2.4.20-pre4+bk: undefined references for smp + apm
arch/i386/kernel/kernel.o(.text+0xcd12): In function `apm_save_cpus':
: undefined reference to set_cpus_allowed' arch/i386/kernel/kernel.o(.text+0xcdbf): In function apm_bios_call':
: undefined reference to set_cpus_allowed' arch/i386/kernel/kernel.o(.text+0xce56): In function apm_bios_call_simple':
: undefined reference to `set_cpus_allowed'
-alex
A message that is not in the archive (sent off-list or not yet received): [email protected]
Toon van der Pas, Sat, Feb 01, 2003 17:28:05 +0100:
Quoted 11 lines · Alex Riesen
Quoted 7 lines
arch/i386/kernel/kernel.o(.text+0xcd12): In function `apm_save_cpus':
: undefined reference toset_cpus_allowed' arch/i386/kernel/kernel.o(.text+0xcdbf): In functionapm_bios_call':
: undefined reference toset_cpus_allowed' arch/i386/kernel/kernel.o(.text+0xce56): In functionapm_bios_call_simple':
: undefined reference to `set_cpus_allowed'make mrproper
no, that's not the reason.
set_cpus_allowed doesn't appear anywhere in the tree, only apm.c (with CONFIG_SMP defined) references it.
-alex
Quoted 7 lines · Alex Riesen
arch/i386/kernel/kernel.o(.text+0xcd12): In function `apm_save_cpus':
: undefined reference toset_cpus_allowed' arch/i386/kernel/kernel.o(.text+0xcdbf): In functionapm_bios_call':
: undefined reference toset_cpus_allowed' arch/i386/kernel/kernel.o(.text+0xce56): In functionapm_bios_call_simple':
: undefined reference to `set_cpus_allowed'
I sent this patch (from rml) to Marcelo about a dozend times even before people started using it for intree code and a few times after this got introduces, but he always ignored it. Here it is again anyway:
include/linux/sched.h +6 -0
@@ -163,6 +164,12 @@extern int start_context_thread (void );extern int current_is_keventd (void ); +#if CONFIG_SMP +extern void set_cpus_allowed (struct task_struct *p,unsigned long new_mask); +#else +# define set_cpus_allowed (p, new_mask) do { } while (0) +#endif +/* * The default fd array needs to be at least BITS_PER_LONG, * as this is the granularity returned by copy_fdset().
kernel/ksyms.c +3 -0
@@ -451,6 +451,9 @@EXPORT_SYMBOL (interruptible_sleep_on_timeout);EXPORT_SYMBOL (schedule);EXPORT_SYMBOL (schedule_timeout); +#if CONFIG_SMP +EXPORT_SYMBOL (set_cpus_allowed); +#endif EXPORT_SYMBOL (yield);EXPORT_SYMBOL (__cond_resched);EXPORT_SYMBOL (jiffies);
kernel/sched.c +38 -0
@@ -850,6 +850,44 @@void scheduling_functions_end_here (void ) { } +#if CONFIG_SMP +/** +* set_cpus_allowed() - change a given task's processor affinity +* @p: task to bind +* @new_mask: bitmask of allowed processors +* +* Upon return, the task is running on a legal processor. Note the caller +* must have a valid reference to the task: it must not exit() prematurely. +* This call can sleep; do not hold locks on call. +*/ +void set_cpus_allowed (struct task_struct *p,unsigned long new_mask) +{ + new_mask &= cpu_online_map; +BUG_ON (!new_mask); + + p->cpus_allowed = new_mask; + +/* +* If the task is on a no-longer-allowed processor, we need to move +* it. If the task is not current, then set need_resched and send +* its processor an IPI to reschedule. +*/ +if (!(p->cpus_runnable & p->cpus_allowed)) { +if (p != current) { + p->need_resched =1 ; +smp_send_reschedule (p->processor); + } +/* +* Wait until we are on a legal processor. If the task is +* current, then we should be on a legal processor the next +* time we reschedule. Otherwise, we need to wait for the IPI. +*/ +while (!(p->cpus_runnable & p->cpus_allowed)) +schedule (); + } +} +#endif /* CONFIG_SMP */ +#ifndef __alpha__/*