From: Marc Zyngier <maz@kernel.org>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: oliver.upton@linux.dev, joey.gouly@arm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
catalin.marinas@arm.com, will@kernel.org, qperret@google.com,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v3 1/3] KVM: arm64: Add flags to kvm_hyp_memcache
Date: Wed, 12 Mar 2025 08:38:43 +0000 [thread overview]
Message-ID: <87r0327iek.wl-maz@kernel.org> (raw)
In-Reply-To: <20250307113411.469018-2-vdonnefort@google.com>
On Fri, 07 Mar 2025 11:34:09 +0000,
Vincent Donnefort <vdonnefort@google.com> wrote:
>
> Add flags to kvm_hyp_memcache and propagate the latter to the allocation
> and free callbacks. This will later allow to account for memory, based
> on the memcache configuration.
>
> Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
>
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 3a7ec98ef123..12691ae23d4c 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -86,6 +86,7 @@ struct kvm_hyp_memcache {
> phys_addr_t head;
> unsigned long nr_pages;
> struct pkvm_mapping *mapping; /* only used from EL1 */
> + unsigned long flags;
> };
>
> static inline void push_hyp_memcache(struct kvm_hyp_memcache *mc,
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 1f55b0c7b11d..c01ad4430729 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -1086,12 +1086,12 @@ void kvm_free_stage2_pgd(struct kvm_s2_mmu *mmu)
> }
> }
>
> -static void hyp_mc_free_fn(void *addr, void *unused)
> +static void hyp_mc_free_fn(void *addr, void *mc)
> {
> free_page((unsigned long)addr);
> }
>
> -static void *hyp_mc_alloc_fn(void *unused)
> +static void *hyp_mc_alloc_fn(void *mc)
> {
> return (void *)__get_free_page(GFP_KERNEL_ACCOUNT);
> }
> @@ -1102,7 +1102,7 @@ void free_hyp_memcache(struct kvm_hyp_memcache *mc)
> return;
>
> kfree(mc->mapping);
> - __free_hyp_memcache(mc, hyp_mc_free_fn, kvm_host_va, NULL);
> + __free_hyp_memcache(mc, hyp_mc_free_fn, kvm_host_va, (void *)mc);
Why the cast? It looks superfluous to me.
> }
>
> int topup_hyp_memcache(struct kvm_hyp_memcache *mc, unsigned long min_pages)
> @@ -1117,7 +1117,7 @@ int topup_hyp_memcache(struct kvm_hyp_memcache *mc, unsigned long min_pages)
> }
>
> return __topup_hyp_memcache(mc, min_pages, hyp_mc_alloc_fn,
> - kvm_host_pa, NULL);
> + kvm_host_pa, (void *)mc);
Same here.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-03-12 8:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 11:34 [PATCH v3 0/3] Count pKVM stage-2 usage in secondary pagetable stat Vincent Donnefort
2025-03-07 11:34 ` [PATCH v3 1/3] KVM: arm64: Add flags to kvm_hyp_memcache Vincent Donnefort
2025-03-12 8:38 ` Marc Zyngier [this message]
2025-03-13 9:16 ` Vincent Donnefort
2025-03-07 11:34 ` [PATCH v3 2/3] KVM: arm64: Distinct pKVM teardown memcache for stage-2 Vincent Donnefort
2025-03-12 8:59 ` Marc Zyngier
2025-03-13 9:13 ` Vincent Donnefort
2025-03-13 9:31 ` Marc Zyngier
2025-03-07 11:34 ` [PATCH v3 3/3] KVM: arm64: Count pKVM stage-2 usage in secondary pagetable stats Vincent Donnefort
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=87r0327iek.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=kernel-team@android.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.upton@linux.dev \
--cc=qperret@google.com \
--cc=suzuki.poulose@arm.com \
--cc=vdonnefort@google.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.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.