Re: svn commit: r290547 - in head/sys: arm/annapurna/alpine arm/mv/armadaxp arm/qemu arm/ti/omap4 arm/xilinx kern x86/x86
On Mon, 9 Nov 2015 17:45:46 + "Bjoern A. Zeeb" wrote: >> On 08 Nov 2015, at 14:26 , Tijl Coosemans wrote: >> >> Author: tijl >> Date: Sun Nov 8 14:26:50 2015 >> New Revision: 290547 >> URL: https://svnweb.freebsd.org/changeset/base/290547 >> >> Log: >> Since r289279 bufinit() uses mp_ncpus, but some architectures set this >> variable during mp_start() which is too late. Move this to mp_setmaxid() >> where other architectures set it and move x86 assertions to MI code. >> >> Reviewed by:kib (x86 part) >> >> Modified: >> head/sys/arm/annapurna/alpine/alpine_machdep_mp.c >> head/sys/arm/mv/armadaxp/armadaxp_mp.c >> head/sys/arm/qemu/virt_mp.c > > Seems copy and paste from the old to the new function brought some > confusion n variable naming; can you please fix? > > > /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:17: error: use of > undeclared identifier 'ncpus'; did you mean 'pcpup'? > mp_ncpus = MIN(ncpus, MAXCPU); >^ >pcpup > /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:21: note: expanded from > macro 'MIN' > #define MIN(a,b) (((a)<(b))?(a):(b)) > ^ > ./machine/pcpu.h:65:21: note: 'pcpup' declared here > extern struct pcpu *pcpup; > ^ > /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:13: error: > ordered comparison between pointer and integer ('struct pcpu *' and 'int') > [-Werror] > mp_ncpus = MIN(ncpus, MAXCPU); >^~ > /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:23: note: expanded from > macro 'MIN' > #define MIN(a,b) (((a)<(b))?(a):(b)) >~~~^~~~ > /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:17: error: use of > undeclared identifier 'ncpus'; did you mean 'pcpup'? > mp_ncpus = MIN(ncpus, MAXCPU); >^ >pcpup > /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:30: note: expanded from > macro 'MIN' > #define MIN(a,b) (((a)<(b))?(a):(b)) > ^ > ./machine/pcpu.h:65:21: note: 'pcpup' declared here > extern struct pcpu *pcpup; > ^ > /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:13: error: > pointer/integer type mismatch in conditional expression ('struct pcpu *' and > 'int') [-Werror,-Wconditional-type-mismatch] > mp_ncpus = MIN(ncpus, MAXCPU); >^~ > /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:28: note: expanded from > macro 'MIN' > #define MIN(a,b) (((a)<(b))?(a):(b)) >^~~~ ~~~ > /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:11: error: > incompatible pointer to integer conversion assigning to 'int' from 'struct > pcpu *' [-Werror,-Wint-conversion] > mp_ncpus = MIN(ncpus, MAXCPU); > ^ ~~ > 5 errors generated. > --- virt_mp.o --- > *** [virt_mp.o] Error code 1 Fixed in r290621. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r290547 - in head/sys: arm/annapurna/alpine arm/mv/armadaxp arm/qemu arm/ti/omap4 arm/xilinx kern x86/x86
> On 08 Nov 2015, at 14:26 , Tijl Coosemans wrote: > > Author: tijl > Date: Sun Nov 8 14:26:50 2015 > New Revision: 290547 > URL: https://svnweb.freebsd.org/changeset/base/290547 > > Log: > Since r289279 bufinit() uses mp_ncpus, but some architectures set this > variable during mp_start() which is too late. Move this to mp_setmaxid() > where other architectures set it and move x86 assertions to MI code. > > Reviewed by: kib (x86 part) > > Modified: > head/sys/arm/annapurna/alpine/alpine_machdep_mp.c > head/sys/arm/mv/armadaxp/armadaxp_mp.c > head/sys/arm/qemu/virt_mp.c Seems copy and paste from the old to the new function brought some confusion n variable naming; can you please fix? /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:17: error: use of undeclared identifier 'ncpus'; did you mean 'pcpup'? mp_ncpus = MIN(ncpus, MAXCPU); ^ pcpup /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:21: note: expanded from macro 'MIN' #define MIN(a,b) (((a)<(b))?(a):(b)) ^ ./machine/pcpu.h:65:21: note: 'pcpup' declared here extern struct pcpu *pcpup; ^ /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:13: error: ordered comparison between pointer and integer ('struct pcpu *' and 'int') [-Werror] mp_ncpus = MIN(ncpus, MAXCPU); ^~ /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:23: note: expanded from macro 'MIN' #define MIN(a,b) (((a)<(b))?(a):(b)) ~~~^~~~ /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:17: error: use of undeclared identifier 'ncpus'; did you mean 'pcpup'? mp_ncpus = MIN(ncpus, MAXCPU); ^ pcpup /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:30: note: expanded from macro 'MIN' #define MIN(a,b) (((a)<(b))?(a):(b)) ^ ./machine/pcpu.h:65:21: note: 'pcpup' declared here extern struct pcpu *pcpup; ^ /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:13: error: pointer/integer type mismatch in conditional expression ('struct pcpu *' and 'int') [-Werror,-Wconditional-type-mismatch] mp_ncpus = MIN(ncpus, MAXCPU); ^~ /home/baz21/SVN/head-ipv6-fix.svn/sys/sys/param.h:301:28: note: expanded from macro 'MIN' #define MIN(a,b) (((a)<(b))?(a):(b)) ^~~~ ~~~ /home/baz21/SVN/head-ipv6-fix.svn/sys/arm/qemu/virt_mp.c:74:11: error: incompatible pointer to integer conversion assigning to 'int' from 'struct pcpu *' [-Werror,-Wint-conversion] mp_ncpus = MIN(ncpus, MAXCPU); ^ ~~ 5 errors generated. --- virt_mp.o --- *** [virt_mp.o] Error code 1 — Bjoern A. Zeeb Charles Haddon Spurgeon: "Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend." ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r290547 - in head/sys: arm/annapurna/alpine arm/mv/armadaxp arm/qemu arm/ti/omap4 arm/xilinx kern x86/x86
Author: tijl Date: Sun Nov 8 14:26:50 2015 New Revision: 290547 URL: https://svnweb.freebsd.org/changeset/base/290547 Log: Since r289279 bufinit() uses mp_ncpus, but some architectures set this variable during mp_start() which is too late. Move this to mp_setmaxid() where other architectures set it and move x86 assertions to MI code. Reviewed by: kib (x86 part) Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c head/sys/arm/mv/armadaxp/armadaxp_mp.c head/sys/arm/qemu/virt_mp.c head/sys/arm/ti/omap4/omap4_mp.c head/sys/arm/xilinx/zy7_mp.c head/sys/kern/subr_smp.c head/sys/x86/x86/mp_x86.c Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c == --- head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Sun Nov 8 14:22:57 2015(r290546) +++ head/sys/arm/annapurna/alpine/alpine_machdep_mp.c Sun Nov 8 14:26:50 2015(r290547) @@ -128,16 +128,14 @@ platform_mp_init_secondary(void) void platform_mp_setmaxid(void) { - int core_cnt; - core_cnt = platform_mp_get_core_cnt(); - mp_maxid = core_cnt - 1; + mp_ncpus = platform_mp_get_core_cnt(); + mp_maxid = mp_ncpus - 1; } int platform_mp_probe(void) { - mp_ncpus = platform_mp_get_core_cnt(); return (1); } Modified: head/sys/arm/mv/armadaxp/armadaxp_mp.c == --- head/sys/arm/mv/armadaxp/armadaxp_mp.c Sun Nov 8 14:22:57 2015 (r290546) +++ head/sys/arm/mv/armadaxp/armadaxp_mp.c Sun Nov 8 14:26:50 2015 (r290547) @@ -82,15 +82,14 @@ void platform_mp_setmaxid(void) { - mp_maxid = 3; + mp_ncpus = platform_get_ncpus(); + mp_maxid = mp_ncpus - 1; } int platform_mp_probe(void) { - mp_ncpus = platform_get_ncpus(); - return (mp_ncpus > 1); } Modified: head/sys/arm/qemu/virt_mp.c == --- head/sys/arm/qemu/virt_mp.c Sun Nov 8 14:22:57 2015(r290546) +++ head/sys/arm/qemu/virt_mp.c Sun Nov 8 14:26:50 2015(r290547) @@ -49,17 +49,8 @@ static int running_cpus; int platform_mp_probe(void) { - int ncpus; - ncpus = ofw_cpu_early_foreach(NULL, true); - if (ncpus <= 1) { - mp_ncpus = 1; - return (0); - } - - mp_ncpus = MIN(ncpus, MAXCPU); - - return (1); + return (mp_ncpus > 1); } static boolean_t @@ -77,7 +68,10 @@ platform_mp_setmaxid(void) { mp_maxid = PCPU_GET(cpuid); - ofw_cpu_early_foreach(virt_maxid, true); + mp_ncpus = ofw_cpu_early_foreach(virt_maxid, true); + if (mp_ncpus < 1) + mp_ncpus = 1; + mp_ncpus = MIN(ncpus, MAXCPU); } static boolean_t Modified: head/sys/arm/ti/omap4/omap4_mp.c == --- head/sys/arm/ti/omap4/omap4_mp.cSun Nov 8 14:22:57 2015 (r290546) +++ head/sys/arm/ti/omap4/omap4_mp.cSun Nov 8 14:26:50 2015 (r290547) @@ -51,14 +51,14 @@ void platform_mp_setmaxid(void) { -mp_maxid = 1; + mp_maxid = 1; + mp_ncpus = 2; } int platform_mp_probe(void) { - mp_ncpus = 2; return (1); } Modified: head/sys/arm/xilinx/zy7_mp.c == --- head/sys/arm/xilinx/zy7_mp.cSun Nov 8 14:22:57 2015 (r290546) +++ head/sys/arm/xilinx/zy7_mp.cSun Nov 8 14:26:50 2015 (r290547) @@ -57,13 +57,13 @@ platform_mp_setmaxid(void) { mp_maxid = 1; + mp_ncpus = 2; } int platform_mp_probe(void) { - mp_ncpus = 2; return (1); } Modified: head/sys/kern/subr_smp.c == --- head/sys/kern/subr_smp.cSun Nov 8 14:22:57 2015(r290546) +++ head/sys/kern/subr_smp.cSun Nov 8 14:26:50 2015(r290547) @@ -125,7 +125,15 @@ struct mtx smp_ipi_mtx; static void mp_setmaxid(void *dummy) { + cpu_mp_setmaxid(); + + KASSERT(mp_ncpus >= 1, ("%s: CPU count < 1", __func__)); + KASSERT(mp_ncpus > 1 || mp_maxid == 0, + ("%s: one CPU but mp_maxid is not zero", __func__)); + KASSERT(mp_maxid >= mp_ncpus - 1, + ("%s: counters out of sync: max %d, count %d", __func__, + mp_maxid, mp_ncpus)); } SYSINIT(cpu_mp_setmaxid, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_setmaxid, NULL); Modified: head/sys/x86/x86/mp_x86.c == --- head/sys/x86/x86/mp_x86.c Sun Nov 8 14:22:57 2015(r290546) +++ head/sys/x86/x86/mp_x86.c Sun Nov 8 14:26:50 2015(r290547) @@ -425,18 +425,11 @@ cpu_mp_setmaxid(void) { /* -* mp_maxid should be alr