aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-18 12:42:44 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-18 12:42:44 -0500
commit3e3b3916a9c5c28a16528585478de19fea59816b (patch)
treef7da78c1044840e62008ac7b5512b40713c342bc
parent51dad801e271f3754a728e5b9a2ef974576490cc (diff)
parent4aae07025265151e3f7041dfbf0f529e122de1d8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86
* git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86: x86: fix "Kernel panic - not syncing: IO-APIC + timer doesn't work!" genirq: revert lazy irq disable for simple irqs x86: also define AT_VECTOR_SIZE_ARCH x86: kprobes bugfix x86: jprobe bugfix timer: kernel/timer.c section fixes genirq: add unlocked version of set_irq_handler() clockevents: fix reprogramming decision in oneshot broadcast oprofile: op_model_athlon.c support for AMD family 10h barcelona performance counters
-rw-r--r--arch/x86/kernel/io_apic_32.c16
-rw-r--r--arch/x86/kernel/io_apic_64.c16
-rw-r--r--arch/x86/kernel/kprobes_32.c4
-rw-r--r--arch/x86/kernel/kprobes_64.c47
-rw-r--r--arch/x86/oprofile/op_model_athlon.c22
-rw-r--r--include/asm-x86/kprobes_32.h2
-rw-r--r--include/asm-x86/kprobes_64.h2
-rw-r--r--include/asm-x86/system_64.h7
-rw-r--r--include/linux/irq.h7
-rw-r--r--kernel/irq/chip.c9
-rw-r--r--kernel/time/tick-broadcast.c56
-rw-r--r--kernel/timer.c4
12 files changed, 102 insertions, 90 deletions
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 6cf27319a91c..c3a565bba106 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -1882,13 +1882,16 @@ __setup("no_timer_check", notimercheck);
1882static int __init timer_irq_works(void) 1882static int __init timer_irq_works(void)
1883{ 1883{
1884 unsigned long t1 = jiffies; 1884 unsigned long t1 = jiffies;
1885 unsigned long flags;
1885 1886
1886 if (no_timer_check) 1887 if (no_timer_check)
1887 return 1; 1888 return 1;
1888 1889
1890 local_save_flags(flags);
1889 local_irq_enable(); 1891 local_irq_enable();
1890 /* Let ten ticks pass... */ 1892 /* Let ten ticks pass... */
1891 mdelay((10 * 1000) / HZ); 1893 mdelay((10 * 1000) / HZ);
1894 local_irq_restore(flags);
1892 1895
1893 /* 1896 /*
1894 * Expect a few ticks at least, to be sure some possible 1897 * Expect a few ticks at least, to be sure some possible
@@ -2167,6 +2170,9 @@ static inline void __init check_timer(void)
2167 int apic1, pin1, apic2, pin2; 2170 int apic1, pin1, apic2, pin2;
2168 int vector; 2171 int vector;
2169 unsigned int ver; 2172 unsigned int ver;
2173 unsigned long flags;
2174
2175 local_irq_save(flags);
2170 2176
2171 ver = apic_read(APIC_LVR); 2177 ver = apic_read(APIC_LVR);
2172 ver = GET_APIC_VERSION(ver); 2178 ver = GET_APIC_VERSION(ver);
@@ -2219,7 +2225,7 @@ static inline void __init check_timer(void)
2219 } 2225 }
2220 if (disable_timer_pin_1 > 0) 2226 if (disable_timer_pin_1 > 0)
2221 clear_IO_APIC_pin(0, pin1); 2227 clear_IO_APIC_pin(0, pin1);
2222 return; 2228 goto out;
2223 } 2229 }
2224 clear_IO_APIC_pin(apic1, pin1); 2230 clear_IO_APIC_pin(apic1, pin1);
2225 printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to " 2231 printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
@@ -2242,7 +2248,7 @@ static inline void __init check_timer(void)
2242 if (nmi_watchdog == NMI_IO_APIC) { 2248 if (nmi_watchdog == NMI_IO_APIC) {
2243 setup_nmi(); 2249 setup_nmi();
2244 } 2250 }
2245 return; 2251 goto out;
2246 } 2252 }
2247 /* 2253 /*
2248 * Cleanup, just in case ... 2254 * Cleanup, just in case ...
@@ -2266,7 +2272,7 @@ static inline void __init check_timer(void)
2266 2272
2267 if (timer_irq_works()) { 2273 if (timer_irq_works()) {
2268 printk(" works.\n"); 2274 printk(" works.\n");
2269 return; 2275 goto out;
2270 } 2276 }
2271 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); 2277 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
2272 printk(" failed.\n"); 2278 printk(" failed.\n");
@@ -2282,11 +2288,13 @@ static inline void __init check_timer(void)
2282 2288
2283 if (timer_irq_works()) { 2289 if (timer_irq_works()) {
2284 printk(" works.\n"); 2290 printk(" works.\n");
2285 return; 2291 goto out;
2286 } 2292 }
2287 printk(" failed :(.\n"); 2293 printk(" failed :(.\n");
2288 panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a " 2294 panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a "
2289 "report. Then try booting with the 'noapic' option"); 2295 "report. Then try booting with the 'noapic' option");
2296out:
2297 local_irq_restore(flags);
2290} 2298}
2291 2299
2292/* 2300/*
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 435a8c9b55f8..cbac1670c7c3 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1281,10 +1281,13 @@ void disable_IO_APIC(void)
1281static int __init timer_irq_works(void) 1281static int __init timer_irq_works(void)
1282{ 1282{
1283 unsigned long t1 = jiffies; 1283 unsigned long t1 = jiffies;
1284 unsigned long flags;
1284 1285
1286 local_save_flags(flags);
1285 local_irq_enable(); 1287 local_irq_enable();
1286 /* Let ten ticks pass... */ 1288 /* Let ten ticks pass... */
1287 mdelay((10 * 1000) / HZ); 1289 mdelay((10 * 1000) / HZ);
1290 local_irq_restore(flags);
1288 1291
1289 /* 1292 /*
1290 * Expect a few ticks at least, to be sure some possible 1293 * Expect a few ticks at least, to be sure some possible
@@ -1655,6 +1658,9 @@ static inline void check_timer(void)
1655{ 1658{
1656 struct irq_cfg *cfg = irq_cfg + 0; 1659 struct irq_cfg *cfg = irq_cfg + 0;
1657 int apic1, pin1, apic2, pin2; 1660 int apic1, pin1, apic2, pin2;
1661 unsigned long flags;
1662
1663 local_irq_save(flags);
1658 1664
1659 /* 1665 /*
1660 * get/set the timer IRQ vector: 1666 * get/set the timer IRQ vector:
@@ -1696,7 +1702,7 @@ static inline void check_timer(void)
1696 } 1702 }
1697 if (disable_timer_pin_1 > 0) 1703 if (disable_timer_pin_1 > 0)
1698 clear_IO_APIC_pin(0, pin1); 1704 clear_IO_APIC_pin(0, pin1);
1699 return; 1705 goto out;
1700 } 1706 }
1701 clear_IO_APIC_pin(apic1, pin1); 1707 clear_IO_APIC_pin(apic1, pin1);
1702 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " 1708 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not "
@@ -1718,7 +1724,7 @@ static inline void check_timer(void)
1718 if (nmi_watchdog == NMI_IO_APIC) { 1724 if (nmi_watchdog == NMI_IO_APIC) {
1719 setup_nmi(); 1725 setup_nmi();
1720 } 1726 }
1721 return; 1727 goto out;
1722 } 1728 }
1723 /* 1729 /*
1724 * Cleanup, just in case ... 1730 * Cleanup, just in case ...
@@ -1741,7 +1747,7 @@ static inline void check_timer(void)
1741 1747
1742 if (timer_irq_works()) { 1748 if (timer_irq_works()) {
1743 apic_printk(APIC_VERBOSE," works.\n"); 1749 apic_printk(APIC_VERBOSE," works.\n");
1744 return; 1750 goto out;
1745 } 1751 }
1746 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); 1752 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
1747 apic_printk(APIC_VERBOSE," failed.\n"); 1753 apic_printk(APIC_VERBOSE," failed.\n");
@@ -1756,10 +1762,12 @@ static inline void check_timer(void)
1756 1762
1757 if (timer_irq_works()) { 1763 if (timer_irq_works()) {
1758 apic_printk(APIC_VERBOSE," works.\n"); 1764 apic_printk(APIC_VERBOSE," works.\n");
1759 return; 1765 goto out;
1760 } 1766 }
1761 apic_printk(APIC_VERBOSE," failed :(.\n"); 1767 apic_printk(APIC_VERBOSE," failed :(.\n");
1762 panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); 1768 panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
1769out:
1770 local_irq_restore(flags);
1763} 1771}
1764 1772
1765static int __init notimercheck(char *s) 1773static int __init notimercheck(char *s)
diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index d87a523070d1..3a020f79f82b 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -727,9 +727,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
727 727
728 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { 728 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
729 if (&regs->esp != kcb->jprobe_saved_esp) { 729 if (&regs->esp != kcb->jprobe_saved_esp) {
730 struct pt_regs *saved_regs = 730 struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
731 container_of(kcb->jprobe_saved_esp,
732 struct pt_regs, esp);
733 printk("current esp %p does not match saved esp %p\n", 731 printk("current esp %p does not match saved esp %p\n",
734 &regs->esp, kcb->jprobe_saved_esp); 732 &regs->esp, kcb->jprobe_saved_esp);
735 printk("Saved registers for jprobe %p\n", jp); 733 printk("Saved registers for jprobe %p\n", jp);
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index 0c467644589c..5df19a9f9239 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -485,7 +485,6 @@ static void __kprobes resume_execution(struct kprobe *p,
485 struct pt_regs *regs, struct kprobe_ctlblk *kcb) 485 struct pt_regs *regs, struct kprobe_ctlblk *kcb)
486{ 486{
487 unsigned long *tos = (unsigned long *)regs->rsp; 487 unsigned long *tos = (unsigned long *)regs->rsp;
488 unsigned long next_rip = 0;
489 unsigned long copy_rip = (unsigned long)p->ainsn.insn; 488 unsigned long copy_rip = (unsigned long)p->ainsn.insn;
490 unsigned long orig_rip = (unsigned long)p->addr; 489 unsigned long orig_rip = (unsigned long)p->addr;
491 kprobe_opcode_t *insn = p->ainsn.insn; 490 kprobe_opcode_t *insn = p->ainsn.insn;
@@ -494,46 +493,42 @@ static void __kprobes resume_execution(struct kprobe *p,
494 if (*insn >= 0x40 && *insn <= 0x4f) 493 if (*insn >= 0x40 && *insn <= 0x4f)
495 insn++; 494 insn++;
496 495
496 regs->eflags &= ~TF_MASK;
497 switch (*insn) { 497 switch (*insn) {
498 case 0x9c: /* pushfl */ 498 case 0x9c: /* pushfl */
499 *tos &= ~(TF_MASK | IF_MASK); 499 *tos &= ~(TF_MASK | IF_MASK);
500 *tos |= kcb->kprobe_old_rflags; 500 *tos |= kcb->kprobe_old_rflags;
501 break; 501 break;
502 case 0xc3: /* ret/lret */ 502 case 0xc2: /* iret/ret/lret */
503 case 0xcb: 503 case 0xc3:
504 case 0xc2:
505 case 0xca: 504 case 0xca:
506 regs->eflags &= ~TF_MASK; 505 case 0xcb:
507 /* rip is already adjusted, no more changes required*/ 506 case 0xcf:
508 return; 507 case 0xea: /* jmp absolute -- ip is correct */
509 case 0xe8: /* call relative - Fix return addr */ 508 /* ip is already adjusted, no more changes required */
509 goto no_change;
510 case 0xe8: /* call relative - Fix return addr */
510 *tos = orig_rip + (*tos - copy_rip); 511 *tos = orig_rip + (*tos - copy_rip);
511 break; 512 break;
512 case 0xff: 513 case 0xff:
513 if ((insn[1] & 0x30) == 0x10) { 514 if ((insn[1] & 0x30) == 0x10) {
514 /* call absolute, indirect */ 515 /* call absolute, indirect */
515 /* Fix return addr; rip is correct. */ 516 /* Fix return addr; ip is correct. */
516 next_rip = regs->rip;
517 *tos = orig_rip + (*tos - copy_rip); 517 *tos = orig_rip + (*tos - copy_rip);
518 goto no_change;
518 } else if (((insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ 519 } else if (((insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */
519 ((insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ 520 ((insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */
520 /* rip is correct. */ 521 /* ip is correct. */
521 next_rip = regs->rip; 522 goto no_change;
522 } 523 }
523 break;
524 case 0xea: /* jmp absolute -- rip is correct */
525 next_rip = regs->rip;
526 break;
527 default: 524 default:
528 break; 525 break;
529 } 526 }
530 527
531 regs->eflags &= ~TF_MASK; 528 regs->rip = orig_rip + (regs->rip - copy_rip);
532 if (next_rip) { 529no_change:
533 regs->rip = next_rip; 530
534 } else { 531 return;
535 regs->rip = orig_rip + (regs->rip - copy_rip);
536 }
537} 532}
538 533
539int __kprobes post_kprobe_handler(struct pt_regs *regs) 534int __kprobes post_kprobe_handler(struct pt_regs *regs)
@@ -716,10 +711,8 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
716 struct jprobe *jp = container_of(p, struct jprobe, kp); 711 struct jprobe *jp = container_of(p, struct jprobe, kp);
717 712
718 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { 713 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
719 if ((long *)regs->rsp != kcb->jprobe_saved_rsp) { 714 if ((unsigned long *)regs->rsp != kcb->jprobe_saved_rsp) {
720 struct pt_regs *saved_regs = 715 struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
721 container_of(kcb->jprobe_saved_rsp,
722 struct pt_regs, rsp);
723 printk("current rsp %p does not match saved rsp %p\n", 716 printk("current rsp %p does not match saved rsp %p\n",
724 (long *)regs->rsp, kcb->jprobe_saved_rsp); 717 (long *)regs->rsp, kcb->jprobe_saved_rsp);
725 printk("Saved registers for jprobe %p\n", jp); 718 printk("Saved registers for jprobe %p\n", jp);
diff --git a/arch/x86/oprofile/op_model_athlon.c b/arch/x86/oprofile/op_model_athlon.c
index 3057a19e4641..c3ee43333f26 100644
--- a/arch/x86/oprofile/op_model_athlon.c
+++ b/arch/x86/oprofile/op_model_athlon.c
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file op_model_athlon.h 2 * @file op_model_athlon.h
3 * athlon / K7 model-specific MSR operations 3 * athlon / K7 / K8 / Family 10h model-specific MSR operations
4 * 4 *
5 * @remark Copyright 2002 OProfile authors 5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING 6 * @remark Read the file COPYING
@@ -31,12 +31,16 @@
31#define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0) 31#define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0)
32#define CTRL_SET_ACTIVE(n) (n |= (1<<22)) 32#define CTRL_SET_ACTIVE(n) (n |= (1<<22))
33#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22)) 33#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
34#define CTRL_CLEAR(x) (x &= (1<<21)) 34#define CTRL_CLEAR_LO(x) (x &= (1<<21))
35#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0)
35#define CTRL_SET_ENABLE(val) (val |= 1<<20) 36#define CTRL_SET_ENABLE(val) (val |= 1<<20)
36#define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16)) 37#define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16))
37#define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17)) 38#define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17))
38#define CTRL_SET_UM(val, m) (val |= (m << 8)) 39#define CTRL_SET_UM(val, m) (val |= (m << 8))
39#define CTRL_SET_EVENT(val, e) (val |= e) 40#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff))
41#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf))
42#define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 1) << 9))
43#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8))
40 44
41static unsigned long reset_value[NUM_COUNTERS]; 45static unsigned long reset_value[NUM_COUNTERS];
42 46
@@ -70,7 +74,8 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
70 if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 74 if (unlikely(!CTRL_IS_RESERVED(msrs,i)))
71 continue; 75 continue;
72 CTRL_READ(low, high, msrs, i); 76 CTRL_READ(low, high, msrs, i);
73 CTRL_CLEAR(low); 77 CTRL_CLEAR_LO(low);
78 CTRL_CLEAR_HI(high);
74 CTRL_WRITE(low, high, msrs, i); 79 CTRL_WRITE(low, high, msrs, i);
75 } 80 }
76 81
@@ -89,12 +94,17 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
89 CTR_WRITE(counter_config[i].count, msrs, i); 94 CTR_WRITE(counter_config[i].count, msrs, i);
90 95
91 CTRL_READ(low, high, msrs, i); 96 CTRL_READ(low, high, msrs, i);
92 CTRL_CLEAR(low); 97 CTRL_CLEAR_LO(low);
98 CTRL_CLEAR_HI(high);
93 CTRL_SET_ENABLE(low); 99 CTRL_SET_ENABLE(low);
94 CTRL_SET_USR(low, counter_config[i].user); 100 CTRL_SET_USR(low, counter_config[i].user);
95 CTRL_SET_KERN(low, counter_config[i].kernel); 101 CTRL_SET_KERN(low, counter_config[i].kernel);
96 CTRL_SET_UM(low, counter_config[i].unit_mask); 102 CTRL_SET_UM(low, counter_config[i].unit_mask);
97 CTRL_SET_EVENT(low, counter_config[i].event); 103 CTRL_SET_EVENT_LOW(low, counter_config[i].event);
104 CTRL_SET_EVENT_HIGH(high, counter_config[i].event);
105 CTRL_SET_HOST_ONLY(high, 0);
106 CTRL_SET_GUEST_ONLY(high, 0);
107
98 CTRL_WRITE(low, high, msrs, i); 108 CTRL_WRITE(low, high, msrs, i);
99 } else { 109 } else {
100 reset_value[i] = 0; 110 reset_value[i] = 0;
diff --git a/include/asm-x86/kprobes_32.h b/include/asm-x86/kprobes_32.h
index b772d5b38685..9fe8f3bddfd5 100644
--- a/include/asm-x86/kprobes_32.h
+++ b/include/asm-x86/kprobes_32.h
@@ -73,7 +73,7 @@ struct kprobe_ctlblk {
73 unsigned long kprobe_status; 73 unsigned long kprobe_status;
74 unsigned long kprobe_old_eflags; 74 unsigned long kprobe_old_eflags;
75 unsigned long kprobe_saved_eflags; 75 unsigned long kprobe_saved_eflags;
76 long *jprobe_saved_esp; 76 unsigned long *jprobe_saved_esp;
77 struct pt_regs jprobe_saved_regs; 77 struct pt_regs jprobe_saved_regs;
78 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; 78 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
79 struct prev_kprobe prev_kprobe; 79 struct prev_kprobe prev_kprobe;
diff --git a/include/asm-x86/kprobes_64.h b/include/asm-x86/kprobes_64.h
index 53f4d8507354..743d76218fc9 100644
--- a/include/asm-x86/kprobes_64.h
+++ b/include/asm-x86/kprobes_64.h
@@ -66,7 +66,7 @@ struct kprobe_ctlblk {
66 unsigned long kprobe_status; 66 unsigned long kprobe_status;
67 unsigned long kprobe_old_rflags; 67 unsigned long kprobe_old_rflags;
68 unsigned long kprobe_saved_rflags; 68 unsigned long kprobe_saved_rflags;
69 long *jprobe_saved_rsp; 69 unsigned long *jprobe_saved_rsp;
70 struct pt_regs jprobe_saved_regs; 70 struct pt_regs jprobe_saved_regs;
71 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; 71 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
72 struct prev_kprobe prev_kprobe; 72 struct prev_kprobe prev_kprobe;
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h
index 4cb23848d460..6e9e4841a2da 100644
--- a/include/asm-x86/system_64.h
+++ b/include/asm-x86/system_64.h
@@ -7,6 +7,13 @@
7 7
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10/* entries in ARCH_DLINFO: */
11#ifdef CONFIG_IA32_EMULATION
12# define AT_VECTOR_SIZE_ARCH 2
13#else
14# define AT_VECTOR_SIZE_ARCH 1
15#endif
16
10#define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t" 17#define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"
11#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" 18#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
12 19
diff --git a/include/linux/irq.h b/include/linux/irq.h
index efc88538b2ba..4669be080617 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -339,6 +339,13 @@ extern void
339__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, 339__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
340 const char *name); 340 const char *name);
341 341
342/* caller has locked the irq_desc and both params are valid */
343static inline void __set_irq_handler_unlocked(int irq,
344 irq_flow_handler_t handler)
345{
346 irq_desc[irq].handle_irq = handler;
347}
348
342/* 349/*
343 * Set a highlevel flow handler for a given IRQ: 350 * Set a highlevel flow handler for a given IRQ:
344 */ 351 */
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 9b5dff6b3f6a..44019ce30a14 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -297,18 +297,13 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
297 297
298 if (unlikely(desc->status & IRQ_INPROGRESS)) 298 if (unlikely(desc->status & IRQ_INPROGRESS))
299 goto out_unlock; 299 goto out_unlock;
300 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
300 kstat_cpu(cpu).irqs[irq]++; 301 kstat_cpu(cpu).irqs[irq]++;
301 302
302 action = desc->action; 303 action = desc->action;
303 if (unlikely(!action || (desc->status & IRQ_DISABLED))) { 304 if (unlikely(!action || (desc->status & IRQ_DISABLED)))
304 if (desc->chip->mask)
305 desc->chip->mask(irq);
306 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
307 desc->status |= IRQ_PENDING;
308 goto out_unlock; 305 goto out_unlock;
309 }
310 306
311 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING | IRQ_PENDING);
312 desc->status |= IRQ_INPROGRESS; 307 desc->status |= IRQ_INPROGRESS;
313 spin_unlock(&desc->lock); 308 spin_unlock(&desc->lock);
314 309
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index aa82d7bf478a..5b86698faa0b 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -384,45 +384,19 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
384} 384}
385 385
386/* 386/*
387 * Reprogram the broadcast device:
388 *
389 * Called with tick_broadcast_lock held and interrupts disabled.
390 */
391static int tick_broadcast_reprogram(void)
392{
393 ktime_t expires = { .tv64 = KTIME_MAX };
394 struct tick_device *td;
395 int cpu;
396
397 /*
398 * Find the event which expires next:
399 */
400 for (cpu = first_cpu(tick_broadcast_oneshot_mask); cpu != NR_CPUS;
401 cpu = next_cpu(cpu, tick_broadcast_oneshot_mask)) {
402 td = &per_cpu(tick_cpu_device, cpu);
403 if (td->evtdev->next_event.tv64 < expires.tv64)
404 expires = td->evtdev->next_event;
405 }
406
407 if (expires.tv64 == KTIME_MAX)
408 return 0;
409
410 return tick_broadcast_set_event(expires, 0);
411}
412
413/*
414 * Handle oneshot mode broadcasting 387 * Handle oneshot mode broadcasting
415 */ 388 */
416static void tick_handle_oneshot_broadcast(struct clock_event_device *dev) 389static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
417{ 390{
418 struct tick_device *td; 391 struct tick_device *td;
419 cpumask_t mask; 392 cpumask_t mask;
420 ktime_t now; 393 ktime_t now, next_event;
421 int cpu; 394 int cpu;
422 395
423 spin_lock(&tick_broadcast_lock); 396 spin_lock(&tick_broadcast_lock);
424again: 397again:
425 dev->next_event.tv64 = KTIME_MAX; 398 dev->next_event.tv64 = KTIME_MAX;
399 next_event.tv64 = KTIME_MAX;
426 mask = CPU_MASK_NONE; 400 mask = CPU_MASK_NONE;
427 now = ktime_get(); 401 now = ktime_get();
428 /* Find all expired events */ 402 /* Find all expired events */
@@ -431,19 +405,31 @@ again:
431 td = &per_cpu(tick_cpu_device, cpu); 405 td = &per_cpu(tick_cpu_device, cpu);
432 if (td->evtdev->next_event.tv64 <= now.tv64) 406 if (td->evtdev->next_event.tv64 <= now.tv64)
433 cpu_set(cpu, mask); 407 cpu_set(cpu, mask);
408 else if (td->evtdev->next_event.tv64 < next_event.tv64)
409 next_event.tv64 = td->evtdev->next_event.tv64;
434 } 410 }
435 411
436 /* 412 /*
437 * Wakeup the cpus which have an expired event. The broadcast 413 * Wakeup the cpus which have an expired event.
438 * device is reprogrammed in the return from idle code. 414 */
415 tick_do_broadcast(mask);
416
417 /*
418 * Two reasons for reprogram:
419 *
420 * - The global event did not expire any CPU local
421 * events. This happens in dyntick mode, as the maximum PIT
422 * delta is quite small.
423 *
424 * - There are pending events on sleeping CPUs which were not
425 * in the event mask
439 */ 426 */
440 if (!tick_do_broadcast(mask)) { 427 if (next_event.tv64 != KTIME_MAX) {
441 /* 428 /*
442 * The global event did not expire any CPU local 429 * Rearm the broadcast device. If event expired,
443 * events. This happens in dyntick mode, as the 430 * repeat the above
444 * maximum PIT delta is quite small.
445 */ 431 */
446 if (tick_broadcast_reprogram()) 432 if (tick_broadcast_set_event(next_event, 0))
447 goto again; 433 goto again;
448 } 434 }
449 spin_unlock(&tick_broadcast_lock); 435 spin_unlock(&tick_broadcast_lock);
diff --git a/kernel/timer.c b/kernel/timer.c
index a05817c021d6..d4527dcef1af 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1219,11 +1219,11 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info)
1219 */ 1219 */
1220static struct lock_class_key base_lock_keys[NR_CPUS]; 1220static struct lock_class_key base_lock_keys[NR_CPUS];
1221 1221
1222static int __devinit init_timers_cpu(int cpu) 1222static int __cpuinit init_timers_cpu(int cpu)
1223{ 1223{
1224 int j; 1224 int j;
1225 tvec_base_t *base; 1225 tvec_base_t *base;
1226 static char __devinitdata tvec_base_done[NR_CPUS]; 1226 static char __cpuinitdata tvec_base_done[NR_CPUS];
1227 1227
1228 if (!tvec_base_done[cpu]) { 1228 if (!tvec_base_done[cpu]) {
1229 static char boot_done; 1229 static char boot_done;