History

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

Pull x86 cleanups from Ingo Molnar: "Various cleanups and simplifications, none of them really stands out, they are all over the place" * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/uaccess: Remove unused __addr_ok() macro x86/smpboot: Remove unused phys_id variable x86/mm/dump_pagetables: Remove the unused prev_pud variable x86/fpu: Move init_xstate_size() to __init section x86/cpu_entry_area: Move percpu_setup_debug_store() to __init section x86/mtrr: Remove unused variable x86/boot/compressed/64: Explain paging_prepare()'s return value x86/resctrl: Remove duplicate MSR_MISC_FEATURE_CONTROL definition x86/asm/suspend: Drop ENTRY from local data x86/hw_breakpoints, kprobes: Remove kprobes ifdeffery x86/boot: Save several bytes in decompressor x86/trap: Remove useless declaration x86/mm/tlb: Remove unused cpu variable x86/events: Mark expected switch-case fall-throughs x86/asm-prototypes: Remove duplicate include <asm/page.h> x86/kernel: Mark expected switch-case fall-throughs x86/insn-eval: Mark expected switch-case fall-through x86/platform/UV: Replace kmalloc() and memset() with k[cz]alloc() calls x86/e820: Replace kmalloc() + memcpy() with kmemdup()

Linus Torvalds committed 7 years ago

Commit bcd49c32 parents f14b5f0 2e7614c24 files · +38 −55Browse files

Unified · Split

24 files
  1. arch/x86/boot/compressed/head_64.S +6 −5
  2. arch/x86/events/intel/core.c +2 −0
  3. arch/x86/events/intel/lbr.c +1 −0
  4. arch/x86/include/asm/asm-prototypes.h +0 −1
  5. arch/x86/include/asm/processor.h +0 −1
  6. arch/x86/include/asm/uaccess.h +0 −3
  7. arch/x86/kernel/acpi/wakeup_32.S +1 −1
  8. arch/x86/kernel/acpi/wakeup_64.S +6 −6
  9. arch/x86/kernel/apic/io_apic.c +2 −0
  10. arch/x86/kernel/cpu/cacheinfo.c +1 −0
  11. arch/x86/kernel/cpu/mtrr/cleanup.c +1 −2
  12. arch/x86/kernel/cpu/resctrl/pseudo_lock.c +0 −7
  13. arch/x86/kernel/e820.c +3 −6
  14. arch/x86/kernel/fpu/xstate.c +1 −1
  15. arch/x86/kernel/hw_breakpoint.c +1 −4
  16. arch/x86/kernel/kgdb.c +1 −0
  17. arch/x86/kernel/smpboot.c +1 −6
  18. arch/x86/kernel/uprobes.c +1 −0
  19. arch/x86/lib/insn-eval.c +2 −0
  20. arch/x86/mm/cpu_entry_area.c +1 −1
  21. arch/x86/mm/dump_pagetables.c +0 −2
  22. arch/x86/mm/tlb.c +0 −3
  23. arch/x86/platform/uv/tlb_uv.c +2 −6
  24. include/linux/kprobes.h +5 −0
arch/x86/boot/compressed/head_64.S+6−5
@@ -358,8 +358,11 @@ ENTRY(startup_64) · 357 unmodified lines
358358 * paging_prepare() sets up the trampoline and checks if we need to
359359 * enable 5-level paging.
360360 *
361− * Address of the trampoline is returned in RAX.
362− * Non zero RDX on return means we need to enable 5-level paging.
361+ * paging_prepare() returns a two-quadword structure which lands
362+ * into RDX:RAX:
363+ * - Address of the trampoline is returned in RAX.
364+ * - Non zero RDX means trampoline needs to enable 5-level
365+ * paging.
363366 *
364367 * RSI holds real mode data and needs to be preserved across
365368 * this function call.
@@ -565,7 +568,7 @@ adjust_got: · 199 unmodified lines
565568 *
566569 * RDI contains the return address (might be above 4G).
567570 * ECX contains the base address of the trampoline memory.
568− * Non zero RDX on return means we need to enable 5-level paging.
571+ * Non zero RDX means trampoline needs to enable 5-level paging.
569572 */
570573 ENTRY(trampoline_32bit_src)
571574 /* Set up data and stack segments */
@@ -655,8 +658,6 @@ no_longmode: · 83 unmodified lines
655658 .data
656659 gdt64:
657660 .word gdt_end - gdt
658− .long 0
659− .word 0
660661 .quad 0
661662 gdt:
662663 .word gdt_end - gdt
arch/x86/events/intel/core.c+2−0
@@ -4220,6 +4220,8 @@ __init int intel_pmu_init(void) · 4219 unmodified lines
42204220
42214221 case INTEL_FAM6_CORE2_MEROM:
42224222 x86_add_quirk(intel_clovertown_quirk);
4223+ /* fall through */
4224+
42234225 case INTEL_FAM6_CORE2_MEROM_L:
42244226 case INTEL_FAM6_CORE2_PENRYN:
42254227 case INTEL_FAM6_CORE2_DUNNINGTON:
arch/x86/events/intel/lbr.c+1−0
@@ -931,6 +931,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort) · 930 unmodified lines
931931 ret = X86_BR_ZERO_CALL;
932932 break;
933933 }
934+ /* fall through */
934935 case 0x9a: /* call far absolute */
935936 ret = X86_BR_CALL;
936937 break;
arch/x86/include/asm/asm-prototypes.h+0−1
@@ -7,7 +7,6 @@ · 6 unmodified lines
77
88 #include <asm-generic/asm-prototypes.h>
99
10−#include <asm/page.h>
1110 #include <asm/pgtable.h>
1211 #include <asm/special_insns.h>
1312 #include <asm/preempt.h>
arch/x86/include/asm/processor.h+0−1
@@ -742,7 +742,6 @@ enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_NOMWAIT, · 741 unmodified lines
742742 extern void enable_sep_cpu(void);
743743 extern int sysenter_setup(void);
744744
745−void early_trap_pf_init(void);
746745
747746 /* Defined in head.S */
748747 extern struct desc_ptr early_gdt_descr;
arch/x86/include/asm/uaccess.h+0−3
@@ -34,10 +34,7 @@ static inline void set_fs(mm_segment_t fs) · 33 unmodified lines
3434 }
3535
3636 #define segment_eq(a, b) ((a).seg == (b).seg)
37−
3837 #define user_addr_max() (current->thread.addr_limit.seg)
39−#define __addr_ok(addr) \
40− ((unsigned long __force)(addr) < user_addr_max())
4138
4239 /*
4340 * Test whether a block of memory is a valid user space address.
arch/x86/kernel/acpi/wakeup_32.S+1−1
@@ -90,7 +90,7 @@ ret_point: · 89 unmodified lines
9090 .data
9191 ALIGN
9292 ENTRY(saved_magic) .long 0
93−ENTRY(saved_eip) .long 0
93+saved_eip: .long 0
9494
9595 # saved registers
9696 saved_idt: .long 0,0
arch/x86/kernel/acpi/wakeup_64.S+6−6
@@ -125,12 +125,12 @@ ENTRY(do_suspend_lowlevel) · 124 unmodified lines
125125 ENDPROC(do_suspend_lowlevel)
126126
127127 .data
128−ENTRY(saved_rbp) .quad 0
129−ENTRY(saved_rsi) .quad 0
130−ENTRY(saved_rdi) .quad 0
131−ENTRY(saved_rbx) .quad 0
128+saved_rbp: .quad 0
129+saved_rsi: .quad 0
130+saved_rdi: .quad 0
131+saved_rbx: .quad 0
132132
133−ENTRY(saved_rip) .quad 0
134−ENTRY(saved_rsp) .quad 0
133+saved_rip: .quad 0
134+saved_rsp: .quad 0
135135
136136 ENTRY(saved_magic) .quad 0
arch/x86/kernel/apic/io_apic.c+2−0
@@ -812,6 +812,7 @@ static int irq_polarity(int idx) · 811 unmodified lines
812812 return IOAPIC_POL_HIGH;
813813 case MP_IRQPOL_RESERVED:
814814 pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n");
815+ /* fall through */
815816 case MP_IRQPOL_ACTIVE_LOW:
816817 default: /* Pointless default required due to do gcc stupidity */
817818 return IOAPIC_POL_LOW;
@@ -859,6 +860,7 @@ static int irq_trigger(int idx) · 41 unmodified lines
859860 return IOAPIC_EDGE;
860861 case MP_IRQTRIG_RESERVED:
861862 pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n");
863+ /* fall through */
862864 case MP_IRQTRIG_LEVEL:
863865 default: /* Pointless default required due to do gcc stupidity */
864866 return IOAPIC_LEVEL;
arch/x86/kernel/cpu/cacheinfo.c+1−0
@@ -248,6 +248,7 @@ amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, · 247 unmodified lines
248248 switch (leaf) {
249249 case 1:
250250 l1 = &l1i;
251+ /* fall through */
251252 case 0:
252253 if (!l1->val)
253254 return;
arch/x86/kernel/cpu/mtrr/cleanup.c+1−2
@@ -296,7 +296,7 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek, · 295 unmodified lines
296296 unsigned long sizek)
297297 {
298298 unsigned long hole_basek, hole_sizek;
299− unsigned long second_basek, second_sizek;
299+ unsigned long second_sizek;
300300 unsigned long range0_basek, range0_sizek;
301301 unsigned long range_basek, range_sizek;
302302 unsigned long chunk_sizek;
@@ -304,7 +304,6 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek, · 1 unmodified line
304304
305305 hole_basek = 0;
306306 hole_sizek = 0;
307− second_basek = 0;
308307 second_sizek = 0;
309308 chunk_sizek = state->chunk_sizek;
310309 gran_sizek = state->gran_sizek;
arch/x86/kernel/cpu/resctrl/pseudo_lock.c+0−7
@@ -33,13 +33,6 @@ · 32 unmodified lines
3333 #define CREATE_TRACE_POINTS
3434 #include "pseudo_lock_event.h"
3535
36−/*
37− * MSR_MISC_FEATURE_CONTROL register enables the modification of hardware
38− * prefetcher state. Details about this register can be found in the MSR
39− * tables for specific platforms found in Intel's SDM.
40− */
41−#define MSR_MISC_FEATURE_CONTROL 0x000001a4
42−
4336 /*
4437 * The bits needed to disable hardware prefetching varies based on the
4538 * platform. During initialization we will discover which bits to use.
arch/x86/kernel/e820.c+3−6
@@ -671,21 +671,18 @@ __init void e820__reallocate_tables(void) · 670 unmodified lines
671671 int size;
672672
673673 size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table->nr_entries;
674− n = kmalloc(size, GFP_KERNEL);
674+ n = kmemdup(e820_table, size, GFP_KERNEL);
675675 BUG_ON(!n);
676− memcpy(n, e820_table, size);
677676 e820_table = n;
678677
679678 size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table_kexec->nr_entries;
680− n = kmalloc(size, GFP_KERNEL);
679+ n = kmemdup(e820_table_kexec, size, GFP_KERNEL);
681680 BUG_ON(!n);
682− memcpy(n, e820_table_kexec, size);
683681 e820_table_kexec = n;
684682
685683 size = offsetof(struct e820_table, entries) + sizeof(struct e820_entry)*e820_table_firmware->nr_entries;
686− n = kmalloc(size, GFP_KERNEL);
684+ n = kmemdup(e820_table_firmware, size, GFP_KERNEL);
687685 BUG_ON(!n);
688− memcpy(n, e820_table_firmware, size);
689686 e820_table_firmware = n;
690687 }
691688
arch/x86/kernel/fpu/xstate.c+1−1
@@ -669,7 +669,7 @@ static bool is_supported_xstate_size(unsigned int test_xstate_size) · 668 unmodified lines
669669 return false;
670670 }
671671
672−static int init_xstate_size(void)
672+static int __init init_xstate_size(void)
673673 {
674674 /* Recompute the context size for enabled features: */
675675 unsigned int possible_xstate_size;
arch/x86/kernel/hw_breakpoint.c+1−4
@@ -261,12 +261,8 @@ static int arch_build_bp_info(struct perf_event *bp, · 260 unmodified lines
261261 * allow kernel breakpoints at all.
262262 */
263263 if (attr->bp_addr >= TASK_SIZE_MAX) {
264−#ifdef CONFIG_KPROBES
265264 if (within_kprobe_blacklist(attr->bp_addr))
266265 return -EINVAL;
267−#else
268− return -EINVAL;
269−#endif
270266 }
271267
272268 hw->type = X86_BREAKPOINT_EXECUTE;
@@ -279,6 +275,7 @@ static int arch_build_bp_info(struct perf_event *bp, · 6 unmodified lines
279275 hw->len = X86_BREAKPOINT_LEN_X;
280276 return 0;
281277 }
278+ /* fall through */
282279 default:
283280 return -EINVAL;
284281 }
arch/x86/kernel/kgdb.c+1−0
@@ -467,6 +467,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code, · 466 unmodified lines
467467 ptr = &remcomInBuffer[1];
468468 if (kgdb_hex2long(&ptr, &addr))
469469 linux_regs->ip = addr;
470+ /* fall through */
470471 case 'D':
471472 case 'k':
472473 /* clear the trace bit */
arch/x86/kernel/smpboot.c+1−6
@@ -150,7 +150,7 @@ static inline void smpboot_restore_warm_reset_vector(void) · 149 unmodified lines
150150 */
151151 static void smp_callin(void)
152152 {
153− int cpuid, phys_id;
153+ int cpuid;
154154
155155 /*
156156 * If waken up by an INIT in an 82489DX configuration
@@ -160,11 +160,6 @@ static void smp_callin(void) · 3 unmodified lines
160160 */
161161 cpuid = smp_processor_id();
162162
163− /*
164− * (This works even if the APIC is not enabled.)
165− */
166− phys_id = read_apic_id();
167−
168163 /*
169164 * the boot CPU has finished the init stage and is spinning
170165 * on callin_map until we finish. We are free to set up this
arch/x86/kernel/uprobes.c+1−0
@@ -745,6 +745,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) · 744 unmodified lines
745745 * OPCODE1() of the "short" jmp which checks the same condition.
746746 */
747747 opc1 = OPCODE2(insn) - 0x10;
748+ /* fall through */
748749 default:
749750 if (!is_cond_jmp_opcode(opc1))
750751 return -ENOSYS;
arch/x86/lib/insn-eval.c+2−0
@@ -179,6 +179,8 @@ static int resolve_default_seg(struct insn *insn, struct pt_regs *regs, int off) · 178 unmodified lines
179179 if (insn->addr_bytes == 2)
180180 return -EINVAL;
181181
182+ /* fall through */
183+
182184 case -EDOM:
183185 case offsetof(struct pt_regs, bx):
184186 case offsetof(struct pt_regs, si):
arch/x86/mm/cpu_entry_area.c+1−1
@@ -52,7 +52,7 @@ cea_map_percpu_pages(void *cea_vaddr, void *ptr, int pages, pgprot_t prot) · 51 unmodified lines
5252 cea_set_pte(cea_vaddr, per_cpu_ptr_to_phys(ptr), prot);
5353 }
5454
55−static void percpu_setup_debug_store(int cpu)
55+static void __init percpu_setup_debug_store(int cpu)
5656 {
5757 #ifdef CONFIG_CPU_SUP_INTEL
5858 int npages;
arch/x86/mm/dump_pagetables.c+0−2
@@ -444,7 +444,6 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, p4d_t addr, · 443 unmodified lines
444444 int i;
445445 pud_t *start, *pud_start;
446446 pgprotval_t prot, eff;
447− pud_t *prev_pud = NULL;
448447
449448 pud_start = start = (pud_t *)p4d_page_vaddr(addr);
450449
@@ -462,7 +461,6 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, p4d_t addr, · 11 unmodified lines
462461 } else
463462 note_page(m, st, __pgprot(0), 0, 3);
464463
465− prev_pud = start;
466464 start++;
467465 }
468466 }
arch/x86/mm/tlb.c+0−3
@@ -685,9 +685,6 @@ void native_flush_tlb_others(const struct cpumask *cpumask, · 684 unmodified lines
685685 * that UV should be updated so that smp_call_function_many(),
686686 * etc, are optimal on UV.
687687 */
688− unsigned int cpu;
689−
690− cpu = smp_processor_id();
691688 cpumask = uv_flush_tlb_others(cpumask, info);
692689 if (cpumask)
693690 smp_call_function_many(cpumask, flush_tlb_func_remote,
arch/x86/platform/uv/tlb_uv.c+2−6
@@ -2010,8 +2010,7 @@ static void make_per_cpu_thp(struct bau_control *smaster) · 2009 unmodified lines
20102010 int cpu;
20112011 size_t hpsz = sizeof(struct hub_and_pnode) * num_possible_cpus();
20122012
2013− smaster->thp = kmalloc_node(hpsz, GFP_KERNEL, smaster->osnode);
2014− memset(smaster->thp, 0, hpsz);
2013+ smaster->thp = kzalloc_node(hpsz, GFP_KERNEL, smaster->osnode);
20152014 for_each_present_cpu(cpu) {
20162015 smaster->thp[cpu].pnode = uv_cpu_hub_info(cpu)->pnode;
20172016 smaster->thp[cpu].uvhub = uv_cpu_hub_info(cpu)->numa_blade_id;
@@ -2135,15 +2134,12 @@ static int __init summarize_uvhub_sockets(int nuvhubs, · 117 unmodified lines
21352134 static int __init init_per_cpu(int nuvhubs, int base_part_pnode)
21362135 {
21372136 unsigned char *uvhub_mask;
2138− void *vp;
21392137 struct uvhub_desc *uvhub_descs;
21402138
21412139 if (is_uv3_hub() || is_uv2_hub() || is_uv1_hub())
21422140 timeout_us = calculate_destination_timeout();
21432141
2144− vp = kmalloc_array(nuvhubs, sizeof(struct uvhub_desc), GFP_KERNEL);
2145− uvhub_descs = (struct uvhub_desc *)vp;
2146− memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
2142+ uvhub_descs = kcalloc(nuvhubs, sizeof(struct uvhub_desc), GFP_KERNEL);
21472143 uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL);
21482144
21492145 if (get_cpu_topology(base_part_pnode, uvhub_descs, uvhub_mask))
include/linux/kprobes.h+5−0
@@ -442,6 +442,11 @@ static inline int enable_kprobe(struct kprobe *kp) · 441 unmodified lines
442442 {
443443 return -ENOSYS;
444444 }
445+
446+static inline bool within_kprobe_blacklist(unsigned long addr)
447+{
448+ return true;
449+}
445450 #endif /* CONFIG_KPROBES */
446451 static inline int disable_kretprobe(struct kretprobe *rp)
447452 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t