Re: [PATCH V2 16/19] csky: SMP support

2018-07-07 Thread Guo Ren
On Fri, Jul 06, 2018 at 05:21:00PM +0100, Mark Rutland wrote: > Please don't open-code this. Use of_device_is_available(), which checks > the status property itself. e.g. > > void __init setup_smp(void) > { > struct device_node *node = NULL; > > while ((node =

Re: [PATCH V2 16/19] csky: SMP support

2018-07-07 Thread Guo Ren
On Fri, Jul 06, 2018 at 05:21:00PM +0100, Mark Rutland wrote: > Please don't open-code this. Use of_device_is_available(), which checks > the status property itself. e.g. > > void __init setup_smp(void) > { > struct device_node *node = NULL; > > while ((node =

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Mark Rutland
On Fri, Jul 06, 2018 at 08:26:31PM +0800, Guo Ren wrote: > On Fri, Jul 06, 2018 at 12:43:52PM +0100, Mark Rutland wrote: > > Please see the devicetree spec [1], section 2.3.4. Valid values are: > > > > * "okay" // equivalent to no status property present > > * "disabled" > > * "fail" > > *

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Mark Rutland
On Fri, Jul 06, 2018 at 08:26:31PM +0800, Guo Ren wrote: > On Fri, Jul 06, 2018 at 12:43:52PM +0100, Mark Rutland wrote: > > Please see the devicetree spec [1], section 2.3.4. Valid values are: > > > > * "okay" // equivalent to no status property present > > * "disabled" > > * "fail" > > *

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 11:39:32AM +0200, Peter Zijlstra wrote: > On Fri, Jul 06, 2018 at 02:07:40PM +0800, Guo Ren wrote: > > > > Please explain those mb()'s... I'm thinking you meant to use smp_mb(). > > Yes, smp_mb(). Current smp_mb()() is the same: sync.is. > > > > In next version patch,

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 11:39:32AM +0200, Peter Zijlstra wrote: > On Fri, Jul 06, 2018 at 02:07:40PM +0800, Guo Ren wrote: > > > > Please explain those mb()'s... I'm thinking you meant to use smp_mb(). > > Yes, smp_mb(). Current smp_mb()() is the same: sync.is. > > > > In next version patch,

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 12:43:52PM +0100, Mark Rutland wrote: > Please see the devicetree spec [1], section 2.3.4. Valid values are: > > * "okay" // equivalent to no status property present > * "disabled" > * "fail" > * "fail-sss" Nice tip, thx. > I'm a bit confused. You write (1 << cpu) into

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 12:43:52PM +0100, Mark Rutland wrote: > Please see the devicetree spec [1], section 2.3.4. Valid values are: > > * "okay" // equivalent to no status property present > * "disabled" > * "fail" > * "fail-sss" Nice tip, thx. > I'm a bit confused. You write (1 << cpu) into

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Mark Rutland
On Fri, Jul 06, 2018 at 07:32:01PM +0800, Guo Ren wrote: > On Fri, Jul 06, 2018 at 06:24:33AM +0100, Mark Rutland wrote: > > > + if (cpu >= NR_CPUS) > > > + goto error; > > > + > > > + if (of_property_read_string(node, "status", )) > > > + status = "enable"; > > > + > > > + if

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Mark Rutland
On Fri, Jul 06, 2018 at 07:32:01PM +0800, Guo Ren wrote: > On Fri, Jul 06, 2018 at 06:24:33AM +0100, Mark Rutland wrote: > > > + if (cpu >= NR_CPUS) > > > + goto error; > > > + > > > + if (of_property_read_string(node, "status", )) > > > + status = "enable"; > > > + > > > + if

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 06:24:33AM +0100, Mark Rutland wrote: > > + if (cpu >= NR_CPUS) > > + goto error; > > + > > + if (of_property_read_string(node, "status", )) > > + status = "enable"; > > + > > + if (strcmp(status, "disable") == 0) > > + goto error; > >

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 06:24:33AM +0100, Mark Rutland wrote: > > + if (cpu >= NR_CPUS) > > + goto error; > > + > > + if (of_property_read_string(node, "status", )) > > + status = "enable"; > > + > > + if (strcmp(status, "disable") == 0) > > + goto error; > >

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Peter Zijlstra
On Fri, Jul 06, 2018 at 02:07:40PM +0800, Guo Ren wrote: > > Please explain those mb()'s... I'm thinking you meant to use smp_mb(). > Yes, smp_mb(). Current smp_mb()() is the same: sync.is. > > In next version patch, I'll seperate smp_mb() and mb() and use ld/st.barrier > instead of sync.is.

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Peter Zijlstra
On Fri, Jul 06, 2018 at 02:07:40PM +0800, Guo Ren wrote: > > Please explain those mb()'s... I'm thinking you meant to use smp_mb(). > Yes, smp_mb(). Current smp_mb()() is the same: sync.is. > > In next version patch, I'll seperate smp_mb() and mb() and use ld/st.barrier > instead of sync.is.

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Thu, Jul 05, 2018 at 08:05:03PM +0200, Peter Zijlstra wrote: > On Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > > +static irqreturn_t handle_ipi(int irq, void *dev) > > +{ > > + unsigned long *pending_ipis = _data[smp_processor_id()].bits; > > + > > + while (true) { > > +

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Thu, Jul 05, 2018 at 08:05:03PM +0200, Peter Zijlstra wrote: > On Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > > +static irqreturn_t handle_ipi(int irq, void *dev) > > +{ > > + unsigned long *pending_ipis = _data[smp_processor_id()].bits; > > + > > + while (true) { > > +

Re: [PATCH V2 16/19] csky: SMP support

2018-07-05 Thread Mark Rutland
On Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > +static int csky_of_cpu(struct device_node *node) > +{ > + const char *status; > + int cpu; > + > + if (of_property_read_u32(node, "reg", )) > + goto error; > + > + if (cpu >= NR_CPUS) > + goto

Re: [PATCH V2 16/19] csky: SMP support

2018-07-05 Thread Mark Rutland
On Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > +static int csky_of_cpu(struct device_node *node) > +{ > + const char *status; > + int cpu; > + > + if (of_property_read_u32(node, "reg", )) > + goto error; > + > + if (cpu >= NR_CPUS) > + goto

Re: [PATCH V2 16/19] csky: SMP support

2018-07-05 Thread Peter Zijlstra
On Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > +static irqreturn_t handle_ipi(int irq, void *dev) > +{ > + unsigned long *pending_ipis = _data[smp_processor_id()].bits; > + > + while (true) { > + unsigned long ops; > + > + /* Order bit clearing and data

Re: [PATCH V2 16/19] csky: SMP support

2018-07-05 Thread Peter Zijlstra
On Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > +static irqreturn_t handle_ipi(int irq, void *dev) > +{ > + unsigned long *pending_ipis = _data[smp_processor_id()].bits; > + > + while (true) { > + unsigned long ops; > + > + /* Order bit clearing and data

[PATCH V2 16/19] csky: SMP support

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/smp.h | 26 + arch/csky/kernel/smp.c | 256 2 files changed, 282 insertions(+) create mode 100644 arch/csky/include/asm/smp.h create mode 100644 arch/csky/kernel/smp.c diff --git

[PATCH V2 16/19] csky: SMP support

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/smp.h | 26 + arch/csky/kernel/smp.c | 256 2 files changed, 282 insertions(+) create mode 100644 arch/csky/include/asm/smp.h create mode 100644 arch/csky/kernel/smp.c diff --git