linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [GIT pull] x86/urgent for v5.4-rc7
Date: Sun, 10 Nov 2019 10:21:53 -0000	[thread overview]
Message-ID: <157338131324.14789.8363441947094006311.tglx@nanos.tec.linutronix.de> (raw)
In-Reply-To: 157338131323.14789.2179255265964358886.tglx@nanos.tec.linutronix.de

Linus,

please pull the latest x86-urgent-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

up to:  63ec58b44fcc: x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early

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.

Thanks,

	tglx

------------------>
Jan Beulich (1):
      x86/apic/32: Avoid bogus LDR warnings

Michael Zhivich (1):
      x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early

Thomas Gleixner (1):
      x86/dumpstack/64: Don't evaluate exception stacks before setup

Xiaochen Shen (1):
      x86/resctrl: Prevent NULL pointer dereference when reading mondata


 arch/x86/kernel/apic/apic.c               | 28 +++++++++++++++-------------
 arch/x86/kernel/cpu/resctrl/ctrlmondata.c |  4 ++++
 arch/x86/kernel/dumpstack_64.c            |  7 +++++++
 arch/x86/kernel/tsc.c                     |  3 +++
 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)
 {
 	int cpu = smp_processor_id();
 	unsigned int value;
-#ifdef CONFIG_X86_32
-	int logical_apicid, ldr_apicid;
-#endif
 
 	if (disable_apic) {
 		disable_ioapic_support();
@@ -1626,16 +1623,21 @@ static void setup_local_APIC(void)
 	apic->init_apic_ldr();
 
 #ifdef CONFIG_X86_32
-	/*
-	 * APIC LDR is initialized.  If logical_apicid mapping was
-	 * initialized during get_smp_config(), make sure it matches the
-	 * actual value.
-	 */
-	logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
-	ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
-	WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
-	/* always use the value from LDR */
-	early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	if (apic->dest_logical) {
+		int logical_apicid, ldr_apicid;
+
+		/*
+		 * APIC LDR is initialized.  If logical_apicid mapping was
+		 * initialized during get_smp_config(), make sure it matches
+		 * the actual value.
+		 */
+		logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
+		ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
+		if (logical_apicid != BAD_APICID)
+			WARN_ON(logical_apicid != ldr_apicid);
+		/* Always use the value from LDR. */
+		early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
+	}
 #endif
 
 	/*
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)
 	int ret = 0;
 
 	rdtgrp = rdtgroup_kn_lock_live(of->kn);
+	if (!rdtgrp) {
+		ret = -ENOENT;
+		goto out;
+	}
 
 	md.priv = of->kn->priv;
 	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)
 	BUILD_BUG_ON(N_EXCEPTION_STACKS != 6);
 
 	begin = (unsigned long)__this_cpu_read(cea_exception_stacks);
+	/*
+	 * Handle the case where stack trace is collected _before_
+	 * cea_exception_stacks had been initialized.
+	 */
+	if (!begin)
+		return false;
+
 	end = begin + sizeof(struct cea_exception_stacks);
 	/* Bail if @stack is outside the exception stack area. */
 	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)
 		return;
 	}
 
+	if (tsc_clocksource_reliable || no_tsc_watchdog)
+		clocksource_tsc_early.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
+
 	clocksource_register_khz(&clocksource_tsc_early, tsc_khz);
 	detect_art();
 }



  parent reply	other threads:[~2019-11-10 10:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-10 10:21 [GIT pull] core/urgent for v5.4-rc7 Thomas Gleixner
2019-11-10 10:21 ` [GIT pull] timers/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] perf/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] sched/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 10:21 ` Thomas Gleixner [this message]
2019-11-10 21:00   ` [GIT pull] x86/urgent " pr-tracker-bot
2019-11-10 10:21 ` [GIT pull] irq/urgent " Thomas Gleixner
2019-11-10 21:00   ` pr-tracker-bot
2019-11-10 21:00 ` [GIT pull] core/urgent " pr-tracker-bot
2019-11-10 22:00 ` Joe Perches
2019-11-10 22:35   ` Linus Torvalds
2019-11-11  1:50     ` Joe Perches
2019-11-11 17:12       ` Linus Torvalds
2019-11-12  1:37         ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=157338131324.14789.8363441947094006311.tglx@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).