All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: benh@au1.ibm.com,
	Christophe Lombard <clombard@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, fbarrat@linux.vnet.ibm.com,
	vaibhav@linux.vnet.ibm.com, andrew.donnellan@au1.ibm.com
Subject: Re: [PATCH] powerpc/64s: Add support for ASB_Notify on POWER9
Date: Mon, 14 Aug 2017 16:40:33 +1000	[thread overview]
Message-ID: <1502692833.9844.4.camel@neuling.org> (raw)
In-Reply-To: <1501907321.2664.126.camel@au1.ibm.com>

On Sat, 2017-08-05 at 14:28 +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2017-08-04 at 16:56 +0200, Christophe Lombard wrote:
> > The POWER9 core supports a new feature: ASB_Notify which requires the
> > support of the Special Purpose Register: TIDR.
> >=20
> > The ASB_Notify command, generated by the AFU, will attempt to
> > wake-up the host thread identified by the particular LPID:PID:TID.
> >=20
> > The special register TIDR has to be updated to with the same value
> > present in the process element.
> >=20
> > If the length of the register TIDR is 64bits, the CAPI Translation
> > Service Layer core (XSL9) for Power9 systems limits the size (16bits) o=
f
> > the Thread ID when it generates the ASB_Notify message adding
> > PID:LPID:TID information from the context.
> >=20
> > The content of the internal kernel Thread ID (32bits) can not therefore
> > be used to fulfill the register TIDR.
> >=20
> > This patch allows to avoid this limitation by adding a new interface
> > for the user. The instructions mfspr/mtspr SPRN_TIDR are emulated,
> > save/restore SPRs (context switch) are updated and a new feature
> > (CPU_FTR_TIDR) is added to POWER9 system.
>=20
> Those CPU_FTR_* are internal to the kernel. You probably also need a
> feature in AT_HWCAP2 to indicate to userspace that this is supported.
>=20
> Also you put the onus of allocating the TIDs onto userspace which is a
> bit tricky. What happens if there are duplicate TIDs for example ? (ie,
> userspace doesn't allocate it or uses a library that spawns a thread)

I tend to agree.  I don't want userspace knowing anything about TIDR
allocations.  If we want userspace to receive one of these as_notifys, ther=
e
should be some abstract handle (like a file descriptor) that the kernel giv=
es
out. That handle should be associated with an LPID/PID/TID tuple by the ker=
nel.

This is similar to the PE number in CAPI. Most of the time userspace doesn'=
t
need to know its PE number (there is some cases were a master needs to know=
 a
slave PE, but that's the exception, not the rule).  Similarly, guests don't=
 know
their LPID.  Processes don't know their PID. Threads shouldn't know the TID=
.

Also, Suka has posted a patch that does TID allocation in the kernel...=C2=
=A0
http://patchwork.ozlabs.org/patch/799494/

Regards,
Mikey

  parent reply	other threads:[~2017-08-14  6:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 14:56 [PATCH] powerpc/64s: Add support for ASB_Notify on POWER9 Christophe Lombard
2017-08-05  4:28 ` Benjamin Herrenschmidt
2017-08-09 13:18   ` christophe lombard
2017-08-14  6:40   ` Michael Neuling [this message]
2017-08-07  3:08 ` Michael Ellerman
2017-08-10 20:32   ` christophe lombard

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=1502692833.9844.4.camel@neuling.org \
    --to=mikey@neuling.org \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=benh@au1.ibm.com \
    --cc=clombard@linux.vnet.ibm.com \
    --cc=fbarrat@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=vaibhav@linux.vnet.ibm.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.