From: Nathan Lynch <nathanl@linux.ibm.com>
To: Haren Myneni <haren@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com
Subject: Re: [PATCH] powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL
Date: Thu, 29 Sep 2022 17:16:40 -0500 [thread overview]
Message-ID: <87wn9lbzcn.fsf@linux.ibm.com> (raw)
In-Reply-To: <55380253ea0c11341824cd4c0fc6bbcfc5752689.camel@linux.ibm.com>
Haren Myneni <haren@linux.ibm.com> writes:
> Generally the hypervisor decides to allocate a window on different
> VAS instances. But if the user space wishes to allocate on the
> current VAS instance where the process is executing, the kernel has
> to pass associativity domain IDs to allocate VAS window HCALL. To
> determine the associativity domain IDs for the current CPU, passing
> smp_processor_id() to node associativity HCALL which may return
> H_P2 (-55) error during DLPAR CPU event.
>
> This patch fixes this issue by passing hard_smp_processor_id() with
> VPHN_FLAG_VCPU flag (PAPR 14.11.6.1 H_HOME_NODE_ASSOCIATIVITY).
>
> Signed-off-by: Haren Myneni <haren@linux.ibm.com>
> ---
> arch/powerpc/platforms/pseries/vas.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c
> index fe33bdb620d5..533026fd1f40 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -348,7 +348,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,
> * So no unpacking needs to be done.
> */
> rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, domain,
> - VPHN_FLAG_VCPU, smp_processor_id());
> + VPHN_FLAG_VCPU, hard_smp_processor_id());
> if (rc != H_SUCCESS) {
> pr_err("H_HOME_NODE_ASSOCIATIVITY error: %d\n", rc);
> goto out;
Yes, it is always wrong to pass Linux CPU numbers to the hypervisor,
which has its own numbering for hardware threads. It usually coincides
with Linux's numbering in practice, which tends to hide bugs like this.
Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>
next prev parent reply other threads:[~2022-09-29 22:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 1:57 [PATCH] powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL Haren Myneni
2022-09-29 22:16 ` Nathan Lynch [this message]
2022-09-30 8:55 ` Michal Suchánek
2022-09-30 10:35 ` Michael Ellerman
2022-10-04 13:26 ` Michael Ellerman
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=87wn9lbzcn.fsf@linux.ibm.com \
--to=nathanl@linux.ibm.com \
--cc=haren@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).