Date: Wed, 9 Oct 2013 18:23:30 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r256207 - in stable/9/sys: amd64/amd64 i386/i386 i386/xen mips/mips sparc64/sparc64 sys Message-ID: <201310091823.r99INUMG043021@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Oct 9 18:23:30 2013 New Revision: 256207 URL: http://svnweb.freebsd.org/changeset/base/256207 Log: MFC r251703 (by attilio): - Add a BIT_FFS() macro and use it to replace cpusetffs_obj() Modified: stable/9/sys/amd64/amd64/mp_machdep.c stable/9/sys/i386/i386/mp_machdep.c stable/9/sys/i386/i386/pmap.c stable/9/sys/i386/xen/mp_machdep.c stable/9/sys/i386/xen/pmap.c stable/9/sys/mips/mips/mp_machdep.c stable/9/sys/sparc64/sparc64/mp_machdep.c stable/9/sys/sys/bitset.h stable/9/sys/sys/cpuset.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/amd64/amd64/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1151,7 +1151,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask ipi_all_but_self(vector); } else { ncpu = 0; - while ((cpu = cpusetobj_ffs(&mask)) != 0) { + while ((cpu = CPU_FFS(&mask)) != 0) { cpu--; CPU_CLR(cpu, &mask); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, @@ -1300,7 +1300,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); Modified: stable/9/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/9/sys/i386/i386/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/i386/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1256,7 +1256,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask ipi_all_but_self(vector); } else { ncpu = 0; - while ((cpu = cpusetobj_ffs(&mask)) != 0) { + while ((cpu = CPU_FFS(&mask)) != 0) { cpu--; CPU_CLR(cpu, &mask); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, @@ -1405,7 +1405,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); Modified: stable/9/sys/i386/i386/pmap.c ============================================================================== --- stable/9/sys/i386/i386/pmap.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/i386/pmap.c Wed Oct 9 18:23:30 2013 (r256207) @@ -2007,7 +2007,7 @@ pmap_lazyfix(pmap_t pmap) spins = 50000000; /* Find least significant set bit. */ - lsb = cpusetobj_ffs(&mask); + lsb = CPU_FFS(&mask); MPASS(lsb != 0); lsb--; CPU_SETOF(lsb, &mask); Modified: stable/9/sys/i386/xen/mp_machdep.c ============================================================================== --- stable/9/sys/i386/xen/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/xen/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1038,7 +1038,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask ipi_all_but_self(vector); } else { ncpu = 0; - while ((cpu = cpusetobj_ffs(&mask)) != 0) { + while ((cpu = CPU_FFS(&mask)) != 0) { cpu--; CPU_CLR(cpu, &mask); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, @@ -1131,7 +1131,7 @@ ipi_selected(cpuset_t cpus, u_int ipi) if (ipi == IPI_STOP_HARD) CPU_OR_ATOMIC(&ipi_nmi_pending, &cpus); - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); CTR3(KTR_SMP, "%s: cpu: %d ipi: %x", __func__, cpu, ipi); Modified: stable/9/sys/i386/xen/pmap.c ============================================================================== --- stable/9/sys/i386/xen/pmap.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/i386/xen/pmap.c Wed Oct 9 18:23:30 2013 (r256207) @@ -1702,7 +1702,7 @@ pmap_lazyfix(pmap_t pmap) spins = 50000000; /* Find least significant set bit. */ - lsb = cpusetobj_ffs(&mask); + lsb = CPU_FFS(&mask); MPASS(lsb != 0); lsb--; CPU_SETOF(lsb, &mask); Modified: stable/9/sys/mips/mips/mp_machdep.c ============================================================================== --- stable/9/sys/mips/mips/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/mips/mips/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -208,7 +208,7 @@ cpu_mp_setmaxid(void) platform_cpu_mask(&cpumask); mp_ncpus = 0; last = 1; - while ((cpu = cpusetobj_ffs(&cpumask)) != 0) { + while ((cpu = CPU_FFS(&cpumask)) != 0) { last = cpu; cpu--; CPU_CLR(cpu, &cpumask); @@ -251,7 +251,7 @@ cpu_mp_start(void) platform_cpu_mask(&cpumask); while (!CPU_EMPTY(&cpumask)) { - cpuid = cpusetobj_ffs(&cpumask) - 1; + cpuid = CPU_FFS(&cpumask) - 1; CPU_CLR(cpuid, &cpumask); if (cpuid >= MAXCPU) { Modified: stable/9/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/mp_machdep.c Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/sparc64/sparc64/mp_machdep.c Wed Oct 9 18:23:30 2013 (r256207) @@ -557,7 +557,7 @@ spitfire_ipi_selected(cpuset_t cpus, u_l { u_int cpu; - while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + while ((cpu = CPU_FFS(&cpus)) != 0) { cpu--; CPU_CLR(cpu, &cpus); spitfire_ipi_single(cpu, d0, d1, d2); Modified: stable/9/sys/sys/bitset.h ============================================================================== --- stable/9/sys/sys/bitset.h Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/sys/bitset.h Wed Oct 9 18:23:30 2013 (r256207) @@ -150,4 +150,19 @@ (f)->__bits[__i]); \ } while (0) +#define BIT_FFS(_s, p) __extension__ ({ \ + __size_t __i; \ + int __bit; \ + \ + __bit = 0; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) { \ + if ((p)->__bits[__i] != 0) { \ + __bit = ffsl((p)->__bits[__i]); \ + __bit += __i * _BITSET_BITS; \ + break; \ + } \ + } \ + __bit; \ +}) + #endif /* !_SYS_BITSET_H_ */ Modified: stable/9/sys/sys/cpuset.h ============================================================================== --- stable/9/sys/sys/cpuset.h Wed Oct 9 18:14:28 2013 (r256206) +++ stable/9/sys/sys/cpuset.h Wed Oct 9 18:23:30 2013 (r256207) @@ -57,6 +57,7 @@ #define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) +#define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) /* * Valid cpulevel_t values.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310091823.r99INUMG043021>