* [PATCH] i386: export genapic again
@ 2005-11-08 12:57 Jan Beulich
2005-11-08 13:08 ` Arjan van de Ven
` (8 more replies)
0 siblings, 9 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 12:57 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 286 bytes --]
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 <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-genapic.patch --]
[-- Type: application/octet-stream, Size: 1031 bytes --]
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 <jbeulich@novell.com>
--- 2.6.14/arch/i386/mach-generic/probe.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-genapic/arch/i386/mach-generic/probe.c 2005-11-04 16:19:33.000000000 +0100
@@ -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,
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: export genapic again
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
@ 2005-11-08 13:08 ` Arjan van de Ven
2005-11-08 13:22 ` Jan Beulich
2005-11-08 13:29 ` Adrian Bunk
` (7 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Arjan van de Ven @ 2005-11-08 13:08 UTC (permalink / raw)
To: Jan Beulich; +Cc: linux-kernel
On Tue, 2005-11-08 at 13:57 +0100, Jan Beulich wrote:
> 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 <jbeulich@novell.com>
>
> (actual patch attached)
>
+#define APIC_DEFINITION 1
what is that for?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: export genapic again
2005-11-08 13:08 ` Arjan van de Ven
@ 2005-11-08 13:22 ` Jan Beulich
0 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 13:22 UTC (permalink / raw)
To: Arjan Ven; +Cc: linux-kernel
>>> Arjan van de Ven <arjan@infradead.org> 08.11.05 14:08:09 >>>
>On Tue, 2005-11-08 at 13:57 +0100, Jan Beulich wrote:
>> 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 <jbeulich@novell.com>
>>
>> (actual patch attached)
>>
>
>+#define APIC_DEFINITION 1
>
>what 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: export genapic again
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
2005-11-08 13:08 ` Arjan van de Ven
@ 2005-11-08 13:29 ` Adrian Bunk
2005-11-08 14:17 ` Jan Beulich
2005-11-08 16:52 ` [PATCH] i386: make trap information available to die handlers Jan Beulich
` (6 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Adrian Bunk @ 2005-11-08 13:29 UTC (permalink / raw)
To: Jan Beulich; +Cc: linux-kernel
On Tue, Nov 08, 2005 at 01:57:53PM +0100, Jan Beulich wrote:
> 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?
> From: Jan Beulich <jbeulich@novell.com>
>
> (actual patch attached)
cu
Adrian
--
"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 Seed
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: export genapic again
2005-11-08 13:29 ` Adrian Bunk
@ 2005-11-08 14:17 ` Jan Beulich
0 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 14:17 UTC (permalink / raw)
To: Adrian Bunk; +Cc: linux-kernel
>>> Adrian Bunk <bunk@stusta.de> 08.11.05 14:29:54 >>>
>On Tue, Nov 08, 2005 at 01:57:53PM +0100, Jan Beulich wrote:
>> 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?
I'm in the process of preparing such a submission.
Jan
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] i386: make trap information available to die handlers
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
2005-11-08 13:08 ` Arjan van de Ven
2005-11-08 13:29 ` Adrian Bunk
@ 2005-11-08 16:52 ` Jan Beulich
2005-11-08 16:59 ` Randy.Dunlap
2005-11-08 16:52 ` [PATCH] i386: int3 adjustment Jan Beulich
` (5 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 16:52 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
Pass the trap number causing the call to die() to the die notification
handler chain.
From: Jan Beulich <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-die-trap-info.patch --]
[-- Type: application/octet-stream, Size: 630 bytes --]
Pass the trap number causing the call to die() to the die notification
handler chain.
From: Jan Beulich <jbeulich@novell.com>
--- 2.6.14/arch/i386/kernel/traps.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-die-trap-info/arch/i386/kernel/traps.c 2005-11-04 17:00:47.000000000 +0100
@@ -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");
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] i386: int3 adjustment
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
` (2 preceding siblings ...)
2005-11-08 16:52 ` [PATCH] i386: make trap information available to die handlers Jan Beulich
@ 2005-11-08 16:52 ` Jan Beulich
2005-11-09 8:37 ` [PATCH 1/2] i386: double fault adjustment - introduce THREAD_ORDER Jan Beulich
2005-11-08 16:54 ` [PATCH] i386: NMI <-> debugging handler adjustments Jan Beulich
` (4 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 16:52 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
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 <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-int3.patch --]
[-- Type: application/octet-stream, Size: 1297 bytes --]
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 <jbeulich@novell.com>
--- 2.6.14/arch/i386/kernel/traps.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-int3/arch/i386/kernel/traps.c 2005-11-04 17:00:47.000000000 +0100
@@ -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 p
restore_interrupts(regs);
do_trap(3, SIGTRAP, "int3", 1, regs, error_code, NULL);
}
-#endif
/*
* Our handling of the processor debug registers is non-trivial.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] i386: NMI <-> debugging handler adjustments
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
` (3 preceding siblings ...)
2005-11-08 16:52 ` [PATCH] i386: int3 adjustment Jan Beulich
@ 2005-11-08 16:54 ` Jan Beulich
2005-11-08 16:55 ` [PATCH] i386: handle NMI case in IPI sending Jan Beulich
` (3 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 16:54 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
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 <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-nmi-int3.patch --]
[-- Type: application/octet-stream, Size: 2573 bytes --]
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 <jbeulich@novell.com>
--- 2.6.14/arch/i386/kernel/entry.S 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-nmi-int3/arch/i386/kernel/entry.S 2005-11-08 17:06:59.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] i386: handle NMI case in IPI sending
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
` (4 preceding siblings ...)
2005-11-08 16:54 ` [PATCH] i386: NMI <-> debugging handler adjustments Jan Beulich
@ 2005-11-08 16:55 ` Jan Beulich
2005-11-08 16:55 ` [PATCH] i386: stand-alone CONFIG_PAE Jan Beulich
` (2 subsequent siblings)
8 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 16:55 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 151 bytes --]
Define NMI_VECTOR for all sub-architectures, and handle it in the IPI
sending code.
From: Jan Beulich <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-nmi-ipi.patch --]
[-- Type: application/octet-stream, Size: 1852 bytes --]
Define NMI_VECTOR for all sub-architectures, and handle it in the IPI
sending code.
From: Jan Beulich <jbeulich@novell.com>
--- 2.6.14/arch/i386/kernel/smp.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-nmi-ipi/arch/i386/kernel/smp.c 2005-11-04 16:51:14.000000000 +0100
@@ -114,7 +114,17 @@ DEFINE_PER_CPU(struct tlb_state, cpu_tlb
static 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)
--- 2.6.14/include/asm-i386/mach-default/irq_vectors.h 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-nmi-ipi/include/asm-i386/mach-default/irq_vectors.h 2005-11-04 16:19:34.000000000 +0100
@@ -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:
--- 2.6.14/include/asm-i386/mach-visws/irq_vectors.h 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-nmi-ipi/include/asm-i386/mach-visws/irq_vectors.h 2005-11-04 16:19:34.000000000 +0100
@@ -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:
--- 2.6.14/include/asm-i386/mach-voyager/irq_vectors.h 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-nmi-ipi/include/asm-i386/mach-voyager/irq_vectors.h 2005-11-04 16:19:34.000000000 +0100
@@ -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:
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] i386: stand-alone CONFIG_PAE
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
` (5 preceding siblings ...)
2005-11-08 16:55 ` [PATCH] i386: handle NMI case in IPI sending Jan Beulich
@ 2005-11-08 16:55 ` Jan Beulich
2005-11-08 17:02 ` Adrian Bunk
2005-11-08 16:57 ` [PATCH] i386: adjust page fault handling Jan Beulich
2005-11-08 21:22 ` [PATCH] i386: export genapic again Randy.Dunlap
8 siblings, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 16:55 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 342 bytes --]
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 <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-pae.patch --]
[-- Type: application/octet-stream, Size: 1058 bytes --]
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 <jbeulich@novell.com>
--- 2.6.14/arch/i386/Kconfig 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-pae/arch/i386/Kconfig 2005-11-04 16:19:32.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] i386: adjust page fault handling
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
` (6 preceding siblings ...)
2005-11-08 16:55 ` [PATCH] i386: stand-alone CONFIG_PAE Jan Beulich
@ 2005-11-08 16:57 ` Jan Beulich
2005-11-08 21:22 ` [PATCH] i386: export genapic again Randy.Dunlap
8 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 16:57 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
Adjust page fault protection error check before considering it to be
a vmalloc synchronization candidate.
From: Jan Beulich <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-pagefault.patch --]
[-- Type: application/octet-stream, Size: 1182 bytes --]
Adjust page fault protection error check before considering it to be
a vmalloc synchronization candidate.
From: Jan Beulich <jbeulich@novell.com>
--- 2.6.14/arch/i386/mm/fault.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-pagefault/arch/i386/mm/fault.c 2005-11-04 16:19:33.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: make trap information available to die handlers
2005-11-08 16:52 ` [PATCH] i386: make trap information available to die handlers Jan Beulich
@ 2005-11-08 16:59 ` Randy.Dunlap
2005-11-08 17:08 ` Jan Beulich
0 siblings, 1 reply; 23+ messages in thread
From: Randy.Dunlap @ 2005-11-08 16:59 UTC (permalink / raw)
To: Jan Beulich; +Cc: akpm, linux-kernel
On Tue, 8 Nov 2005, Jan Beulich wrote:
> Pass the trap number causing the call to die() to the die notification
> handler chain.
>
> From: Jan Beulich <jbeulich@novell.com>
>
> (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,
--
~Randy
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: stand-alone CONFIG_PAE
2005-11-08 16:55 ` [PATCH] i386: stand-alone CONFIG_PAE Jan Beulich
@ 2005-11-08 17:02 ` Adrian Bunk
2005-11-08 17:10 ` Jan Beulich
0 siblings, 1 reply; 23+ messages in thread
From: Adrian Bunk @ 2005-11-08 17:02 UTC (permalink / raw)
To: Jan Beulich; +Cc: linux-kernel
On Tue, Nov 08, 2005 at 05:55:43PM +0100, Jan Beulich wrote:
>...
> 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".
> From: Jan Beulich <jbeulich@novell.com>
>
> (actual patch attached)
cu
Adrian
--
"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 Seed
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: make trap information available to die handlers
2005-11-08 16:59 ` Randy.Dunlap
@ 2005-11-08 17:08 ` Jan Beulich
2005-11-08 17:13 ` Randy.Dunlap
2005-11-08 20:58 ` Richard Knutsson
0 siblings, 2 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 17:08 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: akpm, linux-kernel
>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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: stand-alone CONFIG_PAE
2005-11-08 17:02 ` Adrian Bunk
@ 2005-11-08 17:10 ` Jan Beulich
0 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-08 17:10 UTC (permalink / raw)
To: Adrian Bunk; +Cc: linux-kernel
>>> Adrian Bunk <bunk@stusta.de> 08.11.05 18:02:43 >>>
>On Tue, Nov 08, 2005 at 05:55:43PM +0100, Jan Beulich wrote:
>>...
>> 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: make trap information available to die handlers
2005-11-08 17:08 ` Jan Beulich
@ 2005-11-08 17:13 ` Randy.Dunlap
2005-11-09 8:20 ` Jan Beulich
2005-11-08 20:58 ` Richard Knutsson
1 sibling, 1 reply; 23+ messages in thread
From: Randy.Dunlap @ 2005-11-08 17:13 UTC (permalink / raw)
To: Jan Beulich; +Cc: Randy.Dunlap, akpm, linux-kernel
On Tue, 8 Nov 2005, Jan Beulich wrote:
> >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...
--
~Randy
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: make trap information available to die handlers
2005-11-08 17:08 ` Jan Beulich
2005-11-08 17:13 ` Randy.Dunlap
@ 2005-11-08 20:58 ` Richard Knutsson
1 sibling, 0 replies; 23+ messages in thread
From: Richard Knutsson @ 2005-11-08 20:58 UTC (permalink / raw)
To: Jan Beulich; +Cc: Randy.Dunlap, akpm, linux-kernel
Jan Beulich wrote:
>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 :)
>Jan
>
>
Richard
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: export genapic again
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
` (7 preceding siblings ...)
2005-11-08 16:57 ` [PATCH] i386: adjust page fault handling Jan Beulich
@ 2005-11-08 21:22 ` Randy.Dunlap
2005-11-09 8:18 ` Jan Beulich
8 siblings, 1 reply; 23+ messages in thread
From: Randy.Dunlap @ 2005-11-08 21:22 UTC (permalink / raw)
To: Jan Beulich; +Cc: linux-kernel
On Tue, 8 Nov 2005, Jan Beulich wrote:
> 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 <jbeulich@novell.com>
>
> (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.
--
~Randy
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: export genapic again
2005-11-08 21:22 ` [PATCH] i386: export genapic again Randy.Dunlap
@ 2005-11-09 8:18 ` Jan Beulich
0 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-09 8:18 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: linux-kernel
>>> "Randy.Dunlap" <rdunlap@xenotime.net> 08.11.05 22:22:45 >>>
>On Tue, 8 Nov 2005, Jan Beulich wrote:
>
>> 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 <jbeulich@novell.com>
>>
>> (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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: make trap information available to die handlers
2005-11-08 17:13 ` Randy.Dunlap
@ 2005-11-09 8:20 ` Jan Beulich
2005-11-10 12:21 ` Pavel Machek
0 siblings, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2005-11-09 8:20 UTC (permalink / raw)
To: Randy.Dunlap; +Cc: akpm, linux-kernel
>>> "Randy.Dunlap" <rdunlap@xenotime.net> 08.11.05 18:13:28 >>>
>On Tue, 8 Nov 2005, Jan Beulich wrote:
>
>> >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...
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 1/2] i386: double fault adjustment - introduce THREAD_ORDER
2005-11-08 16:52 ` [PATCH] i386: int3 adjustment Jan Beulich
@ 2005-11-09 8:37 ` Jan Beulich
2005-11-09 8:38 ` [PATCH 2/2] i386: double fault adjustment Jan Beulich
0 siblings, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2005-11-09 8:37 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
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.
Signed-Off-By: Jan Beulich <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-THREAD_ORDER.patch --]
[-- Type: application/octet-stream, Size: 3183 bytes --]
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.
Signed-Off-By: Jan Beulich <jbeulich@novell.com>
--- 2.6.14/arch/i386/kernel/asm-offsets.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-THREAD_ORDER/arch/i386/kernel/asm-offsets.c 2005-11-04 16:19:32.000000000 +0100
@@ -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));
}
--- 2.6.14/arch/i386/kernel/entry.S 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-THREAD_ORDER/arch/i386/kernel/entry.S 2005-11-04 16:45:13.000000000 +0100
@@ -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)
--- 2.6.14/arch/i386/kernel/head.S 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-THREAD_ORDER/arch/i386/kernel/head.S 2005-11-04 16:47:02.000000000 +0100
@@ -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
--- 2.6.14/arch/i386/kernel/vmlinux.lds.S 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-THREAD_ORDER/arch/i386/kernel/vmlinux.lds.S 2005-11-08 14:45:53.000000000 +0100
@@ -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)
}
--- 2.6.14/include/asm-i386/thread_info.h 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-THREAD_ORDER/include/asm-i386/thread_info.h 2005-11-04 16:19:34.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/2] i386: double fault adjustment
2005-11-09 8:37 ` [PATCH 1/2] i386: double fault adjustment - introduce THREAD_ORDER Jan Beulich
@ 2005-11-09 8:38 ` Jan Beulich
0 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2005-11-09 8:38 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
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.
Signed-Off-By: Jan Beulich <jbeulich@novell.com>
(actual patch attached)
[-- Attachment #2: linux-2.6.14-i386-doublefault.patch --]
[-- Type: application/octet-stream, Size: 9392 bytes --]
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.
Signed-Off-By: Jan Beulich <jbeulich@novell.com>
--- 2.6.14/arch/i386/kernel/cpu/common.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-doublefault/arch/i386/kernel/cpu/common.c 2005-11-04 16:19:32.000000000 +0100
@@ -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. */
asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs");
--- 2.6.14/arch/i386/kernel/doublefault.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-doublefault/arch/i386/kernel/doublefault.c 2005-11-04 16:19:32.000000000 +0100
@@ -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)
-};
--- 2.6.14/arch/i386/kernel/head.S 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-doublefault/arch/i386/kernel/head.S 2005-11-04 16:47:02.000000000 +0100
@@ -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
--- 2.6.14/arch/i386/kernel/traps.c 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-doublefault/arch/i386/kernel/traps.c 2005-11-04 17:00:47.000000000 +0100
@@ -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);
--- 2.6.14/include/asm-i386/processor.h 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-doublefault/include/asm-i386/processor.h 2005-11-07 10:20:43.000000000 +0100
@@ -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;
--- 2.6.14/include/asm-i386/segment.h 2005-10-28 02:02:08.000000000 +0200
+++ 2.6.14-i386-doublefault/include/asm-i386/segment.h 2005-11-08 09:16:17.000000000 +0100
@@ -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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] i386: make trap information available to die handlers
2005-11-09 8:20 ` Jan Beulich
@ 2005-11-10 12:21 ` Pavel Machek
0 siblings, 0 replies; 23+ messages in thread
From: Pavel Machek @ 2005-11-10 12:21 UTC (permalink / raw)
To: Jan Beulich; +Cc: Randy.Dunlap, akpm, linux-kernel
On St 09-11-05 09:20:25, Jan Beulich wrote:
> >>> "Randy.Dunlap" <rdunlap@xenotime.net> 08.11.05 18:13:28 >>>
> >On Tue, 8 Nov 2005, Jan Beulich wrote:
> >
> >> >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...
>
> 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
--
Thanks, Sharp!
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2005-11-10 12:22 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-08 12:57 [PATCH] i386: export genapic again Jan Beulich
2005-11-08 13:08 ` Arjan van de Ven
2005-11-08 13:22 ` Jan Beulich
2005-11-08 13:29 ` Adrian Bunk
2005-11-08 14:17 ` Jan Beulich
2005-11-08 16:52 ` [PATCH] i386: make trap information available to die handlers Jan Beulich
2005-11-08 16:59 ` Randy.Dunlap
2005-11-08 17:08 ` Jan Beulich
2005-11-08 17:13 ` Randy.Dunlap
2005-11-09 8:20 ` Jan Beulich
2005-11-10 12:21 ` Pavel Machek
2005-11-08 20:58 ` Richard Knutsson
2005-11-08 16:52 ` [PATCH] i386: int3 adjustment Jan Beulich
2005-11-09 8:37 ` [PATCH 1/2] i386: double fault adjustment - introduce THREAD_ORDER Jan Beulich
2005-11-09 8:38 ` [PATCH 2/2] i386: double fault adjustment Jan Beulich
2005-11-08 16:54 ` [PATCH] i386: NMI <-> debugging handler adjustments Jan Beulich
2005-11-08 16:55 ` [PATCH] i386: handle NMI case in IPI sending Jan Beulich
2005-11-08 16:55 ` [PATCH] i386: stand-alone CONFIG_PAE Jan Beulich
2005-11-08 17:02 ` Adrian Bunk
2005-11-08 17:10 ` Jan Beulich
2005-11-08 16:57 ` [PATCH] i386: adjust page fault handling Jan Beulich
2005-11-08 21:22 ` [PATCH] i386: export genapic again Randy.Dunlap
2005-11-09 8:18 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.