Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
"Another pile of small fixes and updates for x86:

- Plug a hole in the SMAP implementation which misses to clear AC on
NMI entry

- Fix the norandmaps/ADDR_NO_RANDOMIZE logic so the command line
parameter works correctly again

- Use the proper accessor in the startup64 code for next_early_pgt to
prevent accessing of invalid addresses and faulting in the early
boot code.

- Prevent CPU hotplug lock recursion in the MTRR code

- Unbreak CPU0 hotplugging

- Rename overly long CPUID bits which got introduced in this cycle

- Two commits which mark data 'const' and restrict the scope of data
and functions to file scope by making them 'static'"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: Constify attribute_group structures
x86/boot/64/clang: Use fixup_pointer() to access 'next_early_pgt'
x86/elf: Remove the unnecessary ADDR_NO_RANDOMIZE checks
x86: Fix norandmaps/ADDR_NO_RANDOMIZE
x86/mtrr: Prevent CPU hotplug lock recursion
x86: Mark various structures and functions as 'static'
x86/cpufeature, kvm/svm: Rename (shorten) the new "virtualized VMSAVE/VMLOAD" CPUID flag
x86/smpboot: Unbreak CPU0 hotplug
x86/asm/64: Clear AC on NMI entries

+85 -68
+2
arch/x86/entry/entry_64.S
··· 1211 1211 * other IST entries. 1212 1212 */ 1213 1213 1214 + ASM_CLAC 1215 + 1214 1216 /* Use %rdx as our temp variable throughout */ 1215 1217 pushq %rdx 1216 1218
+1 -1
arch/x86/events/intel/bts.c
··· 69 69 struct bts_phys buf[0]; 70 70 }; 71 71 72 - struct pmu bts_pmu; 72 + static struct pmu bts_pmu; 73 73 74 74 static size_t buf_size(struct page *page) 75 75 {
+1 -1
arch/x86/events/intel/p4.c
··· 587 587 * P4_CONFIG_ALIASABLE or bits for P4_PEBS_METRIC, they are 588 588 * either up to date automatically or not applicable at all. 589 589 */ 590 - struct p4_event_alias { 590 + static struct p4_event_alias { 591 591 u64 original; 592 592 u64 alternative; 593 593 } p4_event_aliases[] = {
+1 -1
arch/x86/events/intel/rapl.c
··· 559 559 .attrs = rapl_formats_attr, 560 560 }; 561 561 562 - const struct attribute_group *rapl_attr_groups[] = { 562 + static const struct attribute_group *rapl_attr_groups[] = { 563 563 &rapl_pmu_attr_group, 564 564 &rapl_pmu_format_group, 565 565 &rapl_pmu_events_group,
+1 -1
arch/x86/events/intel/uncore.c
··· 721 721 NULL, 722 722 }; 723 723 724 - static struct attribute_group uncore_pmu_attr_group = { 724 + static const struct attribute_group uncore_pmu_attr_group = { 725 725 .attrs = uncore_pmu_attrs, 726 726 }; 727 727
+6 -6
arch/x86/events/intel/uncore_nhmex.c
··· 272 272 NULL, 273 273 }; 274 274 275 - static struct attribute_group nhmex_uncore_ubox_format_group = { 275 + static const struct attribute_group nhmex_uncore_ubox_format_group = { 276 276 .name = "format", 277 277 .attrs = nhmex_uncore_ubox_formats_attr, 278 278 }; ··· 299 299 NULL, 300 300 }; 301 301 302 - static struct attribute_group nhmex_uncore_cbox_format_group = { 302 + static const struct attribute_group nhmex_uncore_cbox_format_group = { 303 303 .name = "format", 304 304 .attrs = nhmex_uncore_cbox_formats_attr, 305 305 }; ··· 407 407 NULL, 408 408 }; 409 409 410 - static struct attribute_group nhmex_uncore_bbox_format_group = { 410 + static const struct attribute_group nhmex_uncore_bbox_format_group = { 411 411 .name = "format", 412 412 .attrs = nhmex_uncore_bbox_formats_attr, 413 413 }; ··· 484 484 NULL, 485 485 }; 486 486 487 - static struct attribute_group nhmex_uncore_sbox_format_group = { 487 + static const struct attribute_group nhmex_uncore_sbox_format_group = { 488 488 .name = "format", 489 489 .attrs = nhmex_uncore_sbox_formats_attr, 490 490 }; ··· 898 898 NULL, 899 899 }; 900 900 901 - static struct attribute_group nhmex_uncore_mbox_format_group = { 901 + static const struct attribute_group nhmex_uncore_mbox_format_group = { 902 902 .name = "format", 903 903 .attrs = nhmex_uncore_mbox_formats_attr, 904 904 }; ··· 1163 1163 NULL, 1164 1164 }; 1165 1165 1166 - static struct attribute_group nhmex_uncore_rbox_format_group = { 1166 + static const struct attribute_group nhmex_uncore_rbox_format_group = { 1167 1167 .name = "format", 1168 1168 .attrs = nhmex_uncore_rbox_formats_attr, 1169 1169 };
+3 -3
arch/x86/events/intel/uncore_snb.c
··· 130 130 NULL, 131 131 }; 132 132 133 - static struct attribute_group snb_uncore_format_group = { 133 + static const struct attribute_group snb_uncore_format_group = { 134 134 .name = "format", 135 135 .attrs = snb_uncore_formats_attr, 136 136 }; ··· 289 289 NULL, 290 290 }; 291 291 292 - static struct attribute_group snb_uncore_imc_format_group = { 292 + static const struct attribute_group snb_uncore_imc_format_group = { 293 293 .name = "format", 294 294 .attrs = snb_uncore_imc_formats_attr, 295 295 }; ··· 769 769 NULL, 770 770 }; 771 771 772 - static struct attribute_group nhm_uncore_format_group = { 772 + static const struct attribute_group nhm_uncore_format_group = { 773 773 .name = "format", 774 774 .attrs = nhm_uncore_formats_attr, 775 775 };
+21 -21
arch/x86/events/intel/uncore_snbep.c
··· 602 602 { /* end: all zeroes */ }, 603 603 }; 604 604 605 - static struct attribute_group snbep_uncore_format_group = { 605 + static const struct attribute_group snbep_uncore_format_group = { 606 606 .name = "format", 607 607 .attrs = snbep_uncore_formats_attr, 608 608 }; 609 609 610 - static struct attribute_group snbep_uncore_ubox_format_group = { 610 + static const struct attribute_group snbep_uncore_ubox_format_group = { 611 611 .name = "format", 612 612 .attrs = snbep_uncore_ubox_formats_attr, 613 613 }; 614 614 615 - static struct attribute_group snbep_uncore_cbox_format_group = { 615 + static const struct attribute_group snbep_uncore_cbox_format_group = { 616 616 .name = "format", 617 617 .attrs = snbep_uncore_cbox_formats_attr, 618 618 }; 619 619 620 - static struct attribute_group snbep_uncore_pcu_format_group = { 620 + static const struct attribute_group snbep_uncore_pcu_format_group = { 621 621 .name = "format", 622 622 .attrs = snbep_uncore_pcu_formats_attr, 623 623 }; 624 624 625 - static struct attribute_group snbep_uncore_qpi_format_group = { 625 + static const struct attribute_group snbep_uncore_qpi_format_group = { 626 626 .name = "format", 627 627 .attrs = snbep_uncore_qpi_formats_attr, 628 628 }; ··· 1431 1431 NULL, 1432 1432 }; 1433 1433 1434 - static struct attribute_group ivbep_uncore_format_group = { 1434 + static const struct attribute_group ivbep_uncore_format_group = { 1435 1435 .name = "format", 1436 1436 .attrs = ivbep_uncore_formats_attr, 1437 1437 }; 1438 1438 1439 - static struct attribute_group ivbep_uncore_ubox_format_group = { 1439 + static const struct attribute_group ivbep_uncore_ubox_format_group = { 1440 1440 .name = "format", 1441 1441 .attrs = ivbep_uncore_ubox_formats_attr, 1442 1442 }; 1443 1443 1444 - static struct attribute_group ivbep_uncore_cbox_format_group = { 1444 + static const struct attribute_group ivbep_uncore_cbox_format_group = { 1445 1445 .name = "format", 1446 1446 .attrs = ivbep_uncore_cbox_formats_attr, 1447 1447 }; 1448 1448 1449 - static struct attribute_group ivbep_uncore_pcu_format_group = { 1449 + static const struct attribute_group ivbep_uncore_pcu_format_group = { 1450 1450 .name = "format", 1451 1451 .attrs = ivbep_uncore_pcu_formats_attr, 1452 1452 }; 1453 1453 1454 - static struct attribute_group ivbep_uncore_qpi_format_group = { 1454 + static const struct attribute_group ivbep_uncore_qpi_format_group = { 1455 1455 .name = "format", 1456 1456 .attrs = ivbep_uncore_qpi_formats_attr, 1457 1457 }; ··· 1887 1887 NULL, 1888 1888 }; 1889 1889 1890 - static struct attribute_group knl_uncore_ubox_format_group = { 1890 + static const struct attribute_group knl_uncore_ubox_format_group = { 1891 1891 .name = "format", 1892 1892 .attrs = knl_uncore_ubox_formats_attr, 1893 1893 }; ··· 1927 1927 NULL, 1928 1928 }; 1929 1929 1930 - static struct attribute_group knl_uncore_cha_format_group = { 1930 + static const struct attribute_group knl_uncore_cha_format_group = { 1931 1931 .name = "format", 1932 1932 .attrs = knl_uncore_cha_formats_attr, 1933 1933 }; ··· 2037 2037 NULL, 2038 2038 }; 2039 2039 2040 - static struct attribute_group knl_uncore_pcu_format_group = { 2040 + static const struct attribute_group knl_uncore_pcu_format_group = { 2041 2041 .name = "format", 2042 2042 .attrs = knl_uncore_pcu_formats_attr, 2043 2043 }; ··· 2187 2187 NULL, 2188 2188 }; 2189 2189 2190 - static struct attribute_group knl_uncore_irp_format_group = { 2190 + static const struct attribute_group knl_uncore_irp_format_group = { 2191 2191 .name = "format", 2192 2192 .attrs = knl_uncore_irp_formats_attr, 2193 2193 }; ··· 2385 2385 NULL, 2386 2386 }; 2387 2387 2388 - static struct attribute_group hswep_uncore_ubox_format_group = { 2388 + static const struct attribute_group hswep_uncore_ubox_format_group = { 2389 2389 .name = "format", 2390 2390 .attrs = hswep_uncore_ubox_formats_attr, 2391 2391 }; ··· 2439 2439 NULL, 2440 2440 }; 2441 2441 2442 - static struct attribute_group hswep_uncore_cbox_format_group = { 2442 + static const struct attribute_group hswep_uncore_cbox_format_group = { 2443 2443 .name = "format", 2444 2444 .attrs = hswep_uncore_cbox_formats_attr, 2445 2445 }; ··· 2621 2621 NULL, 2622 2622 }; 2623 2623 2624 - static struct attribute_group hswep_uncore_sbox_format_group = { 2624 + static const struct attribute_group hswep_uncore_sbox_format_group = { 2625 2625 .name = "format", 2626 2626 .attrs = hswep_uncore_sbox_formats_attr, 2627 2627 }; ··· 3314 3314 NULL, 3315 3315 }; 3316 3316 3317 - static struct attribute_group skx_uncore_chabox_format_group = { 3317 + static const struct attribute_group skx_uncore_chabox_format_group = { 3318 3318 .name = "format", 3319 3319 .attrs = skx_uncore_cha_formats_attr, 3320 3320 }; ··· 3427 3427 NULL, 3428 3428 }; 3429 3429 3430 - static struct attribute_group skx_uncore_iio_format_group = { 3430 + static const struct attribute_group skx_uncore_iio_format_group = { 3431 3431 .name = "format", 3432 3432 .attrs = skx_uncore_iio_formats_attr, 3433 3433 }; ··· 3484 3484 NULL, 3485 3485 }; 3486 3486 3487 - static struct attribute_group skx_uncore_format_group = { 3487 + static const struct attribute_group skx_uncore_format_group = { 3488 3488 .name = "format", 3489 3489 .attrs = skx_uncore_formats_attr, 3490 3490 }; ··· 3605 3605 NULL, 3606 3606 }; 3607 3607 3608 - static struct attribute_group skx_upi_uncore_format_group = { 3608 + static const struct attribute_group skx_upi_uncore_format_group = { 3609 3609 .name = "format", 3610 3610 .attrs = skx_upi_uncore_formats_attr, 3611 3611 };
+1 -1
arch/x86/include/asm/cpufeatures.h
··· 286 286 #define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */ 287 287 #define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */ 288 288 #define X86_FEATURE_AVIC (15*32+13) /* Virtual Interrupt Controller */ 289 - #define X86_FEATURE_VIRTUAL_VMLOAD_VMSAVE (15*32+15) /* Virtual VMLOAD VMSAVE */ 289 + #define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15) /* Virtual VMSAVE VMLOAD */ 290 290 291 291 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ 292 292 #define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/
+1 -1
arch/x86/kernel/cpu/mcheck/therm_throt.c
··· 122 122 NULL 123 123 }; 124 124 125 - static struct attribute_group thermal_attr_group = { 125 + static const struct attribute_group thermal_attr_group = { 126 126 .attrs = thermal_throttle_attrs, 127 127 .name = "thermal_throttle" 128 128 };
+2 -2
arch/x86/kernel/cpu/microcode/core.c
··· 561 561 NULL 562 562 }; 563 563 564 - static struct attribute_group mc_attr_group = { 564 + static const struct attribute_group mc_attr_group = { 565 565 .attrs = mc_default_attrs, 566 566 .name = "microcode", 567 567 }; ··· 707 707 NULL 708 708 }; 709 709 710 - static struct attribute_group cpu_root_microcode_group = { 710 + static const struct attribute_group cpu_root_microcode_group = { 711 711 .name = "microcode", 712 712 .attrs = cpu_root_microcode_attrs, 713 713 };
+15 -3
arch/x86/kernel/cpu/mtrr/main.c
··· 237 237 stop_machine(mtrr_rendezvous_handler, &data, cpu_online_mask); 238 238 } 239 239 240 + static void set_mtrr_cpuslocked(unsigned int reg, unsigned long base, 241 + unsigned long size, mtrr_type type) 242 + { 243 + struct set_mtrr_data data = { .smp_reg = reg, 244 + .smp_base = base, 245 + .smp_size = size, 246 + .smp_type = type 247 + }; 248 + 249 + stop_machine_cpuslocked(mtrr_rendezvous_handler, &data, cpu_online_mask); 250 + } 251 + 240 252 static void set_mtrr_from_inactive_cpu(unsigned int reg, unsigned long base, 241 253 unsigned long size, mtrr_type type) 242 254 { ··· 382 370 /* Search for an empty MTRR */ 383 371 i = mtrr_if->get_free_region(base, size, replace); 384 372 if (i >= 0) { 385 - set_mtrr(i, base, size, type); 373 + set_mtrr_cpuslocked(i, base, size, type); 386 374 if (likely(replace < 0)) { 387 375 mtrr_usage_table[i] = 1; 388 376 } else { ··· 390 378 if (increment) 391 379 mtrr_usage_table[i]++; 392 380 if (unlikely(replace != i)) { 393 - set_mtrr(replace, 0, 0, 0); 381 + set_mtrr_cpuslocked(replace, 0, 0, 0); 394 382 mtrr_usage_table[replace] = 0; 395 383 } 396 384 } ··· 518 506 goto out; 519 507 } 520 508 if (--mtrr_usage_table[reg] < 1) 521 - set_mtrr(reg, 0, 0, 0); 509 + set_mtrr_cpuslocked(reg, 0, 0, 0); 522 510 error = reg; 523 511 out: 524 512 mutex_unlock(&mtrr_mutex);
+4 -3
arch/x86/kernel/head64.c
··· 53 53 pudval_t *pud; 54 54 pmdval_t *pmd, pmd_entry; 55 55 int i; 56 + unsigned int *next_pgt_ptr; 56 57 57 58 /* Is the address too large? */ 58 59 if (physaddr >> MAX_PHYSMEM_BITS) ··· 92 91 * creates a bunch of nonsense entries but that is fine -- 93 92 * it avoids problems around wraparound. 94 93 */ 95 - 96 - pud = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr); 97 - pmd = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr); 94 + next_pgt_ptr = fixup_pointer(&next_early_pgt, physaddr); 95 + pud = fixup_pointer(early_dynamic_pgts[(*next_pgt_ptr)++], physaddr); 96 + pmd = fixup_pointer(early_dynamic_pgts[(*next_pgt_ptr)++], physaddr); 98 97 99 98 if (IS_ENABLED(CONFIG_X86_5LEVEL)) { 100 99 p4d = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr);
+2 -2
arch/x86/kernel/ksysfs.c
··· 55 55 NULL, 56 56 }; 57 57 58 - static struct attribute_group boot_params_attr_group = { 58 + static const struct attribute_group boot_params_attr_group = { 59 59 .attrs = boot_params_version_attrs, 60 60 .bin_attrs = boot_params_data_attrs, 61 61 }; ··· 202 202 NULL, 203 203 }; 204 204 205 - static struct attribute_group setup_data_attr_group = { 205 + static const struct attribute_group setup_data_attr_group = { 206 206 .attrs = setup_data_type_attrs, 207 207 .bin_attrs = setup_data_data_attrs, 208 208 };
+17 -13
arch/x86/kernel/smpboot.c
··· 971 971 * Returns zero if CPU booted OK, else error code from 972 972 * ->wakeup_secondary_cpu. 973 973 */ 974 - static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle) 974 + static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle, 975 + int *cpu0_nmi_registered) 975 976 { 976 977 volatile u32 *trampoline_status = 977 978 (volatile u32 *) __va(real_mode_header->trampoline_status); ··· 980 979 unsigned long start_ip = real_mode_header->trampoline_start; 981 980 982 981 unsigned long boot_error = 0; 983 - int cpu0_nmi_registered = 0; 984 982 unsigned long timeout; 985 983 986 984 idle->thread.sp = (unsigned long)task_pt_regs(idle); ··· 1035 1035 boot_error = apic->wakeup_secondary_cpu(apicid, start_ip); 1036 1036 else 1037 1037 boot_error = wakeup_cpu_via_init_nmi(cpu, start_ip, apicid, 1038 - &cpu0_nmi_registered); 1038 + cpu0_nmi_registered); 1039 1039 1040 1040 if (!boot_error) { 1041 1041 /* ··· 1080 1080 */ 1081 1081 smpboot_restore_warm_reset_vector(); 1082 1082 } 1083 - /* 1084 - * Clean up the nmi handler. Do this after the callin and callout sync 1085 - * to avoid impact of possible long unregister time. 1086 - */ 1087 - if (cpu0_nmi_registered) 1088 - unregister_nmi_handler(NMI_LOCAL, "wake_cpu0"); 1089 1083 1090 1084 return boot_error; 1091 1085 } ··· 1087 1093 int native_cpu_up(unsigned int cpu, struct task_struct *tidle) 1088 1094 { 1089 1095 int apicid = apic->cpu_present_to_apicid(cpu); 1096 + int cpu0_nmi_registered = 0; 1090 1097 unsigned long flags; 1091 - int err; 1098 + int err, ret = 0; 1092 1099 1093 1100 WARN_ON(irqs_disabled()); 1094 1101 ··· 1126 1131 1127 1132 common_cpu_up(cpu, tidle); 1128 1133 1129 - err = do_boot_cpu(apicid, cpu, tidle); 1134 + err = do_boot_cpu(apicid, cpu, tidle, &cpu0_nmi_registered); 1130 1135 if (err) { 1131 1136 pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu); 1132 - return -EIO; 1137 + ret = -EIO; 1138 + goto unreg_nmi; 1133 1139 } 1134 1140 1135 1141 /* ··· 1146 1150 touch_nmi_watchdog(); 1147 1151 } 1148 1152 1149 - return 0; 1153 + unreg_nmi: 1154 + /* 1155 + * Clean up the nmi handler. Do this after the callin and callout sync 1156 + * to avoid impact of possible long unregister time. 1157 + */ 1158 + if (cpu0_nmi_registered) 1159 + unregister_nmi_handler(NMI_LOCAL, "wake_cpu0"); 1160 + 1161 + return ret; 1150 1162 } 1151 1163 1152 1164 /**
+1 -1
arch/x86/kvm/svm.c
··· 1100 1100 1101 1101 if (vls) { 1102 1102 if (!npt_enabled || 1103 - !boot_cpu_has(X86_FEATURE_VIRTUAL_VMLOAD_VMSAVE) || 1103 + !boot_cpu_has(X86_FEATURE_V_VMSAVE_VMLOAD) || 1104 1104 !IS_ENABLED(CONFIG_X86_64)) { 1105 1105 vls = false; 1106 1106 } else {
+3 -4
arch/x86/mm/mmap.c
··· 50 50 static unsigned long stack_maxrandom_size(unsigned long task_size) 51 51 { 52 52 unsigned long max = 0; 53 - if ((current->flags & PF_RANDOMIZE) && 54 - !(current->personality & ADDR_NO_RANDOMIZE)) { 53 + if (current->flags & PF_RANDOMIZE) { 55 54 max = (-1UL) & __STACK_RND_MASK(task_size == tasksize_32bit()); 56 55 max <<= PAGE_SHIFT; 57 56 } ··· 78 79 79 80 static unsigned long arch_rnd(unsigned int rndbits) 80 81 { 82 + if (!(current->flags & PF_RANDOMIZE)) 83 + return 0; 81 84 return (get_random_long() & ((1UL << rndbits) - 1)) << PAGE_SHIFT; 82 85 } 83 86 84 87 unsigned long arch_mmap_rnd(void) 85 88 { 86 - if (!(current->flags & PF_RANDOMIZE)) 87 - return 0; 88 89 return arch_rnd(mmap_is_ia32() ? mmap32_rnd_bits : mmap64_rnd_bits); 89 90 } 90 91
+2 -2
arch/x86/platform/uv/tlb_uv.c
··· 26 26 static struct bau_operations ops __ro_after_init; 27 27 28 28 /* timeouts in nanoseconds (indexed by UVH_AGING_PRESCALE_SEL urgency7 30:28) */ 29 - static int timeout_base_ns[] = { 29 + static const int timeout_base_ns[] = { 30 30 20, 31 31 160, 32 32 1280, ··· 1216 1216 * set a bit in the UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE register. 1217 1217 * Such a message must be ignored. 1218 1218 */ 1219 - void process_uv2_message(struct msg_desc *mdp, struct bau_control *bcp) 1219 + static void process_uv2_message(struct msg_desc *mdp, struct bau_control *bcp) 1220 1220 { 1221 1221 unsigned long mmr_image; 1222 1222 unsigned char swack_vec;
+1 -2
fs/binfmt_elf.c
··· 664 664 { 665 665 unsigned long random_variable = 0; 666 666 667 - if ((current->flags & PF_RANDOMIZE) && 668 - !(current->personality & ADDR_NO_RANDOMIZE)) { 667 + if (current->flags & PF_RANDOMIZE) { 669 668 random_variable = get_random_long(); 670 669 random_variable &= STACK_RND_MASK; 671 670 random_variable <<= PAGE_SHIFT;