* [RFC 1/6]SEP initialization rework
@ 2005-04-04 2:05 Li Shaohua
[not found] ` <1112580349.4194.331.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Li Shaohua @ 2005-04-04 2:05 UTC (permalink / raw)
To: lkml, ACPI-DEV; +Cc: Zwane Mwaikambo, Len Brown, Pavel Machek
Make SEP init per-cpu, so is hotplug safe.
Thanks,
Shaohua
---
linux-2.6.11-root/arch/i386/kernel/smpboot.c | 6 ++++++
linux-2.6.11-root/arch/i386/kernel/sysenter.c | 10 ++++++----
linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c | 6 ++++++
3 files changed, 18 insertions(+), 4 deletions(-)
diff -puN arch/i386/kernel/sysenter.c~sep_init_cleanup arch/i386/kernel/sysenter.c
--- linux-2.6.11/arch/i386/kernel/sysenter.c~sep_init_cleanup 2005-03-28 09:32:30.936304248 +0800
+++ linux-2.6.11-root/arch/i386/kernel/sysenter.c 2005-03-28 09:58:20.703703792 +0800
@@ -26,6 +26,11 @@ void enable_sep_cpu(void *info)
int cpu = get_cpu();
struct tss_struct *tss = &per_cpu(init_tss, cpu);
+ if (!boot_cpu_has(X86_FEATURE_SEP)) {
+ put_cpu();
+ return;
+ }
+
tss->ss1 = __KERNEL_CS;
tss->esp1 = sizeof(struct tss_struct) + (unsigned long) tss;
wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
@@ -41,7 +46,7 @@ void enable_sep_cpu(void *info)
extern const char vsyscall_int80_start, vsyscall_int80_end;
extern const char vsyscall_sysenter_start, vsyscall_sysenter_end;
-static int __init sysenter_setup(void)
+int __init sysenter_setup(void)
{
void *page = (void *)get_zeroed_page(GFP_ATOMIC);
@@ -58,8 +63,5 @@ static int __init sysenter_setup(void)
&vsyscall_sysenter_start,
&vsyscall_sysenter_end - &vsyscall_sysenter_start);
- on_each_cpu(enable_sep_cpu, NULL, 1, 1);
return 0;
}
-
-__initcall(sysenter_setup);
diff -puN arch/i386/kernel/smpboot.c~sep_init_cleanup arch/i386/kernel/smpboot.c
--- linux-2.6.11/arch/i386/kernel/smpboot.c~sep_init_cleanup 2005-03-28 09:33:49.972288952 +0800
+++ linux-2.6.11-root/arch/i386/kernel/smpboot.c 2005-03-28 09:46:01.814032096 +0800
@@ -415,6 +415,8 @@ static void __init smp_callin(void)
static int cpucount;
+extern int sysenter_setup(void);
+extern void enable_sep_cpu(void *);
/*
* Activate a secondary processor.
*/
@@ -445,6 +447,7 @@ static void __init start_secondary(void
/* We can take interrupts now: we're officially "up". */
local_irq_enable();
+ enable_sep_cpu(NULL);
wmb();
cpu_idle();
@@ -913,6 +916,9 @@ static void __init smp_boot_cpus(unsigne
cpus_clear(cpu_sibling_map[0]);
cpu_set(0, cpu_sibling_map[0]);
+ sysenter_setup();
+ enable_sep_cpu(NULL);
+
/*
* If we couldn't find an SMP configuration at boot time,
* get out of here now!
diff -puN arch/i386/mach-voyager/voyager_smp.c~sep_init_cleanup arch/i386/mach-voyager/voyager_smp.c
--- linux-2.6.11/arch/i386/mach-voyager/voyager_smp.c~sep_init_cleanup 2005-03-28 09:48:27.909822160 +0800
+++ linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c 2005-03-28 09:51:37.896939728 +0800
@@ -441,6 +441,8 @@ setup_trampoline(void)
return virt_to_phys((__u8 *)trampoline_base);
}
+extern void enable_sep_cpu(void *);
+extern int sysenter_setup(void);
/* Routine initially called when a non-boot CPU is brought online */
static void __init
start_secondary(void *unused)
@@ -499,6 +501,7 @@ start_secondary(void *unused)
while (!cpu_isset(cpuid, smp_commenced_mask))
rep_nop();
local_irq_enable();
+ enable_sep_cpu(NULL);
local_flush_tlb();
@@ -696,6 +699,9 @@ smp_boot_cpus(void)
printk("CPU%d: ", boot_cpu_id);
print_cpu_info(&cpu_data[boot_cpu_id]);
+ sysenter_setup();
+ enable_sep_cpu(NULL);
+
if(is_cpu_quad()) {
/* booting on a Quad CPU */
printk("VOYAGER SMP: Boot CPU is Quad\n");
_
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 7+ messages in thread[parent not found: <1112580349.4194.331.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>]
* Re: [RFC 1/6]SEP initialization rework [not found] ` <1112580349.4194.331.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org> @ 2005-04-04 8:46 ` Pavel Machek [not found] ` <20050404084638.GB14642-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org> 2005-04-04 19:10 ` Zwane Mwaikambo 2005-04-06 19:31 ` Martin Waitz 2 siblings, 1 reply; 7+ messages in thread From: Pavel Machek @ 2005-04-04 8:46 UTC (permalink / raw) To: Li Shaohua; +Cc: lkml, ACPI-DEV, Zwane Mwaikambo, Len Brown Hi! > Make SEP init per-cpu, so is hotplug safe. > > Thanks, > Shaohua > > --- > > linux-2.6.11-root/arch/i386/kernel/smpboot.c | 6 ++++++ > linux-2.6.11-root/arch/i386/kernel/sysenter.c | 10 ++++++---- > linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c | 6 ++++++ > 3 files changed, 18 insertions(+), 4 deletions(-) > > diff -puN arch/i386/kernel/sysenter.c~sep_init_cleanup arch/i386/kernel/sysenter.c > --- linux-2.6.11/arch/i386/kernel/sysenter.c~sep_init_cleanup 2005-03-28 09:32:30.936304248 +0800 > +++ linux-2.6.11-root/arch/i386/kernel/sysenter.c 2005-03-28 09:58:20.703703792 +0800 > @@ -26,6 +26,11 @@ void enable_sep_cpu(void *info) > int cpu = get_cpu(); > struct tss_struct *tss = &per_cpu(init_tss, cpu); > > + if (!boot_cpu_has(X86_FEATURE_SEP)) { > + put_cpu(); > + return; > + } > + > tss->ss1 = __KERNEL_CS; > tss->esp1 = sizeof(struct tss_struct) + (unsigned long) tss; > wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); > @@ -41,7 +46,7 @@ void enable_sep_cpu(void *info) > extern const char vsyscall_int80_start, vsyscall_int80_end; > extern const char vsyscall_sysenter_start, vsyscall_sysenter_end; > > -static int __init sysenter_setup(void) > +int __init sysenter_setup(void) > { > void *page = (void *)get_zeroed_page(GFP_ATOMIC); > Can this still be __init? I think you are calling it from hotplug code now, right? > diff -puN arch/i386/kernel/smpboot.c~sep_init_cleanup arch/i386/kernel/smpboot.c > --- linux-2.6.11/arch/i386/kernel/smpboot.c~sep_init_cleanup 2005-03-28 09:33:49.972288952 +0800 > +++ linux-2.6.11-root/arch/i386/kernel/smpboot.c 2005-03-28 09:46:01.814032096 +0800 > @@ -415,6 +415,8 @@ static void __init smp_callin(void) > > static int cpucount; > > +extern int sysenter_setup(void); > +extern void enable_sep_cpu(void *); > /* > * Activate a secondary processor. > */ Perhaps these should go to header file somewhere? Pavel -- People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl! ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20050404084638.GB14642-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>]
* Re: [RFC 1/6]SEP initialization rework [not found] ` <20050404084638.GB14642-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org> @ 2005-04-04 8:52 ` Li Shaohua 0 siblings, 0 replies; 7+ messages in thread From: Li Shaohua @ 2005-04-04 8:52 UTC (permalink / raw) To: Pavel Machek; +Cc: lkml, ACPI-DEV, Zwane Mwaikambo, Len Brown Hi, On Mon, 2005-04-04 at 16:46, Pavel Machek wrote: > > --- > > > > linux-2.6.11-root/arch/i386/kernel/smpboot.c | 6 ++++++ > > linux-2.6.11-root/arch/i386/kernel/sysenter.c | 10 ++++++---- > > linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c | 6 ++++++ > > 3 files changed, 18 insertions(+), 4 deletions(-) > > > > diff -puN arch/i386/kernel/sysenter.c~sep_init_cleanup arch/i386/kernel/sysenter.c > > --- linux-2.6.11/arch/i386/kernel/sysenter.c~sep_init_cleanup 2005-03-28 09:32:30.936304248 +0800 > > +++ linux-2.6.11-root/arch/i386/kernel/sysenter.c 2005-03-28 09:58:20.703703792 +0800 > > @@ -26,6 +26,11 @@ void enable_sep_cpu(void *info) > > int cpu = get_cpu(); > > struct tss_struct *tss = &per_cpu(init_tss, cpu); > > > > + if (!boot_cpu_has(X86_FEATURE_SEP)) { > > + put_cpu(); > > + return; > > + } > > + > > tss->ss1 = __KERNEL_CS; > > tss->esp1 = sizeof(struct tss_struct) + (unsigned long) tss; > > wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); > > @@ -41,7 +46,7 @@ void enable_sep_cpu(void *info) > > extern const char vsyscall_int80_start, vsyscall_int80_end; > > extern const char vsyscall_sysenter_start, vsyscall_sysenter_end; > > > > -static int __init sysenter_setup(void) > > +int __init sysenter_setup(void) > > { > > void *page = (void *)get_zeroed_page(GFP_ATOMIC); > > > > Can this still be __init? I think you are calling it from hotplug code > now, right? Only BP executes it. AP calls enable_sep_cpu. > > > diff -puN arch/i386/kernel/smpboot.c~sep_init_cleanup arch/i386/kernel/smpboot.c > > --- linux-2.6.11/arch/i386/kernel/smpboot.c~sep_init_cleanup 2005-03-28 09:33:49.972288952 +0800 > > +++ linux-2.6.11-root/arch/i386/kernel/smpboot.c 2005-03-28 09:46:01.814032096 +0800 > > @@ -415,6 +415,8 @@ static void __init smp_callin(void) > > > > static int cpucount; > > > > +extern int sysenter_setup(void); > > +extern void enable_sep_cpu(void *); > > /* > > * Activate a secondary processor. > > */ > > Perhaps these should go to header file somewhere? in asm-i386/smp.h? Thanks, Shaohua ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC 1/6]SEP initialization rework [not found] ` <1112580349.4194.331.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org> 2005-04-04 8:46 ` Pavel Machek @ 2005-04-04 19:10 ` Zwane Mwaikambo 2005-04-05 1:00 ` Li Shaohua 2005-04-06 19:31 ` Martin Waitz 2 siblings, 1 reply; 7+ messages in thread From: Zwane Mwaikambo @ 2005-04-04 19:10 UTC (permalink / raw) To: Li Shaohua; +Cc: lkml, ACPI-DEV, Len Brown, Pavel Machek On Mon, 4 Apr 2005, Li Shaohua wrote: > linux-2.6.11-root/arch/i386/kernel/smpboot.c | 6 ++++++ > linux-2.6.11-root/arch/i386/kernel/sysenter.c | 10 ++++++---- > linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c | 6 ++++++ > 3 files changed, 18 insertions(+), 4 deletions(-) > > diff -puN arch/i386/kernel/sysenter.c~sep_init_cleanup arch/i386/kernel/sysenter.c > --- linux-2.6.11/arch/i386/kernel/sysenter.c~sep_init_cleanup 2005-03-28 09:32:30.936304248 +0800 > +++ linux-2.6.11-root/arch/i386/kernel/sysenter.c 2005-03-28 09:58:20.703703792 +0800 > @@ -26,6 +26,11 @@ void enable_sep_cpu(void *info) > int cpu = get_cpu(); > struct tss_struct *tss = &per_cpu(init_tss, cpu); > > + if (!boot_cpu_has(X86_FEATURE_SEP)) { > + put_cpu(); > + return; > + } > + Do you have systems like this? Is it really skipping SEP if the boot processor doesn't have SEP? ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC 1/6]SEP initialization rework 2005-04-04 19:10 ` Zwane Mwaikambo @ 2005-04-05 1:00 ` Li Shaohua [not found] ` <1112662825.17861.4.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Li Shaohua @ 2005-04-05 1:00 UTC (permalink / raw) To: Zwane Mwaikambo; +Cc: lkml, ACPI-DEV, Len Brown, Pavel Machek On Tue, 2005-04-05 at 03:10, Zwane Mwaikambo wrote: > On Mon, 4 Apr 2005, Li Shaohua wrote: > > > linux-2.6.11-root/arch/i386/kernel/smpboot.c | 6 ++++++ > > linux-2.6.11-root/arch/i386/kernel/sysenter.c | 10 ++++++---- > > linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c | 6 ++++++ > > 3 files changed, 18 insertions(+), 4 deletions(-) > > > > diff -puN arch/i386/kernel/sysenter.c~sep_init_cleanup arch/i386/kernel/sysenter.c > > --- linux-2.6.11/arch/i386/kernel/sysenter.c~sep_init_cleanup 2005-03-28 09:32:30.936304248 +0800 > > +++ linux-2.6.11-root/arch/i386/kernel/sysenter.c 2005-03-28 09:58:20.703703792 +0800 > > @@ -26,6 +26,11 @@ void enable_sep_cpu(void *info) > > int cpu = get_cpu(); > > struct tss_struct *tss = &per_cpu(init_tss, cpu); > > > > + if (!boot_cpu_has(X86_FEATURE_SEP)) { > > + put_cpu(); > > + return; > > + } > > + > > Do you have systems like this? Is it really skipping SEP if the boot > processor doesn't have SEP? No, I haven't such system. This is the logic of original SEP initialization. If the CPU hasn't SEP, original logic doesn't call 'on_each_cpu(enable_sep_cpu,...)'. Thanks, Shaohua ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1112662825.17861.4.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>]
* Re: [RFC 1/6]SEP initialization rework [not found] ` <1112662825.17861.4.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org> @ 2005-04-05 8:00 ` Zwane Mwaikambo 0 siblings, 0 replies; 7+ messages in thread From: Zwane Mwaikambo @ 2005-04-05 8:00 UTC (permalink / raw) To: Li Shaohua; +Cc: lkml, ACPI-DEV, Len Brown, Pavel Machek On Tue, 5 Apr 2005, Li Shaohua wrote: > On Tue, 2005-04-05 at 03:10, Zwane Mwaikambo wrote: > > On Mon, 4 Apr 2005, Li Shaohua wrote: > > > > > linux-2.6.11-root/arch/i386/kernel/smpboot.c | 6 ++++++ > > > linux-2.6.11-root/arch/i386/kernel/sysenter.c | 10 ++++++---- > > > linux-2.6.11-root/arch/i386/mach-voyager/voyager_smp.c | 6 ++++++ > > > 3 files changed, 18 insertions(+), 4 deletions(-) > > > > > > diff -puN arch/i386/kernel/sysenter.c~sep_init_cleanup arch/i386/kernel/sysenter.c > > > --- linux-2.6.11/arch/i386/kernel/sysenter.c~sep_init_cleanup 2005-03-28 09:32:30.936304248 +0800 > > > +++ linux-2.6.11-root/arch/i386/kernel/sysenter.c 2005-03-28 09:58:20.703703792 +0800 > > > @@ -26,6 +26,11 @@ void enable_sep_cpu(void *info) > > > int cpu = get_cpu(); > > > struct tss_struct *tss = &per_cpu(init_tss, cpu); > > > > > > + if (!boot_cpu_has(X86_FEATURE_SEP)) { > > > + put_cpu(); > > > + return; > > > + } > > > + > > > > Do you have systems like this? Is it really skipping SEP if the boot > > processor doesn't have SEP? > No, I haven't such system. This is the logic of original SEP > initialization. If the CPU hasn't SEP, original logic doesn't call > 'on_each_cpu(enable_sep_cpu,...)'. Got it, so i misread. Thanks, Zwane ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC 1/6]SEP initialization rework [not found] ` <1112580349.4194.331.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org> 2005-04-04 8:46 ` Pavel Machek 2005-04-04 19:10 ` Zwane Mwaikambo @ 2005-04-06 19:31 ` Martin Waitz 2 siblings, 0 replies; 7+ messages in thread From: Martin Waitz @ 2005-04-06 19:31 UTC (permalink / raw) To: Li Shaohua; +Cc: lkml, ACPI-DEV, Zwane Mwaikambo, Len Brown, Pavel Machek [-- Attachment #1: Type: text/plain, Size: 253 bytes --] hoi :) On Mon, Apr 04, 2005 at 10:05:56AM +0800, Li Shaohua wrote: > - on_each_cpu(enable_sep_cpu, NULL, 1, 1); with this on_each_cpu call gone, you should also be able to remove the useless info pointer in enable_sep_cpu. -- Martin Waitz [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-04-06 19:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-04 2:05 [RFC 1/6]SEP initialization rework Li Shaohua
[not found] ` <1112580349.4194.331.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2005-04-04 8:46 ` Pavel Machek
[not found] ` <20050404084638.GB14642-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2005-04-04 8:52 ` Li Shaohua
2005-04-04 19:10 ` Zwane Mwaikambo
2005-04-05 1:00 ` Li Shaohua
[not found] ` <1112662825.17861.4.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2005-04-05 8:00 ` Zwane Mwaikambo
2005-04-06 19:31 ` Martin Waitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox