cpumask: Change cpumask_of_cpu to use cpumask_of_cpu_map V2
Subsystems (11)
cover cpumask: Change cpumask_of_cpu to use cpumask_of_cpu_map V2
V2: Use Rusty's cpumask initializer to statically initialize the
cpumask_of_cpu_map[]. In addition, create this map in the init data section using NR_CPUS but replace it during boot up with one sized by nr_cpu_ids (num possible cpus).
The following patch is submitted to resolve this problem...
(Based on tip/master. I will generate a linux-next version if requested since it now has generic code that will be executed for non-x86 arch's.)
Quoted 29 lines · Rusty Russell
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
I wouldn't mind it at all, and since it's almost always calling a function that requires a
cpumask_tpointer (like the cpu_* ops orset_cpus_allowed_ptr) then there shouldn't be too many "pointer dereference" penalties. I'm just always a bit hesitant to make too many generic changes since I have only x86 and ia64 machines to test with.Quoted 4 lines
Quoted 4 lines
The simple version is just a static array of [
NR_CPUS] cpumask_t's. Do that, with an override for smarter archs?I really REALLY prefer that over the fairly tortuous macros.
a fresh commit in -git has exposed the
topology.hmess - see the hack below. We now have diverging versions oftopology_core_siblings()semantics - that sure cannot be right. Mike?Ingo
------->
commit695a6b456307455a10059512208e8ed0d376ecd3Author: Ingo Molnar <[email protected]> Date: Wed Jul 23 13:19:44 2008 +0200topology: work around
topology_core_siblings()breakagework around:
Quoted 7 lines
drivers/net/sfc/efx.c: In function �??efx_probe_interrupts':
drivers/net/sfc/efx.c:845: error: lvalue required as unary �??&' operandthe topology API is a mess right now ...
Signed-off-by Ingo Molnar <[email protected]>---
---
The following cross built successfully:
x86_64-default
x86_64-single
x86_64-8psmp
x86_64-debug
x86_64-numa
i386-default
i386-single
i386-smp
ia64-sn2
ia64-default
ia64-nosmp
ia64-zx1
s390-default
arm-default
sparc-default
sparc64-default
sparc64-smp
mips-default
ppc-pmac32These had problems:
ppc-iseries
Build failed Wed Jul 23 10:10:10 PDT 2008
:0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration
ppc64
Build failed Wed Jul 23 10:10:19 PDT 2008
:0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration
ppc-pseries
Build failed Wed Jul 23 10:10:29 PDT 2008
:0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration
ppc-smp
Build failed Wed Jul 23 10:12:03 PDT 2008
CC drivers/scsi/scsi_error.o
BOOTCC arch/powerpc/boot/libfdt/fdt_strerror.o
make[1]: *** [arch/powerpc/boot/uImage] Error 127
ps3_defconfig
Build failed Wed Jul 23 10:12:18 PDT 2008
:0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration
powerpc-allmodconfig
Build failed Wed Jul 23 10:12:31 PDT 2008
:0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration :0: error: -m64 not supported in this configuration
PATCH 1/3 cpumask: Make cpumask_of_cpu_map generic
If an arch doesn't define cpumask_of_cpu_map, create a generic statically-initialized one for them. This allows removal of the buggy cpumask_of_cpu() macro (&cpumask_of_cpu() gives address of out-of-scope var).
An arch with NR_CPUS of 4096 probably wants to allocate this itself based on the actual number of CPUs, since otherwise they're using 2MB of rodata (1024 cpus means 128k). That's what CONFIG_HAVE_CPUMASK_OF_CPU_MAP is for (only x86/64 does so at the moment).
In future as we support more CPUs, we'll need to resort to a get_cpu_map()/put_cpu_map() allocation scheme.
Based on linux-2.6.tip/master.
---
Note: 8 warnings from checkpatch.pl:
"ERROR: Macros with complex values should be enclosed in parenthesis"
--- include/linux/cpumask.h | 41 +----------------- kernel/cpu.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 38 deletions(-)
include/linux/cpumask.h +3 -38
@@ -62,15 +62,7 @@* int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids * * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set -*ifdef CONFIG_HAS_CPUMASK_OF_CPU -* cpumask_of_cpu_ptr_declare(v) Declares cpumask_t *v -* cpumask_of_cpu_ptr_next(v, cpu) Sets v = &cpumask_of_cpu_map[cpu] -* cpumask_of_cpu_ptr(v, cpu) Combines above two operations -*else -* cpumask_of_cpu_ptr_declare(v) Declares cpumask_t _v and *v = &_v -* cpumask_of_cpu_ptr_next(v, cpu) Sets _v = cpumask_of_cpu(cpu) -* cpumask_of_cpu_ptr(v, cpu) Combines above two operations -*endif +* (can be used as an lvalue) * CPU_MASK_ALL Initializer - all bits set * CPU_MASK_NONE Initializer - no bits set * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
@@ -274,36 +266,9 @@ static inline void __cpus_shift_left(cpu } -#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP -extern cpumask_t *cpumask_of_cpu_map; +/* cpumask_of_cpu_map[] is in kernel/cpu.c */ +extern const cpumask_t *cpumask_of_cpu_map;#define cpumask_of_cpu (cpu) (cpumask_of_cpu_map[cpu]) -#define cpumask_of_cpu_ptr (v, cpu) \ - const cpumask_t *v = &cpumask_of_cpu(cpu) -#define cpumask_of_cpu_ptr_declare (v) \ - const cpumask_t *v -#define cpumask_of_cpu_ptr_next (v, cpu) \ - v = &cpumask_of_cpu(cpu) -#else -#define cpumask_of_cpu (cpu) \ -({ \ - typeof(_unused_cpumask_arg_) m; \ - if (sizeof(m) == sizeof(unsigned long)) { \ - m.bits[0] = 1UL<<(cpu); \ - } else { \ - cpus_clear(m); \ - cpu_set((cpu), m); \ - } \ - m; \ -}) -#define cpumask_of_cpu_ptr (v, cpu) \ - cpumask_t _##v = cpumask_of_cpu(cpu); \ - const cpumask_t *v = &_##v -#define cpumask_of_cpu_ptr_declare (v) \ - cpumask_t _##v; \ - const cpumask_t *v = &_##v -#define cpumask_of_cpu_ptr_next (v, cpu) \ - _##v = cpumask_of_cpu(cpu) -#endif #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
kernel/cpu.c +109 -0
112 lines not on this page · raw message
PATCH 2/3 cpumask: Put cpumask_of_cpu_map in the initdata section
In reply to Mike Travis * Create the cpumask_of_cpu_map statically in the init data section using NR_CPUS but replace it during boot up with one sized by nr_cpu_ids (num possible cpus).
Based on linux-2.6.tip/master.
--- arch/x86/kernel/setup_percpu.c | 10 ++++++---- kernel/cpu.c | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-)
arch/x86/kernel/setup_percpu.c +6 -4
@@ -81,10 +81,12 @@ static void __init setup_per_cpu_maps(vo }#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP -cpumask_t *cpumask_of_cpu_map__read_mostly ; -EXPORT_SYMBOL (cpumask_of_cpu_map); - -/* requires nr_cpu_ids to be initialized */ +/* +* Replace static cpumask_of_cpu_map in the initdata section, +* with one that's allocated sized by the possible number of cpus. +* +* (requires nr_cpu_ids to be initialized) +*/ static void __init setup_cpumask_of_cpu (void ) {int i;
kernel/cpu.c +5 -3
@@ -457,7 +457,6 @@ out:#endif /* CONFIG_SMP */ -#ifndef CONFIG_HAVE_CPUMASK_OF_CPU_MAP /* 64 bits of zeros, for initializers. */ #if BITS_PER_LONG ==32 #define Z64 0, 0
@@ -507,7 +506,11 @@ out:/* We want this statically initialized, just to be safe. We try not * to waste too much space, either. */ -static const cpumask_t cpumask_map[] = { +static const cpumask_t cpumask_map[] +#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP +__initdata +#endif += {CMI0 (0 ),CMI0 (1 ),CMI0 (2 ),CMI0 (3 ), #if NR_CPUS > 4 CMI0(4), CMI0(5), CMI0(6), CMI0(7),
@@ -567,4 +570,3 @@ static const cpumask_t cpumask_map[] = { };const cpumask_t *cpumask_of_cpu_map = cpumask_map; -#endif /* !CONFIG_HAVE_CPUMASK_OF_CPU_MAP */
PATCH 3/3 cpumask: Change cpumask_of_cpu_ptr to use new cpumask_of_cpu
In reply to Mike Travis * Replace previous instances of the cpumask_of_cpu_ptr* macros with a the new (lvalue capable) generic cpumask_of_cpu().
Based on linux-2.6.tip/master.
--- arch/x86/kernel/acpi/cstate.c | 3 +-- arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 10 +++------- arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 15 +++++---------- arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | 12 ++++-------- arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | 3 +-- arch/x86/kernel/cpu/intel_cacheinfo.c | 3 +-- arch/x86/kernel/ldt.c | 6 ++---- arch/x86/kernel/microcode.c | 17 +++++------------ arch/x86/kernel/reboot.c | 11 +++-------- drivers/acpi/processor_throttling.c | 11 +++-------- drivers/firmware/dcdbas.c | 3 +-- drivers/misc/sgi-xp/xpc_main.c | 3 +-- kernel/stop_machine.c | 3 +-- kernel/time/tick-common.c | 8 +++----- kernel/trace/trace_sysprof.c | 4 +--- lib/smp_processor_id.c | 5 +---- net/sunrpc/svc.c | 3 +-- 17 files changed, 37 insertions(+), 83 deletions(-)
arch/x86/kernel/acpi/cstate.c +1 -2
@@ -73,7 +73,6 @@ int acpi_processor_ffh_cstate_probe(unsistruct cpuinfo_x86 *c = &cpu_data (cpu);cpumask_t saved_mask; -cpumask_of_cpu_ptr (new_mask, cpu);int retval;unsigned int eax, ebx, ecx, edx;unsigned int edx_part;
@@ -92,7 +91,7 @@ int acpi_processor_ffh_cstate_probe(unsi/* Make sure we are running on right CPU */ saved_mask = current->cpus_allowed; - retval =set_cpus_allowed_ptr (current, new_mask); + retval =set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));if (retval)return -1 ;
arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +3 -7
@@ -200,12 +200,10 @@ static void drv_read(struct drv_cmd *cmdstatic void drv_write (struct drv_cmd *cmd) {cpumask_t saved_mask = current->cpus_allowed; -cpumask_of_cpu_ptr_declare (cpu_mask);unsigned int i;for_each_cpu_mask_nr (i, cmd->mask) { -cpumask_of_cpu_ptr_next (cpu_mask, i); -set_cpus_allowed_ptr (current, cpu_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (i));do_drv_write (cmd); }
@@ -269,12 +267,11 @@ static unsigned int get_measured_perf(un } aperf_cur, mperf_cur;cpumask_t saved_mask; -cpumask_of_cpu_ptr (cpu_mask, cpu);unsigned int perf_percent;unsigned int retval; saved_mask = current->cpus_allowed; -set_cpus_allowed_ptr (current, cpu_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));if (get_cpu () != cpu) {/* We were not able to run on requested processor */ put_cpu ();
@@ -340,7 +337,6 @@ static unsigned int get_measured_perf(unstatic unsigned int get_cur_freq_on_cpu (unsigned int cpu) { -cpumask_of_cpu_ptr (cpu_mask, cpu);struct acpi_cpufreq_data *data =per_cpu (drv_data, cpu);unsigned int freq;unsigned int cached_freq;
@@ -353,7 +349,7 @@ static unsigned int get_cur_freq_on_cpu( } cached_freq = data->freq_table[data->acpi_data->state].frequency; - freq =extract_freq (get_cur_val (cpu_mask), data); + freq =extract_freq (get_cur_val (&cpumask_of_cpu (cpu)), data);if (freq != cached_freq) {/* * The dreaded BIOS frequency change behind our back.
arch/x86/kernel/cpu/cpufreq/powernow-k8.c +5 -10
@@ -479,12 +479,11 @@ static int core_voltage_post_transition(static int check_supported_cpu (unsigned int cpu) {cpumask_t oldmask; -cpumask_of_cpu_ptr (cpu_mask, cpu);u32 eax, ebx, ecx, edx;unsigned int rc =0 ; oldmask = current->cpus_allowed; -set_cpus_allowed_ptr (current, cpu_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));if (smp_processor_id () != cpu) { printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu);
@@ -1017,7 +1016,6 @@ static int transition_frequency_pstate(sstatic int powernowk8_target (struct cpufreq_policy *pol,unsigned targfreq,unsigned relation) {cpumask_t oldmask; -cpumask_of_cpu_ptr (cpu_mask, pol->cpu);struct powernow_k8_data *data =per_cpu (powernow_data, pol->cpu);u32 checkfid;u32 checkvid;
@@ -1032,7 +1030,7 @@ static int powernowk8_target(struct cpuf/* only run on specific CPU from here on */ oldmask = current->cpus_allowed; -set_cpus_allowed_ptr (current, cpu_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (pol->cpu));if (smp_processor_id () != pol->cpu) { printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1107,7 +1105,6 @@ static int __cpuinit powernowk8_cpu_init {struct powernow_k8_data *data;cpumask_t oldmask; -cpumask_of_cpu_ptr_declare (newmask);int rc;if (!cpu_online (pol->cpu))
@@ -1159,8 +1156,7 @@ static int __cpuinit powernowk8_cpu_init/* only run on specific CPU from here on */ oldmask = current->cpus_allowed; -cpumask_of_cpu_ptr_next (newmask, pol->cpu); -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (pol->cpu));if (smp_processor_id () != pol->cpu) { printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1182,7 +1178,7 @@ static int __cpuinit powernowk8_cpu_initset_cpus_allowed_ptr (current, &oldmask);if (cpu_family ==CPU_HW_PSTATE ) - pol->cpus = *newmask; + pol->cpus =cpumask_of_cpu (pol->cpu);else pol->cpus =per_cpu (cpu_core_map, pol->cpu); data->available_cores = &(pol->cpus);
@@ -1248,7 +1244,6 @@ static unsigned int powernowk8_get (unsi {struct powernow_k8_data *data;cpumask_t oldmask = current->cpus_allowed; -cpumask_of_cpu_ptr (newmask, cpu);unsigned int khz =0 ;unsigned int first;
@@ -1258,7 +1253,7 @@ static unsigned int powernowk8_get (unsiif (!data)return -EINVAL ; -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));if (smp_processor_id () != cpu) { printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +4 -8
@@ -417,10 +417,9 @@ static unsigned int get_cur_freq(unsigneunsigned l, h;unsigned clock_freq;cpumask_t saved_mask; -cpumask_of_cpu_ptr (new_mask, cpu); saved_mask = current->cpus_allowed; -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));if (smp_processor_id () != cpu)return 0 ;
@@ -678,15 +677,12 @@ static int centrino_target (struct cpufr* Best effort undo.. */ -if (!cpus_empty (*covered_cpus)) { -cpumask_of_cpu_ptr_declare (new_mask); - +if (!cpus_empty (*covered_cpus))for_each_cpu_mask_nr (j, *covered_cpus) { -cpumask_of_cpu_ptr_next (new_mask, j); -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, + &cpumask_of_cpu (j));wrmsr (MSR_IA32_PERF_CTL , oldmsr, h); } - } tmp = freqs.new; freqs.new = freqs.old;
arch/x86/kernel/cpu/cpufreq/speedstep-ich.c +1 -2
@@ -244,8 +244,7 @@ static unsigned int _speedstep_get(conststatic unsigned int speedstep_get (unsigned int cpu) { -cpumask_of_cpu_ptr (newmask, cpu); -return _speedstep_get (newmask); +return _speedstep_get (&cpumask_of_cpu (cpu)); }/**
arch/x86/kernel/cpu/intel_cacheinfo.c +1 -2
@@ -516,7 +516,6 @@ static int __cpuinit detect_cache_attribunsigned long j;int retval;cpumask_t oldmask; -cpumask_of_cpu_ptr (newmask, cpu);if (num_cache_leaves ==0 )return -ENOENT ;
@@ -527,7 +526,7 @@ static int __cpuinit detect_cache_attribreturn -ENOMEM ; oldmask = current->cpus_allowed; - retval =set_cpus_allowed_ptr (current, newmask); + retval =set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));if (retval) goto out;
arch/x86/kernel/ldt.c +2 -4
@@ -65,12 +65,10 @@ static int alloc_ldt(mm_context_t *pc, iif (reload) {#ifdef CONFIG_SMP -cpumask_of_cpu_ptr_declare (mask); -preempt_disable ();load_LDT (pc); -cpumask_of_cpu_ptr_next (mask,smp_processor_id ()); -if (!cpus_equal (current->mm->cpu_vm_mask, *mask)) +if (!cpus_equal (current->mm->cpu_vm_mask, +cpumask_of_cpu (smp_processor_id ())))smp_call_function (flush_ldt, current->mm,1 );preempt_enable ();#else
arch/x86/kernel/microcode.c +5 -12
@@ -388,7 +388,6 @@ static int do_microcode_update (void)void *new_mc =NULL ;int cpu;cpumask_t old; -cpumask_of_cpu_ptr_declare (newmask); old = current->cpus_allowed;
@@ -405,8 +404,7 @@ static int do_microcode_update (void)if (!uci->valid)continue ; -cpumask_of_cpu_ptr_next (newmask, cpu); -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu)); error =get_maching_microcode (new_mc, cpu);if (error <0 ) goto out;
@@ -576,7 +574,6 @@ static int apply_microcode_check_cpu(intstruct cpuinfo_x86 *c = &cpu_data (cpu);struct ucode_cpu_info *uci = ucode_cpu_info + cpu;cpumask_t old; -cpumask_of_cpu_ptr (newmask, cpu);unsigned int val[2 ];int err =0 ;
@@ -585,7 +582,7 @@ static int apply_microcode_check_cpu(intreturn 0 ; old = current->cpus_allowed; -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));/* Check if the microcode we have in memory matches the CPU */ if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
@@ -623,12 +620,11 @@ static int apply_microcode_check_cpu(intstatic void microcode_init_cpu (int cpu,int resume) {cpumask_t old; -cpumask_of_cpu_ptr (newmask, cpu);struct ucode_cpu_info *uci = ucode_cpu_info + cpu; old = current->cpus_allowed; -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));mutex_lock (µcode_mutex);collect_cpu_info (cpu);if (uci->valid && system_state ==SYSTEM_RUNNING && !resume)
@@ -661,13 +657,10 @@ static ssize_t reload_store(struct sys_dif (end == buf)return -EINVAL ;if (val ==1 ) { -cpumask_t old; -cpumask_of_cpu_ptr (newmask, cpu); - - old = current->cpus_allowed; +cpumask_t old = current->cpus_allowed;get_online_cpus (); -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));mutex_lock (µcode_mutex);if (uci->valid)
arch/x86/kernel/reboot.c +3 -8
@@ -414,25 +414,20 @@ void native_machine_shutdown(void)/* The boot cpu is always logical cpu 0 */ int reboot_cpu_id =0 ; -cpumask_of_cpu_ptr (newmask, reboot_cpu_id);#ifdef CONFIG_X86_32 /* See if there has been given a command line override */ if ((reboot_cpu !=-1 ) && (reboot_cpu <NR_CPUS ) && -cpu_online (reboot_cpu)) { +cpu_online (reboot_cpu)) reboot_cpu_id = reboot_cpu; -cpumask_of_cpu_ptr_next (newmask, reboot_cpu_id); - }#endif /* Make certain the cpu I'm about to reboot on is online */ -if (!cpu_online (reboot_cpu_id)) { +if (!cpu_online (reboot_cpu_id)) reboot_cpu_id =smp_processor_id (); -cpumask_of_cpu_ptr_next (newmask, reboot_cpu_id); - }/* Make certain I only run on the appropriate processor */ -set_cpus_allowed_ptr (current, newmask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (reboot_cpu_id));/* O.K Now that I'm on the appropriate processor, * stop all of the others.
drivers/acpi/processor_throttling.c +3 -8
@@ -827,7 +827,6 @@ static int acpi_processor_get_throttlingstatic int acpi_processor_get_throttling (struct acpi_processor *pr) {cpumask_t saved_mask; -cpumask_of_cpu_ptr_declare (new_mask);int ret;if (!pr)
@@ -839,8 +838,7 @@ static int acpi_processor_get_throttling* Migrate task to the cpu pointed by pr. */ saved_mask = current->cpus_allowed; -cpumask_of_cpu_ptr_next (new_mask, pr->id); -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (pr->id)); ret = pr->throttling.acpi_processor_get_throttling (pr);/* restore the previous state */ set_cpus_allowed_ptr (current, &saved_mask);
@@ -989,7 +987,6 @@ static int acpi_processor_set_throttlingint acpi_processor_set_throttling (struct acpi_processor *pr,int state) {cpumask_t saved_mask; -cpumask_of_cpu_ptr_declare (new_mask);int ret =0 ;unsigned int i;struct acpi_processor *match_pr;
@@ -1028,8 +1025,7 @@ int acpi_processor_set_throttling(struct* it can be called only for the cpu pointed by pr. */ if (p_throttling->shared_type ==DOMAIN_COORD_TYPE_SW_ANY ) { -cpumask_of_cpu_ptr_next (new_mask, pr->id); -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (pr->id)); ret = p_throttling->acpi_processor_set_throttling (pr, t_state.target_state); }else {
@@ -1060,8 +1056,7 @@ int acpi_processor_set_throttling(structcontinue ; } t_state.cpu = i; -cpumask_of_cpu_ptr_next (new_mask, i); -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (i)); ret = match_pr->throttling.acpi_processor_set_throttling ( match_pr, t_state.target_state);
drivers/firmware/dcdbas.c +1 -2
@@ -254,7 +254,6 @@ static ssize_t host_control_on_shutdown_static int smi_request (struct smi_cmd *smi_cmd) {cpumask_t old_mask; -cpumask_of_cpu_ptr (new_mask,0 );int ret =0 ;if (smi_cmd->magic !=SMI_CMD_MAGIC ) {
@@ -265,7 +264,7 @@ static int smi_request(struct smi_cmd *s/* SMI requires CPU 0 */ old_mask = current->cpus_allowed; -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (0 ));if (smp_processor_id () !=0 ) {dev_dbg (&dcdbas_pdev->dev,"%s: failed to get CPU 0\n" , __func__);
drivers/misc/sgi-xp/xpc_main.c +1 -2
@@ -229,11 +229,10 @@ xpc_hb_checker(void *ignore)int last_IRQ_count =0 ;int new_IRQ_count;int force_IRQ =0 ; -cpumask_of_cpu_ptr (cpumask,XPC_HB_CHECK_CPU );/* this thread was marked active by xpc_hb_init() */ -set_cpus_allowed_ptr (current, cpumask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (XPC_HB_CHECK_CPU ));/* set our heartbeating to other partitions into motion */ xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval *HZ );
kernel/stop_machine.c +1 -2
@@ -33,9 +33,8 @@ static int stopmachine(void *cpu) {int irqs_disabled =0 ;int prepared =0 ; -cpumask_of_cpu_ptr (cpumask, (int )(long )cpu); -set_cpus_allowed_ptr (current, cpumask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu ((int )(long )cpu));/* Ack: we are alive */ smp_mb ();/* Theoretically the ack = 0 might not be on this CPU yet. */
kernel/time/tick-common.c +3 -5
@@ -196,12 +196,10 @@ static int tick_check_new_device(structstruct tick_device *td;int cpu, ret =NOTIFY_OK ;unsigned long flags; -cpumask_of_cpu_ptr_declare (cpumask);spin_lock_irqsave (&tick_device_lock, flags); cpu =smp_processor_id (); -cpumask_of_cpu_ptr_next (cpumask, cpu);if (!cpu_isset (cpu, newdev->cpumask)) goto out_bc;
@@ -209,7 +207,7 @@ static int tick_check_new_device(struct curdev = td->evtdev;/* cpu local device ? */ -if (!cpus_equal (newdev->cpumask, *cpumask)) { +if (!cpus_equal (newdev->cpumask,cpumask_of_cpu (cpu))) {/* * If the cpu affinity of the device interrupt can not
@@ -222,7 +220,7 @@ static int tick_check_new_device(struct* If we have a cpu local device already, do not replace it * by a non cpu local device */ -if (curdev &&cpus_equal (curdev->cpumask, *cpumask)) +if (curdev &&cpus_equal (curdev->cpumask,cpumask_of_cpu (cpu))) goto out_bc; }
@@ -254,7 +252,7 @@ static int tick_check_new_device(struct curdev =NULL ; }clockevents_exchange_device (curdev, newdev); -tick_setup_device (td, newdev, cpu, cpumask); +tick_setup_device (td, newdev, cpu, &cpumask_of_cpu (cpu));if (newdev->features &CLOCK_EVT_FEAT_ONESHOT )tick_oneshot_notify ();
kernel/trace/trace_sysprof.c +1 -3
@@ -213,9 +213,7 @@ static void start_stack_timers(void)int cpu;for_each_online_cpu (cpu) { -cpumask_of_cpu_ptr (new_mask, cpu); - -set_cpus_allowed_ptr (current, new_mask); +set_cpus_allowed_ptr (current, &cpumask_of_cpu (cpu));start_stack_timer (cpu); }set_cpus_allowed_ptr (current, &saved_mask);
lib/smp_processor_id.c +1 -4
@@ -11,7 +11,6 @@ notrace unsigned int debug_smp_processor {unsigned long preempt_count =preempt_count ();int this_cpu =raw_smp_processor_id (); -cpumask_of_cpu_ptr_declare (this_mask);if (likely (preempt_count)) goto out;
@@ -23,9 +22,7 @@ notrace unsigned int debug_smp_processor* Kernel threads bound to a single CPU can safely use * smp_processor_id(): */ -cpumask_of_cpu_ptr_next (this_mask, this_cpu); - -if (cpus_equal (current->cpus_allowed, *this_mask)) +if (cpus_equal (current->cpus_allowed,cpumask_of_cpu (this_cpu))) goto out;/*
net/sunrpc/svc.c +1 -2
@@ -310,8 +310,7 @@ svc_pool_map_set_cpumask(struct task_strswitch (m->mode) {case SVC_POOL_PERCPU : { -cpumask_of_cpu_ptr (cpumask, node); -set_cpus_allowed_ptr (task, cpumask); +set_cpus_allowed_ptr (task, &cpumask_of_cpu (node));break ; }case SVC_POOL_PERNODE :
Quoted 10 lines · Mike Travis
V2: Use Rusty's cpumask initializer to statically initialize the
cpumask_of_cpu_map[]. In addition, create this map in the init data section usingNR_CPUSbut replace it during boot up with one sized bynr_cpu_ids(num possible cpus).The following patch is submitted to resolve this problem...
(Based on tip/master. I will generate a linux-next version if requested since it now has generic code that will be executed for non-x86 arch's.)
i've applied it to tip/cpus4096 and started testing it. This is the topic where the problem originates from, so we can reuse it for linux-next.
Ingo
Quoted 3 lines · Ingo Molnar
i've applied it to tip/cpus4096 and started testing it. This is the topic where the problem originates from, so we can reuse it for linux-next.
fixlet below.
Ingo
-------------->
Quoted 1 line
From
5a7a201c51c324876d00a54e7208af6af12d1ca4Mon Sep 17 00:00:00 2001
From: Ingo Molnar <[email protected]>
Date: Sat, 26 Jul 2008 16:50:47 +0200
Subject: [PATCH] cpumask: export cpumask_of_cpu_map
fix:
ERROR: "cpumask_of_cpu_map" [drivers/acpi/processor.ko] undefined!
ERROR: "cpumask_of_cpu_map" [arch/x86/kernel/microcode.ko] undefined!
ERROR: "cpumask_of_cpu_map" [arch/x86/kernel/cpu/cpufreq/speedstep-ich.ko] undefined!
ERROR: "cpumask_of_cpu_map" [arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko] undefined!
--- kernel/cpu.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/cpu.c +2 -0
@@ -572,3 +572,5 @@ __initdata };const cpumask_t *cpumask_of_cpu_map = cpumask_map; + +EXPORT_SYMBOL_GPL (cpumask_of_cpu_map);