2003-08-12 05:55:35

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH][2.6-mm] cpumask_t - ioapic set_ioapic_affinity

Hi Andi,
Would this be an ok way to program the destination? I noticed that
your default target is 1 (TARGET_CPUS)

arch/x86_64/kernel/io_apic.c:1311: warning: initialization from
incompatible pointer type
arch/x86_64/kernel/io_apic.c:1322: warning: initialization from
incompatible pointer type

Index: linux-2.6.0-test3-x86_64/include/asm-x86_64/smp.h
===================================================================
RCS file: /build/cvsroot/linux-2.6.0-test3/include/asm-x86_64/smp.h,v
retrieving revision 1.2
diff -u -p -B -r1.2 smp.h
--- linux-2.6.0-test3-x86_64/include/asm-x86_64/smp.h 12 Aug 2003 05:35:44 -0000 1.2
+++ linux-2.6.0-test3-x86_64/include/asm-x86_64/smp.h 12 Aug 2003 05:36:15 -0000
@@ -67,8 +67,6 @@ static inline int num_booting_cpus(void)
return cpus_weight(cpu_callout_map);
}

-extern cpumask_t cpu_callout_map;
-
#define smp_processor_id() read_pda(cpunumber)

extern __inline int hard_smp_processor_id(void)
@@ -96,6 +94,12 @@ extern inline int safe_smp_processor_id(
#define INT_DELIVERY_MODE 1 /* logical delivery */
#define TARGET_CPUS 1

+#ifndef ASSEMBLY
+static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
+{
+ return cpus_coerce_const(cpumask);
+}
+#endif

#ifndef CONFIG_SMP
#define stack_smp_processor_id() 0
Index: linux-2.6.0-test3-x86_64/arch/x86_64/kernel/io_apic.c
===================================================================
RCS file: /build/cvsroot/linux-2.6.0-test3/arch/x86_64/kernel/io_apic.c,v
retrieving revision 1.2
diff -u -p -B -r1.2 io_apic.c
--- linux-2.6.0-test3-x86_64/arch/x86_64/kernel/io_apic.c 12 Aug 2003 04:56:16 -0000 1.2
+++ linux-2.6.0-test3-x86_64/arch/x86_64/kernel/io_apic.c 12 Aug 2003 05:11:50 -0000
@@ -1278,16 +1278,20 @@ static void end_level_ioapic_irq (unsign

static void mask_and_ack_level_ioapic_irq (unsigned int irq) { /* nothing */ }

-static void set_ioapic_affinity (unsigned int irq, unsigned long mask)
+static void set_ioapic_affinity (unsigned int irq, cpumask_t mask)
{
unsigned long flags;
+ unsigned int dest;
+
+ dest = cpu_mask_to_apicid(mk_cpumask_const(mask));
+
/*
* Only the first 8 bits are valid.
*/
- mask = mask << 24;
+ dest = dest << 24;

spin_lock_irqsave(&ioapic_lock, flags);
- __DO_ACTION(1, = mask, )
+ __DO_ACTION(1, = dest, )
spin_unlock_irqrestore(&ioapic_lock, flags);
}


2003-08-12 14:53:10

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH][2.6-mm] cpumask_t - ioapic set_ioapic_affinity

> -static void set_ioapic_affinity (unsigned int irq, unsigned long mask)
> +static void set_ioapic_affinity (unsigned int irq, cpumask_t mask)
> {
> unsigned long flags;
> + unsigned int dest;
> +
> + dest = cpu_mask_to_apicid(mk_cpumask_const(mask));
> +
> /*
> * Only the first 8 bits are valid.
> */
> - mask = mask << 24;
> + dest = dest << 24;
>
> spin_lock_irqsave(&ioapic_lock, flags);
> - __DO_ACTION(1, = mask, )
> + __DO_ACTION(1, = dest, )
> spin_unlock_irqrestore(&ioapic_lock, flags);

Looks ok.

-Andi