Skip to content

Commit 7f680d7

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: "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
2 parents 2615a38 + 45bd07a commit 7f680d7

File tree

19 files changed

+85
-68
lines changed

19 files changed

+85
-68
lines changed

arch/x86/entry/entry_64.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,8 @@ ENTRY(nmi)
12111211
* other IST entries.
12121212
*/
12131213

1214+
ASM_CLAC
1215+
12141216
/* Use %rdx as our temp variable throughout */
12151217
pushq %rdx
12161218

arch/x86/events/intel/bts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct bts_buffer {
6969
struct bts_phys buf[0];
7070
};
7171

72-
struct pmu bts_pmu;
72+
static struct pmu bts_pmu;
7373

7474
static size_t buf_size(struct page *page)
7575
{

arch/x86/events/intel/p4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static __initconst const u64 p4_hw_cache_event_ids
587587
* P4_CONFIG_ALIASABLE or bits for P4_PEBS_METRIC, they are
588588
* either up to date automatically or not applicable at all.
589589
*/
590-
struct p4_event_alias {
590+
static struct p4_event_alias {
591591
u64 original;
592592
u64 alternative;
593593
} p4_event_aliases[] = {

arch/x86/events/intel/rapl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ static struct attribute_group rapl_pmu_format_group = {
559559
.attrs = rapl_formats_attr,
560560
};
561561

562-
const struct attribute_group *rapl_attr_groups[] = {
562+
static const struct attribute_group *rapl_attr_groups[] = {
563563
&rapl_pmu_attr_group,
564564
&rapl_pmu_format_group,
565565
&rapl_pmu_events_group,

arch/x86/events/intel/uncore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ static struct attribute *uncore_pmu_attrs[] = {
721721
NULL,
722722
};
723723

724-
static struct attribute_group uncore_pmu_attr_group = {
724+
static const struct attribute_group uncore_pmu_attr_group = {
725725
.attrs = uncore_pmu_attrs,
726726
};
727727

arch/x86/events/intel/uncore_nhmex.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static struct attribute *nhmex_uncore_ubox_formats_attr[] = {
272272
NULL,
273273
};
274274

275-
static struct attribute_group nhmex_uncore_ubox_format_group = {
275+
static const struct attribute_group nhmex_uncore_ubox_format_group = {
276276
.name = "format",
277277
.attrs = nhmex_uncore_ubox_formats_attr,
278278
};
@@ -299,7 +299,7 @@ static struct attribute *nhmex_uncore_cbox_formats_attr[] = {
299299
NULL,
300300
};
301301

302-
static struct attribute_group nhmex_uncore_cbox_format_group = {
302+
static const struct attribute_group nhmex_uncore_cbox_format_group = {
303303
.name = "format",
304304
.attrs = nhmex_uncore_cbox_formats_attr,
305305
};
@@ -407,7 +407,7 @@ static struct attribute *nhmex_uncore_bbox_formats_attr[] = {
407407
NULL,
408408
};
409409

410-
static struct attribute_group nhmex_uncore_bbox_format_group = {
410+
static const struct attribute_group nhmex_uncore_bbox_format_group = {
411411
.name = "format",
412412
.attrs = nhmex_uncore_bbox_formats_attr,
413413
};
@@ -484,7 +484,7 @@ static struct attribute *nhmex_uncore_sbox_formats_attr[] = {
484484
NULL,
485485
};
486486

487-
static struct attribute_group nhmex_uncore_sbox_format_group = {
487+
static const struct attribute_group nhmex_uncore_sbox_format_group = {
488488
.name = "format",
489489
.attrs = nhmex_uncore_sbox_formats_attr,
490490
};
@@ -898,7 +898,7 @@ static struct attribute *nhmex_uncore_mbox_formats_attr[] = {
898898
NULL,
899899
};
900900

901-
static struct attribute_group nhmex_uncore_mbox_format_group = {
901+
static const struct attribute_group nhmex_uncore_mbox_format_group = {
902902
.name = "format",
903903
.attrs = nhmex_uncore_mbox_formats_attr,
904904
};
@@ -1163,7 +1163,7 @@ static struct attribute *nhmex_uncore_rbox_formats_attr[] = {
11631163
NULL,
11641164
};
11651165

1166-
static struct attribute_group nhmex_uncore_rbox_format_group = {
1166+
static const struct attribute_group nhmex_uncore_rbox_format_group = {
11671167
.name = "format",
11681168
.attrs = nhmex_uncore_rbox_formats_attr,
11691169
};

arch/x86/events/intel/uncore_snb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct attribute *snb_uncore_formats_attr[] = {
130130
NULL,
131131
};
132132

133-
static struct attribute_group snb_uncore_format_group = {
133+
static const struct attribute_group snb_uncore_format_group = {
134134
.name = "format",
135135
.attrs = snb_uncore_formats_attr,
136136
};
@@ -289,7 +289,7 @@ static struct attribute *snb_uncore_imc_formats_attr[] = {
289289
NULL,
290290
};
291291

292-
static struct attribute_group snb_uncore_imc_format_group = {
292+
static const struct attribute_group snb_uncore_imc_format_group = {
293293
.name = "format",
294294
.attrs = snb_uncore_imc_formats_attr,
295295
};
@@ -769,7 +769,7 @@ static struct attribute *nhm_uncore_formats_attr[] = {
769769
NULL,
770770
};
771771

772-
static struct attribute_group nhm_uncore_format_group = {
772+
static const struct attribute_group nhm_uncore_format_group = {
773773
.name = "format",
774774
.attrs = nhm_uncore_formats_attr,
775775
};

arch/x86/events/intel/uncore_snbep.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -602,27 +602,27 @@ static struct uncore_event_desc snbep_uncore_qpi_events[] = {
602602
{ /* end: all zeroes */ },
603603
};
604604

605-
static struct attribute_group snbep_uncore_format_group = {
605+
static const struct attribute_group snbep_uncore_format_group = {
606606
.name = "format",
607607
.attrs = snbep_uncore_formats_attr,
608608
};
609609

610-
static struct attribute_group snbep_uncore_ubox_format_group = {
610+
static const struct attribute_group snbep_uncore_ubox_format_group = {
611611
.name = "format",
612612
.attrs = snbep_uncore_ubox_formats_attr,
613613
};
614614

615-
static struct attribute_group snbep_uncore_cbox_format_group = {
615+
static const struct attribute_group snbep_uncore_cbox_format_group = {
616616
.name = "format",
617617
.attrs = snbep_uncore_cbox_formats_attr,
618618
};
619619

620-
static struct attribute_group snbep_uncore_pcu_format_group = {
620+
static const struct attribute_group snbep_uncore_pcu_format_group = {
621621
.name = "format",
622622
.attrs = snbep_uncore_pcu_formats_attr,
623623
};
624624

625-
static struct attribute_group snbep_uncore_qpi_format_group = {
625+
static const struct attribute_group snbep_uncore_qpi_format_group = {
626626
.name = "format",
627627
.attrs = snbep_uncore_qpi_formats_attr,
628628
};
@@ -1431,27 +1431,27 @@ static struct attribute *ivbep_uncore_qpi_formats_attr[] = {
14311431
NULL,
14321432
};
14331433

1434-
static struct attribute_group ivbep_uncore_format_group = {
1434+
static const struct attribute_group ivbep_uncore_format_group = {
14351435
.name = "format",
14361436
.attrs = ivbep_uncore_formats_attr,
14371437
};
14381438

1439-
static struct attribute_group ivbep_uncore_ubox_format_group = {
1439+
static const struct attribute_group ivbep_uncore_ubox_format_group = {
14401440
.name = "format",
14411441
.attrs = ivbep_uncore_ubox_formats_attr,
14421442
};
14431443

1444-
static struct attribute_group ivbep_uncore_cbox_format_group = {
1444+
static const struct attribute_group ivbep_uncore_cbox_format_group = {
14451445
.name = "format",
14461446
.attrs = ivbep_uncore_cbox_formats_attr,
14471447
};
14481448

1449-
static struct attribute_group ivbep_uncore_pcu_format_group = {
1449+
static const struct attribute_group ivbep_uncore_pcu_format_group = {
14501450
.name = "format",
14511451
.attrs = ivbep_uncore_pcu_formats_attr,
14521452
};
14531453

1454-
static struct attribute_group ivbep_uncore_qpi_format_group = {
1454+
static const struct attribute_group ivbep_uncore_qpi_format_group = {
14551455
.name = "format",
14561456
.attrs = ivbep_uncore_qpi_formats_attr,
14571457
};
@@ -1887,7 +1887,7 @@ static struct attribute *knl_uncore_ubox_formats_attr[] = {
18871887
NULL,
18881888
};
18891889

1890-
static struct attribute_group knl_uncore_ubox_format_group = {
1890+
static const struct attribute_group knl_uncore_ubox_format_group = {
18911891
.name = "format",
18921892
.attrs = knl_uncore_ubox_formats_attr,
18931893
};
@@ -1927,7 +1927,7 @@ static struct attribute *knl_uncore_cha_formats_attr[] = {
19271927
NULL,
19281928
};
19291929

1930-
static struct attribute_group knl_uncore_cha_format_group = {
1930+
static const struct attribute_group knl_uncore_cha_format_group = {
19311931
.name = "format",
19321932
.attrs = knl_uncore_cha_formats_attr,
19331933
};
@@ -2037,7 +2037,7 @@ static struct attribute *knl_uncore_pcu_formats_attr[] = {
20372037
NULL,
20382038
};
20392039

2040-
static struct attribute_group knl_uncore_pcu_format_group = {
2040+
static const struct attribute_group knl_uncore_pcu_format_group = {
20412041
.name = "format",
20422042
.attrs = knl_uncore_pcu_formats_attr,
20432043
};
@@ -2187,7 +2187,7 @@ static struct attribute *knl_uncore_irp_formats_attr[] = {
21872187
NULL,
21882188
};
21892189

2190-
static struct attribute_group knl_uncore_irp_format_group = {
2190+
static const struct attribute_group knl_uncore_irp_format_group = {
21912191
.name = "format",
21922192
.attrs = knl_uncore_irp_formats_attr,
21932193
};
@@ -2385,7 +2385,7 @@ static struct attribute *hswep_uncore_ubox_formats_attr[] = {
23852385
NULL,
23862386
};
23872387

2388-
static struct attribute_group hswep_uncore_ubox_format_group = {
2388+
static const struct attribute_group hswep_uncore_ubox_format_group = {
23892389
.name = "format",
23902390
.attrs = hswep_uncore_ubox_formats_attr,
23912391
};
@@ -2439,7 +2439,7 @@ static struct attribute *hswep_uncore_cbox_formats_attr[] = {
24392439
NULL,
24402440
};
24412441

2442-
static struct attribute_group hswep_uncore_cbox_format_group = {
2442+
static const struct attribute_group hswep_uncore_cbox_format_group = {
24432443
.name = "format",
24442444
.attrs = hswep_uncore_cbox_formats_attr,
24452445
};
@@ -2621,7 +2621,7 @@ static struct attribute *hswep_uncore_sbox_formats_attr[] = {
26212621
NULL,
26222622
};
26232623

2624-
static struct attribute_group hswep_uncore_sbox_format_group = {
2624+
static const struct attribute_group hswep_uncore_sbox_format_group = {
26252625
.name = "format",
26262626
.attrs = hswep_uncore_sbox_formats_attr,
26272627
};
@@ -3314,7 +3314,7 @@ static struct attribute *skx_uncore_cha_formats_attr[] = {
33143314
NULL,
33153315
};
33163316

3317-
static struct attribute_group skx_uncore_chabox_format_group = {
3317+
static const struct attribute_group skx_uncore_chabox_format_group = {
33183318
.name = "format",
33193319
.attrs = skx_uncore_cha_formats_attr,
33203320
};
@@ -3427,7 +3427,7 @@ static struct attribute *skx_uncore_iio_formats_attr[] = {
34273427
NULL,
34283428
};
34293429

3430-
static struct attribute_group skx_uncore_iio_format_group = {
3430+
static const struct attribute_group skx_uncore_iio_format_group = {
34313431
.name = "format",
34323432
.attrs = skx_uncore_iio_formats_attr,
34333433
};
@@ -3484,7 +3484,7 @@ static struct attribute *skx_uncore_formats_attr[] = {
34843484
NULL,
34853485
};
34863486

3487-
static struct attribute_group skx_uncore_format_group = {
3487+
static const struct attribute_group skx_uncore_format_group = {
34883488
.name = "format",
34893489
.attrs = skx_uncore_formats_attr,
34903490
};
@@ -3605,7 +3605,7 @@ static struct attribute *skx_upi_uncore_formats_attr[] = {
36053605
NULL,
36063606
};
36073607

3608-
static struct attribute_group skx_upi_uncore_format_group = {
3608+
static const struct attribute_group skx_upi_uncore_format_group = {
36093609
.name = "format",
36103610
.attrs = skx_upi_uncore_formats_attr,
36113611
};

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@
286286
#define X86_FEATURE_PAUSEFILTER (15*32+10) /* filtered pause intercept */
287287
#define X86_FEATURE_PFTHRESHOLD (15*32+12) /* pause filter threshold */
288288
#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 */
290290

291291
/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */
292292
#define X86_FEATURE_AVX512VBMI (16*32+ 1) /* AVX512 Vector Bit Manipulation instructions*/

arch/x86/kernel/cpu/mcheck/therm_throt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static struct attribute *thermal_throttle_attrs[] = {
122122
NULL
123123
};
124124

125-
static struct attribute_group thermal_attr_group = {
125+
static const struct attribute_group thermal_attr_group = {
126126
.attrs = thermal_throttle_attrs,
127127
.name = "thermal_throttle"
128128
};

arch/x86/kernel/cpu/microcode/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ static struct attribute *mc_default_attrs[] = {
561561
NULL
562562
};
563563

564-
static struct attribute_group mc_attr_group = {
564+
static const struct attribute_group mc_attr_group = {
565565
.attrs = mc_default_attrs,
566566
.name = "microcode",
567567
};
@@ -707,7 +707,7 @@ static struct attribute *cpu_root_microcode_attrs[] = {
707707
NULL
708708
};
709709

710-
static struct attribute_group cpu_root_microcode_group = {
710+
static const struct attribute_group cpu_root_microcode_group = {
711711
.name = "microcode",
712712
.attrs = cpu_root_microcode_attrs,
713713
};

arch/x86/kernel/cpu/mtrr/main.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,18 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
237237
stop_machine(mtrr_rendezvous_handler, &data, cpu_online_mask);
238238
}
239239

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+
240252
static void set_mtrr_from_inactive_cpu(unsigned int reg, unsigned long base,
241253
unsigned long size, mtrr_type type)
242254
{
@@ -370,15 +382,15 @@ int mtrr_add_page(unsigned long base, unsigned long size,
370382
/* Search for an empty MTRR */
371383
i = mtrr_if->get_free_region(base, size, replace);
372384
if (i >= 0) {
373-
set_mtrr(i, base, size, type);
385+
set_mtrr_cpuslocked(i, base, size, type);
374386
if (likely(replace < 0)) {
375387
mtrr_usage_table[i] = 1;
376388
} else {
377389
mtrr_usage_table[i] = mtrr_usage_table[replace];
378390
if (increment)
379391
mtrr_usage_table[i]++;
380392
if (unlikely(replace != i)) {
381-
set_mtrr(replace, 0, 0, 0);
393+
set_mtrr_cpuslocked(replace, 0, 0, 0);
382394
mtrr_usage_table[replace] = 0;
383395
}
384396
}
@@ -506,7 +518,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
506518
goto out;
507519
}
508520
if (--mtrr_usage_table[reg] < 1)
509-
set_mtrr(reg, 0, 0, 0);
521+
set_mtrr_cpuslocked(reg, 0, 0, 0);
510522
error = reg;
511523
out:
512524
mutex_unlock(&mtrr_mutex);

arch/x86/kernel/head64.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void __head __startup_64(unsigned long physaddr)
5353
pudval_t *pud;
5454
pmdval_t *pmd, pmd_entry;
5555
int i;
56+
unsigned int *next_pgt_ptr;
5657

5758
/* Is the address too large? */
5859
if (physaddr >> MAX_PHYSMEM_BITS)
@@ -91,9 +92,9 @@ void __head __startup_64(unsigned long physaddr)
9192
* creates a bunch of nonsense entries but that is fine --
9293
* it avoids problems around wraparound.
9394
*/
94-
95-
pud = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr);
96-
pmd = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr);
95+
next_pgt_ptr = fixup_pointer(&next_early_pgt, physaddr);
96+
pud = fixup_pointer(early_dynamic_pgts[(*next_pgt_ptr)++], physaddr);
97+
pmd = fixup_pointer(early_dynamic_pgts[(*next_pgt_ptr)++], physaddr);
9798

9899
if (IS_ENABLED(CONFIG_X86_5LEVEL)) {
99100
p4d = fixup_pointer(early_dynamic_pgts[next_early_pgt++], physaddr);

0 commit comments

Comments
 (0)