i386: export genapic again
PATCH 1/1 i386: export genapic again
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
From: Jan Beulich <[email protected]>
(actual patch attached)
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
From: Jan Beulich <[email protected]>
arch/i386/mach-generic/probe.c +3 -0
@@ -3,6 +3,7 @@* * Generic x86 APIC driver probe layer. */ +#define APIC_DEFINITION 1#include <linux/config.h> #include <linux/threads.h> #include <linux/cpumask.h>
@@ -10,6 +11,7 @@#include <linux/kernel.h> #include <linux/ctype.h> #include <linux/init.h> +#include <linux/module.h> #include <asm/fixmap.h> #include <asm/mpspec.h> #include <asm/apicdef.h>
@@ -21,6 +23,7 @@ extern struct genapic apic_es7000;extern struct genapic apic_default;struct genapic *genapic = &apic_default; +EXPORT_SYMBOL (genapic);struct genapic *apic_probe[]__initdata = { &apic_summit,
Quoted 9 lines · Jan Beulich
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
From: Jan Beulich <[email protected]>
(actual patch attached)
+#define APIC_DEFINITION 1
what is that for?
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Arjan van de Ven <[email protected]> 08.11.05 14:08:09 >>>
Quoted 5 lines · Jan Beulich
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
Quoted 8 lines
Quoted 4 lines
From: Jan Beulich <[email protected]>
(actual patch attached)
+#define
APIC_DEFINITION1what is that for?
For making the whole thing build: asm/smp.h and asm/mach-generic/apicdef.h contain some constructs that result in build failures when visible to some of the files that actually implement (parts of) the APIC stuff. For this specific file, hard_smp_processor_id() would otherwise be defined twice.
Jan
Quoted 4 lines · Jan Beulich
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
We don't export symbols for "there might be some driver that might need this".
Can we discuss this issue when such a driver gets submitted for inclusion in the kernel?
Quoted 3 lines
From: Jan Beulich <[email protected]>
(actual patch attached)
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 8 lines
Quoted 1 line
Quoted 1 line
Adrian Bunk <[email protected]> 08.11.05 14:29:54 >>>
Quoted 4 lines · Jan Beulich
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
We don't export symbols for "there might be some driver that might
need
Quoted 4 lines
this".
Can we discuss this issue when such a driver gets submitted for inclusion in the kernel?
I'm in the process of preparing such a submission.
Jan
PATCH 1/1 i386: make trap information available to die handlers
In reply to Jan BeulichPass the trap number causing the call to die() to the die notification handler chain.
From: Jan Beulich <[email protected]>
(actual patch attached)
Pass the trap number causing the call to die() to the die notification handler chain.
From: Jan Beulich <[email protected]>
arch/i386/kernel/traps.c +1 -1
@@ -333,7 +333,7 @@ void die(const char * str, struct pt_reg#endif if (nl)printk ("\n" ); -notify_die (DIE_OOPS , (char *)str, regs, err,255 ,SIGSEGV ); +notify_die (DIE_OOPS , str, regs, err, current->thread.trap_no,SIGSEGV );show_registers (regs); }else printk (KERN_ERR "Recursive die() failure, output suppressed\n" );
Re: [PATCH] i386: make trap information available to die handlers
Quoted 6 lines · Jan Beulich
Pass the trap number causing the call to
die()to the die notification handler chain.From: Jan Beulich <[email protected]>
(actual patch attached)
I understand that some people need to use attachment for patches. In some locations I have that problem myself.
However, the From: in the body above isn't needed. Or if it's needed, it should be part of the patch.
And the patch (attachment) also contains From:, but it's missing a Signed-off-by: line.
Please read/study Documentation/SubmittingPatches, esp. the section on "12) The canonical patch format".
Anyone: what are acceptable method(s) for using
attachments for patches?
Would no email body be OK? (I.e., everything in the attachment?) Everything being "the canonical patch format."
Thanks,
Signature · 1 line
~Randy
Re: [PATCH] i386: make trap information available to die handlers
Quoted 2 lines
And the patch (attachment) also contains From:, but it's missing a Signed-off-by: line.
I looked at many ChangeLog entries (which supposedly get created from the abstract), and by far not all of them have the author listed both as
From: and Singed-Off-By:, which made me think that either of the two should be sufficient (and I really can't see why the author information needs to appear twice).
Jan
Re: [PATCH] i386: make trap information available to die handlers
Quoted 8 lines · Jan Beulich
Quoted 2 lines
And the patch (attachment) also contains From:, but it's missing a Signed-off-by: line.
I looked at many ChangeLog entries (which supposedly get created from the abstract), and by far not all of them have the author listed both as
From: and Singed-Off-By:, which made me think that either of the two should be sufficient (and I really can't see why the author information needs to appear twice).
Tools can determined the From: part from your email, so it's often safe to omit that part.
The S-o-b part is required...
Signature · 1 line
~Randy
Re: [PATCH] i386: make trap information available to die handlers
Quoted 7 lines
Quoted 1 line
Quoted 1 line
"Randy.Dunlap" <[email protected]> 08.11.05 18:13:28 >>>
Quoted 4 lines · Jan Beulich
Quoted 2 lines
And the patch (attachment) also contains From:, but it's missing a Signed-off-by: line.
I looked at many ChangeLog entries (which supposedly get created
from
Quoted 1 line
Quoted 1 line
the abstract), and by far not all of them have the author listed
both as
Quoted 1 line
Quoted 1 line
From: and Singed-Off-By:, which made me think that either of the
two
Quoted 1 line
Quoted 1 line
should be sufficient (and I really can't see why the author
information
Quoted 6 lines
Quoted 1 line
needs to appear twice).
Tools can determined the From: part from your email, so it's often safe to omit that part.
The S-o-b part is required...
Strange. Andi Kleen specifically asked me to add From: to my patches... And I still can't see why the author of a patch wouldn't implicitly sign off on it.
Jan
Re: [PATCH] i386: make trap information available to die handlers
Quoted 16 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line
"Randy.Dunlap" <[email protected]> 08.11.05 18:13:28 >>>
Quoted 4 lines · Jan Beulich
Quoted 2 lines
And the patch (attachment) also contains From:, but it's missing a Signed-off-by: line.
I looked at many ChangeLog entries (which supposedly get created
from
Quoted 1 line
Quoted 1 line
the abstract), and by far not all of them have the author listed
both as
Quoted 1 line
Quoted 1 line
From: and Singed-Off-By:, which made me think that either of the
two
Quoted 1 line
Quoted 1 line
should be sufficient (and I really can't see why the author
information
Quoted 2 lines
Quoted 1 line
needs to appear twice).
Quoted 8 lines
Quoted 4 lines
Tools can determined the From: part from your email, so it's often safe to omit that part.
The S-o-b part is required...
Strange. Andi Kleen specifically asked me to add From: to my patches... And I still can't see why the author of a patch wouldn't implicitly sign off on it.
Read Documentation/SubmittingPatches. s-o-b: means that patch is GPL.
Pavel
Signature · 1 line
Thanks, Sharp!
Re: [PATCH] i386: make trap information available to die handlers
In reply to Jan BeulichQuoted 7 lines · Jan Beulich
I looked at many ChangeLog entries (which supposedly get created from the abstract), and by far not all of them have the author listed both as
From: and Singed-Off-By:, which made me think that either of the two should be sufficient (and I really can't see why the author information needs to appear twice).
The difference between From and Signed-of-by, is like knowing who owns the car, as receiving the keys to the car (hope it made any sense :)
Quoted 3 lines
Jan
Richard
PATCH 1/1 i386: int3 adjustment
In reply to Jan BeulichRemove conditionals from the way INT3 is handled; since the IDT gate is always set up as an interrupt gate, the restore_interrupts() call should also always be issued, making the conditional code unnecessary.
From: Jan Beulich <[email protected]>
(actual patch attached)
Remove conditionals from the way INT3 is handled; since the IDT gate is always set up as an interrupt gate, the restore_interrupts() call should also always be issued, making the conditional code unnecessary.
From: Jan Beulich <[email protected]>
arch/i386/kernel/traps.c +0 -5
@@ -447,9 +447,6 @@ fastcall void do_##name(struct pt_regs * } DO_VM86_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->eip) -#ifndef CONFIG_KPROBES -DO_VM86_ERROR( 3, SIGTRAP, "int3", int3) -#endif DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)DO_ERROR_INFO (6 ,SIGILL ,"invalid operand" , invalid_op,ILL_ILLOPN , regs->eip)
@@ -676,7 +673,6 @@ void unset_nmi_callback(void) }EXPORT_SYMBOL_GPL (unset_nmi_callback); -#ifdef CONFIG_KPROBES fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) { if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
@@ -687,7 +683,6 @@ fastcall void __kprobes do_int3(struct prestore_interrupts (regs);do_trap (3 ,SIGTRAP ,"int3" ,1 , regs, error_code,NULL ); } -#endif /* * Our handling of the processor debug registers is non-trivial.
PATCH 1/2 i386: double fault adjustment - introduce THREAD_ORDER
This introduces THREAD_ORDER (to accompany THREAD_SIZE, which now becomes a derivate of the former) in order to easily pass this to page allocation routines. Code consuming this (fixing the double fault handler to use per-CPU stacks) will soon follow.
(actual patch attached)
This introduces THREAD_ORDER (to accompany THREAD_SIZE, which now becomes a derivate of the former) in order to easily pass this to page allocation routines. Code consuming this (fixing the double fault handler to use per-CPU stacks) will soon follow.
arch/i386/kernel/asm-offsets.c +1 -0
@@ -68,5 +68,6 @@ void foo(void) sizeof(struct tss_struct));DEFINE (PAGE_SIZE_asm,PAGE_SIZE ); +DEFINE (THREAD_SIZE_asm,THREAD_SIZE );DEFINE (VSYSCALL_BASE ,__fix_to_virt (FIX_VSYSCALL )); }
arch/i386/kernel/entry.S +2 -2
@@ -540,8 +540,8 @@ ENTRY(nmi) /* Do not access memory above the end of our stack page, * it might not exist. */ - andl $(THREAD_SIZE-1),%eax - cmpl $(THREAD_SIZE-20),%eax + andl $(THREAD_SIZE_asm-1),%eax + cmpl $(THREAD_SIZE_asm-20),%eax popl %eax jae nmi_stack_correct cmpl $sysenter_entry,12(%esp)
arch/i386/kernel/head.S +1 -1
@@ -429,7 +429,7 @@ ENTRY(empty_zero_page) .data ENTRY(stack_start) - .long init_thread_union+THREAD_SIZE + .long init_thread_union+THREAD_SIZE_asm .long __BOOT_DS ready: .byte 0
arch/i386/kernel/vmlinux.lds.S +3 -2
@@ -4,8 +4,9 @@ #define LOAD_OFFSET __PAGE_OFFSET +#include <linux/config.h> #include <asm-generic/vmlinux.lds.h> -#include <asm/thread_info.h> +#include <asm/asm-offsets.h> #include <asm/page.h> OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
@@ -63,7 +64,7 @@ SECTIONS .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) } _edata = .; /* End of data section */ - . = ALIGN(THREAD_SIZE); /* init_task */ + . = ALIGN(THREAD_SIZE_asm); /* init_task */ .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { *(.data.init_task) }
include/asm-i386/thread_info.h +5 -4
@@ -54,10 +54,11 @@ struct thread_info {#define PREEMPT_ACTIVE 0x10000000#ifdef CONFIG_4KSTACKS -#define THREAD_SIZE (4096) +#define THREAD_ORDER 0#else -#define THREAD_SIZE (8192) +#define THREAD_ORDER 1#endif +#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)#define STACK_WARN (THREAD_SIZE/8)/*
@@ -118,12 +119,12 @@ register unsigned long current_stack_poi/* how to get the thread information struct from ASM */ #define GET_THREAD_INFO (reg) \ - movl $-THREAD_SIZE, reg; \ + movl $-THREAD_SIZE_asm, reg; \ andl %esp, reg/* use this one if reg already contains %esp */ #define GET_THREAD_INFO_WITH_ESP (reg) \ - andl $-THREAD_SIZE, reg + andl $-THREAD_SIZE_asm, reg#endif
PATCH 2/2 i386: double fault adjustment
Make the double fault handler use CPU-specific stacks. Add some abstraction to simplify future change of other exception handlers to go
through task gates. Change the pointer validity checks in the double fault handler to account for the fact that both GDT and TSS aren't in static kernel space anymore.
(actual patch attached)
Make the double fault handler use CPU-specific stacks. Add some abstraction to simplify future change of other exception handlers to go through task gates. Change the pointer validity checks in the double fault handler to account for the fact that both GDT and TSS aren't in static kernel space anymore.
This patch depends upon the presence of THREAD_ORDER, as added in a previously submitted patch.
arch/i386/kernel/cpu/common.c +51 -2
@@ -4,6 +4,7 @@#include <linux/smp.h> #include <linux/module.h> #include <linux/percpu.h> +#include <linux/bootmem.h> #include <asm/semaphore.h> #include <asm/processor.h> #include <asm/i387.h>
@@ -571,6 +572,7 @@ void __init early_cpu_init(void)void __devinit cpu_init (void ) {int cpu =smp_processor_id (); +unsigned i;struct tss_struct * t = &per_cpu (init_tss, cpu);struct thread_struct *thread = ¤t->thread;__u32 stk16_off = (__u32)&per_cpu (cpu_16bit_stack, cpu);
@@ -635,8 +637,55 @@ void __devinit cpu_init(void)load_TR_desc ();load_LDT (&init_mm.context); -/* Set up doublefault TSS pointer in the GDT */ -__set_tss_desc (cpu,GDT_ENTRY_DOUBLEFAULT_TSS , &doublefault_tss); +#if EXCEPTION_STACK_ORDER >THREAD_ORDER +# error Assertion failed: EXCEPTION_STACK_ORDER <= THREAD_ORDER +#endif +for (i =0 ; i <N_EXCEPTION_TSS ; ++i) { +unsigned long stack; + +/* Set up exception handling TSS */ + exception_tss[cpu][i].esp2 = cpu; + exception_tss[cpu][i].esi = (unsigned long )&exception_tss[cpu][i]; + +/* Set up exception handling stacks */ +#ifdef CONFIG_SMP +if (cpu) { + stack =__get_free_pages (GFP_ATOMIC ,THREAD_ORDER ); +if (!stack) +panic ("Cannot allocate exception stack %u %d\n" , + i, + cpu); + } + else +#endif + stack = (unsigned long )__alloc_bootmem (EXCEPTION_STKSZ , +THREAD_SIZE , +__pa (MAX_DMA_ADDRESS )); + stack +=EXCEPTION_STKSZ ; + exception_tss[cpu][i].esp = stack; + exception_tss[cpu][i].esp0 = stack; +#ifdef CONFIG_SMP +if (cpu) { +unsigned j; + +for (j =EXCEPTION_STACK_ORDER ; j <THREAD_ORDER ; ++j) { +/* set_page_refs sets the page count only for the first +page, but since we split the larger-order page here, +we need to adjust the page count before freeing the +pieces. */ +struct page * page =virt_to_page ((void *)stack); + +BUG_ON (page_count (page)); +set_page_count (page,1 ); +free_pages (stack, j); + stack += (PAGE_SIZE << j); + } + } +#endif + +/* Set up exception handling TSS pointer in the GDT */ +__set_tss_desc (cpu,GDT_ENTRY_EXCEPTION_TSS + i, &exception_tss[cpu][i]); + }/* Clear %fs and %gs. */ asmvolatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs" );
arch/i386/kernel/doublefault.c +9 -28
@@ -9,13 +9,11 @@#include <asm/processor.h> #include <asm/desc.h> -#define DOUBLEFAULT_STACKSIZE (1024) -static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE ]; -#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE) +extern unsigned long max_low_pfn; +#define ptr_ok (x, l) ((x) >= PAGE_OFFSET \ + && (x) + (l) <= PAGE_OFFSET + max_low_pfn * PAGE_SIZE - 1) -#define ptr_ok (x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + 0x1000000) - -static void doublefault_fn (void ) +void doublefault_fn (void ) {struct Xgt_desc_struct gdt_desc = {0 ,0 };unsigned long gdt, tss;
@@ -23,43 +21,26 @@ static void doublefault_fn(void)store_gdt (&gdt_desc); gdt = gdt_desc.address; -printk ("double fault, gdt at %08lx [%d bytes]\n" , gdt, gdt_desc.size); +printk ("double fault, gdt at %08lx [%d bytes]\n" , gdt, gdt_desc.size +1 ); -if (ptr_ok (gdt)) { +if (ptr_ok (gdt, gdt_desc.size)) { gdt +=GDT_ENTRY_TSS <<3 ; tss = *(u16 *)(gdt+2 ); tss += *(u8 *)(gdt+4 ) <<16 ; tss += *(u8 *)(gdt+7 ) <<24 ;printk ("double fault, tss at %08lx\n" , tss); -if (ptr_ok (tss)) { +if (ptr_ok (tss, *(u16 *)gdt)) {struct tss_struct *t = (struct tss_struct *)tss;printk ("eip = %08lx, esp = %08lx\n" , t->eip, t->esp);printk ("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n" , t->eax, t->ebx, t->ecx, t->edx); -printk ("esi = %08lx, edi = %08lx\n" , - t->esi, t->edi); +printk ("esi = %08lx, edi = %08lx, ebp = %08lx\n" , + t->esi, t->edi, t->ebp); } }for (;;)/* nothing */ ; } - -struct tss_struct doublefault_tss __cacheline_aligned = { - .esp0 =STACK_START , - .ss0 = __KERNEL_DS, - .ldt =0 , - .io_bitmap_base =INVALID_IO_BITMAP_OFFSET , - - .eip = (unsigned long ) doublefault_fn, - .eflags =X86_EFLAGS_SF |0x2 ,/* 0x2 bit is always set */ - .esp =STACK_START , - .es = __USER_DS, - .cs = __KERNEL_CS, - .ss = __KERNEL_DS, - .ds = __USER_DS, - - .__cr3 =__pa (swapper_pg_dir) -};
arch/i386/kernel/head.S +5 -4
@@ -479,9 +479,9 @@ ENTRY(boot_gdt_table) .quad 0x00cf92000000ffff /* kernel 4GB data at 0x00000000 */ /* - * The Global Descriptor Table contains 28 quadwords, per-CPU. + * The Global Descriptor Table contains at least 31 quadwords, per-CPU. */ - .align PAGE_SIZE_asm + .align L1_CACHE_BYTES ENTRY(cpu_gdt_table) .quad 0x0000000000000000 /* NULL descriptor */ .quad 0x0000000000000000 /* 0x0b reserved */
@@ -523,5 +523,6 @@ ENTRY(cpu_gdt_table) .quad 0x0000000000000000 /* 0xe0 - unused */ .quad 0x0000000000000000 /* 0xe8 - unused */ .quad 0x0000000000000000 /* 0xf0 - unused */ - .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ - + /* Remaining entries represent TSSes for handling exceptions and + are run-time initialized. */ + .fill GDT_ENTRIES - (. - cpu_gdt_table) / 8, 8, 0
arch/i386/kernel/traps.c +19 -1
@@ -61,6 +61,24 @@ asmlinkage int system_call(void);struct desc_struct default_ldt[] = { {0 ,0 }, {0 ,0 }, {0 ,0 }, {0 ,0 }, {0 ,0 } }; +void doublefault_fn (void ); + +struct tss_struct exception_tss[NR_CPUS][N_EXCEPTION_TSS] __cacheline_aligned = { + [0 ...NR_CPUS -1 ] = { + [0 ...N_EXCEPTION_TSS -1 ] = { + .cs = __KERNEL_CS, + .ss = __KERNEL_DS, + .ss0 = __KERNEL_DS, + .__cr3 =__pa (swapper_pg_dir), + .io_bitmap_base =INVALID_IO_BITMAP_OFFSET , + .ds = __USER_DS, + .es = __USER_DS, + .eflags =X86_EFLAGS_SF |0x2 ,/* 0x2 bit is always set */ + }, + [DOUBLEFAULT_TSS ].eip = (unsigned long )doublefault_fn + } +}; +/* Do we ignore FPU interrupts ? */ char ignore_fpu_irq =0 ;
@@ -1086,7 +1104,7 @@ void __init trap_init(void)set_system_gate (5 ,&bounds);set_trap_gate (6 ,&invalid_op);set_trap_gate (7 ,&device_not_available); -set_task_gate (8 ,GDT_ENTRY_DOUBLEFAULT_TSS ); +set_task_gate (8 ,GDT_ENTRY_EXCEPTION_TSS +DOUBLEFAULT_TSS );set_trap_gate (9 ,&coprocessor_segment_overrun);set_trap_gate (10 ,&invalid_TSS);set_trap_gate (11 ,&segment_not_present);
include/asm-i386/processor.h +6 -1
@@ -86,7 +86,6 @@ struct cpuinfo_x86 {extern struct cpuinfo_x86 boot_cpu_data;extern struct cpuinfo_x86 new_cpu_data; -extern struct tss_struct doublefault_tss; DECLARE_PER_CPU(struct tss_struct, init_tss);#ifdef CONFIG_SMP
@@ -480,6 +479,12 @@ struct thread_struct { .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ } +#define DOUBLEFAULT_TSS 0 +#define EXCEPTION_STACK_ORDER 0 +#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) + +extern struct tss_struct exception_tss[NR_CPUS ][N_EXCEPTION_TSS ]; +static inline void load_esp0 (struct tss_struct *tss,struct thread_struct *thread) { tss->esp0 = thread->esp0;
include/asm-i386/segment.h +8 -7
@@ -43,7 +43,8 @@* 28 - unused * 29 - unused * 30 - unused -* 31 - TSS for double fault handler +* 31 - TSS for first exception handler (double fault) +* 32+ TSSes for further exception handlers */ #define GDT_ENTRY_TLS_ENTRIES 3#define GDT_ENTRY_TLS_MIN 6
@@ -74,12 +75,14 @@#define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14)#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8) -#define GDT_ENTRY_DOUBLEFAULT_TSS 31 +#define GDT_ENTRY_EXCEPTION_TSS 31 +#define DOUBLEFAULT_TSS 0 +#define N_EXCEPTION_TSS 1/* -* The GDT has 32 entries +* The GDT has 32+ entries. */ -#define GDT_ENTRIES 32 +#define GDT_ENTRIES (31 + N_EXCEPTION_TSS)#define GDT_SIZE (GDT_ENTRIES * 8)
@@ -92,9 +95,7 @@#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)/* -* The interrupt descriptor table has room for 256 idt's, -* the global descriptor table is dependent on the number -* of tasks we can have.. +* The interrupt descriptor table has room for 256 idt's. */ #define IDT_ENTRIES 256
PATCH 1/1 i386: NMI <-> debugging handler adjustments
In reply to Jan BeulichAlso account for an INT3 breakpoint potentially placed (from a kernel debugger) on sysenter_entry, which requires the NMI handler to add one more check. Further, don't discard debug or breakpoint traps/faults happening on this one instruction and their handler getting interrupted by an NMI before being able to fix the stack.
From: Jan Beulich <[email protected]>
(actual patch attached)
Also account for an INT3 breakpoint potentially placed (from a kernel debugger) on sysenter_entry, which requires the NMI handler to add one more check. Further, don't discard debug or breakpoint traps/faults happening on this one instruction and their handler getting interrupted by an NMI before being able to fix the stack.
From: Jan Beulich <[email protected]>
arch/i386/kernel/entry.S +27 -5
@@ -178,6 +178,7 @@ need_resched: # sysenter call handler stub ENTRY(sysenter_entry) movl TSS_sysenter_esp0(%esp),%esp +.globl sysenter_past_esp sysenter_past_esp: sti pushl $(__USER_DS)
@@ -520,12 +521,12 @@ debug_stack_correct: jmp ret_from_exception .previous .text /* - * NMI is doubly nasty. It can happen _while_ we're handling - * a debug fault, and the debug fault hasn't yet been able to - * clear up the stack. So we first check whether we got an + * NMI is doubly nasty. It can happen _while_ we're handling a debug + * fault or breakpoint trap, and the fault/trap hasn't yet been able + * to clear up the stack. So we first check whether we got an * NMI on the sysenter entry path, but after that we need to - * check whether we got an NMI on the debug path where the debug - * fault happened on the sysenter path. + * check whether we got an NMI on the debug/breakpoint path where the + * fault/trap happened on the sysenter path. */ ENTRY(nmi) pushl %eax
@@ -546,6 +547,8 @@ ENTRY(nmi) jae nmi_stack_correct cmpl $sysenter_entry,12(%esp) je nmi_debug_stack_check + cmpl $sysenter_entry+1,12(%esp) + je .Lnmi_int3_stack_check nmi_stack_correct: pushl %eax SAVE_ALL
@@ -566,6 +569,21 @@ nmi_debug_stack_check: jle nmi_debug_stack_fixup nmi_debug_stack_fixup: FIX_STACK(24,nmi_stack_correct, 1) + pushfl + pushl $__KERNEL_CS + pushl $debug_stack_correct + jmp nmi_stack_correct +.Lnmi_int3_stack_check: + cmpw $__KERNEL_CS,16(%esp) + jne nmi_stack_correct + cmpl $int3, (%esp) + jb nmi_stack_correct + cmpl $.Lint3_esp_fix_insn, (%esp) + ja nmi_stack_correct + FIX_STACK(24,nmi_stack_correct, 1) + pushfl + pushl $__KERNEL_CS + pushl $.Lint3_stack_correct jmp nmi_stack_correct nmi_16bit_stack:
@@ -592,6 +610,10 @@ nmi_16bit_stack: .previous KPROBE_ENTRY(int3) + cmpl $sysenter_entry+1, (%esp) + jne .Lint3_stack_correct + FIX_STACK(12, .Lint3_stack_correct, .Lint3_esp_fix_insn) +.Lint3_stack_correct: pushl $-1 # mark this as an int SAVE_ALL xorl %edx,%edx # zero error code
PATCH 1/1 i386: handle NMI case in IPI sending
In reply to Jan BeulichDefine NMI_VECTOR for all sub-architectures, and handle it in the IPI sending code.
From: Jan Beulich <[email protected]>
(actual patch attached)
Define NMI_VECTOR for all sub-architectures, and handle it in the IPI sending code.
From: Jan Beulich <[email protected]>
arch/i386/kernel/smp.c +11 -1
@@ -114,7 +114,17 @@ DEFINE_PER_CPU(struct tlb_state, cpu_tlbstatic inline int __prepare_ICR (unsigned int shortcut,int vector) { -return APIC_DM_FIXED | shortcut | vector |APIC_DEST_LOGICAL ; +unsigned int cfg = shortcut | vector |APIC_DEST_LOGICAL ; + +switch (vector) { +default : + cfg |=APIC_DM_FIXED ; +break ; +case NMI_VECTOR : + cfg |=APIC_DM_NMI ; +break ; + } +return cfg; }static inline int __prepare_ICR2 (unsigned int mask)
include/asm-i386/mach-default/irq_vectors.h +1 -0
@@ -22,6 +22,7 @@#ifndef _ASM_IRQ_VECTORS_H#define _ASM_IRQ_VECTORS_H +#define NMI_VECTOR 0x02/* * IDT vectors usable for external interrupt sources start * at 0x20:
include/asm-i386/mach-visws/irq_vectors.h +1 -0
@@ -1,6 +1,7 @@#ifndef _ASM_IRQ_VECTORS_H#define _ASM_IRQ_VECTORS_H +#define NMI_VECTOR 0x02/* * IDT vectors usable for external interrupt sources start * at 0x20:
include/asm-i386/mach-voyager/irq_vectors.h +1 -0
@@ -12,6 +12,7 @@#ifndef _ASM_IRQ_VECTORS_H#define _ASM_IRQ_VECTORS_H +#define NMI_VECTOR 0x02/* * IDT vectors usable for external interrupt sources start * at 0x20:
PATCH 1/1 i386: stand-alone CONFIG_PAE
In reply to Jan BeulichSeparate the config option for PAE from that for high memory beyond 4G, allowing configurations with non-execute protection without any (potential) other overhead coming from HIGHMEM64G.
Also appropriately qualify both options depending on configured minimum processor type.
From: Jan Beulich <[email protected]>
(actual patch attached)
Separate the config option for PAE from that for high memory beyond 4G, allowing configurations with non-execute protection without any (potential) other overhead coming from HIGHMEM64G.
Also appropriately qualify both options depending on configured minimum processor type.
From: Jan Beulich <[email protected]>
arch/i386/Kconfig +6 -4
@@ -739,7 +739,7 @@ config HIGHMEM4G gigabytes of physical RAM. config HIGHMEM64G - bool "64GB" + bool "64GB" if !M386 && !M486 && !M586 help Select this if you have a 32-bit processor and more than 4 gigabytes of physical RAM.
@@ -752,9 +752,11 @@ config HIGHMEM default y config X86_PAE - bool - depends on HIGHMEM64G - default y + bool "PAE" if !HIGHMEM64G && !M386 && !M486 && !M586 + default HIGHMEM64G + help + Select this if you want the no-execute MMU functionality despite + your system not having more than 4 gigabytes of RAM. # Common NUMA Features config NUMA
Re: [PATCH] i386: stand-alone CONFIG_PAE
Quoted 3 lines · Jan Beulich
...
Also appropriately qualify both options depending on configured minimum processor type.
With the current semantics of the cpu options this is wrong:
M386 is a synonym for "kernel runs on all cpus".
Quoted 3 lines
From: Jan Beulich <[email protected]>
(actual patch attached)
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedRe: [PATCH] i386: stand-alone CONFIG_PAE
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Adrian Bunk <[email protected]> 08.11.05 18:02:43 >>>
Quoted 3 lines · Jan Beulich
...
Also appropriately qualify both options depending on configured minimum processor type.With the current semantics of the cpu options this is wrong:
M386 is a synonym for "kernel runs on all cpus".
No. Such a kernel in fact doesn't run on all CPUs. It's not like it can take advantage of PAE if it's there, it'll die if there is no PAE. That's why those that clearly can't have PAE have been excluded.
Jan
PATCH 1/1 i386: adjust page fault handling
In reply to Jan BeulichAdjust page fault protection error check before considering it to be a vmalloc synchronization candidate.
From: Jan Beulich <[email protected]>
(actual patch attached)
Adjust page fault protection error check before considering it to be a vmalloc synchronization candidate.
From: Jan Beulich <[email protected]>
arch/i386/mm/fault.c +4 -2
@@ -223,6 +223,8 @@ fastcall void do_invalid_op(struct pt_re* bit 0 == 0 means no page found, 1 means protection fault * bit 1 == 0 means read, 1 means write * bit 2 == 0 means kernel, 1 means user-mode +* bit 3 == 1 means use of reserved bit detected +* bit 4 == 1 means fault was an instruction fetch */ fastcall void __kprobes do_page_fault(struct pt_regs *regs,unsigned long error_code)
@@ -259,10 +261,10 @@ fastcall void __kprobes do_page_fault(st* * This verifies that the fault happens in kernel space * (error_code & 4) == 0, and that the fault was not a -* protection error (error_code & 1) == 0. +* protection error (error_code & 9) == 0. */ if (unlikely (address >=TASK_SIZE )) { -if (!(error_code &5 )) +if (!(error_code &0xd )) goto vmalloc_fault;/* * Don't take the mm semaphore here. If we fixup a prefetch
Quoted 8 lines · Jan Beulich
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
From: Jan Beulich <[email protected]>
(actual patch attached)
Having no attachments would be preferable, but if you must use attachments, having them marked as plain text instead of "octet-stream" would be a great improvement.
Thanks.
Signature · 1 line
~Randy
Quoted 8 lines
Quoted 1 line
Quoted 1 line
"Randy.Dunlap" <[email protected]> 08.11.05 22:22:45 >>>
Quoted 5 lines · Jan Beulich
A change not too long ago made i386's genapic symbol no longer be exported, and thus certain low-level functions no longer be usable. Since close-to-the-hardware code may still be modular, this rectifies the situation.
Quoted 7 lines
Quoted 3 lines
From: Jan Beulich <[email protected]>
(actual patch attached)
Having no attachments would be preferable, but if you must use attachments, having them marked as plain text instead of "octet-stream" would be a great improvement.
I'm sorry, I thought that worked now. As it turns out, they had fixed this here in (or before) July this year, but later broke it again. The intention is indeed to have them sent as text.
Jan