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 39FD7C64ED8 for ; Thu, 23 Feb 2023 03:59:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DD786B0072; Wed, 22 Feb 2023 22:59:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3677E6B0073; Wed, 22 Feb 2023 22:59:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 207266B0074; Wed, 22 Feb 2023 22:59:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0A8DF6B0072 for ; Wed, 22 Feb 2023 22:59:29 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C0165AB66E for ; Thu, 23 Feb 2023 03:59:28 +0000 (UTC) X-FDA: 80497202016.24.AE2641B Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.43]) by imf15.hostedemail.com (Postfix) with ESMTP id 8C014A0002 for ; Thu, 23 Feb 2023 03:59:24 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=V4Q5l6WL; spf=pass (imf15.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.43 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677124764; 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=H32nxJKYLFgX94VN5oR58FHUZwCnE+gpSinuTrZzCc0=; b=5ZuQFkvvnTqR9MOKcK/4AxnbWFZlEJhQzusz2KB9StXAahmNVjLvVqy1+fMaeL3EDfMUtv bk++rr5+tGexRpqvowWiu3reIk797sr80JbLLhneycPNTopDiI8/YKU+OapduvjKqD4PAX 8xruuvb8lBoJyRbJAYwDGKyoXoEDl24= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=V4Q5l6WL; spf=pass (imf15.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.43 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677124764; a=rsa-sha256; cv=none; b=TPJ+g93uCgM6DuEm6FAN5TdTwljy88g444jD8c+AFwTsTrWgpQt5rKWat3//mgOaldGWNN Ycd+zUoyVIQ2EDhPxHIZ5FXmYRNjuPaRPiyiK8gLTxvg/j2pqSHVEKNRbPGj+Z3RgDwGDI iE89lcLDezZkeqhhRhp94rpXCNvA4/o= Received: by mail-vs1-f43.google.com with SMTP id v27so5063375vsa.7 for ; Wed, 22 Feb 2023 19:59:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1677124763; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=H32nxJKYLFgX94VN5oR58FHUZwCnE+gpSinuTrZzCc0=; b=V4Q5l6WLAj/WwxnVZRzvheA/iOME8vS7OMCgLQWsVt/tZ1p+FehahQQjYkfBEwnn5l TKqvMJ4ouOnvNtwLpkdvRKTTNQhJdK8GWjwAgSM5gu2EhnU0opER4l31mwe55domXE0w Hh/RGdOf2a1K2z7Re8lyE0yCVzCTzILxkZUcQXewKdfJ3nDh+Cx8jTMdJZGQX0pZkZUY 4CAifutvKd9vpOwllaoBeMHWTAZ8SHL+wtWN3Q2twnpq3HAsmolU0vVpaO0k7gzLbvmc s3sDmxNfwKOsOYTnd2jaudx9jqxs70BYLlpqGNm2hwnZxrqrv9nxqoKIAVBvW5yE8AKf bHlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677124763; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H32nxJKYLFgX94VN5oR58FHUZwCnE+gpSinuTrZzCc0=; b=ICyVBtJu94P4Pab8JGK3thJA5sGQvQp04IWh6qwp8z+v8NGVpoauECg6VxIlTGr81L EaCA2e7X2Pdir7eSZ0RXc2ql2+I8dZnuB3HiwcD1d5ur1yZRReCB1EvvSLGANZM9Lu9E jKqQhBr5oCzTv+KSWCCtfOrXunv8908P1rZUg6utAdbIPJuq0LSeszKYnWhyaJusxzY1 lgLi42CVUd6+3xmmiQBeRA2ny4qqvhCMEe2Zy6ObcxKUVTOo0vosgtX6tFQFEqeYbBIc Wcqn+dc5hHvcLxv7XO3YWgdtfvudQfWyvEyWlMuic5kK7kZJs80h8ElL9Xs4OgxXUTed RRDA== X-Gm-Message-State: AO0yUKWkhKN7tGEYCb4KV1duWoA7aET9u3BFDaYM4tEVPV8eZ5yuziYJ RL3VPqUb/F/sFOlMjewANNtjaXj//muF5fcFQIwEcw== X-Google-Smtp-Source: AK7set8d4Kt8nwIvSPEaytrIpcGaTkhsSfI3kbZZEBvM/1NXFxRlVl/iWmVtGErpsTF5b/RMhuHUh6LwD5LpoKFSFjM= X-Received: by 2002:a1f:aa41:0:b0:412:948:73ff with SMTP id t62-20020a1faa41000000b00412094873ffmr143108vke.13.1677124763494; Wed, 22 Feb 2023 19:59:23 -0800 (PST) MIME-Version: 1.0 References: <20230217041230.2417228-1-yuzhao@google.com> <20230217041230.2417228-4-yuzhao@google.com> <86lekwy8d7.wl-maz@kernel.org> In-Reply-To: <86lekwy8d7.wl-maz@kernel.org> From: Yu Zhao Date: Wed, 22 Feb 2023 20:58:47 -0700 Message-ID: Subject: Re: [PATCH mm-unstable v1 3/5] kvm/arm64: add kvm_arch_test_clear_young() To: Marc Zyngier Cc: Will Deacon , Jonathan Corbet , Michael Larabel , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-mm@google.com, Andrew Morton , Paolo Bonzini Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8C014A0002 X-Rspam-User: X-Stat-Signature: xbxwd3faosig43ccyqancar7ah6e7ycx X-HE-Tag: 1677124764-939283 X-HE-Meta: U2FsdGVkX19wzzchb+jHcFNqL7YFNhGQGoCwQOTrzIqKLNd8w/ewIJWewl4YtLrzx8zVDHeqGi8kswOeqLAUhkqUxtmQ4TMab186dtrE4iDMpee/78kVXMtWa8EqrSYWR7SAmtu9QfHm7/d81Trngdr9YMZ/r9dNJ9EvzqRgfbLQDrvvl1jUZ569Gly0XwGsWOdoz7I10EmB1cf02CoQ5txZanXw4h05v9T71tfrduYAbQ7kdkjhXaI7DXrt2S4h4GU0ho1MZ0ZgWt5S8WhgS22haDRl1S1c8Ng0v4FdlQmFieGcPspLyt87qLN16vS90gac/cSdyx4yHm3bPV0Axyt3eQ/IBLkZSn+yqZzO5cIwoaTQb8W41XC5AR5z4v/D5nniMVukXz/4r6ZsxB6+gJYt9A9koZcCQuKHMzEGpPlMKEn6pMoUjBmVAi8R35kuzryj3w+7MbHv8Ewh53rZ/aTDA8TohYSMyX/c0nj50xd0fnR1Bg/EWRJmnfyYdBSt9aTd8SoLVadfg4LMtM0gvDQ/nft7cwZ2meJNqV4No0SiDNkJlGB78LJeFcy9gaIXqt+GCo2wY5HKB12m/AFhXBF4VF3VciTZKvlLH8ZFnEyEeNISvcgQLvKTdXjfnFpPekKtvfO4llL1dmPbkXGcgfOa3QQkChmA7/sVlf54s3VooRkphJWsMgVqRGkb/UHJ7hYPsbSgYqQcYUIbYBBwe1PhPre74uu90ccjAwudjS0P4xmztOTyXgLsARtlGnLVmUkzz20wLnmaqEN55Y/juofFGQaj1KjcaYfmXMu++cwZc1q/YLwan4IoIF1IJ9QuopBX03uHk4KeoL2ATCNLm0RXc/uuhVjLSpltQ2XAw8oa7ULCY664179sypkNjJGr1KpPu1Oc5t75XZCX80+zeSjkQ/1jZeUKvgIrpRGocC8sP9C6BMaphu4ggqPAiM8lB5nAKEmqAzfSO0IJG/i EsPYlZeH J4l8AA1jsf2ppslt64bvl6LQ/8HKwHdowB+UcnRaBkI6LojhT43/bbA6pIr58QUgXhqhpJltTvWsYr2JHh9IBvp+px7ZrKdkbggEUEFGUYPJVBXSnI3m1XsXwv7YSpvqA1WoQ4lKpfwMTN3sHdqUNfTzcviMHWqZSQBQ6S/2uA6y/5fdmmYhbRNxLd8NzR4MUBWK5xffJFwVs9bPwR7ujqwhnqmDPkJyjCno5toRvdNrh/RfgdSsZWdGs759/IK+yJT9kvIlW36xCII0Y2BQn5ftVdgRZujSwvXGfOID2ds5UqbgD7HJwT6eA62zZnO15D6zXwYzh3cNZhFJntKdT2RhnLIowmU0OLVtWD+1lnA250XhPMfhK6JPRxKRXRKQyfrS35vDs/CVVbf84WsTOXSRuRwq6g1i5imdzrCnc41PpPNDVD9KfyDVVioe9E8sqDVGtApHIn6CoeQRFB05Sel5PKQ5XSp7Zg0lq 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: On Fri, Feb 17, 2023 at 2:00=E2=80=AFAM Marc Zyngier wrote= : > > On Fri, 17 Feb 2023 04:21:28 +0000, > Yu Zhao wrote: > > > > On Thu, Feb 16, 2023 at 9:12 PM Yu Zhao wrote: > > > > > > This patch adds kvm_arch_test_clear_young() for the vast majority of > > > VMs that are not pKVM and run on hardware that sets the accessed bit > > > in KVM page tables. > > I'm really interested in how you can back this statement. 90% of the > HW I have access to is not FEAT_HWAFDB capable, either because it > predates the feature or because the feature is too buggy to be useful. This is my expericen too -- most devices are pre v8.2. > Do you have numbers? Let's do a quick market survey by segment. The following only applies to ARM CPUs: 1. Phones: none of the major Android phone vendors sell phones running VMs; no other major Linux phone vendors. 2. Laptops: only a very limited number of Chromebooks run VMs, namely ACRVM. No other major Linux laptop vendors. 3. Desktops: no major Linux desktop vendors. 4. Embedded/IoT/Router: no major Linux vendors run VMs (Android Auto can be a VM guest on QNX host). 5. Cloud: this is where the vast majority VMs come from. Among the vendors available to the general public, Ampere is the biggest player. Here [1] is a list of its customers. The A-bit works well even on its EVT products (Neoverse cores). [1] https://en.wikipedia.org/wiki/Ampere_Computing > > > It relies on two techniques, RCU and cmpxchg, to safely test and clea= r > > > the accessed bit without taking the MMU lock. The former protects KVM > > > page tables from being freed while the latter clears the accessed bit > > > atomically against both the hardware and other software page table > > > walkers. > > > > > > Signed-off-by: Yu Zhao > > > --- > > > arch/arm64/include/asm/kvm_host.h | 7 +++ > > > arch/arm64/include/asm/kvm_pgtable.h | 8 +++ > > > arch/arm64/include/asm/stage2_pgtable.h | 43 ++++++++++++++ > > > arch/arm64/kvm/arm.c | 1 + > > > arch/arm64/kvm/hyp/pgtable.c | 51 ++-------------- > > > arch/arm64/kvm/mmu.c | 77 +++++++++++++++++++++++= +- > > > 6 files changed, 141 insertions(+), 46 deletions(-) > > > > Adding Marc and Will. > > > > Can you please add other interested parties that I've missed? > > The MAINTAINERS file has it all: > > KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64) > M: Marc Zyngier > M: Oliver Upton > R: James Morse > R: Suzuki K Poulose > R: Zenghui Yu > L: kvmarm@lists.linux.dev > > May I suggest that you repost your patch and Cc the interested > parties yourself? I guess most folks will want to see this in context, > and not as a random, isolated change with no rationale. This clarified it. Thanks. (I was hesitant to spam people with the entire series containing changes to other architectures.)