Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kameron Carr" <kameroncarr@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v5 3/6] arm64: hyperv: Add per-CPU RSI host call infrastructure for CCA Realms
Date: Sat, 03 Oct 2026 01:34:01 +0000	[thread overview]
Message-ID: <20261003013402.4AF021F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261002215725.2015959-4-kameroncarr@linux.microsoft.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] arm64: hyperv: kcalloc() violates RSI host call 256-byte alignment
--

commit 15aadbf7702767ee71f473eab885a0900dbd0a76
Author: Kameron Carr <kameroncarr@linux.microsoft.com>

arm64: hyperv: Add per-CPU RSI host call infrastructure for CCA Realms

This commit adds a dynamically allocated array of per-CPU `struct
rsi_host_call` structures for ARM CCA Realms. The memory is allocated using
kcalloc() during hyperv_init() to avoid paying the memory cost on non-Realm
guests.

> diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
> index 4fdc26ade1d74..b1657cfabd7d1 100644
> --- a/arch/arm64/hyperv/mshyperv.c
> +++ b/arch/arm64/hyperv/mshyperv.c
[ ... ]
> @@ -85,6 +90,20 @@ static int __init hyperv_init(void)
>  	if (!hyperv_detect_via_acpi() && !hyperv_detect_via_smccc())
>  		return 0;
>  
> +	/*
> +	 * The RSI host-call buffers are only ever used when
> +	 * is_realm_world() is true. Skip the allocation on non-Realm
> +	 * guests. A single contiguous array of nr_cpu_ids entries is
> +	 * allocated; each CPU indexes into it by its processor ID.
> +	 */
> +	if (is_realm_world()) {
> +		hv_hostcall_array = kcalloc(nr_cpu_ids,
> +					    sizeof(struct rsi_host_call),
> +					    GFP_KERNEL);

[Severity: High]
Does kcalloc() satisfy the __aligned(256) requirement of struct rsi_host_call
when SLUB debugging or KASAN is enabled?

The struct definition explicitly demands 256-byte alignment:

include/linux/arm-smccc-rsi.h:
struct rsi_host_call {
	u16 immediate;
	u8 _padding[6];
	u64 gprs[31];
} __aligned(256);

kcalloc() only receives the size of the structure, not the alignment
constraint. When SLUB debugging is enabled, redzoning metadata is prepended to
the object, shifting the base pointer off the 256-byte boundary. A misaligned
Intermediate Physical Address (IPA) might lead to hardware rejection of the
hypercall by the Realm Management Monitor (RMM).

Additionally, since this allocates a single contiguous array for all CPUs,
does it bypass NUMA locality? Using alloc_percpu() would satisfy the alignment
constraint natively and allocate memory on local nodes.

> +		if (!hv_hostcall_array)
> +			return -ENOMEM;
> +	}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261002215725.2015959-1-kameroncarr@linux.microsoft.com?part=3

  reply	other threads:[~2026-10-03  1:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 21:57 [PATCH v5 0/6] arm64: hyperv: Add Realm support for Hyper-V Kameron Carr
2026-10-02 21:57 ` [PATCH v5 1/6] arm64: rsi: Add RSI host call structure and helper function Kameron Carr
2026-10-02 21:57 ` [PATCH v5 2/6] firmware: smccc: Detect hypervisor via RSI host call in CCA Realms Kameron Carr
2026-10-02 21:57 ` [PATCH v5 3/6] arm64: hyperv: Add per-CPU RSI host call infrastructure for " Kameron Carr
2026-10-03  1:34   ` sashiko-bot [this message]
2026-10-02 21:57 ` [PATCH v5 4/6] Drivers: hv: Mark shared memory as decrypted " Kameron Carr
2026-10-02 21:57 ` [PATCH v5 5/6] arm64: hyperv: Route hypercalls through RSI host call in " Kameron Carr
2026-10-03  1:34   ` sashiko-bot
2026-10-02 21:57 ` [PATCH v5 6/6] arm64: hyperv: Implement hv_is_isolation_supported() for " Kameron Carr

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=20261003013402.4AF021F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kameroncarr@linux.microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox