From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DD34C4338F for ; Tue, 3 Aug 2021 11:52:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E83860C3F for ; Tue, 3 Aug 2021 11:52:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0E83860C3F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MiRi6a6FCuu3RjZaTI6C3kbyJHqxsMvXyHqYpoCsuRA=; b=MKOnx8Z2iD7M9s NiKNV3pRiaBBy20BUopV+Iz7BjIzFpH60KrmZxpBHp53EgBlx1iS/ug04D7k/SrY4PvWxnsgAUIBU cMji2Cu4hE9PwPgrivvEHUoLMiqKLVdl/18cPnrL4WjeS5bC5Cwg0gQuJNNXtogG+HO/mndHyrqhY VgU1IXIF9OciyvgrIZMmThB+qZb7uiQMzynE7wNPd8vTXqRwWwSP3CrXtc8p53jeesANiIVOz+p5f 4snmrJIXleHYf/Y3qpNjLWvNgYZvMbUOTADCD6RBIK5L7UDKs+qbggyERu79ONJJYJzcgnxLdPc9O 03Q3SsdOcgj53zPHD9AA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAswN-002OnH-JT; Tue, 03 Aug 2021 11:50:35 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAslC-002K8F-Ie for linux-arm-kernel@lists.infradead.org; Tue, 03 Aug 2021 11:39:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 17CA360BD3; Tue, 3 Aug 2021 11:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627990742; bh=mME2Y3V/e+bRBo+xbl4UW9QXkdNerzgDg+UYaH+HLKI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HV3jZitur7fF0Gywc+XPBQncXgR0TP63CgpxLPROPkzgdPlfCOj1xSDG1Oqy2W6en IaSGccub/3lkMnF1h1q2cAbKUiBJqciCauHUUxQP4RBIOPmKmSedJp1E8ftKlzqYWk lkot2D/XqzZUp/LVVR4MxI2rYAwbvzfSgFoX6ZDIeVIz6xK+6C2DMnFLZX6/GTrjA8 NSjqVj8ulxUwienXToTjFjg9UZx0DRyGfAnSDQHVqV1Qk03iunM55qd1h+kG/lQmqC 9DT0DRQa0DZcZG9pK3cFEVISG/Mbim8DNaVr6GlEufQub8K0J0nDhUNZlSswmGW+hI BjgwNcwiyuaTA== Date: Tue, 3 Aug 2021 12:38:56 +0100 From: Will Deacon To: Shameer Kolothum Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, maz@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, jean-philippe@linaro.org, Alexandru.Elisei@arm.com, qperret@google.com, linuxarm@huawei.com Subject: Re: [PATCH v3 1/4] KVM: arm64: Introduce a new VMID allocator for KVM Message-ID: <20210803113856.GA30853@willie-the-truck> References: <20210729104009.382-1-shameerali.kolothum.thodi@huawei.com> <20210729104009.382-2-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210729104009.382-2-shameerali.kolothum.thodi@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_043902_708116_49516952 X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 29, 2021 at 11:40:06AM +0100, Shameer Kolothum wrote: > A new VMID allocator for arm64 KVM use. This is based on > arm64 ASID allocator algorithm. > > One major deviation from the ASID allocator is the way we > flush the context. Unlike ASID allocator, we expect less > frequent rollover in the case of VMIDs. Hence, instead of > marking the CPU as flush_pending and issuing a local context > invalidation on the next context switch, we broadcast TLB > flush + I-cache invalidation over the inner shareable domain > on rollover. > > Signed-off-by: Shameer Kolothum > --- [...] > +void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid) > +{ > + unsigned long flags; > + unsigned int cpu; > + u64 vmid, old_active_vmid; > + > + vmid = atomic64_read(&kvm_vmid->id); > + > + /* > + * Please refer comments in check_and_switch_context() in > + * arch/arm64/mm/context.c. > + */ > + old_active_vmid = atomic64_read(this_cpu_ptr(&active_vmids)); > + if (old_active_vmid && vmid_gen_match(vmid) && > + atomic64_cmpxchg_relaxed(this_cpu_ptr(&active_vmids), > + old_active_vmid, vmid)) > + return; > + > + raw_spin_lock_irqsave(&cpu_vmid_lock, flags); > + > + /* Check that our VMID belongs to the current generation. */ > + vmid = atomic64_read(&kvm_vmid->id); > + if (!vmid_gen_match(vmid)) { > + vmid = new_vmid(kvm_vmid); > + atomic64_set(&kvm_vmid->id, vmid); new_vmid() can just set kvm_vmid->id directly > + } > + > + cpu = smp_processor_id(); Why? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel