aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-11-10 15:07:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2019-11-10 15:07:47 -0500
commit9805a68371ce01eee3d8491ee2d93f1aa4a4da52 (patch)
treee0c5e8c90e843cbdd0fa01495d7f3a2647f3f52c /arch/x86
parent621084cd3d8cb31aa43a3e4cc37e27e3ddaab561 (diff)
parent63ec58b44fcc05efd1542045abd7faf056ac27d9 (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "A small set of fixes for x86: - Make the tsc=reliable/nowatchdog command line parameter work again. It was broken with the introduction of the early TSC clocksource. - Prevent the evaluation of exception stacks before they are set up. This causes a crash in dumpstack because the stack walk termination gets screwed up. - Prevent a NULL pointer dereference in the rescource control file system. - Avoid bogus warnings about APIC id mismatch related to the LDR which can happen when the LDR is not in use and therefore not initialized. Only evaluate that when the APIC is in logical destination mode" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early x86/dumpstack/64: Don't evaluate exception stacks before setup x86/apic/32: Avoid bogus LDR warnings x86/resctrl: Prevent NULL pointer dereference when reading mondata
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/apic/apic.c28
-rw-r--r--arch/x86/kernel/cpu/resctrl/ctrlmondata.c4
-rw-r--r--arch/x86/kernel/dumpstack_64.c7
-rw-r--r--arch/x86/kernel/tsc.c3
4 files changed, 29 insertions, 13 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 9e2dd2b296cd..2b0faf86da1b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1586,9 +1586,6 @@ static void setup_local_APIC(void)
1586{ 1586{
1587 int cpu = smp_processor_id(); 1587 int cpu = smp_processor_id();
1588 unsigned int value; 1588 unsigned int value;
1589#ifdef CONFIG_X86_32
1590 int logical_apicid, ldr_apicid;
1591#endif
1592 1589
1593 if (disable_apic) { 1590 if (disable_apic) {
1594 disable_ioapic_support(); 1591 disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void)
1626 apic->init_apic_ldr(); 1623 apic->init_apic_ldr();
1627 1624
1628#ifdef CONFIG_X86_32 1625#ifdef CONFIG_X86_32
1629 /* 1626 if (apic->dest_logical) {
1630 * APIC LDR is initialized. If logical_apicid mapping was 1627 int logical_apicid, ldr_apicid;
1631 * initialized during get_smp_config(), make sure it matches the 1628
1632 * actual value. 1629 /*
1633 */ 1630 * APIC LDR is initialized. If logical_apicid mapping was
1634 logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu); 1631 * initialized during get_smp_config(), make sure it matches
1635 ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR)); 1632 * the actual value.
1636 WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid); 1633 */
1637 /* always use the value from LDR */ 1634 logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
1638 early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid; 1635 ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
1636 if (logical_apicid != BAD_APICID)
1637 WARN_ON(logical_apicid != ldr_apicid);
1638 /* Always use the value from LDR. */
1639 early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
1640 }
1639#endif 1641#endif
1640 1642
1641 /* 1643 /*
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index efbd54cc4e69..055c8613b531 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -522,6 +522,10 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
522 int ret = 0; 522 int ret = 0;
523 523
524 rdtgrp = rdtgroup_kn_lock_live(of->kn); 524 rdtgrp = rdtgroup_kn_lock_live(of->kn);
525 if (!rdtgrp) {
526 ret = -ENOENT;
527 goto out;
528 }
525 529
526 md.priv = of->kn->priv; 530 md.priv = of->kn->priv;
527 resid = md.u.rid; 531 resid = md.u.rid;
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 753b8cfe8b8a..87b97897a881 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -94,6 +94,13 @@ static bool in_exception_stack(unsigned long *stack, struct stack_info *info)
94 BUILD_BUG_ON(N_EXCEPTION_STACKS != 6); 94 BUILD_BUG_ON(N_EXCEPTION_STACKS != 6);
95 95
96 begin = (unsigned long)__this_cpu_read(cea_exception_stacks); 96 begin = (unsigned long)__this_cpu_read(cea_exception_stacks);
97 /*
98 * Handle the case where stack trace is collected _before_
99 * cea_exception_stacks had been initialized.
100 */
101 if (!begin)
102 return false;
103
97 end = begin + sizeof(struct cea_exception_stacks); 104 end = begin + sizeof(struct cea_exception_stacks);
98 /* Bail if @stack is outside the exception stack area. */ 105 /* Bail if @stack is outside the exception stack area. */
99 if (stk < begin || stk >= end) 106 if (stk < begin || stk >= end)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index c59454c382fd..7e322e2daaf5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1505,6 +1505,9 @@ void __init tsc_init(void)
1505 return; 1505 return;
1506 } 1506 }
1507 1507
1508 if (tsc_clocksource_reliable || no_tsc_watchdog)
1509 clocksource_tsc_early.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
1510
1508 clocksource_register_khz(&clocksource_tsc_early, tsc_khz); 1511 clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
1509 detect_art(); 1512 detect_art();
1510} 1513}