Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1711378

Re: [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR

From Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR
Date 2017-08-14 21:30 +0200
Message-ID <uetdM-89B-23@gated-at.bofh.it> (permalink)
References <uclNn-6X2-5@gated-at.bofh.it> <uclNo-6X2-19@gated-at.bofh.it> <uehFE-14m-15@gated-at.bofh.it> <uenL4-4Jh-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR Michael Neuling <mikey@neuling.org> - 2017-08-14 09:10 +0200
  Re: [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR Benjamin Herrenschmidt <benh@au1.ibm.com> - 2017-08-14 15:40 +0200
    Re: [PATCH v6 14/17] powerpc: Add support for setting SPRN_TIDR Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2017-08-14 21:30 +0200

csiph-web