diff for duplicates of <1502694131.9844.7.camel@neuling.org> diff --git a/a/1.txt b/N1/1.txt index 8a9d078..a12d6d0 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,50 +1,46 @@ On Tue, 2017-08-08 at 16:06 -0700, Sukadev Bhattiprolu wrote: > We need the SPRN_TIDR to bet set for use with fast thread-wakeup -> (core-to-core wakeup).=C2=A0=C2=A0Each thread in a process needs to have = -a +> (core-to-core wakeup). Each thread in a process needs to have a > unique id within the process but as explained below, for now, we > assign globally unique thread ids to all threads in the system. ->=20 +> > Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> > --- -> =C2=A0arch/powerpc/include/asm/processor.h |=C2=A0=C2=A04 ++ -> =C2=A0arch/powerpc/kernel/process.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= -=C2=A0=C2=A0| 74 +> arch/powerpc/include/asm/processor.h | 4 ++ +> arch/powerpc/kernel/process.c | 74 > ++++++++++++++++++++++++++++++++++++ -> =C2=A02 files changed, 78 insertions(+) ->=20 +> 2 files changed, 78 insertions(+) +> > diff --git a/arch/powerpc/include/asm/processor.h > b/arch/powerpc/include/asm/processor.h > index fab7ff8..bf6ba63 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -232,6 +232,10 @@ struct debug_reg { -> =C2=A0struct thread_struct { -> =C2=A0 unsigned long ksp; /* Kernel stack pointer */ -> =C2=A0 +> struct thread_struct { +> unsigned long ksp; /* Kernel stack pointer */ +> > +#ifdef CONFIG_PPC_VAS -I'm tempted to have this always, or a new feature CONFIG_PPC_TID that's PPC= -_VAS +I'm tempted to have this always, or a new feature CONFIG_PPC_TID that's PPC_VAS depends on. > + unsigned long tidr; > +#endif > + -> =C2=A0#ifdef CONFIG_PPC64 -> =C2=A0 unsigned long ksp_vsid; -> =C2=A0#endif -> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.= -c +> #ifdef CONFIG_PPC64 +> unsigned long ksp_vsid; +> #endif +> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 9f3e2c9..6123859 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1213,6 +1213,16 @@ struct task_struct *__switch_to(struct task_struct > *prev, -> =C2=A0 hard_irq_disable(); -> =C2=A0 } -> =C2=A0 +> hard_irq_disable(); +> } +> > +#ifdef CONFIG_PPC_VAS > + mtspr(SPRN_TIDR, new->thread.tidr); @@ -55,24 +51,22 @@ Also you need an CPU_FTR_ARCH_300 test here (and elsewhere) > +#endif > + /* -> + =C2=A0* We can't take a PMU exception inside _switch() since there is a -> + =C2=A0* window where the kernel stack SLB and the kernel stack are out -> + =C2=A0* of sync. Hard disable here. -> + =C2=A0*/ +> + * We can't take a PMU exception inside _switch() since there is a +> + * window where the kernel stack SLB and the kernel stack are out +> + * of sync. Hard disable here. +> + */ > + hard_irq_disable(); > + What is this? -> =C2=A0 /* -> =C2=A0 =C2=A0* Call restore_sprs() before calling _switch(). If we move i= -t after -> =C2=A0 =C2=A0* _switch() then we miss out on calling it for new tasks. Th= -e reason +> /* +> * Call restore_sprs() before calling _switch(). If we move it after +> * _switch() then we miss out on calling it for new tasks. The reason > @@ -1449,9 +1459,70 @@ void flush_thread(void) -> =C2=A0#endif /* CONFIG_HAVE_HW_BREAKPOINT */ -> =C2=A0} -> =C2=A0 +> #endif /* CONFIG_HAVE_HW_BREAKPOINT */ +> } +> > +#ifdef CONFIG_PPC_VAS > +static DEFINE_SPINLOCK(vas_thread_id_lock); > +static DEFINE_IDA(vas_thread_ida); @@ -81,24 +75,18 @@ This IDA be per process, not global. > + > +/* -> + * We need to assign an unique thread id to each thread in a process. Th= -is -> + * thread id is intended to be used with the Fast Thread-wakeup (aka Cor= -e- -> + * to-core wakeup) mechanism being implemented on top of Virtual Acceler= -ator +> + * 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 th= -read +> + * 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 th= -e +> + * atomic field (or an IDR) in task_struct, which again intrudes into the > + * arch-neutral code. Really? @@ -118,13 +106,13 @@ Yuck! > + return -ENOMEM; > + > + spin_lock(&vas_thread_id_lock); -> + err =3D ida_get_new_above(&vas_thread_ida, 1, &index); +> + err = ida_get_new_above(&vas_thread_ida, 1, &index); We can't use 0 or 1? > + spin_unlock(&vas_thread_id_lock); > + -> + if (err =3D=3D -EAGAIN) +> + if (err == -EAGAIN) > + goto again; > + else if (err) > + return err; @@ -148,30 +136,29 @@ We can't use 0 or 1? > +#endif /* CONFIG_PPC_VAS */ > + > + -> =C2=A0void -> =C2=A0release_thread(struct task_struct *t) -> =C2=A0{ +> void +> release_thread(struct task_struct *t) +> { > +#ifdef CONFIG_PPC_VAS > + free_thread_id(t->thread.tidr); > +#endif Can you restructure this to avoid the #ifdef ugliness -> =C2=A0} -> =C2=A0 -> =C2=A0/* -> @@ -1587,6 +1658,9 @@ int copy_thread(unsigned long clone_flags, unsigned= - long +> } +> +> /* +> @@ -1587,6 +1658,9 @@ int copy_thread(unsigned long clone_flags, unsigned long > usp, -> =C2=A0#endif -> =C2=A0 -> =C2=A0 setup_ksp_vsid(p, sp); +> #endif +> +> setup_ksp_vsid(p, sp); > +#ifdef CONFIG_PPC_VAS -> + p->thread.tidr =3D assign_thread_id(); +> + p->thread.tidr = assign_thread_id(); > +#endif -Same here...=20 +Same here... -> =C2=A0 -> =C2=A0#ifdef CONFIG_PPC64=C2=A0 -> =C2=A0 if (cpu_has_feature(CPU_FTR_DSCR)) { +> +> #ifdef CONFIG_PPC64 +> if (cpu_has_feature(CPU_FTR_DSCR)) { diff --git a/a/content_digest b/N1/content_digest index 6912a96..3f9f67f 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -14,51 +14,47 @@ "b\0" "On Tue, 2017-08-08 at 16:06 -0700, Sukadev Bhattiprolu wrote:\n" "> We need the SPRN_TIDR to bet set for use with fast thread-wakeup\n" - "> (core-to-core wakeup).=C2=A0=C2=A0Each thread in a process needs to have =\n" - "a\n" + "> (core-to-core wakeup).\302\240\302\240Each thread in a process needs to have a\n" "> unique id within the process but as explained below, for now, we\n" "> assign globally unique thread ids to all threads in the system.\n" - ">=20\n" + "> \n" "> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>\n" "> ---\n" - "> =C2=A0arch/powerpc/include/asm/processor.h |=C2=A0=C2=A04 ++\n" - "> =C2=A0arch/powerpc/kernel/process.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=\n" - "=C2=A0=C2=A0| 74\n" + "> \302\240arch/powerpc/include/asm/processor.h |\302\240\302\2404 ++\n" + "> \302\240arch/powerpc/kernel/process.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240| 74\n" "> ++++++++++++++++++++++++++++++++++++\n" - "> =C2=A02 files changed, 78 insertions(+)\n" - ">=20\n" + "> \302\2402 files changed, 78 insertions(+)\n" + "> \n" "> diff --git a/arch/powerpc/include/asm/processor.h\n" "> b/arch/powerpc/include/asm/processor.h\n" "> index fab7ff8..bf6ba63 100644\n" "> --- a/arch/powerpc/include/asm/processor.h\n" "> +++ b/arch/powerpc/include/asm/processor.h\n" "> @@ -232,6 +232,10 @@ struct debug_reg {\n" - "> =C2=A0struct thread_struct {\n" - "> =C2=A0\tunsigned long\tksp;\t\t/* Kernel stack pointer */\n" - "> =C2=A0\n" + "> \302\240struct thread_struct {\n" + "> \302\240\tunsigned long\tksp;\t\t/* Kernel stack pointer */\n" + "> \302\240\n" "> +#ifdef CONFIG_PPC_VAS\n" "\n" - "I'm tempted to have this always, or a new feature CONFIG_PPC_TID that's PPC=\n" - "_VAS\n" + "I'm tempted to have this always, or a new feature CONFIG_PPC_TID that's PPC_VAS\n" "depends on.\n" "\n" "> +\tunsigned long\ttidr;\n" "\n" "> +#endif\n" "> +\n" - "> =C2=A0#ifdef CONFIG_PPC64\n" - "> =C2=A0\tunsigned long\tksp_vsid;\n" - "> =C2=A0#endif\n" - "> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.=\n" - "c\n" + "> \302\240#ifdef CONFIG_PPC64\n" + "> \302\240\tunsigned long\tksp_vsid;\n" + "> \302\240#endif\n" + "> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c\n" "> index 9f3e2c9..6123859 100644\n" "> --- a/arch/powerpc/kernel/process.c\n" "> +++ b/arch/powerpc/kernel/process.c\n" "> @@ -1213,6 +1213,16 @@ struct task_struct *__switch_to(struct task_struct\n" "> *prev,\n" - "> =C2=A0\t\thard_irq_disable();\n" - "> =C2=A0\t}\n" - "> =C2=A0\n" + "> \302\240\t\thard_irq_disable();\n" + "> \302\240\t}\n" + "> \302\240\n" "> +#ifdef CONFIG_PPC_VAS\n" "> +\tmtspr(SPRN_TIDR, new->thread.tidr);\n" "\n" @@ -69,24 +65,22 @@ "\n" "> +#endif\n" "> +\t/*\n" - "> +\t=C2=A0* We can't take a PMU exception inside _switch() since there is a\n" - "> +\t=C2=A0* window where the kernel stack SLB and the kernel stack are out\n" - "> +\t=C2=A0* of sync. Hard disable here.\n" - "> +\t=C2=A0*/\n" + "> +\t\302\240* We can't take a PMU exception inside _switch() since there is a\n" + "> +\t\302\240* window where the kernel stack SLB and the kernel stack are out\n" + "> +\t\302\240* of sync. Hard disable here.\n" + "> +\t\302\240*/\n" "> +\thard_irq_disable();\n" "> +\n" "\n" "What is this?\n" "\n" - "> =C2=A0\t/*\n" - "> =C2=A0\t=C2=A0* Call restore_sprs() before calling _switch(). If we move i=\n" - "t after\n" - "> =C2=A0\t=C2=A0* _switch() then we miss out on calling it for new tasks. Th=\n" - "e reason\n" + "> \302\240\t/*\n" + "> \302\240\t\302\240* Call restore_sprs() before calling _switch(). If we move it after\n" + "> \302\240\t\302\240* _switch() then we miss out on calling it for new tasks. The reason\n" "> @@ -1449,9 +1459,70 @@ void flush_thread(void)\n" - "> =C2=A0#endif /* CONFIG_HAVE_HW_BREAKPOINT */\n" - "> =C2=A0}\n" - "> =C2=A0\n" + "> \302\240#endif /* CONFIG_HAVE_HW_BREAKPOINT */\n" + "> \302\240}\n" + "> \302\240\n" "> +#ifdef CONFIG_PPC_VAS\n" "> +static DEFINE_SPINLOCK(vas_thread_id_lock);\n" "> +static DEFINE_IDA(vas_thread_ida);\n" @@ -95,24 +89,18 @@ "\n" "> +\n" "> +/*\n" - "> + * We need to assign an unique thread id to each thread in a process. Th=\n" - "is\n" - "> + * thread id is intended to be used with the Fast Thread-wakeup (aka Cor=\n" - "e-\n" - "> + * to-core wakeup) mechanism being implemented on top of Virtual Acceler=\n" - "ator\n" + "> + * We need to assign an unique thread id to each thread in a process. This\n" + "> + * thread id is intended to be used with the Fast Thread-wakeup (aka Core-\n" + "> + * to-core wakeup) mechanism being implemented on top of Virtual Accelerator\n" "> + * Switchboard (VAS).\n" "> + *\n" - "> + * To get a unique thread-id per process we could simply use task_pid_nr=\n" - "()\n" - "> + * but the problem is that task_pid_nr() is not yet available for the th=\n" - "read\n" + "> + * To get a unique thread-id per process we could simply use task_pid_nr()\n" + "> + * but the problem is that task_pid_nr() is not yet available for the thread\n" "> + * when copy_thread() is called. Fixing that would require changing more\n" "> + * intrusive arch-neutral code in code path in copy_process()?.\n" "> + *\n" "> + * Further, to assign unique thread ids within each process, we need an\n" - "> + * atomic field (or an IDR) in task_struct, which again intrudes into th=\n" - "e\n" + "> + * atomic field (or an IDR) in task_struct, which again intrudes into the\n" "> + * arch-neutral code.\n" "\n" "Really?\n" @@ -132,13 +120,13 @@ "> +\t\treturn -ENOMEM;\n" "> +\n" "> +\tspin_lock(&vas_thread_id_lock);\n" - "> +\terr =3D ida_get_new_above(&vas_thread_ida, 1, &index);\n" + "> +\terr = ida_get_new_above(&vas_thread_ida, 1, &index);\n" "\n" "We can't use 0 or 1?\n" "\n" "> +\tspin_unlock(&vas_thread_id_lock);\n" "> +\n" - "> +\tif (err =3D=3D -EAGAIN)\n" + "> +\tif (err == -EAGAIN)\n" "> +\t\tgoto again;\n" "> +\telse if (err)\n" "> +\t\treturn err;\n" @@ -162,32 +150,31 @@ "> +#endif /* CONFIG_PPC_VAS */\n" "> +\n" "> +\n" - "> =C2=A0void\n" - "> =C2=A0release_thread(struct task_struct *t)\n" - "> =C2=A0{\n" + "> \302\240void\n" + "> \302\240release_thread(struct task_struct *t)\n" + "> \302\240{\n" "> +#ifdef CONFIG_PPC_VAS\n" "> +\tfree_thread_id(t->thread.tidr);\n" "> +#endif\n" "\n" "Can you restructure this to avoid the #ifdef ugliness\n" "\n" - "> =C2=A0}\n" - "> =C2=A0\n" - "> =C2=A0/*\n" - "> @@ -1587,6 +1658,9 @@ int copy_thread(unsigned long clone_flags, unsigned=\n" - " long\n" + "> \302\240}\n" + "> \302\240\n" + "> \302\240/*\n" + "> @@ -1587,6 +1658,9 @@ int copy_thread(unsigned long clone_flags, unsigned long\n" "> usp,\n" - "> =C2=A0#endif\n" - "> =C2=A0\n" - "> =C2=A0\tsetup_ksp_vsid(p, sp);\n" + "> \302\240#endif\n" + "> \302\240\n" + "> \302\240\tsetup_ksp_vsid(p, sp);\n" "> +#ifdef CONFIG_PPC_VAS\n" - "> +\tp->thread.tidr =3D assign_thread_id();\n" + "> +\tp->thread.tidr = assign_thread_id();\n" "> +#endif\n" "\n" - "Same here...=20\n" + "Same here... \n" "\n" - "> =C2=A0\n" - "> =C2=A0#ifdef CONFIG_PPC64=C2=A0\n" - "> =C2=A0\tif (cpu_has_feature(CPU_FTR_DSCR)) {" + "> \302\240\n" + "> \302\240#ifdef CONFIG_PPC64\302\240\n" + "> \302\240\tif (cpu_has_feature(CPU_FTR_DSCR)) {" -8f1687eb492ed40d5b7ff4265a4266f5dffa46e7e9c9f53058b234426d4c765e +307d84f613267a526ce3c14135fcba3c95b3ad4feda78a0bb2234e0d881ffd38
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.