All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: Yu Zhao <yuzhao@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Michael Larabel <michael@michaellarabel.com>,
	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
Subject: Re: [PATCH mm-unstable v1 3/5] kvm/arm64: add kvm_arch_test_clear_young()
Date: Fri, 17 Feb 2023 08:00:08 -0800	[thread overview]
Message-ID: <Y++kiJwUIh55jkvl@google.com> (raw)
In-Reply-To: <Y+9EUeUIS/ZUe2vw@linux.dev>

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 <yuzhao@google.com>
> > ---
> >  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.

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: linux-mm@google.com, Yu Zhao <yuzhao@google.com>,
	kvm@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Michael Larabel <michael@michaellarabel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kvmarm@lists.linux.dev, Paolo Bonzini <pbonzini@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH mm-unstable v1 3/5] kvm/arm64: add kvm_arch_test_clear_young()
Date: Fri, 17 Feb 2023 08:00:08 -0800	[thread overview]
Message-ID: <Y++kiJwUIh55jkvl@google.com> (raw)
In-Reply-To: <Y+9EUeUIS/ZUe2vw@linux.dev>

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 <yuzhao@google.com>
> > ---
> >  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.

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: Yu Zhao <yuzhao@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Michael Larabel <michael@michaellarabel.com>,
	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
Subject: Re: [PATCH mm-unstable v1 3/5] kvm/arm64: add kvm_arch_test_clear_young()
Date: Fri, 17 Feb 2023 08:00:08 -0800	[thread overview]
Message-ID: <Y++kiJwUIh55jkvl@google.com> (raw)
In-Reply-To: <Y+9EUeUIS/ZUe2vw@linux.dev>

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 <yuzhao@google.com>
> > ---
> >  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

  reply	other threads:[~2023-02-17 16:00 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  4:12 [PATCH mm-unstable v1 0/5] mm/kvm: lockless accessed bit harvest Yu Zhao
2023-02-17  4:12 ` Yu Zhao
2023-02-17  4:12 ` Yu Zhao
2023-02-17  4:12 ` [PATCH mm-unstable v1 1/5] mm/kvm: add mmu_notifier_test_clear_young() Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-23 17:13   ` Sean Christopherson
2023-02-23 17:13     ` Sean Christopherson
2023-02-23 17:13     ` Sean Christopherson
2023-02-23 17:40     ` Yu Zhao
2023-02-23 17:40       ` Yu Zhao
2023-02-23 17:40       ` Yu Zhao
2023-02-23 21:12       ` Sean Christopherson
2023-02-23 21:12         ` Sean Christopherson
2023-02-23 21:12         ` Sean Christopherson
2023-02-23 17:34   ` Sean Christopherson
2023-02-23 17:34     ` Sean Christopherson
2023-02-23 17:34     ` Sean Christopherson
2023-02-17  4:12 ` [PATCH mm-unstable v1 2/5] kvm/x86: add kvm_arch_test_clear_young() Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:19   ` Yu Zhao
2023-02-17  4:19     ` Yu Zhao
2023-02-17  4:19     ` Yu Zhao
2023-02-17 16:27   ` Sean Christopherson
2023-02-17 16:27     ` Sean Christopherson
2023-02-17 16:27     ` Sean Christopherson
2023-02-23  5:58     ` Yu Zhao
2023-02-23  5:58       ` Yu Zhao
2023-02-23  5:58       ` Yu Zhao
2023-02-23 17:09       ` Sean Christopherson
2023-02-23 17:09         ` Sean Christopherson
2023-02-23 17:09         ` Sean Christopherson
2023-02-23 17:27         ` Yu Zhao
2023-02-23 17:27           ` Yu Zhao
2023-02-23 17:27           ` Yu Zhao
2023-02-23 18:23           ` Sean Christopherson
2023-02-23 18:23             ` Sean Christopherson
2023-02-23 18:23             ` Sean Christopherson
2023-02-23 18:34             ` Yu Zhao
2023-02-23 18:34               ` Yu Zhao
2023-02-23 18:34               ` Yu Zhao
2023-02-23 18:47               ` Sean Christopherson
2023-02-23 18:47                 ` Sean Christopherson
2023-02-23 18:47                 ` Sean Christopherson
2023-02-23 19:02                 ` Yu Zhao
2023-02-23 19:02                   ` Yu Zhao
2023-02-23 19:02                   ` Yu Zhao
2023-02-23 19:21                   ` Sean Christopherson
2023-02-23 19:21                     ` Sean Christopherson
2023-02-23 19:21                     ` Sean Christopherson
2023-02-23 19:25                     ` Yu Zhao
2023-02-23 19:25                       ` Yu Zhao
2023-02-23 19:25                       ` Yu Zhao
2023-02-17  4:12 ` [PATCH mm-unstable v1 3/5] kvm/arm64: " Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:21   ` Yu Zhao
2023-02-17  4:21     ` Yu Zhao
2023-02-17  4:21     ` Yu Zhao
2023-02-17  9:00     ` Marc Zyngier
2023-02-17  9:00       ` Marc Zyngier
2023-02-17  9:00       ` Marc Zyngier
2023-02-23  3:58       ` Yu Zhao
2023-02-23  3:58         ` Yu Zhao
2023-02-23  3:58         ` Yu Zhao
2023-02-23  9:03         ` Marc Zyngier
2023-02-23  9:03           ` Marc Zyngier
2023-02-23  9:03           ` Marc Zyngier
2023-02-23  9:18           ` Yu Zhao
2023-02-23  9:18             ` Yu Zhao
2023-02-23  9:18             ` Yu Zhao
2023-02-17  9:09   ` Oliver Upton
2023-02-17  9:09     ` Oliver Upton
2023-02-17  9:09     ` Oliver Upton
2023-02-17 16:00     ` Sean Christopherson [this message]
2023-02-17 16:00       ` Sean Christopherson
2023-02-17 16:00       ` Sean Christopherson
2023-02-23  5:25       ` Yu Zhao
2023-02-23  5:25         ` Yu Zhao
2023-02-23  5:25         ` Yu Zhao
2023-02-23  4:43     ` Yu Zhao
2023-02-23  4:43       ` Yu Zhao
2023-02-23  4:43       ` Yu Zhao
2023-02-17  4:12 ` [PATCH mm-unstable v1 4/5] kvm/powerpc: " Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:24   ` Yu Zhao
2023-02-17  4:24     ` Yu Zhao
2023-02-17  4:24     ` Yu Zhao
2023-02-17  4:12 ` [PATCH mm-unstable v1 5/5] mm: multi-gen LRU: use mmu_notifier_test_clear_young() Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-17  4:12   ` Yu Zhao
2023-02-23 17:43   ` Sean Christopherson
2023-02-23 17:43     ` Sean Christopherson
2023-02-23 17:43     ` Sean Christopherson
2023-02-23 18:08     ` Yu Zhao
2023-02-23 18:08       ` Yu Zhao
2023-02-23 18:08       ` Yu Zhao
2023-02-23 19:11       ` Sean Christopherson
2023-02-23 19:11         ` Sean Christopherson
2023-02-23 19:11         ` Sean Christopherson
2023-02-23 19:36         ` Yu Zhao
2023-02-23 19:36           ` Yu Zhao
2023-02-23 19:36           ` Yu Zhao
2023-02-23 19:58           ` Sean Christopherson
2023-02-23 19:58             ` Sean Christopherson
2023-02-23 19:58             ` Sean Christopherson
2023-02-23 20:09             ` Yu Zhao
2023-02-23 20:09               ` Yu Zhao
2023-02-23 20:09               ` Yu Zhao
2023-02-23 20:28               ` Sean Christopherson
2023-02-23 20:28                 ` Sean Christopherson
2023-02-23 20:28                 ` Sean Christopherson
2023-02-23 20:48                 ` Yu Zhao
2023-02-23 20:48                   ` Yu Zhao
2023-02-23 20:48                   ` Yu Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y++kiJwUIh55jkvl@google.com \
    --to=seanjc@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@google.com \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=michael@michaellarabel.com \
    --cc=oliver.upton@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=x86@kernel.org \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.