From: Oliver Upton <oliver.upton@linux•dev>
To: Yu Zhao <yuzhao@google•com>
Cc: Andrew Morton <akpm@linux-foundation•org>,
Paolo Bonzini <pbonzini@redhat•com>,
Alistair Popple <apopple@nvidia•com>,
Anup Patel <anup@brainfault•org>, Ben Gardon <bgardon@google•com>,
Borislav Petkov <bp@alien8•de>,
Catalin Marinas <catalin.marinas@arm•com>,
Chao Peng <chao.p.peng@linux•intel.com>,
Christophe Leroy <christophe.leroy@csgroup•eu>,
Dave Hansen <dave.hansen@linux•intel.com>,
Fabiano Rosas <farosas@linux•ibm.com>,
Gaosheng Cui <cuigaosheng1@huawei•com>,
Gavin Shan <gshan@redhat•com>, "H. Peter Anvin" <hpa@zytor•com>,
Ingo Molnar <mingo@redhat•com>, James Morse <james.morse@arm•com>,
"Jason A. Donenfeld" <Jason@zx2c4•com>,
Jason Gunthorpe <jgg@ziepe•ca>, Jonathan Corbet <corbet@lwn•net>,
Marc Zyngier <maz@kernel•org>,
Masami Hiramatsu <mhiramat@kernel•org>,
Michael Ellerman <mpe@ellerman•id.au>,
Michael Larabel <michael@michaellarabel•com>,
Mike Rapoport <rppt@kernel•org>,
Nicholas Piggin <npiggin@gmail•com>,
Paul Mackerras <paulus@ozlabs•org>, Peter Xu <peterx@redhat•com>,
Sean Christopherson <seanjc@google•com>,
Steven Rostedt <rostedt@goodmis•org>,
Suzuki K Poulose <suzuki.poulose@arm•com>,
Thomas Gleixner <tglx@linutronix•de>,
Thomas Huth <thuth@redhat•com>, Will Deacon <will@kernel•org>,
Zenghui Yu <yuzenghui@huawei•com>,
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,
linuxppc-dev@lists•ozlabs.org,
linux-trace-kernel@vger•kernel.org, x86@kernel•org,
linux-mm@google•com
Subject: Re: [PATCH mm-unstable v2 04/10] kvm/arm64: make stage2 page tables RCU safe
Date: Wed, 31 May 2023 23:22:53 +0000 [thread overview]
Message-ID: <ZHfWzX04GlcNngdU@linux.dev> (raw)
In-Reply-To: <CAOUHufZrfnfcbrqSzmHkejR5MA2gmGKZ3LMRhbLHV+1427z=Tw@mail.gmail.com>
On Wed, May 31, 2023 at 05:10:52PM -0600, Yu Zhao wrote:
> On Wed, May 31, 2023 at 1:28 PM Oliver Upton <oliver.upton@linux•dev> wrote:
> > On Tue, May 30, 2023 at 02:06:55PM -0600, Yu Zhao wrote:
> > > On Tue, May 30, 2023 at 1:37 PM Oliver Upton <oliver.upton@linux•dev> wrote:
> > > > As it is currently implemented, yes. But, there's potential to fast-path
> > > > the implementation by checking page_count() before starting the walk.
> > >
> > > Do you mind posting another patch? I'd be happy to ack it, as well as
> > > the one you suggested above.
> >
> > I'd rather not take such a patch independent of the test_clear_young
> > series if you're OK with that. Do you mind implementing something
> > similar to the above patch w/ the proposed optimization if you need it?
>
> No worries. I can take the above together with the following, which
> would form a new series with its own merits, since apparently you
> think the !AF case is important.
Sorry if my suggestion was unclear.
I thought we were talking about ->free_removed_table() being called from
the stage-2 unmap path, in which case we wind up unnecessarily visiting
PTEs on a table known to be empty. You could fast-path that by only
initiating a walk if page_count() > 1:
diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index 95dae02ccc2e..766563dc465c 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -1331,7 +1331,8 @@ void kvm_pgtable_stage2_free_removed(struct kvm_pgtable_mm_ops *mm_ops, void *pg
.end = kvm_granule_size(level),
};
- WARN_ON(__kvm_pgtable_walk(&data, mm_ops, ptep, level + 1));
+ if (mm_ops->page_count(pgtable) > 1)
+ WARN_ON(__kvm_pgtable_walk(&data, mm_ops, ptep, level + 1));
WARN_ON(mm_ops->page_count(pgtable) != 1);
mm_ops->put_page(pgtable);
A lock-free access fault walker is interesting, but in my testing it hasn't
led to any significant improvements over acquiring the MMU lock for
read. Because of that I hadn't bothered with posting the series upstream.
--
Thanks,
Oliver
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-05-31 23:23 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 23:44 [PATCH mm-unstable v2 00/10] mm/kvm: locklessly clear the accessed bit Yu Zhao
2023-05-26 23:44 ` [PATCH mm-unstable v2 01/10] mm/kvm: add mmu_notifier_ops->test_clear_young() Yu Zhao
2023-06-06 8:34 ` Tzung-Bi Shih
2023-06-09 1:00 ` Yu Zhao
[not found] ` <ZHedMX470b7EMwbe@ziepe.ca>
2023-06-09 9:04 ` Paolo Bonzini
2023-06-15 17:42 ` Sean Christopherson
2023-06-20 7:30 ` Nicholas Piggin
2023-05-26 23:44 ` [PATCH mm-unstable v2 02/10] mm/kvm: use mmu_notifier_ops->test_clear_young() Yu Zhao
2023-05-26 23:44 ` [PATCH mm-unstable v2 03/10] kvm/arm64: export stage2_try_set_pte() and macros Yu Zhao
2023-05-26 23:44 ` [PATCH mm-unstable v2 04/10] kvm/arm64: make stage2 page tables RCU safe Yu Zhao
2023-05-27 18:08 ` Oliver Upton
2023-05-27 20:13 ` Yu Zhao
2023-05-30 19:37 ` Oliver Upton
2023-05-30 20:06 ` Yu Zhao
[not found] ` <ZHef0VsZvZ1Vnz0u@linux.dev>
2023-05-31 23:10 ` Yu Zhao
2023-05-31 23:22 ` Oliver Upton [this message]
2023-05-31 23:41 ` Yu Zhao
2023-05-26 23:44 ` [PATCH mm-unstable v2 05/10] kvm/arm64: add kvm_arch_test_clear_young() Yu Zhao
[not found] ` <ZHemUc3DiSbxQbxJ@linux.dev>
2023-05-31 21:12 ` Yu Zhao
2023-05-26 23:44 ` [PATCH mm-unstable v2 06/10] kvm/powerpc: make radix page tables RCU safe Yu Zhao
2023-06-20 6:32 ` Nicholas Piggin
2023-06-20 8:00 ` Yu Zhao
2023-06-20 10:49 ` Nicholas Piggin
2023-05-26 23:44 ` [PATCH mm-unstable v2 07/10] kvm/powerpc: add kvm_arch_test_clear_young() Yu Zhao
2023-06-20 7:47 ` Nicholas Piggin
2023-06-21 0:38 ` Yu Zhao
2023-06-21 2:51 ` Nicholas Piggin
2023-05-26 23:44 ` [PATCH mm-unstable v2 08/10] kvm/x86: move tdp_mmu_enabled and shadow_accessed_mask Yu Zhao
2023-06-15 16:59 ` Sean Christopherson
2023-05-26 23:44 ` [PATCH mm-unstable v2 09/10] kvm/x86: add kvm_arch_test_clear_young() Yu Zhao
2023-06-09 9:06 ` Paolo Bonzini
2023-06-15 18:26 ` Sean Christopherson
2023-05-26 23:44 ` [PATCH mm-unstable v2 10/10] mm: multi-gen LRU: use mmu_notifier_test_clear_young() Yu Zhao
2023-06-09 0:59 ` kvm/arm64: Spark benchmark Yu Zhao
2023-06-09 13:04 ` Marc Zyngier
2023-06-18 20:11 ` Yu Zhao
2023-06-09 0:59 ` kvm/powerpc: memcached benchmark Yu Zhao
2023-06-09 0:59 ` kvm/x86: multichase benchmark Yu Zhao
2023-06-18 19:19 ` Yu Zhao
2023-06-09 9:07 ` [PATCH mm-unstable v2 00/10] mm/kvm: locklessly clear the accessed bit Paolo Bonzini
2023-06-20 2:19 ` 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=ZHfWzX04GlcNngdU@linux.dev \
--to=oliver.upton@linux$(echo .)dev \
--cc=Jason@zx2c4$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=anup@brainfault$(echo .)org \
--cc=apopple@nvidia$(echo .)com \
--cc=bgardon@google$(echo .)com \
--cc=bp@alien8$(echo .)de \
--cc=catalin.marinas@arm$(echo .)com \
--cc=chao.p.peng@linux$(echo .)intel.com \
--cc=christophe.leroy@csgroup$(echo .)eu \
--cc=corbet@lwn$(echo .)net \
--cc=cuigaosheng1@huawei$(echo .)com \
--cc=dave.hansen@linux$(echo .)intel.com \
--cc=farosas@linux$(echo .)ibm.com \
--cc=gshan@redhat$(echo .)com \
--cc=hpa@zytor$(echo .)com \
--cc=james.morse@arm$(echo .)com \
--cc=jgg@ziepe$(echo .)ca \
--cc=kvm@vger$(echo .)kernel.org \
--cc=kvmarm@lists$(echo .)linux.dev \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-doc@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mm@google$(echo .)com \
--cc=linux-mm@kvack$(echo .)org \
--cc=linux-trace-kernel@vger$(echo .)kernel.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=maz@kernel$(echo .)org \
--cc=mhiramat@kernel$(echo .)org \
--cc=michael@michaellarabel$(echo .)com \
--cc=mingo@redhat$(echo .)com \
--cc=mpe@ellerman$(echo .)id.au \
--cc=npiggin@gmail$(echo .)com \
--cc=paulus@ozlabs$(echo .)org \
--cc=pbonzini@redhat$(echo .)com \
--cc=peterx@redhat$(echo .)com \
--cc=rostedt@goodmis$(echo .)org \
--cc=rppt@kernel$(echo .)org \
--cc=seanjc@google$(echo .)com \
--cc=suzuki.poulose@arm$(echo .)com \
--cc=tglx@linutronix$(echo .)de \
--cc=thuth@redhat$(echo .)com \
--cc=will@kernel$(echo .)org \
--cc=x86@kernel$(echo .)org \
--cc=yuzenghui@huawei$(echo .)com \
--cc=yuzhao@google$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox