* [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-29 18:29 ` Jan Henrik Weinstock 0 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-01-29 18:29 UTC (permalink / raw) To: jonas, stefan.kristiansson, shorne, openrisc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1467 bytes --] This patch proposes to use the device tree to determine the present cpus instead of assuming all CONFIG_NRCPUS are actually present in the system. Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> --- arch/openrisc/kernel/smp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 29c82ef2e..75be7e34f 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -16,6 +16,7 @@ #include <linux/sched.h> #include <linux/sched/mm.h> #include <linux/irq.h> +#include <linux/of.h> #include <asm/cpuinfo.h> #include <asm/mmu_context.h> #include <asm/tlbflush.h> @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) void __init smp_prepare_cpus(unsigned int max_cpus) { - int i; + u32 cpu_id; + struct device_node *cpu, *cpus; /* * Initialise the present map, which describes the set of CPUs * actually populated at the present time. */ - for (i = 0; i < max_cpus; i++) - set_cpu_present(i, true); + cpus = of_find_node_by_path("/cpus"); + for_each_child_of_node(cpus, cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } + + if (cpu_id >= max_cpus) + continue; + + set_cpu_present(cpu_id, true); + } } void __init smp_cpus_done(unsigned int max_cpus) -- 2.17.1 [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 5316 bytes --] ^ permalink raw reply related [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-29 18:29 ` Jan Henrik Weinstock 0 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-01-29 18:29 UTC (permalink / raw) To: openrisc This patch proposes to use the device tree to determine the present cpus instead of assuming all CONFIG_NRCPUS are actually present in the system. Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> --- arch/openrisc/kernel/smp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 29c82ef2e..75be7e34f 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -16,6 +16,7 @@ #include <linux/sched.h> #include <linux/sched/mm.h> #include <linux/irq.h> +#include <linux/of.h> #include <asm/cpuinfo.h> #include <asm/mmu_context.h> #include <asm/tlbflush.h> @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) void __init smp_prepare_cpus(unsigned int max_cpus) { - int i; + u32 cpu_id; + struct device_node *cpu, *cpus; /* * Initialise the present map, which describes the set of CPUs * actually populated at the present time. */ - for (i = 0; i < max_cpus; i++) - set_cpu_present(i, true); + cpus = of_find_node_by_path("/cpus"); + for_each_child_of_node(cpus, cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } + + if (cpu_id >= max_cpus) + continue; + + set_cpu_present(cpu_id, true); + } } void __init smp_cpus_done(unsigned int max_cpus) -- 2.17.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5316 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20210129/5cfbcebd/attachment.bin> ^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-29 18:29 ` [OpenRISC] " Jan Henrik Weinstock @ 2021-01-29 22:16 ` Stafford Horne -1 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-29 22:16 UTC (permalink / raw) To: Jan Henrik Weinstock; +Cc: jonas, stefan.kristiansson, openrisc, linux-kernel On Fri, Jan 29, 2021 at 07:29:31PM +0100, Jan Henrik Weinstock wrote: > This patch proposes to use the device tree to determine the present cpus > instead of assuming all CONFIG_NRCPUS are actually present in the system. > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > --- > arch/openrisc/kernel/smp.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c > index 29c82ef2e..75be7e34f 100644 > --- a/arch/openrisc/kernel/smp.c > +++ b/arch/openrisc/kernel/smp.c > @@ -16,6 +16,7 @@ > #include <linux/sched.h> > #include <linux/sched/mm.h> > #include <linux/irq.h> > +#include <linux/of.h> > #include <asm/cpuinfo.h> > #include <asm/mmu_context.h> > #include <asm/tlbflush.h> > @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) > > void __init smp_prepare_cpus(unsigned int max_cpus) > { > - int i; > + u32 cpu_id; > + struct device_node *cpu, *cpus; > > /* > * Initialise the present map, which describes the set of CPUs > * actually populated at the present time. > */ > - for (i = 0; i < max_cpus; i++) > - set_cpu_present(i, true); > + cpus = of_find_node_by_path("/cpus"); > + for_each_child_of_node(cpus, cpu) { > + if (of_property_read_u32(cpu, "reg", &cpu_id)) { > + pr_warn("%s missing reg property", cpu->full_name); > + continue; > + } > + > + if (cpu_id >= max_cpus) > + continue; > + > + set_cpu_present(cpu_id, true); > + } Hello, I looked into what other architectures do. Risc-V does something similar but it does the setup in 2 parts: - it uses the device tree to set possible CPU's in setup_smp. Using for_each_of_cpu_node and set_cpu_possible. - Then in smp_prepare_cpus, it loops over possible cpus with for_each_possible_cpu. Note, it seems risc-v does't actually check max_cpus when setting set_cpu_present which may be a bug. I think the two part approach is what we want to do: - we should do set_cpu_possible in smp_init_cpus based on device tree. Basically the same as your loop above but using for_each_of_cpu_node and NR_CPUS. - we can then do set_cpu_present using for_each_possible_cpu in smp_prepare_cpus. What do you think? -Stafford > } > > void __init smp_cpus_done(unsigned int max_cpus) > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-29 22:16 ` Stafford Horne 0 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-29 22:16 UTC (permalink / raw) To: openrisc On Fri, Jan 29, 2021 at 07:29:31PM +0100, Jan Henrik Weinstock wrote: > This patch proposes to use the device tree to determine the present cpus > instead of assuming all CONFIG_NRCPUS are actually present in the system. > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > --- > arch/openrisc/kernel/smp.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c > index 29c82ef2e..75be7e34f 100644 > --- a/arch/openrisc/kernel/smp.c > +++ b/arch/openrisc/kernel/smp.c > @@ -16,6 +16,7 @@ > #include <linux/sched.h> > #include <linux/sched/mm.h> > #include <linux/irq.h> > +#include <linux/of.h> > #include <asm/cpuinfo.h> > #include <asm/mmu_context.h> > #include <asm/tlbflush.h> > @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) > > void __init smp_prepare_cpus(unsigned int max_cpus) > { > - int i; > + u32 cpu_id; > + struct device_node *cpu, *cpus; > > /* > * Initialise the present map, which describes the set of CPUs > * actually populated at the present time. > */ > - for (i = 0; i < max_cpus; i++) > - set_cpu_present(i, true); > + cpus = of_find_node_by_path("/cpus"); > + for_each_child_of_node(cpus, cpu) { > + if (of_property_read_u32(cpu, "reg", &cpu_id)) { > + pr_warn("%s missing reg property", cpu->full_name); > + continue; > + } > + > + if (cpu_id >= max_cpus) > + continue; > + > + set_cpu_present(cpu_id, true); > + } Hello, I looked into what other architectures do. Risc-V does something similar but it does the setup in 2 parts: - it uses the device tree to set possible CPU's in setup_smp. Using for_each_of_cpu_node and set_cpu_possible. - Then in smp_prepare_cpus, it loops over possible cpus with for_each_possible_cpu. Note, it seems risc-v does't actually check max_cpus when setting set_cpu_present which may be a bug. I think the two part approach is what we want to do: - we should do set_cpu_possible in smp_init_cpus based on device tree. Basically the same as your loop above but using for_each_of_cpu_node and NR_CPUS. - we can then do set_cpu_present using for_each_possible_cpu in smp_prepare_cpus. What do you think? -Stafford > } > > void __init smp_cpus_done(unsigned int max_cpus) > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-29 22:16 ` [OpenRISC] " Stafford Horne @ 2021-01-30 11:00 ` Jan Henrik Weinstock -1 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-01-30 11:00 UTC (permalink / raw) To: Stafford Horne, geert; +Cc: jonas, stefan.kristiansson, openrisc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1748 bytes --] Hi Stafford, Geert, thanks for your feedback. I have made the following changes to the patch: 1. use for_each_of_cpu_node 2. possible_cpus is now what is in the devicetree, up to NR_CPUS 3. present_cpus is now all possible cpus, up to max_cpus Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> --- arch/openrisc/kernel/smp.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 29c82ef2e..83cbf43d4 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -16,6 +16,7 @@ #include <linux/sched.h> #include <linux/sched/mm.h> #include <linux/irq.h> +#include <linux/of.h> #include <asm/cpuinfo.h> #include <asm/mmu_context.h> #include <asm/tlbflush.h> @@ -60,22 +61,32 @@ void __init smp_prepare_boot_cpu(void) void __init smp_init_cpus(void) { - int i; + struct device_node* cpu; + u32 cpu_id; - for (i = 0; i < NR_CPUS; i++) - set_cpu_possible(i, true); + for_each_of_cpu_node(cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } + + if (cpu_id < NR_CPUS) + set_cpu_possible(cpu_id, true); + } } void __init smp_prepare_cpus(unsigned int max_cpus) { - int i; + unsigned int cpu; /* * Initialise the present map, which describes the set of CPUs * actually populated at the present time. */ - for (i = 0; i < max_cpus; i++) - set_cpu_present(i, true); + for_each_possible_cpu(cpu) { + if (cpu < max_cpus) + set_cpu_present(cpu, true); + } } void __init smp_cpus_done(unsigned int max_cpus) -- 2.17.1 [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 5316 bytes --] ^ permalink raw reply related [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-30 11:00 ` Jan Henrik Weinstock 0 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-01-30 11:00 UTC (permalink / raw) To: openrisc Hi Stafford, Geert, thanks for your feedback. I have made the following changes to the patch: 1. use for_each_of_cpu_node 2. possible_cpus is now what is in the devicetree, up to NR_CPUS 3. present_cpus is now all possible cpus, up to max_cpus Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> --- arch/openrisc/kernel/smp.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 29c82ef2e..83cbf43d4 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -16,6 +16,7 @@ #include <linux/sched.h> #include <linux/sched/mm.h> #include <linux/irq.h> +#include <linux/of.h> #include <asm/cpuinfo.h> #include <asm/mmu_context.h> #include <asm/tlbflush.h> @@ -60,22 +61,32 @@ void __init smp_prepare_boot_cpu(void) void __init smp_init_cpus(void) { - int i; + struct device_node* cpu; + u32 cpu_id; - for (i = 0; i < NR_CPUS; i++) - set_cpu_possible(i, true); + for_each_of_cpu_node(cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } + + if (cpu_id < NR_CPUS) + set_cpu_possible(cpu_id, true); + } } void __init smp_prepare_cpus(unsigned int max_cpus) { - int i; + unsigned int cpu; /* * Initialise the present map, which describes the set of CPUs * actually populated@the present time. */ - for (i = 0; i < max_cpus; i++) - set_cpu_present(i, true); + for_each_possible_cpu(cpu) { + if (cpu < max_cpus) + set_cpu_present(cpu, true); + } } void __init smp_cpus_done(unsigned int max_cpus) -- 2.17.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5316 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20210130/0e05546d/attachment.bin> ^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-30 11:00 ` [OpenRISC] " Jan Henrik Weinstock @ 2021-01-30 23:03 ` Stafford Horne -1 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-30 23:03 UTC (permalink / raw) To: Jan Henrik Weinstock, g Cc: geert, jonas, stefan.kristiansson, openrisc, linux-kernel On Sat, Jan 30, 2021 at 12:00:10PM +0100, Jan Henrik Weinstock wrote: > Hi Stafford, Geert, > > thanks for your feedback. I have made the following changes to the patch: Hi, Thanks for the updates. > 1. use for_each_of_cpu_node > 2. possible_cpus is now what is in the devicetree, up to NR_CPUS > 3. present_cpus is now all possible cpus, up to max_cpus This looks good, one small comment below. Can you send the next patch as a v2? Using 'git format-patch -v2 ...' > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > --- You can include the 'Changes since v1' in the space here after '---'. > arch/openrisc/kernel/smp.c | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > > diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c > index 29c82ef2e..83cbf43d4 100644 > --- a/arch/openrisc/kernel/smp.c > +++ b/arch/openrisc/kernel/smp.c > @@ -16,6 +16,7 @@ > #include <linux/sched.h> > #include <linux/sched/mm.h> > #include <linux/irq.h> > +#include <linux/of.h> > #include <asm/cpuinfo.h> > #include <asm/mmu_context.h> > #include <asm/tlbflush.h> > @@ -60,22 +61,32 @@ void __init smp_prepare_boot_cpu(void) > > void __init smp_init_cpus(void) > { > - int i; > + struct device_node* cpu; > + u32 cpu_id; > > - for (i = 0; i < NR_CPUS; i++) > - set_cpu_possible(i, true); > + for_each_of_cpu_node(cpu) { > + if (of_property_read_u32(cpu, "reg", &cpu_id)) { > + pr_warn("%s missing reg property", cpu->full_name); > + continue; > + } > + > + if (cpu_id < NR_CPUS) Should we warn on the else case? > + set_cpu_possible(cpu_id, true); > + } > } -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-30 23:03 ` Stafford Horne 0 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-30 23:03 UTC (permalink / raw) To: openrisc On Sat, Jan 30, 2021 at 12:00:10PM +0100, Jan Henrik Weinstock wrote: > Hi Stafford, Geert, > > thanks for your feedback. I have made the following changes to the patch: Hi, Thanks for the updates. > 1. use for_each_of_cpu_node > 2. possible_cpus is now what is in the devicetree, up to NR_CPUS > 3. present_cpus is now all possible cpus, up to max_cpus This looks good, one small comment below. Can you send the next patch as a v2? Using 'git format-patch -v2 ...' > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > --- You can include the 'Changes since v1' in the space here after '---'. > arch/openrisc/kernel/smp.c | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > > diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c > index 29c82ef2e..83cbf43d4 100644 > --- a/arch/openrisc/kernel/smp.c > +++ b/arch/openrisc/kernel/smp.c > @@ -16,6 +16,7 @@ > #include <linux/sched.h> > #include <linux/sched/mm.h> > #include <linux/irq.h> > +#include <linux/of.h> > #include <asm/cpuinfo.h> > #include <asm/mmu_context.h> > #include <asm/tlbflush.h> > @@ -60,22 +61,32 @@ void __init smp_prepare_boot_cpu(void) > > void __init smp_init_cpus(void) > { > - int i; > + struct device_node* cpu; > + u32 cpu_id; > > - for (i = 0; i < NR_CPUS; i++) > - set_cpu_possible(i, true); > + for_each_of_cpu_node(cpu) { > + if (of_property_read_u32(cpu, "reg", &cpu_id)) { > + pr_warn("%s missing reg property", cpu->full_name); > + continue; > + } > + > + if (cpu_id < NR_CPUS) Should we warn on the else case? > + set_cpu_possible(cpu_id, true); > + } > } -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-30 23:03 ` [OpenRISC] " Stafford Horne @ 2021-01-30 23:11 ` Stafford Horne -1 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-30 23:11 UTC (permalink / raw) To: Jan Henrik Weinstock Cc: geert, jonas, stefan.kristiansson, openrisc, linux-kernel Sorry, Please disrecard the g@lianli.shorne-pla.net address in the mail distribution list. I must have it a incorrect button. -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-30 23:11 ` Stafford Horne 0 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-30 23:11 UTC (permalink / raw) To: openrisc Sorry, Please disrecard the g at lianli.shorne-pla.net address in the mail distribution list. I must have it a incorrect button. -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-30 23:03 ` [OpenRISC] " Stafford Horne @ 2021-01-31 8:22 ` Jan Henrik Weinstock -1 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-01-31 8:22 UTC (permalink / raw) To: Stafford Horne; +Cc: geert, jonas, stefan.kristiansson, openrisc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 497 bytes --] On 31/01/2021 00:03, Stafford Horne wrote: > This looks good, one small comment below. Can you send the next patch as a v2? > > Using 'git format-patch -v2 ...' Sorry, was not aware of that, will do better next time! > Should we warn on the else case? I think it is fine for the kernel to have room for more CPUs than are actually present (i.e. NR_CPUs > present_cpus is OK). Other Archs do not show a warning in this case either, therefore I also omitted it. Gruss Jan [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 5316 bytes --] ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-31 8:22 ` Jan Henrik Weinstock 0 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-01-31 8:22 UTC (permalink / raw) To: openrisc On 31/01/2021 00:03, Stafford Horne wrote: > This looks good, one small comment below. Can you send the next patch as a v2? > > Using 'git format-patch -v2 ...' Sorry, was not aware of that, will do better next time! > Should we warn on the else case? I think it is fine for the kernel to have room for more CPUs than are actually present (i.e. NR_CPUs > present_cpus is OK). Other Archs do not show a warning in this case either, therefore I also omitted it. Gruss Jan -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5316 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20210131/803cf008/attachment-0001.bin> ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-31 8:22 ` [OpenRISC] " Jan Henrik Weinstock @ 2021-01-31 21:27 ` Stafford Horne -1 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-31 21:27 UTC (permalink / raw) To: Jan Henrik Weinstock Cc: geert, jonas, stefan.kristiansson, openrisc, linux-kernel On Sun, Jan 31, 2021 at 09:22:31AM +0100, Jan Henrik Weinstock wrote: > On 31/01/2021 00:03, Stafford Horne wrote: > > > This looks good, one small comment below. Can you send the next patch as a v2? > > > > Using 'git format-patch -v2 ...' > > Sorry, was not aware of that, will do better next time! > > > Should we warn on the else case? > > I think it is fine for the kernel to have room for more CPUs than are > actually present (i.e. NR_CPUs > present_cpus is OK). Other Archs do not > show a warning in this case either, therefore I also omitted it. Fair enough. Reviewed-by: Stafford Horne <shorne@gmail.com> I can queue this for 5.12 when you send v2. -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-31 21:27 ` Stafford Horne 0 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-01-31 21:27 UTC (permalink / raw) To: openrisc On Sun, Jan 31, 2021 at 09:22:31AM +0100, Jan Henrik Weinstock wrote: > On 31/01/2021 00:03, Stafford Horne wrote: > > > This looks good, one small comment below. Can you send the next patch as a v2? > > > > Using 'git format-patch -v2 ...' > > Sorry, was not aware of that, will do better next time! > > > Should we warn on the else case? > > I think it is fine for the kernel to have room for more CPUs than are > actually present (i.e. NR_CPUs > present_cpus is OK). Other Archs do not > show a warning in this case either, therefore I also omitted it. Fair enough. Reviewed-by: Stafford Horne <shorne@gmail.com> I can queue this for 5.12 when you send v2. -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH v2] openrisc: use device tree to determine present cpus 2021-01-31 21:27 ` [OpenRISC] " Stafford Horne @ 2021-02-01 11:49 ` Jan Henrik Weinstock -1 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-02-01 11:49 UTC (permalink / raw) To: Stafford Horne, geert; +Cc: jonas, stefan.kristiansson, openrisc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1812 bytes --] Use the device tree to determine the present cpus instead of assuming all CONFIG_NRCPUS are actually present in the system. Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> --- Changes since v1: 1. use for_each_of_cpu_node 2. possible_cpus is now what is in the devicetree, up to NR_CPUS 3. present_cpus is now all possible cpus, up to max_cpus arch/openrisc/kernel/smp.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 75be7e34f..83cbf43d4 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -61,32 +61,31 @@ void __init smp_prepare_boot_cpu(void) void __init smp_init_cpus(void) { - int i; + struct device_node* cpu; + u32 cpu_id; + + for_each_of_cpu_node(cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } - for (i = 0; i < NR_CPUS; i++) - set_cpu_possible(i, true); + if (cpu_id < NR_CPUS) + set_cpu_possible(cpu_id, true); + } } void __init smp_prepare_cpus(unsigned int max_cpus) { - u32 cpu_id; - struct device_node *cpu, *cpus; + unsigned int cpu; /* * Initialise the present map, which describes the set of CPUs * actually populated at the present time. */ - cpus = of_find_node_by_path("/cpus"); - for_each_child_of_node(cpus, cpu) { - if (of_property_read_u32(cpu, "reg", &cpu_id)) { - pr_warn("%s missing reg property", cpu->full_name); - continue; - } - - if (cpu_id >= max_cpus) - continue; - - set_cpu_present(cpu_id, true); + for_each_possible_cpu(cpu) { + if (cpu < max_cpus) + set_cpu_present(cpu, true); } } -- 2.17.1 [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 5316 bytes --] ^ permalink raw reply related [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus @ 2021-02-01 11:49 ` Jan Henrik Weinstock 0 siblings, 0 replies; 29+ messages in thread From: Jan Henrik Weinstock @ 2021-02-01 11:49 UTC (permalink / raw) To: openrisc Use the device tree to determine the present cpus instead of assuming all CONFIG_NRCPUS are actually present in the system. Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> --- Changes since v1: 1. use for_each_of_cpu_node 2. possible_cpus is now what is in the devicetree, up to NR_CPUS 3. present_cpus is now all possible cpus, up to max_cpus arch/openrisc/kernel/smp.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 75be7e34f..83cbf43d4 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -61,32 +61,31 @@ void __init smp_prepare_boot_cpu(void) void __init smp_init_cpus(void) { - int i; + struct device_node* cpu; + u32 cpu_id; + + for_each_of_cpu_node(cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } - for (i = 0; i < NR_CPUS; i++) - set_cpu_possible(i, true); + if (cpu_id < NR_CPUS) + set_cpu_possible(cpu_id, true); + } } void __init smp_prepare_cpus(unsigned int max_cpus) { - u32 cpu_id; - struct device_node *cpu, *cpus; + unsigned int cpu; /* * Initialise the present map, which describes the set of CPUs * actually populated@the present time. */ - cpus = of_find_node_by_path("/cpus"); - for_each_child_of_node(cpus, cpu) { - if (of_property_read_u32(cpu, "reg", &cpu_id)) { - pr_warn("%s missing reg property", cpu->full_name); - continue; - } - - if (cpu_id >= max_cpus) - continue; - - set_cpu_present(cpu_id, true); + for_each_possible_cpu(cpu) { + if (cpu < max_cpus) + set_cpu_present(cpu, true); } } -- 2.17.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5316 bytes Desc: S/MIME Cryptographic Signature URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20210201/0e1d6181/attachment.bin> ^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH v2] openrisc: use device tree to determine present cpus 2021-02-01 11:49 ` [OpenRISC] " Jan Henrik Weinstock @ 2021-02-05 14:43 ` Stafford Horne -1 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-02-05 14:43 UTC (permalink / raw) To: Jan Henrik Weinstock Cc: geert, jonas, stefan.kristiansson, openrisc, linux-kernel On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > Use the device tree to determine the present cpus instead of assuming all > CONFIG_NRCPUS are actually present in the system. > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> Hi Jan, I cannot apply this patch, it seems you somehow sent it signed as a multipart message via Thunderbird. This causes errors when trying to apply, even after I tried to manually fix the patch mail: Applying: openrisc: use device tree to determine present cpus error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). error: could not build fake ancestor Patch failed at 0001 openrisc: use device tree to determine present cpus Can you send this using 'git send-email?' If not I can get it applied with some work, otherwise you can point me to a git repo which I can pull it from. -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus @ 2021-02-05 14:43 ` Stafford Horne 0 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-02-05 14:43 UTC (permalink / raw) To: openrisc On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > Use the device tree to determine the present cpus instead of assuming all > CONFIG_NRCPUS are actually present in the system. > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> Hi Jan, I cannot apply this patch, it seems you somehow sent it signed as a multipart message via Thunderbird. This causes errors when trying to apply, even after I tried to manually fix the patch mail: Applying: openrisc: use device tree to determine present cpus error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). error: could not build fake ancestor Patch failed at 0001 openrisc: use device tree to determine present cpus Can you send this using 'git send-email?' If not I can get it applied with some work, otherwise you can point me to a git repo which I can pull it from. -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v2] openrisc: use device tree to determine present cpus 2021-02-05 14:43 ` [OpenRISC] " Stafford Horne @ 2021-02-05 16:07 ` Geert Uytterhoeven -1 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-02-05 16:07 UTC (permalink / raw) To: Stafford Horne Cc: Jan Henrik Weinstock, Jonas Bonn, Stefan Kristiansson, Openrisc, Linux Kernel Mailing List Hi Stafford, On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > Use the device tree to determine the present cpus instead of assuming all > > CONFIG_NRCPUS are actually present in the system. > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > Hi Jan, > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > message via Thunderbird. > > This causes errors when trying to apply, even after I tried to manually fix the > patch mail: > > Applying: openrisc: use device tree to determine present cpus > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > error: could not build fake ancestor > Patch failed at 0001 openrisc: use device tree to determine present cpus > > Can you send this using 'git send-email?' > > If not I can get it applied with some work, otherwise you can point me to a git > repo which I can pull it from. "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de" works fine for me. git://git.kernel.org/pub/scm/utils/b4/b4.git Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus @ 2021-02-05 16:07 ` Geert Uytterhoeven 0 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-02-05 16:07 UTC (permalink / raw) To: openrisc Hi Stafford, On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > Use the device tree to determine the present cpus instead of assuming all > > CONFIG_NRCPUS are actually present in the system. > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > Hi Jan, > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > message via Thunderbird. > > This causes errors when trying to apply, even after I tried to manually fix the > patch mail: > > Applying: openrisc: use device tree to determine present cpus > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > error: could not build fake ancestor > Patch failed at 0001 openrisc: use device tree to determine present cpus > > Can you send this using 'git send-email?' > > If not I can get it applied with some work, otherwise you can point me to a git > repo which I can pull it from. "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de" works fine for me. git://git.kernel.org/pub/scm/utils/b4/b4.git Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v2] openrisc: use device tree to determine present cpus 2021-02-05 16:07 ` [OpenRISC] " Geert Uytterhoeven @ 2021-02-05 22:36 ` Stafford Horne -1 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-02-05 22:36 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Jan Henrik Weinstock, Jonas Bonn, Stefan Kristiansson, Openrisc, Linux Kernel Mailing List On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > Hi Stafford, > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > Use the device tree to determine the present cpus instead of assuming all > > > CONFIG_NRCPUS are actually present in the system. > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > Hi Jan, > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > message via Thunderbird. > > > > This causes errors when trying to apply, even after I tried to manually fix the > > patch mail: > > > > Applying: openrisc: use device tree to determine present cpus > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > error: could not build fake ancestor > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > Can you send this using 'git send-email?' > > > > If not I can get it applied with some work, otherwise you can point me to a git > > repo which I can pull it from. > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de" works > fine for me. > > git://git.kernel.org/pub/scm/utils/b4/b4.git Did it work? For me I got, base not found. Looking up https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de Grabbing thread from lore.kernel.org/lkml Analyzing 9 messages in the thread Will use the latest revision: v2 You can pick other revisions using the -vN flag --- Writing ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx [PATCH v2] openrisc: use device tree to determine present cpus --- Total patches: 1 --- Link: https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de Base: not found git am ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus @ 2021-02-05 22:36 ` Stafford Horne 0 siblings, 0 replies; 29+ messages in thread From: Stafford Horne @ 2021-02-05 22:36 UTC (permalink / raw) To: openrisc On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > Hi Stafford, > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > Use the device tree to determine the present cpus instead of assuming all > > > CONFIG_NRCPUS are actually present in the system. > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > Hi Jan, > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > message via Thunderbird. > > > > This causes errors when trying to apply, even after I tried to manually fix the > > patch mail: > > > > Applying: openrisc: use device tree to determine present cpus > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > error: could not build fake ancestor > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > Can you send this using 'git send-email?' > > > > If not I can get it applied with some work, otherwise you can point me to a git > > repo which I can pull it from. > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de" works > fine for me. > > git://git.kernel.org/pub/scm/utils/b4/b4.git Did it work? For me I got, base not found. Looking up https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de Grabbing thread from lore.kernel.org/lkml Analyzing 9 messages in the thread Will use the latest revision: v2 You can pick other revisions using the -vN flag --- Writing ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx [PATCH v2] openrisc: use device tree to determine present cpus --- Total patches: 1 --- Link: https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de Base: not found git am ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx -Stafford ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v2] openrisc: use device tree to determine present cpus 2021-02-05 22:36 ` [OpenRISC] " Stafford Horne @ 2021-02-06 9:33 ` Geert Uytterhoeven -1 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-02-06 9:33 UTC (permalink / raw) To: Stafford Horne Cc: Jan Henrik Weinstock, Jonas Bonn, Stefan Kristiansson, Openrisc, Linux Kernel Mailing List Hi Stafford, On Fri, Feb 5, 2021 at 11:36 PM Stafford Horne <shorne@gmail.com> wrote: > On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > > Use the device tree to determine the present cpus instead of assuming all > > > > CONFIG_NRCPUS are actually present in the system. > > > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > > message via Thunderbird. > > > > > > This causes errors when trying to apply, even after I tried to manually fix the > > > patch mail: > > > > > > Applying: openrisc: use device tree to determine present cpus > > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > > error: could not build fake ancestor > > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > > > Can you send this using 'git send-email?' > > > > > > If not I can get it applied with some work, otherwise you can point me to a git > > > repo which I can pull it from. > > > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de" works > > fine for me. > > > > git://git.kernel.org/pub/scm/utils/b4/b4.git > > Did it work? For me I got, base not found. > > Looking up > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de > Grabbing thread from lore.kernel.org/lkml > Analyzing 9 messages in the thread > Will use the latest revision: v2 > You can pick other revisions using the -vN flag > --- > Writing > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > [PATCH v2] openrisc: use device tree to determine present cpus > --- > Total patches: 1 > --- > Link: > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de > Base: not found That just means the patch contains no information w.r.t. its base, i.e. against which tree/commit it applies to. To be ignored. > git am > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx Just run the above command ;-) In addition, you can run "formail -s scripts/checkpatch.pl < *mbx" first, to run the mbox (which could contain multiple patches) through checkpatch. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus @ 2021-02-06 9:33 ` Geert Uytterhoeven 0 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-02-06 9:33 UTC (permalink / raw) To: openrisc Hi Stafford, On Fri, Feb 5, 2021 at 11:36 PM Stafford Horne <shorne@gmail.com> wrote: > On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > > Use the device tree to determine the present cpus instead of assuming all > > > > CONFIG_NRCPUS are actually present in the system. > > > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > > message via Thunderbird. > > > > > > This causes errors when trying to apply, even after I tried to manually fix the > > > patch mail: > > > > > > Applying: openrisc: use device tree to determine present cpus > > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > > error: could not build fake ancestor > > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > > > Can you send this using 'git send-email?' > > > > > > If not I can get it applied with some work, otherwise you can point me to a git > > > repo which I can pull it from. > > > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de" works > > fine for me. > > > > git://git.kernel.org/pub/scm/utils/b4/b4.git > > Did it work? For me I got, base not found. > > Looking up > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de > Grabbing thread from lore.kernel.org/lkml > Analyzing 9 messages in the thread > Will use the latest revision: v2 > You can pick other revisions using the -vN flag > --- > Writing > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > [PATCH v2] openrisc: use device tree to determine present cpus > --- > Total patches: 1 > --- > Link: > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de > Base: not found That just means the patch contains no information w.r.t. its base, i.e. against which tree/commit it applies to. To be ignored. > git am > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx Just run the above command ;-) In addition, you can run "formail -s scripts/checkpatch.pl < *mbx" first, to run the mbox (which could contain multiple patches) through checkpatch. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus 2021-02-06 9:33 ` [OpenRISC] " Geert Uytterhoeven (?) @ 2021-02-08 12:16 ` Stafford Horne 2021-02-08 12:22 ` [OpenRISC] " Geert Uytterhoeven -1 siblings, 1 reply; 29+ messages in thread From: Stafford Horne @ 2021-02-08 12:16 UTC (permalink / raw) To: openrisc On Sat, Feb 06, 2021 at 10:33:24AM +0100, Geert Uytterhoeven wrote: > Hi Stafford, > > On Fri, Feb 5, 2021 at 11:36 PM Stafford Horne <shorne@gmail.com> wrote: > > On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > > > Use the device tree to determine the present cpus instead of assuming all > > > > > CONFIG_NRCPUS are actually present in the system. > > > > > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > > > message via Thunderbird. > > > > > > > > This causes errors when trying to apply, even after I tried to manually fix the > > > > patch mail: > > > > > > > > Applying: openrisc: use device tree to determine present cpus > > > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > > > error: could not build fake ancestor > > > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > > > > > Can you send this using 'git send-email?' > > > > > > > > If not I can get it applied with some work, otherwise you can point me to a git > > > > repo which I can pull it from. > > > > > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de" works > > > fine for me. > > > > > > git://git.kernel.org/pub/scm/utils/b4/b4.git > > > > Did it work? For me I got, base not found. > > > > Looking up > > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de > > Grabbing thread from lore.kernel.org/lkml > > Analyzing 9 messages in the thread > > Will use the latest revision: v2 > > You can pick other revisions using the -vN flag > > --- > > Writing > > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > > [PATCH v2] openrisc: use device tree to determine present cpus > > --- > > Total patches: 1 > > --- > > Link: > > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de > > Base: not found > > That just means the patch contains no information w.r.t. its base, i.e. > against which tree/commit it applies to. To be ignored. > > > git am > > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > > Just run the above command ;-) > > In addition, you can run "formail -s scripts/checkpatch.pl < *mbx" first, to > run the mbox (which could contain multiple patches) through checkpatch. Hi Geert, Thanks for your help, but this is still not working. See that attached patch. If your patch doesn't have this corruption then please forward it. If Jan could point to a git repo or reset with 'git send-email' that would be great too. It seems that the mailer has corrupted the patch by adding and removing whitespace to each line. I don't have a 'formail' command, but I did try 'git am' and 'checkpatch.pl' and it shows: < shorne@lianli ~/work/linux > git am v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx Applying: openrisc: use device tree to determine present cpus error: corrupt patch at line 62 Patch failed at 0001 openrisc: use device tree to determine present cpus hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". < shorne@lianli ~/work/linux > ./scripts/checkpatch.pl v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx ERROR: "foo* bar" should be "foo *bar" #38: FILE: arch/openrisc/kernel/smp.c:64: + struct device_node* cpu; WARNING: usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc #49: FILE: arch/openrisc/kernel/smp.c:73: + if (cpu_id < NR_CPUS) ERROR: patch seems to be corrupt (line wrapped?) #81: FILE: arch/openrisc/kernel/smp.c:90: 2.17.1 total: 2 errors, 1 warnings, 49 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx has style problems, please review. -Stafford -------------- next part -------------- ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH v2] openrisc: use device tree to determine present cpus 2021-02-08 12:16 ` Stafford Horne @ 2021-02-08 12:22 ` Geert Uytterhoeven 0 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-02-08 12:22 UTC (permalink / raw) To: Stafford Horne Cc: Jan Henrik Weinstock, Jonas Bonn, Stefan Kristiansson, Openrisc, Linux Kernel Mailing List Hi Stafford, On Mon, Feb 8, 2021 at 1:16 PM Stafford Horne <shorne@gmail.com> wrote: > On Sat, Feb 06, 2021 at 10:33:24AM +0100, Geert Uytterhoeven wrote: > > On Fri, Feb 5, 2021 at 11:36 PM Stafford Horne <shorne@gmail.com> wrote: > > > On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > > > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > > > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > > > > Use the device tree to determine the present cpus instead of assuming all > > > > > > CONFIG_NRCPUS are actually present in the system. > > > > > > > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > > > > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > > > > message via Thunderbird. > > > > > > > > > > This causes errors when trying to apply, even after I tried to manually fix the > > > > > patch mail: > > > > > > > > > > Applying: openrisc: use device tree to determine present cpus > > > > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > > > > error: could not build fake ancestor > > > > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > > > > > > > Can you send this using 'git send-email?' > > > > > > > > > > If not I can get it applied with some work, otherwise you can point me to a git > > > > > repo which I can pull it from. > > > > > > > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de" works > > > > fine for me. > > > > > > > > git://git.kernel.org/pub/scm/utils/b4/b4.git > > > > > > Did it work? For me I got, base not found. > > > > > > Looking up > > > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de > > > Grabbing thread from lore.kernel.org/lkml > > > Analyzing 9 messages in the thread > > > Will use the latest revision: v2 > > > You can pick other revisions using the -vN flag > > > --- > > > Writing > > > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > > > [PATCH v2] openrisc: use device tree to determine present cpus > > > --- > > > Total patches: 1 > > > --- > > > Link: > > > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1@rwth-aachen.de > > > Base: not found > > > > That just means the patch contains no information w.r.t. its base, i.e. > > against which tree/commit it applies to. To be ignored. > > > > > git am > > > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > > > > Just run the above command ;-) > > > > In addition, you can run "formail -s scripts/checkpatch.pl < *mbx" first, to > > run the mbox (which could contain multiple patches) through checkpatch. > > Thanks for your help, but this is still not working. See that attached patch. > If your patch doesn't have this corruption then please forward it. If Jan could > point to a git repo or reset with 'git send-email' that would be great too. > > It seems that the mailer has corrupted the patch by adding and removing > whitespace to each line. > > I don't have a 'formail' command, but I did try 'git am' and 'checkpatch.pl' and > it shows: > > < shorne@lianli ~/work/linux > git am v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > Applying: openrisc: use device tree to determine present cpus > error: corrupt patch at line 62 Indeed, the patch is corrupt. Sorry for not verifying that before. I just thought you had an issue saving multipart patches. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH v2] openrisc: use device tree to determine present cpus @ 2021-02-08 12:22 ` Geert Uytterhoeven 0 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-02-08 12:22 UTC (permalink / raw) To: openrisc Hi Stafford, On Mon, Feb 8, 2021 at 1:16 PM Stafford Horne <shorne@gmail.com> wrote: > On Sat, Feb 06, 2021 at 10:33:24AM +0100, Geert Uytterhoeven wrote: > > On Fri, Feb 5, 2021 at 11:36 PM Stafford Horne <shorne@gmail.com> wrote: > > > On Fri, Feb 05, 2021 at 05:07:51PM +0100, Geert Uytterhoeven wrote: > > > > On Fri, Feb 5, 2021 at 3:43 PM Stafford Horne <shorne@gmail.com> wrote: > > > > > On Mon, Feb 01, 2021 at 12:49:31PM +0100, Jan Henrik Weinstock wrote: > > > > > > Use the device tree to determine the present cpus instead of assuming all > > > > > > CONFIG_NRCPUS are actually present in the system. > > > > > > > > > > > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> > > > > > > > > > > I cannot apply this patch, it seems you somehow sent it signed as a multipart > > > > > message via Thunderbird. > > > > > > > > > > This causes errors when trying to apply, even after I tried to manually fix the > > > > > patch mail: > > > > > > > > > > Applying: openrisc: use device tree to determine present cpus > > > > > error: sha1 information is lacking or useless (arch/openrisc/kernel/smp.c). > > > > > error: could not build fake ancestor > > > > > Patch failed at 0001 openrisc: use device tree to determine present cpus > > > > > > > > > > Can you send this using 'git send-email?' > > > > > > > > > > If not I can get it applied with some work, otherwise you can point me to a git > > > > > repo which I can pull it from. > > > > > > > > "b4 am 6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de" works > > > > fine for me. > > > > > > > > git://git.kernel.org/pub/scm/utils/b4/b4.git > > > > > > Did it work? For me I got, base not found. > > > > > > Looking up > > > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1%40rwth-aachen.de > > > Grabbing thread from lore.kernel.org/lkml > > > Analyzing 9 messages in the thread > > > Will use the latest revision: v2 > > > You can pick other revisions using the -vN flag > > > --- > > > Writing > > > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > > > [PATCH v2] openrisc: use device tree to determine present cpus > > > --- > > > Total patches: 1 > > > --- > > > Link: > > > https://lore.kernel.org/r/6dbc27f8-5261-59c5-acba-70f6c6a74ba1 at rwth-aachen.de > > > Base: not found > > > > That just means the patch contains no information w.r.t. its base, i.e. > > against which tree/commit it applies to. To be ignored. > > > > > git am > > > ./v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > > > > Just run the above command ;-) > > > > In addition, you can run "formail -s scripts/checkpatch.pl < *mbx" first, to > > run the mbox (which could contain multiple patches) through checkpatch. > > Thanks for your help, but this is still not working. See that attached patch. > If your patch doesn't have this corruption then please forward it. If Jan could > point to a git repo or reset with 'git send-email' that would be great too. > > It seems that the mailer has corrupted the patch by adding and removing > whitespace to each line. > > I don't have a 'formail' command, but I did try 'git am' and 'checkpatch.pl' and > it shows: > > < shorne@lianli ~/work/linux > git am v2_20210201_jan_weinstock_openrisc_use_device_tree_to_determine_present_cpus.mbx > Applying: openrisc: use device tree to determine present cpus > error: corrupt patch at line 62 Indeed, the patch is corrupt. Sorry for not verifying that before. I just thought you had an issue saving multipart patches. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH] openrisc: use device tree to determine present cpus 2021-01-29 18:29 ` [OpenRISC] " Jan Henrik Weinstock @ 2021-01-30 10:37 ` Geert Uytterhoeven -1 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-01-30 10:37 UTC (permalink / raw) To: Jan Henrik Weinstock Cc: Jonas Bonn, Stefan Kristiansson, Stafford Horne, Openrisc, Linux Kernel Mailing List Hi Jan, On Fri, Jan 29, 2021 at 7:34 PM Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> wrote: > This patch proposes to use the device tree to determine the present cpus > instead of assuming all CONFIG_NRCPUS are actually present in the system. > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> Thanks for your patch! > --- a/arch/openrisc/kernel/smp.c > +++ b/arch/openrisc/kernel/smp.c > @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) > > void __init smp_prepare_cpus(unsigned int max_cpus) > { > - int i; > + u32 cpu_id; > + struct device_node *cpu, *cpus; > > /* > * Initialise the present map, which describes the set of CPUs > * actually populated at the present time. > */ > - for (i = 0; i < max_cpus; i++) > - set_cpu_present(i, true); > + cpus = of_find_node_by_path("/cpus"); > + for_each_child_of_node(cpus, cpu) { for_each_of_cpu_node()? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
* [OpenRISC] [PATCH] openrisc: use device tree to determine present cpus @ 2021-01-30 10:37 ` Geert Uytterhoeven 0 siblings, 0 replies; 29+ messages in thread From: Geert Uytterhoeven @ 2021-01-30 10:37 UTC (permalink / raw) To: openrisc Hi Jan, On Fri, Jan 29, 2021 at 7:34 PM Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> wrote: > This patch proposes to use the device tree to determine the present cpus > instead of assuming all CONFIG_NRCPUS are actually present in the system. > > Signed-off-by: Jan Henrik Weinstock <jan.weinstock@rwth-aachen.de> Thanks for your patch! > --- a/arch/openrisc/kernel/smp.c > +++ b/arch/openrisc/kernel/smp.c > @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) > > void __init smp_prepare_cpus(unsigned int max_cpus) > { > - int i; > + u32 cpu_id; > + struct device_node *cpu, *cpus; > > /* > * Initialise the present map, which describes the set of CPUs > * actually populated at the present time. > */ > - for (i = 0; i < max_cpus; i++) > - set_cpu_present(i, true); > + cpus = of_find_node_by_path("/cpus"); > + for_each_child_of_node(cpus, cpu) { for_each_of_cpu_node()? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2021-02-08 12:33 UTC | newest] Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-29 18:29 [PATCH] openrisc: use device tree to determine present cpus Jan Henrik Weinstock 2021-01-29 18:29 ` [OpenRISC] " Jan Henrik Weinstock 2021-01-29 22:16 ` Stafford Horne 2021-01-29 22:16 ` [OpenRISC] " Stafford Horne 2021-01-30 11:00 ` Jan Henrik Weinstock 2021-01-30 11:00 ` [OpenRISC] " Jan Henrik Weinstock 2021-01-30 23:03 ` Stafford Horne 2021-01-30 23:03 ` [OpenRISC] " Stafford Horne 2021-01-30 23:11 ` Stafford Horne 2021-01-30 23:11 ` [OpenRISC] " Stafford Horne 2021-01-31 8:22 ` Jan Henrik Weinstock 2021-01-31 8:22 ` [OpenRISC] " Jan Henrik Weinstock 2021-01-31 21:27 ` Stafford Horne 2021-01-31 21:27 ` [OpenRISC] " Stafford Horne 2021-02-01 11:49 ` [PATCH v2] " Jan Henrik Weinstock 2021-02-01 11:49 ` [OpenRISC] " Jan Henrik Weinstock 2021-02-05 14:43 ` Stafford Horne 2021-02-05 14:43 ` [OpenRISC] " Stafford Horne 2021-02-05 16:07 ` Geert Uytterhoeven 2021-02-05 16:07 ` [OpenRISC] " Geert Uytterhoeven 2021-02-05 22:36 ` Stafford Horne 2021-02-05 22:36 ` [OpenRISC] " Stafford Horne 2021-02-06 9:33 ` Geert Uytterhoeven 2021-02-06 9:33 ` [OpenRISC] " Geert Uytterhoeven 2021-02-08 12:16 ` Stafford Horne 2021-02-08 12:22 ` Geert Uytterhoeven 2021-02-08 12:22 ` [OpenRISC] " Geert Uytterhoeven 2021-01-30 10:37 ` [PATCH] " Geert Uytterhoeven 2021-01-30 10:37 ` [OpenRISC] " Geert Uytterhoeven
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.