Split time.c series: part 1
Ingo, please pull the latest master branch git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/glommer/linux-2.6-x86-integration.git ingo-time
into your tree
It contains the part of time.c integration that is considered mostly safe, and does not touch (but one reorganization patch) the interrupt code. It should go smootly, but it's (should be) bisection friendly in case it doesn't.
Sorry for the delay.
Thanks!
Glauber
------------------>
Glauber Costa (13):
x86: use user_mode macro
x86: coalesce tests
x86: set bp field in pt_regs properly
x86: use frame pointer information on x86_64 profile_pc
x86: remove SEGMENT_IS_FLAT_CODE
x86: use user_mode_vm instead of user_mode
x86: bind irq0 irq data to cpu0
x86: factor out irq initialization for x86_64
x86: make init_ISA_irqs nonstatic
x86: rename timer_event_interrupt to timer_interrupt
x86: replace hardcoded number
x86: wrap MCA_bus test around an ifdef
x86: move vgetcpu mode probing to cpu detection
arch/x86/kernel/cpu/common.c | 12 +++++++++++ arch/x86/kernel/entry_64.S | 7 ++++++ arch/x86/kernel/irqinit_64.c | 45 +++++++++++++++++++++++++++-------------- arch/x86/kernel/time_32.c | 7 +++-- arch/x86/kernel/time_64.c | 23 ++++++++++++++------ include/asm-x86/segment.h | 6 ----- 6 files changed, 68 insertions(+), 32 deletions(-)
arch/x86/kernel/cpu/common.c +12 -0
@@ -719,12 +719,24 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)#endif } +#ifdef CONFIG_X86_64 +static void vgetcpu_set_mode (void ) +{ +if (cpu_has (&boot_cpu_data,X86_FEATURE_RDTSCP )) + vgetcpu_mode =VGETCPU_RDTSCP ; +else + vgetcpu_mode =VGETCPU_LSL ; +} +#endif +void __init identify_boot_cpu (void ) {identify_cpu (&boot_cpu_data);#ifdef CONFIG_X86_32 sysenter_setup ();enable_sep_cpu (); +#else +vgetcpu_set_mode ();#endif }
arch/x86/kernel/entry_64.S +7 -0
@@ -643,6 +643,13 @@ END(stub_rt_sigreturn) SAVE_ARGS leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler pushq %rbp + /* + * Save rbp twice: One is for marking the stack frame, as usual, and the + * other, to fill pt_regs properly. This is because bx comes right + * before the last saved register in that structure, and not bp. If the + * base pointer were in the place bx is today, this would not be needed. + */ + movq %rbp, -8(%rsp) CFI_ADJUST_CFA_OFFSET 8 CFI_REL_OFFSET rbp, 0 movq %rsp,%rbp
arch/x86/kernel/irqinit_64.c +29 -16
70 lines not on this page · raw message
arch/x86/kernel/time_32.c +4 -3
@@ -47,10 +47,9 @@ unsigned long profile_pc(struct pt_regs *regs)unsigned long pc =instruction_pointer (regs);#ifdef CONFIG_SMP -if (!v8086_mode (regs) &&SEGMENT_IS_KERNEL_CODE (regs->cs) && -in_lock_functions (pc)) { +if (!user_mode_vm (regs) &&in_lock_functions (pc)) {#ifdef CONFIG_FRAME_POINTER -return *(unsigned long *)(regs->bp +4 ); +return *(unsigned long *)(regs->bp +sizeof (long ));#else unsigned long *sp = (unsigned long *)®s->sp;
@@ -95,6 +94,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)do_timer_interrupt_hook (); +#ifdef CONFIG_MCA if (MCA_bus) {/* The PS/2 uses level-triggered interrupts. You can't turn them off, nor would you want to (any attempt to
@@ -108,6 +108,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)u8 irq_v =inb_p (0x61 );/* read the current state */ outb_p( irq_v|0x80, 0x61 ); /* reset the IRQ */ } +#endif return IRQ_HANDLED ; }
arch/x86/kernel/time_64.c +16 -7
@@ -16,6 +16,7 @@#include <linux/interrupt.h> #include <linux/module.h> #include <linux/time.h> +#include <linux/mca.h> #include <asm/i8253.h> #include <asm/hpet.h>
@@ -33,23 +34,34 @@ unsigned long profile_pc(struct pt_regs *regs)/* Assume the lock function has either no stack frame or a copy of flags from PUSHF Eflags always has bits 22 and up cleared unlike kernel addresses. */ -if (!user_mode (regs) &&in_lock_functions (pc)) { +if (!user_mode_vm (regs) &&in_lock_functions (pc)) { +#ifdef CONFIG_FRAME_POINTER +return *(unsigned long *)(regs->bp +sizeof (long )); +#else unsigned long *sp = (unsigned long *)regs->sp;if (sp[0 ] >>22 )return sp[0 ];if (sp[1 ] >>22 )return sp[1 ]; +#endif }return pc; }EXPORT_SYMBOL (profile_pc); -static irqreturn_t timer_event_interrupt (int irq,void *dev_id) +irqreturn_t timer_interrupt (int irq,void *dev_id) {add_pda (irq0_irqs,1 ); global_clock_event->event_handler (global_clock_event); +#ifdef CONFIG_MCA +if (MCA_bus) { +u8 irq_v =inb_p (0x61 );/* read the current state */ +outb_p (irq_v|0x80 ,0x61 );/* reset the IRQ */ + } +#endif +return IRQ_HANDLED ; }
@@ -100,7 +112,7 @@ unsigned long __init calibrate_cpu(void) }static struct irqaction irq0 = { - .handler = timer_event_interrupt, + .handler = timer_interrupt, .flags =IRQF_DISABLED |IRQF_IRQPOLL |IRQF_NOBALANCING , .mask =CPU_MASK_NONE , .name ="hpet"
@@ -113,16 +125,13 @@ void __init hpet_time_init(void)setup_pit_timer (); } + irq0.mask =cpumask_of_cpu (0 );setup_irq (0 , &irq0); }void __init time_init (void ) {tsc_init (); -if (cpu_has (&boot_cpu_data,X86_FEATURE_RDTSCP )) - vgetcpu_mode =VGETCPU_RDTSCP ; -else - vgetcpu_mode =VGETCPU_LSL ; late_time_init =choose_time_init (); }
include/asm-x86/segment.h +0 -6
@@ -131,12 +131,6 @@* Matching rules for certain types of segments. */ -/* Matches only __KERNEL_CS, ignoring PnP / USER / APM segments */ -#define SEGMENT_IS_KERNEL_CODE (x) (((x) & 0xfc) == GDT_ENTRY_KERNEL_CS * 8) - -/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */ -#define SEGMENT_IS_FLAT_CODE (x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8) -/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */ #define SEGMENT_IS_PNP_CODE (x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
Quoted 5 lines · Glauber Costa
Ingo, please pull the latest master branch git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/glommer/linux-2.6-x86-integration.gitingo-timeinto your tree
hm, there's no ingo-time branch there. Forgot to push out? But the 'master' branch seems to match up with your diffstat, so i pulled that one instead.
Quoted 4 lines
It contains the part of
time.cintegration that is considered mostly safe, and does not touch (but one reorganization patch) the interrupt code. It should go smootly, but it's (should be) bisection friendly in case it doesn't.
i've restructured the dependencies a bit: i've put your changes into tip/x86/time and based them on tip/x86/core (not tip/master). It integrates cleanly into tip/master and i've started testing them.
Thanks,
Ingo
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Glauber Costa
Ingo, please pull the latest master branch git tree from:
Quoted 7 lines
Quoted 3 lines
git://git.kernel.org/pub/scm/linux/kernel/git/glommer/linux-2.6-x86-integration.gitingo-timeinto your tree
hm, there's no ingo-time branch there. Forgot to push out? But the 'master' branch seems to match up with your diffstat, so i pulled that one instead.
yeah, sure. My mistake.
Quoted 9 lines
Quoted 5 lines
It contains the part of
time.cintegration that is considered mostly safe, and does not touch (but one reorganization patch) the interrupt code. It should go smootly, but it's (should be) bisection friendly in case it doesn't.i've restructured the dependencies a bit: i've put your changes into tip/x86/time and based them on tip/x86/core (not tip/master). It integrates cleanly into tip/master and i've started testing them.
cool. Let me know how it goes.
Quoted 4 lines
Thanks,
Ingo