From: Michael Ellerman <mpe@ellerman.id.au>
To: "Michal Suchánek" <msuchanek@suse.de>,
"Nathan Lynch" <nathanl@linux.ibm.com>
Cc: Haren Myneni <haren@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com
Subject: Re: [PATCH] powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL
Date: Fri, 30 Sep 2022 20:35:15 +1000 [thread overview]
Message-ID: <87mtahp2u4.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20220930085542.GW28810@kitsune.suse.cz>
Michal Suchánek <msuchanek@suse.de> writes:
> On Thu, Sep 29, 2022 at 05:16:40PM -0500, Nathan Lynch wrote:
>> 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>
>
> This is the code that introduces the problem, right?
>
> Fixes: b22f2d88e435 ("powerpc/pseries/vas: Integrate API with open/close windows")
Yeah, I tagged it when applying. Thanks.
cheers
next prev parent reply other threads:[~2022-09-30 10:35 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
2022-09-30 8:55 ` Michal Suchánek
2022-09-30 10:35 ` Michael Ellerman [this message]
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=87mtahp2u4.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=haren@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=msuchanek@suse.de \
--cc=nathanl@linux.ibm.com \
--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 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.