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

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()

+38 -55
+6 -5
arch/x86/boot/compressed/head_64.S
··· 358 358 * paging_prepare() sets up the trampoline and checks if we need to 359 359 * enable 5-level paging. 360 360 * 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. 363 366 * 364 367 * RSI holds real mode data and needs to be preserved across 365 368 * this function call. ··· 568 565 * 569 566 * RDI contains the return address (might be above 4G). 570 567 * ECX contains the base address of the trampoline memory. 571 - * Non zero RDX on return means we need to enable 5-level paging. 568 + * Non zero RDX means trampoline needs to enable 5-level paging. 572 569 */ 573 570 ENTRY(trampoline_32bit_src) 574 571 /* Set up data and stack segments */ ··· 658 655 .data 659 656 gdt64: 660 657 .word gdt_end - gdt 661 - .long 0 662 - .word 0 663 658 .quad 0 664 659 gdt: 665 660 .word gdt_end - gdt
+2
arch/x86/events/intel/core.c
··· 4220 4220 4221 4221 case INTEL_FAM6_CORE2_MEROM: 4222 4222 x86_add_quirk(intel_clovertown_quirk); 4223 + /* fall through */ 4224 + 4223 4225 case INTEL_FAM6_CORE2_MEROM_L: 4224 4226 case INTEL_FAM6_CORE2_PENRYN: 4225 4227 case INTEL_FAM6_CORE2_DUNNINGTON:
+1
arch/x86/events/intel/lbr.c
··· 931 931 ret = X86_BR_ZERO_CALL; 932 932 break; 933 933 } 934 + /* fall through */ 934 935 case 0x9a: /* call far absolute */ 935 936 ret = X86_BR_CALL; 936 937 break;
-1
arch/x86/include/asm/asm-prototypes.h
··· 7 7 8 8 #include <asm-generic/asm-prototypes.h> 9 9 10 - #include <asm/page.h> 11 10 #include <asm/pgtable.h> 12 11 #include <asm/special_insns.h> 13 12 #include <asm/preempt.h>
-1
arch/x86/include/asm/processor.h
··· 742 742 extern void enable_sep_cpu(void); 743 743 extern int sysenter_setup(void); 744 744 745 - void early_trap_pf_init(void); 746 745 747 746 /* Defined in head.S */ 748 747 extern struct desc_ptr early_gdt_descr;
-3
arch/x86/include/asm/uaccess.h
··· 34 34 } 35 35 36 36 #define segment_eq(a, b) ((a).seg == (b).seg) 37 - 38 37 #define user_addr_max() (current->thread.addr_limit.seg) 39 - #define __addr_ok(addr) \ 40 - ((unsigned long __force)(addr) < user_addr_max()) 41 38 42 39 /* 43 40 * Test whether a block of memory is a valid user space address.
+1 -1
arch/x86/kernel/acpi/wakeup_32.S
··· 90 90 .data 91 91 ALIGN 92 92 ENTRY(saved_magic) .long 0 93 - ENTRY(saved_eip) .long 0 93 + saved_eip: .long 0 94 94 95 95 # saved registers 96 96 saved_idt: .long 0,0
+6 -6
arch/x86/kernel/acpi/wakeup_64.S
··· 125 125 ENDPROC(do_suspend_lowlevel) 126 126 127 127 .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 132 132 133 - ENTRY(saved_rip) .quad 0 134 - ENTRY(saved_rsp) .quad 0 133 + saved_rip: .quad 0 134 + saved_rsp: .quad 0 135 135 136 136 ENTRY(saved_magic) .quad 0
+2
arch/x86/kernel/apic/io_apic.c
··· 812 812 return IOAPIC_POL_HIGH; 813 813 case MP_IRQPOL_RESERVED: 814 814 pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n"); 815 + /* fall through */ 815 816 case MP_IRQPOL_ACTIVE_LOW: 816 817 default: /* Pointless default required due to do gcc stupidity */ 817 818 return IOAPIC_POL_LOW; ··· 860 859 return IOAPIC_EDGE; 861 860 case MP_IRQTRIG_RESERVED: 862 861 pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n"); 862 + /* fall through */ 863 863 case MP_IRQTRIG_LEVEL: 864 864 default: /* Pointless default required due to do gcc stupidity */ 865 865 return IOAPIC_LEVEL;
+1
arch/x86/kernel/cpu/cacheinfo.c
··· 248 248 switch (leaf) { 249 249 case 1: 250 250 l1 = &l1i; 251 + /* fall through */ 251 252 case 0: 252 253 if (!l1->val) 253 254 return;
+1 -2
arch/x86/kernel/cpu/mtrr/cleanup.c
··· 296 296 unsigned long sizek) 297 297 { 298 298 unsigned long hole_basek, hole_sizek; 299 - unsigned long second_basek, second_sizek; 299 + unsigned long second_sizek; 300 300 unsigned long range0_basek, range0_sizek; 301 301 unsigned long range_basek, range_sizek; 302 302 unsigned long chunk_sizek; ··· 304 304 305 305 hole_basek = 0; 306 306 hole_sizek = 0; 307 - second_basek = 0; 308 307 second_sizek = 0; 309 308 chunk_sizek = state->chunk_sizek; 310 309 gran_sizek = state->gran_sizek;
-7
arch/x86/kernel/cpu/resctrl/pseudo_lock.c
··· 34 34 #include "pseudo_lock_event.h" 35 35 36 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 - 43 - /* 44 37 * The bits needed to disable hardware prefetching varies based on the 45 38 * platform. During initialization we will discover which bits to use. 46 39 */
+3 -6
arch/x86/kernel/e820.c
··· 671 671 int size; 672 672 673 673 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); 675 675 BUG_ON(!n); 676 - memcpy(n, e820_table, size); 677 676 e820_table = n; 678 677 679 678 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); 681 680 BUG_ON(!n); 682 - memcpy(n, e820_table_kexec, size); 683 681 e820_table_kexec = n; 684 682 685 683 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); 687 685 BUG_ON(!n); 688 - memcpy(n, e820_table_firmware, size); 689 686 e820_table_firmware = n; 690 687 } 691 688
+1 -1
arch/x86/kernel/fpu/xstate.c
··· 669 669 return false; 670 670 } 671 671 672 - static int init_xstate_size(void) 672 + static int __init init_xstate_size(void) 673 673 { 674 674 /* Recompute the context size for enabled features: */ 675 675 unsigned int possible_xstate_size;
+1 -4
arch/x86/kernel/hw_breakpoint.c
··· 261 261 * allow kernel breakpoints at all. 262 262 */ 263 263 if (attr->bp_addr >= TASK_SIZE_MAX) { 264 - #ifdef CONFIG_KPROBES 265 264 if (within_kprobe_blacklist(attr->bp_addr)) 266 265 return -EINVAL; 267 - #else 268 - return -EINVAL; 269 - #endif 270 266 } 271 267 272 268 hw->type = X86_BREAKPOINT_EXECUTE; ··· 275 279 hw->len = X86_BREAKPOINT_LEN_X; 276 280 return 0; 277 281 } 282 + /* fall through */ 278 283 default: 279 284 return -EINVAL; 280 285 }
+1
arch/x86/kernel/kgdb.c
··· 467 467 ptr = &remcomInBuffer[1]; 468 468 if (kgdb_hex2long(&ptr, &addr)) 469 469 linux_regs->ip = addr; 470 + /* fall through */ 470 471 case 'D': 471 472 case 'k': 472 473 /* clear the trace bit */
+1 -6
arch/x86/kernel/smpboot.c
··· 150 150 */ 151 151 static void smp_callin(void) 152 152 { 153 - int cpuid, phys_id; 153 + int cpuid; 154 154 155 155 /* 156 156 * If waken up by an INIT in an 82489DX configuration ··· 159 159 * now safe to touch our local APIC. 160 160 */ 161 161 cpuid = smp_processor_id(); 162 - 163 - /* 164 - * (This works even if the APIC is not enabled.) 165 - */ 166 - phys_id = read_apic_id(); 167 162 168 163 /* 169 164 * the boot CPU has finished the init stage and is spinning
+1
arch/x86/kernel/uprobes.c
··· 745 745 * OPCODE1() of the "short" jmp which checks the same condition. 746 746 */ 747 747 opc1 = OPCODE2(insn) - 0x10; 748 + /* fall through */ 748 749 default: 749 750 if (!is_cond_jmp_opcode(opc1)) 750 751 return -ENOSYS;
+2
arch/x86/lib/insn-eval.c
··· 179 179 if (insn->addr_bytes == 2) 180 180 return -EINVAL; 181 181 182 + /* fall through */ 183 + 182 184 case -EDOM: 183 185 case offsetof(struct pt_regs, bx): 184 186 case offsetof(struct pt_regs, si):
+1 -1
arch/x86/mm/cpu_entry_area.c
··· 52 52 cea_set_pte(cea_vaddr, per_cpu_ptr_to_phys(ptr), prot); 53 53 } 54 54 55 - static void percpu_setup_debug_store(int cpu) 55 + static void __init percpu_setup_debug_store(int cpu) 56 56 { 57 57 #ifdef CONFIG_CPU_SUP_INTEL 58 58 int npages;
-2
arch/x86/mm/dump_pagetables.c
··· 444 444 int i; 445 445 pud_t *start, *pud_start; 446 446 pgprotval_t prot, eff; 447 - pud_t *prev_pud = NULL; 448 447 449 448 pud_start = start = (pud_t *)p4d_page_vaddr(addr); 450 449 ··· 461 462 } else 462 463 note_page(m, st, __pgprot(0), 0, 3); 463 464 464 - prev_pud = start; 465 465 start++; 466 466 } 467 467 }
-3
arch/x86/mm/tlb.c
··· 685 685 * that UV should be updated so that smp_call_function_many(), 686 686 * etc, are optimal on UV. 687 687 */ 688 - unsigned int cpu; 689 - 690 - cpu = smp_processor_id(); 691 688 cpumask = uv_flush_tlb_others(cpumask, info); 692 689 if (cpumask) 693 690 smp_call_function_many(cpumask, flush_tlb_func_remote,
+2 -6
arch/x86/platform/uv/tlb_uv.c
··· 2010 2010 int cpu; 2011 2011 size_t hpsz = sizeof(struct hub_and_pnode) * num_possible_cpus(); 2012 2012 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); 2015 2014 for_each_present_cpu(cpu) { 2016 2015 smaster->thp[cpu].pnode = uv_cpu_hub_info(cpu)->pnode; 2017 2016 smaster->thp[cpu].uvhub = uv_cpu_hub_info(cpu)->numa_blade_id; ··· 2134 2135 static int __init init_per_cpu(int nuvhubs, int base_part_pnode) 2135 2136 { 2136 2137 unsigned char *uvhub_mask; 2137 - void *vp; 2138 2138 struct uvhub_desc *uvhub_descs; 2139 2139 2140 2140 if (is_uv3_hub() || is_uv2_hub() || is_uv1_hub()) 2141 2141 timeout_us = calculate_destination_timeout(); 2142 2142 2143 - vp = kmalloc_array(nuvhubs, sizeof(struct uvhub_desc), GFP_KERNEL); 2144 - uvhub_descs = (struct uvhub_desc *)vp; 2145 - memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc)); 2143 + uvhub_descs = kcalloc(nuvhubs, sizeof(struct uvhub_desc), GFP_KERNEL); 2146 2144 uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL); 2147 2145 2148 2146 if (get_cpu_topology(base_part_pnode, uvhub_descs, uvhub_mask))
+5
include/linux/kprobes.h
··· 442 442 { 443 443 return -ENOSYS; 444 444 } 445 + 446 + static inline bool within_kprobe_blacklist(unsigned long addr) 447 + { 448 + return true; 449 + } 445 450 #endif /* CONFIG_KPROBES */ 446 451 static inline int disable_kretprobe(struct kretprobe *rp) 447 452 {