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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7866C3DA4A for ; Mon, 19 Aug 2024 20:42:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F6F66B008A; Mon, 19 Aug 2024 16:42:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A7366B0092; Mon, 19 Aug 2024 16:42:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46F116B0093; Mon, 19 Aug 2024 16:42:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2563B6B008A for ; Mon, 19 Aug 2024 16:42:07 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CDEC38108D for ; Mon, 19 Aug 2024 20:42:06 +0000 (UTC) X-FDA: 82470167052.16.8F48098 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) by imf28.hostedemail.com (Postfix) with ESMTP id D1B3BC0023 for ; Mon, 19 Aug 2024 20:42:03 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=QjckSWmi; spf=pass (imf28.hostedemail.com: domain of oliver.upton@linux.dev designates 95.215.58.170 as permitted sender) smtp.mailfrom=oliver.upton@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724100046; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9Y168q5crzOyuR0vBXeOnFBth7VvFqg3LAjS8RW/lCM=; b=vqnvhgMWmKJM1czySRKgt7oKjJ4coCyUPJLGAo3bc2cjGx1rBCc/juJjkvaAiOedD02dRn xNFogT0pI4G5LX40RRtU0UU/6TAJ2wPC63UgNn3Iwj5Ak0LJys2ORqtfa5RHTSqyhiu2xh 0D1O2YKdQESEoYS2yfpZrWIdprdywf8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724100046; a=rsa-sha256; cv=none; b=Got2rwKgqI3bwwHvaSOztuFkogJOkDRWBlBT4r7RuVqK2ejQFwRmIPbGQ0zI+7iebpicLB GfJadD8FKZob3exbPuMdrhK5b1RREHLYCrhjlbSnHQyzNqf0QF/2bLF5/1TTJB1L9ciCTo pfsAkmBQn4gjhhZIYNJtuHg0xd7xLrw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=QjckSWmi; spf=pass (imf28.hostedemail.com: domain of oliver.upton@linux.dev designates 95.215.58.170 as permitted sender) smtp.mailfrom=oliver.upton@linux.dev; dmarc=pass (policy=none) header.from=linux.dev Date: Mon, 19 Aug 2024 20:41:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1724100121; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Y168q5crzOyuR0vBXeOnFBth7VvFqg3LAjS8RW/lCM=; b=QjckSWmi/C6logVG6INyLTdl2yFG7ehaLWTfObZBDHmH29dWtGBfep0KYv6Z9gBDYeh9S+ B6R9XRrjvorKQxuRIfjSMJWax726Gq0p6dIEjHG9Ct8t5QfdejAKRHlb7mGX73T27kmL/f 3zLPC94bHuABE9SXOJjRNTeVEwEQcVA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Yu Zhao Cc: Sean Christopherson , James Houghton , Andrew Morton , Paolo Bonzini , Ankit Agrawal , Axel Rasmussen , Catalin Marinas , David Matlack , David Rientjes , James Morse , Jason Gunthorpe , Jonathan Corbet , Marc Zyngier , Raghavendra Rao Ananta , Ryan Roberts , Shaoqin Huang , Suzuki K Poulose , Wei Xu , Will Deacon , Zenghui Yu , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v6 03/11] KVM: arm64: Relax locking for kvm_test_age_gfn and kvm_age_gfn Message-ID: References: <20240724011037.3671523-1-jthoughton@google.com> <20240724011037.3671523-4-jthoughton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Stat-Signature: 5ed3k5sr84rhjxkeakx6epd3x1zzjbuj X-Rspamd-Queue-Id: D1B3BC0023 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1724100123-471359 X-HE-Meta: U2FsdGVkX1/LpwEhy9sMtfejr2Keg0Z9wKIXbvy3BBarp55kqgerFDmbP6lAt3AviTvtaeJJ6dDwYWHo8CAVMdgcgSXMvVHg6FzhbFb/BLZRe1OkIoIA/tBETaJpviGHGN8FM+2BeWNciZ17oUJGVlvW071P+IrpQ8SkQJs0j79xAhUAgfYFfvgDqLibLv3I0D8w9AcPJm9wyZHjqj5caGPEaEbLQYTt0b37PdcKigjrzbcdwqMdBxEyrBqD3JDQxMIl51nyfE3GdQDIJ+mPxqkotqtxDR+uGQgYAa8I3nMj8mgodQypW8gjx71Ug0Vd/ASry+eSgK571/dR5eJGyf1+AL2a9bzAoOQb9ixUz2ou97vzT4CMw5HOsOTSDgR+xAd0aVIuDVQuFLfdKCGygTkNrLEul5CZQDgemaUM+PWbz5INwpjgBH5qph67pxRtY5nwEFeB4DJrbF15IR5xjdJ3pcNfl8ycp7ifA/V39IK7/86YzTejPuc7ws5JNbRwawpqqH2KlLz7WCAd0GbjyyxCcvbHrHnURiRM1mjkh6icPuXu29G4BqbQBkWxv2GhUPvIbaPcbaLCe0CxABt8RQIKpNgmemPzfXMx7nRgNp/j/8TSi/c+cj+3/N7CKHxrEYrCDEkvsoBcpFPYsTIK3wXyec9Ot00hvSJRBmqj5euchW99AZD8SAxAWHqT7Lmqy5vGOtub0KjktSjtiK2CHk7jmAke3syz+3FAbdjjUkGkrtKbUbRIeXd0dfbGpa1h6ab2Oc62Dg6ghXw+nuG/WJbHCcrxA6ABcMeluwA4m051B6N6Ew694j6hwDvIYakBxT57GJGiK6290VME9BlOb3LZz177uGTKvgPs6Aljjvk4AvknLVqQFVLvGPQyLgpKHgJywTSVwZrGuNDxABvXSZJuntHtsEBVXBPQgo3DPtVT8NnWbYjtdR0wLlJw7/akk0uTEfDRQQmCua7OTQv l/Ovs7Fz Jd9XzITUW7sm4XSsO+LOnM/AzpsLu3sDxOTh3zKpnnSGrSLOUjRcc74RAy6V8lDkg2pYONXvL6t1l6sj6huEBRJiDu6AzJV84moGYpSq1PKxO5Hb6lBe6j6WyunmCOyWhNDK3DyUWsBjBBYnRGwExdXpOox7EQiSXXgsJh1UnO1vWqjpvom+MQSNcpO3Jt4ulXKkO82A47bIYo5Khd8l04oZ0o2eRm5hBECsjEWpFBiNRhzUc69eqMNgs1+lyViIL45QqlsZBCpvccR/OkY0l2UR5+Sw+qGdx1Pov X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Aug 16, 2024 at 07:03:27PM -0600, Yu Zhao wrote: > On Fri, Aug 16, 2024 at 6:46 PM Sean Christopherson wrote: [...] > > Were you expecting vCPU runtime to improve (more)? If so, lack of movement could > > be due to KVM arm64 taking mmap_lock for read when handling faults: > > > > https://lore.kernel.org/all/Zr0ZbPQHVNzmvwa6@google.com > > For the above test, I don't think it's mmap_lock Yeah, I don't think this is related to the mmap_lock. James is likely using hardware that has FEAT_HAFDBS, so vCPUs won't fault for an Access flag update. Even if he's on a machine w/o it, Access flag faults are handled outside the mmap_lock. Forcing SW management of the AF at stage-2 would be the best case for demonstrating the locking improvement: diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index a24a2a857456..a640e8a8c6ea 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -669,8 +669,6 @@ u64 kvm_get_vtcr(u64 mmfr0, u64 mmfr1, u32 phys_shift) * happen to be running on a design that has unadvertised support for * HAFDBS. Here be dragons. */ - if (!cpus_have_final_cap(ARM64_WORKAROUND_AMPERE_AC03_CPU_38)) - vtcr |= VTCR_EL2_HA; #endif /* CONFIG_ARM64_HW_AFDBM */ if (kvm_lpa2_is_enabled()) Changing the config option would work too, but I wasn't sure if FEAT_HAFDBS on the primary MMU influenced MGLRU heuristics. > -- the reclaim path, > e.g., when zswapping guest memory, has two stages: aging (scanning > PTEs) and eviction (unmapping PTEs). Only testing the former isn't > realistic at all. AIUI, the intention of this test data is to provide some justification for why Marc + I should consider the locking change *outside* of any MMU notifier changes. So from that POV, this is meant as a hacked up microbenchmark and not meant to be realistic. And really, the arm64 change has nothing to do with this series at this point, which is disappointing. In the interest of moving this feature along for both architectures, would you be able help James with: - Identifying a benchmark that you believe is realistic - Suggestions on how to run that benchmark on Google infrastructure Asking since you had a setup / data earlier on when you were carrying the series. Hopefully with supportive data we can get arm64 to opt-in to HAVE_KVM_MMU_NOTIFIER_YOUNG_FAST_ONLY as well. -- Thanks, Oliver