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 E2DCEC05027 for ; Fri, 17 Feb 2023 16:01:25 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tCNZqD6VwR75mH1Y0AC7aFQwdqsyN+ZM8WhENyNmpH8=; b=WlfNm8SpdbXK2g37imz6qw8EbD jDe0UW4NCiRL2nZHJnDyrcTWB7SslBA6bi1xTQLxrNRPm9EaT7OK53Yu/we9Fo0ZQmUpc56ZXwb2N eZvpm9DC7Z9oAIJZT8N6xrTdnmZC3vRnW3CyZ3Lvs+UaQuR1HdRBEld38dikbatFjTWF2kfjViqlh pz9f5dAgyy5lRu5uAGZJ8HY1RDLuibopgBhDtGyRBVjKNUjRdp1s+S7GtnpXRYoZ6LGMvfJBIzedG 8tODGhk+mT7V1/JyjIUmAGGlASUdZmY2NYc34mL4cL0j6IXwxqRzaLzKDDFZVvwYraI2B7U6ObFbg 1a49CoOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pT39p-00ExZF-R0; Fri, 17 Feb 2023 16:00:21 +0000 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pT39f-00ExQ5-W5 for linux-arm-kernel@lists.infradead.org; Fri, 17 Feb 2023 16:00:13 +0000 Received: by mail-pf1-x44a.google.com with SMTP id cq5-20020a056a00330500b00593e2189278so370208pfb.19 for ; Fri, 17 Feb 2023 08:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+ASrBAOfhB8V2b1UWnVkBSljvQtym3PPwSnuFL8RngU=; b=sUkblHuJ9dulsxh4CZcm+FIp/qRpAAcmRtfvp6ULnSXppIvCitchjm1OUit+QXJRWj fwJ7Xd7LeD3Frj7FzM+U/mMAyXTZ8R5RK0CcMGNMR8PLROcI0/4xgADL5vqH5U+/VYgG dkLQqFX5fKeKJhpV5Gz8z+39KNbu/jjFTFfYD8mmFsM5kC/nK+Gp9BDhC26xn+icV0pC bHQSk7Mqvc6fB6p4dz8MrdQupt1NEggpWvfcZBir6hbXow/Kay6VqXDNaQVda+8NmyZ/ DJpPCojT4dj2fTwoDxf+msJ00C5RYvwVAx1bbgonDLlmp6LfYVABRQ30VMxJGXDgaHEA nfVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+ASrBAOfhB8V2b1UWnVkBSljvQtym3PPwSnuFL8RngU=; b=nm6VnWFwiMVCtLeTckmomwEKExp+N/5GnXWOO6F+53PKappOKRocPWUWtGmtffVKHH 6Qa1dzEWs3sOjtB9RloC9DE2rNTJH1smEq4PmtuNjw39d49oJNV54QRDJgUabW67Qhpu xZgPqf97U8BAqee/O92hlefRKQRRqiFE9FC3Z4cQVME3g899oCw/DSKpWs2gceU9Be98 QPgagYar9dKZlulVBnfIQhfkh8o2KEAwhooR/3fjR0orml24kBmIsPhRM5UQ5S2MiYcX vaM/iNKAFO1VB7OGCD0ejmAD35Vupt21PS5MzJyIdoiy3or8gc0lbpPdBw+kOHG5AUPh ViSw== X-Gm-Message-State: AO0yUKW4dYDcaiPEYjV2e60SsF4xsgqnLq790sQrAqZwDyMf3qk8Jhoc NjKHgIcd6dlTnQ2ofwtfoNwwovJ6E2I= X-Google-Smtp-Source: AK7set/TQ5moWaaNQcL8V8kGjN9B7zl+2zJIJ8kumCX3x4I/RGgInnGSIHRIAYNv9fJ3WTWtfSDyzLo0yfI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a02:43:b0:4fd:72f3:5859 with SMTP id az3-20020a056a02004300b004fd72f35859mr296462pgb.2.1676649609963; Fri, 17 Feb 2023 08:00:09 -0800 (PST) Date: Fri, 17 Feb 2023 08:00:08 -0800 In-Reply-To: Mime-Version: 1.0 References: <20230217041230.2417228-1-yuzhao@google.com> <20230217041230.2417228-4-yuzhao@google.com> Message-ID: Subject: Re: [PATCH mm-unstable v1 3/5] kvm/arm64: add kvm_arch_test_clear_young() From: Sean Christopherson To: Oliver Upton Cc: Yu Zhao , Andrew Morton , Paolo Bonzini , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230217_080012_078217_6BF7B9D7 X-CRM114-Status: GOOD ( 31.54 ) 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 Fri, Feb 17, 2023, Oliver Upton wrote: > Hi Yu, > > scripts/get_maintainers.pl is your friend for getting the right set of > emails for a series :) Don't know about others, but generally I would > prefer to be Cc'ed on an entire series (to gather context) than just an > individual patch. +1 > > On Thu, Feb 16, 2023 at 09:12:28PM -0700, 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. At least for the x86 changes, please read Documentation/process/maintainer-tip.rst and rewrite the changelogs. > > It relies on two techniques, RCU and cmpxchg, to safely test and clear > > 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(-) > > > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > > index 35a159d131b5..572bcd321586 100644 > > --- a/arch/arm64/include/asm/kvm_host.h > > +++ b/arch/arm64/include/asm/kvm_host.h > > @@ -1031,4 +1031,11 @@ static inline void kvm_hyp_reserve(void) { } > > void kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu); > > bool kvm_arm_vcpu_stopped(struct kvm_vcpu *vcpu); > > > > +/* see the comments on the generic kvm_arch_has_test_clear_young() */ Please eliminate all of these "see the comments on blah", in every case they do nothing more than redirect the reader to something they're likely already aware of. > > +#define kvm_arch_has_test_clear_young kvm_arch_has_test_clear_young > > +static inline bool kvm_arch_has_test_clear_young(void) > > +{ > > + return IS_ENABLED(CONFIG_KVM) && cpu_has_hw_af() && !is_protected_kvm_enabled(); > > +} ... > Also, I'm at a loss for why we'd need to test if CONFIG_KVM is enabled. > My expectation is that we should provide an implementation that returns > false if !CONFIG_KVM, avoiding the need to repeat that bit in every > single implementation of the function. mm/vmscan.c uses kvm_arch_has_test_clear_young(). I have opinions on that, but I'll hold off on expressing them until there's actual justification presented somewhere. Yu, this series and each patch needs a big pile of "why". I get that the goal is to optimize memory oversubscribe, but there needs to be justification for why this is KVM only, why nested VMs and !A/D hardware are out of scope, why yet another mmu_notifier hook is being added, etc. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel