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

Merge branch 'for_linus' into for_next

Jan Kara 1cd6b7be a3942700

+2661 -1584
+1
.mailmap
··· 51 51 Greg Kroah-Hartman <greg@kroah.com> 52 52 Henk Vergonet <Henk.Vergonet@gmail.com> 53 53 Henrik Kretzschmar <henne@nachtwindheim.de> 54 + Henrik Rydberg <rydberg@bitmath.org> 54 55 Herbert Xu <herbert@gondor.apana.org.au> 55 56 Jacob Shin <Jacob.Shin@amd.com> 56 57 James Bottomley <jejb@mulgrave.(none)>
+12 -37
Documentation/target/tcm_mod_builder.py
··· 389 389 buf += " .release_cmd = " + fabric_mod_name + "_release_cmd,\n" 390 390 buf += " .shutdown_session = " + fabric_mod_name + "_shutdown_session,\n" 391 391 buf += " .close_session = " + fabric_mod_name + "_close_session,\n" 392 - buf += " .stop_session = " + fabric_mod_name + "_stop_session,\n" 393 - buf += " .fall_back_to_erl0 = " + fabric_mod_name + "_reset_nexus,\n" 394 - buf += " .sess_logged_in = " + fabric_mod_name + "_sess_logged_in,\n" 395 392 buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n" 396 393 buf += " .sess_get_initiator_sid = NULL,\n" 397 394 buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n" ··· 399 402 buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n" 400 403 buf += " .queue_status = " + fabric_mod_name + "_queue_status,\n" 401 404 buf += " .queue_tm_rsp = " + fabric_mod_name + "_queue_tm_rsp,\n" 402 - buf += " .is_state_remove = " + fabric_mod_name + "_is_state_remove,\n" 405 + buf += " .aborted_task = " + fabric_mod_name + "_aborted_task,\n" 403 406 buf += " /*\n" 404 407 buf += " * Setup function pointers for generic logic in target_core_fabric_configfs.c\n" 405 408 buf += " */\n" ··· 425 428 buf += " /*\n" 426 429 buf += " * Register the top level struct config_item_type with TCM core\n" 427 430 buf += " */\n" 428 - buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name[4:] + "\");\n" 431 + buf += " fabric = target_fabric_configfs_init(THIS_MODULE, \"" + fabric_mod_name + "\");\n" 429 432 buf += " if (IS_ERR(fabric)) {\n" 430 433 buf += " printk(KERN_ERR \"target_fabric_configfs_init() failed\\n\");\n" 431 434 buf += " return PTR_ERR(fabric);\n" ··· 592 595 if re.search('get_fabric_name', fo): 593 596 buf += "char *" + fabric_mod_name + "_get_fabric_name(void)\n" 594 597 buf += "{\n" 595 - buf += " return \"" + fabric_mod_name[4:] + "\";\n" 598 + buf += " return \"" + fabric_mod_name + "\";\n" 596 599 buf += "}\n\n" 597 600 bufi += "char *" + fabric_mod_name + "_get_fabric_name(void);\n" 598 601 continue ··· 817 820 buf += "}\n\n" 818 821 bufi += "void " + fabric_mod_name + "_close_session(struct se_session *);\n" 819 822 820 - if re.search('stop_session\)\(', fo): 821 - buf += "void " + fabric_mod_name + "_stop_session(struct se_session *se_sess, int sess_sleep , int conn_sleep)\n" 822 - buf += "{\n" 823 - buf += " return;\n" 824 - buf += "}\n\n" 825 - bufi += "void " + fabric_mod_name + "_stop_session(struct se_session *, int, int);\n" 826 - 827 - if re.search('fall_back_to_erl0\)\(', fo): 828 - buf += "void " + fabric_mod_name + "_reset_nexus(struct se_session *se_sess)\n" 829 - buf += "{\n" 830 - buf += " return;\n" 831 - buf += "}\n\n" 832 - bufi += "void " + fabric_mod_name + "_reset_nexus(struct se_session *);\n" 833 - 834 - if re.search('sess_logged_in\)\(', fo): 835 - buf += "int " + fabric_mod_name + "_sess_logged_in(struct se_session *se_sess)\n" 836 - buf += "{\n" 837 - buf += " return 0;\n" 838 - buf += "}\n\n" 839 - bufi += "int " + fabric_mod_name + "_sess_logged_in(struct se_session *);\n" 840 - 841 823 if re.search('sess_get_index\)\(', fo): 842 824 buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n" 843 825 buf += "{\n" ··· 874 898 bufi += "int " + fabric_mod_name + "_queue_status(struct se_cmd *);\n" 875 899 876 900 if re.search('queue_tm_rsp\)\(', fo): 877 - buf += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n" 901 + buf += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *se_cmd)\n" 878 902 buf += "{\n" 879 - buf += " return 0;\n" 903 + buf += " return;\n" 880 904 buf += "}\n\n" 881 - bufi += "int " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n" 905 + bufi += "void " + fabric_mod_name + "_queue_tm_rsp(struct se_cmd *);\n" 882 906 883 - if re.search('is_state_remove\)\(', fo): 884 - buf += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *se_cmd)\n" 907 + if re.search('aborted_task\)\(', fo): 908 + buf += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *se_cmd)\n" 885 909 buf += "{\n" 886 - buf += " return 0;\n" 910 + buf += " return;\n" 887 911 buf += "}\n\n" 888 - bufi += "int " + fabric_mod_name + "_is_state_remove(struct se_cmd *);\n" 889 - 912 + bufi += "void " + fabric_mod_name + "_aborted_task(struct se_cmd *);\n" 890 913 891 914 ret = p.write(buf) 892 915 if ret: ··· 993 1018 tcm_mod_build_kbuild(fabric_mod_dir, fabric_mod_name) 994 1019 tcm_mod_build_kconfig(fabric_mod_dir, fabric_mod_name) 995 1020 996 - input = raw_input("Would you like to add " + fabric_mod_name + "to drivers/target/Makefile..? [yes,no]: ") 1021 + input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Makefile..? [yes,no]: ") 997 1022 if input == "yes" or input == "y": 998 1023 tcm_mod_add_kbuild(tcm_dir, fabric_mod_name) 999 1024 1000 - input = raw_input("Would you like to add " + fabric_mod_name + "to drivers/target/Kconfig..? [yes,no]: ") 1025 + input = raw_input("Would you like to add " + fabric_mod_name + " to drivers/target/Kconfig..? [yes,no]: ") 1001 1026 if input == "yes" or input == "y": 1002 1027 tcm_mod_add_kconfig(tcm_dir, fabric_mod_name) 1003 1028
+16 -6
MAINTAINERS
··· 724 724 F: drivers/char/apm-emulation.c 725 725 726 726 APPLE BCM5974 MULTITOUCH DRIVER 727 - M: Henrik Rydberg <rydberg@euromail.se> 727 + M: Henrik Rydberg <rydberg@bitmath.org> 728 728 L: linux-input@vger.kernel.org 729 - S: Maintained 729 + S: Odd fixes 730 730 F: drivers/input/mouse/bcm5974.c 731 731 732 732 APPLE SMC DRIVER 733 - M: Henrik Rydberg <rydberg@euromail.se> 733 + M: Henrik Rydberg <rydberg@bitmath.org> 734 734 L: lm-sensors@lm-sensors.org 735 - S: Maintained 735 + S: Odd fixes 736 736 F: drivers/hwmon/applesmc.c 737 737 738 738 APPLETALK NETWORK LAYER ··· 2259 2259 BTRFS FILE SYSTEM 2260 2260 M: Chris Mason <clm@fb.com> 2261 2261 M: Josef Bacik <jbacik@fb.com> 2262 + M: David Sterba <dsterba@suse.cz> 2262 2263 L: linux-btrfs@vger.kernel.org 2263 2264 W: http://btrfs.wiki.kernel.org/ 2264 2265 Q: http://patchwork.kernel.org/project/linux-btrfs/list/ ··· 4941 4940 F: include/linux/input/ 4942 4941 4943 4942 INPUT MULTITOUCH (MT) PROTOCOL 4944 - M: Henrik Rydberg <rydberg@euromail.se> 4943 + M: Henrik Rydberg <rydberg@bitmath.org> 4945 4944 L: linux-input@vger.kernel.org 4946 4945 T: git git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt.git 4947 - S: Maintained 4946 + S: Odd fixes 4948 4947 F: Documentation/input/multi-touch-protocol.txt 4949 4948 F: drivers/input/input-mt.c 4950 4949 K: \b(ABS|SYN)_MT_ ··· 5279 5278 W: www.open-iscsi.org 5280 5279 Q: http://patchwork.kernel.org/project/linux-rdma/list/ 5281 5280 F: drivers/infiniband/ulp/iser/ 5281 + 5282 + ISCSI EXTENSIONS FOR RDMA (ISER) TARGET 5283 + M: Sagi Grimberg <sagig@mellanox.com> 5284 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master 5285 + L: linux-rdma@vger.kernel.org 5286 + L: target-devel@vger.kernel.org 5287 + S: Supported 5288 + W: http://www.linux-iscsi.org 5289 + F: drivers/infiniband/ulp/isert 5282 5290 5283 5291 ISDN SUBSYSTEM 5284 5292 M: Karsten Keil <isdn@linux-pingi.de>
+2 -1
Makefile
··· 1 1 VERSION = 3 2 2 PATCHLEVEL = 19 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc2 4 + EXTRAVERSION = -rc4 5 5 NAME = Diseased Newt 6 6 7 7 # *DOCUMENTATION* ··· 391 391 # Needed to be compatible with the O= option 392 392 LINUXINCLUDE := \ 393 393 -I$(srctree)/arch/$(hdr-arch)/include \ 394 + -Iarch/$(hdr-arch)/include/generated/uapi \ 394 395 -Iarch/$(hdr-arch)/include/generated \ 395 396 $(if $(KBUILD_SRC), -I$(srctree)/include) \ 396 397 -Iinclude \
+1
arch/arm/include/uapi/asm/unistd.h
··· 413 413 #define __NR_getrandom (__NR_SYSCALL_BASE+384) 414 414 #define __NR_memfd_create (__NR_SYSCALL_BASE+385) 415 415 #define __NR_bpf (__NR_SYSCALL_BASE+386) 416 + #define __NR_execveat (__NR_SYSCALL_BASE+387) 416 417 417 418 /* 418 419 * The following SWIs are ARM private.
+1
arch/arm/kernel/calls.S
··· 396 396 CALL(sys_getrandom) 397 397 /* 385 */ CALL(sys_memfd_create) 398 398 CALL(sys_bpf) 399 + CALL(sys_execveat) 399 400 #ifndef syscalls_counted 400 401 .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 401 402 #define syscalls_counted
+8
arch/arm/kernel/perf_regs.c
··· 28 28 { 29 29 return PERF_SAMPLE_REGS_ABI_32; 30 30 } 31 + 32 + void perf_get_regs_user(struct perf_regs *regs_user, 33 + struct pt_regs *regs, 34 + struct pt_regs *regs_user_copy) 35 + { 36 + regs_user->regs = task_pt_regs(current); 37 + regs_user->abi = perf_reg_abi(current); 38 + }
+2 -7
arch/arm/mm/dump.c
··· 220 220 static const char units[] = "KMGTPE"; 221 221 u64 prot = val & pg_level[level].mask; 222 222 223 - if (addr < USER_PGTABLES_CEILING) 224 - return; 225 - 226 223 if (!st->level) { 227 224 st->level = level; 228 225 st->current_prot = prot; ··· 305 308 pgd_t *pgd = swapper_pg_dir; 306 309 struct pg_state st; 307 310 unsigned long addr; 308 - unsigned i, pgdoff = USER_PGTABLES_CEILING / PGDIR_SIZE; 311 + unsigned i; 309 312 310 313 memset(&st, 0, sizeof(st)); 311 314 st.seq = m; 312 315 st.marker = address_markers; 313 316 314 - pgd += pgdoff; 315 - 316 - for (i = pgdoff; i < PTRS_PER_PGD; i++, pgd++) { 317 + for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { 317 318 addr = i * PGDIR_SIZE; 318 319 if (!pgd_none(*pgd)) { 319 320 walk_pud(&st, pgd, addr);
+2 -2
arch/arm/mm/init.c
··· 658 658 .start = (unsigned long)_stext, 659 659 .end = (unsigned long)__init_begin, 660 660 #ifdef CONFIG_ARM_LPAE 661 - .mask = ~PMD_SECT_RDONLY, 662 - .prot = PMD_SECT_RDONLY, 661 + .mask = ~L_PMD_SECT_RDONLY, 662 + .prot = L_PMD_SECT_RDONLY, 663 663 #else 664 664 .mask = ~(PMD_SECT_APX | PMD_SECT_AP_WRITE), 665 665 .prot = PMD_SECT_APX | PMD_SECT_AP_WRITE,
+2 -2
arch/arm/mm/mmu.c
··· 1329 1329 static void __init map_lowmem(void) 1330 1330 { 1331 1331 struct memblock_region *reg; 1332 - unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); 1333 - unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); 1332 + phys_addr_t kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); 1333 + phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); 1334 1334 1335 1335 /* Map all the lowmem memory banks. */ 1336 1336 for_each_memblock(memory, reg) {
+1
arch/arm64/include/asm/arch_timer.h
··· 21 21 22 22 #include <asm/barrier.h> 23 23 24 + #include <linux/bug.h> 24 25 #include <linux/init.h> 25 26 #include <linux/types.h> 26 27
+5
arch/arm64/include/asm/cpu.h
··· 39 39 u64 reg_id_aa64pfr0; 40 40 u64 reg_id_aa64pfr1; 41 41 42 + u32 reg_id_dfr0; 42 43 u32 reg_id_isar0; 43 44 u32 reg_id_isar1; 44 45 u32 reg_id_isar2; ··· 52 51 u32 reg_id_mmfr3; 53 52 u32 reg_id_pfr0; 54 53 u32 reg_id_pfr1; 54 + 55 + u32 reg_mvfr0; 56 + u32 reg_mvfr1; 57 + u32 reg_mvfr2; 55 58 }; 56 59 57 60 DECLARE_PER_CPU(struct cpuinfo_arm64, cpu_data);
+1 -3
arch/arm64/include/asm/processor.h
··· 31 31 32 32 #include <asm/fpsimd.h> 33 33 #include <asm/hw_breakpoint.h> 34 + #include <asm/pgtable-hwdef.h> 34 35 #include <asm/ptrace.h> 35 36 #include <asm/types.h> 36 37 ··· 123 122 124 123 /* Free all resources held by a thread. */ 125 124 extern void release_thread(struct task_struct *); 126 - 127 - /* Prepare to copy thread state - unlazy all lazy status */ 128 - #define prepare_to_copy(tsk) do { } while (0) 129 125 130 126 unsigned long get_wchan(struct task_struct *p); 131 127
+1 -1
arch/arm64/include/asm/unistd.h
··· 44 44 #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) 45 45 #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) 46 46 47 - #define __NR_compat_syscalls 386 47 + #define __NR_compat_syscalls 387 48 48 #endif 49 49 50 50 #define __ARCH_WANT_SYS_CLONE
+10
arch/arm64/kernel/cpuinfo.c
··· 147 147 * If we have AArch32, we care about 32-bit features for compat. These 148 148 * registers should be RES0 otherwise. 149 149 */ 150 + diff |= CHECK(id_dfr0, boot, cur, cpu); 150 151 diff |= CHECK(id_isar0, boot, cur, cpu); 151 152 diff |= CHECK(id_isar1, boot, cur, cpu); 152 153 diff |= CHECK(id_isar2, boot, cur, cpu); ··· 165 164 diff |= CHECK(id_mmfr3, boot, cur, cpu); 166 165 diff |= CHECK(id_pfr0, boot, cur, cpu); 167 166 diff |= CHECK(id_pfr1, boot, cur, cpu); 167 + 168 + diff |= CHECK(mvfr0, boot, cur, cpu); 169 + diff |= CHECK(mvfr1, boot, cur, cpu); 170 + diff |= CHECK(mvfr2, boot, cur, cpu); 168 171 169 172 /* 170 173 * Mismatched CPU features are a recipe for disaster. Don't even ··· 194 189 info->reg_id_aa64pfr0 = read_cpuid(ID_AA64PFR0_EL1); 195 190 info->reg_id_aa64pfr1 = read_cpuid(ID_AA64PFR1_EL1); 196 191 192 + info->reg_id_dfr0 = read_cpuid(ID_DFR0_EL1); 197 193 info->reg_id_isar0 = read_cpuid(ID_ISAR0_EL1); 198 194 info->reg_id_isar1 = read_cpuid(ID_ISAR1_EL1); 199 195 info->reg_id_isar2 = read_cpuid(ID_ISAR2_EL1); ··· 207 201 info->reg_id_mmfr3 = read_cpuid(ID_MMFR3_EL1); 208 202 info->reg_id_pfr0 = read_cpuid(ID_PFR0_EL1); 209 203 info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1); 204 + 205 + info->reg_mvfr0 = read_cpuid(MVFR0_EL1); 206 + info->reg_mvfr1 = read_cpuid(MVFR1_EL1); 207 + info->reg_mvfr2 = read_cpuid(MVFR2_EL1); 210 208 211 209 cpuinfo_detect_icache_policy(info); 212 210
+1 -1
arch/arm64/kernel/efi.c
··· 326 326 327 327 /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ 328 328 efi_setup_idmap(); 329 + early_memunmap(memmap.map, memmap.map_end - memmap.map); 329 330 } 330 331 331 332 static int __init remap_region(efi_memory_desc_t *md, void **new) ··· 381 380 } 382 381 383 382 mapsize = memmap.map_end - memmap.map; 384 - early_memunmap(memmap.map, mapsize); 385 383 386 384 if (efi_runtime_disabled()) { 387 385 pr_info("EFI runtime services will be disabled.\n");
+1
arch/arm64/kernel/module.c
··· 25 25 #include <linux/mm.h> 26 26 #include <linux/moduleloader.h> 27 27 #include <linux/vmalloc.h> 28 + #include <asm/alternative.h> 28 29 #include <asm/insn.h> 29 30 #include <asm/sections.h> 30 31
+8
arch/arm64/kernel/perf_regs.c
··· 50 50 else 51 51 return PERF_SAMPLE_REGS_ABI_64; 52 52 } 53 + 54 + void perf_get_regs_user(struct perf_regs *regs_user, 55 + struct pt_regs *regs, 56 + struct pt_regs *regs_user_copy) 57 + { 58 + regs_user->regs = task_pt_regs(current); 59 + regs_user->abi = perf_reg_abi(current); 60 + }
+1
arch/arm64/kernel/setup.c
··· 402 402 request_standard_resources(); 403 403 404 404 efi_idmap_init(); 405 + early_ioremap_reset(); 405 406 406 407 unflatten_device_tree(); 407 408
+1
arch/arm64/kernel/smp_spin_table.c
··· 25 25 #include <asm/cacheflush.h> 26 26 #include <asm/cpu_ops.h> 27 27 #include <asm/cputype.h> 28 + #include <asm/io.h> 28 29 #include <asm/smp_plat.h> 29 30 30 31 extern void secondary_holding_pen(void);
+1
arch/blackfin/mach-bf533/boards/stamp.c
··· 7 7 */ 8 8 9 9 #include <linux/device.h> 10 + #include <linux/delay.h> 10 11 #include <linux/platform_device.h> 11 12 #include <linux/mtd/mtd.h> 12 13 #include <linux/mtd/partitions.h>
+1 -1
arch/ia64/include/asm/unistd.h
··· 11 11 12 12 13 13 14 - #define NR_syscalls 318 /* length of syscall table */ 14 + #define NR_syscalls 319 /* length of syscall table */ 15 15 16 16 /* 17 17 * The following defines stop scripts/checksyscalls.sh from complaining about
+1
arch/ia64/include/uapi/asm/unistd.h
··· 331 331 #define __NR_getrandom 1339 332 332 #define __NR_memfd_create 1340 333 333 #define __NR_bpf 1341 334 + #define __NR_execveat 1342 334 335 335 336 #endif /* _UAPI_ASM_IA64_UNISTD_H */
+4 -5
arch/ia64/kernel/acpi.c
··· 893 893 } 894 894 895 895 /* wrapper to silence section mismatch warning */ 896 - int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) 896 + int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu) 897 897 { 898 898 return _acpi_map_lsapic(handle, physid, pcpu); 899 899 } 900 - EXPORT_SYMBOL(acpi_map_lsapic); 900 + EXPORT_SYMBOL(acpi_map_cpu); 901 901 902 - int acpi_unmap_lsapic(int cpu) 902 + int acpi_unmap_cpu(int cpu) 903 903 { 904 904 ia64_cpu_to_sapicid[cpu] = -1; 905 905 set_cpu_present(cpu, false); ··· 910 910 911 911 return (0); 912 912 } 913 - 914 - EXPORT_SYMBOL(acpi_unmap_lsapic); 913 + EXPORT_SYMBOL(acpi_unmap_cpu); 915 914 #endif /* CONFIG_ACPI_HOTPLUG_CPU */ 916 915 917 916 #ifdef CONFIG_ACPI_NUMA
+1
arch/ia64/kernel/entry.S
··· 1779 1779 data8 sys_getrandom 1780 1780 data8 sys_memfd_create // 1340 1781 1781 data8 sys_bpf 1782 + data8 sys_execveat 1782 1783 1783 1784 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1784 1785 #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
+10
arch/powerpc/include/asm/kexec.h
··· 86 86 extern void reserve_crashkernel(void); 87 87 extern void machine_kexec_mask_interrupts(void); 88 88 89 + static inline bool kdump_in_progress(void) 90 + { 91 + return crashing_cpu >= 0; 92 + } 93 + 89 94 #else /* !CONFIG_KEXEC */ 90 95 static inline void crash_kexec_secondary(struct pt_regs *regs) { } 91 96 ··· 109 104 static inline int crash_shutdown_unregister(crash_shutdown_t handler) 110 105 { 111 106 return 0; 107 + } 108 + 109 + static inline bool kdump_in_progress(void) 110 + { 111 + return false; 112 112 } 113 113 114 114 #endif /* CONFIG_KEXEC */
+1
arch/powerpc/include/asm/systbl.h
··· 366 366 SYSCALL_SPU(getrandom) 367 367 SYSCALL_SPU(memfd_create) 368 368 SYSCALL_SPU(bpf) 369 + COMPAT_SYS(execveat)
+1 -1
arch/powerpc/include/asm/unistd.h
··· 12 12 #include <uapi/asm/unistd.h> 13 13 14 14 15 - #define __NR_syscalls 362 15 + #define __NR_syscalls 363 16 16 17 17 #define __NR__exit __NR_exit 18 18 #define NR_syscalls __NR_syscalls
+1
arch/powerpc/include/uapi/asm/unistd.h
··· 384 384 #define __NR_getrandom 359 385 385 #define __NR_memfd_create 360 386 386 #define __NR_bpf 361 387 + #define __NR_execveat 362 387 388 388 389 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
+1 -1
arch/powerpc/kernel/machine_kexec_64.c
··· 330 330 * using debugger IPI. 331 331 */ 332 332 333 - if (crashing_cpu == -1) 333 + if (!kdump_in_progress()) 334 334 kexec_prepare_cpus(); 335 335 336 336 pr_debug("kexec: Starting switchover sequence.\n");
+1 -8
arch/powerpc/kernel/smp.c
··· 700 700 smp_store_cpu_info(cpu); 701 701 set_dec(tb_ticks_per_jiffy); 702 702 preempt_disable(); 703 + cpu_callin_map[cpu] = 1; 703 704 704 705 if (smp_ops->setup_cpu) 705 706 smp_ops->setup_cpu(cpu); ··· 738 737 smp_wmb(); 739 738 notify_cpu_starting(cpu); 740 739 set_cpu_online(cpu, true); 741 - 742 - /* 743 - * CPU must be marked active and online before we signal back to the 744 - * master, because the scheduler needs to see the cpu_online and 745 - * cpu_active bits set. 746 - */ 747 - smp_wmb(); 748 - cpu_callin_map[cpu] = 1; 749 740 750 741 local_irq_enable(); 751 742
+7 -1
arch/powerpc/platforms/pseries/lpar.c
··· 43 43 #include <asm/trace.h> 44 44 #include <asm/firmware.h> 45 45 #include <asm/plpar_wrappers.h> 46 + #include <asm/kexec.h> 46 47 #include <asm/fadump.h> 47 48 48 49 #include "pseries.h" ··· 268 267 * out to the user, but at least this will stop us from 269 268 * continuing on further and creating an even more 270 269 * difficult to debug situation. 270 + * 271 + * There is a known problem when kdump'ing, if cpus are offline 272 + * the above call will fail. Rather than panicking again, keep 273 + * going and hope the kdump kernel is also little endian, which 274 + * it usually is. 271 275 */ 272 - if (rc) 276 + if (rc && !kdump_in_progress()) 273 277 panic("Could not enable big endian exceptions"); 274 278 } 275 279 #endif
+1
arch/x86/boot/Makefile
··· 51 51 $(obj)/cpustr.h: $(obj)/mkcpustr FORCE 52 52 $(call if_changed,cpustr) 53 53 endif 54 + clean-files += cpustr.h 54 55 55 56 # --------------------------------------------------------------------------- 56 57
+1 -1
arch/x86/crypto/Makefile
··· 26 26 27 27 obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o 28 28 obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o 29 - obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/ 30 29 obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o 31 30 obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o 32 31 obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o ··· 45 46 ifeq ($(avx2_supported),yes) 46 47 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o 47 48 obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o 49 + obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/ 48 50 endif 49 51 50 52 aes-i586-y := aes-i586-asm_32.o aes_glue.o
+35 -11
arch/x86/crypto/aes_ctrby8_avx-x86_64.S
··· 208 208 209 209 .if (klen == KEY_128) 210 210 .if (load_keys) 211 - vmovdqa 3*16(p_keys), xkeyA 211 + vmovdqa 3*16(p_keys), xkey4 212 212 .endif 213 213 .else 214 214 vmovdqa 3*16(p_keys), xkeyA ··· 224 224 add $(16*by), p_in 225 225 226 226 .if (klen == KEY_128) 227 - vmovdqa 4*16(p_keys), xkey4 227 + vmovdqa 4*16(p_keys), xkeyB 228 228 .else 229 229 .if (load_keys) 230 230 vmovdqa 4*16(p_keys), xkey4 ··· 234 234 .set i, 0 235 235 .rept by 236 236 club XDATA, i 237 - vaesenc xkeyA, var_xdata, var_xdata /* key 3 */ 237 + /* key 3 */ 238 + .if (klen == KEY_128) 239 + vaesenc xkey4, var_xdata, var_xdata 240 + .else 241 + vaesenc xkeyA, var_xdata, var_xdata 242 + .endif 238 243 .set i, (i +1) 239 244 .endr 240 245 ··· 248 243 .set i, 0 249 244 .rept by 250 245 club XDATA, i 251 - vaesenc xkey4, var_xdata, var_xdata /* key 4 */ 246 + /* key 4 */ 247 + .if (klen == KEY_128) 248 + vaesenc xkeyB, var_xdata, var_xdata 249 + .else 250 + vaesenc xkey4, var_xdata, var_xdata 251 + .endif 252 252 .set i, (i +1) 253 253 .endr 254 254 255 255 .if (klen == KEY_128) 256 256 .if (load_keys) 257 - vmovdqa 6*16(p_keys), xkeyB 257 + vmovdqa 6*16(p_keys), xkey8 258 258 .endif 259 259 .else 260 260 vmovdqa 6*16(p_keys), xkeyB ··· 277 267 .set i, 0 278 268 .rept by 279 269 club XDATA, i 280 - vaesenc xkeyB, var_xdata, var_xdata /* key 6 */ 270 + /* key 6 */ 271 + .if (klen == KEY_128) 272 + vaesenc xkey8, var_xdata, var_xdata 273 + .else 274 + vaesenc xkeyB, var_xdata, var_xdata 275 + .endif 281 276 .set i, (i +1) 282 277 .endr 283 278 284 279 .if (klen == KEY_128) 285 - vmovdqa 8*16(p_keys), xkey8 280 + vmovdqa 8*16(p_keys), xkeyB 286 281 .else 287 282 .if (load_keys) 288 283 vmovdqa 8*16(p_keys), xkey8 ··· 303 288 304 289 .if (klen == KEY_128) 305 290 .if (load_keys) 306 - vmovdqa 9*16(p_keys), xkeyA 291 + vmovdqa 9*16(p_keys), xkey12 307 292 .endif 308 293 .else 309 294 vmovdqa 9*16(p_keys), xkeyA ··· 312 297 .set i, 0 313 298 .rept by 314 299 club XDATA, i 315 - vaesenc xkey8, var_xdata, var_xdata /* key 8 */ 300 + /* key 8 */ 301 + .if (klen == KEY_128) 302 + vaesenc xkeyB, var_xdata, var_xdata 303 + .else 304 + vaesenc xkey8, var_xdata, var_xdata 305 + .endif 316 306 .set i, (i +1) 317 307 .endr 318 308 ··· 326 306 .set i, 0 327 307 .rept by 328 308 club XDATA, i 329 - vaesenc xkeyA, var_xdata, var_xdata /* key 9 */ 309 + /* key 9 */ 310 + .if (klen == KEY_128) 311 + vaesenc xkey12, var_xdata, var_xdata 312 + .else 313 + vaesenc xkeyA, var_xdata, var_xdata 314 + .endif 330 315 .set i, (i +1) 331 316 .endr 332 317 ··· 437 412 /* main body of aes ctr load */ 438 413 439 414 .macro do_aes_ctrmain key_len 440 - 441 415 cmp $16, num_bytes 442 416 jb .Ldo_return2\key_len 443 417
+4 -2
arch/x86/include/asm/vgtod.h
··· 80 80 81 81 /* 82 82 * Load per CPU data from GDT. LSL is faster than RDTSCP and 83 - * works on all CPUs. 83 + * works on all CPUs. This is volatile so that it orders 84 + * correctly wrt barrier() and to keep gcc from cleverly 85 + * hoisting it out of the calling function. 84 86 */ 85 - asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 87 + asm volatile ("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 86 88 87 89 return p; 88 90 }
+4 -5
arch/x86/kernel/acpi/boot.c
··· 750 750 } 751 751 752 752 /* wrapper to silence section mismatch warning */ 753 - int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) 753 + int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu) 754 754 { 755 755 return _acpi_map_lsapic(handle, physid, pcpu); 756 756 } 757 - EXPORT_SYMBOL(acpi_map_lsapic); 757 + EXPORT_SYMBOL(acpi_map_cpu); 758 758 759 - int acpi_unmap_lsapic(int cpu) 759 + int acpi_unmap_cpu(int cpu) 760 760 { 761 761 #ifdef CONFIG_ACPI_NUMA 762 762 set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE); ··· 768 768 769 769 return (0); 770 770 } 771 - 772 - EXPORT_SYMBOL(acpi_unmap_lsapic); 771 + EXPORT_SYMBOL(acpi_unmap_cpu); 773 772 #endif /* CONFIG_ACPI_HOTPLUG_CPU */ 774 773 775 774 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
+1
arch/x86/kernel/cpu/Makefile
··· 66 66 $(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE 67 67 $(call if_changed,mkcapflags) 68 68 endif 69 + clean-files += capflags.c
+1 -1
arch/x86/kernel/cpu/mkcapflags.sh
··· 28 28 # If the /* comment */ starts with a quote string, grab that. 29 29 VALUE="$(echo "$i" | sed -n 's@.*/\* *\("[^"]*"\).*\*/@\1@p')" 30 30 [ -z "$VALUE" ] && VALUE="\"$NAME\"" 31 - [ "$VALUE" == '""' ] && continue 31 + [ "$VALUE" = '""' ] && continue 32 32 33 33 # Name is uppercase, VALUE is all lowercase 34 34 VALUE="$(echo "$VALUE" | tr A-Z a-z)"
+1 -1
arch/x86/kernel/cpu/perf_event_intel_uncore.h
··· 17 17 #define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff) 18 18 #define UNCORE_PCI_DEV_IDX(data) (data & 0xff) 19 19 #define UNCORE_EXTRA_PCI_DEV 0xff 20 - #define UNCORE_EXTRA_PCI_DEV_MAX 2 20 + #define UNCORE_EXTRA_PCI_DEV_MAX 3 21 21 22 22 /* support up to 8 sockets */ 23 23 #define UNCORE_SOCKET_MAX 8
+17
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
··· 891 891 enum { 892 892 SNBEP_PCI_QPI_PORT0_FILTER, 893 893 SNBEP_PCI_QPI_PORT1_FILTER, 894 + HSWEP_PCI_PCU_3, 894 895 }; 895 896 896 897 static int snbep_qpi_hw_config(struct intel_uncore_box *box, struct perf_event *event) ··· 2027 2026 { 2028 2027 if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) 2029 2028 hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; 2029 + 2030 + /* Detect 6-8 core systems with only two SBOXes */ 2031 + if (uncore_extra_pci_dev[0][HSWEP_PCI_PCU_3]) { 2032 + u32 capid4; 2033 + 2034 + pci_read_config_dword(uncore_extra_pci_dev[0][HSWEP_PCI_PCU_3], 2035 + 0x94, &capid4); 2036 + if (((capid4 >> 6) & 0x3) == 0) 2037 + hswep_uncore_sbox.num_boxes = 2; 2038 + } 2039 + 2030 2040 uncore_msr_uncores = hswep_msr_uncores; 2031 2041 } 2032 2042 ··· 2298 2286 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2f96), 2299 2287 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2300 2288 SNBEP_PCI_QPI_PORT1_FILTER), 2289 + }, 2290 + { /* PCU.3 (for Capability registers) */ 2291 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fc0), 2292 + .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2293 + HSWEP_PCI_PCU_3), 2301 2294 }, 2302 2295 { /* end: all zeroes */ } 2303 2296 };
+90
arch/x86/kernel/perf_regs.c
··· 78 78 { 79 79 return PERF_SAMPLE_REGS_ABI_32; 80 80 } 81 + 82 + void perf_get_regs_user(struct perf_regs *regs_user, 83 + struct pt_regs *regs, 84 + struct pt_regs *regs_user_copy) 85 + { 86 + regs_user->regs = task_pt_regs(current); 87 + regs_user->abi = perf_reg_abi(current); 88 + } 81 89 #else /* CONFIG_X86_64 */ 82 90 #define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \ 83 91 (1ULL << PERF_REG_X86_ES) | \ ··· 109 101 return PERF_SAMPLE_REGS_ABI_32; 110 102 else 111 103 return PERF_SAMPLE_REGS_ABI_64; 104 + } 105 + 106 + void perf_get_regs_user(struct perf_regs *regs_user, 107 + struct pt_regs *regs, 108 + struct pt_regs *regs_user_copy) 109 + { 110 + struct pt_regs *user_regs = task_pt_regs(current); 111 + 112 + /* 113 + * If we're in an NMI that interrupted task_pt_regs setup, then 114 + * we can't sample user regs at all. This check isn't really 115 + * sufficient, though, as we could be in an NMI inside an interrupt 116 + * that happened during task_pt_regs setup. 117 + */ 118 + if (regs->sp > (unsigned long)&user_regs->r11 && 119 + regs->sp <= (unsigned long)(user_regs + 1)) { 120 + regs_user->abi = PERF_SAMPLE_REGS_ABI_NONE; 121 + regs_user->regs = NULL; 122 + return; 123 + } 124 + 125 + /* 126 + * RIP, flags, and the argument registers are usually saved. 127 + * orig_ax is probably okay, too. 128 + */ 129 + regs_user_copy->ip = user_regs->ip; 130 + regs_user_copy->cx = user_regs->cx; 131 + regs_user_copy->dx = user_regs->dx; 132 + regs_user_copy->si = user_regs->si; 133 + regs_user_copy->di = user_regs->di; 134 + regs_user_copy->r8 = user_regs->r8; 135 + regs_user_copy->r9 = user_regs->r9; 136 + regs_user_copy->r10 = user_regs->r10; 137 + regs_user_copy->r11 = user_regs->r11; 138 + regs_user_copy->orig_ax = user_regs->orig_ax; 139 + regs_user_copy->flags = user_regs->flags; 140 + 141 + /* 142 + * Don't even try to report the "rest" regs. 143 + */ 144 + regs_user_copy->bx = -1; 145 + regs_user_copy->bp = -1; 146 + regs_user_copy->r12 = -1; 147 + regs_user_copy->r13 = -1; 148 + regs_user_copy->r14 = -1; 149 + regs_user_copy->r15 = -1; 150 + 151 + /* 152 + * For this to be at all useful, we need a reasonable guess for 153 + * sp and the ABI. Be careful: we're in NMI context, and we're 154 + * considering current to be the current task, so we should 155 + * be careful not to look at any other percpu variables that might 156 + * change during context switches. 157 + */ 158 + if (IS_ENABLED(CONFIG_IA32_EMULATION) && 159 + task_thread_info(current)->status & TS_COMPAT) { 160 + /* Easy case: we're in a compat syscall. */ 161 + regs_user->abi = PERF_SAMPLE_REGS_ABI_32; 162 + regs_user_copy->sp = user_regs->sp; 163 + regs_user_copy->cs = user_regs->cs; 164 + regs_user_copy->ss = user_regs->ss; 165 + } else if (user_regs->orig_ax != -1) { 166 + /* 167 + * We're probably in a 64-bit syscall. 168 + * Warning: this code is severely racy. At least it's better 169 + * than just blindly copying user_regs. 170 + */ 171 + regs_user->abi = PERF_SAMPLE_REGS_ABI_64; 172 + regs_user_copy->sp = this_cpu_read(old_rsp); 173 + regs_user_copy->cs = __USER_CS; 174 + regs_user_copy->ss = __USER_DS; 175 + regs_user_copy->cx = -1; /* usually contains garbage */ 176 + } else { 177 + /* We're probably in an interrupt or exception. */ 178 + regs_user->abi = user_64bit_mode(user_regs) ? 179 + PERF_SAMPLE_REGS_ABI_64 : PERF_SAMPLE_REGS_ABI_32; 180 + regs_user_copy->sp = user_regs->sp; 181 + regs_user_copy->cs = user_regs->cs; 182 + regs_user_copy->ss = user_regs->ss; 183 + } 184 + 185 + regs_user->regs = regs_user_copy; 112 186 } 113 187 #endif /* CONFIG_X86_32 */
+1 -1
arch/x86/lib/insn.c
··· 28 28 29 29 /* Verify next sizeof(t) bytes can be on the same instruction */ 30 30 #define validate_next(t, insn, n) \ 31 - ((insn)->next_byte + sizeof(t) + n < (insn)->end_kaddr) 31 + ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr) 32 32 33 33 #define __get_next(t, insn) \ 34 34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; })
+17 -20
arch/x86/mm/init.c
··· 438 438 static unsigned long __init get_new_step_size(unsigned long step_size) 439 439 { 440 440 /* 441 - * Explain why we shift by 5 and why we don't have to worry about 442 - * 'step_size << 5' overflowing: 443 - * 444 - * initial mapped size is PMD_SIZE (2M). 441 + * Initial mapped size is PMD_SIZE (2M). 445 442 * We can not set step_size to be PUD_SIZE (1G) yet. 446 443 * In worse case, when we cross the 1G boundary, and 447 444 * PG_LEVEL_2M is not set, we will need 1+1+512 pages (2M + 8k) 448 - * to map 1G range with PTE. Use 5 as shift for now. 445 + * to map 1G range with PTE. Hence we use one less than the 446 + * difference of page table level shifts. 449 447 * 450 - * Don't need to worry about overflow, on 32bit, when step_size 451 - * is 0, round_down() returns 0 for start, and that turns it 452 - * into 0x100000000ULL. 448 + * Don't need to worry about overflow in the top-down case, on 32bit, 449 + * when step_size is 0, round_down() returns 0 for start, and that 450 + * turns it into 0x100000000ULL. 451 + * In the bottom-up case, round_up(x, 0) returns 0 though too, which 452 + * needs to be taken into consideration by the code below. 453 453 */ 454 - return step_size << 5; 454 + return step_size << (PMD_SHIFT - PAGE_SHIFT - 1); 455 455 } 456 456 457 457 /** ··· 471 471 unsigned long step_size; 472 472 unsigned long addr; 473 473 unsigned long mapped_ram_size = 0; 474 - unsigned long new_mapped_ram_size; 475 474 476 475 /* xen has big range in reserved near end of ram, skip it at first.*/ 477 476 addr = memblock_find_in_range(map_start, map_end, PMD_SIZE, PMD_SIZE); ··· 495 496 start = map_start; 496 497 } else 497 498 start = map_start; 498 - new_mapped_ram_size = init_range_memory_mapping(start, 499 + mapped_ram_size += init_range_memory_mapping(start, 499 500 last_start); 500 501 last_start = start; 501 502 min_pfn_mapped = last_start >> PAGE_SHIFT; 502 - /* only increase step_size after big range get mapped */ 503 - if (new_mapped_ram_size > mapped_ram_size) 503 + if (mapped_ram_size >= step_size) 504 504 step_size = get_new_step_size(step_size); 505 - mapped_ram_size += new_mapped_ram_size; 506 505 } 507 506 508 507 if (real_end < map_end) ··· 521 524 static void __init memory_map_bottom_up(unsigned long map_start, 522 525 unsigned long map_end) 523 526 { 524 - unsigned long next, new_mapped_ram_size, start; 527 + unsigned long next, start; 525 528 unsigned long mapped_ram_size = 0; 526 529 /* step_size need to be small so pgt_buf from BRK could cover it */ 527 530 unsigned long step_size = PMD_SIZE; ··· 536 539 * for page table. 537 540 */ 538 541 while (start < map_end) { 539 - if (map_end - start > step_size) { 542 + if (step_size && map_end - start > step_size) { 540 543 next = round_up(start + 1, step_size); 541 544 if (next > map_end) 542 545 next = map_end; 543 - } else 546 + } else { 544 547 next = map_end; 548 + } 545 549 546 - new_mapped_ram_size = init_range_memory_mapping(start, next); 550 + mapped_ram_size += init_range_memory_mapping(start, next); 547 551 start = next; 548 552 549 - if (new_mapped_ram_size > mapped_ram_size) 553 + if (mapped_ram_size >= step_size) 550 554 step_size = get_new_step_size(step_size); 551 - mapped_ram_size += new_mapped_ram_size; 552 555 } 553 556 } 554 557
+29 -16
arch/x86/vdso/vma.c
··· 41 41 42 42 struct linux_binprm; 43 43 44 - /* Put the vdso above the (randomized) stack with another randomized offset. 45 - This way there is no hole in the middle of address space. 46 - To save memory make sure it is still in the same PTE as the stack top. 47 - This doesn't give that many random bits. 48 - 49 - Only used for the 64-bit and x32 vdsos. */ 44 + /* 45 + * Put the vdso above the (randomized) stack with another randomized 46 + * offset. This way there is no hole in the middle of address space. 47 + * To save memory make sure it is still in the same PTE as the stack 48 + * top. This doesn't give that many random bits. 49 + * 50 + * Note that this algorithm is imperfect: the distribution of the vdso 51 + * start address within a PMD is biased toward the end. 52 + * 53 + * Only used for the 64-bit and x32 vdsos. 54 + */ 50 55 static unsigned long vdso_addr(unsigned long start, unsigned len) 51 56 { 52 57 #ifdef CONFIG_X86_32 ··· 59 54 #else 60 55 unsigned long addr, end; 61 56 unsigned offset; 62 - end = (start + PMD_SIZE - 1) & PMD_MASK; 57 + 58 + /* 59 + * Round up the start address. It can start out unaligned as a result 60 + * of stack start randomization. 61 + */ 62 + start = PAGE_ALIGN(start); 63 + 64 + /* Round the lowest possible end address up to a PMD boundary. */ 65 + end = (start + len + PMD_SIZE - 1) & PMD_MASK; 63 66 if (end >= TASK_SIZE_MAX) 64 67 end = TASK_SIZE_MAX; 65 68 end -= len; 66 - /* This loses some more bits than a modulo, but is cheaper */ 67 - offset = get_random_int() & (PTRS_PER_PTE - 1); 68 - addr = start + (offset << PAGE_SHIFT); 69 - if (addr >= end) 70 - addr = end; 69 + 70 + if (end > start) { 71 + offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1); 72 + addr = start + (offset << PAGE_SHIFT); 73 + } else { 74 + addr = start; 75 + } 71 76 72 77 /* 73 - * page-align it here so that get_unmapped_area doesn't 74 - * align it wrongfully again to the next page. addr can come in 4K 75 - * unaligned here as a result of stack start randomization. 78 + * Forcibly align the final address in case we have a hardware 79 + * issue that requires alignment for performance reasons. 76 80 */ 77 - addr = PAGE_ALIGN(addr); 78 81 addr = align_vdso_addr(addr); 79 82 80 83 return addr;
+21 -1
arch/x86/xen/enlighten.c
··· 40 40 #include <xen/interface/physdev.h> 41 41 #include <xen/interface/vcpu.h> 42 42 #include <xen/interface/memory.h> 43 + #include <xen/interface/nmi.h> 43 44 #include <xen/interface/xen-mca.h> 44 45 #include <xen/features.h> 45 46 #include <xen/page.h> ··· 67 66 #include <asm/reboot.h> 68 67 #include <asm/stackprotector.h> 69 68 #include <asm/hypervisor.h> 69 + #include <asm/mach_traps.h> 70 70 #include <asm/mwait.h> 71 71 #include <asm/pci_x86.h> 72 72 #include <asm/pat.h> ··· 1353 1351 .emergency_restart = xen_emergency_restart, 1354 1352 }; 1355 1353 1354 + static unsigned char xen_get_nmi_reason(void) 1355 + { 1356 + unsigned char reason = 0; 1357 + 1358 + /* Construct a value which looks like it came from port 0x61. */ 1359 + if (test_bit(_XEN_NMIREASON_io_error, 1360 + &HYPERVISOR_shared_info->arch.nmi_reason)) 1361 + reason |= NMI_REASON_IOCHK; 1362 + if (test_bit(_XEN_NMIREASON_pci_serr, 1363 + &HYPERVISOR_shared_info->arch.nmi_reason)) 1364 + reason |= NMI_REASON_SERR; 1365 + 1366 + return reason; 1367 + } 1368 + 1356 1369 static void __init xen_boot_params_init_edd(void) 1357 1370 { 1358 1371 #if IS_ENABLED(CONFIG_EDD) ··· 1552 1535 pv_info = xen_info; 1553 1536 pv_init_ops = xen_init_ops; 1554 1537 pv_apic_ops = xen_apic_ops; 1555 - if (!xen_pvh_domain()) 1538 + if (!xen_pvh_domain()) { 1556 1539 pv_cpu_ops = xen_cpu_ops; 1540 + 1541 + x86_platform.get_nmi_reason = xen_get_nmi_reason; 1542 + } 1557 1543 1558 1544 if (xen_feature(XENFEAT_auto_translated_physmap)) 1559 1545 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
+10 -10
arch/x86/xen/p2m.c
··· 167 167 return (void *)__get_free_page(GFP_KERNEL | __GFP_REPEAT); 168 168 } 169 169 170 - /* Only to be called in case of a race for a page just allocated! */ 171 - static void free_p2m_page(void *p) 170 + static void __ref free_p2m_page(void *p) 172 171 { 173 - BUG_ON(!slab_is_available()); 172 + if (unlikely(!slab_is_available())) { 173 + free_bootmem((unsigned long)p, PAGE_SIZE); 174 + return; 175 + } 176 + 174 177 free_page((unsigned long)p); 175 178 } 176 179 ··· 378 375 p2m_missing_pte : p2m_identity_pte; 379 376 for (i = 0; i < PMDS_PER_MID_PAGE; i++) { 380 377 pmdp = populate_extra_pmd( 381 - (unsigned long)(p2m + pfn + i * PTRS_PER_PTE)); 378 + (unsigned long)(p2m + pfn) + i * PMD_SIZE); 382 379 set_pmd(pmdp, __pmd(__pa(ptep) | _KERNPG_TABLE)); 383 380 } 384 381 } ··· 439 436 * a new pmd is to replace p2m_missing_pte or p2m_identity_pte by a individual 440 437 * pmd. In case of PAE/x86-32 there are multiple pmds to allocate! 441 438 */ 442 - static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *ptep, pte_t *pte_pg) 439 + static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *pte_pg) 443 440 { 444 441 pte_t *ptechk; 445 - pte_t *pteret = ptep; 446 442 pte_t *pte_newpg[PMDS_PER_MID_PAGE]; 447 443 pmd_t *pmdp; 448 444 unsigned int level; ··· 475 473 if (ptechk == pte_pg) { 476 474 set_pmd(pmdp, 477 475 __pmd(__pa(pte_newpg[i]) | _KERNPG_TABLE)); 478 - if (vaddr == (addr & ~(PMD_SIZE - 1))) 479 - pteret = pte_offset_kernel(pmdp, addr); 480 476 pte_newpg[i] = NULL; 481 477 } 482 478 ··· 488 488 vaddr += PMD_SIZE; 489 489 } 490 490 491 - return pteret; 491 + return lookup_address(addr, &level); 492 492 } 493 493 494 494 /* ··· 517 517 518 518 if (pte_pg == p2m_missing_pte || pte_pg == p2m_identity_pte) { 519 519 /* PMD level is missing, allocate a new one */ 520 - ptep = alloc_p2m_pmd(addr, ptep, pte_pg); 520 + ptep = alloc_p2m_pmd(addr, pte_pg); 521 521 if (!ptep) 522 522 return false; 523 523 }
+20 -22
arch/x86/xen/setup.c
··· 140 140 unsigned long __ref xen_chk_extra_mem(unsigned long pfn) 141 141 { 142 142 int i; 143 - unsigned long addr = PFN_PHYS(pfn); 143 + phys_addr_t addr = PFN_PHYS(pfn); 144 144 145 145 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) { 146 146 if (addr >= xen_extra_mem[i].start && ··· 160 160 int i; 161 161 162 162 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) { 163 + if (!xen_extra_mem[i].size) 164 + continue; 163 165 pfn_s = PFN_DOWN(xen_extra_mem[i].start); 164 166 pfn_e = PFN_UP(xen_extra_mem[i].start + xen_extra_mem[i].size); 165 167 for (pfn = pfn_s; pfn < pfn_e; pfn++) ··· 231 229 * as a fallback if the remapping fails. 232 230 */ 233 231 static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, 234 - unsigned long end_pfn, unsigned long nr_pages, unsigned long *identity, 235 - unsigned long *released) 232 + unsigned long end_pfn, unsigned long nr_pages, unsigned long *released) 236 233 { 237 - unsigned long len = 0; 238 234 unsigned long pfn, end; 239 235 int ret; 240 236 241 237 WARN_ON(start_pfn > end_pfn); 242 238 239 + /* Release pages first. */ 243 240 end = min(end_pfn, nr_pages); 244 241 for (pfn = start_pfn; pfn < end; pfn++) { 245 242 unsigned long mfn = pfn_to_mfn(pfn); ··· 251 250 WARN(ret != 1, "Failed to release pfn %lx err=%d\n", pfn, ret); 252 251 253 252 if (ret == 1) { 253 + (*released)++; 254 254 if (!__set_phys_to_machine(pfn, INVALID_P2M_ENTRY)) 255 255 break; 256 - len++; 257 256 } else 258 257 break; 259 258 } 260 259 261 - /* Need to release pages first */ 262 - *released += len; 263 - *identity += set_phys_range_identity(start_pfn, end_pfn); 260 + set_phys_range_identity(start_pfn, end_pfn); 264 261 } 265 262 266 263 /* ··· 286 287 } 287 288 288 289 /* Update kernel mapping, but not for highmem. */ 289 - if ((pfn << PAGE_SHIFT) >= __pa(high_memory)) 290 + if (pfn >= PFN_UP(__pa(high_memory - 1))) 290 291 return; 291 292 292 293 if (HYPERVISOR_update_va_mapping((unsigned long)__va(pfn << PAGE_SHIFT), ··· 317 318 unsigned long ident_pfn_iter, remap_pfn_iter; 318 319 unsigned long ident_end_pfn = start_pfn + size; 319 320 unsigned long left = size; 320 - unsigned long ident_cnt = 0; 321 321 unsigned int i, chunk; 322 322 323 323 WARN_ON(size == 0); ··· 345 347 xen_remap_mfn = mfn; 346 348 347 349 /* Set identity map */ 348 - ident_cnt += set_phys_range_identity(ident_pfn_iter, 349 - ident_pfn_iter + chunk); 350 + set_phys_range_identity(ident_pfn_iter, ident_pfn_iter + chunk); 350 351 351 352 left -= chunk; 352 353 } ··· 368 371 static unsigned long __init xen_set_identity_and_remap_chunk( 369 372 const struct e820entry *list, size_t map_size, unsigned long start_pfn, 370 373 unsigned long end_pfn, unsigned long nr_pages, unsigned long remap_pfn, 371 - unsigned long *identity, unsigned long *released) 374 + unsigned long *released, unsigned long *remapped) 372 375 { 373 376 unsigned long pfn; 374 377 unsigned long i = 0; ··· 383 386 /* Do not remap pages beyond the current allocation */ 384 387 if (cur_pfn >= nr_pages) { 385 388 /* Identity map remaining pages */ 386 - *identity += set_phys_range_identity(cur_pfn, 387 - cur_pfn + size); 389 + set_phys_range_identity(cur_pfn, cur_pfn + size); 388 390 break; 389 391 } 390 392 if (cur_pfn + size > nr_pages) ··· 394 398 if (!remap_range_size) { 395 399 pr_warning("Unable to find available pfn range, not remapping identity pages\n"); 396 400 xen_set_identity_and_release_chunk(cur_pfn, 397 - cur_pfn + left, nr_pages, identity, released); 401 + cur_pfn + left, nr_pages, released); 398 402 break; 399 403 } 400 404 /* Adjust size to fit in current e820 RAM region */ ··· 406 410 /* Update variables to reflect new mappings. */ 407 411 i += size; 408 412 remap_pfn += size; 409 - *identity += size; 413 + *remapped += size; 410 414 } 411 415 412 416 /* ··· 423 427 424 428 static void __init xen_set_identity_and_remap( 425 429 const struct e820entry *list, size_t map_size, unsigned long nr_pages, 426 - unsigned long *released) 430 + unsigned long *released, unsigned long *remapped) 427 431 { 428 432 phys_addr_t start = 0; 429 - unsigned long identity = 0; 430 433 unsigned long last_pfn = nr_pages; 431 434 const struct e820entry *entry; 432 435 unsigned long num_released = 0; 436 + unsigned long num_remapped = 0; 433 437 int i; 434 438 435 439 /* ··· 456 460 last_pfn = xen_set_identity_and_remap_chunk( 457 461 list, map_size, start_pfn, 458 462 end_pfn, nr_pages, last_pfn, 459 - &identity, &num_released); 463 + &num_released, &num_remapped); 460 464 start = end; 461 465 } 462 466 } 463 467 464 468 *released = num_released; 469 + *remapped = num_remapped; 465 470 466 - pr_info("Set %ld page(s) to 1-1 mapping\n", identity); 467 471 pr_info("Released %ld page(s)\n", num_released); 468 472 } 469 473 ··· 582 586 struct xen_memory_map memmap; 583 587 unsigned long max_pages; 584 588 unsigned long extra_pages = 0; 589 + unsigned long remapped_pages; 585 590 int i; 586 591 int op; 587 592 ··· 632 635 * underlying RAM. 633 636 */ 634 637 xen_set_identity_and_remap(map, memmap.nr_entries, max_pfn, 635 - &xen_released_pages); 638 + &xen_released_pages, &remapped_pages); 636 639 637 640 extra_pages += xen_released_pages; 641 + extra_pages += remapped_pages; 638 642 639 643 /* 640 644 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
+5 -13
arch/x86/xen/time.c
··· 391 391 392 392 struct xen_clock_event_device { 393 393 struct clock_event_device evt; 394 - char *name; 394 + char name[16]; 395 395 }; 396 396 static DEFINE_PER_CPU(struct xen_clock_event_device, xen_clock_events) = { .evt.irq = -1 }; 397 397 ··· 420 420 if (evt->irq >= 0) { 421 421 unbind_from_irqhandler(evt->irq, NULL); 422 422 evt->irq = -1; 423 - kfree(per_cpu(xen_clock_events, cpu).name); 424 - per_cpu(xen_clock_events, cpu).name = NULL; 425 423 } 426 424 } 427 425 428 426 void xen_setup_timer(int cpu) 429 427 { 430 - char *name; 431 - struct clock_event_device *evt; 428 + struct xen_clock_event_device *xevt = &per_cpu(xen_clock_events, cpu); 429 + struct clock_event_device *evt = &xevt->evt; 432 430 int irq; 433 431 434 - evt = &per_cpu(xen_clock_events, cpu).evt; 435 432 WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu); 436 433 if (evt->irq >= 0) 437 434 xen_teardown_timer(cpu); 438 435 439 436 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu); 440 437 441 - name = kasprintf(GFP_KERNEL, "timer%d", cpu); 442 - if (!name) 443 - name = "<timer kasprintf failed>"; 438 + snprintf(xevt->name, sizeof(xevt->name), "timer%d", cpu); 444 439 445 440 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, 446 441 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER| 447 442 IRQF_FORCE_RESUME|IRQF_EARLY_RESUME, 448 - name, NULL); 443 + xevt->name, NULL); 449 444 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX); 450 445 451 446 memcpy(evt, xen_clockevent, sizeof(*evt)); 452 447 453 448 evt->cpumask = cpumask_of(cpu); 454 449 evt->irq = irq; 455 - per_cpu(xen_clock_events, cpu).name = name; 456 450 } 457 451 458 452 459 453 void xen_setup_cpu_clockevents(void) 460 454 { 461 - BUG_ON(preemptible()); 462 - 463 455 clockevents_register_device(this_cpu_ptr(&xen_clock_events.evt)); 464 456 } 465 457
+4 -2
drivers/Makefile
··· 50 50 obj-y += tty/ 51 51 obj-y += char/ 52 52 53 - # gpu/ comes after char for AGP vs DRM startup 53 + # iommu/ comes before gpu as gpu are using iommu controllers 54 + obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ 55 + 56 + # gpu/ comes after char for AGP vs DRM startup and after iommu 54 57 obj-y += gpu/ 55 58 56 59 obj-$(CONFIG_CONNECTOR) += connector/ ··· 144 141 145 142 obj-$(CONFIG_MAILBOX) += mailbox/ 146 143 obj-$(CONFIG_HWSPINLOCK) += hwspinlock/ 147 - obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ 148 144 obj-$(CONFIG_REMOTEPROC) += remoteproc/ 149 145 obj-$(CONFIG_RPMSG) += rpmsg/ 150 146
+14 -11
drivers/acpi/acpi_processor.c
··· 170 170 acpi_status status; 171 171 int ret; 172 172 173 - if (pr->apic_id == -1) 173 + if (pr->phys_id == -1) 174 174 return -ENODEV; 175 175 176 176 status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); ··· 180 180 cpu_maps_update_begin(); 181 181 cpu_hotplug_begin(); 182 182 183 - ret = acpi_map_lsapic(pr->handle, pr->apic_id, &pr->id); 183 + ret = acpi_map_cpu(pr->handle, pr->phys_id, &pr->id); 184 184 if (ret) 185 185 goto out; 186 186 187 187 ret = arch_register_cpu(pr->id); 188 188 if (ret) { 189 - acpi_unmap_lsapic(pr->id); 189 + acpi_unmap_cpu(pr->id); 190 190 goto out; 191 191 } 192 192 ··· 215 215 union acpi_object object = { 0 }; 216 216 struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; 217 217 struct acpi_processor *pr = acpi_driver_data(device); 218 - int apic_id, cpu_index, device_declaration = 0; 218 + int phys_id, cpu_index, device_declaration = 0; 219 219 acpi_status status = AE_OK; 220 220 static int cpu0_initialized; 221 221 unsigned long long value; ··· 262 262 pr->acpi_id = value; 263 263 } 264 264 265 - apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); 266 - if (apic_id < 0) 267 - acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); 268 - pr->apic_id = apic_id; 265 + phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id); 266 + if (phys_id < 0) 267 + acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n"); 268 + pr->phys_id = phys_id; 269 269 270 - cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); 270 + cpu_index = acpi_map_cpuid(pr->phys_id, pr->acpi_id); 271 271 if (!cpu0_initialized && !acpi_has_cpu_in_madt()) { 272 272 cpu0_initialized = 1; 273 - /* Handle UP system running SMP kernel, with no LAPIC in MADT */ 273 + /* 274 + * Handle UP system running SMP kernel, with no CPU 275 + * entry in MADT 276 + */ 274 277 if ((cpu_index == -1) && (num_online_cpus() == 1)) 275 278 cpu_index = 0; 276 279 } ··· 461 458 462 459 /* Remove the CPU. */ 463 460 arch_unregister_cpu(pr->id); 464 - acpi_unmap_lsapic(pr->id); 461 + acpi_unmap_cpu(pr->id); 465 462 466 463 cpu_hotplug_done(); 467 464 cpu_maps_update_done();
+1 -1
drivers/acpi/device_pm.c
··· 257 257 258 258 device->power.state = ACPI_STATE_UNKNOWN; 259 259 if (!acpi_device_is_present(device)) 260 - return 0; 260 + return -ENXIO; 261 261 262 262 result = acpi_device_get_power(device, &state); 263 263 if (result)
+7 -4
drivers/acpi/int340x_thermal.c
··· 14 14 15 15 #include "internal.h" 16 16 17 - #define DO_ENUMERATION 0x01 17 + #define INT3401_DEVICE 0X01 18 18 static const struct acpi_device_id int340x_thermal_device_ids[] = { 19 - {"INT3400", DO_ENUMERATION }, 20 - {"INT3401"}, 19 + {"INT3400"}, 20 + {"INT3401", INT3401_DEVICE}, 21 21 {"INT3402"}, 22 22 {"INT3403"}, 23 23 {"INT3404"}, ··· 34 34 const struct acpi_device_id *id) 35 35 { 36 36 #if defined(CONFIG_INT340X_THERMAL) || defined(CONFIG_INT340X_THERMAL_MODULE) 37 - if (id->driver_data == DO_ENUMERATION) 37 + acpi_create_platform_device(adev); 38 + #elif defined(INTEL_SOC_DTS_THERMAL) || defined(INTEL_SOC_DTS_THERMAL_MODULE) 39 + /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ 40 + if (id->driver_data == INT3401_DEVICE) 38 41 acpi_create_platform_device(adev); 39 42 #endif 40 43 return 1;
+28 -28
drivers/acpi/processor_core.c
··· 69 69 unsigned long madt_end, entry; 70 70 static struct acpi_table_madt *madt; 71 71 static int read_madt; 72 - int apic_id = -1; 72 + int phys_id = -1; /* CPU hardware ID */ 73 73 74 74 if (!read_madt) { 75 75 if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, ··· 79 79 } 80 80 81 81 if (!madt) 82 - return apic_id; 82 + return phys_id; 83 83 84 84 entry = (unsigned long)madt; 85 85 madt_end = entry + madt->header.length; ··· 91 91 struct acpi_subtable_header *header = 92 92 (struct acpi_subtable_header *)entry; 93 93 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { 94 - if (!map_lapic_id(header, acpi_id, &apic_id)) 94 + if (!map_lapic_id(header, acpi_id, &phys_id)) 95 95 break; 96 96 } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { 97 - if (!map_x2apic_id(header, type, acpi_id, &apic_id)) 97 + if (!map_x2apic_id(header, type, acpi_id, &phys_id)) 98 98 break; 99 99 } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { 100 - if (!map_lsapic_id(header, type, acpi_id, &apic_id)) 100 + if (!map_lsapic_id(header, type, acpi_id, &phys_id)) 101 101 break; 102 102 } 103 103 entry += header->length; 104 104 } 105 - return apic_id; 105 + return phys_id; 106 106 } 107 107 108 108 static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) ··· 110 110 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 111 111 union acpi_object *obj; 112 112 struct acpi_subtable_header *header; 113 - int apic_id = -1; 113 + int phys_id = -1; 114 114 115 115 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 116 116 goto exit; ··· 126 126 127 127 header = (struct acpi_subtable_header *)obj->buffer.pointer; 128 128 if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) 129 - map_lapic_id(header, acpi_id, &apic_id); 129 + map_lapic_id(header, acpi_id, &phys_id); 130 130 else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) 131 - map_lsapic_id(header, type, acpi_id, &apic_id); 131 + map_lsapic_id(header, type, acpi_id, &phys_id); 132 132 else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) 133 - map_x2apic_id(header, type, acpi_id, &apic_id); 133 + map_x2apic_id(header, type, acpi_id, &phys_id); 134 134 135 135 exit: 136 136 kfree(buffer.pointer); 137 - return apic_id; 137 + return phys_id; 138 138 } 139 139 140 - int acpi_get_apicid(acpi_handle handle, int type, u32 acpi_id) 140 + int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) 141 141 { 142 - int apic_id; 142 + int phys_id; 143 143 144 - apic_id = map_mat_entry(handle, type, acpi_id); 145 - if (apic_id == -1) 146 - apic_id = map_madt_entry(type, acpi_id); 144 + phys_id = map_mat_entry(handle, type, acpi_id); 145 + if (phys_id == -1) 146 + phys_id = map_madt_entry(type, acpi_id); 147 147 148 - return apic_id; 148 + return phys_id; 149 149 } 150 150 151 - int acpi_map_cpuid(int apic_id, u32 acpi_id) 151 + int acpi_map_cpuid(int phys_id, u32 acpi_id) 152 152 { 153 153 #ifdef CONFIG_SMP 154 154 int i; 155 155 #endif 156 156 157 - if (apic_id == -1) { 157 + if (phys_id == -1) { 158 158 /* 159 159 * On UP processor, there is no _MAT or MADT table. 160 - * So above apic_id is always set to -1. 160 + * So above phys_id is always set to -1. 161 161 * 162 162 * BIOS may define multiple CPU handles even for UP processor. 163 163 * For example, ··· 170 170 * Processor (CPU3, 0x03, 0x00000410, 0x06) {} 171 171 * } 172 172 * 173 - * Ignores apic_id and always returns 0 for the processor 173 + * Ignores phys_id and always returns 0 for the processor 174 174 * handle with acpi id 0 if nr_cpu_ids is 1. 175 175 * This should be the case if SMP tables are not found. 176 176 * Return -1 for other CPU's handle. ··· 178 178 if (nr_cpu_ids <= 1 && acpi_id == 0) 179 179 return acpi_id; 180 180 else 181 - return apic_id; 181 + return phys_id; 182 182 } 183 183 184 184 #ifdef CONFIG_SMP 185 185 for_each_possible_cpu(i) { 186 - if (cpu_physical_id(i) == apic_id) 186 + if (cpu_physical_id(i) == phys_id) 187 187 return i; 188 188 } 189 189 #else 190 190 /* In UP kernel, only processor 0 is valid */ 191 - if (apic_id == 0) 192 - return apic_id; 191 + if (phys_id == 0) 192 + return phys_id; 193 193 #endif 194 194 return -1; 195 195 } 196 196 197 197 int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) 198 198 { 199 - int apic_id; 199 + int phys_id; 200 200 201 - apic_id = acpi_get_apicid(handle, type, acpi_id); 201 + phys_id = acpi_get_phys_id(handle, type, acpi_id); 202 202 203 - return acpi_map_cpuid(apic_id, acpi_id); 203 + return acpi_map_cpuid(phys_id, acpi_id); 204 204 } 205 205 EXPORT_SYMBOL_GPL(acpi_get_cpuid);
+8 -5
drivers/acpi/scan.c
··· 1001 1001 if (device->wakeup.flags.valid) 1002 1002 acpi_power_resources_list_free(&device->wakeup.resources); 1003 1003 1004 - if (!device->flags.power_manageable) 1004 + if (!device->power.flags.power_resources) 1005 1005 return; 1006 1006 1007 1007 for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { ··· 1744 1744 device->power.flags.power_resources) 1745 1745 device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1; 1746 1746 1747 - if (acpi_bus_init_power(device)) { 1748 - acpi_free_power_resources_lists(device); 1747 + if (acpi_bus_init_power(device)) 1749 1748 device->flags.power_manageable = 0; 1750 - } 1751 1749 } 1752 1750 1753 1751 static void acpi_bus_get_flags(struct acpi_device *device) ··· 2369 2371 /* Skip devices that are not present. */ 2370 2372 if (!acpi_device_is_present(device)) { 2371 2373 device->flags.visited = false; 2374 + device->flags.power_manageable = 0; 2372 2375 return; 2373 2376 } 2374 2377 if (device->handler) 2375 2378 goto ok; 2376 2379 2377 2380 if (!device->flags.initialized) { 2378 - acpi_bus_update_power(device, NULL); 2381 + device->flags.power_manageable = 2382 + device->power.states[ACPI_STATE_D0].flags.valid; 2383 + if (acpi_bus_init_power(device)) 2384 + device->flags.power_manageable = 0; 2385 + 2379 2386 device->flags.initialized = true; 2380 2387 } 2381 2388 device->flags.visited = false;
+10
drivers/acpi/video.c
··· 522 522 DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"), 523 523 }, 524 524 }, 525 + 526 + { 527 + /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */ 528 + .callback = video_disable_native_backlight, 529 + .ident = "Dell XPS15 L521X", 530 + .matches = { 531 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 532 + DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"), 533 + }, 534 + }, 525 535 {} 526 536 }; 527 537
+2 -1
drivers/char/ipmi/ipmi_ssif.c
··· 969 969 970 970 do_gettimeofday(&t); 971 971 pr_info("**Enqueue %02x %02x: %ld.%6.6ld\n", 972 - msg->data[0], msg->data[1], t.tv_sec, t.tv_usec); 972 + msg->data[0], msg->data[1], 973 + (long) t.tv_sec, (long) t.tv_usec); 973 974 } 974 975 } 975 976
+67 -89
drivers/gpio/gpio-dln2.c
··· 47 47 48 48 #define DLN2_GPIO_MAX_PINS 32 49 49 50 - struct dln2_irq_work { 51 - struct work_struct work; 52 - struct dln2_gpio *dln2; 53 - int pin; 54 - int type; 55 - }; 56 - 57 50 struct dln2_gpio { 58 51 struct platform_device *pdev; 59 52 struct gpio_chip gpio; ··· 57 64 */ 58 65 DECLARE_BITMAP(output_enabled, DLN2_GPIO_MAX_PINS); 59 66 60 - DECLARE_BITMAP(irqs_masked, DLN2_GPIO_MAX_PINS); 61 - DECLARE_BITMAP(irqs_enabled, DLN2_GPIO_MAX_PINS); 62 - DECLARE_BITMAP(irqs_pending, DLN2_GPIO_MAX_PINS); 63 - struct dln2_irq_work *irq_work; 67 + /* active IRQs - not synced to hardware */ 68 + DECLARE_BITMAP(unmasked_irqs, DLN2_GPIO_MAX_PINS); 69 + /* active IRQS - synced to hardware */ 70 + DECLARE_BITMAP(enabled_irqs, DLN2_GPIO_MAX_PINS); 71 + int irq_type[DLN2_GPIO_MAX_PINS]; 72 + struct mutex irq_lock; 64 73 }; 65 74 66 75 struct dln2_gpio_pin { ··· 136 141 return !!ret; 137 142 } 138 143 139 - static void dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2, 140 - unsigned int pin, int value) 144 + static int dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2, 145 + unsigned int pin, int value) 141 146 { 142 147 struct dln2_gpio_pin_val req = { 143 148 .pin = cpu_to_le16(pin), 144 149 .value = value, 145 150 }; 146 151 147 - dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req, 148 - sizeof(req)); 152 + return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req, 153 + sizeof(req)); 149 154 } 150 155 151 156 #define DLN2_GPIO_DIRECTION_IN 0 ··· 262 267 static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, 263 268 int value) 264 269 { 270 + struct dln2_gpio *dln2 = container_of(chip, struct dln2_gpio, gpio); 271 + int ret; 272 + 273 + ret = dln2_gpio_pin_set_out_val(dln2, offset, value); 274 + if (ret < 0) 275 + return ret; 276 + 265 277 return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); 266 278 } 267 279 ··· 299 297 &req, sizeof(req)); 300 298 } 301 299 302 - static void dln2_irq_work(struct work_struct *w) 303 - { 304 - struct dln2_irq_work *iw = container_of(w, struct dln2_irq_work, work); 305 - struct dln2_gpio *dln2 = iw->dln2; 306 - u8 type = iw->type & DLN2_GPIO_EVENT_MASK; 307 - 308 - if (test_bit(iw->pin, dln2->irqs_enabled)) 309 - dln2_gpio_set_event_cfg(dln2, iw->pin, type, 0); 310 - else 311 - dln2_gpio_set_event_cfg(dln2, iw->pin, DLN2_GPIO_EVENT_NONE, 0); 312 - } 313 - 314 - static void dln2_irq_enable(struct irq_data *irqd) 300 + static void dln2_irq_unmask(struct irq_data *irqd) 315 301 { 316 302 struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); 317 303 struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); 318 304 int pin = irqd_to_hwirq(irqd); 319 305 320 - set_bit(pin, dln2->irqs_enabled); 321 - schedule_work(&dln2->irq_work[pin].work); 322 - } 323 - 324 - static void dln2_irq_disable(struct irq_data *irqd) 325 - { 326 - struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); 327 - struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); 328 - int pin = irqd_to_hwirq(irqd); 329 - 330 - clear_bit(pin, dln2->irqs_enabled); 331 - schedule_work(&dln2->irq_work[pin].work); 306 + set_bit(pin, dln2->unmasked_irqs); 332 307 } 333 308 334 309 static void dln2_irq_mask(struct irq_data *irqd) ··· 314 335 struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); 315 336 int pin = irqd_to_hwirq(irqd); 316 337 317 - set_bit(pin, dln2->irqs_masked); 318 - } 319 - 320 - static void dln2_irq_unmask(struct irq_data *irqd) 321 - { 322 - struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); 323 - struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); 324 - struct device *dev = dln2->gpio.dev; 325 - int pin = irqd_to_hwirq(irqd); 326 - 327 - if (test_and_clear_bit(pin, dln2->irqs_pending)) { 328 - int irq; 329 - 330 - irq = irq_find_mapping(dln2->gpio.irqdomain, pin); 331 - if (!irq) { 332 - dev_err(dev, "pin %d not mapped to IRQ\n", pin); 333 - return; 334 - } 335 - 336 - generic_handle_irq(irq); 337 - } 338 + clear_bit(pin, dln2->unmasked_irqs); 338 339 } 339 340 340 341 static int dln2_irq_set_type(struct irq_data *irqd, unsigned type) ··· 325 366 326 367 switch (type) { 327 368 case IRQ_TYPE_LEVEL_HIGH: 328 - dln2->irq_work[pin].type = DLN2_GPIO_EVENT_LVL_HIGH; 369 + dln2->irq_type[pin] = DLN2_GPIO_EVENT_LVL_HIGH; 329 370 break; 330 371 case IRQ_TYPE_LEVEL_LOW: 331 - dln2->irq_work[pin].type = DLN2_GPIO_EVENT_LVL_LOW; 372 + dln2->irq_type[pin] = DLN2_GPIO_EVENT_LVL_LOW; 332 373 break; 333 374 case IRQ_TYPE_EDGE_BOTH: 334 - dln2->irq_work[pin].type = DLN2_GPIO_EVENT_CHANGE; 375 + dln2->irq_type[pin] = DLN2_GPIO_EVENT_CHANGE; 335 376 break; 336 377 case IRQ_TYPE_EDGE_RISING: 337 - dln2->irq_work[pin].type = DLN2_GPIO_EVENT_CHANGE_RISING; 378 + dln2->irq_type[pin] = DLN2_GPIO_EVENT_CHANGE_RISING; 338 379 break; 339 380 case IRQ_TYPE_EDGE_FALLING: 340 - dln2->irq_work[pin].type = DLN2_GPIO_EVENT_CHANGE_FALLING; 381 + dln2->irq_type[pin] = DLN2_GPIO_EVENT_CHANGE_FALLING; 341 382 break; 342 383 default: 343 384 return -EINVAL; ··· 346 387 return 0; 347 388 } 348 389 390 + static void dln2_irq_bus_lock(struct irq_data *irqd) 391 + { 392 + struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); 393 + struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); 394 + 395 + mutex_lock(&dln2->irq_lock); 396 + } 397 + 398 + static void dln2_irq_bus_unlock(struct irq_data *irqd) 399 + { 400 + struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); 401 + struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); 402 + int pin = irqd_to_hwirq(irqd); 403 + int enabled, unmasked; 404 + unsigned type; 405 + int ret; 406 + 407 + enabled = test_bit(pin, dln2->enabled_irqs); 408 + unmasked = test_bit(pin, dln2->unmasked_irqs); 409 + 410 + if (enabled != unmasked) { 411 + if (unmasked) { 412 + type = dln2->irq_type[pin] & DLN2_GPIO_EVENT_MASK; 413 + set_bit(pin, dln2->enabled_irqs); 414 + } else { 415 + type = DLN2_GPIO_EVENT_NONE; 416 + clear_bit(pin, dln2->enabled_irqs); 417 + } 418 + 419 + ret = dln2_gpio_set_event_cfg(dln2, pin, type, 0); 420 + if (ret) 421 + dev_err(dln2->gpio.dev, "failed to set event\n"); 422 + } 423 + 424 + mutex_unlock(&dln2->irq_lock); 425 + } 426 + 349 427 static struct irq_chip dln2_gpio_irqchip = { 350 428 .name = "dln2-irq", 351 - .irq_enable = dln2_irq_enable, 352 - .irq_disable = dln2_irq_disable, 353 429 .irq_mask = dln2_irq_mask, 354 430 .irq_unmask = dln2_irq_unmask, 355 431 .irq_set_type = dln2_irq_set_type, 432 + .irq_bus_lock = dln2_irq_bus_lock, 433 + .irq_bus_sync_unlock = dln2_irq_bus_unlock, 356 434 }; 357 435 358 436 static void dln2_gpio_event(struct platform_device *pdev, u16 echo, ··· 421 425 return; 422 426 } 423 427 424 - if (!test_bit(pin, dln2->irqs_enabled)) 425 - return; 426 - if (test_bit(pin, dln2->irqs_masked)) { 427 - set_bit(pin, dln2->irqs_pending); 428 - return; 429 - } 430 - 431 - switch (dln2->irq_work[pin].type) { 428 + switch (dln2->irq_type[pin]) { 432 429 case DLN2_GPIO_EVENT_CHANGE_RISING: 433 430 if (event->value) 434 431 generic_handle_irq(irq); ··· 440 451 struct dln2_gpio *dln2; 441 452 struct device *dev = &pdev->dev; 442 453 int pins; 443 - int i, ret; 454 + int ret; 444 455 445 456 pins = dln2_gpio_get_pin_count(pdev); 446 457 if (pins < 0) { ··· 456 467 if (!dln2) 457 468 return -ENOMEM; 458 469 459 - dln2->irq_work = devm_kcalloc(&pdev->dev, pins, 460 - sizeof(struct dln2_irq_work), GFP_KERNEL); 461 - if (!dln2->irq_work) 462 - return -ENOMEM; 463 - for (i = 0; i < pins; i++) { 464 - INIT_WORK(&dln2->irq_work[i].work, dln2_irq_work); 465 - dln2->irq_work[i].pin = i; 466 - dln2->irq_work[i].dln2 = dln2; 467 - } 470 + mutex_init(&dln2->irq_lock); 468 471 469 472 dln2->pdev = pdev; 470 473 ··· 510 529 static int dln2_gpio_remove(struct platform_device *pdev) 511 530 { 512 531 struct dln2_gpio *dln2 = platform_get_drvdata(pdev); 513 - int i; 514 532 515 533 dln2_unregister_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV); 516 - for (i = 0; i < dln2->gpio.ngpio; i++) 517 - flush_work(&dln2->irq_work[i].work); 518 534 gpiochip_remove(&dln2->gpio); 519 535 520 536 return 0;
+2 -1
drivers/gpio/gpio-grgpio.c
··· 441 441 err = gpiochip_add(gc); 442 442 if (err) { 443 443 dev_err(&ofdev->dev, "Could not add gpiochip\n"); 444 - irq_domain_remove(priv->domain); 444 + if (priv->domain) 445 + irq_domain_remove(priv->domain); 445 446 return err; 446 447 } 447 448
+1 -1
drivers/gpu/drm/Makefile
··· 37 37 obj-$(CONFIG_DRM_TTM) += ttm/ 38 38 obj-$(CONFIG_DRM_TDFX) += tdfx/ 39 39 obj-$(CONFIG_DRM_R128) += r128/ 40 + obj-$(CONFIG_HSA_AMD) += amd/amdkfd/ 40 41 obj-$(CONFIG_DRM_RADEON)+= radeon/ 41 42 obj-$(CONFIG_DRM_MGA) += mga/ 42 43 obj-$(CONFIG_DRM_I810) += i810/ ··· 68 67 obj-y += i2c/ 69 68 obj-y += panel/ 70 69 obj-y += bridge/ 71 - obj-$(CONFIG_HSA_AMD) += amd/amdkfd/
+169 -149
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
··· 31 31 #include <uapi/linux/kfd_ioctl.h> 32 32 #include <linux/time.h> 33 33 #include <linux/mm.h> 34 - #include <linux/uaccess.h> 35 34 #include <uapi/asm-generic/mman-common.h> 36 35 #include <asm/processor.h> 37 36 #include "kfd_priv.h" ··· 126 127 return 0; 127 128 } 128 129 129 - static long kfd_ioctl_get_version(struct file *filep, struct kfd_process *p, 130 - void __user *arg) 130 + static int kfd_ioctl_get_version(struct file *filep, struct kfd_process *p, 131 + void *data) 131 132 { 132 - struct kfd_ioctl_get_version_args args; 133 + struct kfd_ioctl_get_version_args *args = data; 133 134 int err = 0; 134 135 135 - args.major_version = KFD_IOCTL_MAJOR_VERSION; 136 - args.minor_version = KFD_IOCTL_MINOR_VERSION; 137 - 138 - if (copy_to_user(arg, &args, sizeof(args))) 139 - err = -EFAULT; 136 + args->major_version = KFD_IOCTL_MAJOR_VERSION; 137 + args->minor_version = KFD_IOCTL_MINOR_VERSION; 140 138 141 139 return err; 142 140 } ··· 217 221 return 0; 218 222 } 219 223 220 - static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, 221 - void __user *arg) 224 + static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, 225 + void *data) 222 226 { 223 - struct kfd_ioctl_create_queue_args args; 227 + struct kfd_ioctl_create_queue_args *args = data; 224 228 struct kfd_dev *dev; 225 229 int err = 0; 226 230 unsigned int queue_id; ··· 229 233 230 234 memset(&q_properties, 0, sizeof(struct queue_properties)); 231 235 232 - if (copy_from_user(&args, arg, sizeof(args))) 233 - return -EFAULT; 234 - 235 236 pr_debug("kfd: creating queue ioctl\n"); 236 237 237 - err = set_queue_properties_from_user(&q_properties, &args); 238 + err = set_queue_properties_from_user(&q_properties, args); 238 239 if (err) 239 240 return err; 240 241 241 - dev = kfd_device_by_id(args.gpu_id); 242 + dev = kfd_device_by_id(args->gpu_id); 242 243 if (dev == NULL) 243 244 return -EINVAL; 244 245 ··· 243 250 244 251 pdd = kfd_bind_process_to_device(dev, p); 245 252 if (IS_ERR(pdd)) { 246 - err = PTR_ERR(pdd); 253 + err = -ESRCH; 247 254 goto err_bind_process; 248 255 } 249 256 ··· 256 263 if (err != 0) 257 264 goto err_create_queue; 258 265 259 - args.queue_id = queue_id; 266 + args->queue_id = queue_id; 260 267 261 268 /* Return gpu_id as doorbell offset for mmap usage */ 262 - args.doorbell_offset = args.gpu_id << PAGE_SHIFT; 263 - 264 - if (copy_to_user(arg, &args, sizeof(args))) { 265 - err = -EFAULT; 266 - goto err_copy_args_out; 267 - } 269 + args->doorbell_offset = args->gpu_id << PAGE_SHIFT; 268 270 269 271 mutex_unlock(&p->mutex); 270 272 271 - pr_debug("kfd: queue id %d was created successfully\n", args.queue_id); 273 + pr_debug("kfd: queue id %d was created successfully\n", args->queue_id); 272 274 273 275 pr_debug("ring buffer address == 0x%016llX\n", 274 - args.ring_base_address); 276 + args->ring_base_address); 275 277 276 278 pr_debug("read ptr address == 0x%016llX\n", 277 - args.read_pointer_address); 279 + args->read_pointer_address); 278 280 279 281 pr_debug("write ptr address == 0x%016llX\n", 280 - args.write_pointer_address); 282 + args->write_pointer_address); 281 283 282 284 return 0; 283 285 284 - err_copy_args_out: 285 - pqm_destroy_queue(&p->pqm, queue_id); 286 286 err_create_queue: 287 287 err_bind_process: 288 288 mutex_unlock(&p->mutex); ··· 283 297 } 284 298 285 299 static int kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process *p, 286 - void __user *arg) 300 + void *data) 287 301 { 288 302 int retval; 289 - struct kfd_ioctl_destroy_queue_args args; 290 - 291 - if (copy_from_user(&args, arg, sizeof(args))) 292 - return -EFAULT; 303 + struct kfd_ioctl_destroy_queue_args *args = data; 293 304 294 305 pr_debug("kfd: destroying queue id %d for PASID %d\n", 295 - args.queue_id, 306 + args->queue_id, 296 307 p->pasid); 297 308 298 309 mutex_lock(&p->mutex); 299 310 300 - retval = pqm_destroy_queue(&p->pqm, args.queue_id); 311 + retval = pqm_destroy_queue(&p->pqm, args->queue_id); 301 312 302 313 mutex_unlock(&p->mutex); 303 314 return retval; 304 315 } 305 316 306 317 static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p, 307 - void __user *arg) 318 + void *data) 308 319 { 309 320 int retval; 310 - struct kfd_ioctl_update_queue_args args; 321 + struct kfd_ioctl_update_queue_args *args = data; 311 322 struct queue_properties properties; 312 323 313 - if (copy_from_user(&args, arg, sizeof(args))) 314 - return -EFAULT; 315 - 316 - if (args.queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { 324 + if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { 317 325 pr_err("kfd: queue percentage must be between 0 to KFD_MAX_QUEUE_PERCENTAGE\n"); 318 326 return -EINVAL; 319 327 } 320 328 321 - if (args.queue_priority > KFD_MAX_QUEUE_PRIORITY) { 329 + if (args->queue_priority > KFD_MAX_QUEUE_PRIORITY) { 322 330 pr_err("kfd: queue priority must be between 0 to KFD_MAX_QUEUE_PRIORITY\n"); 323 331 return -EINVAL; 324 332 } 325 333 326 - if ((args.ring_base_address) && 334 + if ((args->ring_base_address) && 327 335 (!access_ok(VERIFY_WRITE, 328 - (const void __user *) args.ring_base_address, 336 + (const void __user *) args->ring_base_address, 329 337 sizeof(uint64_t)))) { 330 338 pr_err("kfd: can't access ring base address\n"); 331 339 return -EFAULT; 332 340 } 333 341 334 - if (!is_power_of_2(args.ring_size) && (args.ring_size != 0)) { 342 + if (!is_power_of_2(args->ring_size) && (args->ring_size != 0)) { 335 343 pr_err("kfd: ring size must be a power of 2 or 0\n"); 336 344 return -EINVAL; 337 345 } 338 346 339 - properties.queue_address = args.ring_base_address; 340 - properties.queue_size = args.ring_size; 341 - properties.queue_percent = args.queue_percentage; 342 - properties.priority = args.queue_priority; 347 + properties.queue_address = args->ring_base_address; 348 + properties.queue_size = args->ring_size; 349 + properties.queue_percent = args->queue_percentage; 350 + properties.priority = args->queue_priority; 343 351 344 352 pr_debug("kfd: updating queue id %d for PASID %d\n", 345 - args.queue_id, p->pasid); 353 + args->queue_id, p->pasid); 346 354 347 355 mutex_lock(&p->mutex); 348 356 349 - retval = pqm_update_queue(&p->pqm, args.queue_id, &properties); 357 + retval = pqm_update_queue(&p->pqm, args->queue_id, &properties); 350 358 351 359 mutex_unlock(&p->mutex); 352 360 353 361 return retval; 354 362 } 355 363 356 - static long kfd_ioctl_set_memory_policy(struct file *filep, 357 - struct kfd_process *p, void __user *arg) 364 + static int kfd_ioctl_set_memory_policy(struct file *filep, 365 + struct kfd_process *p, void *data) 358 366 { 359 - struct kfd_ioctl_set_memory_policy_args args; 367 + struct kfd_ioctl_set_memory_policy_args *args = data; 360 368 struct kfd_dev *dev; 361 369 int err = 0; 362 370 struct kfd_process_device *pdd; 363 371 enum cache_policy default_policy, alternate_policy; 364 372 365 - if (copy_from_user(&args, arg, sizeof(args))) 366 - return -EFAULT; 367 - 368 - if (args.default_policy != KFD_IOC_CACHE_POLICY_COHERENT 369 - && args.default_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { 373 + if (args->default_policy != KFD_IOC_CACHE_POLICY_COHERENT 374 + && args->default_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { 370 375 return -EINVAL; 371 376 } 372 377 373 - if (args.alternate_policy != KFD_IOC_CACHE_POLICY_COHERENT 374 - && args.alternate_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { 378 + if (args->alternate_policy != KFD_IOC_CACHE_POLICY_COHERENT 379 + && args->alternate_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { 375 380 return -EINVAL; 376 381 } 377 382 378 - dev = kfd_device_by_id(args.gpu_id); 383 + dev = kfd_device_by_id(args->gpu_id); 379 384 if (dev == NULL) 380 385 return -EINVAL; 381 386 ··· 374 397 375 398 pdd = kfd_bind_process_to_device(dev, p); 376 399 if (IS_ERR(pdd)) { 377 - err = PTR_ERR(pdd); 400 + err = -ESRCH; 378 401 goto out; 379 402 } 380 403 381 - default_policy = (args.default_policy == KFD_IOC_CACHE_POLICY_COHERENT) 404 + default_policy = (args->default_policy == KFD_IOC_CACHE_POLICY_COHERENT) 382 405 ? cache_policy_coherent : cache_policy_noncoherent; 383 406 384 407 alternate_policy = 385 - (args.alternate_policy == KFD_IOC_CACHE_POLICY_COHERENT) 408 + (args->alternate_policy == KFD_IOC_CACHE_POLICY_COHERENT) 386 409 ? cache_policy_coherent : cache_policy_noncoherent; 387 410 388 411 if (!dev->dqm->set_cache_memory_policy(dev->dqm, 389 412 &pdd->qpd, 390 413 default_policy, 391 414 alternate_policy, 392 - (void __user *)args.alternate_aperture_base, 393 - args.alternate_aperture_size)) 415 + (void __user *)args->alternate_aperture_base, 416 + args->alternate_aperture_size)) 394 417 err = -EINVAL; 395 418 396 419 out: ··· 399 422 return err; 400 423 } 401 424 402 - static long kfd_ioctl_get_clock_counters(struct file *filep, 403 - struct kfd_process *p, void __user *arg) 425 + static int kfd_ioctl_get_clock_counters(struct file *filep, 426 + struct kfd_process *p, void *data) 404 427 { 405 - struct kfd_ioctl_get_clock_counters_args args; 428 + struct kfd_ioctl_get_clock_counters_args *args = data; 406 429 struct kfd_dev *dev; 407 430 struct timespec time; 408 431 409 - if (copy_from_user(&args, arg, sizeof(args))) 410 - return -EFAULT; 411 - 412 - dev = kfd_device_by_id(args.gpu_id); 432 + dev = kfd_device_by_id(args->gpu_id); 413 433 if (dev == NULL) 414 434 return -EINVAL; 415 435 416 436 /* Reading GPU clock counter from KGD */ 417 - args.gpu_clock_counter = kfd2kgd->get_gpu_clock_counter(dev->kgd); 437 + args->gpu_clock_counter = kfd2kgd->get_gpu_clock_counter(dev->kgd); 418 438 419 439 /* No access to rdtsc. Using raw monotonic time */ 420 440 getrawmonotonic(&time); 421 - args.cpu_clock_counter = (uint64_t)timespec_to_ns(&time); 441 + args->cpu_clock_counter = (uint64_t)timespec_to_ns(&time); 422 442 423 443 get_monotonic_boottime(&time); 424 - args.system_clock_counter = (uint64_t)timespec_to_ns(&time); 444 + args->system_clock_counter = (uint64_t)timespec_to_ns(&time); 425 445 426 446 /* Since the counter is in nano-seconds we use 1GHz frequency */ 427 - args.system_clock_freq = 1000000000; 428 - 429 - if (copy_to_user(arg, &args, sizeof(args))) 430 - return -EFAULT; 447 + args->system_clock_freq = 1000000000; 431 448 432 449 return 0; 433 450 } 434 451 435 452 436 453 static int kfd_ioctl_get_process_apertures(struct file *filp, 437 - struct kfd_process *p, void __user *arg) 454 + struct kfd_process *p, void *data) 438 455 { 439 - struct kfd_ioctl_get_process_apertures_args args; 456 + struct kfd_ioctl_get_process_apertures_args *args = data; 440 457 struct kfd_process_device_apertures *pAperture; 441 458 struct kfd_process_device *pdd; 442 459 443 460 dev_dbg(kfd_device, "get apertures for PASID %d", p->pasid); 444 461 445 - if (copy_from_user(&args, arg, sizeof(args))) 446 - return -EFAULT; 447 - 448 - args.num_of_nodes = 0; 462 + args->num_of_nodes = 0; 449 463 450 464 mutex_lock(&p->mutex); 451 465 ··· 445 477 /* Run over all pdd of the process */ 446 478 pdd = kfd_get_first_process_device_data(p); 447 479 do { 448 - pAperture = &args.process_apertures[args.num_of_nodes]; 480 + pAperture = 481 + &args->process_apertures[args->num_of_nodes]; 449 482 pAperture->gpu_id = pdd->dev->id; 450 483 pAperture->lds_base = pdd->lds_base; 451 484 pAperture->lds_limit = pdd->lds_limit; ··· 456 487 pAperture->scratch_limit = pdd->scratch_limit; 457 488 458 489 dev_dbg(kfd_device, 459 - "node id %u\n", args.num_of_nodes); 490 + "node id %u\n", args->num_of_nodes); 460 491 dev_dbg(kfd_device, 461 492 "gpu id %u\n", pdd->dev->id); 462 493 dev_dbg(kfd_device, ··· 472 503 dev_dbg(kfd_device, 473 504 "scratch_limit %llX\n", pdd->scratch_limit); 474 505 475 - args.num_of_nodes++; 506 + args->num_of_nodes++; 476 507 } while ((pdd = kfd_get_next_process_device_data(p, pdd)) != NULL && 477 - (args.num_of_nodes < NUM_OF_SUPPORTED_GPUS)); 508 + (args->num_of_nodes < NUM_OF_SUPPORTED_GPUS)); 478 509 } 479 510 480 511 mutex_unlock(&p->mutex); 481 512 482 - if (copy_to_user(arg, &args, sizeof(args))) 483 - return -EFAULT; 484 - 485 513 return 0; 486 514 } 515 + 516 + #define AMDKFD_IOCTL_DEF(ioctl, _func, _flags) \ 517 + [_IOC_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl} 518 + 519 + /** Ioctl table */ 520 + static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = { 521 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_VERSION, 522 + kfd_ioctl_get_version, 0), 523 + 524 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_CREATE_QUEUE, 525 + kfd_ioctl_create_queue, 0), 526 + 527 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_DESTROY_QUEUE, 528 + kfd_ioctl_destroy_queue, 0), 529 + 530 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_SET_MEMORY_POLICY, 531 + kfd_ioctl_set_memory_policy, 0), 532 + 533 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_CLOCK_COUNTERS, 534 + kfd_ioctl_get_clock_counters, 0), 535 + 536 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_PROCESS_APERTURES, 537 + kfd_ioctl_get_process_apertures, 0), 538 + 539 + AMDKFD_IOCTL_DEF(AMDKFD_IOC_UPDATE_QUEUE, 540 + kfd_ioctl_update_queue, 0), 541 + }; 542 + 543 + #define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls) 487 544 488 545 static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) 489 546 { 490 547 struct kfd_process *process; 491 - long err = -EINVAL; 548 + amdkfd_ioctl_t *func; 549 + const struct amdkfd_ioctl_desc *ioctl = NULL; 550 + unsigned int nr = _IOC_NR(cmd); 551 + char stack_kdata[128]; 552 + char *kdata = NULL; 553 + unsigned int usize, asize; 554 + int retcode = -EINVAL; 492 555 493 - dev_dbg(kfd_device, 494 - "ioctl cmd 0x%x (#%d), arg 0x%lx\n", 495 - cmd, _IOC_NR(cmd), arg); 556 + if (nr >= AMDKFD_CORE_IOCTL_COUNT) 557 + goto err_i1; 558 + 559 + if ((nr >= AMDKFD_COMMAND_START) && (nr < AMDKFD_COMMAND_END)) { 560 + u32 amdkfd_size; 561 + 562 + ioctl = &amdkfd_ioctls[nr]; 563 + 564 + amdkfd_size = _IOC_SIZE(ioctl->cmd); 565 + usize = asize = _IOC_SIZE(cmd); 566 + if (amdkfd_size > asize) 567 + asize = amdkfd_size; 568 + 569 + cmd = ioctl->cmd; 570 + } else 571 + goto err_i1; 572 + 573 + dev_dbg(kfd_device, "ioctl cmd 0x%x (#%d), arg 0x%lx\n", cmd, nr, arg); 496 574 497 575 process = kfd_get_process(current); 498 - if (IS_ERR(process)) 499 - return PTR_ERR(process); 500 - 501 - switch (cmd) { 502 - case KFD_IOC_GET_VERSION: 503 - err = kfd_ioctl_get_version(filep, process, (void __user *)arg); 504 - break; 505 - case KFD_IOC_CREATE_QUEUE: 506 - err = kfd_ioctl_create_queue(filep, process, 507 - (void __user *)arg); 508 - break; 509 - 510 - case KFD_IOC_DESTROY_QUEUE: 511 - err = kfd_ioctl_destroy_queue(filep, process, 512 - (void __user *)arg); 513 - break; 514 - 515 - case KFD_IOC_SET_MEMORY_POLICY: 516 - err = kfd_ioctl_set_memory_policy(filep, process, 517 - (void __user *)arg); 518 - break; 519 - 520 - case KFD_IOC_GET_CLOCK_COUNTERS: 521 - err = kfd_ioctl_get_clock_counters(filep, process, 522 - (void __user *)arg); 523 - break; 524 - 525 - case KFD_IOC_GET_PROCESS_APERTURES: 526 - err = kfd_ioctl_get_process_apertures(filep, process, 527 - (void __user *)arg); 528 - break; 529 - 530 - case KFD_IOC_UPDATE_QUEUE: 531 - err = kfd_ioctl_update_queue(filep, process, 532 - (void __user *)arg); 533 - break; 534 - 535 - default: 536 - dev_err(kfd_device, 537 - "unknown ioctl cmd 0x%x, arg 0x%lx)\n", 538 - cmd, arg); 539 - err = -EINVAL; 540 - break; 576 + if (IS_ERR(process)) { 577 + dev_dbg(kfd_device, "no process\n"); 578 + goto err_i1; 541 579 } 542 580 543 - if (err < 0) 544 - dev_err(kfd_device, 545 - "ioctl error %ld for ioctl cmd 0x%x (#%d)\n", 546 - err, cmd, _IOC_NR(cmd)); 581 + /* Do not trust userspace, use our own definition */ 582 + func = ioctl->func; 547 583 548 - return err; 584 + if (unlikely(!func)) { 585 + dev_dbg(kfd_device, "no function\n"); 586 + retcode = -EINVAL; 587 + goto err_i1; 588 + } 589 + 590 + if (cmd & (IOC_IN | IOC_OUT)) { 591 + if (asize <= sizeof(stack_kdata)) { 592 + kdata = stack_kdata; 593 + } else { 594 + kdata = kmalloc(asize, GFP_KERNEL); 595 + if (!kdata) { 596 + retcode = -ENOMEM; 597 + goto err_i1; 598 + } 599 + } 600 + if (asize > usize) 601 + memset(kdata + usize, 0, asize - usize); 602 + } 603 + 604 + if (cmd & IOC_IN) { 605 + if (copy_from_user(kdata, (void __user *)arg, usize) != 0) { 606 + retcode = -EFAULT; 607 + goto err_i1; 608 + } 609 + } else if (cmd & IOC_OUT) { 610 + memset(kdata, 0, usize); 611 + } 612 + 613 + retcode = func(filep, process, kdata); 614 + 615 + if (cmd & IOC_OUT) 616 + if (copy_to_user((void __user *)arg, kdata, usize) != 0) 617 + retcode = -EFAULT; 618 + 619 + err_i1: 620 + if (!ioctl) 621 + dev_dbg(kfd_device, "invalid ioctl: pid=%d, cmd=0x%02x, nr=0x%02x\n", 622 + task_pid_nr(current), cmd, nr); 623 + 624 + if (kdata != stack_kdata) 625 + kfree(kdata); 626 + 627 + if (retcode) 628 + dev_dbg(kfd_device, "ret = %d\n", retcode); 629 + 630 + return retcode; 549 631 } 550 632 551 633 static int kfd_mmap(struct file *filp, struct vm_area_struct *vma)
+26 -2
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
··· 161 161 { 162 162 int bit = qpd->vmid - KFD_VMID_START_OFFSET; 163 163 164 + /* Release the vmid mapping */ 165 + set_pasid_vmid_mapping(dqm, 0, qpd->vmid); 166 + 164 167 set_bit(bit, (unsigned long *)&dqm->vmid_bitmap); 165 168 qpd->vmid = 0; 166 169 q->properties.vmid = 0; ··· 275 272 return retval; 276 273 } 277 274 275 + pr_debug("kfd: loading mqd to hqd on pipe (%d) queue (%d)\n", 276 + q->pipe, 277 + q->queue); 278 + 279 + retval = mqd->load_mqd(mqd, q->mqd, q->pipe, 280 + q->queue, q->properties.write_ptr); 281 + if (retval != 0) { 282 + deallocate_hqd(dqm, q); 283 + mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); 284 + return retval; 285 + } 286 + 278 287 return 0; 279 288 } 280 289 ··· 335 320 { 336 321 int retval; 337 322 struct mqd_manager *mqd; 323 + bool prev_active = false; 338 324 339 325 BUG_ON(!dqm || !q || !q->mqd); 340 326 ··· 346 330 return -ENOMEM; 347 331 } 348 332 349 - retval = mqd->update_mqd(mqd, q->mqd, &q->properties); 350 333 if (q->properties.is_active == true) 334 + prev_active = true; 335 + 336 + /* 337 + * 338 + * check active state vs. the previous state 339 + * and modify counter accordingly 340 + */ 341 + retval = mqd->update_mqd(mqd, q->mqd, &q->properties); 342 + if ((q->properties.is_active == true) && (prev_active == false)) 351 343 dqm->queue_count++; 352 - else 344 + else if ((q->properties.is_active == false) && (prev_active == true)) 353 345 dqm->queue_count--; 354 346 355 347 if (sched_policy != KFD_SCHED_POLICY_NO_HWS)
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
··· 184 184 uint32_t queue_id) 185 185 { 186 186 187 - return kfd2kgd->hqd_is_occupies(mm->dev->kgd, queue_address, 187 + return kfd2kgd->hqd_is_occupied(mm->dev->kgd, queue_address, 188 188 pipe_id, queue_id); 189 189 190 190 }
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_pasid.c
··· 32 32 { 33 33 pasid_limit = max_num_of_processes; 34 34 35 - pasid_bitmap = kzalloc(BITS_TO_LONGS(pasid_limit), GFP_KERNEL); 35 + pasid_bitmap = kcalloc(BITS_TO_LONGS(pasid_limit), sizeof(long), GFP_KERNEL); 36 36 if (!pasid_bitmap) 37 37 return -ENOMEM; 38 38
+18
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
··· 463 463 bool is_32bit_user_mode; 464 464 }; 465 465 466 + /** 467 + * Ioctl function type. 468 + * 469 + * \param filep pointer to file structure. 470 + * \param p amdkfd process pointer. 471 + * \param data pointer to arg that was copied from user. 472 + */ 473 + typedef int amdkfd_ioctl_t(struct file *filep, struct kfd_process *p, 474 + void *data); 475 + 476 + struct amdkfd_ioctl_desc { 477 + unsigned int cmd; 478 + int flags; 479 + amdkfd_ioctl_t *func; 480 + unsigned int cmd_drv; 481 + const char *name; 482 + }; 483 + 466 484 void kfd_process_create_wq(void); 467 485 void kfd_process_destroy_wq(void); 468 486 struct kfd_process *kfd_create_process(const struct task_struct *);
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
··· 921 921 uint32_t i = 0; 922 922 923 923 list_for_each_entry(dev, &topology_device_list, list) { 924 - ret = kfd_build_sysfs_node_entry(dev, 0); 924 + ret = kfd_build_sysfs_node_entry(dev, i); 925 925 if (ret < 0) 926 926 return ret; 927 927 i++;
+1 -1
drivers/gpu/drm/amd/include/kgd_kfd_interface.h
··· 183 183 int (*hqd_load)(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, 184 184 uint32_t queue_id, uint32_t __user *wptr); 185 185 186 - bool (*hqd_is_occupies)(struct kgd_dev *kgd, uint64_t queue_address, 186 + bool (*hqd_is_occupied)(struct kgd_dev *kgd, uint64_t queue_address, 187 187 uint32_t pipe_id, uint32_t queue_id); 188 188 189 189 int (*hqd_destroy)(struct kgd_dev *kgd, uint32_t reset_type,
-2
drivers/gpu/drm/i915/i915_drv.h
··· 1756 1756 */ 1757 1757 struct workqueue_struct *dp_wq; 1758 1758 1759 - uint32_t bios_vgacntr; 1760 - 1761 1759 /* Abstract the submission mechanism (legacy ringbuffer or execlists) away */ 1762 1760 struct { 1763 1761 int (*do_execbuf)(struct drm_device *dev, struct drm_file *file,
+7 -1
drivers/gpu/drm/i915/i915_gem.c
··· 1048 1048 i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, 1049 1049 struct drm_file *file) 1050 1050 { 1051 + struct drm_i915_private *dev_priv = dev->dev_private; 1051 1052 struct drm_i915_gem_pwrite *args = data; 1052 1053 struct drm_i915_gem_object *obj; 1053 1054 int ret; ··· 1068 1067 return -EFAULT; 1069 1068 } 1070 1069 1070 + intel_runtime_pm_get(dev_priv); 1071 + 1071 1072 ret = i915_mutex_lock_interruptible(dev); 1072 1073 if (ret) 1073 - return ret; 1074 + goto put_rpm; 1074 1075 1075 1076 obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); 1076 1077 if (&obj->base == NULL) { ··· 1124 1121 drm_gem_object_unreference(&obj->base); 1125 1122 unlock: 1126 1123 mutex_unlock(&dev->struct_mutex); 1124 + put_rpm: 1125 + intel_runtime_pm_put(dev_priv); 1126 + 1127 1127 return ret; 1128 1128 } 1129 1129
+2 -4
drivers/gpu/drm/i915/i915_irq.c
··· 3725 3725 if ((iir & flip_pending) == 0) 3726 3726 goto check_page_flip; 3727 3727 3728 - intel_prepare_page_flip(dev, plane); 3729 - 3730 3728 /* We detect FlipDone by looking for the change in PendingFlip from '1' 3731 3729 * to '0' on the following vblank, i.e. IIR has the Pendingflip 3732 3730 * asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence ··· 3734 3736 if (I915_READ16(ISR) & flip_pending) 3735 3737 goto check_page_flip; 3736 3738 3739 + intel_prepare_page_flip(dev, plane); 3737 3740 intel_finish_page_flip(dev, pipe); 3738 3741 return true; 3739 3742 ··· 3906 3907 if ((iir & flip_pending) == 0) 3907 3908 goto check_page_flip; 3908 3909 3909 - intel_prepare_page_flip(dev, plane); 3910 - 3911 3910 /* We detect FlipDone by looking for the change in PendingFlip from '1' 3912 3911 * to '0' on the following vblank, i.e. IIR has the Pendingflip 3913 3912 * asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence ··· 3915 3918 if (I915_READ(ISR) & flip_pending) 3916 3919 goto check_page_flip; 3917 3920 3921 + intel_prepare_page_flip(dev, plane); 3918 3922 intel_finish_page_flip(dev, pipe); 3919 3923 return true; 3920 3924
+1 -7
drivers/gpu/drm/i915/intel_display.c
··· 13057 13057 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); 13058 13058 udelay(300); 13059 13059 13060 - /* 13061 - * Fujitsu-Siemens Lifebook S6010 (830) has problems resuming 13062 - * from S3 without preserving (some of?) the other bits. 13063 - */ 13064 - I915_WRITE(vga_reg, dev_priv->bios_vgacntr | VGA_DISP_DISABLE); 13060 + I915_WRITE(vga_reg, VGA_DISP_DISABLE); 13065 13061 POSTING_READ(vga_reg); 13066 13062 } 13067 13063 ··· 13142 13146 13143 13147 intel_shared_dpll_init(dev); 13144 13148 13145 - /* save the BIOS value before clobbering it */ 13146 - dev_priv->bios_vgacntr = I915_READ(i915_vgacntrl_reg(dev)); 13147 13149 /* Just disable it once at startup */ 13148 13150 i915_disable_vga(dev); 13149 13151 intel_setup_outputs(dev);
-27
drivers/gpu/drm/i915/intel_runtime_pm.c
··· 615 615 vlv_power_sequencer_reset(dev_priv); 616 616 } 617 617 618 - static void check_power_well_state(struct drm_i915_private *dev_priv, 619 - struct i915_power_well *power_well) 620 - { 621 - bool enabled = power_well->ops->is_enabled(dev_priv, power_well); 622 - 623 - if (power_well->always_on || !i915.disable_power_well) { 624 - if (!enabled) 625 - goto mismatch; 626 - 627 - return; 628 - } 629 - 630 - if (enabled != (power_well->count > 0)) 631 - goto mismatch; 632 - 633 - return; 634 - 635 - mismatch: 636 - WARN(1, "state mismatch for '%s' (always_on %d hw state %d use-count %d disable_power_well %d\n", 637 - power_well->name, power_well->always_on, enabled, 638 - power_well->count, i915.disable_power_well); 639 - } 640 - 641 618 /** 642 619 * intel_display_power_get - grab a power domain reference 643 620 * @dev_priv: i915 device instance ··· 646 669 power_well->ops->enable(dev_priv, power_well); 647 670 power_well->hw_enabled = true; 648 671 } 649 - 650 - check_power_well_state(dev_priv, power_well); 651 672 } 652 673 653 674 power_domains->domain_use_count[domain]++; ··· 684 709 power_well->hw_enabled = false; 685 710 power_well->ops->disable(dev_priv, power_well); 686 711 } 687 - 688 - check_power_well_state(dev_priv, power_well); 689 712 } 690 713 691 714 mutex_unlock(&power_domains->lock);
+2 -2
drivers/gpu/drm/nouveau/core/core/event.c
··· 26 26 void 27 27 nvkm_event_put(struct nvkm_event *event, u32 types, int index) 28 28 { 29 - BUG_ON(!spin_is_locked(&event->refs_lock)); 29 + assert_spin_locked(&event->refs_lock); 30 30 while (types) { 31 31 int type = __ffs(types); types &= ~(1 << type); 32 32 if (--event->refs[index * event->types_nr + type] == 0) { ··· 39 39 void 40 40 nvkm_event_get(struct nvkm_event *event, u32 types, int index) 41 41 { 42 - BUG_ON(!spin_is_locked(&event->refs_lock)); 42 + assert_spin_locked(&event->refs_lock); 43 43 while (types) { 44 44 int type = __ffs(types); types &= ~(1 << type); 45 45 if (++event->refs[index * event->types_nr + type] == 1) {
+1 -1
drivers/gpu/drm/nouveau/core/core/notify.c
··· 98 98 struct nvkm_event *event = notify->event; 99 99 unsigned long flags; 100 100 101 - BUG_ON(!spin_is_locked(&event->list_lock)); 101 + assert_spin_locked(&event->list_lock); 102 102 BUG_ON(size != notify->size); 103 103 104 104 spin_lock_irqsave(&event->refs_lock, flags);
+33
drivers/gpu/drm/nouveau/core/engine/device/nve0.c
··· 249 249 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 250 250 device->oclass[NVDEV_ENGINE_PERFMON] = &nvf0_perfmon_oclass; 251 251 break; 252 + case 0x106: 253 + device->cname = "GK208B"; 254 + device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; 255 + device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; 256 + device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; 257 + device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; 258 + device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; 259 + device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; 260 + device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; 261 + device->oclass[NVDEV_SUBDEV_DEVINIT] = nvc0_devinit_oclass; 262 + device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass; 263 + device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; 264 + device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; 265 + device->oclass[NVDEV_SUBDEV_FB ] = nve0_fb_oclass; 266 + device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass; 267 + device->oclass[NVDEV_SUBDEV_IBUS ] = &nve0_ibus_oclass; 268 + device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; 269 + device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; 270 + device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass; 271 + device->oclass[NVDEV_SUBDEV_PWR ] = nv108_pwr_oclass; 272 + device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; 273 + device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; 274 + device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass; 275 + device->oclass[NVDEV_ENGINE_SW ] = nvc0_software_oclass; 276 + device->oclass[NVDEV_ENGINE_GR ] = nv108_graph_oclass; 277 + device->oclass[NVDEV_ENGINE_DISP ] = nvf0_disp_oclass; 278 + device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass; 279 + device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass; 280 + device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass; 281 + device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass; 282 + device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 283 + device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 284 + break; 252 285 case 0x108: 253 286 device->cname = "GK208"; 254 287 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
+4 -2
drivers/gpu/drm/nouveau/core/subdev/bios/shadowramin.c
··· 44 44 pramin_fini(void *data) 45 45 { 46 46 struct priv *priv = data; 47 - nv_wr32(priv->bios, 0x001700, priv->bar0); 48 - kfree(priv); 47 + if (priv) { 48 + nv_wr32(priv->bios, 0x001700, priv->bar0); 49 + kfree(priv); 50 + } 49 51 } 50 52 51 53 static void *
+51 -14
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c
··· 24 24 25 25 #include "nv50.h" 26 26 27 + struct nvaa_ram_priv { 28 + struct nouveau_ram base; 29 + u64 poller_base; 30 + }; 31 + 27 32 static int 28 33 nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, 29 34 struct nouveau_oclass *oclass, void *data, u32 datasize, 30 35 struct nouveau_object **pobject) 31 36 { 32 - const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */ 33 - const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */ 37 + u32 rsvd_head = ( 256 * 1024); /* vga memory */ 38 + u32 rsvd_tail = (1024 * 1024); /* vbios etc */ 34 39 struct nouveau_fb *pfb = nouveau_fb(parent); 35 - struct nouveau_ram *ram; 40 + struct nvaa_ram_priv *priv; 36 41 int ret; 37 42 38 - ret = nouveau_ram_create(parent, engine, oclass, &ram); 39 - *pobject = nv_object(ram); 43 + ret = nouveau_ram_create(parent, engine, oclass, &priv); 44 + *pobject = nv_object(priv); 40 45 if (ret) 41 46 return ret; 42 47 43 - ram->size = nv_rd32(pfb, 0x10020c); 44 - ram->size = (ram->size & 0xffffff00) | ((ram->size & 0x000000ff) << 32); 48 + priv->base.type = NV_MEM_TYPE_STOLEN; 49 + priv->base.stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; 50 + priv->base.size = (u64)nv_rd32(pfb, 0x100e14) << 12; 45 51 46 - ret = nouveau_mm_init(&pfb->vram, rsvd_head, (ram->size >> 12) - 47 - (rsvd_head + rsvd_tail), 1); 52 + rsvd_tail += 0x1000; 53 + priv->poller_base = priv->base.size - rsvd_tail; 54 + 55 + ret = nouveau_mm_init(&pfb->vram, rsvd_head >> 12, 56 + (priv->base.size - (rsvd_head + rsvd_tail)) >> 12, 57 + 1); 48 58 if (ret) 49 59 return ret; 50 60 51 - ram->type = NV_MEM_TYPE_STOLEN; 52 - ram->stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; 53 - ram->get = nv50_ram_get; 54 - ram->put = nv50_ram_put; 61 + priv->base.get = nv50_ram_get; 62 + priv->base.put = nv50_ram_put; 63 + return 0; 64 + } 65 + 66 + static int 67 + nvaa_ram_init(struct nouveau_object *object) 68 + { 69 + struct nouveau_fb *pfb = nouveau_fb(object); 70 + struct nvaa_ram_priv *priv = (void *)object; 71 + int ret; 72 + u64 dniso, hostnb, flush; 73 + 74 + ret = nouveau_ram_init(&priv->base); 75 + if (ret) 76 + return ret; 77 + 78 + dniso = ((priv->base.size - (priv->poller_base + 0x00)) >> 5) - 1; 79 + hostnb = ((priv->base.size - (priv->poller_base + 0x20)) >> 5) - 1; 80 + flush = ((priv->base.size - (priv->poller_base + 0x40)) >> 5) - 1; 81 + 82 + /* Enable NISO poller for various clients and set their associated 83 + * read address, only for MCP77/78 and MCP79/7A. (fd#25701) 84 + */ 85 + nv_wr32(pfb, 0x100c18, dniso); 86 + nv_mask(pfb, 0x100c14, 0x00000000, 0x00000001); 87 + nv_wr32(pfb, 0x100c1c, hostnb); 88 + nv_mask(pfb, 0x100c14, 0x00000000, 0x00000002); 89 + nv_wr32(pfb, 0x100c24, flush); 90 + nv_mask(pfb, 0x100c14, 0x00000000, 0x00010000); 91 + 55 92 return 0; 56 93 } 57 94 ··· 97 60 .ofuncs = &(struct nouveau_ofuncs) { 98 61 .ctor = nvaa_ram_ctor, 99 62 .dtor = _nouveau_ram_dtor, 100 - .init = _nouveau_ram_init, 63 + .init = nvaa_ram_init, 101 64 .fini = _nouveau_ram_fini, 102 65 }, 103 66 };
-8
drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c
··· 24 24 25 25 #include "nv04.h" 26 26 27 - static void 28 - nv4c_mc_msi_rearm(struct nouveau_mc *pmc) 29 - { 30 - struct nv04_mc_priv *priv = (void *)pmc; 31 - nv_wr08(priv, 0x088050, 0xff); 32 - } 33 - 34 27 struct nouveau_oclass * 35 28 nv4c_mc_oclass = &(struct nouveau_mc_oclass) { 36 29 .base.handle = NV_SUBDEV(MC, 0x4c), ··· 34 41 .fini = _nouveau_mc_fini, 35 42 }, 36 43 .intr = nv04_mc_intr, 37 - .msi_rearm = nv4c_mc_msi_rearm, 38 44 }.base;
+3 -1
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 1572 1572 * so use the DMA API for them. 1573 1573 */ 1574 1574 if (!nv_device_is_cpu_coherent(device) && 1575 - ttm->caching_state == tt_uncached) 1575 + ttm->caching_state == tt_uncached) { 1576 1576 ttm_dma_unpopulate(ttm_dma, dev->dev); 1577 + return; 1578 + } 1577 1579 1578 1580 #if __OS_HAS_AGP 1579 1581 if (drm->agp.stat == ENABLED) {
+31 -6
drivers/gpu/drm/nouveau/nouveau_gem.c
··· 36 36 nouveau_gem_object_del(struct drm_gem_object *gem) 37 37 { 38 38 struct nouveau_bo *nvbo = nouveau_gem_object(gem); 39 + struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); 39 40 struct ttm_buffer_object *bo = &nvbo->bo; 41 + struct device *dev = drm->dev->dev; 42 + int ret; 43 + 44 + ret = pm_runtime_get_sync(dev); 45 + if (WARN_ON(ret < 0 && ret != -EACCES)) 46 + return; 40 47 41 48 if (gem->import_attach) 42 49 drm_prime_gem_destroy(gem, nvbo->bo.sg); ··· 53 46 /* reset filp so nouveau_bo_del_ttm() can test for it */ 54 47 gem->filp = NULL; 55 48 ttm_bo_unref(&bo); 49 + 50 + pm_runtime_mark_last_busy(dev); 51 + pm_runtime_put_autosuspend(dev); 56 52 } 57 53 58 54 int ··· 63 53 { 64 54 struct nouveau_cli *cli = nouveau_cli(file_priv); 65 55 struct nouveau_bo *nvbo = nouveau_gem_object(gem); 56 + struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); 66 57 struct nouveau_vma *vma; 58 + struct device *dev = drm->dev->dev; 67 59 int ret; 68 60 69 61 if (!cli->vm) ··· 83 71 goto out; 84 72 } 85 73 86 - ret = nouveau_bo_vma_add(nvbo, cli->vm, vma); 87 - if (ret) { 88 - kfree(vma); 74 + ret = pm_runtime_get_sync(dev); 75 + if (ret < 0 && ret != -EACCES) 89 76 goto out; 90 - } 77 + 78 + ret = nouveau_bo_vma_add(nvbo, cli->vm, vma); 79 + if (ret) 80 + kfree(vma); 81 + 82 + pm_runtime_mark_last_busy(dev); 83 + pm_runtime_put_autosuspend(dev); 91 84 } else { 92 85 vma->refcount++; 93 86 } ··· 146 129 { 147 130 struct nouveau_cli *cli = nouveau_cli(file_priv); 148 131 struct nouveau_bo *nvbo = nouveau_gem_object(gem); 132 + struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); 133 + struct device *dev = drm->dev->dev; 149 134 struct nouveau_vma *vma; 150 135 int ret; 151 136 ··· 160 141 161 142 vma = nouveau_bo_vma_find(nvbo, cli->vm); 162 143 if (vma) { 163 - if (--vma->refcount == 0) 164 - nouveau_gem_object_unmap(nvbo, vma); 144 + if (--vma->refcount == 0) { 145 + ret = pm_runtime_get_sync(dev); 146 + if (!WARN_ON(ret < 0 && ret != -EACCES)) { 147 + nouveau_gem_object_unmap(nvbo, vma); 148 + pm_runtime_mark_last_busy(dev); 149 + pm_runtime_put_autosuspend(dev); 150 + } 151 + } 165 152 } 166 153 ttm_bo_unreserve(&nvbo->bo); 167 154 }
+4 -4
drivers/gpu/drm/radeon/atombios_crtc.c
··· 1851 1851 return pll; 1852 1852 } 1853 1853 /* otherwise, pick one of the plls */ 1854 - if ((rdev->family == CHIP_KAVERI) || 1855 - (rdev->family == CHIP_KABINI) || 1854 + if ((rdev->family == CHIP_KABINI) || 1856 1855 (rdev->family == CHIP_MULLINS)) { 1857 - /* KB/KV/ML has PPLL1 and PPLL2 */ 1856 + /* KB/ML has PPLL1 and PPLL2 */ 1858 1857 pll_in_use = radeon_get_pll_use_mask(crtc); 1859 1858 if (!(pll_in_use & (1 << ATOM_PPLL2))) 1860 1859 return ATOM_PPLL2; ··· 1862 1863 DRM_ERROR("unable to allocate a PPLL\n"); 1863 1864 return ATOM_PPLL_INVALID; 1864 1865 } else { 1865 - /* CI has PPLL0, PPLL1, and PPLL2 */ 1866 + /* CI/KV has PPLL0, PPLL1, and PPLL2 */ 1866 1867 pll_in_use = radeon_get_pll_use_mask(crtc); 1867 1868 if (!(pll_in_use & (1 << ATOM_PPLL2))) 1868 1869 return ATOM_PPLL2; ··· 2154 2155 case ATOM_PPLL0: 2155 2156 /* disable the ppll */ 2156 2157 if ((rdev->family == CHIP_ARUBA) || 2158 + (rdev->family == CHIP_KAVERI) || 2157 2159 (rdev->family == CHIP_BONAIRE) || 2158 2160 (rdev->family == CHIP_HAWAII)) 2159 2161 atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id,
+4
drivers/gpu/drm/radeon/atombios_dp.c
··· 492 492 struct radeon_connector_atom_dig *dig_connector; 493 493 int dp_clock; 494 494 495 + if ((mode->clock > 340000) && 496 + (!radeon_connector_is_dp12_capable(connector))) 497 + return MODE_CLOCK_HIGH; 498 + 495 499 if (!radeon_connector->con_priv) 496 500 return MODE_CLOCK_HIGH; 497 501 dig_connector = radeon_connector->con_priv;
+2
drivers/gpu/drm/radeon/cikd.h
··· 2156 2156 #define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu 2157 2157 #define ATC_VM_APERTURE1_LOW_ADDR 0x3304u 2158 2158 2159 + #define IH_VMID_0_LUT 0x3D40u 2160 + 2159 2161 #endif
+1 -1
drivers/gpu/drm/radeon/dce3_1_afmt.c
··· 103 103 } 104 104 105 105 sad_count = drm_edid_to_sad(radeon_connector->edid, &sads); 106 - if (sad_count < 0) { 106 + if (sad_count <= 0) { 107 107 DRM_ERROR("Couldn't read SADs: %d\n", sad_count); 108 108 return; 109 109 }
+4 -6
drivers/gpu/drm/radeon/kv_dpm.c
··· 2745 2745 pi->enable_auto_thermal_throttling = true; 2746 2746 pi->disable_nb_ps3_in_battery = false; 2747 2747 if (radeon_bapm == -1) { 2748 - /* There are stability issues reported on with 2749 - * bapm enabled on an asrock system. 2750 - */ 2751 - if (rdev->pdev->subsystem_vendor == 0x1849) 2752 - pi->bapm_enable = false; 2753 - else 2748 + /* only enable bapm on KB, ML by default */ 2749 + if (rdev->family == CHIP_KABINI || rdev->family == CHIP_MULLINS) 2754 2750 pi->bapm_enable = true; 2751 + else 2752 + pi->bapm_enable = false; 2755 2753 } else if (radeon_bapm == 0) { 2756 2754 pi->bapm_enable = false; 2757 2755 } else {
+20 -3
drivers/gpu/drm/radeon/radeon_kfd.c
··· 72 72 static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, 73 73 uint32_t queue_id, uint32_t __user *wptr); 74 74 75 - static bool kgd_hqd_is_occupies(struct kgd_dev *kgd, uint64_t queue_address, 75 + static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, 76 76 uint32_t pipe_id, uint32_t queue_id); 77 77 78 78 static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, ··· 92 92 .init_memory = kgd_init_memory, 93 93 .init_pipeline = kgd_init_pipeline, 94 94 .hqd_load = kgd_hqd_load, 95 - .hqd_is_occupies = kgd_hqd_is_occupies, 95 + .hqd_is_occupied = kgd_hqd_is_occupied, 96 96 .hqd_destroy = kgd_hqd_destroy, 97 97 .get_fw_version = get_fw_version 98 98 }; ··· 101 101 102 102 bool radeon_kfd_init(void) 103 103 { 104 + #if defined(CONFIG_HSA_AMD_MODULE) 104 105 bool (*kgd2kfd_init_p)(unsigned, const struct kfd2kgd_calls*, 105 106 const struct kgd2kfd_calls**); 106 107 ··· 118 117 } 119 118 120 119 return true; 120 + #elif defined(CONFIG_HSA_AMD) 121 + if (!kgd2kfd_init(KFD_INTERFACE_VERSION, &kfd2kgd, &kgd2kfd)) { 122 + kgd2kfd = NULL; 123 + 124 + return false; 125 + } 126 + 127 + return true; 128 + #else 129 + return false; 130 + #endif 121 131 } 122 132 123 133 void radeon_kfd_fini(void) ··· 390 378 cpu_relax(); 391 379 write_register(kgd, ATC_VMID_PASID_MAPPING_UPDATE_STATUS, 1U << vmid); 392 380 381 + /* Mapping vmid to pasid also for IH block */ 382 + write_register(kgd, IH_VMID_0_LUT + vmid * sizeof(uint32_t), 383 + pasid_mapping); 384 + 393 385 return 0; 394 386 } 395 387 ··· 533 517 return 0; 534 518 } 535 519 536 - static bool kgd_hqd_is_occupies(struct kgd_dev *kgd, uint64_t queue_address, 520 + static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, 537 521 uint32_t pipe_id, uint32_t queue_id) 538 522 { 539 523 uint32_t act; ··· 572 556 if (timeout == 0) { 573 557 pr_err("kfd: cp queue preemption time out (%dms)\n", 574 558 temp); 559 + release_queue(kgd); 575 560 return -ETIME; 576 561 } 577 562 msleep(20);
+1 -1
drivers/gpu/drm/radeon/radeon_state.c
··· 1703 1703 u32 format; 1704 1704 u32 *buffer; 1705 1705 const u8 __user *data; 1706 - int size, dwords, tex_width, blit_width, spitch; 1706 + unsigned int size, dwords, tex_width, blit_width, spitch; 1707 1707 u32 height; 1708 1708 int i; 1709 1709 u32 texpitch, microtile;
+2 -1
drivers/hid/Kconfig
··· 27 27 28 28 config HID_BATTERY_STRENGTH 29 29 bool "Battery level reporting for HID devices" 30 - depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY 30 + depends on HID 31 + select POWER_SUPPLY 31 32 default n 32 33 ---help--- 33 34 This option adds support of reporting battery strength (for HID devices
+1
drivers/hid/hid-core.c
··· 1805 1805 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, 1806 1806 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, 1807 1807 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, 1808 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, 1808 1809 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, 1809 1810 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1810 1811 { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) },
+1
drivers/hid/hid-ids.h
··· 526 526 #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 527 527 #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 528 528 #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 529 + #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a 529 530 #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 530 531 531 532 #define USB_VENDOR_ID_LABTEC 0x1020
+3
drivers/hid/hid-input.c
··· 312 312 USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), 313 313 HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 314 314 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 315 + USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), 316 + HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 317 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 315 318 USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), 316 319 HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, 317 320 {}
+4
drivers/hid/hid-kye.c
··· 323 323 } 324 324 break; 325 325 case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: 326 + case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: 326 327 if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { 327 328 rdesc = mousepen_i608x_rdesc_fixed; 328 329 *rsize = sizeof(mousepen_i608x_rdesc_fixed); ··· 416 415 switch (id->product) { 417 416 case USB_DEVICE_ID_KYE_EASYPEN_I405X: 418 417 case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: 418 + case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: 419 419 case USB_DEVICE_ID_KYE_EASYPEN_M610X: 420 420 ret = kye_tablet_enable(hdev); 421 421 if (ret) { ··· 447 445 USB_DEVICE_ID_KYE_EASYPEN_I405X) }, 448 446 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 449 447 USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, 448 + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 449 + USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, 450 450 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 451 451 USB_DEVICE_ID_KYE_EASYPEN_M610X) }, 452 452 { HID_USB_DEVICE(USB_VENDOR_ID_KYE,
+15 -1
drivers/hid/hid-logitech-dj.c
··· 962 962 963 963 switch (data[0]) { 964 964 case REPORT_ID_DJ_SHORT: 965 + if (size != DJREPORT_SHORT_LENGTH) { 966 + dev_err(&hdev->dev, "DJ report of bad size (%d)", size); 967 + return false; 968 + } 965 969 return logi_dj_dj_event(hdev, report, data, size); 966 970 case REPORT_ID_HIDPP_SHORT: 967 - /* intentional fallthrough */ 971 + if (size != HIDPP_REPORT_SHORT_LENGTH) { 972 + dev_err(&hdev->dev, 973 + "Short HID++ report of bad size (%d)", size); 974 + return false; 975 + } 976 + return logi_dj_hidpp_event(hdev, report, data, size); 968 977 case REPORT_ID_HIDPP_LONG: 978 + if (size != HIDPP_REPORT_LONG_LENGTH) { 979 + dev_err(&hdev->dev, 980 + "Long HID++ report of bad size (%d)", size); 981 + return false; 982 + } 969 983 return logi_dj_hidpp_event(hdev, report, data, size); 970 984 } 971 985
+41
drivers/hid/hid-logitech-hidpp.c
··· 282 282 (report->rap.sub_id == 0x41); 283 283 } 284 284 285 + /** 286 + * hidpp_prefix_name() prefixes the current given name with "Logitech ". 287 + */ 288 + static void hidpp_prefix_name(char **name, int name_length) 289 + { 290 + #define PREFIX_LENGTH 9 /* "Logitech " */ 291 + 292 + int new_length; 293 + char *new_name; 294 + 295 + if (name_length > PREFIX_LENGTH && 296 + strncmp(*name, "Logitech ", PREFIX_LENGTH) == 0) 297 + /* The prefix has is already in the name */ 298 + return; 299 + 300 + new_length = PREFIX_LENGTH + name_length; 301 + new_name = kzalloc(new_length, GFP_KERNEL); 302 + if (!new_name) 303 + return; 304 + 305 + snprintf(new_name, new_length, "Logitech %s", *name); 306 + 307 + kfree(*name); 308 + 309 + *name = new_name; 310 + } 311 + 285 312 /* -------------------------------------------------------------------------- */ 286 313 /* HIDP++ 1.0 commands */ 287 314 /* -------------------------------------------------------------------------- */ ··· 348 321 return NULL; 349 322 350 323 memcpy(name, &response.rap.params[2], len); 324 + 325 + /* include the terminating '\0' */ 326 + hidpp_prefix_name(&name, len + 1); 327 + 351 328 return name; 352 329 } 353 330 ··· 528 497 } 529 498 index += ret; 530 499 } 500 + 501 + /* include the terminating '\0' */ 502 + hidpp_prefix_name(&name, __name_length + 1); 531 503 532 504 return name; 533 505 } ··· 828 794 829 795 switch (data[0]) { 830 796 case 0x02: 797 + if (size < 2) { 798 + hid_err(hdev, "Received HID report of bad size (%d)", 799 + size); 800 + return 1; 801 + } 831 802 if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { 832 803 input_event(wd->input, EV_KEY, BTN_LEFT, 833 804 !!(data[1] & 0x01)); 834 805 input_event(wd->input, EV_KEY, BTN_RIGHT, 835 806 !!(data[1] & 0x02)); 836 807 input_sync(wd->input); 808 + return 0; 837 809 } else { 838 810 if (size < 21) 839 811 return 1; 840 812 return wtp_mouse_raw_xy_event(hidpp, &data[7]); 841 813 } 842 814 case REPORT_ID_HIDPP_LONG: 815 + /* size is already checked in hidpp_raw_event. */ 843 816 if ((report->fap.feature_index != wd->mt_feature_index) || 844 817 (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) 845 818 return 1;
+6 -2
drivers/hid/hid-roccat-pyra.c
··· 35 35 static void profile_activated(struct pyra_device *pyra, 36 36 unsigned int new_profile) 37 37 { 38 + if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) 39 + return; 38 40 pyra->actual_profile = new_profile; 39 41 pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; 40 42 } ··· 259 257 if (off != 0 || count != PYRA_SIZE_SETTINGS) 260 258 return -EINVAL; 261 259 262 - mutex_lock(&pyra->pyra_lock); 263 - 264 260 settings = (struct pyra_settings const *)buf; 261 + if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) 262 + return -EINVAL; 263 + 264 + mutex_lock(&pyra->pyra_lock); 265 265 266 266 retval = pyra_set_settings(usb_dev, settings); 267 267 if (retval) {
-5
drivers/hid/i2c-hid/i2c-hid.c
··· 706 706 707 707 static void i2c_hid_stop(struct hid_device *hid) 708 708 { 709 - struct i2c_client *client = hid->driver_data; 710 - struct i2c_hid *ihid = i2c_get_clientdata(client); 711 - 712 709 hid->claimed = 0; 713 - 714 - i2c_hid_free_buffers(ihid); 715 710 } 716 711 717 712 static int i2c_hid_open(struct hid_device *hid)
+1
drivers/hid/usbhid/hid-quirks.c
··· 124 124 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, 125 125 { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, 126 126 { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, 127 + { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, 127 128 { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, 128 129 { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, 129 130 { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS },
+4 -8
drivers/iommu/intel-iommu.c
··· 4029 4029 if (action != BUS_NOTIFY_REMOVED_DEVICE) 4030 4030 return 0; 4031 4031 4032 - /* 4033 - * If the device is still attached to a device driver we can't 4034 - * tear down the domain yet as DMA mappings may still be in use. 4035 - * Wait for the BUS_NOTIFY_UNBOUND_DRIVER event to do that. 4036 - */ 4037 - if (action == BUS_NOTIFY_DEL_DEVICE && dev->driver != NULL) 4038 - return 0; 4039 - 4040 4032 domain = find_domain(dev); 4041 4033 if (!domain) 4042 4034 return 0; ··· 4420 4428 domain_remove_one_dev_info(old_domain, dev); 4421 4429 else 4422 4430 domain_remove_dev_info(old_domain); 4431 + 4432 + if (!domain_type_is_vm_or_si(old_domain) && 4433 + list_empty(&old_domain->devices)) 4434 + domain_exit(old_domain); 4423 4435 } 4424 4436 } 4425 4437
+3 -3
drivers/iommu/ipmmu-vmsa.c
··· 558 558 559 559 static u64 ipmmu_page_prot(unsigned int prot, u64 type) 560 560 { 561 - u64 pgprot = ARM_VMSA_PTE_XN | ARM_VMSA_PTE_nG | ARM_VMSA_PTE_AF 561 + u64 pgprot = ARM_VMSA_PTE_nG | ARM_VMSA_PTE_AF 562 562 | ARM_VMSA_PTE_SH_IS | ARM_VMSA_PTE_AP_UNPRIV 563 563 | ARM_VMSA_PTE_NS | type; 564 564 ··· 568 568 if (prot & IOMMU_CACHE) 569 569 pgprot |= IMMAIR_ATTR_IDX_WBRWA << ARM_VMSA_PTE_ATTRINDX_SHIFT; 570 570 571 - if (prot & IOMMU_EXEC) 572 - pgprot &= ~ARM_VMSA_PTE_XN; 571 + if (prot & IOMMU_NOEXEC) 572 + pgprot |= ARM_VMSA_PTE_XN; 573 573 else if (!(prot & (IOMMU_READ | IOMMU_WRITE))) 574 574 /* If no access create a faulting entry to avoid TLB fills. */ 575 575 pgprot &= ~ARM_VMSA_PTE_PAGE;
-1
drivers/iommu/rockchip-iommu.c
··· 1009 1009 .remove = rk_iommu_remove, 1010 1010 .driver = { 1011 1011 .name = "rk_iommu", 1012 - .owner = THIS_MODULE, 1013 1012 .of_match_table = of_match_ptr(rk_iommu_dt_ids), 1014 1013 }, 1015 1014 };
+6 -6
drivers/leds/leds-netxbig.c
··· 330 330 led_dat->sata = 0; 331 331 led_dat->cdev.brightness = LED_OFF; 332 332 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 333 - /* 334 - * If available, expose the SATA activity blink capability through 335 - * a "sata" sysfs attribute. 336 - */ 337 - if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) 338 - led_dat->cdev.groups = netxbig_led_groups; 339 333 led_dat->mode_addr = template->mode_addr; 340 334 led_dat->mode_val = template->mode_val; 341 335 led_dat->bright_addr = template->bright_addr; 342 336 led_dat->bright_max = (1 << pdata->gpio_ext->num_data) - 1; 343 337 led_dat->timer = pdata->timer; 344 338 led_dat->num_timer = pdata->num_timer; 339 + /* 340 + * If available, expose the SATA activity blink capability through 341 + * a "sata" sysfs attribute. 342 + */ 343 + if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) 344 + led_dat->cdev.groups = netxbig_led_groups; 345 345 346 346 return led_classdev_register(&pdev->dev, &led_dat->cdev); 347 347 }
+2
drivers/mmc/host/sdhci-acpi.c
··· 247 247 { "INT33BB" , "3" , &sdhci_acpi_slot_int_sd }, 248 248 { "INT33C6" , NULL, &sdhci_acpi_slot_int_sdio }, 249 249 { "INT3436" , NULL, &sdhci_acpi_slot_int_sdio }, 250 + { "INT344D" , NULL, &sdhci_acpi_slot_int_sdio }, 250 251 { "PNP0D40" }, 251 252 { }, 252 253 }; ··· 258 257 { "INT33BB" }, 259 258 { "INT33C6" }, 260 259 { "INT3436" }, 260 + { "INT344D" }, 261 261 { "PNP0D40" }, 262 262 { }, 263 263 };
+25
drivers/mmc/host/sdhci-pci.c
··· 993 993 .subdevice = PCI_ANY_ID, 994 994 .driver_data = (kernel_ulong_t)&sdhci_intel_mrfl_mmc, 995 995 }, 996 + 997 + { 998 + .vendor = PCI_VENDOR_ID_INTEL, 999 + .device = PCI_DEVICE_ID_INTEL_SPT_EMMC, 1000 + .subvendor = PCI_ANY_ID, 1001 + .subdevice = PCI_ANY_ID, 1002 + .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc, 1003 + }, 1004 + 1005 + { 1006 + .vendor = PCI_VENDOR_ID_INTEL, 1007 + .device = PCI_DEVICE_ID_INTEL_SPT_SDIO, 1008 + .subvendor = PCI_ANY_ID, 1009 + .subdevice = PCI_ANY_ID, 1010 + .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio, 1011 + }, 1012 + 1013 + { 1014 + .vendor = PCI_VENDOR_ID_INTEL, 1015 + .device = PCI_DEVICE_ID_INTEL_SPT_SD, 1016 + .subvendor = PCI_ANY_ID, 1017 + .subdevice = PCI_ANY_ID, 1018 + .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd, 1019 + }, 1020 + 996 1021 { 997 1022 .vendor = PCI_VENDOR_ID_O2, 998 1023 .device = PCI_DEVICE_ID_O2_8120,
+3
drivers/mmc/host/sdhci-pci.h
··· 21 21 #define PCI_DEVICE_ID_INTEL_CLV_EMMC0 0x08e5 22 22 #define PCI_DEVICE_ID_INTEL_CLV_EMMC1 0x08e6 23 23 #define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7 24 + #define PCI_DEVICE_ID_INTEL_SPT_EMMC 0x9d2b 25 + #define PCI_DEVICE_ID_INTEL_SPT_SDIO 0x9d2c 26 + #define PCI_DEVICE_ID_INTEL_SPT_SD 0x9d2d 24 27 25 28 /* 26 29 * PCI registers
+7 -8
drivers/mmc/host/sdhci-pxav3.c
··· 300 300 if (IS_ERR(host)) 301 301 return PTR_ERR(host); 302 302 303 - if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 304 - ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); 305 - if (ret < 0) 306 - goto err_mbus_win; 307 - } 308 - 309 - 310 303 pltfm_host = sdhci_priv(host); 311 304 pltfm_host->priv = pxa; 312 305 ··· 317 324 pxa->clk_core = devm_clk_get(dev, "core"); 318 325 if (!IS_ERR(pxa->clk_core)) 319 326 clk_prepare_enable(pxa->clk_core); 327 + 328 + if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 329 + ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); 330 + if (ret < 0) 331 + goto err_mbus_win; 332 + } 320 333 321 334 /* enable 1/8V DDR capable */ 322 335 host->mmc->caps |= MMC_CAP_1_8V_DDR; ··· 395 396 pm_runtime_disable(&pdev->dev); 396 397 err_of_parse: 397 398 err_cd_req: 399 + err_mbus_win: 398 400 clk_disable_unprepare(pxa->clk_io); 399 401 if (!IS_ERR(pxa->clk_core)) 400 402 clk_disable_unprepare(pxa->clk_core); 401 403 err_clk_get: 402 - err_mbus_win: 403 404 sdhci_pltfm_free(pdev); 404 405 return ret; 405 406 }
+48 -26
drivers/mmc/host/sdhci.c
··· 259 259 260 260 del_timer_sync(&host->tuning_timer); 261 261 host->flags &= ~SDHCI_NEEDS_RETUNING; 262 - host->mmc->max_blk_count = 263 - (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535; 264 262 } 265 263 sdhci_enable_card_detection(host); 266 264 } ··· 1351 1353 1352 1354 sdhci_runtime_pm_get(host); 1353 1355 1356 + present = mmc_gpio_get_cd(host->mmc); 1357 + 1354 1358 spin_lock_irqsave(&host->lock, flags); 1355 1359 1356 1360 WARN_ON(host->mrq != NULL); ··· 1381 1381 * zero: cd-gpio is used, and card is removed 1382 1382 * one: cd-gpio is used, and card is present 1383 1383 */ 1384 - present = mmc_gpio_get_cd(host->mmc); 1385 1384 if (present < 0) { 1386 1385 /* If polling, assume that the card is always present. */ 1387 1386 if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ··· 1879 1880 return !(present_state & SDHCI_DATA_LVL_MASK); 1880 1881 } 1881 1882 1883 + static int sdhci_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_ios *ios) 1884 + { 1885 + struct sdhci_host *host = mmc_priv(mmc); 1886 + unsigned long flags; 1887 + 1888 + spin_lock_irqsave(&host->lock, flags); 1889 + host->flags |= SDHCI_HS400_TUNING; 1890 + spin_unlock_irqrestore(&host->lock, flags); 1891 + 1892 + return 0; 1893 + } 1894 + 1882 1895 static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) 1883 1896 { 1884 1897 struct sdhci_host *host = mmc_priv(mmc); ··· 1898 1887 int tuning_loop_counter = MAX_TUNING_LOOP; 1899 1888 int err = 0; 1900 1889 unsigned long flags; 1890 + unsigned int tuning_count = 0; 1891 + bool hs400_tuning; 1901 1892 1902 1893 sdhci_runtime_pm_get(host); 1903 1894 spin_lock_irqsave(&host->lock, flags); 1895 + 1896 + hs400_tuning = host->flags & SDHCI_HS400_TUNING; 1897 + host->flags &= ~SDHCI_HS400_TUNING; 1898 + 1899 + if (host->tuning_mode == SDHCI_TUNING_MODE_1) 1900 + tuning_count = host->tuning_count; 1904 1901 1905 1902 /* 1906 1903 * The Host Controller needs tuning only in case of SDR104 mode ··· 1918 1899 * tuning function has to be executed. 1919 1900 */ 1920 1901 switch (host->timing) { 1902 + /* HS400 tuning is done in HS200 mode */ 1921 1903 case MMC_TIMING_MMC_HS400: 1904 + err = -EINVAL; 1905 + goto out_unlock; 1906 + 1922 1907 case MMC_TIMING_MMC_HS200: 1908 + /* 1909 + * Periodic re-tuning for HS400 is not expected to be needed, so 1910 + * disable it here. 1911 + */ 1912 + if (hs400_tuning) 1913 + tuning_count = 0; 1914 + break; 1915 + 1923 1916 case MMC_TIMING_UHS_SDR104: 1924 1917 break; 1925 1918 ··· 1942 1911 /* FALLTHROUGH */ 1943 1912 1944 1913 default: 1945 - spin_unlock_irqrestore(&host->lock, flags); 1946 - sdhci_runtime_pm_put(host); 1947 - return 0; 1914 + goto out_unlock; 1948 1915 } 1949 1916 1950 1917 if (host->ops->platform_execute_tuning) { ··· 2066 2037 } 2067 2038 2068 2039 out: 2069 - /* 2070 - * If this is the very first time we are here, we start the retuning 2071 - * timer. Since only during the first time, SDHCI_NEEDS_RETUNING 2072 - * flag won't be set, we check this condition before actually starting 2073 - * the timer. 2074 - */ 2075 - if (!(host->flags & SDHCI_NEEDS_RETUNING) && host->tuning_count && 2076 - (host->tuning_mode == SDHCI_TUNING_MODE_1)) { 2040 + host->flags &= ~SDHCI_NEEDS_RETUNING; 2041 + 2042 + if (tuning_count) { 2077 2043 host->flags |= SDHCI_USING_RETUNING_TIMER; 2078 - mod_timer(&host->tuning_timer, jiffies + 2079 - host->tuning_count * HZ); 2080 - /* Tuning mode 1 limits the maximum data length to 4MB */ 2081 - mmc->max_blk_count = (4 * 1024 * 1024) / mmc->max_blk_size; 2082 - } else if (host->flags & SDHCI_USING_RETUNING_TIMER) { 2083 - host->flags &= ~SDHCI_NEEDS_RETUNING; 2084 - /* Reload the new initial value for timer */ 2085 - mod_timer(&host->tuning_timer, jiffies + 2086 - host->tuning_count * HZ); 2044 + mod_timer(&host->tuning_timer, jiffies + tuning_count * HZ); 2087 2045 } 2088 2046 2089 2047 /* ··· 2086 2070 2087 2071 sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); 2088 2072 sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); 2073 + out_unlock: 2089 2074 spin_unlock_irqrestore(&host->lock, flags); 2090 2075 sdhci_runtime_pm_put(host); 2091 2076 ··· 2127 2110 { 2128 2111 struct sdhci_host *host = mmc_priv(mmc); 2129 2112 unsigned long flags; 2113 + int present; 2130 2114 2131 2115 /* First check if client has provided their own card event */ 2132 2116 if (host->ops->card_event) 2133 2117 host->ops->card_event(host); 2134 2118 2119 + present = sdhci_do_get_cd(host); 2120 + 2135 2121 spin_lock_irqsave(&host->lock, flags); 2136 2122 2137 2123 /* Check host->mrq first in case we are runtime suspended */ 2138 - if (host->mrq && !sdhci_do_get_cd(host)) { 2124 + if (host->mrq && !present) { 2139 2125 pr_err("%s: Card removed during transfer!\n", 2140 2126 mmc_hostname(host->mmc)); 2141 2127 pr_err("%s: Resetting controller.\n", ··· 2162 2142 .hw_reset = sdhci_hw_reset, 2163 2143 .enable_sdio_irq = sdhci_enable_sdio_irq, 2164 2144 .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, 2145 + .prepare_hs400_tuning = sdhci_prepare_hs400_tuning, 2165 2146 .execute_tuning = sdhci_execute_tuning, 2166 2147 .card_event = sdhci_card_event, 2167 2148 .card_busy = sdhci_card_busy, ··· 3281 3260 mmc->max_segs = SDHCI_MAX_SEGS; 3282 3261 3283 3262 /* 3284 - * Maximum number of sectors in one transfer. Limited by DMA boundary 3285 - * size (512KiB). 3263 + * Maximum number of sectors in one transfer. Limited by SDMA boundary 3264 + * size (512KiB). Note some tuning modes impose a 4MiB limit, but this 3265 + * is less anyway. 3286 3266 */ 3287 3267 mmc->max_req_size = 524288; 3288 3268
+3 -1
drivers/net/ethernet/allwinner/sun4i-emac.c
··· 850 850 } 851 851 852 852 db->clk = devm_clk_get(&pdev->dev, NULL); 853 - if (IS_ERR(db->clk)) 853 + if (IS_ERR(db->clk)) { 854 + ret = PTR_ERR(db->clk); 854 855 goto out; 856 + } 855 857 856 858 clk_prepare_enable(db->clk); 857 859
+6 -9
drivers/net/ethernet/altera/altera_tse_main.c
··· 1170 1170 init_error: 1171 1171 free_skbufs(dev); 1172 1172 alloc_skbuf_error: 1173 - if (priv->phydev) { 1174 - phy_disconnect(priv->phydev); 1175 - priv->phydev = NULL; 1176 - } 1177 1173 phy_error: 1178 1174 return ret; 1179 1175 } ··· 1182 1186 int ret; 1183 1187 unsigned long int flags; 1184 1188 1185 - /* Stop and disconnect the PHY */ 1186 - if (priv->phydev) { 1189 + /* Stop the PHY */ 1190 + if (priv->phydev) 1187 1191 phy_stop(priv->phydev); 1188 - phy_disconnect(priv->phydev); 1189 - priv->phydev = NULL; 1190 - } 1191 1192 1192 1193 netif_stop_queue(dev); 1193 1194 napi_disable(&priv->napi); ··· 1518 1525 static int altera_tse_remove(struct platform_device *pdev) 1519 1526 { 1520 1527 struct net_device *ndev = platform_get_drvdata(pdev); 1528 + struct altera_tse_private *priv = netdev_priv(ndev); 1529 + 1530 + if (priv->phydev) 1531 + phy_disconnect(priv->phydev); 1521 1532 1522 1533 platform_set_drvdata(pdev, NULL); 1523 1534 altera_tse_mdio_destroy(ndev);
+4 -2
drivers/net/ethernet/cisco/enic/enic_main.c
··· 1616 1616 if (vnic_rq_desc_used(&enic->rq[i]) == 0) { 1617 1617 netdev_err(netdev, "Unable to alloc receive buffers\n"); 1618 1618 err = -ENOMEM; 1619 - goto err_out_notify_unset; 1619 + goto err_out_free_rq; 1620 1620 } 1621 1621 } 1622 1622 ··· 1649 1649 1650 1650 return 0; 1651 1651 1652 - err_out_notify_unset: 1652 + err_out_free_rq: 1653 + for (i = 0; i < enic->rq_count; i++) 1654 + vnic_rq_clean(&enic->rq[i], enic_free_rq_buf); 1653 1655 enic_dev_notify_unset(enic); 1654 1656 err_out_free_intr: 1655 1657 enic_free_intr(enic);
+1 -1
drivers/net/ethernet/intel/e100.c
··· 1543 1543 mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr); 1544 1544 } else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && 1545 1545 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && 1546 - !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { 1546 + (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { 1547 1547 /* enable/disable MDI/MDI-X auto-switching. */ 1548 1548 mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, 1549 1549 nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH);
+3 -1
drivers/net/ethernet/intel/i40e/i40e_debugfs.c
··· 829 829 if (desc_n >= ring->count || desc_n < 0) { 830 830 dev_info(&pf->pdev->dev, 831 831 "descriptor %d not found\n", desc_n); 832 - return; 832 + goto out; 833 833 } 834 834 if (!is_rx_ring) { 835 835 txd = I40E_TX_DESC(ring, desc_n); ··· 855 855 } else { 856 856 dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n"); 857 857 } 858 + 859 + out: 858 860 kfree(ring); 859 861 } 860 862
+1 -1
drivers/net/ethernet/intel/igb/e1000_82575.c
··· 1125 1125 u32 swmask = mask; 1126 1126 u32 fwmask = mask << 16; 1127 1127 s32 ret_val = 0; 1128 - s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ 1128 + s32 i = 0, timeout = 200; 1129 1129 1130 1130 while (i < timeout) { 1131 1131 if (igb_get_hw_semaphore(hw)) {
+4 -9
drivers/net/ethernet/mellanox/mlx4/main.c
··· 1829 1829 err = mlx4_dev_cap(dev, &dev_cap); 1830 1830 if (err) { 1831 1831 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n"); 1832 - goto err_stop_fw; 1832 + return err; 1833 1833 } 1834 1834 1835 1835 choose_steering_mode(dev, &dev_cap); ··· 1860 1860 &init_hca); 1861 1861 if ((long long) icm_size < 0) { 1862 1862 err = icm_size; 1863 - goto err_stop_fw; 1863 + return err; 1864 1864 } 1865 1865 1866 1866 dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1; ··· 1874 1874 1875 1875 err = mlx4_init_icm(dev, &dev_cap, &init_hca, icm_size); 1876 1876 if (err) 1877 - goto err_stop_fw; 1877 + return err; 1878 1878 1879 1879 err = mlx4_INIT_HCA(dev, &init_hca); 1880 1880 if (err) { ··· 1886 1886 err = mlx4_query_func(dev, &dev_cap); 1887 1887 if (err < 0) { 1888 1888 mlx4_err(dev, "QUERY_FUNC command failed, aborting.\n"); 1889 - goto err_stop_fw; 1889 + goto err_close; 1890 1890 } else if (err & MLX4_QUERY_FUNC_NUM_SYS_EQS) { 1891 1891 dev->caps.num_eqs = dev_cap.max_eqs; 1892 1892 dev->caps.reserved_eqs = dev_cap.reserved_eqs; ··· 2006 2006 if (!mlx4_is_slave(dev)) 2007 2007 mlx4_free_icms(dev); 2008 2008 2009 - err_stop_fw: 2010 - if (!mlx4_is_slave(dev)) { 2011 - mlx4_UNMAP_FA(dev); 2012 - mlx4_free_icm(dev, priv->fw.fw_icm, 0); 2013 - } 2014 2009 return err; 2015 2010 } 2016 2011
+5 -4
drivers/net/ethernet/mellanox/mlx4/mr.c
··· 584 584 void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr) 585 585 { 586 586 mlx4_mtt_cleanup(dev, &mr->mtt); 587 + mr->mtt.order = -1; 587 588 } 588 589 EXPORT_SYMBOL_GPL(mlx4_mr_rereg_mem_cleanup); 589 590 ··· 594 593 { 595 594 int err; 596 595 597 - mpt_entry->start = cpu_to_be64(iova); 598 - mpt_entry->length = cpu_to_be64(size); 599 - mpt_entry->entity_size = cpu_to_be32(page_shift); 600 - 601 596 err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); 602 597 if (err) 603 598 return err; 599 + 600 + mpt_entry->start = cpu_to_be64(mr->iova); 601 + mpt_entry->length = cpu_to_be64(mr->size); 602 + mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); 604 603 605 604 mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | 606 605 MLX4_MPT_PD_FLAG_EN_INV);
+3 -1
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
··· 4033 4033 (void)pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 4034 4034 mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd), 4035 4035 &mgp->cmd_bus, GFP_KERNEL); 4036 - if (mgp->cmd == NULL) 4036 + if (!mgp->cmd) { 4037 + status = -ENOMEM; 4037 4038 goto abort_with_enabled; 4039 + } 4038 4040 4039 4041 mgp->board_span = pci_resource_len(pdev, 0); 4040 4042 mgp->iomem_base = pci_resource_start(pdev, 0);
+3 -5
drivers/net/ethernet/qlogic/qla3xxx.c
··· 146 146 { 147 147 int i = 0; 148 148 149 - while (i < 10) { 150 - if (i) 151 - ssleep(1); 152 - 149 + do { 153 150 if (ql_sem_lock(qdev, 154 151 QL_DRVR_SEM_MASK, 155 152 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) ··· 155 158 "driver lock acquired\n"); 156 159 return 1; 157 160 } 158 - } 161 + ssleep(1); 162 + } while (++i < 10); 159 163 160 164 netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); 161 165 return 0;
+1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 2605 2605 } else { 2606 2606 dev_err(&pdev->dev, 2607 2607 "%s: failed. Please Reboot\n", __func__); 2608 + err = -ENODEV; 2608 2609 goto err_out_free_hw; 2609 2610 } 2610 2611
+8 -11
drivers/net/ethernet/ti/cpsw.c
··· 757 757 static irqreturn_t cpsw_interrupt(int irq, void *dev_id) 758 758 { 759 759 struct cpsw_priv *priv = dev_id; 760 + int value = irq - priv->irqs_table[0]; 761 + 762 + /* NOTICE: Ending IRQ here. The trick with the 'value' variable above 763 + * is to make sure we will always write the correct value to the EOI 764 + * register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2 765 + * for TX Interrupt and 3 for MISC Interrupt. 766 + */ 767 + cpdma_ctlr_eoi(priv->dma, value); 760 768 761 769 cpsw_intr_disable(priv); 762 770 if (priv->irq_enabled == true) { ··· 794 786 int num_tx, num_rx; 795 787 796 788 num_tx = cpdma_chan_process(priv->txch, 128); 797 - if (num_tx) 798 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); 799 789 800 790 num_rx = cpdma_chan_process(priv->rxch, budget); 801 791 if (num_rx < budget) { ··· 801 795 802 796 napi_complete(napi); 803 797 cpsw_intr_enable(priv); 804 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); 805 798 prim_cpsw = cpsw_get_slave_priv(priv, 0); 806 799 if (prim_cpsw->irq_enabled == false) { 807 800 prim_cpsw->irq_enabled = true; ··· 1315 1310 napi_enable(&priv->napi); 1316 1311 cpdma_ctlr_start(priv->dma); 1317 1312 cpsw_intr_enable(priv); 1318 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); 1319 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); 1320 1313 1321 1314 prim_cpsw = cpsw_get_slave_priv(priv, 0); 1322 1315 if (prim_cpsw->irq_enabled == false) { ··· 1581 1578 cpdma_chan_start(priv->txch); 1582 1579 cpdma_ctlr_int_ctrl(priv->dma, true); 1583 1580 cpsw_intr_enable(priv); 1584 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); 1585 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); 1586 - 1587 1581 } 1588 1582 1589 1583 static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) ··· 1620 1620 cpsw_interrupt(ndev->irq, priv); 1621 1621 cpdma_ctlr_int_ctrl(priv->dma, true); 1622 1622 cpsw_intr_enable(priv); 1623 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); 1624 - cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); 1625 - 1626 1623 } 1627 1624 #endif 1628 1625
+2
drivers/net/ethernet/xilinx/ll_temac_main.c
··· 1043 1043 lp->regs = of_iomap(op->dev.of_node, 0); 1044 1044 if (!lp->regs) { 1045 1045 dev_err(&op->dev, "could not map temac regs.\n"); 1046 + rc = -ENOMEM; 1046 1047 goto nodev; 1047 1048 } 1048 1049 ··· 1063 1062 np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); 1064 1063 if (!np) { 1065 1064 dev_err(&op->dev, "could not find DMA node\n"); 1065 + rc = -ENODEV; 1066 1066 goto err_iounmap; 1067 1067 } 1068 1068
+2
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
··· 1501 1501 lp->regs = of_iomap(op->dev.of_node, 0); 1502 1502 if (!lp->regs) { 1503 1503 dev_err(&op->dev, "could not map Axi Ethernet regs.\n"); 1504 + ret = -ENOMEM; 1504 1505 goto nodev; 1505 1506 } 1506 1507 /* Setup checksum offload, but default to off if not specified */ ··· 1564 1563 np = of_parse_phandle(op->dev.of_node, "axistream-connected", 0); 1565 1564 if (!np) { 1566 1565 dev_err(&op->dev, "could not find DMA node\n"); 1566 + ret = -ENODEV; 1567 1567 goto err_iounmap; 1568 1568 } 1569 1569 lp->dma_regs = of_iomap(np, 0);
+1
drivers/net/ethernet/xilinx/xilinx_emaclite.c
··· 1109 1109 res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); 1110 1110 if (!res) { 1111 1111 dev_err(dev, "no IRQ found\n"); 1112 + rc = -ENXIO; 1112 1113 goto error; 1113 1114 } 1114 1115
+7 -3
drivers/net/usb/qmi_wwan.c
··· 56 56 /* default ethernet address used by the modem */ 57 57 static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; 58 58 59 + static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00}; 60 + 59 61 /* Make up an ethernet header if the packet doesn't have one. 60 62 * 61 63 * A firmware bug common among several devices cause them to send raw ··· 334 332 usb_driver_release_interface(driver, info->data); 335 333 } 336 334 337 - /* Never use the same address on both ends of the link, even 338 - * if the buggy firmware told us to. 335 + /* Never use the same address on both ends of the link, even if the 336 + * buggy firmware told us to. Or, if device is assigned the well-known 337 + * buggy firmware MAC address, replace it with a random address, 339 338 */ 340 - if (ether_addr_equal(dev->net->dev_addr, default_modem_addr)) 339 + if (ether_addr_equal(dev->net->dev_addr, default_modem_addr) || 340 + ether_addr_equal(dev->net->dev_addr, buggy_fw_addr)) 341 341 eth_hw_addr_random(dev->net); 342 342 343 343 /* make MAC addr easily distinguishable from an IP header */
+17
drivers/net/usb/r8152.c
··· 1897 1897 netif_wake_queue(netdev); 1898 1898 } 1899 1899 1900 + static netdev_features_t 1901 + rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, 1902 + netdev_features_t features) 1903 + { 1904 + u32 mss = skb_shinfo(skb)->gso_size; 1905 + int max_offset = mss ? GTTCPHO_MAX : TCPHO_MAX; 1906 + int offset = skb_transport_offset(skb); 1907 + 1908 + if ((mss || skb->ip_summed == CHECKSUM_PARTIAL) && offset > max_offset) 1909 + features &= ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); 1910 + else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz) 1911 + features &= ~NETIF_F_GSO_MASK; 1912 + 1913 + return features; 1914 + } 1915 + 1900 1916 static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, 1901 1917 struct net_device *netdev) 1902 1918 { ··· 3722 3706 .ndo_set_mac_address = rtl8152_set_mac_address, 3723 3707 .ndo_change_mtu = rtl8152_change_mtu, 3724 3708 .ndo_validate_addr = eth_validate_addr, 3709 + .ndo_features_check = rtl8152_features_check, 3725 3710 }; 3726 3711 3727 3712 static void r8152b_get_version(struct r8152 *tp)
+1
drivers/net/xen-netback/xenbus.c
··· 737 737 } 738 738 739 739 queue->remaining_credit = credit_bytes; 740 + queue->credit_usec = credit_usec; 740 741 741 742 err = connect_rings(be, queue); 742 743 if (err) {
+54 -3
drivers/pinctrl/pinctrl-rockchip.c
··· 89 89 * @reg_pull: optional separate register for additional pull settings 90 90 * @clk: clock of the gpio bank 91 91 * @irq: interrupt of the gpio bank 92 + * @saved_enables: Saved content of GPIO_INTEN at suspend time. 92 93 * @pin_base: first pin number 93 94 * @nr_pins: number of pins in this bank 94 95 * @name: name of the bank ··· 108 107 struct regmap *regmap_pull; 109 108 struct clk *clk; 110 109 int irq; 110 + u32 saved_enables; 111 111 u32 pin_base; 112 112 u8 nr_pins; 113 113 char *name; ··· 1545 1543 return 0; 1546 1544 } 1547 1545 1546 + static void rockchip_irq_suspend(struct irq_data *d) 1547 + { 1548 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 1549 + struct rockchip_pin_bank *bank = gc->private; 1550 + 1551 + bank->saved_enables = irq_reg_readl(gc, GPIO_INTEN); 1552 + irq_reg_writel(gc, gc->wake_active, GPIO_INTEN); 1553 + } 1554 + 1555 + static void rockchip_irq_resume(struct irq_data *d) 1556 + { 1557 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 1558 + struct rockchip_pin_bank *bank = gc->private; 1559 + 1560 + irq_reg_writel(gc, bank->saved_enables, GPIO_INTEN); 1561 + } 1562 + 1563 + static void rockchip_irq_disable(struct irq_data *d) 1564 + { 1565 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 1566 + u32 val; 1567 + 1568 + irq_gc_lock(gc); 1569 + 1570 + val = irq_reg_readl(gc, GPIO_INTEN); 1571 + val &= ~d->mask; 1572 + irq_reg_writel(gc, val, GPIO_INTEN); 1573 + 1574 + irq_gc_unlock(gc); 1575 + } 1576 + 1577 + static void rockchip_irq_enable(struct irq_data *d) 1578 + { 1579 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 1580 + u32 val; 1581 + 1582 + irq_gc_lock(gc); 1583 + 1584 + val = irq_reg_readl(gc, GPIO_INTEN); 1585 + val |= d->mask; 1586 + irq_reg_writel(gc, val, GPIO_INTEN); 1587 + 1588 + irq_gc_unlock(gc); 1589 + } 1590 + 1548 1591 static int rockchip_interrupts_register(struct platform_device *pdev, 1549 1592 struct rockchip_pinctrl *info) 1550 1593 { ··· 1628 1581 gc = irq_get_domain_generic_chip(bank->domain, 0); 1629 1582 gc->reg_base = bank->reg_base; 1630 1583 gc->private = bank; 1631 - gc->chip_types[0].regs.mask = GPIO_INTEN; 1584 + gc->chip_types[0].regs.mask = GPIO_INTMASK; 1632 1585 gc->chip_types[0].regs.ack = GPIO_PORTS_EOI; 1633 1586 gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit; 1634 - gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; 1635 - gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; 1587 + gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit; 1588 + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit; 1589 + gc->chip_types[0].chip.irq_enable = rockchip_irq_enable; 1590 + gc->chip_types[0].chip.irq_disable = rockchip_irq_disable; 1636 1591 gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; 1592 + gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend; 1593 + gc->chip_types[0].chip.irq_resume = rockchip_irq_resume; 1637 1594 gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type; 1638 1595 gc->wake_enabled = IRQ_MSK(bank->nr_pins); 1639 1596
+4 -1
drivers/pinctrl/pinctrl-st.c
··· 1012 1012 struct seq_file *s, unsigned pin_id) 1013 1013 { 1014 1014 unsigned long config; 1015 - st_pinconf_get(pctldev, pin_id, &config); 1016 1015 1016 + mutex_unlock(&pctldev->mutex); 1017 + st_pinconf_get(pctldev, pin_id, &config); 1018 + mutex_lock(&pctldev->mutex); 1017 1019 seq_printf(s, "[OE:%ld,PU:%ld,OD:%ld]\n" 1018 1020 "\t\t[retime:%ld,invclk:%ld,clknotdat:%ld," 1019 1021 "de:%ld,rt-clk:%ld,rt-delay:%ld]", ··· 1445 1443 1446 1444 static struct irq_chip st_gpio_irqchip = { 1447 1445 .name = "GPIO", 1446 + .irq_disable = st_gpio_irq_mask, 1448 1447 .irq_mask = st_gpio_irq_mask, 1449 1448 .irq_unmask = st_gpio_irq_unmask, 1450 1449 .irq_set_type = st_gpio_irq_set_type,
+3 -1
drivers/scsi/qla2xxx/qla_os.c
··· 734 734 * Return target busy if we've received a non-zero retry_delay_timer 735 735 * in a FCP_RSP. 736 736 */ 737 - if (time_after(jiffies, fcport->retry_delay_timestamp)) 737 + if (fcport->retry_delay_timestamp == 0) { 738 + /* retry delay not set */ 739 + } else if (time_after(jiffies, fcport->retry_delay_timestamp)) 738 740 fcport->retry_delay_timestamp = 0; 739 741 else 740 742 goto qc24_target_busy;
+6 -6
drivers/target/iscsi/iscsi_target.c
··· 2027 2027 goto reject; 2028 2028 } 2029 2029 if (!strncmp("=All", text_ptr, 4)) { 2030 - cmd->cmd_flags |= IFC_SENDTARGETS_ALL; 2030 + cmd->cmd_flags |= ICF_SENDTARGETS_ALL; 2031 2031 } else if (!strncmp("=iqn.", text_ptr, 5) || 2032 2032 !strncmp("=eui.", text_ptr, 5)) { 2033 - cmd->cmd_flags |= IFC_SENDTARGETS_SINGLE; 2033 + cmd->cmd_flags |= ICF_SENDTARGETS_SINGLE; 2034 2034 } else { 2035 2035 pr_err("Unable to locate valid SendTargets=%s value\n", text_ptr); 2036 2036 goto reject; ··· 3415 3415 return -ENOMEM; 3416 3416 } 3417 3417 /* 3418 - * Locate pointer to iqn./eui. string for IFC_SENDTARGETS_SINGLE 3418 + * Locate pointer to iqn./eui. string for ICF_SENDTARGETS_SINGLE 3419 3419 * explicit case.. 3420 3420 */ 3421 - if (cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) { 3421 + if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) { 3422 3422 text_ptr = strchr(text_in, '='); 3423 3423 if (!text_ptr) { 3424 3424 pr_err("Unable to locate '=' string in text_in:" ··· 3434 3434 3435 3435 spin_lock(&tiqn_lock); 3436 3436 list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) { 3437 - if ((cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) && 3437 + if ((cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) && 3438 3438 strcmp(tiqn->tiqn, text_ptr)) { 3439 3439 continue; 3440 3440 } ··· 3512 3512 if (end_of_buf) 3513 3513 break; 3514 3514 3515 - if (cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) 3515 + if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) 3516 3516 break; 3517 3517 } 3518 3518 spin_unlock(&tiqn_lock);
+2 -2
drivers/target/iscsi/iscsi_target_core.h
··· 135 135 ICF_CONTIG_MEMORY = 0x00000020, 136 136 ICF_ATTACHED_TO_RQUEUE = 0x00000040, 137 137 ICF_OOO_CMDSN = 0x00000080, 138 - IFC_SENDTARGETS_ALL = 0x00000100, 139 - IFC_SENDTARGETS_SINGLE = 0x00000200, 138 + ICF_SENDTARGETS_ALL = 0x00000100, 139 + ICF_SENDTARGETS_SINGLE = 0x00000200, 140 140 }; 141 141 142 142 /* struct iscsi_cmd->i_state */
+4 -50
drivers/target/target_core_device.c
··· 1103 1103 } 1104 1104 EXPORT_SYMBOL(se_dev_set_queue_depth); 1105 1105 1106 - int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) 1107 - { 1108 - int block_size = dev->dev_attrib.block_size; 1109 - 1110 - if (dev->export_count) { 1111 - pr_err("dev[%p]: Unable to change SE Device" 1112 - " fabric_max_sectors while export_count is %d\n", 1113 - dev, dev->export_count); 1114 - return -EINVAL; 1115 - } 1116 - if (!fabric_max_sectors) { 1117 - pr_err("dev[%p]: Illegal ZERO value for" 1118 - " fabric_max_sectors\n", dev); 1119 - return -EINVAL; 1120 - } 1121 - if (fabric_max_sectors < DA_STATUS_MAX_SECTORS_MIN) { 1122 - pr_err("dev[%p]: Passed fabric_max_sectors: %u less than" 1123 - " DA_STATUS_MAX_SECTORS_MIN: %u\n", dev, fabric_max_sectors, 1124 - DA_STATUS_MAX_SECTORS_MIN); 1125 - return -EINVAL; 1126 - } 1127 - if (fabric_max_sectors > DA_STATUS_MAX_SECTORS_MAX) { 1128 - pr_err("dev[%p]: Passed fabric_max_sectors: %u" 1129 - " greater than DA_STATUS_MAX_SECTORS_MAX:" 1130 - " %u\n", dev, fabric_max_sectors, 1131 - DA_STATUS_MAX_SECTORS_MAX); 1132 - return -EINVAL; 1133 - } 1134 - /* 1135 - * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() 1136 - */ 1137 - if (!block_size) { 1138 - block_size = 512; 1139 - pr_warn("Defaulting to 512 for zero block_size\n"); 1140 - } 1141 - fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors, 1142 - block_size); 1143 - 1144 - dev->dev_attrib.fabric_max_sectors = fabric_max_sectors; 1145 - pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", 1146 - dev, fabric_max_sectors); 1147 - return 0; 1148 - } 1149 - EXPORT_SYMBOL(se_dev_set_fabric_max_sectors); 1150 - 1151 1106 int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) 1152 1107 { 1153 1108 if (dev->export_count) { ··· 1111 1156 dev, dev->export_count); 1112 1157 return -EINVAL; 1113 1158 } 1114 - if (optimal_sectors > dev->dev_attrib.fabric_max_sectors) { 1159 + if (optimal_sectors > dev->dev_attrib.hw_max_sectors) { 1115 1160 pr_err("dev[%p]: Passed optimal_sectors %u cannot be" 1116 - " greater than fabric_max_sectors: %u\n", dev, 1117 - optimal_sectors, dev->dev_attrib.fabric_max_sectors); 1161 + " greater than hw_max_sectors: %u\n", dev, 1162 + optimal_sectors, dev->dev_attrib.hw_max_sectors); 1118 1163 return -EINVAL; 1119 1164 } 1120 1165 ··· 1508 1553 dev->dev_attrib.unmap_granularity_alignment = 1509 1554 DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; 1510 1555 dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN; 1511 - dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS; 1512 - dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS; 1513 1556 1514 1557 xcopy_lun = &dev->xcopy_lun; 1515 1558 xcopy_lun->lun_se_dev = dev; ··· 1548 1595 dev->dev_attrib.hw_max_sectors = 1549 1596 se_dev_align_max_sectors(dev->dev_attrib.hw_max_sectors, 1550 1597 dev->dev_attrib.hw_block_size); 1598 + dev->dev_attrib.optimal_sectors = dev->dev_attrib.hw_max_sectors; 1551 1599 1552 1600 dev->dev_index = scsi_get_new_index(SCSI_DEVICE_INDEX); 1553 1601 dev->creation_time = get_jiffies_64();
+10 -2
drivers/target/target_core_file.c
··· 621 621 struct fd_prot fd_prot; 622 622 sense_reason_t rc; 623 623 int ret = 0; 624 - 624 + /* 625 + * We are currently limited by the number of iovecs (2048) per 626 + * single vfs_[writev,readv] call. 627 + */ 628 + if (cmd->data_length > FD_MAX_BYTES) { 629 + pr_err("FILEIO: Not able to process I/O of %u bytes due to" 630 + "FD_MAX_BYTES: %u iovec count limitiation\n", 631 + cmd->data_length, FD_MAX_BYTES); 632 + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 633 + } 625 634 /* 626 635 * Call vectorized fileio functions to map struct scatterlist 627 636 * physical memory addresses to struct iovec virtual memory. ··· 968 959 &fileio_dev_attrib_hw_block_size.attr, 969 960 &fileio_dev_attrib_block_size.attr, 970 961 &fileio_dev_attrib_hw_max_sectors.attr, 971 - &fileio_dev_attrib_fabric_max_sectors.attr, 972 962 &fileio_dev_attrib_optimal_sectors.attr, 973 963 &fileio_dev_attrib_hw_queue_depth.attr, 974 964 &fileio_dev_attrib_queue_depth.attr,
+1 -2
drivers/target/target_core_iblock.c
··· 124 124 q = bdev_get_queue(bd); 125 125 126 126 dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); 127 - dev->dev_attrib.hw_max_sectors = UINT_MAX; 127 + dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); 128 128 dev->dev_attrib.hw_queue_depth = q->nr_requests; 129 129 130 130 /* ··· 883 883 &iblock_dev_attrib_hw_block_size.attr, 884 884 &iblock_dev_attrib_block_size.attr, 885 885 &iblock_dev_attrib_hw_max_sectors.attr, 886 - &iblock_dev_attrib_fabric_max_sectors.attr, 887 886 &iblock_dev_attrib_optimal_sectors.attr, 888 887 &iblock_dev_attrib_hw_queue_depth.attr, 889 888 &iblock_dev_attrib_queue_depth.attr,
+12
drivers/target/target_core_pr.c
··· 528 528 529 529 return 0; 530 530 } 531 + } else if (we && registered_nexus) { 532 + /* 533 + * Reads are allowed for Write Exclusive locks 534 + * from all registrants. 535 + */ 536 + if (cmd->data_direction == DMA_FROM_DEVICE) { 537 + pr_debug("Allowing READ CDB: 0x%02x for %s" 538 + " reservation\n", cdb[0], 539 + core_scsi3_pr_dump_type(pr_reg_type)); 540 + 541 + return 0; 542 + } 531 543 } 532 544 pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" 533 545 " for %s reservation\n", transport_dump_cmd_direction(cmd),
-1
drivers/target/target_core_rd.c
··· 657 657 &rd_mcp_dev_attrib_hw_block_size.attr, 658 658 &rd_mcp_dev_attrib_block_size.attr, 659 659 &rd_mcp_dev_attrib_hw_max_sectors.attr, 660 - &rd_mcp_dev_attrib_fabric_max_sectors.attr, 661 660 &rd_mcp_dev_attrib_optimal_sectors.attr, 662 661 &rd_mcp_dev_attrib_hw_queue_depth.attr, 663 662 &rd_mcp_dev_attrib_queue_depth.attr,
-15
drivers/target/target_core_sbc.c
··· 953 953 954 954 if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { 955 955 unsigned long long end_lba; 956 - 957 - if (sectors > dev->dev_attrib.fabric_max_sectors) { 958 - printk_ratelimited(KERN_ERR "SCSI OP %02xh with too" 959 - " big sectors %u exceeds fabric_max_sectors:" 960 - " %u\n", cdb[0], sectors, 961 - dev->dev_attrib.fabric_max_sectors); 962 - return TCM_INVALID_CDB_FIELD; 963 - } 964 - if (sectors > dev->dev_attrib.hw_max_sectors) { 965 - printk_ratelimited(KERN_ERR "SCSI OP %02xh with too" 966 - " big sectors %u exceeds backend hw_max_sectors:" 967 - " %u\n", cdb[0], sectors, 968 - dev->dev_attrib.hw_max_sectors); 969 - return TCM_INVALID_CDB_FIELD; 970 - } 971 956 check_lba: 972 957 end_lba = dev->transport->get_blocks(dev) + 1; 973 958 if (cmd->t_task_lba + sectors > end_lba) {
+1 -4
drivers/target/target_core_spc.c
··· 505 505 spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) 506 506 { 507 507 struct se_device *dev = cmd->se_dev; 508 - u32 max_sectors; 509 508 int have_tp = 0; 510 509 int opt, min; 511 510 ··· 538 539 /* 539 540 * Set MAXIMUM TRANSFER LENGTH 540 541 */ 541 - max_sectors = min(dev->dev_attrib.fabric_max_sectors, 542 - dev->dev_attrib.hw_max_sectors); 543 - put_unaligned_be32(max_sectors, &buf[8]); 542 + put_unaligned_be32(dev->dev_attrib.hw_max_sectors, &buf[8]); 544 543 545 544 /* 546 545 * Set OPTIMAL TRANSFER LENGTH
-1
drivers/target/target_core_user.c
··· 1118 1118 &tcmu_dev_attrib_hw_block_size.attr, 1119 1119 &tcmu_dev_attrib_block_size.attr, 1120 1120 &tcmu_dev_attrib_hw_max_sectors.attr, 1121 - &tcmu_dev_attrib_fabric_max_sectors.attr, 1122 1121 &tcmu_dev_attrib_optimal_sectors.attr, 1123 1122 &tcmu_dev_attrib_hw_queue_depth.attr, 1124 1123 &tcmu_dev_attrib_queue_depth.attr,
+4 -12
drivers/thermal/int340x_thermal/acpi_thermal_rel.c
··· 119 119 continue; 120 120 121 121 result = acpi_bus_get_device(trt->source, &adev); 122 - if (!result) 123 - acpi_create_platform_device(adev); 124 - else 122 + if (result) 125 123 pr_warn("Failed to get source ACPI device\n"); 126 124 127 125 result = acpi_bus_get_device(trt->target, &adev); 128 - if (!result) 129 - acpi_create_platform_device(adev); 130 - else 126 + if (result) 131 127 pr_warn("Failed to get target ACPI device\n"); 132 128 } 133 129 ··· 202 206 203 207 if (art->source) { 204 208 result = acpi_bus_get_device(art->source, &adev); 205 - if (!result) 206 - acpi_create_platform_device(adev); 207 - else 209 + if (result) 208 210 pr_warn("Failed to get source ACPI device\n"); 209 211 } 210 212 if (art->target) { 211 213 result = acpi_bus_get_device(art->target, &adev); 212 - if (!result) 213 - acpi_create_platform_device(adev); 214 - else 214 + if (result) 215 215 pr_warn("Failed to get source ACPI device\n"); 216 216 } 217 217 }
+2
drivers/thermal/int340x_thermal/processor_thermal_device.c
··· 130 130 int ret; 131 131 132 132 adev = ACPI_COMPANION(dev); 133 + if (!adev) 134 + return -ENODEV; 133 135 134 136 status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); 135 137 if (ACPI_FAILURE(status))
+1 -3
drivers/vfio/pci/vfio_pci.c
··· 840 840 841 841 static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 842 842 { 843 - u8 type; 844 843 struct vfio_pci_device *vdev; 845 844 struct iommu_group *group; 846 845 int ret; 847 846 848 - pci_read_config_byte(pdev, PCI_HEADER_TYPE, &type); 849 - if ((type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL) 847 + if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL) 850 848 return -EINVAL; 851 849 852 850 group = iommu_group_get(&pdev->dev);
+1 -1
drivers/vhost/net.c
··· 538 538 ++headcount; 539 539 seg += in; 540 540 } 541 - heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen); 541 + heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen); 542 542 *iovcount = seg; 543 543 if (unlikely(log)) 544 544 *log_num = nlogs;
+21 -3
drivers/vhost/scsi.c
··· 911 911 return 0; 912 912 } 913 913 914 + static int vhost_scsi_to_tcm_attr(int attr) 915 + { 916 + switch (attr) { 917 + case VIRTIO_SCSI_S_SIMPLE: 918 + return TCM_SIMPLE_TAG; 919 + case VIRTIO_SCSI_S_ORDERED: 920 + return TCM_ORDERED_TAG; 921 + case VIRTIO_SCSI_S_HEAD: 922 + return TCM_HEAD_TAG; 923 + case VIRTIO_SCSI_S_ACA: 924 + return TCM_ACA_TAG; 925 + default: 926 + break; 927 + } 928 + return TCM_SIMPLE_TAG; 929 + } 930 + 914 931 static void tcm_vhost_submission_work(struct work_struct *work) 915 932 { 916 933 struct tcm_vhost_cmd *cmd = ··· 953 936 rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, 954 937 cmd->tvc_cdb, &cmd->tvc_sense_buf[0], 955 938 cmd->tvc_lun, cmd->tvc_exp_data_len, 956 - cmd->tvc_task_attr, cmd->tvc_data_direction, 957 - TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, 958 - NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count); 939 + vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), 940 + cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, 941 + sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, 942 + cmd->tvc_prot_sgl_count); 959 943 if (rc < 0) { 960 944 transport_send_check_condition_and_sense(se_cmd, 961 945 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
+1 -9
drivers/virtio/virtio_pci_common.c
··· 282 282 283 283 vp_free_vectors(vdev); 284 284 kfree(vp_dev->vqs); 285 + vp_dev->vqs = NULL; 285 286 } 286 287 287 288 static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, ··· 420 419 } 421 420 } 422 421 return 0; 423 - } 424 - 425 - void virtio_pci_release_dev(struct device *_d) 426 - { 427 - /* 428 - * No need for a release method as we allocate/free 429 - * all devices together with the pci devices. 430 - * Provide an empty one to avoid getting a warning from core. 431 - */ 432 422 } 433 423 434 424 #ifdef CONFIG_PM_SLEEP
-1
drivers/virtio/virtio_pci_common.h
··· 126 126 * - ignore the affinity request if we're using INTX 127 127 */ 128 128 int vp_set_vq_affinity(struct virtqueue *vq, int cpu); 129 - void virtio_pci_release_dev(struct device *); 130 129 131 130 int virtio_pci_legacy_probe(struct pci_dev *pci_dev, 132 131 const struct pci_device_id *id);
+11 -1
drivers/virtio/virtio_pci_legacy.c
··· 211 211 .set_vq_affinity = vp_set_vq_affinity, 212 212 }; 213 213 214 + static void virtio_pci_release_dev(struct device *_d) 215 + { 216 + struct virtio_device *vdev = dev_to_virtio(_d); 217 + struct virtio_pci_device *vp_dev = to_vp_device(vdev); 218 + 219 + /* As struct device is a kobject, it's not safe to 220 + * free the memory (including the reference counter itself) 221 + * until it's release callback. */ 222 + kfree(vp_dev); 223 + } 224 + 214 225 /* the PCI probing function */ 215 226 int virtio_pci_legacy_probe(struct pci_dev *pci_dev, 216 227 const struct pci_device_id *id) ··· 313 302 pci_iounmap(pci_dev, vp_dev->ioaddr); 314 303 pci_release_regions(pci_dev); 315 304 pci_disable_device(pci_dev); 316 - kfree(vp_dev); 317 305 }
+10 -3
fs/btrfs/backref.c
··· 1552 1552 { 1553 1553 int ret; 1554 1554 int type; 1555 - struct btrfs_tree_block_info *info; 1556 1555 struct btrfs_extent_inline_ref *eiref; 1557 1556 1558 1557 if (*ptr == (unsigned long)-1) ··· 1572 1573 } 1573 1574 1574 1575 /* we can treat both ref types equally here */ 1575 - info = (struct btrfs_tree_block_info *)(ei + 1); 1576 1576 *out_root = btrfs_extent_inline_ref_offset(eb, eiref); 1577 - *out_level = btrfs_tree_block_level(eb, info); 1577 + 1578 + if (key->type == BTRFS_EXTENT_ITEM_KEY) { 1579 + struct btrfs_tree_block_info *info; 1580 + 1581 + info = (struct btrfs_tree_block_info *)(ei + 1); 1582 + *out_level = btrfs_tree_block_level(eb, info); 1583 + } else { 1584 + ASSERT(key->type == BTRFS_METADATA_ITEM_KEY); 1585 + *out_level = (u8)key->offset; 1586 + } 1578 1587 1579 1588 if (ret == 1) 1580 1589 *ptr = (unsigned long)-1;
+8
fs/btrfs/delayed-inode.c
··· 1857 1857 { 1858 1858 struct btrfs_delayed_node *delayed_node; 1859 1859 1860 + /* 1861 + * we don't do delayed inode updates during log recovery because it 1862 + * leads to enospc problems. This means we also can't do 1863 + * delayed inode refs 1864 + */ 1865 + if (BTRFS_I(inode)->root->fs_info->log_root_recovering) 1866 + return -EAGAIN; 1867 + 1860 1868 delayed_node = btrfs_get_or_create_delayed_node(inode); 1861 1869 if (IS_ERR(delayed_node)) 1862 1870 return PTR_ERR(delayed_node);
+6 -6
fs/btrfs/extent-tree.c
··· 3139 3139 struct extent_buffer *leaf; 3140 3140 3141 3141 ret = btrfs_search_slot(trans, extent_root, &cache->key, path, 0, 1); 3142 - if (ret < 0) 3142 + if (ret) { 3143 + if (ret > 0) 3144 + ret = -ENOENT; 3143 3145 goto fail; 3144 - BUG_ON(ret); /* Corruption */ 3146 + } 3145 3147 3146 3148 leaf = path->nodes[0]; 3147 3149 bi = btrfs_item_ptr_offset(leaf, path->slots[0]); ··· 3151 3149 btrfs_mark_buffer_dirty(leaf); 3152 3150 btrfs_release_path(path); 3153 3151 fail: 3154 - if (ret) { 3152 + if (ret) 3155 3153 btrfs_abort_transaction(trans, root, ret); 3156 - return ret; 3157 - } 3158 - return 0; 3154 + return ret; 3159 3155 3160 3156 } 3161 3157
+3 -1
fs/btrfs/inode.c
··· 6255 6255 6256 6256 out_fail: 6257 6257 btrfs_end_transaction(trans, root); 6258 - if (drop_on_err) 6258 + if (drop_on_err) { 6259 + inode_dec_link_count(inode); 6259 6260 iput(inode); 6261 + } 6260 6262 btrfs_balance_delayed_items(root); 6261 6263 btrfs_btree_balance_dirty(root); 6262 6264 return err;
+1 -1
fs/btrfs/scrub.c
··· 2607 2607 ret = scrub_pages_for_parity(sparity, logical, l, physical, dev, 2608 2608 flags, gen, mirror_num, 2609 2609 have_csum ? csum : NULL); 2610 - skip: 2611 2610 if (ret) 2612 2611 return ret; 2612 + skip: 2613 2613 len -= l; 2614 2614 logical += l; 2615 2615 physical += l;
+1 -1
fs/ceph/addr.c
··· 1416 1416 } 1417 1417 } 1418 1418 1419 - dout("fill_inline_data %p %llx.%llx len %lu locked_page %p\n", 1419 + dout("fill_inline_data %p %llx.%llx len %zu locked_page %p\n", 1420 1420 inode, ceph_vinop(inode), len, locked_page); 1421 1421 1422 1422 if (len > 0) {
+2 -2
fs/ext4/extents.c
··· 5166 5166 5167 5167 /* fallback to generic here if not in extents fmt */ 5168 5168 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 5169 - return __generic_block_fiemap(inode, fieinfo, start, len, 5170 - ext4_get_block); 5169 + return generic_block_fiemap(inode, fieinfo, start, len, 5170 + ext4_get_block); 5171 5171 5172 5172 if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS)) 5173 5173 return -EBADR;
+116 -108
fs/ext4/file.c
··· 273 273 * we determine this extent as a data or a hole according to whether the 274 274 * page cache has data or not. 275 275 */ 276 - static int ext4_find_unwritten_pgoff(struct inode *inode, int whence, 277 - loff_t endoff, loff_t *offset) 276 + static int ext4_find_unwritten_pgoff(struct inode *inode, 277 + int whence, 278 + struct ext4_map_blocks *map, 279 + loff_t *offset) 278 280 { 279 281 struct pagevec pvec; 282 + unsigned int blkbits; 280 283 pgoff_t index; 281 284 pgoff_t end; 285 + loff_t endoff; 282 286 loff_t startoff; 283 287 loff_t lastoff; 284 288 int found = 0; 285 289 290 + blkbits = inode->i_sb->s_blocksize_bits; 286 291 startoff = *offset; 287 292 lastoff = startoff; 288 - 293 + endoff = (loff_t)(map->m_lblk + map->m_len) << blkbits; 289 294 290 295 index = startoff >> PAGE_CACHE_SHIFT; 291 296 end = endoff >> PAGE_CACHE_SHIFT; ··· 408 403 static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize) 409 404 { 410 405 struct inode *inode = file->f_mapping->host; 411 - struct fiemap_extent_info fie; 412 - struct fiemap_extent ext[2]; 413 - loff_t next; 414 - int i, ret = 0; 406 + struct ext4_map_blocks map; 407 + struct extent_status es; 408 + ext4_lblk_t start, last, end; 409 + loff_t dataoff, isize; 410 + int blkbits; 411 + int ret = 0; 415 412 416 413 mutex_lock(&inode->i_mutex); 417 - if (offset >= inode->i_size) { 414 + 415 + isize = i_size_read(inode); 416 + if (offset >= isize) { 418 417 mutex_unlock(&inode->i_mutex); 419 418 return -ENXIO; 420 419 } 421 - fie.fi_flags = 0; 422 - fie.fi_extents_max = 2; 423 - fie.fi_extents_start = (struct fiemap_extent __user *) &ext; 424 - while (1) { 425 - mm_segment_t old_fs = get_fs(); 426 420 427 - fie.fi_extents_mapped = 0; 428 - memset(ext, 0, sizeof(*ext) * fie.fi_extents_max); 421 + blkbits = inode->i_sb->s_blocksize_bits; 422 + start = offset >> blkbits; 423 + last = start; 424 + end = isize >> blkbits; 425 + dataoff = offset; 429 426 430 - set_fs(get_ds()); 431 - ret = ext4_fiemap(inode, &fie, offset, maxsize - offset); 432 - set_fs(old_fs); 433 - if (ret) 434 - break; 435 - 436 - /* No extents found, EOF */ 437 - if (!fie.fi_extents_mapped) { 438 - ret = -ENXIO; 427 + do { 428 + map.m_lblk = last; 429 + map.m_len = end - last + 1; 430 + ret = ext4_map_blocks(NULL, inode, &map, 0); 431 + if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) { 432 + if (last != start) 433 + dataoff = (loff_t)last << blkbits; 439 434 break; 440 435 } 441 - for (i = 0; i < fie.fi_extents_mapped; i++) { 442 - next = (loff_t)(ext[i].fe_length + ext[i].fe_logical); 443 436 444 - if (offset < (loff_t)ext[i].fe_logical) 445 - offset = (loff_t)ext[i].fe_logical; 446 - /* 447 - * If extent is not unwritten, then it contains valid 448 - * data, mapped or delayed. 449 - */ 450 - if (!(ext[i].fe_flags & FIEMAP_EXTENT_UNWRITTEN)) 451 - goto out; 452 - 453 - /* 454 - * If there is a unwritten extent at this offset, 455 - * it will be as a data or a hole according to page 456 - * cache that has data or not. 457 - */ 458 - if (ext4_find_unwritten_pgoff(inode, SEEK_DATA, 459 - next, &offset)) 460 - goto out; 461 - 462 - if (ext[i].fe_flags & FIEMAP_EXTENT_LAST) { 463 - ret = -ENXIO; 464 - goto out; 465 - } 466 - offset = next; 437 + /* 438 + * If there is a delay extent at this offset, 439 + * it will be as a data. 440 + */ 441 + ext4_es_find_delayed_extent_range(inode, last, last, &es); 442 + if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) { 443 + if (last != start) 444 + dataoff = (loff_t)last << blkbits; 445 + break; 467 446 } 468 - } 469 - if (offset > inode->i_size) 470 - offset = inode->i_size; 471 - out: 447 + 448 + /* 449 + * If there is a unwritten extent at this offset, 450 + * it will be as a data or a hole according to page 451 + * cache that has data or not. 452 + */ 453 + if (map.m_flags & EXT4_MAP_UNWRITTEN) { 454 + int unwritten; 455 + unwritten = ext4_find_unwritten_pgoff(inode, SEEK_DATA, 456 + &map, &dataoff); 457 + if (unwritten) 458 + break; 459 + } 460 + 461 + last++; 462 + dataoff = (loff_t)last << blkbits; 463 + } while (last <= end); 464 + 472 465 mutex_unlock(&inode->i_mutex); 473 - if (ret) 474 - return ret; 475 466 476 - return vfs_setpos(file, offset, maxsize); 467 + if (dataoff > isize) 468 + return -ENXIO; 469 + 470 + return vfs_setpos(file, dataoff, maxsize); 477 471 } 478 472 479 473 /* 480 - * ext4_seek_hole() retrieves the offset for SEEK_HOLE 474 + * ext4_seek_hole() retrieves the offset for SEEK_HOLE. 481 475 */ 482 476 static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize) 483 477 { 484 478 struct inode *inode = file->f_mapping->host; 485 - struct fiemap_extent_info fie; 486 - struct fiemap_extent ext[2]; 487 - loff_t next; 488 - int i, ret = 0; 479 + struct ext4_map_blocks map; 480 + struct extent_status es; 481 + ext4_lblk_t start, last, end; 482 + loff_t holeoff, isize; 483 + int blkbits; 484 + int ret = 0; 489 485 490 486 mutex_lock(&inode->i_mutex); 491 - if (offset >= inode->i_size) { 487 + 488 + isize = i_size_read(inode); 489 + if (offset >= isize) { 492 490 mutex_unlock(&inode->i_mutex); 493 491 return -ENXIO; 494 492 } 495 493 496 - fie.fi_flags = 0; 497 - fie.fi_extents_max = 2; 498 - fie.fi_extents_start = (struct fiemap_extent __user *)&ext; 499 - while (1) { 500 - mm_segment_t old_fs = get_fs(); 494 + blkbits = inode->i_sb->s_blocksize_bits; 495 + start = offset >> blkbits; 496 + last = start; 497 + end = isize >> blkbits; 498 + holeoff = offset; 501 499 502 - fie.fi_extents_mapped = 0; 503 - memset(ext, 0, sizeof(*ext)); 500 + do { 501 + map.m_lblk = last; 502 + map.m_len = end - last + 1; 503 + ret = ext4_map_blocks(NULL, inode, &map, 0); 504 + if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) { 505 + last += ret; 506 + holeoff = (loff_t)last << blkbits; 507 + continue; 508 + } 504 509 505 - set_fs(get_ds()); 506 - ret = ext4_fiemap(inode, &fie, offset, maxsize - offset); 507 - set_fs(old_fs); 508 - if (ret) 509 - break; 510 + /* 511 + * If there is a delay extent at this offset, 512 + * we will skip this extent. 513 + */ 514 + ext4_es_find_delayed_extent_range(inode, last, last, &es); 515 + if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) { 516 + last = es.es_lblk + es.es_len; 517 + holeoff = (loff_t)last << blkbits; 518 + continue; 519 + } 510 520 511 - /* No extents found */ 512 - if (!fie.fi_extents_mapped) 513 - break; 514 - 515 - for (i = 0; i < fie.fi_extents_mapped; i++) { 516 - next = (loff_t)(ext[i].fe_logical + ext[i].fe_length); 517 - /* 518 - * If extent is not unwritten, then it contains valid 519 - * data, mapped or delayed. 520 - */ 521 - if (!(ext[i].fe_flags & FIEMAP_EXTENT_UNWRITTEN)) { 522 - if (offset < (loff_t)ext[i].fe_logical) 523 - goto out; 524 - offset = next; 521 + /* 522 + * If there is a unwritten extent at this offset, 523 + * it will be as a data or a hole according to page 524 + * cache that has data or not. 525 + */ 526 + if (map.m_flags & EXT4_MAP_UNWRITTEN) { 527 + int unwritten; 528 + unwritten = ext4_find_unwritten_pgoff(inode, SEEK_HOLE, 529 + &map, &holeoff); 530 + if (!unwritten) { 531 + last += ret; 532 + holeoff = (loff_t)last << blkbits; 525 533 continue; 526 534 } 527 - /* 528 - * If there is a unwritten extent at this offset, 529 - * it will be as a data or a hole according to page 530 - * cache that has data or not. 531 - */ 532 - if (ext4_find_unwritten_pgoff(inode, SEEK_HOLE, 533 - next, &offset)) 534 - goto out; 535 - 536 - offset = next; 537 - if (ext[i].fe_flags & FIEMAP_EXTENT_LAST) 538 - goto out; 539 535 } 540 - } 541 - if (offset > inode->i_size) 542 - offset = inode->i_size; 543 - out: 544 - mutex_unlock(&inode->i_mutex); 545 - if (ret) 546 - return ret; 547 536 548 - return vfs_setpos(file, offset, maxsize); 537 + /* find a hole */ 538 + break; 539 + } while (last <= end); 540 + 541 + mutex_unlock(&inode->i_mutex); 542 + 543 + if (holeoff > isize) 544 + holeoff = isize; 545 + 546 + return vfs_setpos(file, holeoff, maxsize); 549 547 } 550 548 551 549 /*
+12 -12
fs/ext4/resize.c
··· 24 24 return -EPERM; 25 25 26 26 /* 27 + * If we are not using the primary superblock/GDT copy don't resize, 28 + * because the user tools have no way of handling this. Probably a 29 + * bad time to do it anyways. 30 + */ 31 + if (EXT4_SB(sb)->s_sbh->b_blocknr != 32 + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { 33 + ext4_warning(sb, "won't resize using backup superblock at %llu", 34 + (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr); 35 + return -EPERM; 36 + } 37 + 38 + /* 27 39 * We are not allowed to do online-resizing on a filesystem mounted 28 40 * with error, because it can destroy the filesystem easily. 29 41 */ ··· 769 757 printk(KERN_DEBUG 770 758 "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n", 771 759 gdb_num); 772 - 773 - /* 774 - * If we are not using the primary superblock/GDT copy don't resize, 775 - * because the user tools have no way of handling this. Probably a 776 - * bad time to do it anyways. 777 - */ 778 - if (EXT4_SB(sb)->s_sbh->b_blocknr != 779 - le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { 780 - ext4_warning(sb, "won't resize using backup superblock at %llu", 781 - (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr); 782 - return -EPERM; 783 - } 784 760 785 761 gdb_bh = sb_bread(sb, gdblock); 786 762 if (!gdb_bh)
+1 -1
fs/ext4/super.c
··· 3482 3482 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 3483 3483 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && 3484 3484 EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) 3485 - ext4_warning(sb, KERN_INFO "metadata_csum and uninit_bg are " 3485 + ext4_warning(sb, "metadata_csum and uninit_bg are " 3486 3486 "redundant flags; please run fsck."); 3487 3487 3488 3488 /* Check for a known checksum algorithm */
+3 -2
fs/fcntl.c
··· 740 740 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY 741 741 * is defined as O_NONBLOCK on some platforms and not on others. 742 742 */ 743 - BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 743 + BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( 744 744 O_RDONLY | O_WRONLY | O_RDWR | 745 745 O_CREAT | O_EXCL | O_NOCTTY | 746 746 O_TRUNC | O_APPEND | /* O_NONBLOCK | */ 747 747 __O_SYNC | O_DSYNC | FASYNC | 748 748 O_DIRECT | O_LARGEFILE | O_DIRECTORY | 749 749 O_NOFOLLOW | O_NOATIME | O_CLOEXEC | 750 - __FMODE_EXEC | O_PATH | __O_TMPFILE 750 + __FMODE_EXEC | O_PATH | __O_TMPFILE | 751 + __FMODE_NONOTIFY 751 752 )); 752 753 753 754 fasync_cache = kmem_cache_create("fasync_cache",
+23 -26
fs/gfs2/quota.c
··· 667 667 668 668 static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, 669 669 s64 change, struct gfs2_quota_data *qd, 670 - struct fs_disk_quota *fdq) 670 + struct qc_dqblk *fdq) 671 671 { 672 672 struct inode *inode = &ip->i_inode; 673 673 struct gfs2_sbd *sdp = GFS2_SB(inode); ··· 697 697 be64_add_cpu(&q.qu_value, change); 698 698 qd->qd_qb.qb_value = q.qu_value; 699 699 if (fdq) { 700 - if (fdq->d_fieldmask & FS_DQ_BSOFT) { 701 - q.qu_warn = cpu_to_be64(fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift); 700 + if (fdq->d_fieldmask & QC_SPC_SOFT) { 701 + q.qu_warn = cpu_to_be64(fdq->d_spc_softlimit >> sdp->sd_sb.sb_bsize_shift); 702 702 qd->qd_qb.qb_warn = q.qu_warn; 703 703 } 704 - if (fdq->d_fieldmask & FS_DQ_BHARD) { 705 - q.qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift); 704 + if (fdq->d_fieldmask & QC_SPC_HARD) { 705 + q.qu_limit = cpu_to_be64(fdq->d_spc_hardlimit >> sdp->sd_sb.sb_bsize_shift); 706 706 qd->qd_qb.qb_limit = q.qu_limit; 707 707 } 708 - if (fdq->d_fieldmask & FS_DQ_BCOUNT) { 709 - q.qu_value = cpu_to_be64(fdq->d_bcount >> sdp->sd_fsb2bb_shift); 708 + if (fdq->d_fieldmask & QC_SPACE) { 709 + q.qu_value = cpu_to_be64(fdq->d_space >> sdp->sd_sb.sb_bsize_shift); 710 710 qd->qd_qb.qb_value = q.qu_value; 711 711 } 712 712 } ··· 1497 1497 } 1498 1498 1499 1499 static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid, 1500 - struct fs_disk_quota *fdq) 1500 + struct qc_dqblk *fdq) 1501 1501 { 1502 1502 struct gfs2_sbd *sdp = sb->s_fs_info; 1503 1503 struct gfs2_quota_lvb *qlvb; ··· 1505 1505 struct gfs2_holder q_gh; 1506 1506 int error; 1507 1507 1508 - memset(fdq, 0, sizeof(struct fs_disk_quota)); 1508 + memset(fdq, 0, sizeof(*fdq)); 1509 1509 1510 1510 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) 1511 1511 return -ESRCH; /* Crazy XFS error code */ ··· 1522 1522 goto out; 1523 1523 1524 1524 qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lksb.sb_lvbptr; 1525 - fdq->d_version = FS_DQUOT_VERSION; 1526 - fdq->d_flags = (qid.type == USRQUOTA) ? FS_USER_QUOTA : FS_GROUP_QUOTA; 1527 - fdq->d_id = from_kqid_munged(current_user_ns(), qid); 1528 - fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_fsb2bb_shift; 1529 - fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_fsb2bb_shift; 1530 - fdq->d_bcount = be64_to_cpu(qlvb->qb_value) << sdp->sd_fsb2bb_shift; 1525 + fdq->d_spc_hardlimit = be64_to_cpu(qlvb->qb_limit) << sdp->sd_sb.sb_bsize_shift; 1526 + fdq->d_spc_softlimit = be64_to_cpu(qlvb->qb_warn) << sdp->sd_sb.sb_bsize_shift; 1527 + fdq->d_space = be64_to_cpu(qlvb->qb_value) << sdp->sd_sb.sb_bsize_shift; 1531 1528 1532 1529 gfs2_glock_dq_uninit(&q_gh); 1533 1530 out: ··· 1533 1536 } 1534 1537 1535 1538 /* GFS2 only supports a subset of the XFS fields */ 1536 - #define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD|FS_DQ_BCOUNT) 1539 + #define GFS2_FIELDMASK (QC_SPC_SOFT|QC_SPC_HARD|QC_SPACE) 1537 1540 1538 1541 static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, 1539 - struct fs_disk_quota *fdq) 1542 + struct qc_dqblk *fdq) 1540 1543 { 1541 1544 struct gfs2_sbd *sdp = sb->s_fs_info; 1542 1545 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); ··· 1580 1583 goto out_i; 1581 1584 1582 1585 /* If nothing has changed, this is a no-op */ 1583 - if ((fdq->d_fieldmask & FS_DQ_BSOFT) && 1584 - ((fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_warn))) 1585 - fdq->d_fieldmask ^= FS_DQ_BSOFT; 1586 + if ((fdq->d_fieldmask & QC_SPC_SOFT) && 1587 + ((fdq->d_spc_softlimit >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_warn))) 1588 + fdq->d_fieldmask ^= QC_SPC_SOFT; 1586 1589 1587 - if ((fdq->d_fieldmask & FS_DQ_BHARD) && 1588 - ((fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_limit))) 1589 - fdq->d_fieldmask ^= FS_DQ_BHARD; 1590 + if ((fdq->d_fieldmask & QC_SPC_HARD) && 1591 + ((fdq->d_spc_hardlimit >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_limit))) 1592 + fdq->d_fieldmask ^= QC_SPC_HARD; 1590 1593 1591 - if ((fdq->d_fieldmask & FS_DQ_BCOUNT) && 1592 - ((fdq->d_bcount >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_value))) 1593 - fdq->d_fieldmask ^= FS_DQ_BCOUNT; 1594 + if ((fdq->d_fieldmask & QC_SPACE) && 1595 + ((fdq->d_space >> sdp->sd_sb.sb_bsize_shift) == be64_to_cpu(qd->qd_qb.qb_value))) 1596 + fdq->d_fieldmask ^= QC_SPACE; 1594 1597 1595 1598 if (fdq->d_fieldmask == 0) 1596 1599 goto out_i;
+1 -1
fs/nfsd/nfs4state.c
··· 3897 3897 status = nfs4_setlease(dp); 3898 3898 goto out; 3899 3899 } 3900 - atomic_inc(&fp->fi_delegees); 3901 3900 if (fp->fi_had_conflict) { 3902 3901 status = -EAGAIN; 3903 3902 goto out_unlock; 3904 3903 } 3904 + atomic_inc(&fp->fi_delegees); 3905 3905 hash_delegation_locked(dp, fp); 3906 3906 status = 0; 3907 3907 out_unlock:
+5 -5
fs/notify/fanotify/fanotify_user.c
··· 259 259 struct fsnotify_event *kevent; 260 260 char __user *start; 261 261 int ret; 262 - DEFINE_WAIT(wait); 262 + DEFINE_WAIT_FUNC(wait, woken_wake_function); 263 263 264 264 start = buf; 265 265 group = file->private_data; 266 266 267 267 pr_debug("%s: group=%p\n", __func__, group); 268 268 269 + add_wait_queue(&group->notification_waitq, &wait); 269 270 while (1) { 270 - prepare_to_wait(&group->notification_waitq, &wait, TASK_INTERRUPTIBLE); 271 - 272 271 mutex_lock(&group->notification_mutex); 273 272 kevent = get_one_event(group, count); 274 273 mutex_unlock(&group->notification_mutex); ··· 288 289 289 290 if (start != buf) 290 291 break; 291 - schedule(); 292 + 293 + wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); 292 294 continue; 293 295 } 294 296 ··· 318 318 buf += ret; 319 319 count -= ret; 320 320 } 321 + remove_wait_queue(&group->notification_waitq, &wait); 321 322 322 - finish_wait(&group->notification_waitq, &wait); 323 323 if (start != buf && ret != -EFAULT) 324 324 ret = buf - start; 325 325 return ret;
+1 -4
fs/ocfs2/dlm/dlmrecovery.c
··· 2023 2023 dlm_lockres_drop_inflight_ref(dlm, res); 2024 2024 spin_unlock(&res->spinlock); 2025 2025 2026 - if (ret < 0) { 2026 + if (ret < 0) 2027 2027 mlog_errno(ret); 2028 - if (newlock) 2029 - dlm_lock_put(newlock); 2030 - } 2031 2028 2032 2029 return ret; 2033 2030 }
+35 -8
fs/ocfs2/namei.c
··· 94 94 struct inode *inode, 95 95 const char *symname); 96 96 97 + static int ocfs2_double_lock(struct ocfs2_super *osb, 98 + struct buffer_head **bh1, 99 + struct inode *inode1, 100 + struct buffer_head **bh2, 101 + struct inode *inode2, 102 + int rename); 103 + 104 + static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2); 97 105 /* An orphan dir name is an 8 byte value, printed as a hex string */ 98 106 #define OCFS2_ORPHAN_NAMELEN ((int)(2 * sizeof(u64))) 99 107 ··· 686 678 { 687 679 handle_t *handle; 688 680 struct inode *inode = old_dentry->d_inode; 681 + struct inode *old_dir = old_dentry->d_parent->d_inode; 689 682 int err; 690 683 struct buffer_head *fe_bh = NULL; 684 + struct buffer_head *old_dir_bh = NULL; 691 685 struct buffer_head *parent_fe_bh = NULL; 692 686 struct ocfs2_dinode *fe = NULL; 693 687 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); ··· 706 696 707 697 dquot_initialize(dir); 708 698 709 - err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); 699 + err = ocfs2_double_lock(osb, &old_dir_bh, old_dir, 700 + &parent_fe_bh, dir, 0); 710 701 if (err < 0) { 711 702 if (err != -ENOENT) 712 703 mlog_errno(err); 713 704 return err; 705 + } 706 + 707 + /* make sure both dirs have bhs 708 + * get an extra ref on old_dir_bh if old==new */ 709 + if (!parent_fe_bh) { 710 + if (old_dir_bh) { 711 + parent_fe_bh = old_dir_bh; 712 + get_bh(parent_fe_bh); 713 + } else { 714 + mlog(ML_ERROR, "%s: no old_dir_bh!\n", osb->uuid_str); 715 + err = -EIO; 716 + goto out; 717 + } 714 718 } 715 719 716 720 if (!dir->i_nlink) { ··· 732 708 goto out; 733 709 } 734 710 735 - err = ocfs2_lookup_ino_from_name(dir, old_dentry->d_name.name, 711 + err = ocfs2_lookup_ino_from_name(old_dir, old_dentry->d_name.name, 736 712 old_dentry->d_name.len, &old_de_ino); 737 713 if (err) { 738 714 err = -ENOENT; ··· 825 801 ocfs2_inode_unlock(inode, 1); 826 802 827 803 out: 828 - ocfs2_inode_unlock(dir, 1); 804 + ocfs2_double_unlock(old_dir, dir); 829 805 830 806 brelse(fe_bh); 831 807 brelse(parent_fe_bh); 808 + brelse(old_dir_bh); 832 809 833 810 ocfs2_free_dir_lookup_result(&lookup); 834 811 ··· 1097 1072 } 1098 1073 1099 1074 /* 1100 - * The only place this should be used is rename! 1075 + * The only place this should be used is rename and link! 1101 1076 * if they have the same id, then the 1st one is the only one locked. 1102 1077 */ 1103 1078 static int ocfs2_double_lock(struct ocfs2_super *osb, 1104 1079 struct buffer_head **bh1, 1105 1080 struct inode *inode1, 1106 1081 struct buffer_head **bh2, 1107 - struct inode *inode2) 1082 + struct inode *inode2, 1083 + int rename) 1108 1084 { 1109 1085 int status; 1110 1086 int inode1_is_ancestor, inode2_is_ancestor; ··· 1153 1127 } 1154 1128 /* lock id2 */ 1155 1129 status = ocfs2_inode_lock_nested(inode2, bh2, 1, 1156 - OI_LS_RENAME1); 1130 + rename == 1 ? OI_LS_RENAME1 : OI_LS_PARENT); 1157 1131 if (status < 0) { 1158 1132 if (status != -ENOENT) 1159 1133 mlog_errno(status); ··· 1162 1136 } 1163 1137 1164 1138 /* lock id1 */ 1165 - status = ocfs2_inode_lock_nested(inode1, bh1, 1, OI_LS_RENAME2); 1139 + status = ocfs2_inode_lock_nested(inode1, bh1, 1, 1140 + rename == 1 ? OI_LS_RENAME2 : OI_LS_PARENT); 1166 1141 if (status < 0) { 1167 1142 /* 1168 1143 * An error return must mean that no cluster locks ··· 1279 1252 1280 1253 /* if old and new are the same, this'll just do one lock. */ 1281 1254 status = ocfs2_double_lock(osb, &old_dir_bh, old_dir, 1282 - &new_dir_bh, new_dir); 1255 + &new_dir_bh, new_dir, 1); 1283 1256 if (status < 0) { 1284 1257 mlog_errno(status); 1285 1258 goto bail;
+39 -44
fs/quota/dquot.c
··· 2396 2396 } 2397 2397 2398 2398 /* Generic routine for getting common part of quota structure */ 2399 - static void do_get_dqblk(struct dquot *dquot, struct fs_disk_quota *di) 2399 + static void do_get_dqblk(struct dquot *dquot, struct qc_dqblk *di) 2400 2400 { 2401 2401 struct mem_dqblk *dm = &dquot->dq_dqb; 2402 2402 2403 2403 memset(di, 0, sizeof(*di)); 2404 - di->d_version = FS_DQUOT_VERSION; 2405 - di->d_flags = dquot->dq_id.type == USRQUOTA ? 2406 - FS_USER_QUOTA : FS_GROUP_QUOTA; 2407 - di->d_id = from_kqid_munged(current_user_ns(), dquot->dq_id); 2408 - 2409 2404 spin_lock(&dq_data_lock); 2410 - di->d_blk_hardlimit = stoqb(dm->dqb_bhardlimit); 2411 - di->d_blk_softlimit = stoqb(dm->dqb_bsoftlimit); 2405 + di->d_spc_hardlimit = dm->dqb_bhardlimit; 2406 + di->d_spc_softlimit = dm->dqb_bsoftlimit; 2412 2407 di->d_ino_hardlimit = dm->dqb_ihardlimit; 2413 2408 di->d_ino_softlimit = dm->dqb_isoftlimit; 2414 - di->d_bcount = dm->dqb_curspace + dm->dqb_rsvspace; 2415 - di->d_icount = dm->dqb_curinodes; 2416 - di->d_btimer = dm->dqb_btime; 2417 - di->d_itimer = dm->dqb_itime; 2409 + di->d_space = dm->dqb_curspace + dm->dqb_rsvspace; 2410 + di->d_ino_count = dm->dqb_curinodes; 2411 + di->d_spc_timer = dm->dqb_btime; 2412 + di->d_ino_timer = dm->dqb_itime; 2418 2413 spin_unlock(&dq_data_lock); 2419 2414 } 2420 2415 2421 2416 int dquot_get_dqblk(struct super_block *sb, struct kqid qid, 2422 - struct fs_disk_quota *di) 2417 + struct qc_dqblk *di) 2423 2418 { 2424 2419 struct dquot *dquot; 2425 2420 ··· 2428 2433 } 2429 2434 EXPORT_SYMBOL(dquot_get_dqblk); 2430 2435 2431 - #define VFS_FS_DQ_MASK \ 2432 - (FS_DQ_BCOUNT | FS_DQ_BSOFT | FS_DQ_BHARD | \ 2433 - FS_DQ_ICOUNT | FS_DQ_ISOFT | FS_DQ_IHARD | \ 2434 - FS_DQ_BTIMER | FS_DQ_ITIMER) 2436 + #define VFS_QC_MASK \ 2437 + (QC_SPACE | QC_SPC_SOFT | QC_SPC_HARD | \ 2438 + QC_INO_COUNT | QC_INO_SOFT | QC_INO_HARD | \ 2439 + QC_SPC_TIMER | QC_INO_TIMER) 2435 2440 2436 2441 /* Generic routine for setting common part of quota structure */ 2437 - static int do_set_dqblk(struct dquot *dquot, struct fs_disk_quota *di) 2442 + static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) 2438 2443 { 2439 2444 struct mem_dqblk *dm = &dquot->dq_dqb; 2440 2445 int check_blim = 0, check_ilim = 0; 2441 2446 struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type]; 2442 2447 2443 - if (di->d_fieldmask & ~VFS_FS_DQ_MASK) 2448 + if (di->d_fieldmask & ~VFS_QC_MASK) 2444 2449 return -EINVAL; 2445 2450 2446 - if (((di->d_fieldmask & FS_DQ_BSOFT) && 2447 - (di->d_blk_softlimit > dqi->dqi_maxblimit)) || 2448 - ((di->d_fieldmask & FS_DQ_BHARD) && 2449 - (di->d_blk_hardlimit > dqi->dqi_maxblimit)) || 2450 - ((di->d_fieldmask & FS_DQ_ISOFT) && 2451 + if (((di->d_fieldmask & QC_SPC_SOFT) && 2452 + stoqb(di->d_spc_softlimit) > dqi->dqi_maxblimit) || 2453 + ((di->d_fieldmask & QC_SPC_HARD) && 2454 + stoqb(di->d_spc_hardlimit) > dqi->dqi_maxblimit) || 2455 + ((di->d_fieldmask & QC_INO_SOFT) && 2451 2456 (di->d_ino_softlimit > dqi->dqi_maxilimit)) || 2452 - ((di->d_fieldmask & FS_DQ_IHARD) && 2457 + ((di->d_fieldmask & QC_INO_HARD) && 2453 2458 (di->d_ino_hardlimit > dqi->dqi_maxilimit))) 2454 2459 return -ERANGE; 2455 2460 2456 2461 spin_lock(&dq_data_lock); 2457 - if (di->d_fieldmask & FS_DQ_BCOUNT) { 2458 - dm->dqb_curspace = di->d_bcount - dm->dqb_rsvspace; 2462 + if (di->d_fieldmask & QC_SPACE) { 2463 + dm->dqb_curspace = di->d_space - dm->dqb_rsvspace; 2459 2464 check_blim = 1; 2460 2465 set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); 2461 2466 } 2462 2467 2463 - if (di->d_fieldmask & FS_DQ_BSOFT) 2464 - dm->dqb_bsoftlimit = qbtos(di->d_blk_softlimit); 2465 - if (di->d_fieldmask & FS_DQ_BHARD) 2466 - dm->dqb_bhardlimit = qbtos(di->d_blk_hardlimit); 2467 - if (di->d_fieldmask & (FS_DQ_BSOFT | FS_DQ_BHARD)) { 2468 + if (di->d_fieldmask & QC_SPC_SOFT) 2469 + dm->dqb_bsoftlimit = di->d_spc_softlimit; 2470 + if (di->d_fieldmask & QC_SPC_HARD) 2471 + dm->dqb_bhardlimit = di->d_spc_hardlimit; 2472 + if (di->d_fieldmask & (QC_SPC_SOFT | QC_SPC_HARD)) { 2468 2473 check_blim = 1; 2469 2474 set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); 2470 2475 } 2471 2476 2472 - if (di->d_fieldmask & FS_DQ_ICOUNT) { 2473 - dm->dqb_curinodes = di->d_icount; 2477 + if (di->d_fieldmask & QC_INO_COUNT) { 2478 + dm->dqb_curinodes = di->d_ino_count; 2474 2479 check_ilim = 1; 2475 2480 set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); 2476 2481 } 2477 2482 2478 - if (di->d_fieldmask & FS_DQ_ISOFT) 2483 + if (di->d_fieldmask & QC_INO_SOFT) 2479 2484 dm->dqb_isoftlimit = di->d_ino_softlimit; 2480 - if (di->d_fieldmask & FS_DQ_IHARD) 2485 + if (di->d_fieldmask & QC_INO_HARD) 2481 2486 dm->dqb_ihardlimit = di->d_ino_hardlimit; 2482 - if (di->d_fieldmask & (FS_DQ_ISOFT | FS_DQ_IHARD)) { 2487 + if (di->d_fieldmask & (QC_INO_SOFT | QC_INO_HARD)) { 2483 2488 check_ilim = 1; 2484 2489 set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); 2485 2490 } 2486 2491 2487 - if (di->d_fieldmask & FS_DQ_BTIMER) { 2488 - dm->dqb_btime = di->d_btimer; 2492 + if (di->d_fieldmask & QC_SPC_TIMER) { 2493 + dm->dqb_btime = di->d_spc_timer; 2489 2494 check_blim = 1; 2490 2495 set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); 2491 2496 } 2492 2497 2493 - if (di->d_fieldmask & FS_DQ_ITIMER) { 2494 - dm->dqb_itime = di->d_itimer; 2498 + if (di->d_fieldmask & QC_INO_TIMER) { 2499 + dm->dqb_itime = di->d_ino_timer; 2495 2500 check_ilim = 1; 2496 2501 set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); 2497 2502 } ··· 2501 2506 dm->dqb_curspace < dm->dqb_bsoftlimit) { 2502 2507 dm->dqb_btime = 0; 2503 2508 clear_bit(DQ_BLKS_B, &dquot->dq_flags); 2504 - } else if (!(di->d_fieldmask & FS_DQ_BTIMER)) 2509 + } else if (!(di->d_fieldmask & QC_SPC_TIMER)) 2505 2510 /* Set grace only if user hasn't provided his own... */ 2506 2511 dm->dqb_btime = get_seconds() + dqi->dqi_bgrace; 2507 2512 } ··· 2510 2515 dm->dqb_curinodes < dm->dqb_isoftlimit) { 2511 2516 dm->dqb_itime = 0; 2512 2517 clear_bit(DQ_INODES_B, &dquot->dq_flags); 2513 - } else if (!(di->d_fieldmask & FS_DQ_ITIMER)) 2518 + } else if (!(di->d_fieldmask & QC_INO_TIMER)) 2514 2519 /* Set grace only if user hasn't provided his own... */ 2515 2520 dm->dqb_itime = get_seconds() + dqi->dqi_igrace; 2516 2521 } ··· 2526 2531 } 2527 2532 2528 2533 int dquot_set_dqblk(struct super_block *sb, struct kqid qid, 2529 - struct fs_disk_quota *di) 2534 + struct qc_dqblk *di) 2530 2535 { 2531 2536 struct dquot *dquot; 2532 2537 int rc;
+137 -25
fs/quota/quota.c
··· 118 118 return sb->s_qcop->set_info(sb, type, &info); 119 119 } 120 120 121 - static void copy_to_if_dqblk(struct if_dqblk *dst, struct fs_disk_quota *src) 121 + static inline qsize_t qbtos(qsize_t blocks) 122 + { 123 + return blocks << QIF_DQBLKSIZE_BITS; 124 + } 125 + 126 + static inline qsize_t stoqb(qsize_t space) 127 + { 128 + return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS; 129 + } 130 + 131 + static void copy_to_if_dqblk(struct if_dqblk *dst, struct qc_dqblk *src) 122 132 { 123 133 memset(dst, 0, sizeof(*dst)); 124 - dst->dqb_bhardlimit = src->d_blk_hardlimit; 125 - dst->dqb_bsoftlimit = src->d_blk_softlimit; 126 - dst->dqb_curspace = src->d_bcount; 134 + dst->dqb_bhardlimit = stoqb(src->d_spc_hardlimit); 135 + dst->dqb_bsoftlimit = stoqb(src->d_spc_softlimit); 136 + dst->dqb_curspace = src->d_space; 127 137 dst->dqb_ihardlimit = src->d_ino_hardlimit; 128 138 dst->dqb_isoftlimit = src->d_ino_softlimit; 129 - dst->dqb_curinodes = src->d_icount; 130 - dst->dqb_btime = src->d_btimer; 131 - dst->dqb_itime = src->d_itimer; 139 + dst->dqb_curinodes = src->d_ino_count; 140 + dst->dqb_btime = src->d_spc_timer; 141 + dst->dqb_itime = src->d_ino_timer; 132 142 dst->dqb_valid = QIF_ALL; 133 143 } 134 144 ··· 146 136 void __user *addr) 147 137 { 148 138 struct kqid qid; 149 - struct fs_disk_quota fdq; 139 + struct qc_dqblk fdq; 150 140 struct if_dqblk idq; 151 141 int ret; 152 142 ··· 164 154 return 0; 165 155 } 166 156 167 - static void copy_from_if_dqblk(struct fs_disk_quota *dst, struct if_dqblk *src) 157 + static void copy_from_if_dqblk(struct qc_dqblk *dst, struct if_dqblk *src) 168 158 { 169 - dst->d_blk_hardlimit = src->dqb_bhardlimit; 170 - dst->d_blk_softlimit = src->dqb_bsoftlimit; 171 - dst->d_bcount = src->dqb_curspace; 159 + dst->d_spc_hardlimit = qbtos(src->dqb_bhardlimit); 160 + dst->d_spc_softlimit = qbtos(src->dqb_bsoftlimit); 161 + dst->d_space = src->dqb_curspace; 172 162 dst->d_ino_hardlimit = src->dqb_ihardlimit; 173 163 dst->d_ino_softlimit = src->dqb_isoftlimit; 174 - dst->d_icount = src->dqb_curinodes; 175 - dst->d_btimer = src->dqb_btime; 176 - dst->d_itimer = src->dqb_itime; 164 + dst->d_ino_count = src->dqb_curinodes; 165 + dst->d_spc_timer = src->dqb_btime; 166 + dst->d_ino_timer = src->dqb_itime; 177 167 178 168 dst->d_fieldmask = 0; 179 169 if (src->dqb_valid & QIF_BLIMITS) 180 - dst->d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD; 170 + dst->d_fieldmask |= QC_SPC_SOFT | QC_SPC_HARD; 181 171 if (src->dqb_valid & QIF_SPACE) 182 - dst->d_fieldmask |= FS_DQ_BCOUNT; 172 + dst->d_fieldmask |= QC_SPACE; 183 173 if (src->dqb_valid & QIF_ILIMITS) 184 - dst->d_fieldmask |= FS_DQ_ISOFT | FS_DQ_IHARD; 174 + dst->d_fieldmask |= QC_INO_SOFT | QC_INO_HARD; 185 175 if (src->dqb_valid & QIF_INODES) 186 - dst->d_fieldmask |= FS_DQ_ICOUNT; 176 + dst->d_fieldmask |= QC_INO_COUNT; 187 177 if (src->dqb_valid & QIF_BTIME) 188 - dst->d_fieldmask |= FS_DQ_BTIMER; 178 + dst->d_fieldmask |= QC_SPC_TIMER; 189 179 if (src->dqb_valid & QIF_ITIME) 190 - dst->d_fieldmask |= FS_DQ_ITIMER; 180 + dst->d_fieldmask |= QC_INO_TIMER; 191 181 } 192 182 193 183 static int quota_setquota(struct super_block *sb, int type, qid_t id, 194 184 void __user *addr) 195 185 { 196 - struct fs_disk_quota fdq; 186 + struct qc_dqblk fdq; 197 187 struct if_dqblk idq; 198 188 struct kqid qid; 199 189 ··· 257 247 return ret; 258 248 } 259 249 250 + /* 251 + * XFS defines BBTOB and BTOBB macros inside fs/xfs/ and we cannot move them 252 + * out of there as xfsprogs rely on definitions being in that header file. So 253 + * just define same functions here for quota purposes. 254 + */ 255 + #define XFS_BB_SHIFT 9 256 + 257 + static inline u64 quota_bbtob(u64 blocks) 258 + { 259 + return blocks << XFS_BB_SHIFT; 260 + } 261 + 262 + static inline u64 quota_btobb(u64 bytes) 263 + { 264 + return (bytes + (1 << XFS_BB_SHIFT) - 1) >> XFS_BB_SHIFT; 265 + } 266 + 267 + static void copy_from_xfs_dqblk(struct qc_dqblk *dst, struct fs_disk_quota *src) 268 + { 269 + dst->d_spc_hardlimit = quota_bbtob(src->d_blk_hardlimit); 270 + dst->d_spc_softlimit = quota_bbtob(src->d_blk_softlimit); 271 + dst->d_ino_hardlimit = src->d_ino_hardlimit; 272 + dst->d_ino_softlimit = src->d_ino_softlimit; 273 + dst->d_space = quota_bbtob(src->d_bcount); 274 + dst->d_ino_count = src->d_icount; 275 + dst->d_ino_timer = src->d_itimer; 276 + dst->d_spc_timer = src->d_btimer; 277 + dst->d_ino_warns = src->d_iwarns; 278 + dst->d_spc_warns = src->d_bwarns; 279 + dst->d_rt_spc_hardlimit = quota_bbtob(src->d_rtb_hardlimit); 280 + dst->d_rt_spc_softlimit = quota_bbtob(src->d_rtb_softlimit); 281 + dst->d_rt_space = quota_bbtob(src->d_rtbcount); 282 + dst->d_rt_spc_timer = src->d_rtbtimer; 283 + dst->d_rt_spc_warns = src->d_rtbwarns; 284 + dst->d_fieldmask = 0; 285 + if (src->d_fieldmask & FS_DQ_ISOFT) 286 + dst->d_fieldmask |= QC_INO_SOFT; 287 + if (src->d_fieldmask & FS_DQ_IHARD) 288 + dst->d_fieldmask |= QC_INO_HARD; 289 + if (src->d_fieldmask & FS_DQ_BSOFT) 290 + dst->d_fieldmask |= QC_SPC_SOFT; 291 + if (src->d_fieldmask & FS_DQ_BHARD) 292 + dst->d_fieldmask |= QC_SPC_HARD; 293 + if (src->d_fieldmask & FS_DQ_RTBSOFT) 294 + dst->d_fieldmask |= QC_RT_SPC_SOFT; 295 + if (src->d_fieldmask & FS_DQ_RTBHARD) 296 + dst->d_fieldmask |= QC_RT_SPC_HARD; 297 + if (src->d_fieldmask & FS_DQ_BTIMER) 298 + dst->d_fieldmask |= QC_SPC_TIMER; 299 + if (src->d_fieldmask & FS_DQ_ITIMER) 300 + dst->d_fieldmask |= QC_INO_TIMER; 301 + if (src->d_fieldmask & FS_DQ_RTBTIMER) 302 + dst->d_fieldmask |= QC_RT_SPC_TIMER; 303 + if (src->d_fieldmask & FS_DQ_BWARNS) 304 + dst->d_fieldmask |= QC_SPC_WARNS; 305 + if (src->d_fieldmask & FS_DQ_IWARNS) 306 + dst->d_fieldmask |= QC_INO_WARNS; 307 + if (src->d_fieldmask & FS_DQ_RTBWARNS) 308 + dst->d_fieldmask |= QC_RT_SPC_WARNS; 309 + if (src->d_fieldmask & FS_DQ_BCOUNT) 310 + dst->d_fieldmask |= QC_SPACE; 311 + if (src->d_fieldmask & FS_DQ_ICOUNT) 312 + dst->d_fieldmask |= QC_INO_COUNT; 313 + if (src->d_fieldmask & FS_DQ_RTBCOUNT) 314 + dst->d_fieldmask |= QC_RT_SPACE; 315 + } 316 + 260 317 static int quota_setxquota(struct super_block *sb, int type, qid_t id, 261 318 void __user *addr) 262 319 { 263 320 struct fs_disk_quota fdq; 321 + struct qc_dqblk qdq; 264 322 struct kqid qid; 265 323 266 324 if (copy_from_user(&fdq, addr, sizeof(fdq))) ··· 338 260 qid = make_kqid(current_user_ns(), type, id); 339 261 if (!qid_valid(qid)) 340 262 return -EINVAL; 341 - return sb->s_qcop->set_dqblk(sb, qid, &fdq); 263 + copy_from_xfs_dqblk(&qdq, &fdq); 264 + return sb->s_qcop->set_dqblk(sb, qid, &qdq); 265 + } 266 + 267 + static void copy_to_xfs_dqblk(struct fs_disk_quota *dst, struct qc_dqblk *src, 268 + int type, qid_t id) 269 + { 270 + memset(dst, 0, sizeof(*dst)); 271 + dst->d_version = FS_DQUOT_VERSION; 272 + dst->d_id = id; 273 + if (type == USRQUOTA) 274 + dst->d_flags = FS_USER_QUOTA; 275 + else if (type == PRJQUOTA) 276 + dst->d_flags = FS_PROJ_QUOTA; 277 + else 278 + dst->d_flags = FS_GROUP_QUOTA; 279 + dst->d_blk_hardlimit = quota_btobb(src->d_spc_hardlimit); 280 + dst->d_blk_softlimit = quota_btobb(src->d_spc_softlimit); 281 + dst->d_ino_hardlimit = src->d_ino_hardlimit; 282 + dst->d_ino_softlimit = src->d_ino_softlimit; 283 + dst->d_bcount = quota_btobb(src->d_space); 284 + dst->d_icount = src->d_ino_count; 285 + dst->d_itimer = src->d_ino_timer; 286 + dst->d_btimer = src->d_spc_timer; 287 + dst->d_iwarns = src->d_ino_warns; 288 + dst->d_bwarns = src->d_spc_warns; 289 + dst->d_rtb_hardlimit = quota_btobb(src->d_rt_spc_hardlimit); 290 + dst->d_rtb_softlimit = quota_btobb(src->d_rt_spc_softlimit); 291 + dst->d_rtbcount = quota_btobb(src->d_rt_space); 292 + dst->d_rtbtimer = src->d_rt_spc_timer; 293 + dst->d_rtbwarns = src->d_rt_spc_warns; 342 294 } 343 295 344 296 static int quota_getxquota(struct super_block *sb, int type, qid_t id, 345 297 void __user *addr) 346 298 { 347 299 struct fs_disk_quota fdq; 300 + struct qc_dqblk qdq; 348 301 struct kqid qid; 349 302 int ret; 350 303 ··· 384 275 qid = make_kqid(current_user_ns(), type, id); 385 276 if (!qid_valid(qid)) 386 277 return -EINVAL; 387 - ret = sb->s_qcop->get_dqblk(sb, qid, &fdq); 388 - if (!ret && copy_to_user(addr, &fdq, sizeof(fdq))) 278 + ret = sb->s_qcop->get_dqblk(sb, qid, &qdq); 279 + if (ret) 280 + return ret; 281 + copy_to_xfs_dqblk(&fdq, &qdq, type, id); 282 + if (copy_to_user(addr, &fdq, sizeof(fdq))) 389 283 return -EFAULT; 390 284 return ret; 391 285 }
+1 -1
fs/udf/file.c
··· 224 224 static int udf_release_file(struct inode *inode, struct file *filp) 225 225 { 226 226 if (filp->f_mode & FMODE_WRITE && 227 - atomic_read(&inode->i_writecount) > 1) { 227 + atomic_read(&inode->i_writecount) == 1) { 228 228 /* 229 229 * Grab i_mutex to avoid races with writes changing i_size 230 230 * while we are running.
+2 -2
fs/xfs/xfs_qm.h
··· 166 166 /* quota ops */ 167 167 extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint); 168 168 extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, 169 - uint, struct fs_disk_quota *); 169 + uint, struct qc_dqblk *); 170 170 extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, 171 - struct fs_disk_quota *); 171 + struct qc_dqblk *); 172 172 extern int xfs_qm_scall_getqstat(struct xfs_mount *, 173 173 struct fs_quota_stat *); 174 174 extern int xfs_qm_scall_getqstatv(struct xfs_mount *,
+66 -90
fs/xfs/xfs_qm_syscalls.c
··· 39 39 STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *, 40 40 uint); 41 41 STATIC uint xfs_qm_export_flags(uint); 42 - STATIC uint xfs_qm_export_qtype_flags(uint); 43 42 44 43 /* 45 44 * Turn off quota accounting and/or enforcement for all udquots and/or ··· 546 547 return 0; 547 548 } 548 549 549 - #define XFS_DQ_MASK \ 550 - (FS_DQ_LIMIT_MASK | FS_DQ_TIMER_MASK | FS_DQ_WARNS_MASK) 550 + #define XFS_QC_MASK \ 551 + (QC_LIMIT_MASK | QC_TIMER_MASK | QC_WARNS_MASK) 551 552 552 553 /* 553 554 * Adjust quota limits, and start/stop timers accordingly. ··· 557 558 struct xfs_mount *mp, 558 559 xfs_dqid_t id, 559 560 uint type, 560 - fs_disk_quota_t *newlim) 561 + struct qc_dqblk *newlim) 561 562 { 562 563 struct xfs_quotainfo *q = mp->m_quotainfo; 563 564 struct xfs_disk_dquot *ddq; ··· 566 567 int error; 567 568 xfs_qcnt_t hard, soft; 568 569 569 - if (newlim->d_fieldmask & ~XFS_DQ_MASK) 570 + if (newlim->d_fieldmask & ~XFS_QC_MASK) 570 571 return -EINVAL; 571 - if ((newlim->d_fieldmask & XFS_DQ_MASK) == 0) 572 + if ((newlim->d_fieldmask & XFS_QC_MASK) == 0) 572 573 return 0; 573 574 574 575 /* ··· 606 607 /* 607 608 * Make sure that hardlimits are >= soft limits before changing. 608 609 */ 609 - hard = (newlim->d_fieldmask & FS_DQ_BHARD) ? 610 - (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) : 610 + hard = (newlim->d_fieldmask & QC_SPC_HARD) ? 611 + (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_hardlimit) : 611 612 be64_to_cpu(ddq->d_blk_hardlimit); 612 - soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ? 613 - (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) : 613 + soft = (newlim->d_fieldmask & QC_SPC_SOFT) ? 614 + (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_softlimit) : 614 615 be64_to_cpu(ddq->d_blk_softlimit); 615 616 if (hard == 0 || hard >= soft) { 616 617 ddq->d_blk_hardlimit = cpu_to_be64(hard); ··· 623 624 } else { 624 625 xfs_debug(mp, "blkhard %Ld < blksoft %Ld", hard, soft); 625 626 } 626 - hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? 627 - (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : 627 + hard = (newlim->d_fieldmask & QC_RT_SPC_HARD) ? 628 + (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_hardlimit) : 628 629 be64_to_cpu(ddq->d_rtb_hardlimit); 629 - soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ? 630 - (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) : 630 + soft = (newlim->d_fieldmask & QC_RT_SPC_SOFT) ? 631 + (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_softlimit) : 631 632 be64_to_cpu(ddq->d_rtb_softlimit); 632 633 if (hard == 0 || hard >= soft) { 633 634 ddq->d_rtb_hardlimit = cpu_to_be64(hard); ··· 640 641 xfs_debug(mp, "rtbhard %Ld < rtbsoft %Ld", hard, soft); 641 642 } 642 643 643 - hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? 644 + hard = (newlim->d_fieldmask & QC_INO_HARD) ? 644 645 (xfs_qcnt_t) newlim->d_ino_hardlimit : 645 646 be64_to_cpu(ddq->d_ino_hardlimit); 646 - soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ? 647 + soft = (newlim->d_fieldmask & QC_INO_SOFT) ? 647 648 (xfs_qcnt_t) newlim->d_ino_softlimit : 648 649 be64_to_cpu(ddq->d_ino_softlimit); 649 650 if (hard == 0 || hard >= soft) { ··· 660 661 /* 661 662 * Update warnings counter(s) if requested 662 663 */ 663 - if (newlim->d_fieldmask & FS_DQ_BWARNS) 664 - ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns); 665 - if (newlim->d_fieldmask & FS_DQ_IWARNS) 666 - ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns); 667 - if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 668 - ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns); 664 + if (newlim->d_fieldmask & QC_SPC_WARNS) 665 + ddq->d_bwarns = cpu_to_be16(newlim->d_spc_warns); 666 + if (newlim->d_fieldmask & QC_INO_WARNS) 667 + ddq->d_iwarns = cpu_to_be16(newlim->d_ino_warns); 668 + if (newlim->d_fieldmask & QC_RT_SPC_WARNS) 669 + ddq->d_rtbwarns = cpu_to_be16(newlim->d_rt_spc_warns); 669 670 670 671 if (id == 0) { 671 672 /* ··· 675 676 * soft and hard limit values (already done, above), and 676 677 * for warnings. 677 678 */ 678 - if (newlim->d_fieldmask & FS_DQ_BTIMER) { 679 - q->qi_btimelimit = newlim->d_btimer; 680 - ddq->d_btimer = cpu_to_be32(newlim->d_btimer); 679 + if (newlim->d_fieldmask & QC_SPC_TIMER) { 680 + q->qi_btimelimit = newlim->d_spc_timer; 681 + ddq->d_btimer = cpu_to_be32(newlim->d_spc_timer); 681 682 } 682 - if (newlim->d_fieldmask & FS_DQ_ITIMER) { 683 - q->qi_itimelimit = newlim->d_itimer; 684 - ddq->d_itimer = cpu_to_be32(newlim->d_itimer); 683 + if (newlim->d_fieldmask & QC_INO_TIMER) { 684 + q->qi_itimelimit = newlim->d_ino_timer; 685 + ddq->d_itimer = cpu_to_be32(newlim->d_ino_timer); 685 686 } 686 - if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { 687 - q->qi_rtbtimelimit = newlim->d_rtbtimer; 688 - ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer); 687 + if (newlim->d_fieldmask & QC_RT_SPC_TIMER) { 688 + q->qi_rtbtimelimit = newlim->d_rt_spc_timer; 689 + ddq->d_rtbtimer = cpu_to_be32(newlim->d_rt_spc_timer); 689 690 } 690 - if (newlim->d_fieldmask & FS_DQ_BWARNS) 691 - q->qi_bwarnlimit = newlim->d_bwarns; 692 - if (newlim->d_fieldmask & FS_DQ_IWARNS) 693 - q->qi_iwarnlimit = newlim->d_iwarns; 694 - if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 695 - q->qi_rtbwarnlimit = newlim->d_rtbwarns; 691 + if (newlim->d_fieldmask & QC_SPC_WARNS) 692 + q->qi_bwarnlimit = newlim->d_spc_warns; 693 + if (newlim->d_fieldmask & QC_INO_WARNS) 694 + q->qi_iwarnlimit = newlim->d_ino_warns; 695 + if (newlim->d_fieldmask & QC_RT_SPC_WARNS) 696 + q->qi_rtbwarnlimit = newlim->d_rt_spc_warns; 696 697 } else { 697 698 /* 698 699 * If the user is now over quota, start the timelimit. ··· 797 798 struct xfs_mount *mp, 798 799 xfs_dqid_t id, 799 800 uint type, 800 - struct fs_disk_quota *dst) 801 + struct qc_dqblk *dst) 801 802 { 802 803 struct xfs_dquot *dqp; 803 804 int error; ··· 821 822 } 822 823 823 824 memset(dst, 0, sizeof(*dst)); 824 - dst->d_version = FS_DQUOT_VERSION; 825 - dst->d_flags = xfs_qm_export_qtype_flags(dqp->q_core.d_flags); 826 - dst->d_id = be32_to_cpu(dqp->q_core.d_id); 827 - dst->d_blk_hardlimit = 828 - XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit)); 829 - dst->d_blk_softlimit = 830 - XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit)); 825 + dst->d_spc_hardlimit = 826 + XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit)); 827 + dst->d_spc_softlimit = 828 + XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit)); 831 829 dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit); 832 830 dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit); 833 - dst->d_bcount = XFS_FSB_TO_BB(mp, dqp->q_res_bcount); 834 - dst->d_icount = dqp->q_res_icount; 835 - dst->d_btimer = be32_to_cpu(dqp->q_core.d_btimer); 836 - dst->d_itimer = be32_to_cpu(dqp->q_core.d_itimer); 837 - dst->d_iwarns = be16_to_cpu(dqp->q_core.d_iwarns); 838 - dst->d_bwarns = be16_to_cpu(dqp->q_core.d_bwarns); 839 - dst->d_rtb_hardlimit = 840 - XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit)); 841 - dst->d_rtb_softlimit = 842 - XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit)); 843 - dst->d_rtbcount = XFS_FSB_TO_BB(mp, dqp->q_res_rtbcount); 844 - dst->d_rtbtimer = be32_to_cpu(dqp->q_core.d_rtbtimer); 845 - dst->d_rtbwarns = be16_to_cpu(dqp->q_core.d_rtbwarns); 831 + dst->d_space = XFS_FSB_TO_B(mp, dqp->q_res_bcount); 832 + dst->d_ino_count = dqp->q_res_icount; 833 + dst->d_spc_timer = be32_to_cpu(dqp->q_core.d_btimer); 834 + dst->d_ino_timer = be32_to_cpu(dqp->q_core.d_itimer); 835 + dst->d_ino_warns = be16_to_cpu(dqp->q_core.d_iwarns); 836 + dst->d_spc_warns = be16_to_cpu(dqp->q_core.d_bwarns); 837 + dst->d_rt_spc_hardlimit = 838 + XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit)); 839 + dst->d_rt_spc_softlimit = 840 + XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit)); 841 + dst->d_rt_space = XFS_FSB_TO_B(mp, dqp->q_res_rtbcount); 842 + dst->d_rt_spc_timer = be32_to_cpu(dqp->q_core.d_rtbtimer); 843 + dst->d_rt_spc_warns = be16_to_cpu(dqp->q_core.d_rtbwarns); 846 844 847 845 /* 848 846 * Internally, we don't reset all the timers when quota enforcement ··· 852 856 dqp->q_core.d_flags == XFS_DQ_GROUP) || 853 857 (!XFS_IS_PQUOTA_ENFORCED(mp) && 854 858 dqp->q_core.d_flags == XFS_DQ_PROJ)) { 855 - dst->d_btimer = 0; 856 - dst->d_itimer = 0; 857 - dst->d_rtbtimer = 0; 859 + dst->d_spc_timer = 0; 860 + dst->d_ino_timer = 0; 861 + dst->d_rt_spc_timer = 0; 858 862 } 859 863 860 864 #ifdef DEBUG 861 - if (((XFS_IS_UQUOTA_ENFORCED(mp) && dst->d_flags == FS_USER_QUOTA) || 862 - (XFS_IS_GQUOTA_ENFORCED(mp) && dst->d_flags == FS_GROUP_QUOTA) || 863 - (XFS_IS_PQUOTA_ENFORCED(mp) && dst->d_flags == FS_PROJ_QUOTA)) && 864 - dst->d_id != 0) { 865 - if ((dst->d_bcount > dst->d_blk_softlimit) && 866 - (dst->d_blk_softlimit > 0)) { 867 - ASSERT(dst->d_btimer != 0); 865 + if (((XFS_IS_UQUOTA_ENFORCED(mp) && type == XFS_DQ_USER) || 866 + (XFS_IS_GQUOTA_ENFORCED(mp) && type == XFS_DQ_GROUP) || 867 + (XFS_IS_PQUOTA_ENFORCED(mp) && type == XFS_DQ_PROJ)) && 868 + id != 0) { 869 + if ((dst->d_space > dst->d_spc_softlimit) && 870 + (dst->d_spc_softlimit > 0)) { 871 + ASSERT(dst->d_spc_timer != 0); 868 872 } 869 - if ((dst->d_icount > dst->d_ino_softlimit) && 873 + if ((dst->d_ino_count > dst->d_ino_softlimit) && 870 874 (dst->d_ino_softlimit > 0)) { 871 - ASSERT(dst->d_itimer != 0); 875 + ASSERT(dst->d_ino_timer != 0); 872 876 } 873 877 } 874 878 #endif 875 879 out_put: 876 880 xfs_qm_dqput(dqp); 877 881 return error; 878 - } 879 - 880 - STATIC uint 881 - xfs_qm_export_qtype_flags( 882 - uint flags) 883 - { 884 - /* 885 - * Can't be more than one, or none. 886 - */ 887 - ASSERT((flags & (FS_PROJ_QUOTA | FS_USER_QUOTA)) != 888 - (FS_PROJ_QUOTA | FS_USER_QUOTA)); 889 - ASSERT((flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)) != 890 - (FS_PROJ_QUOTA | FS_GROUP_QUOTA)); 891 - ASSERT((flags & (FS_USER_QUOTA | FS_GROUP_QUOTA)) != 892 - (FS_USER_QUOTA | FS_GROUP_QUOTA)); 893 - ASSERT((flags & (FS_PROJ_QUOTA|FS_USER_QUOTA|FS_GROUP_QUOTA)) != 0); 894 - 895 - return (flags & XFS_DQ_USER) ? 896 - FS_USER_QUOTA : (flags & XFS_DQ_PROJ) ? 897 - FS_PROJ_QUOTA : FS_GROUP_QUOTA; 898 882 } 899 883 900 884 STATIC uint
+4 -4
fs/xfs/xfs_quotaops.c
··· 131 131 xfs_fs_get_dqblk( 132 132 struct super_block *sb, 133 133 struct kqid qid, 134 - struct fs_disk_quota *fdq) 134 + struct qc_dqblk *qdq) 135 135 { 136 136 struct xfs_mount *mp = XFS_M(sb); 137 137 ··· 141 141 return -ESRCH; 142 142 143 143 return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid), 144 - xfs_quota_type(qid.type), fdq); 144 + xfs_quota_type(qid.type), qdq); 145 145 } 146 146 147 147 STATIC int 148 148 xfs_fs_set_dqblk( 149 149 struct super_block *sb, 150 150 struct kqid qid, 151 - struct fs_disk_quota *fdq) 151 + struct qc_dqblk *qdq) 152 152 { 153 153 struct xfs_mount *mp = XFS_M(sb); 154 154 ··· 160 160 return -ESRCH; 161 161 162 162 return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid), 163 - xfs_quota_type(qid.type), fdq); 163 + xfs_quota_type(qid.type), qdq); 164 164 } 165 165 166 166 const struct quotactl_ops xfs_quotactl_operations = {
+4 -4
include/acpi/processor.h
··· 196 196 struct acpi_processor { 197 197 acpi_handle handle; 198 198 u32 acpi_id; 199 - u32 apic_id; 200 - u32 id; 199 + u32 phys_id; /* CPU hardware ID such as APIC ID for x86 */ 200 + u32 id; /* CPU logical ID allocated by OS */ 201 201 u32 pblk; 202 202 int performance_platform_limit; 203 203 int throttling_platform_limit; ··· 310 310 #endif /* CONFIG_CPU_FREQ */ 311 311 312 312 /* in processor_core.c */ 313 - int acpi_get_apicid(acpi_handle, int type, u32 acpi_id); 314 - int acpi_map_cpuid(int apic_id, u32 acpi_id); 313 + int acpi_get_phys_id(acpi_handle, int type, u32 acpi_id); 314 + int acpi_map_cpuid(int phys_id, u32 acpi_id); 315 315 int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); 316 316 317 317 /* in processor_pdc.c */
+6 -2
include/asm-generic/tlb.h
··· 136 136 137 137 static inline void __tlb_reset_range(struct mmu_gather *tlb) 138 138 { 139 - tlb->start = TASK_SIZE; 140 - tlb->end = 0; 139 + if (tlb->fullmm) { 140 + tlb->start = tlb->end = ~0; 141 + } else { 142 + tlb->start = TASK_SIZE; 143 + tlb->end = 0; 144 + } 141 145 } 142 146 143 147 /*
+2 -2
include/linux/acpi.h
··· 147 147 148 148 #ifdef CONFIG_ACPI_HOTPLUG_CPU 149 149 /* Arch dependent functions for cpu hotplug support */ 150 - int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu); 151 - int acpi_unmap_lsapic(int cpu); 150 + int acpi_map_cpu(acpi_handle handle, int physid, int *pcpu); 151 + int acpi_unmap_cpu(int cpu); 152 152 #endif /* CONFIG_ACPI_HOTPLUG_CPU */ 153 153 154 154 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
+2 -2
include/linux/ceph/osd_client.h
··· 87 87 struct ceph_osd_data osd_data; 88 88 } extent; 89 89 struct { 90 - __le32 name_len; 91 - __le32 value_len; 90 + u32 name_len; 91 + u32 value_len; 92 92 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */ 93 93 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ 94 94 struct ceph_osd_data osd_data;
+6 -6
include/linux/compiler.h
··· 215 215 } 216 216 } 217 217 218 - static __always_inline void __assign_once_size(volatile void *p, void *res, int size) 218 + static __always_inline void __write_once_size(volatile void *p, void *res, int size) 219 219 { 220 220 switch (size) { 221 221 case 1: *(volatile __u8 *)p = *(__u8 *)res; break; ··· 235 235 /* 236 236 * Prevent the compiler from merging or refetching reads or writes. The 237 237 * compiler is also forbidden from reordering successive instances of 238 - * READ_ONCE, ASSIGN_ONCE and ACCESS_ONCE (see below), but only when the 238 + * READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the 239 239 * compiler is aware of some particular ordering. One way to make the 240 240 * compiler aware of ordering is to put the two invocations of READ_ONCE, 241 - * ASSIGN_ONCE or ACCESS_ONCE() in different C statements. 241 + * WRITE_ONCE or ACCESS_ONCE() in different C statements. 242 242 * 243 243 * In contrast to ACCESS_ONCE these two macros will also work on aggregate 244 244 * data types like structs or unions. If the size of the accessed data 245 245 * type exceeds the word size of the machine (e.g., 32 bits or 64 bits) 246 - * READ_ONCE() and ASSIGN_ONCE() will fall back to memcpy and print a 246 + * READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a 247 247 * compile-time warning. 248 248 * 249 249 * Their two major use cases are: (1) Mediating communication between ··· 257 257 #define READ_ONCE(x) \ 258 258 ({ typeof(x) __val; __read_once_size(&x, &__val, sizeof(__val)); __val; }) 259 259 260 - #define ASSIGN_ONCE(val, x) \ 261 - ({ typeof(x) __val; __val = val; __assign_once_size(&x, &__val, sizeof(__val)); __val; }) 260 + #define WRITE_ONCE(x, val) \ 261 + ({ typeof(x) __val; __val = val; __write_once_size(&x, &__val, sizeof(__val)); __val; }) 262 262 263 263 #endif /* __KERNEL__ */ 264 264
+1 -1
include/linux/fs.h
··· 135 135 #define FMODE_CAN_WRITE ((__force fmode_t)0x40000) 136 136 137 137 /* File was opened by fanotify and shouldn't generate fanotify events */ 138 - #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 138 + #define FMODE_NONOTIFY ((__force fmode_t)0x4000000) 139 139 140 140 /* 141 141 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
+53 -9
include/linux/kdb.h
··· 13 13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com> 14 14 */ 15 15 16 + /* Shifted versions of the command enable bits are be used if the command 17 + * has no arguments (see kdb_check_flags). This allows commands, such as 18 + * go, to have different permissions depending upon whether it is called 19 + * with an argument. 20 + */ 21 + #define KDB_ENABLE_NO_ARGS_SHIFT 10 22 + 16 23 typedef enum { 17 - KDB_REPEAT_NONE = 0, /* Do not repeat this command */ 18 - KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */ 19 - KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */ 20 - } kdb_repeat_t; 24 + KDB_ENABLE_ALL = (1 << 0), /* Enable everything */ 25 + KDB_ENABLE_MEM_READ = (1 << 1), 26 + KDB_ENABLE_MEM_WRITE = (1 << 2), 27 + KDB_ENABLE_REG_READ = (1 << 3), 28 + KDB_ENABLE_REG_WRITE = (1 << 4), 29 + KDB_ENABLE_INSPECT = (1 << 5), 30 + KDB_ENABLE_FLOW_CTRL = (1 << 6), 31 + KDB_ENABLE_SIGNAL = (1 << 7), 32 + KDB_ENABLE_REBOOT = (1 << 8), 33 + /* User exposed values stop here, all remaining flags are 34 + * exclusively used to describe a commands behaviour. 35 + */ 36 + 37 + KDB_ENABLE_ALWAYS_SAFE = (1 << 9), 38 + KDB_ENABLE_MASK = (1 << KDB_ENABLE_NO_ARGS_SHIFT) - 1, 39 + 40 + KDB_ENABLE_ALL_NO_ARGS = KDB_ENABLE_ALL << KDB_ENABLE_NO_ARGS_SHIFT, 41 + KDB_ENABLE_MEM_READ_NO_ARGS = KDB_ENABLE_MEM_READ 42 + << KDB_ENABLE_NO_ARGS_SHIFT, 43 + KDB_ENABLE_MEM_WRITE_NO_ARGS = KDB_ENABLE_MEM_WRITE 44 + << KDB_ENABLE_NO_ARGS_SHIFT, 45 + KDB_ENABLE_REG_READ_NO_ARGS = KDB_ENABLE_REG_READ 46 + << KDB_ENABLE_NO_ARGS_SHIFT, 47 + KDB_ENABLE_REG_WRITE_NO_ARGS = KDB_ENABLE_REG_WRITE 48 + << KDB_ENABLE_NO_ARGS_SHIFT, 49 + KDB_ENABLE_INSPECT_NO_ARGS = KDB_ENABLE_INSPECT 50 + << KDB_ENABLE_NO_ARGS_SHIFT, 51 + KDB_ENABLE_FLOW_CTRL_NO_ARGS = KDB_ENABLE_FLOW_CTRL 52 + << KDB_ENABLE_NO_ARGS_SHIFT, 53 + KDB_ENABLE_SIGNAL_NO_ARGS = KDB_ENABLE_SIGNAL 54 + << KDB_ENABLE_NO_ARGS_SHIFT, 55 + KDB_ENABLE_REBOOT_NO_ARGS = KDB_ENABLE_REBOOT 56 + << KDB_ENABLE_NO_ARGS_SHIFT, 57 + KDB_ENABLE_ALWAYS_SAFE_NO_ARGS = KDB_ENABLE_ALWAYS_SAFE 58 + << KDB_ENABLE_NO_ARGS_SHIFT, 59 + KDB_ENABLE_MASK_NO_ARGS = KDB_ENABLE_MASK << KDB_ENABLE_NO_ARGS_SHIFT, 60 + 61 + KDB_REPEAT_NO_ARGS = 0x40000000, /* Repeat the command w/o arguments */ 62 + KDB_REPEAT_WITH_ARGS = 0x80000000, /* Repeat the command with args */ 63 + } kdb_cmdflags_t; 21 64 22 65 typedef int (*kdb_func_t)(int, const char **); 23 66 ··· 105 62 #define KDB_BADLENGTH (-19) 106 63 #define KDB_NOBP (-20) 107 64 #define KDB_BADADDR (-21) 65 + #define KDB_NOPERM (-22) 108 66 109 67 /* 110 68 * kdb_diemsg ··· 190 146 191 147 /* Dynamic kdb shell command registration */ 192 148 extern int kdb_register(char *, kdb_func_t, char *, char *, short); 193 - extern int kdb_register_repeat(char *, kdb_func_t, char *, char *, 194 - short, kdb_repeat_t); 149 + extern int kdb_register_flags(char *, kdb_func_t, char *, char *, 150 + short, kdb_cmdflags_t); 195 151 extern int kdb_unregister(char *); 196 152 #else /* ! CONFIG_KGDB_KDB */ 197 153 static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; } 198 154 static inline void kdb_init(int level) {} 199 155 static inline int kdb_register(char *cmd, kdb_func_t func, char *usage, 200 156 char *help, short minlen) { return 0; } 201 - static inline int kdb_register_repeat(char *cmd, kdb_func_t func, char *usage, 202 - char *help, short minlen, 203 - kdb_repeat_t repeat) { return 0; } 157 + static inline int kdb_register_flags(char *cmd, kdb_func_t func, char *usage, 158 + char *help, short minlen, 159 + kdb_cmdflags_t flags) { return 0; } 204 160 static inline int kdb_unregister(char *cmd) { return 0; } 205 161 #endif /* CONFIG_KGDB_KDB */ 206 162 enum {
+1 -1
include/linux/mm.h
··· 1952 1952 #if VM_GROWSUP 1953 1953 extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); 1954 1954 #else 1955 - #define expand_upwards(vma, address) do { } while (0) 1955 + #define expand_upwards(vma, address) (0) 1956 1956 #endif 1957 1957 1958 1958 /* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
+1
include/linux/mmc/sdhci.h
··· 137 137 #define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */ 138 138 #define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */ 139 139 #define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */ 140 + #define SDHCI_HS400_TUNING (1<<13) /* Tuning for HS400 */ 140 141 141 142 unsigned int version; /* SDHCI spec. version */ 142 143
+7 -5
include/linux/perf_event.h
··· 79 79 struct perf_branch_entry entries[0]; 80 80 }; 81 81 82 - struct perf_regs { 83 - __u64 abi; 84 - struct pt_regs *regs; 85 - }; 86 - 87 82 struct task_struct; 88 83 89 84 /* ··· 605 610 u32 reserved; 606 611 } cpu_entry; 607 612 struct perf_callchain_entry *callchain; 613 + 614 + /* 615 + * regs_user may point to task_pt_regs or to regs_user_copy, depending 616 + * on arch details. 617 + */ 608 618 struct perf_regs regs_user; 619 + struct pt_regs regs_user_copy; 620 + 609 621 struct perf_regs regs_intr; 610 622 u64 stack_user_size; 611 623 } ____cacheline_aligned;
+16
include/linux/perf_regs.h
··· 1 1 #ifndef _LINUX_PERF_REGS_H 2 2 #define _LINUX_PERF_REGS_H 3 3 4 + struct perf_regs { 5 + __u64 abi; 6 + struct pt_regs *regs; 7 + }; 8 + 4 9 #ifdef CONFIG_HAVE_PERF_REGS 5 10 #include <asm/perf_regs.h> 6 11 u64 perf_reg_value(struct pt_regs *regs, int idx); 7 12 int perf_reg_validate(u64 mask); 8 13 u64 perf_reg_abi(struct task_struct *task); 14 + void perf_get_regs_user(struct perf_regs *regs_user, 15 + struct pt_regs *regs, 16 + struct pt_regs *regs_user_copy); 9 17 #else 10 18 static inline u64 perf_reg_value(struct pt_regs *regs, int idx) 11 19 { ··· 28 20 static inline u64 perf_reg_abi(struct task_struct *task) 29 21 { 30 22 return PERF_SAMPLE_REGS_ABI_NONE; 23 + } 24 + 25 + static inline void perf_get_regs_user(struct perf_regs *regs_user, 26 + struct pt_regs *regs, 27 + struct pt_regs *regs_user_copy) 28 + { 29 + regs_user->regs = task_pt_regs(current); 30 + regs_user->abi = perf_reg_abi(current); 31 31 } 32 32 #endif /* CONFIG_HAVE_PERF_REGS */ 33 33 #endif /* _LINUX_PERF_REGS_H */
+45 -2
include/linux/quota.h
··· 323 323 324 324 struct path; 325 325 326 + /* Structure for communicating via ->get_dqblk() & ->set_dqblk() */ 327 + struct qc_dqblk { 328 + int d_fieldmask; /* mask of fields to change in ->set_dqblk() */ 329 + u64 d_spc_hardlimit; /* absolute limit on used space */ 330 + u64 d_spc_softlimit; /* preferred limit on used space */ 331 + u64 d_ino_hardlimit; /* maximum # allocated inodes */ 332 + u64 d_ino_softlimit; /* preferred inode limit */ 333 + u64 d_space; /* Space owned by the user */ 334 + u64 d_ino_count; /* # inodes owned by the user */ 335 + s64 d_ino_timer; /* zero if within inode limits */ 336 + /* if not, we refuse service */ 337 + s64 d_spc_timer; /* similar to above; for space */ 338 + int d_ino_warns; /* # warnings issued wrt num inodes */ 339 + int d_spc_warns; /* # warnings issued wrt used space */ 340 + u64 d_rt_spc_hardlimit; /* absolute limit on realtime space */ 341 + u64 d_rt_spc_softlimit; /* preferred limit on RT space */ 342 + u64 d_rt_space; /* realtime space owned */ 343 + s64 d_rt_spc_timer; /* similar to above; for RT space */ 344 + int d_rt_spc_warns; /* # warnings issued wrt RT space */ 345 + }; 346 + 347 + /* Field specifiers for ->set_dqblk() in struct qc_dqblk */ 348 + #define QC_INO_SOFT (1<<0) 349 + #define QC_INO_HARD (1<<1) 350 + #define QC_SPC_SOFT (1<<2) 351 + #define QC_SPC_HARD (1<<3) 352 + #define QC_RT_SPC_SOFT (1<<4) 353 + #define QC_RT_SPC_HARD (1<<5) 354 + #define QC_LIMIT_MASK (QC_INO_SOFT | QC_INO_HARD | QC_SPC_SOFT | QC_SPC_HARD | \ 355 + QC_RT_SPC_SOFT | QC_RT_SPC_HARD) 356 + #define QC_SPC_TIMER (1<<6) 357 + #define QC_INO_TIMER (1<<7) 358 + #define QC_RT_SPC_TIMER (1<<8) 359 + #define QC_TIMER_MASK (QC_SPC_TIMER | QC_INO_TIMER | QC_RT_SPC_TIMER) 360 + #define QC_SPC_WARNS (1<<9) 361 + #define QC_INO_WARNS (1<<10) 362 + #define QC_RT_SPC_WARNS (1<<11) 363 + #define QC_WARNS_MASK (QC_SPC_WARNS | QC_INO_WARNS | QC_RT_SPC_WARNS) 364 + #define QC_SPACE (1<<12) 365 + #define QC_INO_COUNT (1<<13) 366 + #define QC_RT_SPACE (1<<14) 367 + #define QC_ACCT_MASK (QC_SPACE | QC_INO_COUNT | QC_RT_SPACE) 368 + 326 369 /* Operations handling requests from userspace */ 327 370 struct quotactl_ops { 328 371 int (*quota_on)(struct super_block *, int, int, struct path *); ··· 374 331 int (*quota_sync)(struct super_block *, int); 375 332 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 376 333 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 377 - int (*get_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *); 378 - int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *); 334 + int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); 335 + int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); 379 336 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 380 337 int (*set_xstate)(struct super_block *, unsigned int, int); 381 338 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
+2 -2
include/linux/quotaops.h
··· 98 98 int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 99 99 int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 100 100 int dquot_get_dqblk(struct super_block *sb, struct kqid id, 101 - struct fs_disk_quota *di); 101 + struct qc_dqblk *di); 102 102 int dquot_set_dqblk(struct super_block *sb, struct kqid id, 103 - struct fs_disk_quota *di); 103 + struct qc_dqblk *di); 104 104 105 105 int __dquot_transfer(struct inode *inode, struct dquot **transfer_to); 106 106 int dquot_transfer(struct inode *inode, struct iattr *iattr);
+10
include/linux/rmap.h
··· 37 37 atomic_t refcount; 38 38 39 39 /* 40 + * Count of child anon_vmas and VMAs which points to this anon_vma. 41 + * 42 + * This counter is used for making decision about reusing anon_vma 43 + * instead of forking new one. See comments in function anon_vma_clone. 44 + */ 45 + unsigned degree; 46 + 47 + struct anon_vma *parent; /* Parent of this anon_vma */ 48 + 49 + /* 40 50 * NOTE: the LSB of the rb_root.rb_node is set by 41 51 * mm_take_all_locks() _after_ taking the above lock. So the 42 52 * rb_root must only be read/written after taking the above lock
-1
include/linux/writeback.h
··· 177 177 struct writeback_control *wbc, writepage_t writepage, 178 178 void *data); 179 179 int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 180 - void set_page_dirty_balance(struct page *page); 181 180 void writeback_set_ratelimit(void); 182 181 void tag_pages_for_writeback(struct address_space *mapping, 183 182 pgoff_t start, pgoff_t end);
+2 -5
include/net/mac80211.h
··· 1270 1270 * 1271 1271 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the 1272 1272 * driver to indicate that it requires IV generation for this 1273 - * particular key. Setting this flag does not necessarily mean that SKBs 1274 - * will have sufficient tailroom for ICV or MIC. 1273 + * particular key. 1275 1274 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by 1276 1275 * the driver for a TKIP key if it requires Michael MIC 1277 1276 * generation in software. ··· 1282 1283 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver 1283 1284 * if space should be prepared for the IV, but the IV 1284 1285 * itself should not be generated. Do not set together with 1285 - * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does 1286 - * not necessarily mean that SKBs will have sufficient tailroom for ICV or 1287 - * MIC. 1286 + * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. 1288 1287 * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received 1289 1288 * management frames. The flag can help drivers that have a hardware 1290 1289 * crypto implementation that doesn't deal with management frames
-1
include/target/target_core_backend.h
··· 135 135 int se_dev_set_emulate_rest_reord(struct se_device *dev, int); 136 136 int se_dev_set_queue_depth(struct se_device *, u32); 137 137 int se_dev_set_max_sectors(struct se_device *, u32); 138 - int se_dev_set_fabric_max_sectors(struct se_device *, u32); 139 138 int se_dev_set_optimal_sectors(struct se_device *, u32); 140 139 int se_dev_set_block_size(struct se_device *, u32); 141 140
-2
include/target/target_core_backend_configfs.h
··· 98 98 TB_DEV_ATTR(_backend, block_size, S_IRUGO | S_IWUSR); \ 99 99 DEF_TB_DEV_ATTRIB_RO(_backend, hw_max_sectors); \ 100 100 TB_DEV_ATTR_RO(_backend, hw_max_sectors); \ 101 - DEF_TB_DEV_ATTRIB(_backend, fabric_max_sectors); \ 102 - TB_DEV_ATTR(_backend, fabric_max_sectors, S_IRUGO | S_IWUSR); \ 103 101 DEF_TB_DEV_ATTRIB(_backend, optimal_sectors); \ 104 102 TB_DEV_ATTR(_backend, optimal_sectors, S_IRUGO | S_IWUSR); \ 105 103 DEF_TB_DEV_ATTRIB_RO(_backend, hw_queue_depth); \
-3
include/target/target_core_base.h
··· 77 77 #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 78 78 /* Default max_write_same_len, disabled by default */ 79 79 #define DA_MAX_WRITE_SAME_LEN 0 80 - /* Default max transfer length */ 81 - #define DA_FABRIC_MAX_SECTORS 8192 82 80 /* Use a model alias based on the configfs backend device name */ 83 81 #define DA_EMULATE_MODEL_ALIAS 0 84 82 /* Emulation for Direct Page Out */ ··· 692 694 u32 hw_block_size; 693 695 u32 block_size; 694 696 u32 hw_max_sectors; 695 - u32 fabric_max_sectors; 696 697 u32 optimal_sectors; 697 698 u32 hw_queue_depth; 698 699 u32 queue_depth;
+1 -1
include/uapi/asm-generic/fcntl.h
··· 5 5 6 6 /* 7 7 * FMODE_EXEC is 0x20 8 - * FMODE_NONOTIFY is 0x1000000 8 + * FMODE_NONOTIFY is 0x4000000 9 9 * These cannot be used by userspace O_* until internal and external open 10 10 * flags are split. 11 11 * -Eric Paris
+22 -15
include/uapi/linux/kfd_ioctl.h
··· 128 128 uint32_t pad; 129 129 }; 130 130 131 - #define KFD_IOC_MAGIC 'K' 131 + #define AMDKFD_IOCTL_BASE 'K' 132 + #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) 133 + #define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type) 134 + #define AMDKFD_IOW(nr, type) _IOW(AMDKFD_IOCTL_BASE, nr, type) 135 + #define AMDKFD_IOWR(nr, type) _IOWR(AMDKFD_IOCTL_BASE, nr, type) 132 136 133 - #define KFD_IOC_GET_VERSION \ 134 - _IOR(KFD_IOC_MAGIC, 1, struct kfd_ioctl_get_version_args) 137 + #define AMDKFD_IOC_GET_VERSION \ 138 + AMDKFD_IOR(0x01, struct kfd_ioctl_get_version_args) 135 139 136 - #define KFD_IOC_CREATE_QUEUE \ 137 - _IOWR(KFD_IOC_MAGIC, 2, struct kfd_ioctl_create_queue_args) 140 + #define AMDKFD_IOC_CREATE_QUEUE \ 141 + AMDKFD_IOWR(0x02, struct kfd_ioctl_create_queue_args) 138 142 139 - #define KFD_IOC_DESTROY_QUEUE \ 140 - _IOWR(KFD_IOC_MAGIC, 3, struct kfd_ioctl_destroy_queue_args) 143 + #define AMDKFD_IOC_DESTROY_QUEUE \ 144 + AMDKFD_IOWR(0x03, struct kfd_ioctl_destroy_queue_args) 141 145 142 - #define KFD_IOC_SET_MEMORY_POLICY \ 143 - _IOW(KFD_IOC_MAGIC, 4, struct kfd_ioctl_set_memory_policy_args) 146 + #define AMDKFD_IOC_SET_MEMORY_POLICY \ 147 + AMDKFD_IOW(0x04, struct kfd_ioctl_set_memory_policy_args) 144 148 145 - #define KFD_IOC_GET_CLOCK_COUNTERS \ 146 - _IOWR(KFD_IOC_MAGIC, 5, struct kfd_ioctl_get_clock_counters_args) 149 + #define AMDKFD_IOC_GET_CLOCK_COUNTERS \ 150 + AMDKFD_IOWR(0x05, struct kfd_ioctl_get_clock_counters_args) 147 151 148 - #define KFD_IOC_GET_PROCESS_APERTURES \ 149 - _IOR(KFD_IOC_MAGIC, 6, struct kfd_ioctl_get_process_apertures_args) 152 + #define AMDKFD_IOC_GET_PROCESS_APERTURES \ 153 + AMDKFD_IOR(0x06, struct kfd_ioctl_get_process_apertures_args) 150 154 151 - #define KFD_IOC_UPDATE_QUEUE \ 152 - _IOW(KFD_IOC_MAGIC, 7, struct kfd_ioctl_update_queue_args) 155 + #define AMDKFD_IOC_UPDATE_QUEUE \ 156 + AMDKFD_IOW(0x07, struct kfd_ioctl_update_queue_args) 157 + 158 + #define AMDKFD_COMMAND_START 0x01 159 + #define AMDKFD_COMMAND_END 0x08 153 160 154 161 #endif
+51
include/xen/interface/nmi.h
··· 1 + /****************************************************************************** 2 + * nmi.h 3 + * 4 + * NMI callback registration and reason codes. 5 + * 6 + * Copyright (c) 2005, Keir Fraser <keir@xensource.com> 7 + */ 8 + 9 + #ifndef __XEN_PUBLIC_NMI_H__ 10 + #define __XEN_PUBLIC_NMI_H__ 11 + 12 + #include <xen/interface/xen.h> 13 + 14 + /* 15 + * NMI reason codes: 16 + * Currently these are x86-specific, stored in arch_shared_info.nmi_reason. 17 + */ 18 + /* I/O-check error reported via ISA port 0x61, bit 6. */ 19 + #define _XEN_NMIREASON_io_error 0 20 + #define XEN_NMIREASON_io_error (1UL << _XEN_NMIREASON_io_error) 21 + /* PCI SERR reported via ISA port 0x61, bit 7. */ 22 + #define _XEN_NMIREASON_pci_serr 1 23 + #define XEN_NMIREASON_pci_serr (1UL << _XEN_NMIREASON_pci_serr) 24 + /* Unknown hardware-generated NMI. */ 25 + #define _XEN_NMIREASON_unknown 2 26 + #define XEN_NMIREASON_unknown (1UL << _XEN_NMIREASON_unknown) 27 + 28 + /* 29 + * long nmi_op(unsigned int cmd, void *arg) 30 + * NB. All ops return zero on success, else a negative error code. 31 + */ 32 + 33 + /* 34 + * Register NMI callback for this (calling) VCPU. Currently this only makes 35 + * sense for domain 0, vcpu 0. All other callers will be returned EINVAL. 36 + * arg == pointer to xennmi_callback structure. 37 + */ 38 + #define XENNMI_register_callback 0 39 + struct xennmi_callback { 40 + unsigned long handler_address; 41 + unsigned long pad; 42 + }; 43 + DEFINE_GUEST_HANDLE_STRUCT(xennmi_callback); 44 + 45 + /* 46 + * Deregister NMI callback for this (calling) VCPU. 47 + * arg == NULL. 48 + */ 49 + #define XENNMI_unregister_callback 1 50 + 51 + #endif /* __XEN_PUBLIC_NMI_H__ */
+28 -24
kernel/debug/debug_core.c
··· 27 27 * version 2. This program is licensed "as is" without any warranty of any 28 28 * kind, whether express or implied. 29 29 */ 30 + 31 + #define pr_fmt(fmt) "KGDB: " fmt 32 + 30 33 #include <linux/pid_namespace.h> 31 34 #include <linux/clocksource.h> 32 35 #include <linux/serial_core.h> ··· 199 196 return err; 200 197 err = kgdb_arch_remove_breakpoint(&tmp); 201 198 if (err) 202 - printk(KERN_ERR "KGDB: Critical breakpoint error, kernel " 203 - "memory destroyed at: %lx", addr); 199 + pr_err("Critical breakpoint error, kernel memory destroyed at: %lx\n", 200 + addr); 204 201 return err; 205 202 } 206 203 ··· 259 256 error = kgdb_arch_set_breakpoint(&kgdb_break[i]); 260 257 if (error) { 261 258 ret = error; 262 - printk(KERN_INFO "KGDB: BP install failed: %lx", 263 - kgdb_break[i].bpt_addr); 259 + pr_info("BP install failed: %lx\n", 260 + kgdb_break[i].bpt_addr); 264 261 continue; 265 262 } 266 263 ··· 322 319 continue; 323 320 error = kgdb_arch_remove_breakpoint(&kgdb_break[i]); 324 321 if (error) { 325 - printk(KERN_INFO "KGDB: BP remove failed: %lx\n", 326 - kgdb_break[i].bpt_addr); 322 + pr_info("BP remove failed: %lx\n", 323 + kgdb_break[i].bpt_addr); 327 324 ret = error; 328 325 } 329 326 ··· 370 367 goto setundefined; 371 368 error = kgdb_arch_remove_breakpoint(&kgdb_break[i]); 372 369 if (error) 373 - printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n", 370 + pr_err("breakpoint remove failed: %lx\n", 374 371 kgdb_break[i].bpt_addr); 375 372 setundefined: 376 373 kgdb_break[i].state = BP_UNDEFINED; ··· 403 400 if (print_wait) { 404 401 #ifdef CONFIG_KGDB_KDB 405 402 if (!dbg_kdb_mode) 406 - printk(KERN_CRIT "KGDB: waiting... or $3#33 for KDB\n"); 403 + pr_crit("waiting... or $3#33 for KDB\n"); 407 404 #else 408 - printk(KERN_CRIT "KGDB: Waiting for remote debugger\n"); 405 + pr_crit("Waiting for remote debugger\n"); 409 406 #endif 410 407 } 411 408 return 1; ··· 433 430 exception_level = 0; 434 431 kgdb_skipexception(ks->ex_vector, ks->linux_regs); 435 432 dbg_activate_sw_breakpoints(); 436 - printk(KERN_CRIT "KGDB: re-enter error: breakpoint removed %lx\n", 437 - addr); 433 + pr_crit("re-enter error: breakpoint removed %lx\n", addr); 438 434 WARN_ON_ONCE(1); 439 435 440 436 return 1; ··· 446 444 panic("Recursive entry to debugger"); 447 445 } 448 446 449 - printk(KERN_CRIT "KGDB: re-enter exception: ALL breakpoints killed\n"); 447 + pr_crit("re-enter exception: ALL breakpoints killed\n"); 450 448 #ifdef CONFIG_KGDB_KDB 451 449 /* Allow kdb to debug itself one level */ 452 450 return 0; ··· 473 471 int cpu; 474 472 int trace_on = 0; 475 473 int online_cpus = num_online_cpus(); 474 + u64 time_left; 476 475 477 476 kgdb_info[ks->cpu].enter_kgdb++; 478 477 kgdb_info[ks->cpu].exception_state |= exception_state; ··· 598 595 /* 599 596 * Wait for the other CPUs to be notified and be waiting for us: 600 597 */ 601 - while (kgdb_do_roundup && (atomic_read(&masters_in_kgdb) + 602 - atomic_read(&slaves_in_kgdb)) != online_cpus) 598 + time_left = loops_per_jiffy * HZ; 599 + while (kgdb_do_roundup && --time_left && 600 + (atomic_read(&masters_in_kgdb) + atomic_read(&slaves_in_kgdb)) != 601 + online_cpus) 603 602 cpu_relax(); 603 + if (!time_left) 604 + pr_crit("KGDB: Timed out waiting for secondary CPUs.\n"); 604 605 605 606 /* 606 607 * At this point the primary processor is completely ··· 802 795 static void sysrq_handle_dbg(int key) 803 796 { 804 797 if (!dbg_io_ops) { 805 - printk(KERN_CRIT "ERROR: No KGDB I/O module available\n"); 798 + pr_crit("ERROR: No KGDB I/O module available\n"); 806 799 return; 807 800 } 808 801 if (!kgdb_connected) { 809 802 #ifdef CONFIG_KGDB_KDB 810 803 if (!dbg_kdb_mode) 811 - printk(KERN_CRIT "KGDB or $3#33 for KDB\n"); 804 + pr_crit("KGDB or $3#33 for KDB\n"); 812 805 #else 813 - printk(KERN_CRIT "Entering KGDB\n"); 806 + pr_crit("Entering KGDB\n"); 814 807 #endif 815 808 } 816 809 ··· 952 945 { 953 946 kgdb_break_asap = 0; 954 947 955 - printk(KERN_CRIT "kgdb: Waiting for connection from remote gdb...\n"); 948 + pr_crit("Waiting for connection from remote gdb...\n"); 956 949 kgdb_breakpoint(); 957 950 } 958 951 ··· 971 964 if (dbg_io_ops) { 972 965 spin_unlock(&kgdb_registration_lock); 973 966 974 - printk(KERN_ERR "kgdb: Another I/O driver is already " 975 - "registered with KGDB.\n"); 967 + pr_err("Another I/O driver is already registered with KGDB\n"); 976 968 return -EBUSY; 977 969 } 978 970 ··· 987 981 988 982 spin_unlock(&kgdb_registration_lock); 989 983 990 - printk(KERN_INFO "kgdb: Registered I/O driver %s.\n", 991 - new_dbg_io_ops->name); 984 + pr_info("Registered I/O driver %s\n", new_dbg_io_ops->name); 992 985 993 986 /* Arm KGDB now. */ 994 987 kgdb_register_callbacks(); ··· 1022 1017 1023 1018 spin_unlock(&kgdb_registration_lock); 1024 1019 1025 - printk(KERN_INFO 1026 - "kgdb: Unregistered I/O driver %s, debugger disabled.\n", 1020 + pr_info("Unregistered I/O driver %s, debugger disabled\n", 1027 1021 old_dbg_io_ops->name); 1028 1022 } 1029 1023 EXPORT_SYMBOL_GPL(kgdb_unregister_io_module);
+21 -14
kernel/debug/kdb/kdb_bp.c
··· 531 531 for (i = 0, bp = kdb_breakpoints; i < KDB_MAXBPT; i++, bp++) 532 532 bp->bp_free = 1; 533 533 534 - kdb_register_repeat("bp", kdb_bp, "[<vaddr>]", 535 - "Set/Display breakpoints", 0, KDB_REPEAT_NO_ARGS); 536 - kdb_register_repeat("bl", kdb_bp, "[<vaddr>]", 537 - "Display breakpoints", 0, KDB_REPEAT_NO_ARGS); 534 + kdb_register_flags("bp", kdb_bp, "[<vaddr>]", 535 + "Set/Display breakpoints", 0, 536 + KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS); 537 + kdb_register_flags("bl", kdb_bp, "[<vaddr>]", 538 + "Display breakpoints", 0, 539 + KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS); 538 540 if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) 539 - kdb_register_repeat("bph", kdb_bp, "[<vaddr>]", 540 - "[datar [length]|dataw [length]] Set hw brk", 0, KDB_REPEAT_NO_ARGS); 541 - kdb_register_repeat("bc", kdb_bc, "<bpnum>", 542 - "Clear Breakpoint", 0, KDB_REPEAT_NONE); 543 - kdb_register_repeat("be", kdb_bc, "<bpnum>", 544 - "Enable Breakpoint", 0, KDB_REPEAT_NONE); 545 - kdb_register_repeat("bd", kdb_bc, "<bpnum>", 546 - "Disable Breakpoint", 0, KDB_REPEAT_NONE); 541 + kdb_register_flags("bph", kdb_bp, "[<vaddr>]", 542 + "[datar [length]|dataw [length]] Set hw brk", 0, 543 + KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS); 544 + kdb_register_flags("bc", kdb_bc, "<bpnum>", 545 + "Clear Breakpoint", 0, 546 + KDB_ENABLE_FLOW_CTRL); 547 + kdb_register_flags("be", kdb_bc, "<bpnum>", 548 + "Enable Breakpoint", 0, 549 + KDB_ENABLE_FLOW_CTRL); 550 + kdb_register_flags("bd", kdb_bc, "<bpnum>", 551 + "Disable Breakpoint", 0, 552 + KDB_ENABLE_FLOW_CTRL); 547 553 548 - kdb_register_repeat("ss", kdb_ss, "", 549 - "Single Step", 1, KDB_REPEAT_NO_ARGS); 554 + kdb_register_flags("ss", kdb_ss, "", 555 + "Single Step", 1, 556 + KDB_ENABLE_FLOW_CTRL | KDB_REPEAT_NO_ARGS); 550 557 /* 551 558 * Architecture dependent initialization. 552 559 */
+4
kernel/debug/kdb/kdb_debugger.c
··· 129 129 ks->pass_exception = 1; 130 130 KDB_FLAG_SET(CATASTROPHIC); 131 131 } 132 + /* set CATASTROPHIC if the system contains unresponsive processors */ 133 + for_each_online_cpu(i) 134 + if (!kgdb_info[i].enter_kgdb) 135 + KDB_FLAG_SET(CATASTROPHIC); 132 136 if (KDB_STATE(SSBPT) && reason == KDB_REASON_SSTEP) { 133 137 KDB_STATE_CLEAR(SSBPT); 134 138 KDB_STATE_CLEAR(DOING_SS);
+170 -95
kernel/debug/kdb/kdb_main.c
··· 12 12 */ 13 13 14 14 #include <linux/ctype.h> 15 + #include <linux/types.h> 15 16 #include <linux/string.h> 16 17 #include <linux/kernel.h> 17 18 #include <linux/kmsg_dump.h> ··· 24 23 #include <linux/vmalloc.h> 25 24 #include <linux/atomic.h> 26 25 #include <linux/module.h> 26 + #include <linux/moduleparam.h> 27 27 #include <linux/mm.h> 28 28 #include <linux/init.h> 29 29 #include <linux/kallsyms.h> ··· 43 41 #include <linux/uaccess.h> 44 42 #include <linux/slab.h> 45 43 #include "kdb_private.h" 44 + 45 + #undef MODULE_PARAM_PREFIX 46 + #define MODULE_PARAM_PREFIX "kdb." 47 + 48 + static int kdb_cmd_enabled = CONFIG_KDB_DEFAULT_ENABLE; 49 + module_param_named(cmd_enable, kdb_cmd_enabled, int, 0600); 46 50 47 51 #define GREP_LEN 256 48 52 char kdb_grep_string[GREP_LEN]; ··· 129 121 KDBMSG(BADLENGTH, "Invalid length field"), 130 122 KDBMSG(NOBP, "No Breakpoint exists"), 131 123 KDBMSG(BADADDR, "Invalid address"), 124 + KDBMSG(NOPERM, "Permission denied"), 132 125 }; 133 126 #undef KDBMSG 134 127 ··· 194 185 p = krp->p; 195 186 #endif 196 187 return p; 188 + } 189 + 190 + /* 191 + * Check whether the flags of the current command and the permissions 192 + * of the kdb console has allow a command to be run. 193 + */ 194 + static inline bool kdb_check_flags(kdb_cmdflags_t flags, int permissions, 195 + bool no_args) 196 + { 197 + /* permissions comes from userspace so needs massaging slightly */ 198 + permissions &= KDB_ENABLE_MASK; 199 + permissions |= KDB_ENABLE_ALWAYS_SAFE; 200 + 201 + /* some commands change group when launched with no arguments */ 202 + if (no_args) 203 + permissions |= permissions << KDB_ENABLE_NO_ARGS_SHIFT; 204 + 205 + flags |= KDB_ENABLE_ALL; 206 + 207 + return permissions & flags; 197 208 } 198 209 199 210 /* ··· 505 476 kdb_symtab_t symtab; 506 477 507 478 /* 479 + * If the enable flags prohibit both arbitrary memory access 480 + * and flow control then there are no reasonable grounds to 481 + * provide symbol lookup. 482 + */ 483 + if (!kdb_check_flags(KDB_ENABLE_MEM_READ | KDB_ENABLE_FLOW_CTRL, 484 + kdb_cmd_enabled, false)) 485 + return KDB_NOPERM; 486 + 487 + /* 508 488 * Process arguments which follow the following syntax: 509 489 * 510 490 * symbol | numeric-address [+/- numeric-offset] ··· 679 641 if (!s->count) 680 642 s->usable = 0; 681 643 if (s->usable) 682 - kdb_register(s->name, kdb_exec_defcmd, 683 - s->usage, s->help, 0); 644 + /* macros are always safe because when executed each 645 + * internal command re-enters kdb_parse() and is 646 + * safety checked individually. 647 + */ 648 + kdb_register_flags(s->name, kdb_exec_defcmd, s->usage, 649 + s->help, 0, 650 + KDB_ENABLE_ALWAYS_SAFE); 684 651 return 0; 685 652 } 686 653 if (!s->usable) ··· 1046 1003 1047 1004 if (i < kdb_max_commands) { 1048 1005 int result; 1006 + 1007 + if (!kdb_check_flags(tp->cmd_flags, kdb_cmd_enabled, argc <= 1)) 1008 + return KDB_NOPERM; 1009 + 1049 1010 KDB_STATE_SET(CMD); 1050 1011 result = (*tp->cmd_func)(argc-1, (const char **)argv); 1051 1012 if (result && ignore_errors && result > KDB_CMD_GO) 1052 1013 result = 0; 1053 1014 KDB_STATE_CLEAR(CMD); 1054 - switch (tp->cmd_repeat) { 1055 - case KDB_REPEAT_NONE: 1056 - argc = 0; 1057 - if (argv[0]) 1058 - *(argv[0]) = '\0'; 1059 - break; 1060 - case KDB_REPEAT_NO_ARGS: 1061 - argc = 1; 1062 - if (argv[1]) 1063 - *(argv[1]) = '\0'; 1064 - break; 1065 - case KDB_REPEAT_WITH_ARGS: 1066 - break; 1067 - } 1015 + 1016 + if (tp->cmd_flags & KDB_REPEAT_WITH_ARGS) 1017 + return result; 1018 + 1019 + argc = tp->cmd_flags & KDB_REPEAT_NO_ARGS ? 1 : 0; 1020 + if (argv[argc]) 1021 + *(argv[argc]) = '\0'; 1068 1022 return result; 1069 1023 } 1070 1024 ··· 1961 1921 */ 1962 1922 static int kdb_sr(int argc, const char **argv) 1963 1923 { 1924 + bool check_mask = 1925 + !kdb_check_flags(KDB_ENABLE_ALL, kdb_cmd_enabled, false); 1926 + 1964 1927 if (argc != 1) 1965 1928 return KDB_ARGCOUNT; 1929 + 1966 1930 kdb_trap_printk++; 1967 - __handle_sysrq(*argv[1], false); 1931 + __handle_sysrq(*argv[1], check_mask); 1968 1932 kdb_trap_printk--; 1969 1933 1970 1934 return 0; ··· 2201 2157 for (start_cpu = -1, i = 0; i < NR_CPUS; i++) { 2202 2158 if (!cpu_online(i)) { 2203 2159 state = 'F'; /* cpu is offline */ 2160 + } else if (!kgdb_info[i].enter_kgdb) { 2161 + state = 'D'; /* cpu is online but unresponsive */ 2204 2162 } else { 2205 2163 state = ' '; /* cpu is responding to kdb */ 2206 2164 if (kdb_task_state_char(KDB_TSK(i)) == 'I') ··· 2256 2210 /* 2257 2211 * Validate cpunum 2258 2212 */ 2259 - if ((cpunum > NR_CPUS) || !cpu_online(cpunum)) 2213 + if ((cpunum > NR_CPUS) || !kgdb_info[cpunum].enter_kgdb) 2260 2214 return KDB_BADCPUNUM; 2261 2215 2262 2216 dbg_switch_cpu = cpunum; ··· 2420 2374 if (KDB_FLAG(CMD_INTERRUPT)) 2421 2375 return 0; 2422 2376 if (!kt->cmd_name) 2377 + continue; 2378 + if (!kdb_check_flags(kt->cmd_flags, kdb_cmd_enabled, true)) 2423 2379 continue; 2424 2380 if (strlen(kt->cmd_usage) > 20) 2425 2381 space = "\n "; ··· 2677 2629 } 2678 2630 2679 2631 /* 2680 - * kdb_register_repeat - This function is used to register a kernel 2632 + * kdb_register_flags - This function is used to register a kernel 2681 2633 * debugger command. 2682 2634 * Inputs: 2683 2635 * cmd Command name ··· 2689 2641 * zero for success, one if a duplicate command. 2690 2642 */ 2691 2643 #define kdb_command_extend 50 /* arbitrary */ 2692 - int kdb_register_repeat(char *cmd, 2693 - kdb_func_t func, 2694 - char *usage, 2695 - char *help, 2696 - short minlen, 2697 - kdb_repeat_t repeat) 2644 + int kdb_register_flags(char *cmd, 2645 + kdb_func_t func, 2646 + char *usage, 2647 + char *help, 2648 + short minlen, 2649 + kdb_cmdflags_t flags) 2698 2650 { 2699 2651 int i; 2700 2652 kdbtab_t *kp; ··· 2742 2694 kp->cmd_func = func; 2743 2695 kp->cmd_usage = usage; 2744 2696 kp->cmd_help = help; 2745 - kp->cmd_flags = 0; 2746 2697 kp->cmd_minlen = minlen; 2747 - kp->cmd_repeat = repeat; 2698 + kp->cmd_flags = flags; 2748 2699 2749 2700 return 0; 2750 2701 } 2751 - EXPORT_SYMBOL_GPL(kdb_register_repeat); 2702 + EXPORT_SYMBOL_GPL(kdb_register_flags); 2752 2703 2753 2704 2754 2705 /* 2755 2706 * kdb_register - Compatibility register function for commands that do 2756 2707 * not need to specify a repeat state. Equivalent to 2757 - * kdb_register_repeat with KDB_REPEAT_NONE. 2708 + * kdb_register_flags with flags set to 0. 2758 2709 * Inputs: 2759 2710 * cmd Command name 2760 2711 * func Function to execute the command ··· 2768 2721 char *help, 2769 2722 short minlen) 2770 2723 { 2771 - return kdb_register_repeat(cmd, func, usage, help, minlen, 2772 - KDB_REPEAT_NONE); 2724 + return kdb_register_flags(cmd, func, usage, help, minlen, 0); 2773 2725 } 2774 2726 EXPORT_SYMBOL_GPL(kdb_register); 2775 2727 ··· 2810 2764 for_each_kdbcmd(kp, i) 2811 2765 kp->cmd_name = NULL; 2812 2766 2813 - kdb_register_repeat("md", kdb_md, "<vaddr>", 2767 + kdb_register_flags("md", kdb_md, "<vaddr>", 2814 2768 "Display Memory Contents, also mdWcN, e.g. md8c1", 1, 2815 - KDB_REPEAT_NO_ARGS); 2816 - kdb_register_repeat("mdr", kdb_md, "<vaddr> <bytes>", 2817 - "Display Raw Memory", 0, KDB_REPEAT_NO_ARGS); 2818 - kdb_register_repeat("mdp", kdb_md, "<paddr> <bytes>", 2819 - "Display Physical Memory", 0, KDB_REPEAT_NO_ARGS); 2820 - kdb_register_repeat("mds", kdb_md, "<vaddr>", 2821 - "Display Memory Symbolically", 0, KDB_REPEAT_NO_ARGS); 2822 - kdb_register_repeat("mm", kdb_mm, "<vaddr> <contents>", 2823 - "Modify Memory Contents", 0, KDB_REPEAT_NO_ARGS); 2824 - kdb_register_repeat("go", kdb_go, "[<vaddr>]", 2825 - "Continue Execution", 1, KDB_REPEAT_NONE); 2826 - kdb_register_repeat("rd", kdb_rd, "", 2827 - "Display Registers", 0, KDB_REPEAT_NONE); 2828 - kdb_register_repeat("rm", kdb_rm, "<reg> <contents>", 2829 - "Modify Registers", 0, KDB_REPEAT_NONE); 2830 - kdb_register_repeat("ef", kdb_ef, "<vaddr>", 2831 - "Display exception frame", 0, KDB_REPEAT_NONE); 2832 - kdb_register_repeat("bt", kdb_bt, "[<vaddr>]", 2833 - "Stack traceback", 1, KDB_REPEAT_NONE); 2834 - kdb_register_repeat("btp", kdb_bt, "<pid>", 2835 - "Display stack for process <pid>", 0, KDB_REPEAT_NONE); 2836 - kdb_register_repeat("bta", kdb_bt, "[D|R|S|T|C|Z|E|U|I|M|A]", 2837 - "Backtrace all processes matching state flag", 0, KDB_REPEAT_NONE); 2838 - kdb_register_repeat("btc", kdb_bt, "", 2839 - "Backtrace current process on each cpu", 0, KDB_REPEAT_NONE); 2840 - kdb_register_repeat("btt", kdb_bt, "<vaddr>", 2769 + KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS); 2770 + kdb_register_flags("mdr", kdb_md, "<vaddr> <bytes>", 2771 + "Display Raw Memory", 0, 2772 + KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS); 2773 + kdb_register_flags("mdp", kdb_md, "<paddr> <bytes>", 2774 + "Display Physical Memory", 0, 2775 + KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS); 2776 + kdb_register_flags("mds", kdb_md, "<vaddr>", 2777 + "Display Memory Symbolically", 0, 2778 + KDB_ENABLE_MEM_READ | KDB_REPEAT_NO_ARGS); 2779 + kdb_register_flags("mm", kdb_mm, "<vaddr> <contents>", 2780 + "Modify Memory Contents", 0, 2781 + KDB_ENABLE_MEM_WRITE | KDB_REPEAT_NO_ARGS); 2782 + kdb_register_flags("go", kdb_go, "[<vaddr>]", 2783 + "Continue Execution", 1, 2784 + KDB_ENABLE_REG_WRITE | KDB_ENABLE_ALWAYS_SAFE_NO_ARGS); 2785 + kdb_register_flags("rd", kdb_rd, "", 2786 + "Display Registers", 0, 2787 + KDB_ENABLE_REG_READ); 2788 + kdb_register_flags("rm", kdb_rm, "<reg> <contents>", 2789 + "Modify Registers", 0, 2790 + KDB_ENABLE_REG_WRITE); 2791 + kdb_register_flags("ef", kdb_ef, "<vaddr>", 2792 + "Display exception frame", 0, 2793 + KDB_ENABLE_MEM_READ); 2794 + kdb_register_flags("bt", kdb_bt, "[<vaddr>]", 2795 + "Stack traceback", 1, 2796 + KDB_ENABLE_MEM_READ | KDB_ENABLE_INSPECT_NO_ARGS); 2797 + kdb_register_flags("btp", kdb_bt, "<pid>", 2798 + "Display stack for process <pid>", 0, 2799 + KDB_ENABLE_INSPECT); 2800 + kdb_register_flags("bta", kdb_bt, "[D|R|S|T|C|Z|E|U|I|M|A]", 2801 + "Backtrace all processes matching state flag", 0, 2802 + KDB_ENABLE_INSPECT); 2803 + kdb_register_flags("btc", kdb_bt, "", 2804 + "Backtrace current process on each cpu", 0, 2805 + KDB_ENABLE_INSPECT); 2806 + kdb_register_flags("btt", kdb_bt, "<vaddr>", 2841 2807 "Backtrace process given its struct task address", 0, 2842 - KDB_REPEAT_NONE); 2843 - kdb_register_repeat("env", kdb_env, "", 2844 - "Show environment variables", 0, KDB_REPEAT_NONE); 2845 - kdb_register_repeat("set", kdb_set, "", 2846 - "Set environment variables", 0, KDB_REPEAT_NONE); 2847 - kdb_register_repeat("help", kdb_help, "", 2848 - "Display Help Message", 1, KDB_REPEAT_NONE); 2849 - kdb_register_repeat("?", kdb_help, "", 2850 - "Display Help Message", 0, KDB_REPEAT_NONE); 2851 - kdb_register_repeat("cpu", kdb_cpu, "<cpunum>", 2852 - "Switch to new cpu", 0, KDB_REPEAT_NONE); 2853 - kdb_register_repeat("kgdb", kdb_kgdb, "", 2854 - "Enter kgdb mode", 0, KDB_REPEAT_NONE); 2855 - kdb_register_repeat("ps", kdb_ps, "[<flags>|A]", 2856 - "Display active task list", 0, KDB_REPEAT_NONE); 2857 - kdb_register_repeat("pid", kdb_pid, "<pidnum>", 2858 - "Switch to another task", 0, KDB_REPEAT_NONE); 2859 - kdb_register_repeat("reboot", kdb_reboot, "", 2860 - "Reboot the machine immediately", 0, KDB_REPEAT_NONE); 2808 + KDB_ENABLE_MEM_READ | KDB_ENABLE_INSPECT_NO_ARGS); 2809 + kdb_register_flags("env", kdb_env, "", 2810 + "Show environment variables", 0, 2811 + KDB_ENABLE_ALWAYS_SAFE); 2812 + kdb_register_flags("set", kdb_set, "", 2813 + "Set environment variables", 0, 2814 + KDB_ENABLE_ALWAYS_SAFE); 2815 + kdb_register_flags("help", kdb_help, "", 2816 + "Display Help Message", 1, 2817 + KDB_ENABLE_ALWAYS_SAFE); 2818 + kdb_register_flags("?", kdb_help, "", 2819 + "Display Help Message", 0, 2820 + KDB_ENABLE_ALWAYS_SAFE); 2821 + kdb_register_flags("cpu", kdb_cpu, "<cpunum>", 2822 + "Switch to new cpu", 0, 2823 + KDB_ENABLE_ALWAYS_SAFE_NO_ARGS); 2824 + kdb_register_flags("kgdb", kdb_kgdb, "", 2825 + "Enter kgdb mode", 0, 0); 2826 + kdb_register_flags("ps", kdb_ps, "[<flags>|A]", 2827 + "Display active task list", 0, 2828 + KDB_ENABLE_INSPECT); 2829 + kdb_register_flags("pid", kdb_pid, "<pidnum>", 2830 + "Switch to another task", 0, 2831 + KDB_ENABLE_INSPECT); 2832 + kdb_register_flags("reboot", kdb_reboot, "", 2833 + "Reboot the machine immediately", 0, 2834 + KDB_ENABLE_REBOOT); 2861 2835 #if defined(CONFIG_MODULES) 2862 - kdb_register_repeat("lsmod", kdb_lsmod, "", 2863 - "List loaded kernel modules", 0, KDB_REPEAT_NONE); 2836 + kdb_register_flags("lsmod", kdb_lsmod, "", 2837 + "List loaded kernel modules", 0, 2838 + KDB_ENABLE_INSPECT); 2864 2839 #endif 2865 2840 #if defined(CONFIG_MAGIC_SYSRQ) 2866 - kdb_register_repeat("sr", kdb_sr, "<key>", 2867 - "Magic SysRq key", 0, KDB_REPEAT_NONE); 2841 + kdb_register_flags("sr", kdb_sr, "<key>", 2842 + "Magic SysRq key", 0, 2843 + KDB_ENABLE_ALWAYS_SAFE); 2868 2844 #endif 2869 2845 #if defined(CONFIG_PRINTK) 2870 - kdb_register_repeat("dmesg", kdb_dmesg, "[lines]", 2871 - "Display syslog buffer", 0, KDB_REPEAT_NONE); 2846 + kdb_register_flags("dmesg", kdb_dmesg, "[lines]", 2847 + "Display syslog buffer", 0, 2848 + KDB_ENABLE_ALWAYS_SAFE); 2872 2849 #endif 2873 2850 if (arch_kgdb_ops.enable_nmi) { 2874 - kdb_register_repeat("disable_nmi", kdb_disable_nmi, "", 2875 - "Disable NMI entry to KDB", 0, KDB_REPEAT_NONE); 2851 + kdb_register_flags("disable_nmi", kdb_disable_nmi, "", 2852 + "Disable NMI entry to KDB", 0, 2853 + KDB_ENABLE_ALWAYS_SAFE); 2876 2854 } 2877 - kdb_register_repeat("defcmd", kdb_defcmd, "name \"usage\" \"help\"", 2878 - "Define a set of commands, down to endefcmd", 0, KDB_REPEAT_NONE); 2879 - kdb_register_repeat("kill", kdb_kill, "<-signal> <pid>", 2880 - "Send a signal to a process", 0, KDB_REPEAT_NONE); 2881 - kdb_register_repeat("summary", kdb_summary, "", 2882 - "Summarize the system", 4, KDB_REPEAT_NONE); 2883 - kdb_register_repeat("per_cpu", kdb_per_cpu, "<sym> [<bytes>] [<cpu>]", 2884 - "Display per_cpu variables", 3, KDB_REPEAT_NONE); 2885 - kdb_register_repeat("grephelp", kdb_grep_help, "", 2886 - "Display help on | grep", 0, KDB_REPEAT_NONE); 2855 + kdb_register_flags("defcmd", kdb_defcmd, "name \"usage\" \"help\"", 2856 + "Define a set of commands, down to endefcmd", 0, 2857 + KDB_ENABLE_ALWAYS_SAFE); 2858 + kdb_register_flags("kill", kdb_kill, "<-signal> <pid>", 2859 + "Send a signal to a process", 0, 2860 + KDB_ENABLE_SIGNAL); 2861 + kdb_register_flags("summary", kdb_summary, "", 2862 + "Summarize the system", 4, 2863 + KDB_ENABLE_ALWAYS_SAFE); 2864 + kdb_register_flags("per_cpu", kdb_per_cpu, "<sym> [<bytes>] [<cpu>]", 2865 + "Display per_cpu variables", 3, 2866 + KDB_ENABLE_MEM_READ); 2867 + kdb_register_flags("grephelp", kdb_grep_help, "", 2868 + "Display help on | grep", 0, 2869 + KDB_ENABLE_ALWAYS_SAFE); 2887 2870 } 2888 2871 2889 2872 /* Execute any commands defined in kdb_cmds. */
+1 -2
kernel/debug/kdb/kdb_private.h
··· 172 172 kdb_func_t cmd_func; /* Function to execute command */ 173 173 char *cmd_usage; /* Usage String for this command */ 174 174 char *cmd_help; /* Help message for this command */ 175 - short cmd_flags; /* Parsing flags */ 176 175 short cmd_minlen; /* Minimum legal # command 177 176 * chars required */ 178 - kdb_repeat_t cmd_repeat; /* Does command auto repeat on enter? */ 177 + kdb_cmdflags_t cmd_flags; /* Command behaviour flags */ 179 178 } kdbtab_t; 180 179 181 180 extern int kdb_bt(int, const char **); /* KDB display back trace */
+8 -11
kernel/events/core.c
··· 4461 4461 } 4462 4462 4463 4463 static void perf_sample_regs_user(struct perf_regs *regs_user, 4464 - struct pt_regs *regs) 4464 + struct pt_regs *regs, 4465 + struct pt_regs *regs_user_copy) 4465 4466 { 4466 - if (!user_mode(regs)) { 4467 - if (current->mm) 4468 - regs = task_pt_regs(current); 4469 - else 4470 - regs = NULL; 4471 - } 4472 - 4473 - if (regs) { 4474 - regs_user->abi = perf_reg_abi(current); 4467 + if (user_mode(regs)) { 4468 + regs_user->abi = perf_reg_abi(current); 4475 4469 regs_user->regs = regs; 4470 + } else if (current->mm) { 4471 + perf_get_regs_user(regs_user, regs, regs_user_copy); 4476 4472 } else { 4477 4473 regs_user->abi = PERF_SAMPLE_REGS_ABI_NONE; 4478 4474 regs_user->regs = NULL; ··· 4947 4951 } 4948 4952 4949 4953 if (sample_type & (PERF_SAMPLE_REGS_USER | PERF_SAMPLE_STACK_USER)) 4950 - perf_sample_regs_user(&data->regs_user, regs); 4954 + perf_sample_regs_user(&data->regs_user, regs, 4955 + &data->regs_user_copy); 4951 4956 4952 4957 if (sample_type & PERF_SAMPLE_REGS_USER) { 4953 4958 /* regs dump ABI info */
+9 -3
kernel/exit.c
··· 1287 1287 static int wait_consider_task(struct wait_opts *wo, int ptrace, 1288 1288 struct task_struct *p) 1289 1289 { 1290 + /* 1291 + * We can race with wait_task_zombie() from another thread. 1292 + * Ensure that EXIT_ZOMBIE -> EXIT_DEAD/EXIT_TRACE transition 1293 + * can't confuse the checks below. 1294 + */ 1295 + int exit_state = ACCESS_ONCE(p->exit_state); 1290 1296 int ret; 1291 1297 1292 - if (unlikely(p->exit_state == EXIT_DEAD)) 1298 + if (unlikely(exit_state == EXIT_DEAD)) 1293 1299 return 0; 1294 1300 1295 1301 ret = eligible_child(wo, p); ··· 1316 1310 return 0; 1317 1311 } 1318 1312 1319 - if (unlikely(p->exit_state == EXIT_TRACE)) { 1313 + if (unlikely(exit_state == EXIT_TRACE)) { 1320 1314 /* 1321 1315 * ptrace == 0 means we are the natural parent. In this case 1322 1316 * we should clear notask_error, debugger will notify us. ··· 1343 1337 } 1344 1338 1345 1339 /* slay zombie? */ 1346 - if (p->exit_state == EXIT_ZOMBIE) { 1340 + if (exit_state == EXIT_ZOMBIE) { 1347 1341 /* we don't reap group leaders with subthreads */ 1348 1342 if (!delay_group_leader(p)) { 1349 1343 /*
+1 -1
kernel/locking/mutex-debug.c
··· 80 80 DEBUG_LOCKS_WARN_ON(lock->owner != current); 81 81 82 82 DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next); 83 - mutex_clear_owner(lock); 84 83 } 85 84 86 85 /* 87 86 * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug 88 87 * mutexes so that we can do it here after we've verified state. 89 88 */ 89 + mutex_clear_owner(lock); 90 90 atomic_set(&lock->count, 1); 91 91 } 92 92
+6 -9
kernel/sched/core.c
··· 7113 7113 #ifdef CONFIG_RT_GROUP_SCHED 7114 7114 alloc_size += 2 * nr_cpu_ids * sizeof(void **); 7115 7115 #endif 7116 - #ifdef CONFIG_CPUMASK_OFFSTACK 7117 - alloc_size += num_possible_cpus() * cpumask_size(); 7118 - #endif 7119 7116 if (alloc_size) { 7120 7117 ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT); 7121 7118 ··· 7132 7135 ptr += nr_cpu_ids * sizeof(void **); 7133 7136 7134 7137 #endif /* CONFIG_RT_GROUP_SCHED */ 7135 - #ifdef CONFIG_CPUMASK_OFFSTACK 7136 - for_each_possible_cpu(i) { 7137 - per_cpu(load_balance_mask, i) = (void *)ptr; 7138 - ptr += cpumask_size(); 7139 - } 7140 - #endif /* CONFIG_CPUMASK_OFFSTACK */ 7141 7138 } 7139 + #ifdef CONFIG_CPUMASK_OFFSTACK 7140 + for_each_possible_cpu(i) { 7141 + per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node( 7142 + cpumask_size(), GFP_KERNEL, cpu_to_node(i)); 7143 + } 7144 + #endif /* CONFIG_CPUMASK_OFFSTACK */ 7142 7145 7143 7146 init_rt_bandwidth(&def_rt_bandwidth, 7144 7147 global_rt_period(), global_rt_runtime());
+4 -21
kernel/sched/deadline.c
··· 570 570 static 571 571 int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se) 572 572 { 573 - int dmiss = dl_time_before(dl_se->deadline, rq_clock(rq)); 574 - int rorun = dl_se->runtime <= 0; 575 - 576 - if (!rorun && !dmiss) 577 - return 0; 578 - 579 - /* 580 - * If we are beyond our current deadline and we are still 581 - * executing, then we have already used some of the runtime of 582 - * the next instance. Thus, if we do not account that, we are 583 - * stealing bandwidth from the system at each deadline miss! 584 - */ 585 - if (dmiss) { 586 - dl_se->runtime = rorun ? dl_se->runtime : 0; 587 - dl_se->runtime -= rq_clock(rq) - dl_se->deadline; 588 - } 589 - 590 - return 1; 573 + return (dl_se->runtime <= 0); 591 574 } 592 575 593 576 extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); ··· 809 826 * parameters of the task might need updating. Otherwise, 810 827 * we want a replenishment of its runtime. 811 828 */ 812 - if (!dl_se->dl_new && flags & ENQUEUE_REPLENISH) 813 - replenish_dl_entity(dl_se, pi_se); 814 - else 829 + if (dl_se->dl_new || flags & ENQUEUE_WAKEUP) 815 830 update_dl_entity(dl_se, pi_se); 831 + else if (flags & ENQUEUE_REPLENISH) 832 + replenish_dl_entity(dl_se, pi_se); 816 833 817 834 __enqueue_dl_entity(dl_se); 818 835 }
+5 -1
kernel/sched/fair.c
··· 4005 4005 4006 4006 static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b) 4007 4007 { 4008 + /* init_cfs_bandwidth() was not called */ 4009 + if (!cfs_b->throttled_cfs_rq.next) 4010 + return; 4011 + 4008 4012 hrtimer_cancel(&cfs_b->period_timer); 4009 4013 hrtimer_cancel(&cfs_b->slack_timer); 4010 4014 } ··· 4428 4424 * wl = S * s'_i; see (2) 4429 4425 */ 4430 4426 if (W > 0 && w < W) 4431 - wl = (w * tg->shares) / W; 4427 + wl = (w * (long)tg->shares) / W; 4432 4428 else 4433 4429 wl = tg->shares; 4434 4430
+2 -2
kernel/trace/trace_kdb.c
··· 132 132 133 133 static __init int kdb_ftrace_register(void) 134 134 { 135 - kdb_register_repeat("ftdump", kdb_ftdump, "[skip_#lines] [cpu]", 136 - "Dump ftrace log", 0, KDB_REPEAT_NONE); 135 + kdb_register_flags("ftdump", kdb_ftdump, "[skip_#lines] [cpu]", 136 + "Dump ftrace log", 0, KDB_ENABLE_ALWAYS_SAFE); 137 137 return 0; 138 138 } 139 139
+25
lib/Kconfig.kgdb
··· 73 73 help 74 74 KDB frontend for kernel 75 75 76 + config KDB_DEFAULT_ENABLE 77 + hex "KDB: Select kdb command functions to be enabled by default" 78 + depends on KGDB_KDB 79 + default 0x1 80 + help 81 + Specifiers which kdb commands are enabled by default. This may 82 + be set to 1 or 0 to enable all commands or disable almost all 83 + commands. 84 + 85 + Alternatively the following bitmask applies: 86 + 87 + 0x0002 - allow arbitrary reads from memory and symbol lookup 88 + 0x0004 - allow arbitrary writes to memory 89 + 0x0008 - allow current register state to be inspected 90 + 0x0010 - allow current register state to be modified 91 + 0x0020 - allow passive inspection (backtrace, process list, lsmod) 92 + 0x0040 - allow flow control management (breakpoint, single step) 93 + 0x0080 - enable signalling of processes 94 + 0x0100 - allow machine to be rebooted 95 + 96 + The config option merely sets the default at boot time. Both 97 + issuing 'echo X > /sys/module/kdb/parameters/cmd_enable' or 98 + setting with kdb.cmd_enable=X kernel command line option will 99 + override the default settings. 100 + 76 101 config KDB_KEYBOARD 77 102 bool "KGDB_KDB: keyboard as input device" 78 103 depends on VT && KGDB_KDB
+1
lib/assoc_array.c
··· 11 11 * 2 of the Licence, or (at your option) any later version. 12 12 */ 13 13 //#define DEBUG 14 + #include <linux/rcupdate.h> 14 15 #include <linux/slab.h> 15 16 #include <linux/err.h> 16 17 #include <linux/assoc_array_priv.h>
-9
mm/Kconfig.debug
··· 14 14 depends on !KMEMCHECK 15 15 select PAGE_EXTENSION 16 16 select PAGE_POISONING if !ARCH_SUPPORTS_DEBUG_PAGEALLOC 17 - select PAGE_GUARD if ARCH_SUPPORTS_DEBUG_PAGEALLOC 18 17 ---help--- 19 18 Unmap pages from the kernel linear mapping after free_pages(). 20 19 This results in a large slowdown, but helps to find certain types ··· 26 27 that would result in incorrect warnings of memory corruption after 27 28 a resume because free pages are not saved to the suspend image. 28 29 29 - config WANT_PAGE_DEBUG_FLAGS 30 - bool 31 - 32 30 config PAGE_POISONING 33 31 bool 34 - select WANT_PAGE_DEBUG_FLAGS 35 - 36 - config PAGE_GUARD 37 - bool 38 - select WANT_PAGE_DEBUG_FLAGS
+4 -13
mm/memcontrol.c
··· 3043 3043 if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) { 3044 3044 mem_cgroup_swap_statistics(from, false); 3045 3045 mem_cgroup_swap_statistics(to, true); 3046 - /* 3047 - * This function is only called from task migration context now. 3048 - * It postpones page_counter and refcount handling till the end 3049 - * of task migration(mem_cgroup_clear_mc()) for performance 3050 - * improvement. But we cannot postpone css_get(to) because if 3051 - * the process that has been moved to @to does swap-in, the 3052 - * refcount of @to might be decreased to 0. 3053 - * 3054 - * We are in attach() phase, so the cgroup is guaranteed to be 3055 - * alive, so we can just call css_get(). 3056 - */ 3057 - css_get(&to->css); 3058 3046 return 0; 3059 3047 } 3060 3048 return -EINVAL; ··· 4667 4679 if (parent_css == NULL) { 4668 4680 root_mem_cgroup = memcg; 4669 4681 page_counter_init(&memcg->memory, NULL); 4682 + memcg->soft_limit = PAGE_COUNTER_MAX; 4670 4683 page_counter_init(&memcg->memsw, NULL); 4671 4684 page_counter_init(&memcg->kmem, NULL); 4672 4685 } ··· 4713 4724 4714 4725 if (parent->use_hierarchy) { 4715 4726 page_counter_init(&memcg->memory, &parent->memory); 4727 + memcg->soft_limit = PAGE_COUNTER_MAX; 4716 4728 page_counter_init(&memcg->memsw, &parent->memsw); 4717 4729 page_counter_init(&memcg->kmem, &parent->kmem); 4718 4730 ··· 4723 4733 */ 4724 4734 } else { 4725 4735 page_counter_init(&memcg->memory, NULL); 4736 + memcg->soft_limit = PAGE_COUNTER_MAX; 4726 4737 page_counter_init(&memcg->memsw, NULL); 4727 4738 page_counter_init(&memcg->kmem, NULL); 4728 4739 /* ··· 4798 4807 mem_cgroup_resize_limit(memcg, PAGE_COUNTER_MAX); 4799 4808 mem_cgroup_resize_memsw_limit(memcg, PAGE_COUNTER_MAX); 4800 4809 memcg_update_kmem_limit(memcg, PAGE_COUNTER_MAX); 4801 - memcg->soft_limit = 0; 4810 + memcg->soft_limit = PAGE_COUNTER_MAX; 4802 4811 } 4803 4812 4804 4813 #ifdef CONFIG_MMU
+23 -16
mm/memory.c
··· 235 235 236 236 static void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) 237 237 { 238 + if (!tlb->end) 239 + return; 240 + 238 241 tlb_flush(tlb); 239 242 mmu_notifier_invalidate_range(tlb->mm, tlb->start, tlb->end); 240 243 #ifdef CONFIG_HAVE_RCU_TABLE_FREE ··· 250 247 { 251 248 struct mmu_gather_batch *batch; 252 249 253 - for (batch = &tlb->local; batch; batch = batch->next) { 250 + for (batch = &tlb->local; batch && batch->nr; batch = batch->next) { 254 251 free_pages_and_swap_cache(batch->pages, batch->nr); 255 252 batch->nr = 0; 256 253 } ··· 259 256 260 257 void tlb_flush_mmu(struct mmu_gather *tlb) 261 258 { 262 - if (!tlb->end) 263 - return; 264 - 265 259 tlb_flush_mmu_tlbonly(tlb); 266 260 tlb_flush_mmu_free(tlb); 267 261 } ··· 2137 2137 if (!dirty_page) 2138 2138 return ret; 2139 2139 2140 - /* 2141 - * Yes, Virginia, this is actually required to prevent a race 2142 - * with clear_page_dirty_for_io() from clearing the page dirty 2143 - * bit after it clear all dirty ptes, but before a racing 2144 - * do_wp_page installs a dirty pte. 2145 - * 2146 - * do_shared_fault is protected similarly. 2147 - */ 2148 2140 if (!page_mkwrite) { 2149 - wait_on_page_locked(dirty_page); 2150 - set_page_dirty_balance(dirty_page); 2141 + struct address_space *mapping; 2142 + int dirtied; 2143 + 2144 + lock_page(dirty_page); 2145 + dirtied = set_page_dirty(dirty_page); 2146 + VM_BUG_ON_PAGE(PageAnon(dirty_page), dirty_page); 2147 + mapping = dirty_page->mapping; 2148 + unlock_page(dirty_page); 2149 + 2150 + if (dirtied && mapping) { 2151 + /* 2152 + * Some device drivers do not set page.mapping 2153 + * but still dirty their pages 2154 + */ 2155 + balance_dirty_pages_ratelimited(mapping); 2156 + } 2157 + 2151 2158 /* file_update_time outside page_lock */ 2152 2159 if (vma->vm_file) 2153 2160 file_update_time(vma->vm_file); ··· 2600 2593 if (prev && prev->vm_end == address) 2601 2594 return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; 2602 2595 2603 - expand_downwards(vma, address - PAGE_SIZE); 2596 + return expand_downwards(vma, address - PAGE_SIZE); 2604 2597 } 2605 2598 if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { 2606 2599 struct vm_area_struct *next = vma->vm_next; ··· 2609 2602 if (next && next->vm_start == address + PAGE_SIZE) 2610 2603 return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; 2611 2604 2612 - expand_upwards(vma, address + PAGE_SIZE); 2605 + return expand_upwards(vma, address + PAGE_SIZE); 2613 2606 } 2614 2607 return 0; 2615 2608 }
+10 -5
mm/mmap.c
··· 778 778 if (exporter && exporter->anon_vma && !importer->anon_vma) { 779 779 int error; 780 780 781 - error = anon_vma_clone(importer, exporter); 782 - if (error) 783 - return error; 784 781 importer->anon_vma = exporter->anon_vma; 782 + error = anon_vma_clone(importer, exporter); 783 + if (error) { 784 + importer->anon_vma = NULL; 785 + return error; 786 + } 785 787 } 786 788 } 787 789 ··· 2101 2099 { 2102 2100 struct mm_struct *mm = vma->vm_mm; 2103 2101 struct rlimit *rlim = current->signal->rlim; 2104 - unsigned long new_start; 2102 + unsigned long new_start, actual_size; 2105 2103 2106 2104 /* address space limit tests */ 2107 2105 if (!may_expand_vm(mm, grow)) 2108 2106 return -ENOMEM; 2109 2107 2110 2108 /* Stack limit test */ 2111 - if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) 2109 + actual_size = size; 2110 + if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN))) 2111 + actual_size -= PAGE_SIZE; 2112 + if (actual_size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) 2112 2113 return -ENOMEM; 2113 2114 2114 2115 /* mlock limit tests */
+12 -31
mm/page-writeback.c
··· 1541 1541 bdi_start_background_writeback(bdi); 1542 1542 } 1543 1543 1544 - void set_page_dirty_balance(struct page *page) 1545 - { 1546 - if (set_page_dirty(page)) { 1547 - struct address_space *mapping = page_mapping(page); 1548 - 1549 - if (mapping) 1550 - balance_dirty_pages_ratelimited(mapping); 1551 - } 1552 - } 1553 - 1554 1544 static DEFINE_PER_CPU(int, bdp_ratelimits); 1555 1545 1556 1546 /* ··· 2113 2123 * page dirty in that case, but not all the buffers. This is a "bottom-up" 2114 2124 * dirtying, whereas __set_page_dirty_buffers() is a "top-down" dirtying. 2115 2125 * 2116 - * Most callers have locked the page, which pins the address_space in memory. 2117 - * But zap_pte_range() does not lock the page, however in that case the 2118 - * mapping is pinned by the vma's ->vm_file reference. 2119 - * 2120 - * We take care to handle the case where the page was truncated from the 2121 - * mapping by re-checking page_mapping() inside tree_lock. 2126 + * The caller must ensure this doesn't race with truncation. Most will simply 2127 + * hold the page lock, but e.g. zap_pte_range() calls with the page mapped and 2128 + * the pte lock held, which also locks out truncation. 2122 2129 */ 2123 2130 int __set_page_dirty_nobuffers(struct page *page) 2124 2131 { 2125 2132 if (!TestSetPageDirty(page)) { 2126 2133 struct address_space *mapping = page_mapping(page); 2127 - struct address_space *mapping2; 2128 2134 unsigned long flags; 2129 2135 2130 2136 if (!mapping) 2131 2137 return 1; 2132 2138 2133 2139 spin_lock_irqsave(&mapping->tree_lock, flags); 2134 - mapping2 = page_mapping(page); 2135 - if (mapping2) { /* Race with truncate? */ 2136 - BUG_ON(mapping2 != mapping); 2137 - WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page)); 2138 - account_page_dirtied(page, mapping); 2139 - radix_tree_tag_set(&mapping->page_tree, 2140 - page_index(page), PAGECACHE_TAG_DIRTY); 2141 - } 2140 + BUG_ON(page_mapping(page) != mapping); 2141 + WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page)); 2142 + account_page_dirtied(page, mapping); 2143 + radix_tree_tag_set(&mapping->page_tree, page_index(page), 2144 + PAGECACHE_TAG_DIRTY); 2142 2145 spin_unlock_irqrestore(&mapping->tree_lock, flags); 2143 2146 if (mapping->host) { 2144 2147 /* !PageAnon && !swapper_space */ ··· 2288 2305 /* 2289 2306 * We carefully synchronise fault handlers against 2290 2307 * installing a dirty pte and marking the page dirty 2291 - * at this point. We do this by having them hold the 2292 - * page lock at some point after installing their 2293 - * pte, but before marking the page dirty. 2294 - * Pages are always locked coming in here, so we get 2295 - * the desired exclusion. See mm/memory.c:do_wp_page() 2296 - * for more comments. 2308 + * at this point. We do this by having them hold the 2309 + * page lock while dirtying the page, and pages are 2310 + * always locked coming in here, so we get the desired 2311 + * exclusion. 2297 2312 */ 2298 2313 if (TestClearPageDirty(page)) { 2299 2314 dec_zone_page_state(page, NR_FILE_DIRTY);
+41 -1
mm/rmap.c
··· 72 72 anon_vma = kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL); 73 73 if (anon_vma) { 74 74 atomic_set(&anon_vma->refcount, 1); 75 + anon_vma->degree = 1; /* Reference for first vma */ 76 + anon_vma->parent = anon_vma; 75 77 /* 76 78 * Initialise the anon_vma root to point to itself. If called 77 79 * from fork, the root will be reset to the parents anon_vma. ··· 190 188 if (likely(!vma->anon_vma)) { 191 189 vma->anon_vma = anon_vma; 192 190 anon_vma_chain_link(vma, avc, anon_vma); 191 + /* vma reference or self-parent link for new root */ 192 + anon_vma->degree++; 193 193 allocated = NULL; 194 194 avc = NULL; 195 195 } ··· 240 236 /* 241 237 * Attach the anon_vmas from src to dst. 242 238 * Returns 0 on success, -ENOMEM on failure. 239 + * 240 + * If dst->anon_vma is NULL this function tries to find and reuse existing 241 + * anon_vma which has no vmas and only one child anon_vma. This prevents 242 + * degradation of anon_vma hierarchy to endless linear chain in case of 243 + * constantly forking task. On the other hand, an anon_vma with more than one 244 + * child isn't reused even if there was no alive vma, thus rmap walker has a 245 + * good chance of avoiding scanning the whole hierarchy when it searches where 246 + * page is mapped. 243 247 */ 244 248 int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) 245 249 { ··· 268 256 anon_vma = pavc->anon_vma; 269 257 root = lock_anon_vma_root(root, anon_vma); 270 258 anon_vma_chain_link(dst, avc, anon_vma); 259 + 260 + /* 261 + * Reuse existing anon_vma if its degree lower than two, 262 + * that means it has no vma and only one anon_vma child. 263 + * 264 + * Do not chose parent anon_vma, otherwise first child 265 + * will always reuse it. Root anon_vma is never reused: 266 + * it has self-parent reference and at least one child. 267 + */ 268 + if (!dst->anon_vma && anon_vma != src->anon_vma && 269 + anon_vma->degree < 2) 270 + dst->anon_vma = anon_vma; 271 271 } 272 + if (dst->anon_vma) 273 + dst->anon_vma->degree++; 272 274 unlock_anon_vma_root(root); 273 275 return 0; 274 276 ··· 306 280 if (!pvma->anon_vma) 307 281 return 0; 308 282 283 + /* Drop inherited anon_vma, we'll reuse existing or allocate new. */ 284 + vma->anon_vma = NULL; 285 + 309 286 /* 310 287 * First, attach the new VMA to the parent VMA's anon_vmas, 311 288 * so rmap can find non-COWed pages in child processes. ··· 316 287 error = anon_vma_clone(vma, pvma); 317 288 if (error) 318 289 return error; 290 + 291 + /* An existing anon_vma has been reused, all done then. */ 292 + if (vma->anon_vma) 293 + return 0; 319 294 320 295 /* Then add our own anon_vma. */ 321 296 anon_vma = anon_vma_alloc(); ··· 334 301 * lock any of the anon_vmas in this anon_vma tree. 335 302 */ 336 303 anon_vma->root = pvma->anon_vma->root; 304 + anon_vma->parent = pvma->anon_vma; 337 305 /* 338 306 * With refcounts, an anon_vma can stay around longer than the 339 307 * process it belongs to. The root anon_vma needs to be pinned until ··· 345 311 vma->anon_vma = anon_vma; 346 312 anon_vma_lock_write(anon_vma); 347 313 anon_vma_chain_link(vma, avc, anon_vma); 314 + anon_vma->parent->degree++; 348 315 anon_vma_unlock_write(anon_vma); 349 316 350 317 return 0; ··· 376 341 * Leave empty anon_vmas on the list - we'll need 377 342 * to free them outside the lock. 378 343 */ 379 - if (RB_EMPTY_ROOT(&anon_vma->rb_root)) 344 + if (RB_EMPTY_ROOT(&anon_vma->rb_root)) { 345 + anon_vma->parent->degree--; 380 346 continue; 347 + } 381 348 382 349 list_del(&avc->same_vma); 383 350 anon_vma_chain_free(avc); 384 351 } 352 + if (vma->anon_vma) 353 + vma->anon_vma->degree--; 385 354 unlock_anon_vma_root(root); 386 355 387 356 /* ··· 396 357 list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { 397 358 struct anon_vma *anon_vma = avc->anon_vma; 398 359 360 + BUG_ON(anon_vma->degree); 399 361 put_anon_vma(anon_vma); 400 362 401 363 list_del(&avc->same_vma);
+13 -11
mm/vmscan.c
··· 2921 2921 return false; 2922 2922 2923 2923 /* 2924 - * There is a potential race between when kswapd checks its watermarks 2925 - * and a process gets throttled. There is also a potential race if 2926 - * processes get throttled, kswapd wakes, a large process exits therby 2927 - * balancing the zones that causes kswapd to miss a wakeup. If kswapd 2928 - * is going to sleep, no process should be sleeping on pfmemalloc_wait 2929 - * so wake them now if necessary. If necessary, processes will wake 2930 - * kswapd and get throttled again 2924 + * The throttled processes are normally woken up in balance_pgdat() as 2925 + * soon as pfmemalloc_watermark_ok() is true. But there is a potential 2926 + * race between when kswapd checks the watermarks and a process gets 2927 + * throttled. There is also a potential race if processes get 2928 + * throttled, kswapd wakes, a large process exits thereby balancing the 2929 + * zones, which causes kswapd to exit balance_pgdat() before reaching 2930 + * the wake up checks. If kswapd is going to sleep, no process should 2931 + * be sleeping on pfmemalloc_wait, so wake them now if necessary. If 2932 + * the wake up is premature, processes will wake kswapd and get 2933 + * throttled again. The difference from wake ups in balance_pgdat() is 2934 + * that here we are under prepare_to_wait(). 2931 2935 */ 2932 - if (waitqueue_active(&pgdat->pfmemalloc_wait)) { 2933 - wake_up(&pgdat->pfmemalloc_wait); 2934 - return false; 2935 - } 2936 + if (waitqueue_active(&pgdat->pfmemalloc_wait)) 2937 + wake_up_all(&pgdat->pfmemalloc_wait); 2936 2938 2937 2939 return pgdat_balanced(pgdat, order, classzone_idx); 2938 2940 }
+7 -4
net/batman-adv/multicast.c
··· 685 685 if (orig_initialized) 686 686 atomic_dec(&bat_priv->mcast.num_disabled); 687 687 orig->capabilities |= BATADV_ORIG_CAPA_HAS_MCAST; 688 - /* If mcast support is being switched off increase the disabled 689 - * mcast node counter. 688 + /* If mcast support is being switched off or if this is an initial 689 + * OGM without mcast support then increase the disabled mcast 690 + * node counter. 690 691 */ 691 692 } else if (!orig_mcast_enabled && 692 - orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) { 693 + (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST || 694 + !orig_initialized)) { 693 695 atomic_inc(&bat_priv->mcast.num_disabled); 694 696 orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_MCAST; 695 697 } ··· 740 738 { 741 739 struct batadv_priv *bat_priv = orig->bat_priv; 742 740 743 - if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST)) 741 + if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) && 742 + orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST) 744 743 atomic_dec(&bat_priv->mcast.num_disabled); 745 744 746 745 batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
+1 -1
net/batman-adv/network-coding.c
··· 133 133 if (!bat_priv->nc.decoding_hash) 134 134 goto err; 135 135 136 - batadv_hash_set_lock_class(bat_priv->nc.coding_hash, 136 + batadv_hash_set_lock_class(bat_priv->nc.decoding_hash, 137 137 &batadv_nc_decoding_hash_lock_class_key); 138 138 139 139 INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker);
+4 -3
net/batman-adv/originator.c
··· 570 570 571 571 batadv_frag_purge_orig(orig_node, NULL); 572 572 573 - batadv_tt_global_del_orig(orig_node->bat_priv, orig_node, -1, 574 - "originator timed out"); 575 - 576 573 if (orig_node->bat_priv->bat_algo_ops->bat_orig_free) 577 574 orig_node->bat_priv->bat_algo_ops->bat_orig_free(orig_node); 578 575 ··· 675 678 atomic_set(&orig_node->last_ttvn, 0); 676 679 orig_node->tt_buff = NULL; 677 680 orig_node->tt_buff_len = 0; 681 + orig_node->last_seen = jiffies; 678 682 reset_time = jiffies - 1 - msecs_to_jiffies(BATADV_RESET_PROTECTION_MS); 679 683 orig_node->bcast_seqno_reset = reset_time; 680 684 #ifdef CONFIG_BATMAN_ADV_MCAST ··· 975 977 if (batadv_purge_orig_node(bat_priv, orig_node)) { 976 978 batadv_gw_node_delete(bat_priv, orig_node); 977 979 hlist_del_rcu(&orig_node->hash_entry); 980 + batadv_tt_global_del_orig(orig_node->bat_priv, 981 + orig_node, -1, 982 + "originator timed out"); 978 983 batadv_orig_node_free_ref(orig_node); 979 984 continue; 980 985 }
+4 -2
net/batman-adv/routing.c
··· 443 443 444 444 router = batadv_orig_router_get(orig_node, recv_if); 445 445 446 + if (!router) 447 + return router; 448 + 446 449 /* only consider bonding for recv_if == BATADV_IF_DEFAULT (first hop) 447 450 * and if activated. 448 451 */ 449 - if (recv_if == BATADV_IF_DEFAULT || !atomic_read(&bat_priv->bonding) || 450 - !router) 452 + if (!(recv_if == BATADV_IF_DEFAULT && atomic_read(&bat_priv->bonding))) 451 453 return router; 452 454 453 455 /* bonding: loop through the list of possible routers found
+1 -1
net/ceph/auth_x.c
··· 676 676 int ret; 677 677 char tmp_enc[40]; 678 678 __le32 tmp[5] = { 679 - 16u, msg->hdr.crc, msg->footer.front_crc, 679 + cpu_to_le32(16), msg->hdr.crc, msg->footer.front_crc, 680 680 msg->footer.middle_crc, msg->footer.data_crc, 681 681 }; 682 682 ret = ceph_x_encrypt(&au->session_key, &tmp, sizeof(tmp),
+1 -1
net/ceph/mon_client.c
··· 717 717 if (src_len != sizeof(u32) + dst_len) 718 718 return -EINVAL; 719 719 720 - buf_len = le32_to_cpu(*(u32 *)src); 720 + buf_len = le32_to_cpu(*(__le32 *)src); 721 721 if (buf_len != dst_len) 722 722 return -EINVAL; 723 723
+2 -2
net/ipv4/tcp_output.c
··· 2019 2019 if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) 2020 2020 break; 2021 2021 2022 - if (tso_segs == 1) { 2022 + if (tso_segs == 1 || !max_segs) { 2023 2023 if (unlikely(!tcp_nagle_test(tp, skb, mss_now, 2024 2024 (tcp_skb_is_last(sk, skb) ? 2025 2025 nonagle : TCP_NAGLE_PUSH)))) ··· 2032 2032 } 2033 2033 2034 2034 limit = mss_now; 2035 - if (tso_segs > 1 && !tcp_urg_mode(tp)) 2035 + if (tso_segs > 1 && max_segs && !tcp_urg_mode(tp)) 2036 2036 limit = tcp_mss_split_point(sk, skb, mss_now, 2037 2037 min_t(unsigned int, 2038 2038 cwnd_quota,
+9 -3
net/mac80211/key.c
··· 140 140 if (!ret) { 141 141 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; 142 142 143 - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 143 + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 144 + (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) || 145 + (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))) 144 146 sdata->crypto_tx_tailroom_needed_cnt--; 145 147 146 148 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && ··· 190 188 sta = key->sta; 191 189 sdata = key->sdata; 192 190 193 - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 191 + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 192 + (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) || 193 + (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))) 194 194 increment_tailroom_need_count(sdata); 195 195 196 196 ret = drv_set_key(key->local, DISABLE_KEY, sdata, ··· 888 884 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { 889 885 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 890 886 891 - if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 887 + if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || 888 + (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) || 889 + (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))) 892 890 increment_tailroom_need_count(key->sdata); 893 891 } 894 892
+3 -2
net/openvswitch/flow.c
··· 70 70 { 71 71 struct flow_stats *stats; 72 72 int node = numa_node_id(); 73 + int len = skb->len + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); 73 74 74 75 stats = rcu_dereference(flow->stats[node]); 75 76 ··· 106 105 if (likely(new_stats)) { 107 106 new_stats->used = jiffies; 108 107 new_stats->packet_count = 1; 109 - new_stats->byte_count = skb->len; 108 + new_stats->byte_count = len; 110 109 new_stats->tcp_flags = tcp_flags; 111 110 spin_lock_init(&new_stats->lock); 112 111 ··· 121 120 122 121 stats->used = jiffies; 123 122 stats->packet_count++; 124 - stats->byte_count += skb->len; 123 + stats->byte_count += len; 125 124 stats->tcp_flags |= tcp_flags; 126 125 unlock: 127 126 spin_unlock(&stats->lock);
+1 -1
net/openvswitch/vport.c
··· 480 480 stats = this_cpu_ptr(vport->percpu_stats); 481 481 u64_stats_update_begin(&stats->syncp); 482 482 stats->rx_packets++; 483 - stats->rx_bytes += skb->len; 483 + stats->rx_bytes += skb->len + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); 484 484 u64_stats_update_end(&stats->syncp); 485 485 486 486 OVS_CB(skb)->input_vport = vport;
+3 -3
net/sunrpc/xdr.c
··· 606 606 struct kvec *head = buf->head; 607 607 struct kvec *tail = buf->tail; 608 608 int fraglen; 609 - int new, old; 609 + int new; 610 610 611 611 if (len > buf->len) { 612 612 WARN_ON_ONCE(1); ··· 629 629 buf->len -= fraglen; 630 630 631 631 new = buf->page_base + buf->page_len; 632 - old = new + fraglen; 633 - xdr->page_ptr -= (old >> PAGE_SHIFT) - (new >> PAGE_SHIFT); 632 + 633 + xdr->page_ptr = buf->pages + (new >> PAGE_SHIFT); 634 634 635 635 if (buf->page_len) { 636 636 xdr->p = page_address(*xdr->page_ptr);
+8 -8
scripts/Makefile.clean
··· 42 42 43 43 __clean-files := $(filter-out $(no-clean-files), $(__clean-files)) 44 44 45 - # as clean-files is given relative to the current directory, this adds 46 - # a $(obj) prefix, except for absolute paths 45 + # clean-files is given relative to the current directory, unless it 46 + # starts with $(objtree)/ (which means "./", so do not add "./" unless 47 + # you want to delete a file from the toplevel object directory). 47 48 48 49 __clean-files := $(wildcard \ 49 - $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \ 50 - $(filter /%, $(__clean-files))) 50 + $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(__clean-files))) \ 51 + $(filter $(objtree)/%, $(__clean-files))) 51 52 52 - # as clean-dirs is given relative to the current directory, this adds 53 - # a $(obj) prefix, except for absolute paths 53 + # same as clean-files 54 54 55 55 __clean-dirs := $(wildcard \ 56 - $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs))) \ 57 - $(filter /%, $(clean-dirs))) 56 + $(addprefix $(obj)/, $(filter-out $(objtree)/%, $(clean-dirs))) \ 57 + $(filter $(objtree)/%, $(clean-dirs))) 58 58 59 59 # ========================================================================== 60 60
+2 -2
security/keys/gc.c
··· 148 148 if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) 149 149 atomic_dec(&key->user->nikeys); 150 150 151 - key_user_put(key->user); 152 - 153 151 /* now throw away the key memory */ 154 152 if (key->type->destroy) 155 153 key->type->destroy(key); 154 + 155 + key_user_put(key->user); 156 156 157 157 kfree(key->description); 158 158
+1 -1
sound/firewire/fireworks/fireworks_transaction.c
··· 124 124 spin_lock_irq(&efw->lock); 125 125 126 126 t = (struct snd_efw_transaction *)data; 127 - length = min_t(size_t, t->length * sizeof(t->length), length); 127 + length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); 128 128 129 129 if (efw->push_ptr < efw->pull_ptr) 130 130 capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr);
+2
sound/pci/hda/patch_hdmi.c
··· 3353 3353 { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, 3354 3354 { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, 3355 3355 { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, 3356 + { .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi }, 3356 3357 { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, 3357 3358 { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, 3358 3359 { .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, ··· 3414 3413 MODULE_ALIAS("snd-hda-codec-id:10de0067"); 3415 3414 MODULE_ALIAS("snd-hda-codec-id:10de0070"); 3416 3415 MODULE_ALIAS("snd-hda-codec-id:10de0071"); 3416 + MODULE_ALIAS("snd-hda-codec-id:10de0072"); 3417 3417 MODULE_ALIAS("snd-hda-codec-id:10de8001"); 3418 3418 MODULE_ALIAS("snd-hda-codec-id:11069f80"); 3419 3419 MODULE_ALIAS("snd-hda-codec-id:11069f81");
+2 -2
sound/pci/hda/patch_sigmatel.c
··· 568 568 spec->gpio_mask; 569 569 } 570 570 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) 571 - spec->gpio_mask &= spec->gpio_mask; 572 - if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) 573 571 spec->gpio_dir &= spec->gpio_mask; 572 + if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) 573 + spec->gpio_data &= spec->gpio_mask; 574 574 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) 575 575 spec->eapd_mask &= spec->gpio_mask; 576 576 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
+1 -1
sound/usb/caiaq/audio.c
··· 816 816 return -EINVAL; 817 817 } 818 818 819 - if (cdev->n_streams < 2) { 819 + if (cdev->n_streams < 1) { 820 820 dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams); 821 821 return -EINVAL; 822 822 }
+2 -2
tools/lib/lockdep/preload.c
··· 317 317 * 318 318 * TODO: Hook into free() and add that check there as well. 319 319 */ 320 - debug_check_no_locks_freed(mutex, mutex + sizeof(*mutex)); 320 + debug_check_no_locks_freed(mutex, sizeof(*mutex)); 321 321 __del_lock(__get_lock(mutex)); 322 322 return ll_pthread_mutex_destroy(mutex); 323 323 } ··· 341 341 { 342 342 try_init_preload(); 343 343 344 - debug_check_no_locks_freed(rwlock, rwlock + sizeof(*rwlock)); 344 + debug_check_no_locks_freed(rwlock, sizeof(*rwlock)); 345 345 __del_lock(__get_lock(rwlock)); 346 346 return ll_pthread_rwlock_destroy(rwlock); 347 347 }
+1 -1
tools/perf/builtin-annotate.c
··· 232 232 if (nr_samples > 0) { 233 233 total_nr_samples += nr_samples; 234 234 hists__collapse_resort(hists, NULL); 235 - hists__output_resort(hists); 235 + hists__output_resort(hists, NULL); 236 236 237 237 if (symbol_conf.event_group && 238 238 !perf_evsel__is_group_leader(pos))
+45 -1
tools/perf/builtin-diff.c
··· 545 545 return __hist_entry__cmp_compute(p_left, p_right, c); 546 546 } 547 547 548 + static int64_t 549 + hist_entry__cmp_nop(struct hist_entry *left __maybe_unused, 550 + struct hist_entry *right __maybe_unused) 551 + { 552 + return 0; 553 + } 554 + 555 + static int64_t 556 + hist_entry__cmp_baseline(struct hist_entry *left, struct hist_entry *right) 557 + { 558 + if (sort_compute) 559 + return 0; 560 + 561 + if (left->stat.period == right->stat.period) 562 + return 0; 563 + return left->stat.period > right->stat.period ? 1 : -1; 564 + } 565 + 566 + static int64_t 567 + hist_entry__cmp_delta(struct hist_entry *left, struct hist_entry *right) 568 + { 569 + return hist_entry__cmp_compute(right, left, COMPUTE_DELTA); 570 + } 571 + 572 + static int64_t 573 + hist_entry__cmp_ratio(struct hist_entry *left, struct hist_entry *right) 574 + { 575 + return hist_entry__cmp_compute(right, left, COMPUTE_RATIO); 576 + } 577 + 578 + static int64_t 579 + hist_entry__cmp_wdiff(struct hist_entry *left, struct hist_entry *right) 580 + { 581 + return hist_entry__cmp_compute(right, left, COMPUTE_WEIGHTED_DIFF); 582 + } 583 + 548 584 static void insert_hist_entry_by_compute(struct rb_root *root, 549 585 struct hist_entry *he, 550 586 int c) ··· 641 605 hists__precompute(hists); 642 606 hists__compute_resort(hists); 643 607 } else { 644 - hists__output_resort(hists); 608 + hists__output_resort(hists, NULL); 645 609 } 646 610 647 611 hists__fprintf(hists, true, 0, 0, 0, stdout); ··· 1074 1038 fmt->header = hpp__header; 1075 1039 fmt->width = hpp__width; 1076 1040 fmt->entry = hpp__entry_global; 1041 + fmt->cmp = hist_entry__cmp_nop; 1042 + fmt->collapse = hist_entry__cmp_nop; 1077 1043 1078 1044 /* TODO more colors */ 1079 1045 switch (idx) { 1080 1046 case PERF_HPP_DIFF__BASELINE: 1081 1047 fmt->color = hpp__color_baseline; 1048 + fmt->sort = hist_entry__cmp_baseline; 1082 1049 break; 1083 1050 case PERF_HPP_DIFF__DELTA: 1084 1051 fmt->color = hpp__color_delta; 1052 + fmt->sort = hist_entry__cmp_delta; 1085 1053 break; 1086 1054 case PERF_HPP_DIFF__RATIO: 1087 1055 fmt->color = hpp__color_ratio; 1056 + fmt->sort = hist_entry__cmp_ratio; 1088 1057 break; 1089 1058 case PERF_HPP_DIFF__WEIGHTED_DIFF: 1090 1059 fmt->color = hpp__color_wdiff; 1060 + fmt->sort = hist_entry__cmp_wdiff; 1091 1061 break; 1092 1062 default: 1063 + fmt->sort = hist_entry__cmp_nop; 1093 1064 break; 1094 1065 } 1095 1066 1096 1067 init_header(d, dfmt); 1097 1068 perf_hpp__column_register(fmt); 1069 + perf_hpp__register_sort_field(fmt); 1098 1070 } 1099 1071 1100 1072 static void ui_init(void)
+10 -3
tools/perf/builtin-list.c
··· 19 19 int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) 20 20 { 21 21 int i; 22 - const struct option list_options[] = { 22 + bool raw_dump = false; 23 + struct option list_options[] = { 24 + OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), 23 25 OPT_END() 24 26 }; 25 27 const char * const list_usage[] = { ··· 29 27 NULL 30 28 }; 31 29 30 + set_option_flag(list_options, 0, "raw-dump", PARSE_OPT_HIDDEN); 31 + 32 32 argc = parse_options(argc, argv, list_options, list_usage, 33 33 PARSE_OPT_STOP_AT_NON_OPTION); 34 34 35 35 setup_pager(); 36 + 37 + if (raw_dump) { 38 + print_events(NULL, true); 39 + return 0; 40 + } 36 41 37 42 if (argc == 0) { 38 43 print_events(NULL, false); ··· 62 53 print_hwcache_events(NULL, false); 63 54 else if (strcmp(argv[i], "pmu") == 0) 64 55 print_pmu_events(NULL, false); 65 - else if (strcmp(argv[i], "--raw-dump") == 0) 66 - print_events(NULL, true); 67 56 else { 68 57 char *sep = strchr(argv[i], ':'), *s; 69 58 int sep_idx;
+22 -2
tools/perf/builtin-report.c
··· 457 457 ui_progress__finish(); 458 458 } 459 459 460 + static void report__output_resort(struct report *rep) 461 + { 462 + struct ui_progress prog; 463 + struct perf_evsel *pos; 464 + 465 + ui_progress__init(&prog, rep->nr_entries, "Sorting events for output..."); 466 + 467 + evlist__for_each(rep->session->evlist, pos) 468 + hists__output_resort(evsel__hists(pos), &prog); 469 + 470 + ui_progress__finish(); 471 + } 472 + 460 473 static int __cmd_report(struct report *rep) 461 474 { 462 475 int ret; ··· 518 505 if (session_done()) 519 506 return 0; 520 507 508 + /* 509 + * recalculate number of entries after collapsing since it 510 + * might be changed during the collapse phase. 511 + */ 512 + rep->nr_entries = 0; 513 + evlist__for_each(session->evlist, pos) 514 + rep->nr_entries += evsel__hists(pos)->nr_entries; 515 + 521 516 if (rep->nr_entries == 0) { 522 517 ui__error("The %s file has no samples!\n", file->path); 523 518 return 0; 524 519 } 525 520 526 - evlist__for_each(session->evlist, pos) 527 - hists__output_resort(evsel__hists(pos)); 521 + report__output_resort(rep); 528 522 529 523 return report__browse_hists(rep); 530 524 }
+2 -2
tools/perf/builtin-top.c
··· 285 285 } 286 286 287 287 hists__collapse_resort(hists, NULL); 288 - hists__output_resort(hists); 288 + hists__output_resort(hists, NULL); 289 289 290 290 hists__output_recalc_col_len(hists, top->print_entries - printed); 291 291 putchar('\n'); ··· 554 554 } 555 555 556 556 hists__collapse_resort(hists, NULL); 557 - hists__output_resort(hists); 557 + hists__output_resort(hists, NULL); 558 558 } 559 559 560 560 static void *display_thread_tui(void *arg)
+34 -34
tools/perf/tests/hists_cumulate.c
··· 187 187 * function since TEST_ASSERT_VAL() returns in case of failure. 188 188 */ 189 189 hists__collapse_resort(hists, NULL); 190 - hists__output_resort(hists); 190 + hists__output_resort(hists, NULL); 191 191 192 192 if (verbose > 2) { 193 193 pr_info("use callchain: %d, cumulate callchain: %d\n", ··· 454 454 * 30.00% 10.00% perf perf [.] cmd_record 455 455 * 20.00% 0.00% bash libc [.] malloc 456 456 * 10.00% 10.00% bash [kernel] [k] page_fault 457 - * 10.00% 10.00% perf [kernel] [k] schedule 458 - * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open 459 - * 10.00% 10.00% perf [kernel] [k] page_fault 460 - * 10.00% 10.00% perf libc [.] free 461 - * 10.00% 10.00% perf libc [.] malloc 462 457 * 10.00% 10.00% bash bash [.] xmalloc 458 + * 10.00% 10.00% perf [kernel] [k] page_fault 459 + * 10.00% 10.00% perf libc [.] malloc 460 + * 10.00% 10.00% perf [kernel] [k] schedule 461 + * 10.00% 10.00% perf libc [.] free 462 + * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open 463 463 */ 464 464 struct result expected[] = { 465 465 { 7000, 2000, "perf", "perf", "main" }, ··· 468 468 { 3000, 1000, "perf", "perf", "cmd_record" }, 469 469 { 2000, 0, "bash", "libc", "malloc" }, 470 470 { 1000, 1000, "bash", "[kernel]", "page_fault" }, 471 - { 1000, 1000, "perf", "[kernel]", "schedule" }, 472 - { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, 471 + { 1000, 1000, "bash", "bash", "xmalloc" }, 473 472 { 1000, 1000, "perf", "[kernel]", "page_fault" }, 473 + { 1000, 1000, "perf", "[kernel]", "schedule" }, 474 474 { 1000, 1000, "perf", "libc", "free" }, 475 475 { 1000, 1000, "perf", "libc", "malloc" }, 476 - { 1000, 1000, "bash", "bash", "xmalloc" }, 476 + { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, 477 477 }; 478 478 479 479 symbol_conf.use_callchain = false; ··· 537 537 * malloc 538 538 * main 539 539 * 540 - * 10.00% 10.00% perf [kernel] [k] schedule 540 + * 10.00% 10.00% bash bash [.] xmalloc 541 541 * | 542 - * --- schedule 543 - * run_command 542 + * --- xmalloc 543 + * malloc 544 + * xmalloc <--- NOTE: there's a cycle 545 + * malloc 546 + * xmalloc 544 547 * main 545 548 * 546 549 * 10.00% 0.00% perf [kernel] [k] sys_perf_event_open ··· 556 553 * | 557 554 * --- page_fault 558 555 * sys_perf_event_open 556 + * run_command 557 + * main 558 + * 559 + * 10.00% 10.00% perf [kernel] [k] schedule 560 + * | 561 + * --- schedule 559 562 * run_command 560 563 * main 561 564 * ··· 579 570 * run_command 580 571 * main 581 572 * 582 - * 10.00% 10.00% bash bash [.] xmalloc 583 - * | 584 - * --- xmalloc 585 - * malloc 586 - * xmalloc <--- NOTE: there's a cycle 587 - * malloc 588 - * xmalloc 589 - * main 590 - * 591 573 */ 592 574 struct result expected[] = { 593 575 { 7000, 2000, "perf", "perf", "main" }, ··· 587 587 { 3000, 1000, "perf", "perf", "cmd_record" }, 588 588 { 2000, 0, "bash", "libc", "malloc" }, 589 589 { 1000, 1000, "bash", "[kernel]", "page_fault" }, 590 - { 1000, 1000, "perf", "[kernel]", "schedule" }, 590 + { 1000, 1000, "bash", "bash", "xmalloc" }, 591 591 { 1000, 0, "perf", "[kernel]", "sys_perf_event_open" }, 592 592 { 1000, 1000, "perf", "[kernel]", "page_fault" }, 593 + { 1000, 1000, "perf", "[kernel]", "schedule" }, 593 594 { 1000, 1000, "perf", "libc", "free" }, 594 595 { 1000, 1000, "perf", "libc", "malloc" }, 595 - { 1000, 1000, "bash", "bash", "xmalloc" }, 596 596 }; 597 597 struct callchain_result expected_callchain[] = { 598 598 { ··· 622 622 { "bash", "main" }, }, 623 623 }, 624 624 { 625 - 3, { { "[kernel]", "schedule" }, 626 - { "perf", "run_command" }, 627 - { "perf", "main" }, }, 625 + 6, { { "bash", "xmalloc" }, 626 + { "libc", "malloc" }, 627 + { "bash", "xmalloc" }, 628 + { "libc", "malloc" }, 629 + { "bash", "xmalloc" }, 630 + { "bash", "main" }, }, 628 631 }, 629 632 { 630 633 3, { { "[kernel]", "sys_perf_event_open" }, ··· 637 634 { 638 635 4, { { "[kernel]", "page_fault" }, 639 636 { "[kernel]", "sys_perf_event_open" }, 637 + { "perf", "run_command" }, 638 + { "perf", "main" }, }, 639 + }, 640 + { 641 + 3, { { "[kernel]", "schedule" }, 640 642 { "perf", "run_command" }, 641 643 { "perf", "main" }, }, 642 644 }, ··· 656 648 { "perf", "cmd_record" }, 657 649 { "perf", "run_command" }, 658 650 { "perf", "main" }, }, 659 - }, 660 - { 661 - 6, { { "bash", "xmalloc" }, 662 - { "libc", "malloc" }, 663 - { "bash", "xmalloc" }, 664 - { "libc", "malloc" }, 665 - { "bash", "xmalloc" }, 666 - { "bash", "main" }, }, 667 651 }, 668 652 }; 669 653
+1 -1
tools/perf/tests/hists_filter.c
··· 138 138 struct hists *hists = evsel__hists(evsel); 139 139 140 140 hists__collapse_resort(hists, NULL); 141 - hists__output_resort(hists); 141 + hists__output_resort(hists, NULL); 142 142 143 143 if (verbose > 2) { 144 144 pr_info("Normal histogram\n");
+5 -5
tools/perf/tests/hists_output.c
··· 152 152 goto out; 153 153 154 154 hists__collapse_resort(hists, NULL); 155 - hists__output_resort(hists); 155 + hists__output_resort(hists, NULL); 156 156 157 157 if (verbose > 2) { 158 158 pr_info("[fields = %s, sort = %s]\n", field_order, sort_order); ··· 252 252 goto out; 253 253 254 254 hists__collapse_resort(hists, NULL); 255 - hists__output_resort(hists); 255 + hists__output_resort(hists, NULL); 256 256 257 257 if (verbose > 2) { 258 258 pr_info("[fields = %s, sort = %s]\n", field_order, sort_order); ··· 306 306 goto out; 307 307 308 308 hists__collapse_resort(hists, NULL); 309 - hists__output_resort(hists); 309 + hists__output_resort(hists, NULL); 310 310 311 311 if (verbose > 2) { 312 312 pr_info("[fields = %s, sort = %s]\n", field_order, sort_order); ··· 384 384 goto out; 385 385 386 386 hists__collapse_resort(hists, NULL); 387 - hists__output_resort(hists); 387 + hists__output_resort(hists, NULL); 388 388 389 389 if (verbose > 2) { 390 390 pr_info("[fields = %s, sort = %s]\n", field_order, sort_order); ··· 487 487 goto out; 488 488 489 489 hists__collapse_resort(hists, NULL); 490 - hists__output_resort(hists); 490 + hists__output_resort(hists, NULL); 491 491 492 492 if (verbose > 2) { 493 493 pr_info("[fields = %s, sort = %s]\n", field_order, sort_order);
+1 -1
tools/perf/ui/browsers/hists.c
··· 550 550 bool need_percent; 551 551 552 552 node = rb_first(root); 553 - need_percent = !!rb_next(node); 553 + need_percent = node && rb_next(node); 554 554 555 555 while (node) { 556 556 struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node);
+3
tools/perf/ui/hist.c
··· 204 204 if (ret) 205 205 return ret; 206 206 207 + if (a->thread != b->thread || !symbol_conf.use_callchain) 208 + return 0; 209 + 207 210 ret = b->callchain->max_depth - a->callchain->max_depth; 208 211 } 209 212 return ret;
+24 -2
tools/perf/ui/tui/setup.c
··· 1 1 #include <signal.h> 2 2 #include <stdbool.h> 3 + #ifdef HAVE_BACKTRACE_SUPPORT 4 + #include <execinfo.h> 5 + #endif 3 6 4 7 #include "../../util/cache.h" 5 8 #include "../../util/debug.h" ··· 91 88 return SLkp_getkey(); 92 89 } 93 90 91 + #ifdef HAVE_BACKTRACE_SUPPORT 92 + static void ui__signal_backtrace(int sig) 93 + { 94 + void *stackdump[32]; 95 + size_t size; 96 + 97 + ui__exit(false); 98 + psignal(sig, "perf"); 99 + 100 + printf("-------- backtrace --------\n"); 101 + size = backtrace(stackdump, ARRAY_SIZE(stackdump)); 102 + backtrace_symbols_fd(stackdump, size, STDOUT_FILENO); 103 + 104 + exit(0); 105 + } 106 + #else 107 + # define ui__signal_backtrace ui__signal 108 + #endif 109 + 94 110 static void ui__signal(int sig) 95 111 { 96 112 ui__exit(false); ··· 144 122 ui_browser__init(); 145 123 tui_progress__init(); 146 124 147 - signal(SIGSEGV, ui__signal); 148 - signal(SIGFPE, ui__signal); 125 + signal(SIGSEGV, ui__signal_backtrace); 126 + signal(SIGFPE, ui__signal_backtrace); 149 127 signal(SIGINT, ui__signal); 150 128 signal(SIGQUIT, ui__signal); 151 129 signal(SIGTERM, ui__signal);
+30
tools/perf/util/callchain.c
··· 841 841 842 842 return bf; 843 843 } 844 + 845 + static void free_callchain_node(struct callchain_node *node) 846 + { 847 + struct callchain_list *list, *tmp; 848 + struct callchain_node *child; 849 + struct rb_node *n; 850 + 851 + list_for_each_entry_safe(list, tmp, &node->val, list) { 852 + list_del(&list->list); 853 + free(list); 854 + } 855 + 856 + n = rb_first(&node->rb_root_in); 857 + while (n) { 858 + child = container_of(n, struct callchain_node, rb_node_in); 859 + n = rb_next(n); 860 + rb_erase(&child->rb_node_in, &node->rb_root_in); 861 + 862 + free_callchain_node(child); 863 + free(child); 864 + } 865 + } 866 + 867 + void free_callchain(struct callchain_root *root) 868 + { 869 + if (!symbol_conf.use_callchain) 870 + return; 871 + 872 + free_callchain_node(&root->node); 873 + }
+2
tools/perf/util/callchain.h
··· 198 198 char *callchain_list__sym_name(struct callchain_list *cl, 199 199 char *bf, size_t bfsize, bool show_dso); 200 200 201 + void free_callchain(struct callchain_root *root); 202 + 201 203 #endif /* __PERF_CALLCHAIN_H */
+14 -4
tools/perf/util/hist.c
··· 6 6 #include "evlist.h" 7 7 #include "evsel.h" 8 8 #include "annotate.h" 9 + #include "ui/progress.h" 9 10 #include <math.h> 10 11 11 12 static bool hists__filter_entry_by_dso(struct hists *hists, ··· 304 303 size_t callchain_size = 0; 305 304 struct hist_entry *he; 306 305 307 - if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) 306 + if (symbol_conf.use_callchain) 308 307 callchain_size = sizeof(struct callchain_root); 309 308 310 309 he = zalloc(sizeof(*he) + callchain_size); ··· 737 736 iter->he = he; 738 737 he_cache[iter->curr++] = he; 739 738 740 - callchain_append(he->callchain, &callchain_cursor, sample->period); 739 + hist_entry__append_callchain(he, sample); 741 740 742 741 /* 743 742 * We need to re-initialize the cursor since callchain_append() ··· 810 809 iter->he = he; 811 810 he_cache[iter->curr++] = he; 812 811 813 - callchain_append(he->callchain, &cursor, sample->period); 812 + if (symbol_conf.use_callchain) 813 + callchain_append(he->callchain, &cursor, sample->period); 814 814 return 0; 815 815 } 816 816 ··· 947 945 zfree(&he->mem_info); 948 946 zfree(&he->stat_acc); 949 947 free_srcline(he->srcline); 948 + free_callchain(he->callchain); 950 949 free(he); 951 950 } 952 951 ··· 990 987 else 991 988 p = &(*p)->rb_right; 992 989 } 990 + hists->nr_entries++; 993 991 994 992 rb_link_node(&he->rb_node_in, parent, p); 995 993 rb_insert_color(&he->rb_node_in, root); ··· 1028 1024 if (!sort__need_collapse) 1029 1025 return; 1030 1026 1027 + hists->nr_entries = 0; 1028 + 1031 1029 root = hists__get_rotate_entries_in(hists); 1030 + 1032 1031 next = rb_first(root); 1033 1032 1034 1033 while (next) { ··· 1126 1119 rb_insert_color(&he->rb_node, entries); 1127 1120 } 1128 1121 1129 - void hists__output_resort(struct hists *hists) 1122 + void hists__output_resort(struct hists *hists, struct ui_progress *prog) 1130 1123 { 1131 1124 struct rb_root *root; 1132 1125 struct rb_node *next; ··· 1155 1148 1156 1149 if (!n->filtered) 1157 1150 hists__calc_col_len(hists, n); 1151 + 1152 + if (prog) 1153 + ui_progress__update(prog, 1); 1158 1154 } 1159 1155 } 1160 1156
+1 -1
tools/perf/util/hist.h
··· 121 121 struct hists *hists); 122 122 void hist_entry__free(struct hist_entry *); 123 123 124 - void hists__output_resort(struct hists *hists); 124 + void hists__output_resort(struct hists *hists, struct ui_progress *prog); 125 125 void hists__collapse_resort(struct hists *hists, struct ui_progress *prog); 126 126 127 127 void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel);
+4 -2
tools/perf/util/probe-event.c
··· 495 495 } 496 496 497 497 if (ntevs == 0) { /* No error but failed to find probe point. */ 498 - pr_warning("Probe point '%s' not found.\n", 498 + pr_warning("Probe point '%s' not found in debuginfo.\n", 499 499 synthesize_perf_probe_point(&pev->point)); 500 - return -ENOENT; 500 + if (need_dwarf) 501 + return -ENOENT; 502 + return 0; 501 503 } 502 504 /* Error path : ntevs < 0 */ 503 505 pr_debug("An error occurred in debuginfo analysis (%d).\n", ntevs);
+17 -1
tools/perf/util/probe-finder.c
··· 989 989 int ret = 0; 990 990 991 991 #if _ELFUTILS_PREREQ(0, 142) 992 + Elf *elf; 993 + GElf_Ehdr ehdr; 994 + GElf_Shdr shdr; 995 + 992 996 /* Get the call frame information from this dwarf */ 993 - pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg)); 997 + elf = dwarf_getelf(dbg->dbg); 998 + if (elf == NULL) 999 + return -EINVAL; 1000 + 1001 + if (gelf_getehdr(elf, &ehdr) == NULL) 1002 + return -EINVAL; 1003 + 1004 + if (elf_section_by_name(elf, &ehdr, &shdr, ".eh_frame", NULL) && 1005 + shdr.sh_type == SHT_PROGBITS) { 1006 + pf->cfi = dwarf_getcfi_elf(elf); 1007 + } else { 1008 + pf->cfi = dwarf_getcfi(dbg->dbg); 1009 + } 994 1010 #endif 995 1011 996 1012 off = 0;
+13 -6
tools/testing/selftests/exec/execveat.c
··· 62 62 } 63 63 64 64 static int check_execveat_invoked_rc(int fd, const char *path, int flags, 65 - int expected_rc) 65 + int expected_rc, int expected_rc2) 66 66 { 67 67 int status; 68 68 int rc; ··· 98 98 child, status); 99 99 return 1; 100 100 } 101 - if (WEXITSTATUS(status) != expected_rc) { 102 - printf("[FAIL] (child %d exited with %d not %d)\n", 103 - child, WEXITSTATUS(status), expected_rc); 101 + if ((WEXITSTATUS(status) != expected_rc) && 102 + (WEXITSTATUS(status) != expected_rc2)) { 103 + printf("[FAIL] (child %d exited with %d not %d nor %d)\n", 104 + child, WEXITSTATUS(status), expected_rc, expected_rc2); 104 105 return 1; 105 106 } 106 107 printf("[OK]\n"); ··· 110 109 111 110 static int check_execveat(int fd, const char *path, int flags) 112 111 { 113 - return check_execveat_invoked_rc(fd, path, flags, 99); 112 + return check_execveat_invoked_rc(fd, path, flags, 99, 99); 114 113 } 115 114 116 115 static char *concat(const char *left, const char *right) ··· 193 192 * Execute as a long pathname relative to ".". If this is a script, 194 193 * the interpreter will launch but fail to open the script because its 195 194 * name ("/dev/fd/5/xxx....") is bigger than PATH_MAX. 195 + * 196 + * The failure code is usually 127 (POSIX: "If a command is not found, 197 + * the exit status shall be 127."), but some systems give 126 (POSIX: 198 + * "If the command name is found, but it is not an executable utility, 199 + * the exit status shall be 126."), so allow either. 196 200 */ 197 201 if (is_script) 198 - fail += check_execveat_invoked_rc(dot_dfd, longpath, 0, 127); 202 + fail += check_execveat_invoked_rc(dot_dfd, longpath, 0, 203 + 127, 126); 199 204 else 200 205 fail += check_execveat(dot_dfd, longpath, 0); 201 206
+1 -2
tools/testing/selftests/mqueue/mq_perf_tests.c
··· 536 536 { 537 537 struct mq_attr attr; 538 538 char *option, *next_option; 539 - int i, cpu; 539 + int i, cpu, rc; 540 540 struct sigaction sa; 541 541 poptContext popt_context; 542 - char rc; 543 542 void *retval; 544 543 545 544 main_thread = pthread_self();
+1 -1
tools/testing/selftests/vm/Makefile
··· 7 7 8 8 all: $(BINARIES) 9 9 %: %.c 10 - $(CC) $(CFLAGS) -o $@ $^ 10 + $(CC) $(CFLAGS) -o $@ $^ -lrt 11 11 12 12 run_tests: all 13 13 @/bin/sh ./run_vmtests || (echo "vmtests: [FAIL]"; exit 1)