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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8844DC7EE2E for ; Fri, 9 Jun 2023 14:51:51 +0000 (UTC) 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=WMSuQkSBXz2/8XUK2Hzsm6ccwlBYll7TkpiqUxZiaf4=; b=i8Q0czci3ESWUl hZ0T+TBCGFkCl9li3fk5BIX9T9Rn/bI51m5afMI3+sxA4atxbx/fPRQg1K0H+kfpl4ofPuw2E+vvE 5CgHic6adhKV8cx7gCCW82Jgg7rp1J7e2h4N6zXuG1TFH8fM7sXcQEWBt0dyWrmljb6N0He9R5UAj 9FlI7OSYCxcWiaJSvEmSIdQ/FOmtEmXiap5WCLlAEWGmcxs6LfvYpq2LwH+I6A7w0y1odx9hKEEZP eGvVcPPJM95fmolPoSY9XIc4ayPR8osvUQYjXL4CRqn92llAx2BJany6fVIZ2SxI0Cvf6ykinKj9V RsHXBO05n02uIGsNJm9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7dSY-00DKnJ-0v; Fri, 09 Jun 2023 14:51:26 +0000 Received: from out-40.mta0.migadu.com ([91.218.175.40]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7dST-00DKjo-2u for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2023 14:51:25 +0000 Date: Fri, 9 Jun 2023 14:51:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1686322274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ugtlLEv+hNjZV95DRBMsv7OADrgkWrCWZxoVXaMhWzM=; b=wl6Gjiblbj7fO7EYBkWbx3a+IBk/MtpnHPpaMubTxoj53g8s2Rcx5xm94W51E8Oty9MV90 cvORNsoiQS5rS0pvl5s4vyD4mD83CYpo+bTyXAxRUZ8YydHp9RQxnxX2HDpIuwP3m6CXIO yTZCuO9vIGnNChBfIdcd4VlXZosEqHw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Chun-Tse Shao Cc: linux-kernel@vger.kernel.org, yuzhao@google.com, Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Ben Gardon , Gavin Shan , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v1 3/3] KVM: arm64: Using rcu_read_lock() for kvm_pgtable_stage2_mkyoung() Message-ID: References: <20230608220558.39094-1-ctshao@google.com> <20230608220558.39094-4-ctshao@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230608220558.39094-4-ctshao@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_075122_373080_0AA04FB1 X-CRM114-Status: GOOD ( 11.76 ) 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, Jun 08, 2023 at 03:05:41PM -0700, Chun-Tse Shao wrote: > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 3b9d4d24c361..0f7ea66fb894 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -1437,10 +1437,10 @@ static void handle_access_fault(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa) > > trace_kvm_access_fault(fault_ipa); > > - read_lock(&vcpu->kvm->mmu_lock); > + rcu_read_lock(); > mmu = vcpu->arch.hw_mmu; > pte = kvm_pgtable_stage2_mkyoung(mmu->pgt, fault_ipa); > - read_unlock(&vcpu->kvm->mmu_lock); > + rcu_read_unlock(); What is the point of acquiring the RCU read lock here? kvm_pgtable_walk_{begin,end}() already do the exact same for any 'shared' walk. I agree with Marc that this warrants some very clear benchmark data showing the value of the change. As I had mentioned to Yu, I already implemented this for my own purposes, but wasn't able to see a significant improvement over acquiring the MMU lock for read. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel