LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/5] Use the APIC to determine the hardware processor id - i386
@ 2007-03-01 7:16 Fernando Luis Vázquez Cao
2007-03-01 7:59 ` [Fastboot] " Vivek Goyal
0 siblings, 1 reply; 3+ messages in thread
From: Fernando Luis Vázquez Cao @ 2007-03-01 7:16 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: fastboot, ebiederm, ak, akpm, judith
Use the APIC to determine the hardware processor id when APIC support
has been selected, independently of whether CONFIG_SMP is set or not.
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
---
diff -urNp linux-2.6.21-rc2/include/asm-i386/smp.h linux-2.6.21-rc2-hwcpuid/include/asm-i386/smp.h
--- linux-2.6.21-rc2/include/asm-i386/smp.h 2007-03-01 14:02:21.000000000 +0900
+++ linux-2.6.21-rc2-hwcpuid/include/asm-i386/smp.h 2007-03-01 14:08:50.000000000 +0900
@@ -74,20 +74,6 @@ static inline int num_booting_cpus(void)
return cpus_weight(cpu_callout_map);
}
-#ifdef CONFIG_X86_LOCAL_APIC
-
-#ifdef APIC_DEFINITION
-extern int hard_smp_processor_id(void);
-#else
-#include <mach_apicdef.h>
-static inline int hard_smp_processor_id(void)
-{
- /* we don't want to mark this access volatile - bad code generation */
- return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
-}
-#endif
-#endif
-
extern int safe_smp_processor_id(void);
extern int __cpu_disable(void);
extern void __cpu_die(unsigned int cpu);
@@ -102,10 +88,23 @@ extern unsigned int num_processors;
#define NO_PROC_ID 0xFF /* No processor magic marker */
-#endif
+#endif /* CONFIG_SMP */
#ifndef __ASSEMBLY__
+#ifdef CONFIG_X86_LOCAL_APIC
+#ifdef APIC_DEFINITION
+extern int hard_smp_processor_id(void);
+#else
+#include <mach_apicdef.h>
+static inline int hard_smp_processor_id(void)
+{
+ /* we don't want to mark this access volatile - bad code generation */
+ return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
+}
+#endif /* APIC_DEFINITION */
+#endif /* CONFIG_X86_LOCAL_APIC */
+
extern u8 apicid_2_node[];
#ifdef CONFIG_X86_LOCAL_APIC
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Fastboot] [PATCH 2/5] Use the APIC to determine the hardware processor id - i386
2007-03-01 7:16 [PATCH 2/5] Use the APIC to determine the hardware processor id - i386 Fernando Luis Vázquez Cao
@ 2007-03-01 7:59 ` Vivek Goyal
2007-03-01 8:17 ` Fernando Luis Vázquez Cao
0 siblings, 1 reply; 3+ messages in thread
From: Vivek Goyal @ 2007-03-01 7:59 UTC (permalink / raw)
To: Fernando Luis Vázquez Cao
Cc: Linux Kernel Mailing List, akpm, judith, fastboot, ebiederm, ak
On Thu, Mar 01, 2007 at 04:16:59PM +0900, Fernando Luis Vázquez Cao wrote:
> Use the APIC to determine the hardware processor id when APIC support
> has been selected, independently of whether CONFIG_SMP is set or not.
>
> Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
> ---
>
> diff -urNp linux-2.6.21-rc2/include/asm-i386/smp.h linux-2.6.21-rc2-hwcpuid/include/asm-i386/smp.h
> --- linux-2.6.21-rc2/include/asm-i386/smp.h 2007-03-01 14:02:21.000000000 +0900
> +++ linux-2.6.21-rc2-hwcpuid/include/asm-i386/smp.h 2007-03-01 14:08:50.000000000 +0900
> @@ -74,20 +74,6 @@ static inline int num_booting_cpus(void)
> return cpus_weight(cpu_callout_map);
> }
>
> -#ifdef CONFIG_X86_LOCAL_APIC
> -
> -#ifdef APIC_DEFINITION
> -extern int hard_smp_processor_id(void);
> -#else
> -#include <mach_apicdef.h>
> -static inline int hard_smp_processor_id(void)
> -{
> - /* we don't want to mark this access volatile - bad code generation */
> - return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
> -}
> -#endif
> -#endif
> -
> extern int safe_smp_processor_id(void);
> extern int __cpu_disable(void);
> extern void __cpu_die(unsigned int cpu);
> @@ -102,10 +88,23 @@ extern unsigned int num_processors;
>
> #define NO_PROC_ID 0xFF /* No processor magic marker */
>
> -#endif
> +#endif /* CONFIG_SMP */
>
> #ifndef __ASSEMBLY__
>
> +#ifdef CONFIG_X86_LOCAL_APIC
> +#ifdef APIC_DEFINITION
> +extern int hard_smp_processor_id(void);
> +#else
> +#include <mach_apicdef.h>
> +static inline int hard_smp_processor_id(void)
> +{
> + /* we don't want to mark this access volatile - bad code generation */
> + return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
> +}
> +#endif /* APIC_DEFINITION */
> +#endif /* CONFIG_X86_LOCAL_APIC */
> +
I think compilation will fail if CONFIG_X86_LOCAL_APIC=n and I build a UP
kernel? There is no definition of hard_smp_processor_id in that case.
Otherwise, as a concept it seems to make sense that hard_smp_processor_id()
is not necessarily zero on UP systems.
Thanks
Vivek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Fastboot] [PATCH 2/5] Use the APIC to determine the hardware processor id - i386
2007-03-01 7:59 ` [Fastboot] " Vivek Goyal
@ 2007-03-01 8:17 ` Fernando Luis Vázquez Cao
0 siblings, 0 replies; 3+ messages in thread
From: Fernando Luis Vázquez Cao @ 2007-03-01 8:17 UTC (permalink / raw)
To: vgoyal; +Cc: Linux Kernel Mailing List, akpm, judith, fastboot, ebiederm, ak
On Thu, 2007-03-01 at 13:29 +0530, Vivek Goyal wrote:
> On Thu, Mar 01, 2007 at 04:16:59PM +0900, Fernando Luis Vázquez Cao wrote:
> > Use the APIC to determine the hardware processor id when APIC support
> > has been selected, independently of whether CONFIG_SMP is set or not.
> >
> > Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
> > ---
> >
> > diff -urNp linux-2.6.21-rc2/include/asm-i386/smp.h linux-2.6.21-rc2-hwcpuid/include/asm-i386/smp.h
> > --- linux-2.6.21-rc2/include/asm-i386/smp.h 2007-03-01 14:02:21.000000000 +0900
> > +++ linux-2.6.21-rc2-hwcpuid/include/asm-i386/smp.h 2007-03-01 14:08:50.000000000 +0900
> > @@ -74,20 +74,6 @@ static inline int num_booting_cpus(void)
> > return cpus_weight(cpu_callout_map);
> > }
> >
> > -#ifdef CONFIG_X86_LOCAL_APIC
> > -
> > -#ifdef APIC_DEFINITION
> > -extern int hard_smp_processor_id(void);
> > -#else
> > -#include <mach_apicdef.h>
> > -static inline int hard_smp_processor_id(void)
> > -{
> > - /* we don't want to mark this access volatile - bad code generation */
> > - return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
> > -}
> > -#endif
> > -#endif
> > -
> > extern int safe_smp_processor_id(void);
> > extern int __cpu_disable(void);
> > extern void __cpu_die(unsigned int cpu);
> > @@ -102,10 +88,23 @@ extern unsigned int num_processors;
> >
> > #define NO_PROC_ID 0xFF /* No processor magic marker */
> >
> > -#endif
> > +#endif /* CONFIG_SMP */
> >
> > #ifndef __ASSEMBLY__
> >
> > +#ifdef CONFIG_X86_LOCAL_APIC
> > +#ifdef APIC_DEFINITION
> > +extern int hard_smp_processor_id(void);
> > +#else
> > +#include <mach_apicdef.h>
> > +static inline int hard_smp_processor_id(void)
> > +{
> > + /* we don't want to mark this access volatile - bad code generation */
> > + return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
> > +}
> > +#endif /* APIC_DEFINITION */
> > +#endif /* CONFIG_X86_LOCAL_APIC */
> > +
>
> I think compilation will fail if CONFIG_X86_LOCAL_APIC=n and I build a UP
> kernel? There is no definition of hard_smp_processor_id in that case.
Hi Vivek,
Thank you for the feedback.
I tested that combination and it compiled properly. The reason is that
hard_smp_processor_id is not used anywhere in the kernel when
CONFIG_X86_LOCAL_APIC=n and CONFIG_SMP=n.
I tested all the combinations (including voyager) and everything seems
to work as expected.
Regards,
Fernando
> Otherwise, as a concept it seems to make sense that hard_smp_processor_id()
> is not necessarily zero on UP systems.
>
> Thanks
> Vivek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-01 8:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01 7:16 [PATCH 2/5] Use the APIC to determine the hardware processor id - i386 Fernando Luis Vázquez Cao
2007-03-01 7:59 ` [Fastboot] " Vivek Goyal
2007-03-01 8:17 ` Fernando Luis Vázquez Cao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).