From: sashiko-bot@kernel.org
To: "Vincent Donnefort" <vdonnefort@google.com>
Cc: "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>,
kvmarm@lists.linux.dev
Subject: Re: [PATCH v2 11/18] KVM: arm64: Add a shrinker for pKVM
Date: Mon, 06 Jul 2026 18:13:03 +0000 [thread overview]
Message-ID: <20260706181304.DE57B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706175415.2604046-12-vdonnefort@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The pKVM memory shrinker is registered before pKVM is finalized, exposing 'pKVM-finalised-only' hypercalls to early execution which triggers a WARN_ON and potential boot panic.
--
commit 32c5640182999493c354bd3285732dfbfa3fd23d
Author: Vincent Donnefort <vdonnefort@google.com>
KVM: arm64: Add a shrinker for pKVM
Integrate the pKVM memory reclaim interface with the host's memory
management subsystem. This allows the host to automatically recover unused
memory fom the hypervisor's heap allocator when the host is under memory
pressure.
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
[ ... ]
> @@ -2713,6 +2715,18 @@ static void pkvm_hyp_init_ptrauth(void)
> }
> }
>
> +static unsigned long
> +pkvm_shrinker_count(struct shrinker *shrink, struct shrink_control *sc)
> +{
> + return pkvm_hyp_reclaimable(PKVM_TOPUP_HYP_ALLOC) ?: SHRINK_EMPTY;
> +}
> +
> +static unsigned long
> +pkvm_shrinker_scan(struct shrinker *shrink, struct shrink_control *sc)
> +{
> + return pkvm_hyp_reclaim(PKVM_TOPUP_HYP_ALLOC, sc->nr_to_scan);
> +}
> +
[ ... ]
> @@ -2883,6 +2897,16 @@ static int __init init_hyp_mode(void)
> kvm_err("Failed to init hyp memory protection\n");
> goto out_err;
> }
> +
> + pkvm_shrinker = shrinker_alloc(0, "pkvm");
> + if (pkvm_shrinker) {
> + pkvm_shrinker->count_objects = pkvm_shrinker_count;
> + pkvm_shrinker->scan_objects = pkvm_shrinker_scan;
> + shrinker_register(pkvm_shrinker);
> + } else {
> + kvm_err("Failed to register shrinker for pKVM\n");
> + }
> +
> }
>
> return 0;
[Severity: High]
Could registering the shrinker here expose pKVM-finalised-only hypercalls
to early execution?
Since init_hyp_mode() runs at device_initcall, the shrinker becomes globally
visible before pKVM is finalized at device_initcall_sync in finalize_pkvm().
If memory pressure triggers the shrinker in this window,
pkvm_shrinker_count() and pkvm_shrinker_scan() will invoke reclaim
hypercalls. Because pKVM is not yet finalized, the EL2 handler will reject
hypercalls beyond __KVM_HOST_SMCCC_FUNC_PKVM_ONLY with
SMCCC_RET_NOT_SUPPORTED.
Will this failure cause the host-side kvm_call_hyp_nvhe macro to trigger a
WARN_ON, potentially panicking the host if panic_on_warn is set?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706175415.2604046-1-vdonnefort@google.com?part=11
next prev parent reply other threads:[~2026-07-06 18:13 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 17:53 [PATCH v2 00/18] KVM: arm64: Introduce pKVM hypervisor heap allocator Vincent Donnefort
2026-07-06 17:53 ` [PATCH v2 01/18] KVM: arm64: Add __pkvm_private_range_pa Vincent Donnefort
2026-07-14 16:59 ` Fuad Tabba
2026-07-06 17:53 ` [PATCH v2 02/18] KVM: arm64: Add pkvm_remove_mappings Vincent Donnefort
2026-07-14 17:48 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 03/18] KVM: arm64: Add __hyp_allocator_map for the pKVM hyp Vincent Donnefort
2026-07-14 17:53 ` Fuad Tabba
2026-07-15 8:58 ` Vincent Donnefort
2026-07-15 9:24 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 04/18] KVM: arm64: Add a heap allocator " Vincent Donnefort
2026-07-06 18:12 ` sashiko-bot
2026-07-08 15:54 ` Vincent Donnefort
2026-07-14 18:35 ` Fuad Tabba
2026-07-15 10:59 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 05/18] KVM: arm64: Allow kvm_hyp_memcache usage outside of stage-2 Vincent Donnefort
2026-07-14 19:00 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 06/18] KVM: arm64: Add topup interface for the pKVM heap allocator Vincent Donnefort
2026-07-06 18:14 ` sashiko-bot
2026-07-14 19:28 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 07/18] KVM: arm64: Add pkvm_hyp_req infrastructure Vincent Donnefort
2026-07-14 19:45 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 08/18] KVM: arm64: Handle PKVM_HYP_REQ_HYP_ALLOC request Vincent Donnefort
2026-07-15 6:28 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 09/18] KVM: arm64: Add reclaim interface for the pKVM heap alloc Vincent Donnefort
2026-07-14 20:10 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 10/18] KVM: arm64: Add selftests for the pKVM heap allocator Vincent Donnefort
2026-07-15 11:07 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 11/18] KVM: arm64: Add a shrinker for pKVM Vincent Donnefort
2026-07-06 18:13 ` sashiko-bot [this message]
2026-07-15 11:20 ` Fuad Tabba
2026-07-15 11:35 ` Vincent Donnefort
2026-07-06 17:54 ` [PATCH v2 12/18] KVM: arm64: Filter out non-kernel addresses in kern_hyp_va Vincent Donnefort
2026-07-15 11:30 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 13/18] KVM: arm64: Move hyp_vm refcount into the structure Vincent Donnefort
2026-07-15 11:35 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 14/18] KVM: arm64: Use noclear for PGD in __pkvm_init_vm error path Vincent Donnefort
2026-07-06 18:17 ` sashiko-bot
2026-07-15 12:09 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 15/18] KVM: arm64: Alloc pkvm_hyp_vm using pKVM heap allocator Vincent Donnefort
2026-07-06 18:24 ` sashiko-bot
2026-07-15 12:33 ` Fuad Tabba
2026-07-15 12:55 ` Vincent Donnefort
2026-07-15 12:58 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 16/18] KVM: arm64: Alloc pkvm_hyp_vcpu " Vincent Donnefort
2026-07-06 18:24 ` sashiko-bot
2026-07-15 13:12 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 17/18] KVM: arm64: Reject hyp trace descriptors with fewer CPUs than hyp_nr_cpus Vincent Donnefort
2026-07-15 13:54 ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 18/18] KVM: arm64: Alloc simple_buffer_page using pKVM hyp allocator Vincent Donnefort
2026-07-06 18:19 ` sashiko-bot
2026-07-15 15:07 ` Fuad Tabba
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=20260706181304.DE57B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vdonnefort@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.