Skip to content

Commit 152bbb4

Browse files
committed
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 set of small fixes: - make KGDB work again which got broken by the conversion of WARN() to #UD. The WARN fixup needs to run before the notifier callchain, otherwise KGDB tries to handle it and crashes. - disable KASAN in the ORC unwinder to prevent false positive KASAN warnings - prevent default mapping above 47bit when 5 level page tables are enabled - make the delay calibration optimization work correctly, which had the conditionals the wrong way around and was operating on data which was not yet updated. - remove the bogus X86_TRAP_BP trap init from the default IDT init table, which broke 32bit int3 handling by overwriting the correct int3 setup. - replace this_cpu* with boot_cpu_data access in the preemptible oprofile init code" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/debug: Handle warnings before the notifier chain, to fix KGDB crash x86/mm: Fix ELF_ET_DYN_BASE for 5-level paging x86/idt: Remove X86_TRAP_BP initialization in idt_setup_traps() x86/oprofile/ppro: Do not use __this_cpu*() in preemptible context x86/unwind: Disable KASAN checking in the ORC unwinder x86/smpboot: Make optimization of delay calibration work correctly
2 parents 69581c7 + b8347c2 commit 152bbb4

File tree

7 files changed

+20
-19
lines changed

7 files changed

+20
-19
lines changed

arch/x86/include/asm/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ extern int force_personality32;
253253
* space open for things that want to use the area for 32-bit pointers.
254254
*/
255255
#define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \
256-
(TASK_SIZE / 3 * 2))
256+
(DEFAULT_MAP_WINDOW / 3 * 2))
257257

258258
/* This yields a mask that user programs can use to figure out what
259259
instruction set this CPU supports. This could be done in user space,

arch/x86/kernel/idt.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ static const __initdata struct idt_data def_idts[] = {
9292
INTG(X86_TRAP_DF, double_fault),
9393
#endif
9494
INTG(X86_TRAP_DB, debug),
95-
INTG(X86_TRAP_NMI, nmi),
96-
INTG(X86_TRAP_BP, int3),
9795

9896
#ifdef CONFIG_X86_MCE
9997
INTG(X86_TRAP_MC, &machine_check),

arch/x86/kernel/smpboot.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ static void smp_callin(void)
193193
*/
194194
smp_store_cpu_info(cpuid);
195195

196+
/*
197+
* The topology information must be up to date before
198+
* calibrate_delay() and notify_cpu_starting().
199+
*/
200+
set_cpu_sibling_map(raw_smp_processor_id());
201+
196202
/*
197203
* Get our bogomips.
198204
* Update loops_per_jiffy in cpu_data. Previous call to
@@ -203,11 +209,6 @@ static void smp_callin(void)
203209
cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy;
204210
pr_debug("Stack at about %p\n", &cpuid);
205211

206-
/*
207-
* This must be done before setting cpu_online_mask
208-
* or calling notify_cpu_starting.
209-
*/
210-
set_cpu_sibling_map(raw_smp_processor_id());
211212
wmb();
212213

213214
notify_cpu_starting(cpuid);

arch/x86/kernel/traps.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,6 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
209209
if (fixup_exception(regs, trapnr))
210210
return 0;
211211

212-
if (fixup_bug(regs, trapnr))
213-
return 0;
214-
215212
tsk->thread.error_code = error_code;
216213
tsk->thread.trap_nr = trapnr;
217214
die(str, regs, error_code);
@@ -292,6 +289,13 @@ static void do_error_trap(struct pt_regs *regs, long error_code, char *str,
292289

293290
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
294291

292+
/*
293+
* WARN*()s end up here; fix them up before we call the
294+
* notifier chain.
295+
*/
296+
if (!user_mode(regs) && fixup_bug(regs, trapnr))
297+
return;
298+
295299
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) !=
296300
NOTIFY_STOP) {
297301
cond_local_irq_enable(regs);

arch/x86/kernel/tsc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,12 +1346,10 @@ void __init tsc_init(void)
13461346
unsigned long calibrate_delay_is_known(void)
13471347
{
13481348
int sibling, cpu = smp_processor_id();
1349-
struct cpumask *mask = topology_core_cpumask(cpu);
1349+
int constant_tsc = cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC);
1350+
const struct cpumask *mask = topology_core_cpumask(cpu);
13501351

1351-
if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC))
1352-
return 0;
1353-
1354-
if (!mask)
1352+
if (tsc_disabled || !constant_tsc || !mask)
13551353
return 0;
13561354

13571355
sibling = cpumask_any_but(mask, cpu);

arch/x86/kernel/unwind_orc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static bool deref_stack_reg(struct unwind_state *state, unsigned long addr,
279279
if (!stack_access_ok(state, addr, sizeof(long)))
280280
return false;
281281

282-
*val = READ_ONCE_TASK_STACK(state->task, *(unsigned long *)addr);
282+
*val = READ_ONCE_NOCHECK(*(unsigned long *)addr);
283283
return true;
284284
}
285285

arch/x86/oprofile/op_model_ppro.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ static void arch_perfmon_setup_counters(void)
212212
eax.full = cpuid_eax(0xa);
213213

214214
/* Workaround for BIOS bugs in 6/15. Taken from perfmon2 */
215-
if (eax.split.version_id == 0 && __this_cpu_read(cpu_info.x86) == 6 &&
216-
__this_cpu_read(cpu_info.x86_model) == 15) {
215+
if (eax.split.version_id == 0 && boot_cpu_data.x86 == 6 &&
216+
boot_cpu_data.x86_model == 15) {
217217
eax.split.version_id = 2;
218218
eax.split.num_counters = 2;
219219
eax.split.bit_width = 40;

0 commit comments

Comments
 (0)