From: Oliver Upton <oliver.upton@linux.dev>
To: Ricardo Koller <ricarkol@google.com>
Cc: ricarkol@gmail.com, kvm@vger.kernel.org, catalin.marinas@arm.com,
kvmarm@lists.linux.dev, andrew.jones@linux.dev,
bgardon@google.com, maz@kernel.org, dmatlack@google.com,
pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu
Subject: Re: [RFC PATCH 01/12] KVM: arm64: Relax WARN check in stage2_make_pte()
Date: Mon, 14 Nov 2022 20:59:13 +0000 [thread overview]
Message-ID: <Y3KsIUpKISgYRAV9@google.com> (raw)
In-Reply-To: <20221112081714.2169495-2-ricarkol@google.com>
Hi Ricardo,
On Sat, Nov 12, 2022 at 08:17:03AM +0000, Ricardo Koller wrote:
> stage2_make_pte() throws a warning when used in a non-shared walk, as PTEs
> are not "locked" when walking non-shared. Add a check so it can be used
> non-shared.
>
> Signed-off-by: Ricardo Koller <ricarkol@google.com>
I would very much prefer to leave this WARN as-is. Correct me if I am
wrong, but I do not believe this warning is firing with the existing
code.
While the locking portion doesn't make a whole lot of sense for a
non-shared walk, it is also a magic value that indicates we've already
done the break side of break-before-make. If the warning fires then that
would suggest our break-before-make implementation isn't working as
expected.
--
Thanks,
Oliver
> ---
> arch/arm64/kvm/hyp/pgtable.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index c12462439e70..b16107bf917c 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -733,7 +733,8 @@ static void stage2_make_pte(const struct kvm_pgtable_visit_ctx *ctx, kvm_pte_t n
> {
> struct kvm_pgtable_mm_ops *mm_ops = ctx->mm_ops;
>
> - WARN_ON(!stage2_pte_is_locked(*ctx->ptep));
> + if (kvm_pgtable_walk_shared(ctx))
> + WARN_ON(!stage2_pte_is_locked(*ctx->ptep));
>
> if (stage2_pte_is_counted(new))
> mm_ops->get_page(ctx->ptep);
> --
> 2.38.1.431.g37b22c650d-goog
>
>
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: Oliver Upton <oliver.upton@linux.dev>
To: Ricardo Koller <ricarkol@google.com>
Cc: pbonzini@redhat.com, maz@kernel.org, dmatlack@google.com,
qperret@google.com, catalin.marinas@arm.com,
andrew.jones@linux.dev, seanjc@google.com,
alexandru.elisei@arm.com, suzuki.poulose@arm.com,
eric.auger@redhat.com, gshan@redhat.com, reijiw@google.com,
rananta@google.com, bgardon@google.com, kvm@vger.kernel.org,
kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu,
ricarkol@gmail.com
Subject: Re: [RFC PATCH 01/12] KVM: arm64: Relax WARN check in stage2_make_pte()
Date: Mon, 14 Nov 2022 20:59:13 +0000 [thread overview]
Message-ID: <Y3KsIUpKISgYRAV9@google.com> (raw)
Message-ID: <20221114205913.xD1o5G7ixh4xKXow8rGJHKWNLu56vx_eTtJLqU1V5gA@z> (raw)
In-Reply-To: <20221112081714.2169495-2-ricarkol@google.com>
Hi Ricardo,
On Sat, Nov 12, 2022 at 08:17:03AM +0000, Ricardo Koller wrote:
> stage2_make_pte() throws a warning when used in a non-shared walk, as PTEs
> are not "locked" when walking non-shared. Add a check so it can be used
> non-shared.
>
> Signed-off-by: Ricardo Koller <ricarkol@google.com>
I would very much prefer to leave this WARN as-is. Correct me if I am
wrong, but I do not believe this warning is firing with the existing
code.
While the locking portion doesn't make a whole lot of sense for a
non-shared walk, it is also a magic value that indicates we've already
done the break side of break-before-make. If the warning fires then that
would suggest our break-before-make implementation isn't working as
expected.
--
Thanks,
Oliver
> ---
> arch/arm64/kvm/hyp/pgtable.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index c12462439e70..b16107bf917c 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -733,7 +733,8 @@ static void stage2_make_pte(const struct kvm_pgtable_visit_ctx *ctx, kvm_pte_t n
> {
> struct kvm_pgtable_mm_ops *mm_ops = ctx->mm_ops;
>
> - WARN_ON(!stage2_pte_is_locked(*ctx->ptep));
> + if (kvm_pgtable_walk_shared(ctx))
> + WARN_ON(!stage2_pte_is_locked(*ctx->ptep));
>
> if (stage2_pte_is_counted(new))
> mm_ops->get_page(ctx->ptep);
> --
> 2.38.1.431.g37b22c650d-goog
>
>
next prev parent reply other threads:[~2022-11-14 20:59 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 8:17 [RFC PATCH 00/12] KVM: arm64: Eager huge-page splitting for dirty-logging Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 01/12] KVM: arm64: Relax WARN check in stage2_make_pte() Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-14 20:59 ` Oliver Upton [this message]
2022-11-14 20:59 ` Oliver Upton
2022-11-12 8:17 ` [RFC PATCH 02/12] KVM: arm64: Allow visiting block PTEs in post-order Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-14 18:48 ` Oliver Upton
2022-11-14 18:48 ` Oliver Upton
2023-01-13 3:44 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 03/12] KVM: arm64: Add stage2_create_removed() Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 04/12] KVM: arm64: Add kvm_pgtable_stage2_split() Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-14 20:54 ` Oliver Upton
2022-11-14 20:54 ` Oliver Upton
2022-11-15 23:03 ` Ricardo Koller
2022-11-15 23:03 ` Ricardo Koller
2022-11-15 23:27 ` Ricardo Koller
2022-11-15 23:27 ` Ricardo Koller
2022-11-15 23:54 ` Oliver Upton
2022-11-15 23:54 ` Oliver Upton
2022-11-17 21:50 ` Ricardo Koller
2022-11-17 21:50 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 05/12] arm64: Add a capability for FEAT_BBM level 2 Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 06/12] KVM: arm64: Split block PTEs without using break-before-make Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-14 18:56 ` Oliver Upton
2022-11-14 18:56 ` Oliver Upton
2022-11-12 8:17 ` [RFC PATCH 07/12] KVM: arm64: Refactor kvm_arch_commit_memory_region() Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 08/12] KVM: arm64: Add kvm_uninit_stage2_mmu() Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 09/12] KVM: arm64: Split huge pages when dirty logging is enabled Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 10/12] KVM: arm64: Open-code kvm_mmu_write_protect_pt_masked() Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 11/12] KVM: arm64: Split huge pages during KVM_CLEAR_DIRTY_LOG Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-12 8:17 ` [RFC PATCH 12/12] KVM: arm64: Use local TLBI on permission relaxation Ricardo Koller
2022-11-12 8:17 ` Ricardo Koller
2022-11-14 18:42 ` [RFC PATCH 00/12] KVM: arm64: Eager huge-page splitting for dirty-logging Oliver Upton
2022-11-14 18:42 ` Oliver Upton
2023-01-13 3:42 ` Ricardo Koller
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=Y3KsIUpKISgYRAV9@google.com \
--to=oliver.upton@linux.dev \
--cc=andrew.jones@linux.dev \
--cc=bgardon@google.com \
--cc=catalin.marinas@arm.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=ricarkol@gmail.com \
--cc=ricarkol@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.