Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3511382ybh; Mon, 5 Aug 2019 20:21:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqye2uDmx5R+uFURofOuBScH023ED24kewNe7WbRbH4OvtjYUQDU17fR6Mu1+Oma/0BY2iyv X-Received: by 2002:a17:902:f082:: with SMTP id go2mr988834plb.25.1565061719800; Mon, 05 Aug 2019 20:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565061719; cv=none; d=google.com; s=arc-20160816; b=UKXgiCO3u8TfvdC31O3JRJtmDnKI/WPaiKhwN5AzD3349CJlVoqJCBH7FoEb4gY3jo NZE2VRTvOuu11YD2+21bRyJBtkbdaO7DbNKzaDHIRYArUPfUeYfbX1jMWPQOrrQRC+Ej AQIg0ntWJ3zfi7UK3/DRanca8CDObqG+Z0HzqmGuDeib+xPibQcRuC/8m98XuN8NUTkk /z08Gs0uUXTSI20ev+zgZkOrlE1h84p7OEueLbbwSy33NsndPmdOLi4r2AmWrvgZkT6r ksFKeUcGtdU/Pp4z4632+tALAYURqcO+CRY6URiTurAZAI5dTlXZ8By3SCSL+qOe6xrA NhQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dr2+cEWOTjWIrHgq1rAPpBc6r9tZtYF1YbUnLR69BFg=; b=mvRmXHsPG16XoH10XvGcK5r3F6Hp/BFdaHgn2R3Dg49VoRuGhgBu+fi/KX7oLGNDon vAI1jOA7voJNQg/8K4W7NmPfp3KYjBo7ulkvVDWxeznaACI5UoPlV+XrIRJud0VuOP+d kNpvRGkPkKwBOF7yVxaFlB3WXgK69v7KSzD0YalVZ5BJhz5o8uppohcQ8cq+N2jWt0Fw YzIj5FKESnpq0zlvjuQq9hA9cFiLXu7Mhckyp4/RBsO/eA7l4hBalvdlIjpCHK3pDLT0 gJfEU1eOe4oLSlEndD0G5MiNOjmlGs2G7DHQTZ0t6sX1XDFsee0gYr/JhxTI2dZusjyF zmQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=xQaMHCEu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h26si42062590pgl.398.2019.08.05.20.21.43; Mon, 05 Aug 2019 20:21:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=xQaMHCEu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731514AbfHFDTi (ORCPT + 99 others); Mon, 5 Aug 2019 23:19:38 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34026 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729170AbfHFDTi (ORCPT ); Mon, 5 Aug 2019 23:19:38 -0400 Received: by mail-wm1-f66.google.com with SMTP id w9so7929147wmd.1 for ; Mon, 05 Aug 2019 20:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dr2+cEWOTjWIrHgq1rAPpBc6r9tZtYF1YbUnLR69BFg=; b=xQaMHCEu94MSWV0KnK1zA0WkUuR9+C2JoA7OyFGL1bMhbTfgWoKYiPiBLsiLmW+h+x MQ3B6t0N0TyWSy9h9rZc8F+4VTFAIH8Iedrf8KilAY2c5AOdX2tC2CndcOeVjxSy2GHO GI93PGu9zITG/U5rrHWGkkA5Ju5ktIJiHKkSvIGs+vOJ9Kez1Xb0dI8QvVhhWkfzaKsV tMP55LDR3YYdlt9K21sGMwHzYF9O1rH+IegheKtwbw9tlS2hUgPhoge/HJIJWt3xMgRz uA7D4HcLjXGGPwdp50RKYHh/RJ0kRwQ0JvqWO80/m5fi1DQlNlA09FUD+/020u8Gvf4D 8o6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dr2+cEWOTjWIrHgq1rAPpBc6r9tZtYF1YbUnLR69BFg=; b=gd5s/zkNj3YzeDdWdU+tTcQR+DmXmsj+9JdvB0gD5IAqQOEwoqXGzzAo3PXABjwYeq teG0iHCq6iajbonOtcM59Y4UXuja+3G3e/YaJkbQYjfwFiZ/VJuq/uiXJZqz7AABKiTq StP1UoursbpYR8gtdloMz2uxgdOVC/CLS++ZpIjN0Vc6+nZib7B3G8OAZjtvWUOTMnUe X6S2A8aEgOlJ/cOwOi0BPBB/dbHz3mv2SEaMFuiPIRKR+OLQlflf/VXiF88hB0mcEiK9 Dx8NlHaOgew0q7j7qh5ApGctfBjR6/9aRVMGMwJwK74a9SFpVAATdiZVUBrCv0w0Q0xS oM3g== X-Gm-Message-State: APjAAAXso7VVs0f0hkbU5/Y+VobNgTFJ+ZiX7f8zH2lxSNielNEqrRnw nn9nL2tjw1NqQGbaPUluPstcVu634sYrrc9bjqeFPQ== X-Received: by 2002:a05:600c:254b:: with SMTP id e11mr1313747wma.171.1565061575887; Mon, 05 Aug 2019 20:19:35 -0700 (PDT) MIME-Version: 1.0 References: <20190805134201.2814-1-anup.patel@wdc.com> <20190805134201.2814-12-anup.patel@wdc.com> <21bdde39-8d33-6aae-e729-476ce11406a3@redhat.com> In-Reply-To: <21bdde39-8d33-6aae-e729-476ce11406a3@redhat.com> From: Anup Patel Date: Tue, 6 Aug 2019 08:49:24 +0530 Message-ID: Subject: Re: [PATCH v3 11/19] RISC-V: KVM: Implement VMID allocator To: Paolo Bonzini Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Radim K , Daniel Lezcano , Thomas Gleixner , Atish Patra , Alistair Francis , Damien Le Moal , Christoph Hellwig , "kvm@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 5, 2019 at 9:33 PM Paolo Bonzini wrote: > > On 05/08/19 15:43, Anup Patel wrote: > > + spin_lock(&vmid_lock); > > + > > + /* > > + * We need to re-check the vmid_version here to ensure that if > > + * another vcpu already allocated a valid vmid for this vm. > > + */ > > + if (!kvm_riscv_stage2_vmid_ver_changed(vmid)) { > > + spin_unlock(&vmid_lock); > > + return; > > + } > > + > > + /* First user of a new VMID version? */ > > + if (unlikely(vmid_next == 0)) { > > + WRITE_ONCE(vmid_version, READ_ONCE(vmid_version) + 1); > > + vmid_next = 1; > > + > > + /* > > + * On SMP, we know no other CPUs can use this CPU's or > > + * each other's VMID after forced exit returns since the > > + * vmid_lock blocks them from re-entry to the guest. > > + */ > > + spin_unlock(&vmid_lock); > > + kvm_flush_remote_tlbs(vcpu->kvm); > > + spin_lock(&vmid_lock); > > This comment is not true anymore, so this "if" should become a "while". Sure, I will update in v4. Regards, Anup