public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux•vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@au1•ibm.com>
Cc: Michael Neuling <mikey@neuling•org>,
	Michael Ellerman <mpe@ellerman•id.au>,
	stewart@linux•vnet.ibm.com, linuxppc-dev@ozlabs•org,
	linux-kernel@vger•kernel.org, apopple@au1•ibm.com,
	oohall@gmail•com
Subject: Re: [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR
Date: Mon, 14 Aug 2017 12:27:15 -0700	[thread overview]
Message-ID: <20170814192715.GC24096@us.ibm.com> (raw)
In-Reply-To: <1502717435.4493.29.camel@au1.ibm.com>

Benjamin Herrenschmidt [benh@au1•ibm.com] wrote:
> On Mon, 2017-08-14 at 17:02 +1000, Michael Neuling wrote:
> > > +/*
> > > + * We need to assign an unique thread id to each thread in a process. This
> > > + * thread id is intended to be used with the Fast Thread-wakeup (aka Core-
> > > + * to-core wakeup) mechanism being implemented on top of Virtual Accelerator
> > > + * Switchboard (VAS).
> > > + *
> > > + * To get a unique thread-id per process we could simply use task_pid_nr()
> > > + * but the problem is that task_pid_nr() is not yet available for the thread
> > > + * when copy_thread() is called. Fixing that would require changing more
> > > + * intrusive arch-neutral code in code path in copy_process()?.
> > > + *
> > > + * Further, to assign unique thread ids within each process, we need an
> > > + * atomic field (or an IDR) in task_struct, which again intrudes into the
> > > + * arch-neutral code.
> > 
> > Really?
> > 
> > > + * So try to assign globally unique thraed ids for now.
> > 
> > Yuck!

I know :-) copy_process() has:

        retval = copy_thread_tls(clone_flags, stack_start, stack_size, p, tls);
        if (retval)
                goto bad_fork_cleanup_io;

        if (pid != &init_struct_pid) {
                pid = alloc_pid(p->nsproxy->pid_ns_for_children);
                if (IS_ERR(pid)) {


so copy_thread() is called before a pid_nr is assigned to the task.

But see also response to Michael Ellerman.

> 
> Also CAPI has size limits for the TIDR afaik

Ok.

> 
> Ben.

  reply	other threads:[~2017-08-14 19:27 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 23:06 [PATCH v6 00/17] powerpc/vas: Enable VAS Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 01/17] powerpc/vas: Define macros, register fields and structures Sukadev Bhattiprolu
2017-08-14  5:21   ` Michael Ellerman
2017-08-14  6:05     ` Nicholas Piggin
2017-08-14 11:00       ` Michael Ellerman
2017-08-14 19:14       ` Sukadev Bhattiprolu
2017-08-16 12:07         ` Michael Ellerman
2017-08-16 23:07           ` Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 02/17] powerpc/vas: Move GET_FIELD/SET_FIELD to vas.h Sukadev Bhattiprolu
2017-08-14  7:26   ` Michael Ellerman
2017-08-08 23:06 ` [PATCH v6 03/17] powerpc/vas: Define vas_init() and vas_exit() Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 04/17] powerpc/vas: Define helpers to access MMIO regions Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 05/17] powerpc/vas: Define helpers to init window context Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 06/17] powerpc/vas: Define helpers to alloc/free windows Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 07/17] powerpc/vas: Define vas_win_paste_addr() Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 08/17] powerpc/vas: Define vas_win_id() Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 09/17] powerpc/vas: Define vas_rx_win_open() interface Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 10/17] " Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 11/17] powerpc/vas: Define vas_win_close() interface Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 12/17] powerpc/vas: Define vas_tx_win_open() Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 13/17] powerpc/vas: Define copy/paste interfaces Sukadev Bhattiprolu
2017-08-08 23:06 ` [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR Sukadev Bhattiprolu
2017-08-14  7:02   ` Michael Neuling
2017-08-14 13:30     ` Benjamin Herrenschmidt
2017-08-14 19:27       ` Sukadev Bhattiprolu [this message]
2017-08-14 11:16   ` Michael Ellerman
2017-08-14 20:03     ` Sukadev Bhattiprolu
2017-08-14 22:25       ` Benjamin Herrenschmidt
2017-08-14 22:23     ` Benjamin Herrenschmidt
2017-08-08 23:07 ` [PATCH v6 15/17] powerpc/vas: Define window open ioctls API Sukadev Bhattiprolu
2017-08-08 23:07 ` [PATCH v6 16/17] powerpc/vas: Implement a simple FTW driver Sukadev Bhattiprolu
2017-08-14  6:53   ` Michael Ellerman
2017-08-08 23:07 ` [PATCH v6 17/17] powerpc/vas: Document FTW API/usage Sukadev Bhattiprolu
2017-08-14 10:43   ` Michael Neuling

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=20170814192715.GC24096@us.ibm.com \
    --to=sukadev@linux$(echo .)vnet.ibm.com \
    --cc=apopple@au1$(echo .)ibm.com \
    --cc=benh@au1$(echo .)ibm.com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=mikey@neuling$(echo .)org \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=oohall@gmail$(echo .)com \
    --cc=stewart@linux$(echo .)vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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