From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>
Subject: Re: [PATCH v20 2/9] firmware: arm_rmm: Check for RMI support at init
Date: Wed, 30 Sep 2026 09:18:48 +0100 [thread overview]
Message-ID: <a2fa2bd1-6888-4ed5-9e2f-233eacb600a5@arm.com> (raw)
In-Reply-To: <20260929222840.A0E821F000FF@smtp.kernel.org>
On 29/09/2026 23:28, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] arm_rmm: unbounded spin loop on RMI_BUSY without scheduling
> - [Medium] arm_rmm: commit message and code mismatch on feature registers count
> --
>
> commit 5ddd90a4b6dcf005d84ebc9f9003eb3f383394f8
> Author: Steven Price <steven.price@arm.com>
>
> firmware: arm_rmm: Check for RMI support at init
>
> This commit queries the RMI version to ensure compatibility and reads
> feature registers from the Realm Management Monitor (RMM). It also exposes
> these feature registers for future use.
>
>> The first two feature registers are read and exposed for future code to
>> use.
>
> [Severity: Medium]
> Is this description accurate? The commit message explicitly claims that the
> first two feature registers are read, whereas the actual implementation in
> rmi_read_features() iterates over ARRAY_SIZE(rmi_feat_reg_cache) (which is
> 5) to read all 5 feature registers. This looks like the commit message
> might have missed the v19 code change.
Ack. I have fixed this locally.
>
>> diff --git a/include/linux/arm-rmi-cmds.h b/include/linux/arm-rmi-cmds.h
>> new file mode 100644
>> index 0000000000000..911489b636522
>> --- /dev/null
>> +++ b/include/linux/arm-rmi-cmds.h
> [ ... ]
>> +static inline void rmi_smccc_invoke(struct arm_smccc_1_2_regs *regs)
>> +{
>> + struct arm_smccc_1_2_regs args = *regs;
>> + long status;
>> + int i = 0;
>> +
>> + while (i < RMM_BLOCKED_RETRY_COUNT) {
>> + arm_smccc_1_2_invoke(&args, regs);
>> +
>> + status = RMI_RESULT_STATUS(regs->a0);
>> + if (status != RMI_BUSY && status != RMI_BLOCKED)
>> + break;
>> + if (status == RMI_BLOCKED)
>> + i++;
>> + cpu_relax();
>> + }
>
> [Severity: High]
> Does this sequence create an unbounded spin loop if the firmware continuously
> returns RMI_BUSY?
>
> If the status returned by arm_smccc_1_2_invoke() is RMI_BUSY, the loop
> continues without incrementing the exit counter i. It issues cpu_relax()
> but does not yield the CPU (e.g., via cond_resched()) or impose a timeout.
> If the RMM firmware remains busy, this could cause the host kernel to lock
> up indefinitely.
This is like "spinlock contention". RMM returns EBUSY when a resource is
locked temporarily. We should be able to make progress, unlike the
RMI_BLOCKED, which is blocking due to a long running operation.
Cheers
Suzuki
next prev parent reply other threads:[~2026-09-30 8:19 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 22:16 [PATCH v20 0/9] firmware: arm_rmm: Add RMM v2.0 base RMI support Suzuki K Poulose
2026-09-29 22:16 ` [PATCH v20 1/9] firmware: arm_rmm: Add SMC definitions for calling the RMM Suzuki K Poulose
2026-09-30 9:51 ` Catalin Marinas
2026-09-29 22:16 ` [PATCH v20 2/9] firmware: arm_rmm: Check for RMI support at init Suzuki K Poulose
2026-09-29 22:28 ` sashiko-bot
2026-09-30 8:18 ` Suzuki K Poulose [this message]
2026-09-30 11:02 ` Catalin Marinas
2026-10-01 6:03 ` Suzuki K Poulose
2026-10-01 8:17 ` Suzuki K Poulose
2026-09-29 22:16 ` [PATCH v20 3/9] firmware: arm_rmm: Configure the RMM with the host's page size Suzuki K Poulose
2026-09-30 11:10 ` Catalin Marinas
2026-09-29 22:16 ` [PATCH v20 4/9] firmware: arm_rmm: Add support for SRO Suzuki K Poulose
2026-09-29 22:30 ` sashiko-bot
2026-09-30 8:45 ` Suzuki K Poulose
2026-09-30 8:46 ` Suzuki K Poulose
2026-09-30 13:15 ` Catalin Marinas
2026-09-30 13:48 ` Suzuki K Poulose
2026-09-29 22:16 ` [PATCH v20 5/9] firmware: arm_rmm: Activate the RMM Suzuki K Poulose
2026-09-30 13:20 ` Catalin Marinas
2026-09-29 22:16 ` [PATCH v20 6/9] firmware: arm_rmm: Ensure the RMM has GPT entries for memory Suzuki K Poulose
2026-09-30 13:39 ` Catalin Marinas
2026-09-30 14:44 ` Sudeep Holla
2026-09-30 15:55 ` Suzuki K Poulose
2026-10-01 8:31 ` Sudeep Holla
2026-09-29 22:16 ` [PATCH v20 7/9] arm64: Block hibernate and kexec while RMM is active Suzuki K Poulose
2026-09-29 22:26 ` sashiko-bot
2026-09-30 9:12 ` Suzuki K Poulose
2026-09-30 15:15 ` Catalin Marinas
2026-09-30 16:06 ` Jonathan Cameron
2026-09-29 22:16 ` [PATCH v20 8/9] firmware: arm_rmm: Add wrappers for Realm related RMI commands Suzuki K Poulose
2026-09-29 22:29 ` sashiko-bot
2026-09-30 11:12 ` Suzuki K Poulose
2026-09-30 15:51 ` Catalin Marinas
2026-09-29 22:16 ` [PATCH v20 9/9] firmware: arm_rmm: hotplug: Skip memory added to ZONE_MOVABLE Suzuki K Poulose
2026-09-30 12:22 ` David Hildenbrand (Arm)
2026-09-30 12:47 ` Suzuki K Poulose
2026-09-30 15:53 ` Catalin Marinas
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=a2fa2bd1-6888-4ed5-9e2f-233eacb600a5@arm.com \
--to=suzuki.poulose@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@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