···3737 0-| / \/ \/3838 +---0----1----2----3----4----5----6------------> time (s)39394040- 2. To make the LED go instantly from one brigntess value to another,4141- we should use use zero-time lengths (the brightness must be same as4040+ 2. To make the LED go instantly from one brightness value to another,4141+ we should use zero-time lengths (the brightness must be same as4242 the previous tuple's). So the format should be:4343 "brightness_1 duration_1 brightness_1 0 brightness_2 duration_24444 brightness_2 0 ...". For example:
···11I2C for OMAP platforms2233Required properties :44-- compatible : Must be "ti,omap2420-i2c", "ti,omap2430-i2c", "ti,omap3-i2c"55- or "ti,omap4-i2c"44+- compatible : Must be55+ "ti,omap2420-i2c" for OMAP2420 SoCs66+ "ti,omap2430-i2c" for OMAP2430 SoCs77+ "ti,omap3-i2c" for OMAP3 SoCs88+ "ti,omap4-i2c" for OMAP4+ SoCs99+ "ti,am654-i2c", "ti,omap4-i2c" for AM654 SoCs610- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based)711- #address-cells = <1>;812- #size-cells = <0>;
+18
Documentation/i2c/busses/i2c-nvidia-gpu
···11+Kernel driver i2c-nvidia-gpu22+33+Datasheet: not publicly available.44+55+Authors:66+ Ajay Gupta <ajayg@nvidia.com>77+88+Description99+-----------1010+1111+i2c-nvidia-gpu is a driver for I2C controller included in NVIDIA Turing1212+and later GPUs and it is used to communicate with Type-C controller on GPUs.1313+1414+If your 'lspci -v' listing shows something like the following,1515+1616+01:00.3 Serial bus controller [0c80]: NVIDIA Corporation Device 1ad9 (rev a1)1717+1818+then this driver should support the I2C controller of your GPU.
···25250C8/004 ALL ext_cmd_line_ptr cmd_line_ptr high 32bits2626140/080 ALL edid_info Video mode setup (struct edid_info)27271C0/020 ALL efi_info EFI 32 information (struct efi_info)2828-1E0/004 ALL alk_mem_k Alternative mem check, in KB2828+1E0/004 ALL alt_mem_k Alternative mem check, in KB29291E4/004 ALL scratch Scratch field for the kernel setup code30301E8/001 ALL e820_entries Number of entries in e820_table (below)31311E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
···1010#ifndef _ASM_PGTABLE_2LEVEL_H1111#define _ASM_PGTABLE_2LEVEL_H12121313-#define __PAGETABLE_PMD_FOLDED1313+#define __PAGETABLE_PMD_FOLDED 114141515/*1616 * Hardware-wise, we have a two level page table structure, where the first
···2424#define KERNEL_DS UL(-1)2525#define USER_DS (TASK_SIZE_64 - 1)26262727+/*2828+ * On arm64 systems, unaligned accesses by the CPU are cheap, and so there is2929+ * no point in shifting all network buffers by 2 bytes just to make some IP3030+ * header fields appear aligned in memory, potentially sacrificing some DMA3131+ * performance on some platforms.3232+ */3333+#define NET_IP_ALIGN 03434+2735#ifndef __ASSEMBLY__2836#ifdef __KERNEL__2937
···6767void (*cvmx_override_ipd_port_setup) (int ipd_port);68686969/* Port count per interface */7070-static int interface_port_count[5];7070+static int interface_port_count[9];71717272/**7373 * Return the number of interfaces the chip has. Each interface
+1-1
arch/mips/mm/dma-noncoherent.c
···5050 void *ret;51515252 ret = dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs);5353- if (!ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) {5353+ if (ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) {5454 dma_cache_wback_inv((unsigned long) ret, size);5555 ret = (void *)UNCAC_ADDR(ret);5656 }
···6464CONFIG_PREEMPT=y6565CONFIG_HZ_100=y6666CONFIG_KEXEC_FILE=y6767+CONFIG_EXPOLINE=y6868+CONFIG_EXPOLINE_AUTO=y6769CONFIG_MEMORY_HOTPLUG=y6870CONFIG_MEMORY_HOTREMOVE=y6971CONFIG_KSM=y···8684CONFIG_HOTPLUG_PCI=y8785CONFIG_HOTPLUG_PCI_S390=y8886CONFIG_CHSC_SCH=y8787+CONFIG_VFIO_AP=m8988CONFIG_CRASH_DUMP=y9089CONFIG_BINFMT_MISC=m9190CONFIG_HIBERNATION=y9191+CONFIG_PM_DEBUG=y9292CONFIG_NET=y9393CONFIG_PACKET=y9494CONFIG_PACKET_DIAG=m···165161CONFIG_NF_CT_NETLINK=m166162CONFIG_NF_CT_NETLINK_TIMEOUT=m167163CONFIG_NF_TABLES=m168168-CONFIG_NFT_EXTHDR=m169169-CONFIG_NFT_META=m170164CONFIG_NFT_CT=m171165CONFIG_NFT_COUNTER=m172166CONFIG_NFT_LOG=m···367365CONFIG_NET_ACT_CSUM=m368366CONFIG_DNS_RESOLVER=y369367CONFIG_OPENVSWITCH=m368368+CONFIG_VSOCKETS=m369369+CONFIG_VIRTIO_VSOCKETS=m370370CONFIG_NETLINK_DIAG=m371371CONFIG_CGROUP_NET_PRIO=y372372CONFIG_BPF_JIT=y···465461CONFIG_PPPOL2TP=m466462CONFIG_PPP_ASYNC=m467463CONFIG_PPP_SYNC_TTY=m464464+CONFIG_ISM=m468465CONFIG_INPUT_EVDEV=y469466# CONFIG_INPUT_KEYBOARD is not set470467# CONFIG_INPUT_MOUSE is not set···491486CONFIG_MLX5_INFINIBAND=m492487CONFIG_VFIO=m493488CONFIG_VFIO_PCI=m489489+CONFIG_VFIO_MDEV=m490490+CONFIG_VFIO_MDEV_DEVICE=m494491CONFIG_VIRTIO_PCI=m495492CONFIG_VIRTIO_BALLOON=m496493CONFIG_VIRTIO_INPUT=y494494+CONFIG_S390_AP_IOMMU=y497495CONFIG_EXT4_FS=y498496CONFIG_EXT4_FS_POSIX_ACL=y499497CONFIG_EXT4_FS_SECURITY=y···623615CONFIG_RCU_TORTURE_TEST=m624616CONFIG_RCU_CPU_STALL_TIMEOUT=300625617CONFIG_NOTIFIER_ERROR_INJECTION=m626626-CONFIG_PM_NOTIFIER_ERROR_INJECT=m627618CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m628619CONFIG_FAULT_INJECTION=y629620CONFIG_FAILSLAB=y···734727CONFIG_KVM=m735728CONFIG_KVM_S390_UCONTROL=y736729CONFIG_VHOST_NET=m730730+CONFIG_VHOST_VSOCK=m
+11-2
arch/s390/configs/performance_defconfig
···6565CONFIG_NUMA=y6666CONFIG_HZ_100=y6767CONFIG_KEXEC_FILE=y6868+CONFIG_EXPOLINE=y6969+CONFIG_EXPOLINE_AUTO=y6870CONFIG_MEMORY_HOTPLUG=y6971CONFIG_MEMORY_HOTREMOVE=y7072CONFIG_KSM=y···8482CONFIG_HOTPLUG_PCI=y8583CONFIG_HOTPLUG_PCI_S390=y8684CONFIG_CHSC_SCH=y8585+CONFIG_VFIO_AP=m8786CONFIG_CRASH_DUMP=y8887CONFIG_BINFMT_MISC=m8988CONFIG_HIBERNATION=y8989+CONFIG_PM_DEBUG=y9090CONFIG_NET=y9191CONFIG_PACKET=y9292CONFIG_PACKET_DIAG=m···163159CONFIG_NF_CT_NETLINK=m164160CONFIG_NF_CT_NETLINK_TIMEOUT=m165161CONFIG_NF_TABLES=m166166-CONFIG_NFT_EXTHDR=m167167-CONFIG_NFT_META=m168162CONFIG_NFT_CT=m169163CONFIG_NFT_COUNTER=m170164CONFIG_NFT_LOG=m···364362CONFIG_NET_ACT_CSUM=m365363CONFIG_DNS_RESOLVER=y366364CONFIG_OPENVSWITCH=m365365+CONFIG_VSOCKETS=m366366+CONFIG_VIRTIO_VSOCKETS=m367367CONFIG_NETLINK_DIAG=m368368CONFIG_CGROUP_NET_PRIO=y369369CONFIG_BPF_JIT=y···462458CONFIG_PPPOL2TP=m463459CONFIG_PPP_ASYNC=m464460CONFIG_PPP_SYNC_TTY=m461461+CONFIG_ISM=m465462CONFIG_INPUT_EVDEV=y466463# CONFIG_INPUT_KEYBOARD is not set467464# CONFIG_INPUT_MOUSE is not set···488483CONFIG_MLX5_INFINIBAND=m489484CONFIG_VFIO=m490485CONFIG_VFIO_PCI=m486486+CONFIG_VFIO_MDEV=m487487+CONFIG_VFIO_MDEV_DEVICE=m491488CONFIG_VIRTIO_PCI=m492489CONFIG_VIRTIO_BALLOON=m493490CONFIG_VIRTIO_INPUT=y491491+CONFIG_S390_AP_IOMMU=y494492CONFIG_EXT4_FS=y495493CONFIG_EXT4_FS_POSIX_ACL=y496494CONFIG_EXT4_FS_SECURITY=y···674666CONFIG_KVM=m675667CONFIG_KVM_S390_UCONTROL=y676668CONFIG_VHOST_NET=m669669+CONFIG_VHOST_VSOCK=m
+41-38
arch/s390/defconfig
···2626CONFIG_CGROUP_PERF=y2727CONFIG_NAMESPACES=y2828CONFIG_USER_NS=y2929+CONFIG_CHECKPOINT_RESTORE=y2930CONFIG_BLK_DEV_INITRD=y3031CONFIG_EXPERT=y3132# CONFIG_SYSFS_SYSCALL is not set3232-CONFIG_CHECKPOINT_RESTORE=y3333CONFIG_BPF_SYSCALL=y3434CONFIG_USERFAULTFD=y3535# CONFIG_COMPAT_BRK is not set3636CONFIG_PROFILING=y3737+CONFIG_LIVEPATCH=y3838+CONFIG_NR_CPUS=2563939+CONFIG_NUMA=y4040+CONFIG_HZ_100=y4141+CONFIG_KEXEC_FILE=y4242+CONFIG_CRASH_DUMP=y4343+CONFIG_HIBERNATION=y4444+CONFIG_PM_DEBUG=y4545+CONFIG_CMM=m3746CONFIG_OPROFILE=y3847CONFIG_KPROBES=y3948CONFIG_JUMP_LABEL=y···5344CONFIG_PARTITION_ADVANCED=y5445CONFIG_IBM_PARTITION=y5546CONFIG_DEFAULT_DEADLINE=y5656-CONFIG_LIVEPATCH=y5757-CONFIG_NR_CPUS=2565858-CONFIG_NUMA=y5959-CONFIG_HZ_100=y6060-CONFIG_KEXEC_FILE=y4747+CONFIG_BINFMT_MISC=m6148CONFIG_MEMORY_HOTPLUG=y6249CONFIG_MEMORY_HOTREMOVE=y6350CONFIG_KSM=y···6560CONFIG_ZSMALLOC=m6661CONFIG_ZSMALLOC_STAT=y6762CONFIG_IDLE_PAGE_TRACKING=y6868-CONFIG_CRASH_DUMP=y6969-CONFIG_BINFMT_MISC=m7070-CONFIG_HIBERNATION=y7163CONFIG_NET=y7264CONFIG_PACKET=y7365CONFIG_UNIX=y···10098CONFIG_BLK_DEV_RAM=y10199CONFIG_VIRTIO_BLK=y102100CONFIG_SCSI=y101101+# CONFIG_SCSI_MQ_DEFAULT is not set103102CONFIG_BLK_DEV_SD=y104103CONFIG_CHR_DEV_ST=y105104CONFIG_BLK_DEV_SR=y···134131CONFIG_TUN=m135132CONFIG_VIRTIO_NET=y136133# CONFIG_NET_VENDOR_ALACRITECH is not set134134+# CONFIG_NET_VENDOR_AURORA is not set137135# CONFIG_NET_VENDOR_CORTINA is not set138136# CONFIG_NET_VENDOR_SOLARFLARE is not set139137# CONFIG_NET_VENDOR_SOCIONEXT is not set···161157CONFIG_TMPFS_POSIX_ACL=y162158CONFIG_HUGETLBFS=y163159# CONFIG_NETWORK_FILESYSTEMS is not set164164-CONFIG_DEBUG_INFO=y165165-CONFIG_DEBUG_INFO_DWARF4=y166166-CONFIG_GDB_SCRIPTS=y167167-CONFIG_UNUSED_SYMBOLS=y168168-CONFIG_DEBUG_SECTION_MISMATCH=y169169-CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y170170-CONFIG_MAGIC_SYSRQ=y171171-CONFIG_DEBUG_PAGEALLOC=y172172-CONFIG_DETECT_HUNG_TASK=y173173-CONFIG_PANIC_ON_OOPS=y174174-CONFIG_PROVE_LOCKING=y175175-CONFIG_LOCK_STAT=y176176-CONFIG_DEBUG_LOCKDEP=y177177-CONFIG_DEBUG_ATOMIC_SLEEP=y178178-CONFIG_DEBUG_LIST=y179179-CONFIG_DEBUG_SG=y180180-CONFIG_DEBUG_NOTIFIERS=y181181-CONFIG_RCU_CPU_STALL_TIMEOUT=60182182-CONFIG_LATENCYTOP=y183183-CONFIG_SCHED_TRACER=y184184-CONFIG_FTRACE_SYSCALLS=y185185-CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y186186-CONFIG_STACK_TRACER=y187187-CONFIG_BLK_DEV_IO_TRACE=y188188-CONFIG_FUNCTION_PROFILER=y189189-# CONFIG_RUNTIME_TESTING_MENU is not set190190-CONFIG_S390_PTDUMP=y191160CONFIG_CRYPTO_CRYPTD=m192161CONFIG_CRYPTO_AUTHENC=m193162CONFIG_CRYPTO_TEST=m···170193CONFIG_CRYPTO_CFB=m171194CONFIG_CRYPTO_CTS=m172195CONFIG_CRYPTO_LRW=m196196+CONFIG_CRYPTO_OFB=m173197CONFIG_CRYPTO_PCBC=m174198CONFIG_CRYPTO_XTS=m175199CONFIG_CRYPTO_CMAC=m···209231CONFIG_CRYPTO_USER_API_SKCIPHER=m210232CONFIG_CRYPTO_USER_API_RNG=m211233CONFIG_ZCRYPT=m212212-CONFIG_ZCRYPT_MULTIDEVNODES=y213234CONFIG_PKEY=m214235CONFIG_CRYPTO_PAES_S390=m215236CONFIG_CRYPTO_SHA1_S390=m···224247# CONFIG_XZ_DEC_ARM is not set225248# CONFIG_XZ_DEC_ARMTHUMB is not set226249# CONFIG_XZ_DEC_SPARC is not set227227-CONFIG_CMM=m250250+CONFIG_DEBUG_INFO=y251251+CONFIG_DEBUG_INFO_DWARF4=y252252+CONFIG_GDB_SCRIPTS=y253253+CONFIG_UNUSED_SYMBOLS=y254254+CONFIG_DEBUG_SECTION_MISMATCH=y255255+CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y256256+CONFIG_MAGIC_SYSRQ=y257257+CONFIG_DEBUG_PAGEALLOC=y258258+CONFIG_DETECT_HUNG_TASK=y259259+CONFIG_PANIC_ON_OOPS=y260260+CONFIG_PROVE_LOCKING=y261261+CONFIG_LOCK_STAT=y262262+CONFIG_DEBUG_LOCKDEP=y263263+CONFIG_DEBUG_ATOMIC_SLEEP=y264264+CONFIG_DEBUG_LIST=y265265+CONFIG_DEBUG_SG=y266266+CONFIG_DEBUG_NOTIFIERS=y267267+CONFIG_RCU_CPU_STALL_TIMEOUT=60268268+CONFIG_LATENCYTOP=y269269+CONFIG_SCHED_TRACER=y270270+CONFIG_FTRACE_SYSCALLS=y271271+CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y272272+CONFIG_STACK_TRACER=y273273+CONFIG_BLK_DEV_IO_TRACE=y274274+CONFIG_FUNCTION_PROFILER=y275275+# CONFIG_RUNTIME_TESTING_MENU is not set276276+CONFIG_S390_PTDUMP=y
-5
arch/s390/include/asm/mmu_context.h
···4646 mm->context.asce_limit = STACK_TOP_MAX;4747 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |4848 _ASCE_USER_BITS | _ASCE_TYPE_REGION3;4949- /* pgd_alloc() did not account this pud */5050- mm_inc_nr_puds(mm);5149 break;5250 case -PAGE_SIZE:5351 /* forked 5-level task, set new asce with new_mm->pgd */···6163 /* forked 2-level compat task, set new asce with new mm->pgd */6264 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |6365 _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT;6464- /* pgd_alloc() did not account this pmd */6565- mm_inc_nr_pmds(mm);6666- mm_inc_nr_puds(mm);6766 }6867 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));6968 return 0;
+3-3
arch/s390/include/asm/pgalloc.h
···36363737static inline unsigned long pgd_entry_type(struct mm_struct *mm)3838{3939- if (mm->context.asce_limit <= _REGION3_SIZE)3939+ if (mm_pmd_folded(mm))4040 return _SEGMENT_ENTRY_EMPTY;4141- if (mm->context.asce_limit <= _REGION2_SIZE)4141+ if (mm_pud_folded(mm))4242 return _REGION3_ENTRY_EMPTY;4343- if (mm->context.asce_limit <= _REGION1_SIZE)4343+ if (mm_p4d_folded(mm))4444 return _REGION2_ENTRY_EMPTY;4545 return _REGION1_ENTRY_EMPTY;4646}
···1414 * General size of kernel stacks1515 */1616#ifdef CONFIG_KASAN1717-#define THREAD_SIZE_ORDER 31717+#define THREAD_SIZE_ORDER 41818#else1919#define THREAD_SIZE_ORDER 22020#endif
+3-3
arch/s390/include/asm/tlb.h
···136136static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,137137 unsigned long address)138138{139139- if (tlb->mm->context.asce_limit <= _REGION3_SIZE)139139+ if (mm_pmd_folded(tlb->mm))140140 return;141141 pgtable_pmd_page_dtor(virt_to_page(pmd));142142 tlb_remove_table(tlb, pmd);···152152static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,153153 unsigned long address)154154{155155- if (tlb->mm->context.asce_limit <= _REGION1_SIZE)155155+ if (mm_p4d_folded(tlb->mm))156156 return;157157 tlb_remove_table(tlb, p4d);158158}···167167static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,168168 unsigned long address)169169{170170- if (tlb->mm->context.asce_limit <= _REGION2_SIZE)170170+ if (mm_pud_folded(tlb->mm))171171 return;172172 tlb_remove_table(tlb, pud);173173}
+3-3
arch/s390/kernel/entry.S
···236236 stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task237237 lghi %r4,__TASK_stack238238 lghi %r1,__TASK_thread239239- lg %r5,0(%r4,%r3) # start of kernel stack of next239239+ llill %r5,STACK_INIT240240 stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev241241- lgr %r15,%r5242242- aghi %r15,STACK_INIT # end of kernel stack of next241241+ lg %r15,0(%r4,%r3) # start of kernel stack of next242242+ agr %r15,%r5 # end of kernel stack of next243243 stg %r3,__LC_CURRENT # store task struct of next244244 stg %r15,__LC_KERNEL_STACK # store end of kernel stack245245 lg %r15,__THREAD_ksp(%r1,%r3) # load kernel stack of next
+1-1
arch/s390/kernel/perf_cpum_cf.c
···373373 return -ENOENT;374374375375 if (ev > PERF_CPUM_CF_MAX_CTR)376376- return -EINVAL;376376+ return -ENOENT;377377378378 /* Obtain the counter set to which the specified counter belongs */379379 set = get_counter_set(ev);
+28-5
arch/s390/kernel/perf_cpum_sf.c
···18421842CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF);18431843CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG);1844184418451845-static struct attribute *cpumsf_pmu_events_attr[] = {18461846- CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC),18471847- NULL,18481848- NULL,18451845+/* Attribute list for CPU_SF.18461846+ *18471847+ * The availablitiy depends on the CPU_MF sampling facility authorization18481848+ * for basic + diagnositic samples. This is determined at initialization18491849+ * time by the sampling facility device driver.18501850+ * If the authorization for basic samples is turned off, it should be18511851+ * also turned off for diagnostic sampling.18521852+ *18531853+ * During initialization of the device driver, check the authorization18541854+ * level for diagnostic sampling and installs the attribute18551855+ * file for diagnostic sampling if necessary.18561856+ *18571857+ * For now install a placeholder to reference all possible attributes:18581858+ * SF_CYCLES_BASIC and SF_CYCLES_BASIC_DIAG.18591859+ * Add another entry for the final NULL pointer.18601860+ */18611861+enum {18621862+ SF_CYCLES_BASIC_ATTR_IDX = 0,18631863+ SF_CYCLES_BASIC_DIAG_ATTR_IDX,18641864+ SF_CYCLES_ATTR_MAX18651865+};18661866+18671867+static struct attribute *cpumsf_pmu_events_attr[SF_CYCLES_ATTR_MAX + 1] = {18681868+ [SF_CYCLES_BASIC_ATTR_IDX] = CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC)18491869};1850187018511871PMU_FORMAT_ATTR(event, "config:0-63");···2060204020612041 if (si.ad) {20622042 sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB);20632063- cpumsf_pmu_events_attr[1] =20432043+ /* Sampling of diagnostic data authorized,20442044+ * install event into attribute list of PMU device.20452045+ */20462046+ cpumsf_pmu_events_attr[SF_CYCLES_BASIC_DIAG_ATTR_IDX] =20642047 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG);20652048 }20662049
+3-3
arch/s390/kernel/vdso32/Makefile
···3737$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so38383939# link rule for the .so file, .lds has to be first4040-$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32)4040+$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE4141 $(call if_changed,vdso32ld)42424343# strip rule for the .so file···4646 $(call if_changed,objcopy)47474848# assembly rules for the .S files4949-$(obj-vdso32): %.o: %.S4949+$(obj-vdso32): %.o: %.S FORCE5050 $(call if_changed_dep,vdso32as)51515252# actual build commands5353quiet_cmd_vdso32ld = VDSO32L $@5454- cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@5454+ cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@5555quiet_cmd_vdso32as = VDSO32A $@5656 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<5757
+3-3
arch/s390/kernel/vdso64/Makefile
···3737$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so38383939# link rule for the .so file, .lds has to be first4040-$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64)4040+$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE4141 $(call if_changed,vdso64ld)42424343# strip rule for the .so file···4646 $(call if_changed,objcopy)47474848# assembly rules for the .S files4949-$(obj-vdso64): %.o: %.S4949+$(obj-vdso64): %.o: %.S FORCE5050 $(call if_changed_dep,vdso64as)51515252# actual build commands5353quiet_cmd_vdso64ld = VDSO64L $@5454- cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@5454+ cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@5555quiet_cmd_vdso64as = VDSO64A $@5656 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<5757
+2-2
arch/s390/kernel/vmlinux.lds.S
···154154 * uncompressed image info used by the decompressor155155 * it should match struct vmlinux_info156156 */157157- .vmlinux.info 0 : {157157+ .vmlinux.info 0 (INFO) : {158158 QUAD(_stext) /* default_lma */159159 QUAD(startup_continue) /* entry */160160 QUAD(__bss_start - _stext) /* image_size */161161 QUAD(__bss_stop - __bss_start) /* bss_size */162162 QUAD(__boot_data_start) /* bootdata_off */163163 QUAD(__boot_data_end - __boot_data_start) /* bootdata_size */164164- }164164+ } :NONE165165166166 /* Debugging sections. */167167 STABS_DEBUG
···525525 bool "ScaleMP vSMP"526526 select HYPERVISOR_GUEST527527 select PARAVIRT528528- select PARAVIRT_XXL529528 depends on X86_64 && PCI530529 depends on X86_EXTENDED_PLATFORM531530 depends on SMP
+1-3
arch/x86/Makefile
···213213KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000)214214endif215215216216-# Speed up the build217217-KBUILD_CFLAGS += -pipe218216# Workaround for a gcc prelease that unfortunately was shipped in a suse release219217KBUILD_CFLAGS += -Wno-sign-compare220218#···237239archmacros:238240 $(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s239241240240-ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,-242242+ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s241243export ASM_MACRO_FLAGS242244KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)243245
···33333434/*3535 * Set __PAGE_OFFSET to the most negative possible address +3636- * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a3737- * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's3838- * what Xen requires.3636+ * PGDIR_SIZE*17 (pgd slot 273).3737+ *3838+ * The gap is to allow a space for LDT remap for PTI (1 pgd slot) and space for3939+ * a hypervisor (16 slots). Choosing 16 slots for a hypervisor is arbitrary,4040+ * but it's what Xen requires.3941 */4040-#define __PAGE_OFFSET_BASE_L5 _AC(0xff10000000000000, UL)4141-#define __PAGE_OFFSET_BASE_L4 _AC(0xffff880000000000, UL)4242+#define __PAGE_OFFSET_BASE_L5 _AC(0xff11000000000000, UL)4343+#define __PAGE_OFFSET_BASE_L4 _AC(0xffff888000000000, UL)42444345#ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT4446#define __PAGE_OFFSET page_offset_base
···1313#define queued_fetch_set_pending_acquire queued_fetch_set_pending_acquire1414static __always_inline u32 queued_fetch_set_pending_acquire(struct qspinlock *lock)1515{1616- u32 val = 0;1616+ u32 val;17171818- if (GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c,1919- "I", _Q_PENDING_OFFSET))2020- val |= _Q_PENDING_VAL;2121-1818+ /*1919+ * We can't use GEN_BINARY_RMWcc() inside an if() stmt because asm goto2020+ * and CONFIG_PROFILE_ALL_BRANCHES=y results in a label inside a2121+ * statement expression, which GCC doesn't like.2222+ */2323+ val = GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c,2424+ "I", _Q_PENDING_OFFSET) * _Q_PENDING_VAL;2225 val |= atomic_read(&lock->val) & ~_Q_PENDING_MASK;23262427 return val;
+31-4
arch/x86/include/asm/xen/page.h
···99#include <linux/mm.h>1010#include <linux/device.h>11111212-#include <linux/uaccess.h>1212+#include <asm/extable.h>1313#include <asm/page.h>1414#include <asm/pgtable.h>1515···9393 */9494static inline int xen_safe_write_ulong(unsigned long *addr, unsigned long val)9595{9696- return __put_user(val, (unsigned long __user *)addr);9696+ int ret = 0;9797+9898+ asm volatile("1: mov %[val], %[ptr]\n"9999+ "2:\n"100100+ ".section .fixup, \"ax\"\n"101101+ "3: sub $1, %[ret]\n"102102+ " jmp 2b\n"103103+ ".previous\n"104104+ _ASM_EXTABLE(1b, 3b)105105+ : [ret] "+r" (ret), [ptr] "=m" (*addr)106106+ : [val] "r" (val));107107+108108+ return ret;97109}981109999-static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val)111111+static inline int xen_safe_read_ulong(const unsigned long *addr,112112+ unsigned long *val)100113{101101- return __get_user(*val, (unsigned long __user *)addr);114114+ int ret = 0;115115+ unsigned long rval = ~0ul;116116+117117+ asm volatile("1: mov %[ptr], %[rval]\n"118118+ "2:\n"119119+ ".section .fixup, \"ax\"\n"120120+ "3: sub $1, %[ret]\n"121121+ " jmp 2b\n"122122+ ".previous\n"123123+ _ASM_EXTABLE(1b, 3b)124124+ : [ret] "+r" (ret), [rval] "+r" (rval)125125+ : [ptr] "m" (*addr));126126+ *val = rval;127127+128128+ return ret;102129}103130104131#ifdef CONFIG_XEN_PV
+4-2
arch/x86/kernel/cpu/mcheck/mce.c
···485485 * be somewhat complicated (e.g. segment offset would require an instruction486486 * parser). So only support physical addresses up to page granuality for now.487487 */488488-static int mce_usable_address(struct mce *m)488488+int mce_usable_address(struct mce *m)489489{490490 if (!(m->status & MCI_STATUS_ADDRV))491491 return 0;···505505506506 return 1;507507}508508+EXPORT_SYMBOL_GPL(mce_usable_address);508509509510bool mce_is_memory_error(struct mce *m)510511{···535534}536535EXPORT_SYMBOL_GPL(mce_is_memory_error);537536538538-static bool mce_is_correctable(struct mce *m)537537+bool mce_is_correctable(struct mce *m)539538{540539 if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED)541540 return false;···548547549548 return true;550549}550550+EXPORT_SYMBOL_GPL(mce_is_correctable);551551552552static bool cec_add_mce(struct mce *m)553553{
+11
arch/x86/kernel/cpu/mshyperv.c
···2020#include <linux/interrupt.h>2121#include <linux/irq.h>2222#include <linux/kexec.h>2323+#include <linux/i8253.h>2324#include <asm/processor.h>2425#include <asm/hypervisor.h>2526#include <asm/hyperv-tlfs.h>···295294 */296295 if (efi_enabled(EFI_BOOT))297296 x86_platform.get_nmi_reason = hv_get_nmi_reason;297297+298298+ /*299299+ * Hyper-V VMs have a PIT emulation quirk such that zeroing the300300+ * counter register during PIT shutdown restarts the PIT. So it301301+ * continues to interrupt @18.2 HZ. Setting i8253_clear_counter302302+ * to false tells pit_shutdown() not to zero the counter so that303303+ * the PIT really is shutdown. Generation 2 VMs don't have a PIT,304304+ * and setting this value has no effect.305305+ */306306+ i8253_clear_counter_on_shutdown = false;298307299308#if IS_ENABLED(CONFIG_HYPERV)300309 /*
+1-1
arch/x86/kernel/cpu/vmware.c
···7777}7878early_param("no-vmw-sched-clock", setup_vmw_sched_clock);79798080-static unsigned long long vmware_sched_clock(void)8080+static unsigned long long notrace vmware_sched_clock(void)8181{8282 unsigned long long ns;8383
+38-21
arch/x86/kernel/ldt.c
···199199/*200200 * If PTI is enabled, this maps the LDT into the kernelmode and201201 * usermode tables for the given mm.202202- *203203- * There is no corresponding unmap function. Even if the LDT is freed, we204204- * leave the PTEs around until the slot is reused or the mm is destroyed.205205- * This is harmless: the LDT is always in ordinary memory, and no one will206206- * access the freed slot.207207- *208208- * If we wanted to unmap freed LDTs, we'd also need to do a flush to make209209- * it useful, and the flush would slow down modify_ldt().210202 */211203static int212204map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)···206214 unsigned long va;207215 bool is_vmalloc;208216 spinlock_t *ptl;209209- pgd_t *pgd;210210- int i;217217+ int i, nr_pages;211218212219 if (!static_cpu_has(X86_FEATURE_PTI))213220 return 0;···220229 /* Check if the current mappings are sane */221230 sanity_check_ldt_mapping(mm);222231223223- /*224224- * Did we already have the top level entry allocated? We can't225225- * use pgd_none() for this because it doens't do anything on226226- * 4-level page table kernels.227227- */228228- pgd = pgd_offset(mm, LDT_BASE_ADDR);229229-230232 is_vmalloc = is_vmalloc_addr(ldt->entries);231233232232- for (i = 0; i * PAGE_SIZE < ldt->nr_entries * LDT_ENTRY_SIZE; i++) {234234+ nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE);235235+236236+ for (i = 0; i < nr_pages; i++) {233237 unsigned long offset = i << PAGE_SHIFT;234238 const void *src = (char *)ldt->entries + offset;235239 unsigned long pfn;···258272 /* Propagate LDT mapping to the user page-table */259273 map_ldt_struct_to_user(mm);260274261261- va = (unsigned long)ldt_slot_va(slot);262262- flush_tlb_mm_range(mm, va, va + LDT_SLOT_STRIDE, PAGE_SHIFT, false);263263-264275 ldt->slot = slot;265276 return 0;277277+}278278+279279+static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)280280+{281281+ unsigned long va;282282+ int i, nr_pages;283283+284284+ if (!ldt)285285+ return;286286+287287+ /* LDT map/unmap is only required for PTI */288288+ if (!static_cpu_has(X86_FEATURE_PTI))289289+ return;290290+291291+ nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE);292292+293293+ for (i = 0; i < nr_pages; i++) {294294+ unsigned long offset = i << PAGE_SHIFT;295295+ spinlock_t *ptl;296296+ pte_t *ptep;297297+298298+ va = (unsigned long)ldt_slot_va(ldt->slot) + offset;299299+ ptep = get_locked_pte(mm, va, &ptl);300300+ pte_clear(mm, va, ptep);301301+ pte_unmap_unlock(ptep, ptl);302302+ }303303+304304+ va = (unsigned long)ldt_slot_va(ldt->slot);305305+ flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, PAGE_SHIFT, false);266306}267307268308#else /* !CONFIG_PAGE_TABLE_ISOLATION */···297285map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)298286{299287 return 0;288288+}289289+290290+static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)291291+{300292}301293#endif /* CONFIG_PAGE_TABLE_ISOLATION */302294···540524 }541525542526 install_ldt(mm, new_ldt);527527+ unmap_ldt_struct(mm, old_ldt);543528 free_ldt_struct(old_ldt);544529 error = 0;545530
+7-77
arch/x86/kernel/vsmp_64.c
···26262727#define TOPOLOGY_REGISTER_OFFSET 0x1028282929-#if defined CONFIG_PCI && defined CONFIG_PARAVIRT_XXL3030-/*3131- * Interrupt control on vSMPowered systems:3232- * ~AC is a shadow of IF. If IF is 'on' AC should be 'off'3333- * and vice versa.3434- */3535-3636-asmlinkage __visible unsigned long vsmp_save_fl(void)3737-{3838- unsigned long flags = native_save_fl();3939-4040- if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))4141- flags &= ~X86_EFLAGS_IF;4242- return flags;4343-}4444-PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);4545-4646-__visible void vsmp_restore_fl(unsigned long flags)4747-{4848- if (flags & X86_EFLAGS_IF)4949- flags &= ~X86_EFLAGS_AC;5050- else5151- flags |= X86_EFLAGS_AC;5252- native_restore_fl(flags);5353-}5454-PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);5555-5656-asmlinkage __visible void vsmp_irq_disable(void)5757-{5858- unsigned long flags = native_save_fl();5959-6060- native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);6161-}6262-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);6363-6464-asmlinkage __visible void vsmp_irq_enable(void)6565-{6666- unsigned long flags = native_save_fl();6767-6868- native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));6969-}7070-PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);7171-7272-static unsigned __init vsmp_patch(u8 type, void *ibuf,7373- unsigned long addr, unsigned len)7474-{7575- switch (type) {7676- case PARAVIRT_PATCH(irq.irq_enable):7777- case PARAVIRT_PATCH(irq.irq_disable):7878- case PARAVIRT_PATCH(irq.save_fl):7979- case PARAVIRT_PATCH(irq.restore_fl):8080- return paravirt_patch_default(type, ibuf, addr, len);8181- default:8282- return native_patch(type, ibuf, addr, len);8383- }8484-8585-}8686-8787-static void __init set_vsmp_pv_ops(void)2929+#ifdef CONFIG_PCI3030+static void __init set_vsmp_ctl(void)8831{8932 void __iomem *address;9033 unsigned int cap, ctl, cfg;···52109 }53110#endif541115555- if (cap & ctl & (1 << 4)) {5656- /* Setup irq ops and turn on vSMP IRQ fastpath handling */5757- pv_ops.irq.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable);5858- pv_ops.irq.irq_enable = PV_CALLEE_SAVE(vsmp_irq_enable);5959- pv_ops.irq.save_fl = PV_CALLEE_SAVE(vsmp_save_fl);6060- pv_ops.irq.restore_fl = PV_CALLEE_SAVE(vsmp_restore_fl);6161- pv_ops.init.patch = vsmp_patch;6262- ctl &= ~(1 << 4);6363- }64112 writel(ctl, address + 4);65113 ctl = readl(address + 4);66114 pr_info("vSMP CTL: control set to:0x%08x\n", ctl);6711568116 early_iounmap(address, 8);69117}7070-#else7171-static void __init set_vsmp_pv_ops(void)7272-{7373-}7474-#endif7575-7676-#ifdef CONFIG_PCI77118static int is_vsmp = -1;7811979120static void __init detect_vsmp_box(void)···91164{92165 return 0;93166}167167+static void __init set_vsmp_ctl(void)168168+{169169+}94170#endif9517196172static void __init vsmp_cap_cpus(void)97173{9898-#if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP)174174+#if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) && defined(CONFIG_PCI)99175 void __iomem *address;100176 unsigned int cfg, topology, node_shift, maxcpus;101177···151221152222 vsmp_cap_cpus();153223154154- set_vsmp_pv_ops();224224+ set_vsmp_ctl();155225 return;156226}
+3-3
arch/x86/xen/mmu_pv.c
···19051905 init_top_pgt[0] = __pgd(0);1906190619071907 /* Pre-constructed entries are in pfn, so convert to mfn */19081908- /* L4[272] -> level3_ident_pgt */19081908+ /* L4[273] -> level3_ident_pgt */19091909 /* L4[511] -> level3_kernel_pgt */19101910 convert_pfn_mfn(init_top_pgt);19111911···19251925 addr[0] = (unsigned long)pgd;19261926 addr[1] = (unsigned long)l3;19271927 addr[2] = (unsigned long)l2;19281928- /* Graft it onto L4[272][0]. Note that we creating an aliasing problem:19291929- * Both L4[272][0] and L4[511][510] have entries that point to the same19281928+ /* Graft it onto L4[273][0]. Note that we creating an aliasing problem:19291929+ * Both L4[273][0] and L4[511][510] have entries that point to the same19301930 * L2 (PMD) tables. Meaning that if you modify it in __va space19311931 * it will be also modified in the __ka space! (But if you just19321932 * modify the PMD table to point to other PTE's or none, then you
+1-2
arch/x86/xen/p2m.c
···656656657657 /*658658 * The interface requires atomic updates on p2m elements.659659- * xen_safe_write_ulong() is using __put_user which does an atomic660660- * store via asm().659659+ * xen_safe_write_ulong() is using an atomic store via asm().661660 */662661 if (likely(!xen_safe_write_ulong(xen_p2m_addr + pfn, mfn)))663662 return true;
+8-6
arch/x86/xen/spinlock.c
···99#include <linux/log2.h>1010#include <linux/gfp.h>1111#include <linux/slab.h>1212+#include <linux/atomic.h>12131314#include <asm/paravirt.h>1415#include <asm/qspinlock.h>···22212322static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;2423static DEFINE_PER_CPU(char *, irq_name);2424+static DEFINE_PER_CPU(atomic_t, xen_qlock_wait_nest);2525static bool xen_pvspin = true;26262727static void xen_qlock_kick(int cpu)···4139 */4240static void xen_qlock_wait(u8 *byte, u8 val)4341{4444- unsigned long flags;4542 int irq = __this_cpu_read(lock_kicker_irq);4343+ atomic_t *nest_cnt = this_cpu_ptr(&xen_qlock_wait_nest);46444745 /* If kicker interrupts not initialized yet, just spin */4846 if (irq == -1 || in_nmi())4947 return;50485151- /* Guard against reentry. */5252- local_irq_save(flags);4949+ /* Detect reentry. */5050+ atomic_inc(nest_cnt);53515454- /* If irq pending already clear it. */5555- if (xen_test_irq_pending(irq)) {5252+ /* If irq pending already and no nested call clear it. */5353+ if (atomic_read(nest_cnt) == 1 && xen_test_irq_pending(irq)) {5654 xen_clear_irq_pending(irq);5755 } else if (READ_ONCE(*byte) == val) {5856 /* Block until irq becomes pending (or a spurious wakeup) */5957 xen_poll_irq(irq);6058 }61596262- local_irq_restore(flags);6060+ atomic_dec(nest_cnt);6361}64626563static irqreturn_t dummy_handler(int irq, void *dev_id)
···5151 if ((sector | nr_sects) & bs_mask)5252 return -EINVAL;53535454+ if (!nr_sects)5555+ return -EINVAL;5656+5457 while (nr_sects) {5555- unsigned int req_sects = nr_sects;5656- sector_t end_sect;5757-5858- if (!req_sects)5959- goto fail;6060- if (req_sects > UINT_MAX >> 9)6161- req_sects = UINT_MAX >> 9;6262-6363- end_sect = sector + req_sects;5858+ unsigned int req_sects = min_t(unsigned int, nr_sects,5959+ bio_allowed_max_sectors(q));64606561 bio = blk_next_bio(bio, 0, gfp_mask);6662 bio->bi_iter.bi_sector = sector;···6468 bio_set_op_attrs(bio, op, 0);65696670 bio->bi_iter.bi_size = req_sects << 9;7171+ sector += req_sects;6772 nr_sects -= req_sects;6868- sector = end_sect;69737074 /*7175 * We can loop for a long time in here, if someone does···78827983 *biop = bio;8084 return 0;8181-8282-fail:8383- if (bio) {8484- submit_bio_wait(bio);8585- bio_put(bio);8686- }8787- *biop = NULL;8888- return -EOPNOTSUPP;8985}9086EXPORT_SYMBOL(__blkdev_issue_discard);9187···149161 return -EOPNOTSUPP;150162151163 /* Ensure that max_write_same_sectors doesn't overflow bi_size */152152- max_write_same_sectors = UINT_MAX >> 9;164164+ max_write_same_sectors = bio_allowed_max_sectors(q);153165154166 while (nr_sects) {155167 bio = blk_next_bio(bio, 1, gfp_mask);
+3-2
block/blk-merge.c
···4646 bio_get_first_bvec(prev_rq->bio, &pb);4747 else4848 bio_get_first_bvec(prev, &pb);4949- if (pb.bv_offset)4949+ if (pb.bv_offset & queue_virt_boundary(q))5050 return true;51515252 /*···9090 /* Zero-sector (unknown) and one-sector granularities are the same. */9191 granularity = max(q->limits.discard_granularity >> 9, 1U);92929393- max_discard_sectors = min(q->limits.max_discard_sectors, UINT_MAX >> 9);9393+ max_discard_sectors = min(q->limits.max_discard_sectors,9494+ bio_allowed_max_sectors(q));9495 max_discard_sectors -= max_discard_sectors % granularity;95969697 if (unlikely(!max_discard_sectors)) {
+11-1
block/blk.h
···169169static inline bool __bvec_gap_to_prev(struct request_queue *q,170170 struct bio_vec *bprv, unsigned int offset)171171{172172- return offset ||172172+ return (offset & queue_virt_boundary(q)) ||173173 ((bprv->bv_offset + bprv->bv_len) & queue_virt_boundary(q));174174}175175···393393static inline unsigned long blk_rq_deadline(struct request *rq)394394{395395 return rq->__deadline & ~0x1UL;396396+}397397+398398+/*399399+ * The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size400400+ * is defined as 'unsigned int', meantime it has to aligned to with logical401401+ * block size which is the minimum accepted unit by hardware.402402+ */403403+static inline unsigned int bio_allowed_max_sectors(struct request_queue *q)404404+{405405+ return round_down(UINT_MAX, queue_logical_block_size(q)) >> 9;396406}397407398408/*
+6-2
drivers/acpi/nfit/mce.c
···2525 struct acpi_nfit_desc *acpi_desc;2626 struct nfit_spa *nfit_spa;27272828- /* We only care about memory errors */2929- if (!mce_is_memory_error(mce))2828+ /* We only care about uncorrectable memory errors */2929+ if (!mce_is_memory_error(mce) || mce_is_correctable(mce))3030+ return NOTIFY_DONE;3131+3232+ /* Verify the address reported in the MCE is valid. */3333+ if (!mce_usable_address(mce))3034 return NOTIFY_DONE;31353236 /*
+1-5
drivers/ata/sata_rcar.c
···11+// SPDX-License-Identifier: GPL-2.0+12/*23 * Renesas R-Car SATA driver34 *45 * Author: Vladimir Barinov <source@cogentembedded.com>56 * Copyright (C) 2013-2015 Cogent Embedded, Inc.67 * Copyright (C) 2013-2015 Renesas Solutions Corp.77- *88- * This program is free software; you can redistribute it and/or modify it99- * under the terms of the GNU General Public License as published by the1010- * Free Software Foundation; either version 2 of the License, or (at your1111- * option) any later version.128 */1391410#include <linux/kernel.h>
···325325 .ops = &clk_regmap_gate_ops,326326 .parent_names = (const char *[]){ "fclk_div2_div" },327327 .num_parents = 1,328328+ .flags = CLK_IS_CRITICAL,328329 },329330};330331···350349 .ops = &clk_regmap_gate_ops,351350 .parent_names = (const char *[]){ "fclk_div3_div" },352351 .num_parents = 1,352352+ /*353353+ * FIXME:354354+ * This clock, as fdiv2, is used by the SCPI FW and is required355355+ * by the platform to operate correctly.356356+ * Until the following condition are met, we need this clock to357357+ * be marked as critical:358358+ * a) The SCPI generic driver claims and enable all the clocks359359+ * it needs360360+ * b) CCF has a clock hand-off mechanism to make the sure the361361+ * clock stays on until the proper driver comes along362362+ */363363+ .flags = CLK_IS_CRITICAL,353364 },354365};355366
+12
drivers/clk/meson/gxbb.c
···506506 .ops = &clk_regmap_gate_ops,507507 .parent_names = (const char *[]){ "fclk_div3_div" },508508 .num_parents = 1,509509+ /*510510+ * FIXME:511511+ * This clock, as fdiv2, is used by the SCPI FW and is required512512+ * by the platform to operate correctly.513513+ * Until the following condition are met, we need this clock to514514+ * be marked as critical:515515+ * a) The SCPI generic driver claims and enable all the clocks516516+ * it needs517517+ * b) CCF has a clock hand-off mechanism to make the sure the518518+ * clock stays on until the proper driver comes along519519+ */520520+ .flags = CLK_IS_CRITICAL,509521 },510522};511523
···2020DEFINE_RAW_SPINLOCK(i8253_lock);2121EXPORT_SYMBOL(i8253_lock);22222323+/*2424+ * Handle PIT quirk in pit_shutdown() where zeroing the counter register2525+ * restarts the PIT, negating the shutdown. On platforms with the quirk,2626+ * platform specific code can set this to false.2727+ */2828+bool i8253_clear_counter_on_shutdown __ro_after_init = true;2929+2330#ifdef CONFIG_CLKSRC_I82532431/*2532 * Since the PIT overflows every tick, its not very useful···116109 raw_spin_lock(&i8253_lock);117110118111 outb_p(0x30, PIT_MODE);119119- outb_p(0, PIT_CH0);120120- outb_p(0, PIT_CH0);112112+113113+ if (i8253_clear_counter_on_shutdown) {114114+ outb_p(0, PIT_CH0);115115+ outb_p(0, PIT_CH0);116116+ }121117122118 raw_spin_unlock(&i8253_lock);123119 return 0;
+1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
···151151extern int amdgpu_gpu_recovery;152152extern int amdgpu_emu_mode;153153extern uint amdgpu_smu_memory_pool_size;154154+extern uint amdgpu_dc_feature_mask;154155extern struct amdgpu_mgpu_info mgpu_info;155156156157#ifdef CONFIG_DRM_AMDGPU_SI
+11
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
···127127int amdgpu_gpu_recovery = -1; /* auto */128128int amdgpu_emu_mode = 0;129129uint amdgpu_smu_memory_pool_size = 0;130130+/* FBC (bit 0) disabled by default*/131131+uint amdgpu_dc_feature_mask = 0;132132+130133struct amdgpu_mgpu_info mgpu_info = {131134 .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex),132135};···633630module_param(halt_if_hws_hang, int, 0644);634631MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (default), 1 = on)");635632#endif633633+634634+/**635635+ * DOC: dcfeaturemask (uint)636636+ * Override display features enabled. See enum DC_FEATURE_MASK in drivers/gpu/drm/amd/include/amd_shared.h.637637+ * The default is the current set of stable display features.638638+ */639639+MODULE_PARM_DESC(dcfeaturemask, "all stable DC features enabled (default))");640640+module_param_named(dcfeaturemask, amdgpu_dc_feature_mask, uint, 0444);636641637642static const struct pci_device_id pciidlist[] = {638643#ifdef CONFIG_DRM_AMDGPU_SI
···17361736 if (events->force_trigger)17371737 value |= 0x1;1738173817391739- value |= 0x84;17391739+ if (num_pipes) {17401740+ struct dc *dc = pipe_ctx[0]->stream->ctx->dc;17411741+17421742+ if (dc->fbc_compressor)17431743+ value |= 0x84;17441744+ }1740174517411746 for (i = 0; i < num_pipes; i++)17421747 pipe_ctx[i]->stream_res.tg->funcs->
···105105#define PPSMC_MSG_SetSystemVirtualDramAddrHigh 0x4B106106#define PPSMC_MSG_SetSystemVirtualDramAddrLow 0x4C107107#define PPSMC_MSG_WaflTest 0x4D108108-// Unused ID 0x4E to 0x50108108+#define PPSMC_MSG_SetFclkGfxClkRatio 0x4E109109+// Unused ID 0x4F to 0x50109110#define PPSMC_MSG_AllowGfxOff 0x51110111#define PPSMC_MSG_DisallowGfxOff 0x52111112#define PPSMC_MSG_GetPptLimit 0x53
+1-1
drivers/gpu/drm/etnaviv/etnaviv_sched.c
···9393 * If the GPU managed to complete this jobs fence, the timout is9494 * spurious. Bail out.9595 */9696- if (fence_completed(gpu, submit->out_fence->seqno))9696+ if (dma_fence_is_signaled(submit->out_fence))9797 return;98989999 /*
···11751175 return -EINVAL;11761176 }1177117711781178- dram_info->valid_dimm = true;11791179-11801178 /*11811179 * If any of the channel is single rank channel, worst case output11821180 * will be same as if single rank memory, so consider single rank···11911193 return -EINVAL;11921194 }1193119511941194- if (ch0.is_16gb_dimm || ch1.is_16gb_dimm)11951195- dram_info->is_16gb_dimm = true;11961196+ dram_info->is_16gb_dimm = ch0.is_16gb_dimm || ch1.is_16gb_dimm;1196119711971198 dev_priv->dram_info.symmetric_memory = intel_is_dram_symmetric(val_ch0,11981199 val_ch1,···13111314 return -EINVAL;13121315 }1313131613141314- dram_info->valid_dimm = true;13151317 dram_info->valid = true;13161318 return 0;13171319}···13231327 int ret;1324132813251329 dram_info->valid = false;13261326- dram_info->valid_dimm = false;13271327- dram_info->is_16gb_dimm = false;13281330 dram_info->rank = I915_DRAM_RANK_INVALID;13291331 dram_info->bandwidth_kbps = 0;13301332 dram_info->num_channels = 0;13331333+13341334+ /*13351335+ * Assume 16Gb DIMMs are present until proven otherwise.13361336+ * This is only used for the level 0 watermark latency13371337+ * w/a which does not apply to bxt/glk.13381338+ */13391339+ dram_info->is_16gb_dimm = !IS_GEN9_LP(dev_priv);1331134013321341 if (INTEL_GEN(dev_priv) < 9 || IS_GEMINILAKE(dev_priv))13331342 return;
···460460 * any non-page-aligned or non-canonical addresses.461461 */462462 if (unlikely(entry->flags & EXEC_OBJECT_PINNED &&463463- entry->offset != gen8_canonical_addr(entry->offset & PAGE_MASK)))463463+ entry->offset != gen8_canonical_addr(entry->offset & I915_GTT_PAGE_MASK)))464464 return -EINVAL;465465466466 /* pad_to_size was once a reserved field, so sanitize it */
+1-1
drivers/gpu/drm/i915/i915_gem_gtt.c
···17571757 if (i == 4)17581758 continue;1759175917601760- seq_printf(m, "\t\t(%03d, %04d) %08lx: ",17601760+ seq_printf(m, "\t\t(%03d, %04d) %08llx: ",17611761 pde, pte,17621762 (pde * GEN6_PTES + pte) * I915_GTT_PAGE_SIZE);17631763 for (i = 0; i < 4; i++) {
···21382138static int intel_pixel_rate_to_cdclk(struct drm_i915_private *dev_priv,21392139 int pixel_rate)21402140{21412141- if (INTEL_GEN(dev_priv) >= 10)21412141+ if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))21422142 return DIV_ROUND_UP(pixel_rate, 2);21432143- else if (IS_GEMINILAKE(dev_priv))21442144- /*21452145- * FIXME: Avoid using a pixel clock that is more than 99% of the cdclk21462146- * as a temporary workaround. Use a higher cdclk instead. (Note that21472147- * intel_compute_max_dotclk() limits the max pixel clock to 99% of max21482148- * cdclk.)21492149- */21502150- return DIV_ROUND_UP(pixel_rate * 100, 2 * 99);21512143 else if (IS_GEN9(dev_priv) ||21522144 IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))21532145 return pixel_rate;···25352543{25362544 int max_cdclk_freq = dev_priv->max_cdclk_freq;2537254525382538- if (INTEL_GEN(dev_priv) >= 10)25462546+ if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))25392547 return 2 * max_cdclk_freq;25402540- else if (IS_GEMINILAKE(dev_priv))25412541- /*25422542- * FIXME: Limiting to 99% as a temporary workaround. See25432543- * intel_min_cdclk() for details.25442544- */25452545- return 2 * max_cdclk_freq * 99 / 100;25462548 else if (IS_GEN9(dev_priv) ||25472549 IS_BROADWELL(dev_priv) || IS_HASWELL(dev_priv))25482550 return max_cdclk_freq;
+7-12
drivers/gpu/drm/i915/intel_display.c
···1276812768 intel_check_cpu_fifo_underruns(dev_priv);1276912769 intel_check_pch_fifo_underruns(dev_priv);12770127701277112771- if (!new_crtc_state->active) {1277212772- /*1277312773- * Make sure we don't call initial_watermarks1277412774- * for ILK-style watermark updates.1277512775- *1277612776- * No clue what this is supposed to achieve.1277712777- */1277812778- if (INTEL_GEN(dev_priv) >= 9)1277912779- dev_priv->display.initial_watermarks(intel_state,1278012780- to_intel_crtc_state(new_crtc_state));1278112781- }1277112771+ /* FIXME unify this for all platforms */1277212772+ if (!new_crtc_state->active &&1277312773+ !HAS_GMCH_DISPLAY(dev_priv) &&1277412774+ dev_priv->display.initial_watermarks)1277512775+ dev_priv->display.initial_watermarks(intel_state,1277612776+ to_intel_crtc_state(new_crtc_state));1278212777 }1278312778 }1278412779···1464114646 fb->height < SKL_MIN_YUV_420_SRC_H ||1464214647 (fb->width % 4) != 0 || (fb->height % 4) != 0)) {1464314648 DRM_DEBUG_KMS("src dimensions not correct for NV12\n");1464414644- return -EINVAL;1464914649+ goto err;1464514650 }14646146511464714652 for (i = 0; i < fb->format->num_planes; i++) {
···28812881 * any underrun. If not able to get Dimm info assume 16GB dimm28822882 * to avoid any underrun.28832883 */28842884- if (!dev_priv->dram_info.valid_dimm ||28852885- dev_priv->dram_info.is_16gb_dimm)28842884+ if (dev_priv->dram_info.is_16gb_dimm)28862885 wm[0] += 1;2887288628882887 } else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
···75757676 DRM_DEBUG_DRIVER("Enabling LVDS output\n");77777878- if (!IS_ERR(tcon->panel)) {7878+ if (tcon->panel) {7979 drm_panel_prepare(tcon->panel);8080 drm_panel_enable(tcon->panel);8181 }···88888989 DRM_DEBUG_DRIVER("Disabling LVDS output\n");90909191- if (!IS_ERR(tcon->panel)) {9191+ if (tcon->panel) {9292 drm_panel_disable(tcon->panel);9393 drm_panel_unprepare(tcon->panel);9494 }
+2-2
drivers/gpu/drm/sun4i/sun4i_rgb.c
···135135136136 DRM_DEBUG_DRIVER("Enabling RGB output\n");137137138138- if (!IS_ERR(tcon->panel)) {138138+ if (tcon->panel) {139139 drm_panel_prepare(tcon->panel);140140 drm_panel_enable(tcon->panel);141141 }···148148149149 DRM_DEBUG_DRIVER("Disabling RGB output\n");150150151151- if (!IS_ERR(tcon->panel)) {151151+ if (tcon->panel) {152152 drm_panel_disable(tcon->panel);153153 drm_panel_unprepare(tcon->panel);154154 }
+3-2
drivers/gpu/drm/sun4i/sun4i_tcon.c
···491491 sun4i_tcon0_mode_set_common(tcon, mode);492492493493 /* Set dithering if needed */494494- sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);494494+ if (tcon->panel)495495+ sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);495496496497 /* Adjust clock delay */497498 clk_delay = sun4i_tcon_get_clk_delay(mode, 0);···556555 * Following code is a way to avoid quirks all around TCON557556 * and DOTCLOCK drivers.558557 */559559- if (!IS_ERR(tcon->panel)) {558558+ if (tcon->panel) {560559 struct drm_panel *panel = tcon->panel;561560 struct drm_connector *connector = panel->connector;562561 struct drm_display_info display_info = connector->display_info;
+3
drivers/gpu/vga/vga_switcheroo.c
···380380 mutex_unlock(&vgasr_mutex);381381 return -EINVAL;382382 }383383+ /* notify if GPU has been already bound */384384+ if (ops->gpu_bound)385385+ ops->gpu_bound(pdev, id);383386 }384387 mutex_unlock(&vgasr_mutex);385388
···224224 This driver can also be built as a module. If so, the module225225 will be called i2c-nforce2-s4985.226226227227+config I2C_NVIDIA_GPU228228+ tristate "NVIDIA GPU I2C controller"229229+ depends on PCI230230+ help231231+ If you say yes to this option, support will be included for the232232+ NVIDIA GPU I2C controller which is used to communicate with the GPU's233233+ Type-C controller. This driver can also be built as a module called234234+ i2c-nvidia-gpu.235235+227236config I2C_SIS5595228237 tristate "SiS 5595"229238 depends on PCI···761752762753config I2C_OMAP763754 tristate "OMAP I2C adapter"764764- depends on ARCH_OMAP755755+ depends on ARCH_OMAP || ARCH_K3765756 default y if MACH_OMAP_H3 || MACH_OMAP_OSK766757 help767758 If you say yes to this option, support will be included for the
···204204205205 int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);206206207207+ int (*hw_set_offload)(struct aq_hw_s *self,208208+ struct aq_nic_cfg_s *aq_nic_cfg);209209+210210+ int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc);207211};208212209213struct aq_fw_ops {···229225 int (*update_link_status)(struct aq_hw_s *self);230226231227 int (*update_stats)(struct aq_hw_s *self);228228+229229+ u32 (*get_flow_control)(struct aq_hw_s *self, u32 *fcmode);232230233231 int (*set_flow_control)(struct aq_hw_s *self);234232
+8-2
drivers/net/ethernet/aquantia/atlantic/aq_main.c
···9999 struct aq_nic_s *aq_nic = netdev_priv(ndev);100100 struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic);101101 bool is_lro = false;102102+ int err = 0;102103103103- if (aq_cfg->hw_features & NETIF_F_LRO) {104104+ aq_cfg->features = features;105105+106106+ if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) {104107 is_lro = features & NETIF_F_LRO;105108106109 if (aq_cfg->is_lro != is_lro) {···115112 }116113 }117114 }115115+ if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM)116116+ err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw,117117+ aq_cfg);118118119119- return 0;119119+ return err;120120}121121122122static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr)
+15-3
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
···118118 }119119120120 cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;121121- cfg->hw_features = cfg->aq_hw_caps->hw_features;121121+ cfg->features = cfg->aq_hw_caps->hw_features;122122}123123124124static int aq_nic_update_link_status(struct aq_nic_s *self)125125{126126 int err = self->aq_fw_ops->update_link_status(self->aq_hw);127127+ u32 fc = 0;127128128129 if (err)129130 return err;···134133 AQ_CFG_DRV_NAME, self->link_status.mbps,135134 self->aq_hw->aq_link_status.mbps);136135 aq_nic_update_interrupt_moderation_settings(self);136136+137137+ /* Driver has to update flow control settings on RX block138138+ * on any link event.139139+ * We should query FW whether it negotiated FC.140140+ */141141+ if (self->aq_fw_ops->get_flow_control)142142+ self->aq_fw_ops->get_flow_control(self->aq_hw, &fc);143143+ if (self->aq_hw_ops->hw_set_fc)144144+ self->aq_hw_ops->hw_set_fc(self->aq_hw, fc, 0);137145 }138146139147 self->link_status = self->aq_hw->aq_link_status;···600590 }601591 }602592603603- if (i > 0 && i < AQ_HW_MULTICAST_ADDRESS_MAX) {593593+ if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) {604594 packet_filter |= IFF_MULTICAST;605595 self->mc_list.count = i;606596 self->aq_hw_ops->hw_multicast_list_set(self->aq_hw,···782772 ethtool_link_ksettings_add_link_mode(cmd, advertising,783773 Pause);784774785785- if (self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX)775775+ /* Asym is when either RX or TX, but not both */776776+ if (!!(self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX) ^777777+ !!(self->aq_nic_cfg.flow_control & AQ_NIC_FC_RX))786778 ethtool_link_ksettings_add_link_mode(cmd, advertising,787779 Asym_Pause);788780
···38383838 /* Hardware table is only clear when pf resets */38393839 if (!(handle->flags & HNAE3_SUPPORT_VF)) {38403840 ret = hns3_restore_vlan(netdev);38413841- return ret;38413841+ if (ret)38423842+ return ret;38423843 }3843384438443845 ret = hns3_restore_fd_rules(netdev);
···811811 /* Attempt to disable FW logging before shutting down control queues */812812 ice_cfg_fw_log(hw, false);813813 ice_shutdown_all_ctrlq(hw);814814+815815+ /* Clear VSI contexts if not already cleared */816816+ ice_clear_all_vsi_ctx(hw);814817}815818816819/**
+6-1
drivers/net/ethernet/intel/ice/ice_ethtool.c
···15171517 }1518151815191519 if (!test_bit(__ICE_DOWN, pf->state)) {15201520- /* Give it a little more time to try to come back */15201520+ /* Give it a little more time to try to come back. If still15211521+ * down, restart autoneg link or reinitialize the interface.15221522+ */15211523 msleep(75);15221524 if (!test_bit(__ICE_DOWN, pf->state))15231525 return ice_nway_reset(netdev);15261526+15271527+ ice_down(vsi);15281528+ ice_up(vsi);15241529 }1525153015261531 return err;
···19971997 status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL);19981998 if (status) {19991999 netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n",20002000- ena ? "Ena" : "Dis", vsi->idx, vsi->vsi_num, status,20002000+ ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status,20012001 vsi->back->hw.adminq.sq_last_status);20022002 goto err_out;20032003 }···24582458 * on this wq24592459 */24602460 if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) {24612461+ ice_napi_del(vsi);24612462 unregister_netdev(vsi->netdev);24622463 free_netdev(vsi->netdev);24632464 vsi->netdev = NULL;
+48-38
drivers/net/ethernet/intel/ice/ice_main.c
···14651465 * ice_napi_del - Remove NAPI handler for the VSI14661466 * @vsi: VSI for which NAPI handler is to be removed14671467 */14681468-static void ice_napi_del(struct ice_vsi *vsi)14681468+void ice_napi_del(struct ice_vsi *vsi)14691469{14701470 int v_idx;14711471···16221622{16231623 struct ice_netdev_priv *np = netdev_priv(netdev);16241624 struct ice_vsi *vsi = np->vsi;16251625- int ret;1626162516271626 if (vid >= VLAN_N_VID) {16281627 netdev_err(netdev, "VLAN id requested %d is out of range %d\n",···1634163516351636 /* Enable VLAN pruning when VLAN 0 is added */16361637 if (unlikely(!vid)) {16371637- ret = ice_cfg_vlan_pruning(vsi, true);16381638+ int ret = ice_cfg_vlan_pruning(vsi, true);16391639+16381640 if (ret)16391641 return ret;16401642 }···16441644 * needed to continue allowing all untagged packets since VLAN prune16451645 * list is applied to all packets by the switch16461646 */16471647- ret = ice_vsi_add_vlan(vsi, vid);16481648-16491649- if (!ret)16501650- set_bit(vid, vsi->active_vlans);16511651-16521652- return ret;16471647+ return ice_vsi_add_vlan(vsi, vid);16531648}1654164916551650/**···16711676 status = ice_vsi_kill_vlan(vsi, vid);16721677 if (status)16731678 return status;16741674-16751675- clear_bit(vid, vsi->active_vlans);1676167916771680 /* Disable VLAN pruning when VLAN 0 is removed */16781681 if (unlikely(!vid))···19952002}1996200319972004/**20052005+ * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines20062006+ * @pf: pointer to the PF structure20072007+ *20082008+ * There is no error returned here because the driver should be able to handle20092009+ * 128 Byte cache lines, so we only print a warning in case issues are seen,20102010+ * specifically with Tx.20112011+ */20122012+static void ice_verify_cacheline_size(struct ice_pf *pf)20132013+{20142014+ if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M)20152015+ dev_warn(&pf->pdev->dev,20162016+ "%d Byte cache line assumption is invalid, driver may have Tx timeouts!\n",20172017+ ICE_CACHE_LINE_BYTES);20182018+}20192019+20202020+/**19982021 * ice_probe - Device initialization routine19992022 * @pdev: PCI device information struct20002023 * @ent: entry in ice_pci_tbl···21602151 /* since everything is good, start the service timer */21612152 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period));2162215321542154+ ice_verify_cacheline_size(pf);21552155+21632156 return 0;2164215721652158err_alloc_sw_unroll:···2192218121932182 if (!pf)21942183 return;21842184+21852185+ for (i = 0; i < ICE_MAX_RESET_WAIT; i++) {21862186+ if (!ice_is_reset_in_progress(pf->state))21872187+ break;21882188+ msleep(100);21892189+ }2195219021962191 set_bit(__ICE_DOWN, pf->state);21972192 ice_service_task_stop(pf);···25272510}2528251125292512/**25302530- * ice_restore_vlan - Reinstate VLANs when vsi/netdev comes back up25312531- * @vsi: the VSI being brought back up25322532- */25332533-static int ice_restore_vlan(struct ice_vsi *vsi)25342534-{25352535- int err;25362536- u16 vid;25372537-25382538- if (!vsi->netdev)25392539- return -EINVAL;25402540-25412541- err = ice_vsi_vlan_setup(vsi);25422542- if (err)25432543- return err;25442544-25452545- for_each_set_bit(vid, vsi->active_vlans, VLAN_N_VID) {25462546- err = ice_vlan_rx_add_vid(vsi->netdev, htons(ETH_P_8021Q), vid);25472547- if (err)25482548- break;25492549- }25502550-25512551- return err;25522552-}25532553-25542554-/**25552513 * ice_vsi_cfg - Setup the VSI25562514 * @vsi: the VSI being configured25572515 *···2538254625392547 if (vsi->netdev) {25402548 ice_set_rx_mode(vsi->netdev);25412541- err = ice_restore_vlan(vsi);25492549+25502550+ err = ice_vsi_vlan_setup(vsi);25512551+25422552 if (err)25432553 return err;25442554 }···32903296 struct device *dev = &pf->pdev->dev;32913297 struct ice_hw *hw = &pf->hw;32923298 enum ice_status ret;32933293- int err;32993299+ int err, i;3294330032953301 if (test_bit(__ICE_DOWN, pf->state))32963302 goto clear_recovery;···33643370 }3365337133663372 ice_reset_all_vfs(pf, true);33733373+33743374+ for (i = 0; i < pf->num_alloc_vsi; i++) {33753375+ bool link_up;33763376+33773377+ if (!pf->vsi[i] || pf->vsi[i]->type != ICE_VSI_PF)33783378+ continue;33793379+ ice_get_link_status(pf->vsi[i]->port_info, &link_up);33803380+ if (link_up) {33813381+ netif_carrier_on(pf->vsi[i]->netdev);33823382+ netif_tx_wake_all_queues(pf->vsi[i]->netdev);33833383+ } else {33843384+ netif_carrier_off(pf->vsi[i]->netdev);33853385+ netif_tx_stop_all_queues(pf->vsi[i]->netdev);33863386+ }33873387+ }33883388+33673389 /* if we get here, reset flow is successful */33683390 clear_bit(__ICE_RESET_FAILED, pf->state);33693391 return;
+12
drivers/net/ethernet/intel/ice/ice_switch.c
···348348}349349350350/**351351+ * ice_clear_all_vsi_ctx - clear all the VSI context entries352352+ * @hw: pointer to the hw struct353353+ */354354+void ice_clear_all_vsi_ctx(struct ice_hw *hw)355355+{356356+ u16 i;357357+358358+ for (i = 0; i < ICE_MAX_VSI; i++)359359+ ice_clear_vsi_ctx(hw, i);360360+}361361+362362+/**351363 * ice_add_vsi - add VSI context to the hardware and VSI handle list352364 * @hw: pointer to the hw struct353365 * @vsi_handle: unique VSI handle provided by drivers
···1520152015211521 /* update gso_segs and bytecount */15221522 first->gso_segs = skb_shinfo(skb)->gso_segs;15231523- first->bytecount = (first->gso_segs - 1) * off->header_len;15231523+ first->bytecount += (first->gso_segs - 1) * off->header_len;1524152415251525 cd_tso_len = skb->len - off->header_len;15261526 cd_mss = skb_shinfo(skb)->gso_size;···15561556 * magnitude greater than our largest possible GSO size.15571557 *15581558 * This would then be implemented as:15591559- * return (((size >> 12) * 85) >> 8) + 1;15591559+ * return (((size >> 12) * 85) >> 8) + ICE_DESCS_FOR_SKB_DATA_PTR;15601560 *15611561 * Since multiplication and division are commutative, we can reorder15621562 * operations into:15631563- * return ((size * 85) >> 20) + 1;15631563+ * return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR;15641564 */15651565static unsigned int ice_txd_use_count(unsigned int size)15661566{15671567- return ((size * 85) >> 20) + 1;15671567+ return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR;15681568}1569156915701570/**···17061706 * + 1 desc for context descriptor,17071707 * otherwise try next time17081708 */17091709- if (ice_maybe_stop_tx(tx_ring, count + 4 + 1)) {17091709+ if (ice_maybe_stop_tx(tx_ring, count + ICE_DESCS_PER_CACHE_LINE +17101710+ ICE_DESCS_FOR_CTX_DESC)) {17101711 tx_ring->tx_stats.tx_busy++;17111712 return NETDEV_TX_BUSY;17121713 }
+15-2
drivers/net/ethernet/intel/ice/ice_txrx.h
···2222#define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */2323#define ICE_MAX_TXQ_PER_TXQG 12824242525-/* Tx Descriptors needed, worst case */2626-#define DESC_NEEDED (MAX_SKB_FRAGS + 4)2525+/* We are assuming that the cache line is always 64 Bytes here for ice.2626+ * In order to make sure that is a correct assumption there is a check in probe2727+ * to print a warning if the read from GLPCI_CNF2 tells us that the cache line2828+ * size is 128 bytes. We do it this way because we do not want to read the2929+ * GLPCI_CNF2 register or a variable containing the value on every pass through3030+ * the Tx path.3131+ */3232+#define ICE_CACHE_LINE_BYTES 643333+#define ICE_DESCS_PER_CACHE_LINE (ICE_CACHE_LINE_BYTES / \3434+ sizeof(struct ice_tx_desc))3535+#define ICE_DESCS_FOR_CTX_DESC 13636+#define ICE_DESCS_FOR_SKB_DATA_PTR 13737+/* Tx descriptors needed, worst case */3838+#define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \3939+ ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR)2740#define ICE_DESC_UNUSED(R) \2841 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \2942 (R)->next_to_clean - (R)->next_to_use - 1)
+1-1
drivers/net/ethernet/intel/ice/ice_type.h
···9292 u64 phy_type_low;9393 u16 max_frame_size;9494 u16 link_speed;9595+ u16 req_speeds;9596 u8 lse_ena; /* Link Status Event notification */9697 u8 link_info;9798 u8 an_info;9899 u8 ext_info;99100 u8 pacing;100100- u8 req_speeds;101101 /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of102102 * ice_aqc_get_phy_caps structure103103 */
+1-3
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
···348348 struct ice_vsi_ctx ctxt = { 0 };349349 enum ice_status status;350350351351- ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_TAGGED |351351+ ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_UNTAGGED |352352 ICE_AQ_VSI_PVLAN_INSERT_PVID |353353 ICE_AQ_VSI_VLAN_EMOD_STR;354354 ctxt.info.pvid = cpu_to_le16(vid);···2171217121722172 if (!ice_vsi_add_vlan(vsi, vid)) {21732173 vf->num_vlan++;21742174- set_bit(vid, vsi->active_vlans);2175217421762175 /* Enable VLAN pruning when VLAN 0 is added */21772176 if (unlikely(!vid))···21892190 */21902191 if (!ice_vsi_kill_vlan(vsi, vid)) {21912192 vf->num_vlan--;21922192- clear_bit(vid, vsi->active_vlans);2193219321942194 /* Disable VLAN pruning when removing VLAN 0 */21952195 if (unlikely(!vid))
+7-5
drivers/net/ethernet/intel/igb/igb_ptp.c
···5353 * 2^40 * 10^-9 / 60 = 18.3 minutes.5454 *5555 * SYSTIM is converted to real time using a timecounter. As5656- * timecounter_cyc2time() allows old timestamps, the timecounter5757- * needs to be updated at least once per half of the SYSTIM interval.5858- * Scheduling of delayed work is not very accurate, so we aim for 85959- * minutes to be sure the actual interval is shorter than 9.16 minutes.5656+ * timecounter_cyc2time() allows old timestamps, the timecounter needs5757+ * to be updated at least once per half of the SYSTIM interval.5858+ * Scheduling of delayed work is not very accurate, and also the NIC5959+ * clock can be adjusted to run up to 6% faster and the system clock6060+ * up to 10% slower, so we aim for 6 minutes to be sure the actual6161+ * interval in the NIC time is shorter than 9.16 minutes.6062 */61636262-#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 8)6464+#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 6)6365#define IGB_PTP_TX_TIMEOUT (HZ * 15)6466#define INCPERIOD_82576 BIT(E1000_TIMINCA_16NS_SHIFT)6567#define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
+2-2
drivers/net/ethernet/marvell/mvneta.c
···494494#if defined(__LITTLE_ENDIAN)495495struct mvneta_tx_desc {496496 u32 command; /* Options used by HW for packet transmitting.*/497497- u16 reserverd1; /* csum_l4 (for future use) */497497+ u16 reserved1; /* csum_l4 (for future use) */498498 u16 data_size; /* Data size of transmitted packet in bytes */499499 u32 buf_phys_addr; /* Physical addr of transmitted buffer */500500 u32 reserved2; /* hw_cmd - (for future use, PMT) */···519519#else520520struct mvneta_tx_desc {521521 u16 data_size; /* Data size of transmitted packet in bytes */522522- u16 reserverd1; /* csum_l4 (for future use) */522522+ u16 reserved1; /* csum_l4 (for future use) */523523 u32 command; /* Options used by HW for packet transmitting.*/524524 u32 reserved2; /* hw_cmd - (for future use, PMT) */525525 u32 buf_phys_addr; /* Physical addr of transmitted buffer */
···167167 enum spq_mode comp_mode;168168 struct qed_spq_comp_cb comp_cb;169169 struct qed_spq_comp_done comp_done; /* SPQ_MODE_EBLOCK */170170+171171+ /* Posted entry for unlimited list entry in EBLOCK mode */172172+ struct qed_spq_entry *post_ent;170173};171174172175struct qed_eq {···398395 enum spq_mode comp_mode;399396 struct qed_spq_comp_cb *p_comp_data;400397};398398+399399+/**400400+ * @brief Returns a SPQ entry to the pool / frees the entry if allocated.401401+ * Should be called on in error flows after initializing the SPQ entry402402+ * and before posting it.403403+ *404404+ * @param p_hwfn405405+ * @param p_ent406406+ */407407+void qed_sp_destroy_request(struct qed_hwfn *p_hwfn,408408+ struct qed_spq_entry *p_ent);401409402410int qed_sp_init_request(struct qed_hwfn *p_hwfn,403411 struct qed_spq_entry **pp_ent,
+20-2
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
···4747#include "qed_sp.h"4848#include "qed_sriov.h"49495050+void qed_sp_destroy_request(struct qed_hwfn *p_hwfn,5151+ struct qed_spq_entry *p_ent)5252+{5353+ /* qed_spq_get_entry() can either get an entry from the free_pool,5454+ * or, if no entries are left, allocate a new entry and add it to5555+ * the unlimited_pending list.5656+ */5757+ if (p_ent->queue == &p_hwfn->p_spq->unlimited_pending)5858+ kfree(p_ent);5959+ else6060+ qed_spq_return_entry(p_hwfn, p_ent);6161+}6262+5063int qed_sp_init_request(struct qed_hwfn *p_hwfn,5164 struct qed_spq_entry **pp_ent,5265 u8 cmd, u8 protocol, struct qed_sp_init_data *p_data)···93809481 case QED_SPQ_MODE_BLOCK:9582 if (!p_data->p_comp_data)9696- return -EINVAL;8383+ goto err;97849885 p_ent->comp_cb.cookie = p_data->p_comp_data->cookie;9986 break;···10895 default:10996 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n",11097 p_ent->comp_mode);111111- return -EINVAL;9898+ goto err;11299 }113100114101 DP_VERBOSE(p_hwfn, QED_MSG_SPQ,···122109 memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod));123110124111 return 0;112112+113113+err:114114+ qed_sp_destroy_request(p_hwfn, p_ent);115115+116116+ return -EINVAL;125117}126118127119static enum tunnel_clss qed_tunn_clss_to_fw_clss(u8 type)
+35-34
drivers/net/ethernet/qlogic/qed/qed_spq.c
···142142143143 DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n");144144 rc = qed_mcp_drain(p_hwfn, p_ptt);145145+ qed_ptt_release(p_hwfn, p_ptt);145146 if (rc) {146147 DP_NOTICE(p_hwfn, "MCP drain failed\n");147148 goto err;···151150 /* Retry after drain */152151 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true);153152 if (!rc)154154- goto out;153153+ return 0;155154156155 comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie;157157- if (comp_done->done == 1)156156+ if (comp_done->done == 1) {158157 if (p_fw_ret)159158 *p_fw_ret = comp_done->fw_return_code;160160-out:161161- qed_ptt_release(p_hwfn, p_ptt);162162- return 0;163163-159159+ return 0;160160+ }164161err:165165- qed_ptt_release(p_hwfn, p_ptt);166162 DP_NOTICE(p_hwfn,167163 "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n",168164 le32_to_cpu(p_ent->elem.hdr.cid),···683685 /* EBLOCK responsible to free the allocated p_ent */684686 if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK)685687 kfree(p_ent);688688+ else689689+ p_ent->post_ent = p_en2;686690687691 p_ent = p_en2;688692 }···767767 SPQ_HIGH_PRI_RESERVE_DEFAULT);768768}769769770770+/* Avoid overriding of SPQ entries when getting out-of-order completions, by771771+ * marking the completions in a bitmap and increasing the chain consumer only772772+ * for the first successive completed entries.773773+ */774774+static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo)775775+{776776+ u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE;777777+ struct qed_spq *p_spq = p_hwfn->p_spq;778778+779779+ __set_bit(pos, p_spq->p_comp_bitmap);780780+ while (test_bit(p_spq->comp_bitmap_idx,781781+ p_spq->p_comp_bitmap)) {782782+ __clear_bit(p_spq->comp_bitmap_idx,783783+ p_spq->p_comp_bitmap);784784+ p_spq->comp_bitmap_idx++;785785+ qed_chain_return_produced(&p_spq->chain);786786+ }787787+}788788+770789int qed_spq_post(struct qed_hwfn *p_hwfn,771790 struct qed_spq_entry *p_ent, u8 *fw_return_code)772791{···843824 p_ent->queue == &p_spq->unlimited_pending);844825845826 if (p_ent->queue == &p_spq->unlimited_pending) {846846- /* This is an allocated p_ent which does not need to847847- * return to pool.848848- */827827+ struct qed_spq_entry *p_post_ent = p_ent->post_ent;828828+849829 kfree(p_ent);850850- return rc;830830+831831+ /* Return the entry which was actually posted */832832+ p_ent = p_post_ent;851833 }852834853835 if (rc)···862842spq_post_fail2:863843 spin_lock_bh(&p_spq->lock);864844 list_del(&p_ent->list);865865- qed_chain_return_produced(&p_spq->chain);845845+ qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo);866846867847spq_post_fail:868848 /* return to the free pool */···894874 spin_lock_bh(&p_spq->lock);895875 list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) {896876 if (p_ent->elem.hdr.echo == echo) {897897- u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE;898898-899877 list_del(&p_ent->list);900900-901901- /* Avoid overriding of SPQ entries when getting902902- * out-of-order completions, by marking the completions903903- * in a bitmap and increasing the chain consumer only904904- * for the first successive completed entries.905905- */906906- __set_bit(pos, p_spq->p_comp_bitmap);907907-908908- while (test_bit(p_spq->comp_bitmap_idx,909909- p_spq->p_comp_bitmap)) {910910- __clear_bit(p_spq->comp_bitmap_idx,911911- p_spq->p_comp_bitmap);912912- p_spq->comp_bitmap_idx++;913913- qed_chain_return_produced(&p_spq->chain);914914- }915915-878878+ qed_spq_comp_bmap_update(p_hwfn, echo);916879 p_spq->comp_count++;917880 found = p_ent;918881 break;···934931 QED_MSG_SPQ,935932 "Got a completion without a callback function\n");936933937937- if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) ||938938- (found->queue == &p_spq->unlimited_pending))934934+ if (found->comp_mode != QED_SPQ_MODE_EBLOCK)939935 /* EBLOCK is responsible for returning its own entry into the940940- * free list, unless it originally added the entry into the941941- * unlimited pending list.936936+ * free list.942937 */943938 qed_spq_return_entry(p_hwfn, found);944939
···262262 int mode, int end)263263{264264 p->des0 |= cpu_to_le32(RDES0_OWN);265265- p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK);265265+ p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK);266266267267 if (mode == STMMAC_CHAIN_MODE)268268 ehn_desc_rx_set_on_chain(p);
+1-1
drivers/net/ethernet/stmicro/stmmac/ring_mode.c
···140140static int set_16kib_bfsize(int mtu)141141{142142 int ret = 0;143143- if (unlikely(mtu >= BUF_SIZE_8KiB))143143+ if (unlikely(mtu > BUF_SIZE_8KiB))144144 ret = BUF_SIZE_16KiB;145145 return ret;146146}
+4-3
drivers/net/fddi/defza.c
···11-// SPDX-License-Identifier: GPL-2.011+// SPDX-License-Identifier: GPL-2.0+22/* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices.33 *44 * Copyright (c) 2018 Maciej W. Rozycki···5656#define DRV_VERSION "v.1.1.4"5757#define DRV_RELDATE "Oct 6 2018"58585959-static char version[] =5959+static const char version[] =6060 DRV_NAME ": " DRV_VERSION " " DRV_RELDATE " Maciej W. Rozycki\n";61616262MODULE_AUTHOR("Maciej W. Rozycki <macro@linux-mips.org>");···784784static void fza_tx_smt(struct net_device *dev)785785{786786 struct fza_private *fp = netdev_priv(dev);787787- struct fza_buffer_tx __iomem *smt_tx_ptr, *skb_data_ptr;787787+ struct fza_buffer_tx __iomem *smt_tx_ptr;788788 int i, len;789789 u32 own;790790···799799800800 if (!netif_queue_stopped(dev)) {801801 if (dev_nit_active(dev)) {802802+ struct fza_buffer_tx *skb_data_ptr;802803 struct sk_buff *skb;803804804805 /* Length must be a multiple of 4 as only word
+2-1
drivers/net/fddi/defza.h
···11-/* SPDX-License-Identifier: GPL-2.0 */11+/* SPDX-License-Identifier: GPL-2.0+ */22/* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices.33 *44 * Copyright (c) 2018 Maciej W. Rozycki···235235#define FZA_RING_CMD 0x200400 /* command ring address */236236#define FZA_RING_CMD_SIZE 0x40 /* command descriptor ring237237 * size238238+ */238239/* Command constants. */239240#define FZA_RING_CMD_MASK 0x7fffffff240241#define FZA_RING_CMD_NOP 0x00000000 /* nop */
+16-2
drivers/net/phy/broadcom.c
···9292 return 0;9393}94949595-static int bcm5481x_config(struct phy_device *phydev)9595+static int bcm54xx_config_clock_delay(struct phy_device *phydev)9696{9797 int rc, val;9898···429429 ret = genphy_config_aneg(phydev);430430431431 /* Then we can set up the delay. */432432- bcm5481x_config(phydev);432432+ bcm54xx_config_clock_delay(phydev);433433434434 if (of_property_read_bool(np, "enet-phy-lane-swap")) {435435 /* Lane Swap - Undocumented register...magic! */···438438 if (ret < 0)439439 return ret;440440 }441441+442442+ return ret;443443+}444444+445445+static int bcm54616s_config_aneg(struct phy_device *phydev)446446+{447447+ int ret;448448+449449+ /* Aneg firsly. */450450+ ret = genphy_config_aneg(phydev);451451+452452+ /* Then we can set up the delay. */453453+ bcm54xx_config_clock_delay(phydev);441454442455 return ret;443456}···643630 .name = "Broadcom BCM54616S",644631 .features = PHY_GBIT_FEATURES,645632 .config_init = bcm54xx_config_init,633633+ .config_aneg = bcm54616s_config_aneg,646634 .ack_interrupt = bcm_phy_ack_intr,647635 .config_intr = bcm_phy_config_intr,648636}, {
···15191519 if (ns->ndev)15201520 nvme_nvm_update_nvm_info(ns);15211521#ifdef CONFIG_NVME_MULTIPATH15221522- if (ns->head->disk)15221522+ if (ns->head->disk) {15231523 nvme_update_disk_info(ns->head->disk, ns, id);15241524+ blk_queue_stack_limits(ns->head->disk->queue, ns->queue);15251525+ }15241526#endif15251527}15261528
+1
drivers/nvme/host/multipath.c
···285285 blk_queue_flag_set(QUEUE_FLAG_NONROT, q);286286 /* set to a default value for 512 until disk is validated */287287 blk_queue_logical_block_size(q, 512);288288+ blk_set_stacking_limits(&q->limits);288289289290 /* we need to propagate up the VMC settings */290291 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
+1-1
drivers/nvme/target/core.c
···420420 struct pci_dev *p2p_dev;421421 int ret;422422423423- if (!ctrl->p2p_client)423423+ if (!ctrl->p2p_client || !ns->use_p2pmem)424424 return;425425426426 if (ns->p2p_dev) {
+4-15
drivers/nvme/target/rdma.c
···122122 int inline_page_count;123123};124124125125-static struct workqueue_struct *nvmet_rdma_delete_wq;126125static bool nvmet_rdma_use_srq;127126module_param_named(use_srq, nvmet_rdma_use_srq, bool, 0444);128127MODULE_PARM_DESC(use_srq, "Use shared receive queue.");···1273127412741275 if (queue->host_qid == 0) {12751276 /* Let inflight controller teardown complete */12761276- flush_workqueue(nvmet_rdma_delete_wq);12771277+ flush_scheduled_work();12771278 }1278127912791280 ret = nvmet_rdma_cm_accept(cm_id, queue, &event->param.conn);12801281 if (ret) {12811281- queue_work(nvmet_rdma_delete_wq, &queue->release_work);12821282+ schedule_work(&queue->release_work);12821283 /* Destroying rdma_cm id is not needed here */12831284 return 0;12841285 }···1343134413441345 if (disconnect) {13451346 rdma_disconnect(queue->cm_id);13461346- queue_work(nvmet_rdma_delete_wq, &queue->release_work);13471347+ schedule_work(&queue->release_work);13471348 }13481349}13491350···13731374 mutex_unlock(&nvmet_rdma_queue_mutex);1374137513751376 pr_err("failed to connect queue %d\n", queue->idx);13761376- queue_work(nvmet_rdma_delete_wq, &queue->release_work);13771377+ schedule_work(&queue->release_work);13771378}1378137913791380/**···16551656 if (ret)16561657 goto err_ib_client;1657165816581658- nvmet_rdma_delete_wq = alloc_workqueue("nvmet-rdma-delete-wq",16591659- WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);16601660- if (!nvmet_rdma_delete_wq) {16611661- ret = -ENOMEM;16621662- goto err_unreg_transport;16631663- }16641664-16651659 return 0;1666166016671667-err_unreg_transport:16681668- nvmet_unregister_transport(&nvmet_rdma_ops);16691661err_ib_client:16701662 ib_unregister_client(&nvmet_rdma_ib_client);16711663 return ret;···1664167416651675static void __exit nvmet_rdma_exit(void)16661676{16671667- destroy_workqueue(nvmet_rdma_delete_wq);16681677 nvmet_unregister_transport(&nvmet_rdma_ops);16691678 ib_unregister_client(&nvmet_rdma_ib_client);16701679 WARN_ON_ONCE(!list_empty(&nvmet_rdma_queue_list));
+3-1
drivers/of/device.c
···149149 * set by the driver.150150 */151151 mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1);152152- dev->bus_dma_mask = mask;153152 dev->coherent_dma_mask &= mask;154153 *dev->dma_mask &= mask;154154+ /* ...but only set bus mask if we found valid dma-ranges earlier */155155+ if (!ret)156156+ dev->bus_dma_mask = mask;155157156158 coherent = of_dma_is_coherent(np);157159 dev_dbg(dev, "device is%sdma coherent\n",
···15481548 scr_memsetw(start + offset, vc->vc_video_erase_char, 2 * count);15491549 vc->vc_need_wrap = 0;15501550 if (con_should_update(vc))15511551- do_update_region(vc, (unsigned long) start, count);15511551+ do_update_region(vc, (unsigned long)(start + offset), count);15521552}1553155315541554static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */
+10
drivers/usb/typec/ucsi/Kconfig
···23232424if TYPEC_UCSI25252626+config UCSI_CCG2727+ tristate "UCSI Interface Driver for Cypress CCGx"2828+ depends on I2C2929+ help3030+ This driver enables UCSI support on platforms that expose a3131+ Cypress CCGx Type-C controller over I2C interface.3232+3333+ To compile the driver as a module, choose M here: the module will be3434+ called ucsi_ccg.3535+2636config UCSI_ACPI2737 tristate "UCSI ACPI Interface Driver"2838 depends on ACPI
···914914915915 ret = xenmem_reservation_increase(args->nr_pages, args->frames);916916 if (ret != args->nr_pages) {917917- pr_debug("Failed to decrease reservation for DMA buffer\n");917917+ pr_debug("Failed to increase reservation for DMA buffer\n");918918 ret = -EFAULT;919919 } else {920920 ret = 0;
+4-18
drivers/xen/privcmd-buf.c
···21212222MODULE_LICENSE("GPL");23232424-static unsigned int limit = 64;2525-module_param(limit, uint, 0644);2626-MODULE_PARM_DESC(limit, "Maximum number of pages that may be allocated by "2727- "the privcmd-buf device per open file");2828-2924struct privcmd_buf_private {3025 struct mutex lock;3126 struct list_head list;3232- unsigned int allocated;3327};34283529struct privcmd_buf_vma_private {···5460{5561 unsigned int i;56625757- vma_priv->file_priv->allocated -= vma_priv->n_pages;5858-5963 list_del(&vma_priv->list);60646165 for (i = 0; i < vma_priv->n_pages; i++)6262- if (vma_priv->pages[i])6363- __free_page(vma_priv->pages[i]);6666+ __free_page(vma_priv->pages[i]);64676568 kfree(vma_priv);6669}···137146 unsigned int i;138147 int ret = 0;139148140140- if (!(vma->vm_flags & VM_SHARED) || count > limit ||141141- file_priv->allocated + count > limit)149149+ if (!(vma->vm_flags & VM_SHARED))142150 return -EINVAL;143151144152 vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *),···145155 if (!vma_priv)146156 return -ENOMEM;147157148148- vma_priv->n_pages = count;149149- count = 0;150150- for (i = 0; i < vma_priv->n_pages; i++) {158158+ for (i = 0; i < count; i++) {151159 vma_priv->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO);152160 if (!vma_priv->pages[i])153161 break;154154- count++;162162+ vma_priv->n_pages++;155163 }156164157165 mutex_lock(&file_priv->lock);158158-159159- file_priv->allocated += count;160166161167 vma_priv->file_priv = file_priv;162168 vma_priv->users = 1;
···16641664 struct btrfs_root *root = arg;16651665 struct btrfs_fs_info *fs_info = root->fs_info;16661666 int again;16671667- struct btrfs_trans_handle *trans;1668166716691669- do {16681668+ while (1) {16701669 again = 0;1671167016721671 /* Make the cleaner go to sleep early. */···17141715 */17151716 btrfs_delete_unused_bgs(fs_info);17161717sleep:17181718+ if (kthread_should_park())17191719+ kthread_parkme();17201720+ if (kthread_should_stop())17211721+ return 0;17171722 if (!again) {17181723 set_current_state(TASK_INTERRUPTIBLE);17191719- if (!kthread_should_stop())17201720- schedule();17241724+ schedule();17211725 __set_current_state(TASK_RUNNING);17221726 }17231723- } while (!kthread_should_stop());17241724-17251725- /*17261726- * Transaction kthread is stopped before us and wakes us up.17271727- * However we might have started a new transaction and COWed some17281728- * tree blocks when deleting unused block groups for example. So17291729- * make sure we commit the transaction we started to have a clean17301730- * shutdown when evicting the btree inode - if it has dirty pages17311731- * when we do the final iput() on it, eviction will trigger a17321732- * writeback for it which will fail with null pointer dereferences17331733- * since work queues and other resources were already released and17341734- * destroyed by the time the iput/eviction/writeback is made.17351735- */17361736- trans = btrfs_attach_transaction(root);17371737- if (IS_ERR(trans)) {17381738- if (PTR_ERR(trans) != -ENOENT)17391739- btrfs_err(fs_info,17401740- "cleaner transaction attach returned %ld",17411741- PTR_ERR(trans));17421742- } else {17431743- int ret;17441744-17451745- ret = btrfs_commit_transaction(trans);17461746- if (ret)17471747- btrfs_err(fs_info,17481748- "cleaner open transaction commit returned %d",17491749- ret);17501727 }17511751-17521752- return 0;17531728}1754172917551730static int transaction_kthread(void *arg)···39043931 int ret;3905393239063933 set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags);39343934+ /*39353935+ * We don't want the cleaner to start new transactions, add more delayed39363936+ * iputs, etc. while we're closing. We can't use kthread_stop() yet39373937+ * because that frees the task_struct, and the transaction kthread might39383938+ * still try to wake up the cleaner.39393939+ */39403940+ kthread_park(fs_info->cleaner_kthread);3907394139083942 /* wait for the qgroup rescan worker to stop */39093943 btrfs_qgroup_wait_for_completion(fs_info, false);···3938395839393959 if (!sb_rdonly(fs_info->sb)) {39403960 /*39413941- * If the cleaner thread is stopped and there are39423942- * block groups queued for removal, the deletion will be39433943- * skipped when we quit the cleaner thread.39613961+ * The cleaner kthread is stopped, so do one final pass over39623962+ * unused block groups.39443963 */39453964 btrfs_delete_unused_bgs(fs_info);39463965···43384359 unpin = pinned_extents;43394360again:43404361 while (1) {43624362+ /*43634363+ * The btrfs_finish_extent_commit() may get the same range as43644364+ * ours between find_first_extent_bit and clear_extent_dirty.43654365+ * Hence, hold the unused_bg_unpin_mutex to avoid double unpin43664366+ * the same extent range.43674367+ */43684368+ mutex_lock(&fs_info->unused_bg_unpin_mutex);43414369 ret = find_first_extent_bit(unpin, 0, &start, &end,43424370 EXTENT_DIRTY, NULL);43434343- if (ret)43714371+ if (ret) {43724372+ mutex_unlock(&fs_info->unused_bg_unpin_mutex);43444373 break;43744374+ }4345437543464376 clear_extent_dirty(unpin, start, end);43474377 btrfs_error_unpin_extent_range(fs_info, start, end);43784378+ mutex_unlock(&fs_info->unused_bg_unpin_mutex);43484379 cond_resched();43494380 }43504381
+21-1
fs/btrfs/free-space-cache.c
···7575 * sure NOFS is set to keep us from deadlocking.7676 */7777 nofs_flag = memalloc_nofs_save();7878- inode = btrfs_iget(fs_info->sb, &location, root, NULL);7878+ inode = btrfs_iget_path(fs_info->sb, &location, root, NULL, path);7979+ btrfs_release_path(path);7980 memalloc_nofs_restore(nofs_flag);8081 if (IS_ERR(inode))8182 return inode;···839838 path->search_commit_root = 1;840839 path->skip_locking = 1;841840841841+ /*842842+ * We must pass a path with search_commit_root set to btrfs_iget in843843+ * order to avoid a deadlock when allocating extents for the tree root.844844+ *845845+ * When we are COWing an extent buffer from the tree root, when looking846846+ * for a free extent, at extent-tree.c:find_free_extent(), we can find847847+ * block group without its free space cache loaded. When we find one848848+ * we must load its space cache which requires reading its free space849849+ * cache's inode item from the root tree. If this inode item is located850850+ * in the same leaf that we started COWing before, then we end up in851851+ * deadlock on the extent buffer (trying to read lock it when we852852+ * previously write locked it).853853+ *854854+ * It's safe to read the inode item using the commit root because855855+ * block groups, once loaded, stay in memory forever (until they are856856+ * removed) as well as their space caches once loaded. New block groups857857+ * once created get their ->cached field set to BTRFS_CACHE_FINISHED so858858+ * we will never try to read their inode item while the fs is mounted.859859+ */842860 inode = lookup_free_space_inode(fs_info, block_group, path);843861 if (IS_ERR(inode)) {844862 btrfs_free_path(path);
+24-13
fs/btrfs/inode.c
···15311531 }15321532 btrfs_release_path(path);1533153315341534- if (cur_offset <= end && cow_start == (u64)-1) {15341534+ if (cur_offset <= end && cow_start == (u64)-1)15351535 cow_start = cur_offset;15361536- cur_offset = end;15371537- }1538153615391537 if (cow_start != (u64)-1) {15381538+ cur_offset = end;15401539 ret = cow_file_range(inode, locked_page, cow_start, end, end,15411540 page_started, nr_written, 1, NULL);15421541 if (ret)···35693570/*35703571 * read an inode from the btree into the in-memory inode35713572 */35723572-static int btrfs_read_locked_inode(struct inode *inode)35733573+static int btrfs_read_locked_inode(struct inode *inode,35743574+ struct btrfs_path *in_path)35733575{35743576 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);35753575- struct btrfs_path *path;35773577+ struct btrfs_path *path = in_path;35763578 struct extent_buffer *leaf;35773579 struct btrfs_inode_item *inode_item;35783580 struct btrfs_root *root = BTRFS_I(inode)->root;···35893589 if (!ret)35903590 filled = true;3591359135923592- path = btrfs_alloc_path();35933593- if (!path)35943594- return -ENOMEM;35923592+ if (!path) {35933593+ path = btrfs_alloc_path();35943594+ if (!path)35953595+ return -ENOMEM;35963596+ }3595359735963598 memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));3597359935983600 ret = btrfs_lookup_inode(NULL, root, path, &location, 0);35993601 if (ret) {36003600- btrfs_free_path(path);36023602+ if (path != in_path)36033603+ btrfs_free_path(path);36013604 return ret;36023605 }36033606···37253722 btrfs_ino(BTRFS_I(inode)),37263723 root->root_key.objectid, ret);37273724 }37283728- btrfs_free_path(path);37253725+ if (path != in_path)37263726+ btrfs_free_path(path);3729372737303728 if (!maybe_acls)37313729 cache_no_acl(inode);···56485644/* Get an inode object given its location and corresponding root.56495645 * Returns in *is_new if the inode was read from disk56505646 */56515651-struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,56525652- struct btrfs_root *root, int *new)56475647+struct inode *btrfs_iget_path(struct super_block *s, struct btrfs_key *location,56485648+ struct btrfs_root *root, int *new,56495649+ struct btrfs_path *path)56535650{56545651 struct inode *inode;56555652···56615656 if (inode->i_state & I_NEW) {56625657 int ret;5663565856645664- ret = btrfs_read_locked_inode(inode);56595659+ ret = btrfs_read_locked_inode(inode, path);56655660 if (!ret) {56665661 inode_tree_add(inode);56675662 unlock_new_inode(inode);···56815676 }5682567756835678 return inode;56795679+}56805680+56815681+struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,56825682+ struct btrfs_root *root, int *new)56835683+{56845684+ return btrfs_iget_path(s, location, root, new, NULL);56845685}5685568656865687static struct inode *new_simple_dir(struct super_block *s,
+12-2
fs/btrfs/ioctl.c
···34883488 const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize;3489348934903490 len = round_down(i_size_read(src), sz) - loff;34913491+ if (len == 0)34923492+ return 0;34913493 olen = len;34923494 }34933495 }···42594257 goto out_unlock;42604258 if (len == 0)42614259 olen = len = src->i_size - off;42624262- /* if we extend to eof, continue to block boundary */42634263- if (off + len == src->i_size)42604260+ /*42614261+ * If we extend to eof, continue to block boundary if and only if the42624262+ * destination end offset matches the destination file's size, otherwise42634263+ * we would be corrupting data by placing the eof block into the middle42644264+ * of a file.42654265+ */42664266+ if (off + len == src->i_size) {42674267+ if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size)42684268+ goto out_unlock;42644269 len = ALIGN(src->i_size, bs) - off;42704270+ }4265427142664272 if (len == 0) {42674273 ret = 0;
+3-3
fs/btrfs/super.c
···19161916}1917191719181918/* Used to sort the devices by max_avail(descending sort) */19191919-static int btrfs_cmp_device_free_bytes(const void *dev_info1,19191919+static inline int btrfs_cmp_device_free_bytes(const void *dev_info1,19201920 const void *dev_info2)19211921{19221922 if (((struct btrfs_device_info *)dev_info1)->max_avail >···19451945 * The helper to calc the free space on the devices that can be used to store19461946 * file data.19471947 */19481948-static int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,19491949- u64 *free_bytes)19481948+static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,19491949+ u64 *free_bytes)19501950{19511951 struct btrfs_device_info *devices_info;19521952 struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
+1-1
fs/btrfs/tree-checker.c
···440440 type != (BTRFS_BLOCK_GROUP_METADATA |441441 BTRFS_BLOCK_GROUP_DATA)) {442442 block_group_err(fs_info, leaf, slot,443443-"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",443443+"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",444444 type, hweight64(type),445445 BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,446446 BTRFS_BLOCK_GROUP_SYSTEM,
+17
fs/btrfs/tree-log.c
···43964396 logged_end = end;4397439743984398 list_for_each_entry_safe(em, n, &tree->modified_extents, list) {43994399+ /*44004400+ * Skip extents outside our logging range. It's important to do44014401+ * it for correctness because if we don't ignore them, we may44024402+ * log them before their ordered extent completes, and therefore44034403+ * we could log them without logging their respective checksums44044404+ * (the checksum items are added to the csum tree at the very44054405+ * end of btrfs_finish_ordered_io()). Also leave such extents44064406+ * outside of our range in the list, since we may have another44074407+ * ranged fsync in the near future that needs them. If an extent44084408+ * outside our range corresponds to a hole, log it to avoid44094409+ * leaving gaps between extents (fsck will complain when we are44104410+ * not using the NO_HOLES feature).44114411+ */44124412+ if ((em->start > end || em->start + em->len <= start) &&44134413+ em->block_start != EXTENT_MAP_HOLE)44144414+ continue;44154415+43994416 list_del_init(&em->list);44004417 /*44014418 * Just an arbitrary number, this can be really CPU intensive
+9-2
fs/ceph/file.c
···19311931 if (!prealloc_cf)19321932 return -ENOMEM;1933193319341934- /* Start by sync'ing the source file */19341934+ /* Start by sync'ing the source and destination files */19351935 ret = file_write_and_wait_range(src_file, src_off, (src_off + len));19361936- if (ret < 0)19361936+ if (ret < 0) {19371937+ dout("failed to write src file (%zd)\n", ret);19371938 goto out;19391939+ }19401940+ ret = file_write_and_wait_range(dst_file, dst_off, (dst_off + len));19411941+ if (ret < 0) {19421942+ dout("failed to write dst file (%zd)\n", ret);19431943+ goto out;19441944+ }1938194519391946 /*19401947 * We need FILE_WR caps for dst_ci and FILE_RD for src_ci as other
···58355835{58365836 int err = 0;5837583758385838- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))58385838+ if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {58395839+ put_bh(iloc->bh);58395840 return -EIO;58405840-58415841+ }58415842 if (IS_I_VERSION(inode))58425843 inode_inc_iversion(inode);58435844
+4-1
fs/ext4/namei.c
···126126 if (!is_dx_block && type == INDEX) {127127 ext4_error_inode(inode, func, line, block,128128 "directory leaf block found instead of index block");129129+ brelse(bh);129130 return ERR_PTR(-EFSCORRUPTED);130131 }131132 if (!ext4_has_metadata_csum(inode->i_sb) ||···28122811 list_del_init(&EXT4_I(inode)->i_orphan);28132812 mutex_unlock(&sbi->s_orphan_lock);28142813 }28152815- }28142814+ } else28152815+ brelse(iloc.bh);28162816+28162817 jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);28172818 jbd_debug(4, "orphan inode %lu will point to %d\n",28182819 inode->i_ino, NEXT_ORPHAN(inode));
···40754075 sbi->s_groups_count = blocks_count;40764076 sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,40774077 (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));40784078+ if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) !=40794079+ le32_to_cpu(es->s_inodes_count)) {40804080+ ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu",40814081+ le32_to_cpu(es->s_inodes_count),40824082+ ((u64)sbi->s_groups_count * sbi->s_inodes_per_group));40834083+ ret = -EINVAL;40844084+ goto failed_mount;40854085+ }40784086 db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /40794087 EXT4_DESC_PER_BLOCK(sb);40804088 if (ext4_has_feature_meta_bg(sb)) {···41004092 if (sbi->s_group_desc == NULL) {41014093 ext4_msg(sb, KERN_ERR, "not enough memory");41024094 ret = -ENOMEM;41034103- goto failed_mount;41044104- }41054105- if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) !=41064106- le32_to_cpu(es->s_inodes_count)) {41074107- ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu",41084108- le32_to_cpu(es->s_inodes_count),41094109- ((u64)sbi->s_groups_count * sbi->s_inodes_per_group));41104110- ret = -EINVAL;41114095 goto failed_mount;41124096 }41134097···45104510 percpu_counter_destroy(&sbi->s_freeinodes_counter);45114511 percpu_counter_destroy(&sbi->s_dirs_counter);45124512 percpu_counter_destroy(&sbi->s_dirtyclusters_counter);45134513+ percpu_free_rwsem(&sbi->s_journal_flag_rwsem);45134514failed_mount5:45144515 ext4_ext_release(sb);45154516 ext4_release_system_zone(sb);
+19-8
fs/ext4/xattr.c
···10311031 inode_lock(ea_inode);1032103210331033 ret = ext4_reserve_inode_write(handle, ea_inode, &iloc);10341034- if (ret) {10351035- iloc.bh = NULL;10341034+ if (ret)10361035 goto out;10371037- }1038103610391037 ref_count = ext4_xattr_inode_get_ref(ea_inode);10401038 ref_count += ref_change;···10781080 }1079108110801082 ret = ext4_mark_iloc_dirty(handle, ea_inode, &iloc);10811081- iloc.bh = NULL;10821083 if (ret)10831084 ext4_warning_inode(ea_inode,10841085 "ext4_mark_iloc_dirty() failed ret=%d", ret);10851086out:10861086- brelse(iloc.bh);10871087 inode_unlock(ea_inode);10881088 return ret;10891089}···13841388 bh = ext4_getblk(handle, ea_inode, block, 0);13851389 if (IS_ERR(bh))13861390 return PTR_ERR(bh);13911391+ if (!bh) {13921392+ WARN_ON_ONCE(1);13931393+ EXT4_ERROR_INODE(ea_inode,13941394+ "ext4_getblk() return bh = NULL");13951395+ return -EFSCORRUPTED;13961396+ }13871397 ret = ext4_journal_get_write_access(handle, bh);13881398 if (ret)13891399 goto out;···22782276 if (!bh)22792277 return ERR_PTR(-EIO);22802278 error = ext4_xattr_check_block(inode, bh);22812281- if (error)22792279+ if (error) {22802280+ brelse(bh);22822281 return ERR_PTR(error);22822282+ }22832283 return bh;22842284}22852285···24012397 error = ext4_xattr_block_set(handle, inode, &i, &bs);24022398 } else if (error == -ENOSPC) {24032399 if (EXT4_I(inode)->i_file_acl && !bs.s.base) {24002400+ brelse(bs.bh);24012401+ bs.bh = NULL;24042402 error = ext4_xattr_block_find(inode, &i, &bs);24052403 if (error)24062404 goto cleanup;···26232617 kfree(buffer);26242618 if (is)26252619 brelse(is->iloc.bh);26202620+ if (bs)26212621+ brelse(bs->bh);26262622 kfree(is);26272623 kfree(bs);26282624···27042696 struct ext4_inode *raw_inode, handle_t *handle)27052697{27062698 struct ext4_xattr_ibody_header *header;27072707- struct buffer_head *bh;27082699 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);27092700 static unsigned int mnt_count;27102701 size_t min_offs;···27442737 * EA block can hold new_extra_isize bytes.27452738 */27462739 if (EXT4_I(inode)->i_file_acl) {27402740+ struct buffer_head *bh;27412741+27472742 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);27482743 error = -EIO;27492744 if (!bh)27502745 goto cleanup;27512746 error = ext4_xattr_check_block(inode, bh);27522752- if (error)27472747+ if (error) {27482748+ brelse(bh);27532749 goto cleanup;27502750+ }27542751 base = BHDR(bh);27552752 end = bh->b_data + bh->b_size;27562753 min_offs = end - base;
+17-5
fs/namespace.c
···1540154015411541 namespace_lock();15421542 lock_mount_hash();15431543- event++;1544154315441544+ /* Recheck MNT_LOCKED with the locks held */15451545+ retval = -EINVAL;15461546+ if (mnt->mnt.mnt_flags & MNT_LOCKED)15471547+ goto out;15481548+15491549+ event++;15451550 if (flags & MNT_DETACH) {15461551 if (!list_empty(&mnt->mnt_list))15471552 umount_tree(mnt, UMOUNT_PROPAGATE);···15601555 retval = 0;15611556 }15621557 }15581558+out:15631559 unlock_mount_hash();15641560 namespace_unlock();15651561 return retval;···16511645 goto dput_and_out;16521646 if (!check_mnt(mnt))16531647 goto dput_and_out;16541654- if (mnt->mnt.mnt_flags & MNT_LOCKED)16481648+ if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */16551649 goto dput_and_out;16561650 retval = -EPERM;16571651 if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))···17341728 for (s = r; s; s = next_mnt(s, r)) {17351729 if (!(flag & CL_COPY_UNBINDABLE) &&17361730 IS_MNT_UNBINDABLE(s)) {17371737- s = skip_mnt_tree(s);17381738- continue;17311731+ if (s->mnt.mnt_flags & MNT_LOCKED) {17321732+ /* Both unbindable and locked. */17331733+ q = ERR_PTR(-EPERM);17341734+ goto out;17351735+ } else {17361736+ s = skip_mnt_tree(s);17371737+ continue;17381738+ }17391739 }17401740 if (!(flag & CL_COPY_MNT_NS_FILE) &&17411741 is_mnt_ns_file(s->mnt.mnt_root)) {···17941782{17951783 namespace_lock();17961784 lock_mount_hash();17971797- umount_tree(real_mount(mnt), UMOUNT_SYNC);17851785+ umount_tree(real_mount(mnt), 0);17981786 unlock_mount_hash();17991787 namespace_unlock();18001788}
+9-2
fs/xfs/libxfs/xfs_attr_leaf.c
···243243 struct xfs_mount *mp = bp->b_target->bt_mount;244244 struct xfs_attr_leafblock *leaf = bp->b_addr;245245 struct xfs_attr_leaf_entry *entries;246246- uint16_t end;246246+ uint32_t end; /* must be 32bit - see below */247247 int i;248248249249 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);···293293 /*294294 * Quickly check the freemap information. Attribute data has to be295295 * aligned to 4-byte boundaries, and likewise for the free space.296296+ *297297+ * Note that for 64k block size filesystems, the freemap entries cannot298298+ * overflow as they are only be16 fields. However, when checking end299299+ * pointer of the freemap, we have to be careful to detect overflows and300300+ * so use uint32_t for those checks.296301 */297302 for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {298303 if (ichdr.freemap[i].base > mp->m_attr_geo->blksize)···308303 return __this_address;309304 if (ichdr.freemap[i].size & 0x3)310305 return __this_address;311311- end = ichdr.freemap[i].base + ichdr.freemap[i].size;306306+307307+ /* be care of 16 bit overflows here */308308+ end = (uint32_t)ichdr.freemap[i].base + ichdr.freemap[i].size;312309 if (end < ichdr.freemap[i].base)313310 return __this_address;314311 if (end > mp->m_attr_geo->blksize)
···55#ifndef __ASSEMBLY__66#include <asm-generic/5level-fixup.h>7788-#define __PAGETABLE_PUD_FOLDED88+#define __PAGETABLE_PUD_FOLDED 1991010/*1111 * Having the pud type consist of a pgd gets the size right, and allows
···8899struct mm_struct;10101111-#define __PAGETABLE_PMD_FOLDED1111+#define __PAGETABLE_PMD_FOLDED 112121313/*1414 * Having the pmd type consist of a pud gets the size right, and allows
+1-1
include/asm-generic/pgtable-nopud.h
···99#else1010#include <asm-generic/pgtable-nop4d.h>11111212-#define __PAGETABLE_PUD_FOLDED1212+#define __PAGETABLE_PUD_FOLDED 113131414/*1515 * Having the pud type consist of a p4d gets the size right, and allows
+16
include/asm-generic/pgtable.h
···11271127#endif11281128#endif1129112911301130+/*11311131+ * On some architectures it depends on the mm if the p4d/pud or pmd11321132+ * layer of the page table hierarchy is folded or not.11331133+ */11341134+#ifndef mm_p4d_folded11351135+#define mm_p4d_folded(mm) __is_defined(__PAGETABLE_P4D_FOLDED)11361136+#endif11371137+11381138+#ifndef mm_pud_folded11391139+#define mm_pud_folded(mm) __is_defined(__PAGETABLE_PUD_FOLDED)11401140+#endif11411141+11421142+#ifndef mm_pmd_folded11431143+#define mm_pmd_folded(mm) __is_defined(__PAGETABLE_PMD_FOLDED)11441144+#endif11451145+11301146#endif /* _ASM_GENERIC_PGTABLE_H */
···4455/*66 * The attributes in this file are unconditionally defined and they directly77- * map to compiler attribute(s) -- except those that are optional.77+ * map to compiler attribute(s), unless one of the compilers does not support88+ * the attribute. In that case, __has_attribute is used to check for support99+ * and the reason is stated in its comment ("Optional: ...").810 *911 * Any other "attributes" (i.e. those that depend on a configuration option,1012 * on a compiler, on an architecture, on plugins, on other attributes...)1113 * should be defined elsewhere (e.g. compiler_types.h or compiler-*.h).1414+ * The intention is to keep this file as simple as possible, as well as1515+ * compiler- and version-agnostic (e.g. avoiding GCC_VERSION checks).1216 *1317 * This file is meant to be sorted (by actual attribute name,1418 * not by #define identifier). Use the __attribute__((__name__)) syntax1519 * (i.e. with underscores) to avoid future collisions with other macros.1616- * If an attribute is optional, state the reason in the comment.2020+ * Provide links to the documentation of each supported compiler, if it exists.1721 */18221923/*2020- * To check for optional attributes, we use __has_attribute, which is supported2121- * on gcc >= 5, clang >= 2.9 and icc >= 17. In the meantime, to support2222- * 4.6 <= gcc < 5, we implement __has_attribute by hand.2424+ * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17.2525+ * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute2626+ * by hand.2327 *2428 * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__2529 * depending on the compiler used to build it; however, these attributes have
+4
include/linux/compiler_types.h
···130130# define randomized_struct_fields_end131131#endif132132133133+#ifndef asm_volatile_goto134134+#define asm_volatile_goto(x...) asm goto(x)135135+#endif136136+133137/* Are two types/vars the same type (ignoring qualifiers)? */134138#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))135139
+2-2
include/linux/hid.h
···722722 * input will not be passed to raw_event unless hid_device_io_start is723723 * called.724724 *725725- * raw_event and event should return 0 on no action performed, 1 when no726726- * further processing should be done and negative on error725725+ * raw_event and event should return negative on error, any other value will726726+ * pass the event on to .event() typically return 0 for success.727727 *728728 * input_mapping shall return a negative value to completely ignore this usage729729 * (e.g. doubled or invalid usage), zero to continue with parsing of this
···324324 */325325static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand)326326{327327- return (u64)nand->memorg.luns_per_target *328328- nand->memorg.eraseblocks_per_lun *329329- nand->memorg.pages_per_eraseblock;327327+ return nand->memorg.ntargets * nand->memorg.luns_per_target *328328+ nand->memorg.eraseblocks_per_lun;330329}331330332331/**···568569}569570570571/**571571- * nanddev_pos_next_eraseblock() - Move a position to the next page572572+ * nanddev_pos_next_page() - Move a position to the next page572573 * @nand: NAND device573574 * @pos: the position to update574575 *
+2
include/linux/nmi.h
···119119void watchdog_nmi_stop(void);120120void watchdog_nmi_start(void);121121int watchdog_nmi_probe(void);122122+int watchdog_nmi_enable(unsigned int cpu);123123+void watchdog_nmi_disable(unsigned int cpu);122124123125/**124126 * touch_nmi_watchdog - restart NMI watchdog timeout.
+9-9
include/uapi/linux/kfd_ioctl.h
···8383};84848585struct kfd_ioctl_get_queue_wave_state_args {8686- uint64_t ctl_stack_address; /* to KFD */8787- uint32_t ctl_stack_used_size; /* from KFD */8888- uint32_t save_area_used_size; /* from KFD */8989- uint32_t queue_id; /* to KFD */9090- uint32_t pad;8686+ __u64 ctl_stack_address; /* to KFD */8787+ __u32 ctl_stack_used_size; /* from KFD */8888+ __u32 save_area_used_size; /* from KFD */8989+ __u32 queue_id; /* to KFD */9090+ __u32 pad;9191};92929393/* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */···255255256256/* hw exception data */257257struct kfd_hsa_hw_exception_data {258258- uint32_t reset_type;259259- uint32_t reset_cause;260260- uint32_t memory_lost;261261- uint32_t gpu_id;258258+ __u32 reset_type;259259+ __u32 reset_cause;260260+ __u32 memory_lost;261261+ __u32 gpu_id;262262};263263264264/* Event data */
+7-5
include/xen/xen-ops.h
···42424343extern unsigned long *xen_contiguous_bitmap;44444545-#ifdef CONFIG_XEN_PV4545+#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)4646int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,4747 unsigned int address_bits,4848 dma_addr_t *dma_handle);49495050void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);5151-5252-int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,5353- xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,5454- unsigned int domid, bool no_translate, struct page **pages);5551#else5652static inline int xen_create_contiguous_region(phys_addr_t pstart,5753 unsigned int order,···59636064static inline void xen_destroy_contiguous_region(phys_addr_t pstart,6165 unsigned int order) { }6666+#endif62676868+#if defined(CONFIG_XEN_PV)6969+int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,7070+ xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,7171+ unsigned int domid, bool no_translate, struct page **pages);7272+#else6373static inline int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,6474 xen_pfn_t *pfn, int nr, int *err_ptr,6575 pgprot_t prot, unsigned int domid,
+14-5
kernel/resource.c
···319319EXPORT_SYMBOL(release_resource);320320321321/**322322- * Finds the lowest iomem resource that covers part of [start..end]. The323323- * caller must specify start, end, flags, and desc (which may be322322+ * Finds the lowest iomem resource that covers part of [@start..@end]. The323323+ * caller must specify @start, @end, @flags, and @desc (which may be324324 * IORES_DESC_NONE).325325 *326326- * If a resource is found, returns 0 and *res is overwritten with the part327327- * of the resource that's within [start..end]; if none is found, returns328328- * -1.326326+ * If a resource is found, returns 0 and @*res is overwritten with the part327327+ * of the resource that's within [@start..@end]; if none is found, returns328328+ * -1 or -EINVAL for other invalid parameters.329329 *330330 * This function walks the whole tree and not just first level children331331 * unless @first_lvl is true.332332+ *333333+ * @start: start address of the resource searched for334334+ * @end: end address of same resource335335+ * @flags: flags which the resource must have336336+ * @desc: descriptor the resource must have337337+ * @first_lvl: walk only the first level children, if set338338+ * @res: return ptr, if resource found332339 */333340static int find_next_iomem_res(resource_size_t start, resource_size_t end,334341 unsigned long flags, unsigned long desc,···406399 * @flags: I/O resource flags407400 * @start: start addr408401 * @end: end addr402402+ * @arg: function argument for the callback @func403403+ * @func: callback function that is called for each qualifying resource area409404 *410405 * NOTE: For a new descriptor search, define a new IORES_DESC in411406 * <linux/ioport.h> and set it in 'desc' of a target resource entry.
+4-1
kernel/sched/core.c
···58515851 /*58525852 * There's no userspace yet to cause hotplug operations; hence all the58535853 * CPU masks are stable and all blatant races in the below code cannot58545854- * happen.58545854+ * happen. The hotplug lock is nevertheless taken to satisfy lockdep,58555855+ * but there won't be any contention on it.58555856 */58575857+ cpus_read_lock();58565858 mutex_lock(&sched_domains_mutex);58575859 sched_init_domains(cpu_active_mask);58585860 mutex_unlock(&sched_domains_mutex);58615861+ cpus_read_unlock();5859586258605863 /* Move init over to a non-isolated CPU */58615864 if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
+2-2
kernel/sched/fair.c
···24002400 local = 1;2401240124022402 /*24032403- * Retry task to preferred node migration periodically, in case it24042404- * case it previously failed, or the scheduler moved us.24032403+ * Retry to migrate task to preferred node periodically, in case it24042404+ * previously failed, or the scheduler moved us.24052405 */24062406 if (time_after(jiffies, p->numa_migrate_retry)) {24072407 task_numa_placement(p);
-3
kernel/time/posix-cpu-timers.c
···917917 struct task_cputime cputime;918918 unsigned long soft;919919920920- if (dl_task(tsk))921921- check_dl_overrun(tsk);922922-923920 /*924921 * If cputimer is not running, then there are no active925922 * process wide timers (POSIX 1.b, itimers, RLIMIT_CPU).
+8-4
kernel/user_namespace.c
···974974 if (!new_idmap_permitted(file, ns, cap_setid, &new_map))975975 goto out;976976977977- ret = sort_idmaps(&new_map);978978- if (ret < 0)979979- goto out;980980-981977 ret = -EPERM;982978 /* Map the lower ids from the parent user namespace to the983979 * kernel global id space.···999100310001004 e->lower_first = lower_first;10011005 }10061006+10071007+ /*10081008+ * If we want to use binary search for lookup, this clones the extent10091009+ * array and sorts both copies.10101010+ */10111011+ ret = sort_idmaps(&new_map);10121012+ if (ret < 0)10131013+ goto out;1002101410031015 /* Install the map */10041016 if (new_map.nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) {
···11651165 break;11661166 }1167116711681168- if (dissector_uses_key(flow_dissector,11691169- FLOW_DISSECTOR_KEY_PORTS)) {11681168+ if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS) &&11691169+ !(key_control->flags & FLOW_DIS_IS_FRAGMENT)) {11701170 key_ports = skb_flow_dissector_target(flow_dissector,11711171 FLOW_DISSECTOR_KEY_PORTS,11721172 target_container);
+15-14
net/ipv4/inet_fragment.c
···178178}179179180180static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf,181181- void *arg)181181+ void *arg,182182+ struct inet_frag_queue **prev)182183{183184 struct inet_frags *f = nf->f;184185 struct inet_frag_queue *q;185185- int err;186186187187 q = inet_frag_alloc(nf, f, arg);188188- if (!q)188188+ if (!q) {189189+ *prev = ERR_PTR(-ENOMEM);189190 return NULL;190190-191191+ }191192 mod_timer(&q->timer, jiffies + nf->timeout);192193193193- err = rhashtable_insert_fast(&nf->rhashtable, &q->node,194194- f->rhash_params);195195- if (err < 0) {194194+ *prev = rhashtable_lookup_get_insert_key(&nf->rhashtable, &q->key,195195+ &q->node, f->rhash_params);196196+ if (*prev) {196197 q->flags |= INET_FRAG_COMPLETE;197198 inet_frag_kill(q);198199 inet_frag_destroy(q);···205204/* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */206205struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key)207206{208208- struct inet_frag_queue *fq;207207+ struct inet_frag_queue *fq = NULL, *prev;209208210209 if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh)211210 return NULL;212211213212 rcu_read_lock();214213215215- fq = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params);216216- if (fq) {214214+ prev = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params);215215+ if (!prev)216216+ fq = inet_frag_create(nf, key, &prev);217217+ if (prev && !IS_ERR(prev)) {218218+ fq = prev;217219 if (!refcount_inc_not_zero(&fq->refcnt))218220 fq = NULL;219219- rcu_read_unlock();220220- return fq;221221 }222222 rcu_read_unlock();223223-224224- return inet_frag_create(nf, key);223223+ return fq;225224}226225EXPORT_SYMBOL(inet_frag_find);
+2-1
net/sched/act_mirred.c
···258258 if (is_redirect) {259259 skb2->tc_redirected = 1;260260 skb2->tc_from_ingress = skb2->tc_at_ingress;261261-261261+ if (skb2->tc_from_ingress)262262+ skb2->tstamp = 0;262263 /* let's the caller reinsert the packet, if possible */263264 if (use_reinsert) {264265 res->ingress = want_ingress;
···648648 */649649 skb->dev = qdisc_dev(sch);650650651651-#ifdef CONFIG_NET_CLS_ACT652652- /*653653- * If it's at ingress let's pretend the delay is654654- * from the network (tstamp will be updated).655655- */656656- if (skb->tc_redirected && skb->tc_from_ingress)657657- skb->tstamp = 0;658658-#endif659659-660651 if (q->slot.slot_next) {661652 q->slot.packets_left--;662653 q->slot.bytes_left -= qdisc_pkt_len(skb);
+7-4
net/tipc/link.c
···15981598 if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI))15991599 l->priority = peers_prio;1600160016011601- /* ACTIVATE_MSG serves as PEER_RESET if link is already down */16021602- if (msg_peer_stopping(hdr))16011601+ /* If peer is going down we want full re-establish cycle */16021602+ if (msg_peer_stopping(hdr)) {16031603 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT);16041604- else if ((mtyp == RESET_MSG) || !link_is_up(l))16041604+ break;16051605+ }16061606+ /* ACTIVATE_MSG serves as PEER_RESET if link is already down */16071607+ if (mtyp == RESET_MSG || !link_is_up(l))16051608 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT);1606160916071610 /* ACTIVATE_MSG takes up link if it was already locally reset */16081608- if ((mtyp == ACTIVATE_MSG) && (l->state == LINK_ESTABLISHING))16111611+ if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING)16091612 rc = TIPC_LINK_UP_EVT;1610161316111614 l->peer_session = msg_session(hdr);
+4-3
scripts/kconfig/merge_config.sh
···102102fi103103104104MERGE_LIST=$*105105-SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p"105105+SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p"106106+SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p"106107107108TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)108109···117116 echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2118117 exit 1119118 fi120120- CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)119119+ CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE)121120122121 for CFG in $CFG_LIST ; do123122 grep -q -w $CFG $TMP_FILE || continue···160159161160162161# Check all specified config values took (might have missed-dependency issues)163163-for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do162162+for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do164163165164 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)166165 ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
+3-3
scripts/package/builddeb
···8181 cp System.map "$tmpdir/boot/System.map-$version"8282 cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"8383fi8484-cp "$($MAKE -s image_name)" "$tmpdir/$installed_image_path"8484+cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"85858686-if grep -q "^CONFIG_OF=y" $KCONFIG_CONFIG ; then8686+if grep -q "^CONFIG_OF_EARLY_FLATTREE=y" $KCONFIG_CONFIG ; then8787 # Only some architectures with OF support have this target8888- if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then8888+ if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then8989 $MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install9090 fi9191fi
···5555 S - read sample value (PERF_SAMPLE_READ)5656 D - pin the event to the PMU5757 W - group is weak and will fallback to non-group if not schedulable,5858- only supported in 'perf stat' for now.59586059The 'p' modifier can be used for specifying how precise the instruction6160address should be. The 'p' modifier can be specified multiple times:
···383383 return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID;384384}385385386386-static struct perf_evsel *perf_evsel__reset_weak_group(struct perf_evsel *evsel)387387-{388388- struct perf_evsel *c2, *leader;389389- bool is_open = true;390390-391391- leader = evsel->leader;392392- pr_debug("Weak group for %s/%d failed\n",393393- leader->name, leader->nr_members);394394-395395- /*396396- * for_each_group_member doesn't work here because it doesn't397397- * include the first entry.398398- */399399- evlist__for_each_entry(evsel_list, c2) {400400- if (c2 == evsel)401401- is_open = false;402402- if (c2->leader == leader) {403403- if (is_open)404404- perf_evsel__close(c2);405405- c2->leader = c2;406406- c2->nr_members = 0;407407- }408408- }409409- return leader;410410-}411411-412386static bool is_target_alive(struct target *_target,413387 struct thread_map *threads)414388{···451477 if ((errno == EINVAL || errno == EBADF) &&452478 counter->leader != counter &&453479 counter->weak_group) {454454- counter = perf_evsel__reset_weak_group(counter);480480+ counter = perf_evlist__reset_weak_group(evsel_list, counter);455481 goto try_again;456482 }457483
+3
tools/perf/builtin-top.c
···14291429 }14301430 }1431143114321432+ if (opts->branch_stack && callchain_param.enabled)14331433+ symbol_conf.show_branchflag_count = true;14341434+14321435 sort__mode = SORT_MODE__TOP;14331436 /* display thread wants entries to be collapsed in a different tree */14341437 perf_hpp_list.need_collapse = 1;
+29-5
tools/perf/builtin-trace.c
···108108 } stats;109109 unsigned int max_stack;110110 unsigned int min_stack;111111+ bool raw_augmented_syscalls;111112 bool not_ev_qualifier;112113 bool live;113114 bool full_time;···17251724 return printed;17261725}1727172617281728-static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sample, int *augmented_args_size)17271727+static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sample, int *augmented_args_size, bool raw_augmented)17291728{17301729 void *augmented_args = NULL;17301730+ /*17311731+ * For now with BPF raw_augmented we hook into raw_syscalls:sys_enter17321732+ * and there we get all 6 syscall args plus the tracepoint common17331733+ * fields (sizeof(long)) and the syscall_nr (another long). So we check17341734+ * if that is the case and if so don't look after the sc->args_size,17351735+ * but always after the full raw_syscalls:sys_enter payload, which is17361736+ * fixed.17371737+ *17381738+ * We'll revisit this later to pass s->args_size to the BPF augmenter17391739+ * (now tools/perf/examples/bpf/augmented_raw_syscalls.c, so that it17401740+ * copies only what we need for each syscall, like what happens when we17411741+ * use syscalls:sys_enter_NAME, so that we reduce the kernel/userspace17421742+ * traffic to just what is needed for each syscall.17431743+ */17441744+ int args_size = raw_augmented ? (8 * (int)sizeof(long)) : sc->args_size;1731174517321732- *augmented_args_size = sample->raw_size - sc->args_size;17461746+ *augmented_args_size = sample->raw_size - args_size;17331747 if (*augmented_args_size > 0)17341734- augmented_args = sample->raw_data + sc->args_size;17481748+ augmented_args = sample->raw_data + args_size;1735174917361750 return augmented_args;17371751}···17961780 * here and avoid using augmented syscalls when the evsel is the raw_syscalls one.17971781 */17981782 if (evsel != trace->syscalls.events.sys_enter)17991799- augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size);17831783+ augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size, trace->raw_augmented_syscalls);18001784 ttrace->entry_time = sample->time;18011785 msg = ttrace->entry_str;18021786 printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name);···18491833 goto out_put;1850183418511835 args = perf_evsel__sc_tp_ptr(evsel, args, sample);18521852- augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size);18361836+ augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size, trace->raw_augmented_syscalls);18531837 syscall__scnprintf_args(sc, msg, sizeof(msg), args, augmented_args, augmented_args_size, trace, thread);18541838 fprintf(trace->output, "%s", msg);18551839 err = 0;···35173501 evsel->handler = trace__sys_enter;3518350235193503 evlist__for_each_entry(trace.evlist, evsel) {35043504+ bool raw_syscalls_sys_exit = strcmp(perf_evsel__name(evsel), "raw_syscalls:sys_exit") == 0;35053505+35063506+ if (raw_syscalls_sys_exit) {35073507+ trace.raw_augmented_syscalls = true;35083508+ goto init_augmented_syscall_tp;35093509+ }35103510+35203511 if (strstarts(perf_evsel__name(evsel), "syscalls:sys_exit_")) {35123512+init_augmented_syscall_tp:35213513 perf_evsel__init_augmented_syscall_tp(evsel);35223514 perf_evsel__init_augmented_syscall_tp_ret(evsel);35233515 evsel->handler = trace__sys_exit;
+131
tools/perf/examples/bpf/augmented_raw_syscalls.c
···11+// SPDX-License-Identifier: GPL-2.022+/*33+ * Augment the raw_syscalls tracepoints with the contents of the pointer arguments.44+ *55+ * Test it with:66+ *77+ * perf trace -e tools/perf/examples/bpf/augmented_raw_syscalls.c cat /etc/passwd > /dev/null88+ *99+ * This exactly matches what is marshalled into the raw_syscall:sys_enter1010+ * payload expected by the 'perf trace' beautifiers.1111+ *1212+ * For now it just uses the existing tracepoint augmentation code in 'perf1313+ * trace', in the next csets we'll hook up these with the sys_enter/sys_exit1414+ * code that will combine entry/exit in a strace like way.1515+ */1616+1717+#include <stdio.h>1818+#include <linux/socket.h>1919+2020+/* bpf-output associated map */2121+struct bpf_map SEC("maps") __augmented_syscalls__ = {2222+ .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,2323+ .key_size = sizeof(int),2424+ .value_size = sizeof(u32),2525+ .max_entries = __NR_CPUS__,2626+};2727+2828+struct syscall_enter_args {2929+ unsigned long long common_tp_fields;3030+ long syscall_nr;3131+ unsigned long args[6];3232+};3333+3434+struct syscall_exit_args {3535+ unsigned long long common_tp_fields;3636+ long syscall_nr;3737+ long ret;3838+};3939+4040+struct augmented_filename {4141+ unsigned int size;4242+ int reserved;4343+ char value[256];4444+};4545+4646+#define SYS_OPEN 24747+#define SYS_OPENAT 2574848+4949+SEC("raw_syscalls:sys_enter")5050+int sys_enter(struct syscall_enter_args *args)5151+{5252+ struct {5353+ struct syscall_enter_args args;5454+ struct augmented_filename filename;5555+ } augmented_args;5656+ unsigned int len = sizeof(augmented_args);5757+ const void *filename_arg = NULL;5858+5959+ probe_read(&augmented_args.args, sizeof(augmented_args.args), args);6060+ /*6161+ * Yonghong and Edward Cree sayz:6262+ *6363+ * https://www.spinics.net/lists/netdev/msg531645.html6464+ *6565+ * >> R0=inv(id=0) R1=inv2 R6=ctx(id=0,off=0,imm=0) R7=inv64 R10=fp0,call_-16666+ * >> 10: (bf) r1 = r66767+ * >> 11: (07) r1 += 166868+ * >> 12: (05) goto pc+26969+ * >> 15: (79) r3 = *(u64 *)(r1 +0)7070+ * >> dereference of modified ctx ptr R1 off=16 disallowed7171+ * > Aha, we at least got a different error message this time.7272+ * > And indeed llvm has done that optimisation, rather than the more obvious7373+ * > 11: r3 = *(u64 *)(r1 +16)7474+ * > because it wants to have lots of reads share a single insn. You may be able7575+ * > to defeat that optimisation by adding compiler barriers, idk. Maybe someone7676+ * > with llvm knowledge can figure out how to stop it (ideally, llvm would know7777+ * > when it's generating for bpf backend and not do that). -O0? ¯\_(ツ)_/¯7878+ *7979+ * The optimization mostly likes below:8080+ *8181+ * br1:8282+ * ...8383+ * r1 += 168484+ * goto merge8585+ * br2:8686+ * ...8787+ * r1 += 208888+ * goto merge8989+ * merge:9090+ * *(u64 *)(r1 + 0)9191+ *9292+ * The compiler tries to merge common loads. There is no easy way to9393+ * stop this compiler optimization without turning off a lot of other9494+ * optimizations. The easiest way is to add barriers:9595+ *9696+ * __asm__ __volatile__("": : :"memory")9797+ *9898+ * after the ctx memory access to prevent their down stream merging.9999+ */100100+ switch (augmented_args.args.syscall_nr) {101101+ case SYS_OPEN: filename_arg = (const void *)args->args[0];102102+ __asm__ __volatile__("": : :"memory");103103+ break;104104+ case SYS_OPENAT: filename_arg = (const void *)args->args[1];105105+ break;106106+ }107107+108108+ if (filename_arg != NULL) {109109+ augmented_args.filename.reserved = 0;110110+ augmented_args.filename.size = probe_read_str(&augmented_args.filename.value,111111+ sizeof(augmented_args.filename.value),112112+ filename_arg);113113+ if (augmented_args.filename.size < sizeof(augmented_args.filename.value)) {114114+ len -= sizeof(augmented_args.filename.value) - augmented_args.filename.size;115115+ len &= sizeof(augmented_args.filename.value) - 1;116116+ }117117+ } else {118118+ len = sizeof(augmented_args.args);119119+ }120120+121121+ perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, &augmented_args, len);122122+ return 0;123123+}124124+125125+SEC("raw_syscalls:sys_exit")126126+int sys_exit(struct syscall_exit_args *args)127127+{128128+ return 1; /* 0 as soon as we start copying data returned by the kernel, e.g. 'read' */129129+}130130+131131+license(GPL);
+38-11
tools/perf/jvmti/jvmti_agent.c
···125125}126126127127static int128128-debug_cache_init(void)128128+create_jit_cache_dir(void)129129{130130 char str[32];131131 char *base, *p;···144144145145 strftime(str, sizeof(str), JIT_LANG"-jit-%Y%m%d", &tm);146146147147- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/", base);148148-147147+ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/", base);148148+ if (ret >= PATH_MAX) {149149+ warnx("jvmti: cannot generate jit cache dir because %s/.debug/"150150+ " is too long, please check the cwd, JITDUMPDIR, and"151151+ " HOME variables", base);152152+ return -1;153153+ }149154 ret = mkdir(jit_path, 0755);150155 if (ret == -1) {151156 if (errno != EEXIST) {···159154 }160155 }161156162162- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit", base);157157+ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit", base);158158+ if (ret >= PATH_MAX) {159159+ warnx("jvmti: cannot generate jit cache dir because"160160+ " %s/.debug/jit is too long, please check the cwd,"161161+ " JITDUMPDIR, and HOME variables", base);162162+ return -1;163163+ }163164 ret = mkdir(jit_path, 0755);164165 if (ret == -1) {165166 if (errno != EEXIST) {166166- warn("cannot create jit cache dir %s", jit_path);167167+ warn("jvmti: cannot create jit cache dir %s", jit_path);167168 return -1;168169 }169170 }170171171171- snprintf(jit_path, PATH_MAX - 1, "%s/.debug/jit/%s.XXXXXXXX", base, str);172172-172172+ ret = snprintf(jit_path, PATH_MAX, "%s/.debug/jit/%s.XXXXXXXX", base, str);173173+ if (ret >= PATH_MAX) {174174+ warnx("jvmti: cannot generate jit cache dir because"175175+ " %s/.debug/jit/%s.XXXXXXXX is too long, please check"176176+ " the cwd, JITDUMPDIR, and HOME variables",177177+ base, str);178178+ return -1;179179+ }173180 p = mkdtemp(jit_path);174181 if (p != jit_path) {175175- warn("cannot create jit cache dir %s", jit_path);182182+ warn("jvmti: cannot create jit cache dir %s", jit_path);176183 return -1;177184 }178185···245228{246229 char dump_path[PATH_MAX];247230 struct jitheader header;248248- int fd;231231+ int fd, ret;249232 FILE *fp;250233251234 init_arch_timestamp();···262245263246 memset(&header, 0, sizeof(header));264247265265- debug_cache_init();248248+ /*249249+ * jitdump file dir250250+ */251251+ if (create_jit_cache_dir() < 0)252252+ return NULL;266253267254 /*268255 * jitdump file name269256 */270270- scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid());257257+ ret = snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid());258258+ if (ret >= PATH_MAX) {259259+ warnx("jvmti: cannot generate jitdump file full path because"260260+ " %s/jit-%i.dump is too long, please check the cwd,"261261+ " JITDUMPDIR, and HOME variables", jit_path, getpid());262262+ return NULL;263263+ }271264272265 fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666);273266 if (fd == -1)
+490-3
tools/perf/scripts/python/exported-sql-viewer.py
···119119 return "[kernel]"120120 return name121121122122+def findnth(s, sub, n, offs=0):123123+ pos = s.find(sub)124124+ if pos < 0:125125+ return pos126126+ if n <= 1:127127+ return offs + pos128128+ return findnth(s[pos + 1:], sub, n - 1, offs + pos + 1)129129+122130# Percent to one decimal place123131124132def PercentToOneDP(n, d):···14721464 else:14731465 self.find_bar.NotFound()1474146614671467+# Dialog data item converted and validated using a SQL table14681468+14691469+class SQLTableDialogDataItem():14701470+14711471+ def __init__(self, glb, label, placeholder_text, table_name, match_column, column_name1, column_name2, parent):14721472+ self.glb = glb14731473+ self.label = label14741474+ self.placeholder_text = placeholder_text14751475+ self.table_name = table_name14761476+ self.match_column = match_column14771477+ self.column_name1 = column_name114781478+ self.column_name2 = column_name214791479+ self.parent = parent14801480+14811481+ self.value = ""14821482+14831483+ self.widget = QLineEdit()14841484+ self.widget.editingFinished.connect(self.Validate)14851485+ self.widget.textChanged.connect(self.Invalidate)14861486+ self.red = False14871487+ self.error = ""14881488+ self.validated = True14891489+14901490+ self.last_id = 014911491+ self.first_time = 014921492+ self.last_time = 2 ** 6414931493+ if self.table_name == "<timeranges>":14941494+ query = QSqlQuery(self.glb.db)14951495+ QueryExec(query, "SELECT id, time FROM samples ORDER BY id DESC LIMIT 1")14961496+ if query.next():14971497+ self.last_id = int(query.value(0))14981498+ self.last_time = int(query.value(1))14991499+ QueryExec(query, "SELECT time FROM samples WHERE time != 0 ORDER BY id LIMIT 1")15001500+ if query.next():15011501+ self.first_time = int(query.value(0))15021502+ if placeholder_text:15031503+ placeholder_text += ", between " + str(self.first_time) + " and " + str(self.last_time)15041504+15051505+ if placeholder_text:15061506+ self.widget.setPlaceholderText(placeholder_text)15071507+15081508+ def ValueToIds(self, value):15091509+ ids = []15101510+ query = QSqlQuery(self.glb.db)15111511+ stmt = "SELECT id FROM " + self.table_name + " WHERE " + self.match_column + " = '" + value + "'"15121512+ ret = query.exec_(stmt)15131513+ if ret:15141514+ while query.next():15151515+ ids.append(str(query.value(0)))15161516+ return ids15171517+15181518+ def IdBetween(self, query, lower_id, higher_id, order):15191519+ QueryExec(query, "SELECT id FROM samples WHERE id > " + str(lower_id) + " AND id < " + str(higher_id) + " ORDER BY id " + order + " LIMIT 1")15201520+ if query.next():15211521+ return True, int(query.value(0))15221522+ else:15231523+ return False, 015241524+15251525+ def BinarySearchTime(self, lower_id, higher_id, target_time, get_floor):15261526+ query = QSqlQuery(self.glb.db)15271527+ while True:15281528+ next_id = int((lower_id + higher_id) / 2)15291529+ QueryExec(query, "SELECT time FROM samples WHERE id = " + str(next_id))15301530+ if not query.next():15311531+ ok, dbid = self.IdBetween(query, lower_id, next_id, "DESC")15321532+ if not ok:15331533+ ok, dbid = self.IdBetween(query, next_id, higher_id, "")15341534+ if not ok:15351535+ return str(higher_id)15361536+ next_id = dbid15371537+ QueryExec(query, "SELECT time FROM samples WHERE id = " + str(next_id))15381538+ next_time = int(query.value(0))15391539+ if get_floor:15401540+ if target_time > next_time:15411541+ lower_id = next_id15421542+ else:15431543+ higher_id = next_id15441544+ if higher_id <= lower_id + 1:15451545+ return str(higher_id)15461546+ else:15471547+ if target_time >= next_time:15481548+ lower_id = next_id15491549+ else:15501550+ higher_id = next_id15511551+ if higher_id <= lower_id + 1:15521552+ return str(lower_id)15531553+15541554+ def ConvertRelativeTime(self, val):15551555+ print "val ", val15561556+ mult = 115571557+ suffix = val[-2:]15581558+ if suffix == "ms":15591559+ mult = 100000015601560+ elif suffix == "us":15611561+ mult = 100015621562+ elif suffix == "ns":15631563+ mult = 115641564+ else:15651565+ return val15661566+ val = val[:-2].strip()15671567+ if not self.IsNumber(val):15681568+ return val15691569+ val = int(val) * mult15701570+ if val >= 0:15711571+ val += self.first_time15721572+ else:15731573+ val += self.last_time15741574+ return str(val)15751575+15761576+ def ConvertTimeRange(self, vrange):15771577+ print "vrange ", vrange15781578+ if vrange[0] == "":15791579+ vrange[0] = str(self.first_time)15801580+ if vrange[1] == "":15811581+ vrange[1] = str(self.last_time)15821582+ vrange[0] = self.ConvertRelativeTime(vrange[0])15831583+ vrange[1] = self.ConvertRelativeTime(vrange[1])15841584+ print "vrange2 ", vrange15851585+ if not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]):15861586+ return False15871587+ print "ok1"15881588+ beg_range = max(int(vrange[0]), self.first_time)15891589+ end_range = min(int(vrange[1]), self.last_time)15901590+ if beg_range > self.last_time or end_range < self.first_time:15911591+ return False15921592+ print "ok2"15931593+ vrange[0] = self.BinarySearchTime(0, self.last_id, beg_range, True)15941594+ vrange[1] = self.BinarySearchTime(1, self.last_id + 1, end_range, False)15951595+ print "vrange3 ", vrange15961596+ return True15971597+15981598+ def AddTimeRange(self, value, ranges):15991599+ print "value ", value16001600+ n = value.count("-")16011601+ if n == 1:16021602+ pass16031603+ elif n == 2:16041604+ if value.split("-")[1].strip() == "":16051605+ n = 116061606+ elif n == 3:16071607+ n = 216081608+ else:16091609+ return False16101610+ pos = findnth(value, "-", n)16111611+ vrange = [value[:pos].strip() ,value[pos+1:].strip()]16121612+ if self.ConvertTimeRange(vrange):16131613+ ranges.append(vrange)16141614+ return True16151615+ return False16161616+16171617+ def InvalidValue(self, value):16181618+ self.value = ""16191619+ palette = QPalette()16201620+ palette.setColor(QPalette.Text,Qt.red)16211621+ self.widget.setPalette(palette)16221622+ self.red = True16231623+ self.error = self.label + " invalid value '" + value + "'"16241624+ self.parent.ShowMessage(self.error)16251625+16261626+ def IsNumber(self, value):16271627+ try:16281628+ x = int(value)16291629+ except:16301630+ x = 016311631+ return str(x) == value16321632+16331633+ def Invalidate(self):16341634+ self.validated = False16351635+16361636+ def Validate(self):16371637+ input_string = self.widget.text()16381638+ self.validated = True16391639+ if self.red:16401640+ palette = QPalette()16411641+ self.widget.setPalette(palette)16421642+ self.red = False16431643+ if not len(input_string.strip()):16441644+ self.error = ""16451645+ self.value = ""16461646+ return16471647+ if self.table_name == "<timeranges>":16481648+ ranges = []16491649+ for value in [x.strip() for x in input_string.split(",")]:16501650+ if not self.AddTimeRange(value, ranges):16511651+ return self.InvalidValue(value)16521652+ ranges = [("(" + self.column_name1 + " >= " + r[0] + " AND " + self.column_name1 + " <= " + r[1] + ")") for r in ranges]16531653+ self.value = " OR ".join(ranges)16541654+ elif self.table_name == "<ranges>":16551655+ singles = []16561656+ ranges = []16571657+ for value in [x.strip() for x in input_string.split(",")]:16581658+ if "-" in value:16591659+ vrange = value.split("-")16601660+ if len(vrange) != 2 or not self.IsNumber(vrange[0]) or not self.IsNumber(vrange[1]):16611661+ return self.InvalidValue(value)16621662+ ranges.append(vrange)16631663+ else:16641664+ if not self.IsNumber(value):16651665+ return self.InvalidValue(value)16661666+ singles.append(value)16671667+ ranges = [("(" + self.column_name1 + " >= " + r[0] + " AND " + self.column_name1 + " <= " + r[1] + ")") for r in ranges]16681668+ if len(singles):16691669+ ranges.append(self.column_name1 + " IN (" + ",".join(singles) + ")")16701670+ self.value = " OR ".join(ranges)16711671+ elif self.table_name:16721672+ all_ids = []16731673+ for value in [x.strip() for x in input_string.split(",")]:16741674+ ids = self.ValueToIds(value)16751675+ if len(ids):16761676+ all_ids.extend(ids)16771677+ else:16781678+ return self.InvalidValue(value)16791679+ self.value = self.column_name1 + " IN (" + ",".join(all_ids) + ")"16801680+ if self.column_name2:16811681+ self.value = "( " + self.value + " OR " + self.column_name2 + " IN (" + ",".join(all_ids) + ") )"16821682+ else:16831683+ self.value = input_string.strip()16841684+ self.error = ""16851685+ self.parent.ClearMessage()16861686+16871687+ def IsValid(self):16881688+ if not self.validated:16891689+ self.Validate()16901690+ if len(self.error):16911691+ self.parent.ShowMessage(self.error)16921692+ return False16931693+ return True16941694+16951695+# Selected branch report creation dialog16961696+16971697+class SelectedBranchDialog(QDialog):16981698+16991699+ def __init__(self, glb, parent=None):17001700+ super(SelectedBranchDialog, self).__init__(parent)17011701+17021702+ self.glb = glb17031703+17041704+ self.name = ""17051705+ self.where_clause = ""17061706+17071707+ self.setWindowTitle("Selected Branches")17081708+ self.setMinimumWidth(600)17091709+17101710+ items = (17111711+ ("Report name:", "Enter a name to appear in the window title bar", "", "", "", ""),17121712+ ("Time ranges:", "Enter time ranges", "<timeranges>", "", "samples.id", ""),17131713+ ("CPUs:", "Enter CPUs or ranges e.g. 0,5-6", "<ranges>", "", "cpu", ""),17141714+ ("Commands:", "Only branches with these commands will be included", "comms", "comm", "comm_id", ""),17151715+ ("PIDs:", "Only branches with these process IDs will be included", "threads", "pid", "thread_id", ""),17161716+ ("TIDs:", "Only branches with these thread IDs will be included", "threads", "tid", "thread_id", ""),17171717+ ("DSOs:", "Only branches with these DSOs will be included", "dsos", "short_name", "samples.dso_id", "to_dso_id"),17181718+ ("Symbols:", "Only branches with these symbols will be included", "symbols", "name", "symbol_id", "to_symbol_id"),17191719+ ("Raw SQL clause: ", "Enter a raw SQL WHERE clause", "", "", "", ""),17201720+ )17211721+ self.data_items = [SQLTableDialogDataItem(glb, *x, parent=self) for x in items]17221722+17231723+ self.grid = QGridLayout()17241724+17251725+ for row in xrange(len(self.data_items)):17261726+ self.grid.addWidget(QLabel(self.data_items[row].label), row, 0)17271727+ self.grid.addWidget(self.data_items[row].widget, row, 1)17281728+17291729+ self.status = QLabel()17301730+17311731+ self.ok_button = QPushButton("Ok", self)17321732+ self.ok_button.setDefault(True)17331733+ self.ok_button.released.connect(self.Ok)17341734+ self.ok_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)17351735+17361736+ self.cancel_button = QPushButton("Cancel", self)17371737+ self.cancel_button.released.connect(self.reject)17381738+ self.cancel_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)17391739+17401740+ self.hbox = QHBoxLayout()17411741+ #self.hbox.addStretch()17421742+ self.hbox.addWidget(self.status)17431743+ self.hbox.addWidget(self.ok_button)17441744+ self.hbox.addWidget(self.cancel_button)17451745+17461746+ self.vbox = QVBoxLayout()17471747+ self.vbox.addLayout(self.grid)17481748+ self.vbox.addLayout(self.hbox)17491749+17501750+ self.setLayout(self.vbox);17511751+17521752+ def Ok(self):17531753+ self.name = self.data_items[0].value17541754+ if not self.name:17551755+ self.ShowMessage("Report name is required")17561756+ return17571757+ for d in self.data_items:17581758+ if not d.IsValid():17591759+ return17601760+ for d in self.data_items[1:]:17611761+ if len(d.value):17621762+ if len(self.where_clause):17631763+ self.where_clause += " AND "17641764+ self.where_clause += d.value17651765+ if len(self.where_clause):17661766+ self.where_clause = " AND ( " + self.where_clause + " ) "17671767+ else:17681768+ self.ShowMessage("No selection")17691769+ return17701770+ self.accept()17711771+17721772+ def ShowMessage(self, msg):17731773+ self.status.setText("<font color=#FF0000>" + msg)17741774+17751775+ def ClearMessage(self):17761776+ self.status.setText("")17771777+14751778# Event list1476177914771780def GetEventList(db):···19751656 def FindDone(self, row):19761657 self.find_bar.Idle()19771658 if row >= 0:19781978- self.view.setCurrentIndex(self.model.index(row, 0, QModelIndex()))16591659+ self.view.setCurrentIndex(self.model.mapFromSource(self.data_model.index(row, 0, QModelIndex())))19791660 else:19801661 self.find_bar.NotFound()19811662···20841765 def setActiveSubWindow(self, nr):20851766 self.mdi_area.setActiveSubWindow(self.mdi_area.subWindowList()[nr - 1])2086176717681768+# Help text17691769+17701770+glb_help_text = """17711771+<h1>Contents</h1>17721772+<style>17731773+p.c1 {17741774+ text-indent: 40px;17751775+}17761776+p.c2 {17771777+ text-indent: 80px;17781778+}17791779+}17801780+</style>17811781+<p class=c1><a href=#reports>1. Reports</a></p>17821782+<p class=c2><a href=#callgraph>1.1 Context-Sensitive Call Graph</a></p>17831783+<p class=c2><a href=#allbranches>1.2 All branches</a></p>17841784+<p class=c2><a href=#selectedbranches>1.3 Selected branches</a></p>17851785+<p class=c1><a href=#tables>2. Tables</a></p>17861786+<h1 id=reports>1. Reports</h1>17871787+<h2 id=callgraph>1.1 Context-Sensitive Call Graph</h2>17881788+The result is a GUI window with a tree representing a context-sensitive17891789+call-graph. Expanding a couple of levels of the tree and adjusting column17901790+widths to suit will display something like:17911791+<pre>17921792+ Call Graph: pt_example17931793+Call Path Object Count Time(ns) Time(%) Branch Count Branch Count(%)17941794+v- ls17951795+ v- 2638:263817961796+ v- _start ld-2.19.so 1 10074071 100.0 211135 100.017971797+ |- unknown unknown 1 13198 0.1 1 0.017981798+ >- _dl_start ld-2.19.so 1 1400980 13.9 19637 9.317991799+ >- _d_linit_internal ld-2.19.so 1 448152 4.4 11094 5.318001800+ v-__libc_start_main@plt ls 1 8211741 81.5 180397 85.418011801+ >- _dl_fixup ld-2.19.so 1 7607 0.1 108 0.118021802+ >- __cxa_atexit libc-2.19.so 1 11737 0.1 10 0.018031803+ >- __libc_csu_init ls 1 10354 0.1 10 0.018041804+ |- _setjmp libc-2.19.so 1 0 0.0 4 0.018051805+ v- main ls 1 8182043 99.6 180254 99.918061806+</pre>18071807+<h3>Points to note:</h3>18081808+<ul>18091809+<li>The top level is a command name (comm)</li>18101810+<li>The next level is a thread (pid:tid)</li>18111811+<li>Subsequent levels are functions</li>18121812+<li>'Count' is the number of calls</li>18131813+<li>'Time' is the elapsed time until the function returns</li>18141814+<li>Percentages are relative to the level above</li>18151815+<li>'Branch Count' is the total number of branches for that function and all functions that it calls18161816+</ul>18171817+<h3>Find</h3>18181818+Ctrl-F displays a Find bar which finds function names by either an exact match or a pattern match.18191819+The pattern matching symbols are ? for any character and * for zero or more characters.18201820+<h2 id=allbranches>1.2 All branches</h2>18211821+The All branches report displays all branches in chronological order.18221822+Not all data is fetched immediately. More records can be fetched using the Fetch bar provided.18231823+<h3>Disassembly</h3>18241824+Open a branch to display disassembly. This only works if:18251825+<ol>18261826+<li>The disassembler is available. Currently, only Intel XED is supported - see <a href=#xed>Intel XED Setup</a></li>18271827+<li>The object code is available. Currently, only the perf build ID cache is searched for object code.18281828+The default directory ~/.debug can be overridden by setting environment variable PERF_BUILDID_DIR.18291829+One exception is kcore where the DSO long name is used (refer dsos_view on the Tables menu),18301830+or alternatively, set environment variable PERF_KCORE to the kcore file name.</li>18311831+</ol>18321832+<h4 id=xed>Intel XED Setup</h4>18331833+To use Intel XED, libxed.so must be present. To build and install libxed.so:18341834+<pre>18351835+git clone https://github.com/intelxed/mbuild.git mbuild18361836+git clone https://github.com/intelxed/xed18371837+cd xed18381838+./mfile.py --share18391839+sudo ./mfile.py --prefix=/usr/local install18401840+sudo ldconfig18411841+</pre>18421842+<h3>Find</h3>18431843+Ctrl-F displays a Find bar which finds substrings by either an exact match or a regular expression match.18441844+Refer to Python documentation for the regular expression syntax.18451845+All columns are searched, but only currently fetched rows are searched.18461846+<h2 id=selectedbranches>1.3 Selected branches</h2>18471847+This is the same as the <a href=#allbranches>All branches</a> report but with the data reduced18481848+by various selection criteria. A dialog box displays available criteria which are AND'ed together.18491849+<h3>1.3.1 Time ranges</h3>18501850+The time ranges hint text shows the total time range. Relative time ranges can also be entered in18511851+ms, us or ns. Also, negative values are relative to the end of trace. Examples:18521852+<pre>18531853+ 81073085947329-81073085958238 From 81073085947329 to 8107308595823818541854+ 100us-200us From 100us to 200us18551855+ 10ms- From 10ms to the end18561856+ -100ns The first 100ns18571857+ -10ms- The last 10ms18581858+</pre>18591859+N.B. Due to the granularity of timestamps, there could be no branches in any given time range.18601860+<h1 id=tables>2. Tables</h1>18611861+The Tables menu shows all tables and views in the database. Most tables have an associated view18621862+which displays the information in a more friendly way. Not all data for large tables is fetched18631863+immediately. More records can be fetched using the Fetch bar provided. Columns can be sorted,18641864+but that can be slow for large tables.18651865+<p>There are also tables of database meta-information.18661866+For SQLite3 databases, the sqlite_master table is included.18671867+For PostgreSQL databases, information_schema.tables/views/columns are included.18681868+<h3>Find</h3>18691869+Ctrl-F displays a Find bar which finds substrings by either an exact match or a regular expression match.18701870+Refer to Python documentation for the regular expression syntax.18711871+All columns are searched, but only currently fetched rows are searched.18721872+<p>N.B. Results are found in id order, so if the table is re-ordered, find-next and find-previous18731873+will go to the next/previous result in id order, instead of display order.18741874+"""18751875+18761876+# Help window18771877+18781878+class HelpWindow(QMdiSubWindow):18791879+18801880+ def __init__(self, glb, parent=None):18811881+ super(HelpWindow, self).__init__(parent)18821882+18831883+ self.text = QTextBrowser()18841884+ self.text.setHtml(glb_help_text)18851885+ self.text.setReadOnly(True)18861886+ self.text.setOpenExternalLinks(True)18871887+18881888+ self.setWidget(self.text)18891889+18901890+ AddSubWindow(glb.mainwindow.mdi_area, self, "Exported SQL Viewer Help")18911891+18921892+# Main window that only displays the help text18931893+18941894+class HelpOnlyWindow(QMainWindow):18951895+18961896+ def __init__(self, parent=None):18971897+ super(HelpOnlyWindow, self).__init__(parent)18981898+18991899+ self.setMinimumSize(200, 100)19001900+ self.resize(800, 600)19011901+ self.setWindowTitle("Exported SQL Viewer Help")19021902+ self.setWindowIcon(self.style().standardIcon(QStyle.SP_MessageBoxInformation))19031903+19041904+ self.text = QTextBrowser()19051905+ self.text.setHtml(glb_help_text)19061906+ self.text.setReadOnly(True)19071907+ self.text.setOpenExternalLinks(True)19081908+19091909+ self.setCentralWidget(self.text)19101910+20871911# Font resize2088191220891913def ResizeFont(widget, diff):···2313185123141852 self.window_menu = WindowMenu(self.mdi_area, menu)2315185318541854+ help_menu = menu.addMenu("&Help")18551855+ help_menu.addAction(CreateAction("&Exported SQL Viewer Help", "Helpful information", self.Help, self, QKeySequence.HelpContents))18561856+23161857 def Find(self):23171858 win = self.mdi_area.activeSubWindow()23181859 if win:···23531888 if event == "branches":23541889 label = "All branches" if branches_events == 1 else "All branches " + "(id=" + dbid + ")"23551890 reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewBranchView(x), self))18911891+ label = "Selected branches" if branches_events == 1 else "Selected branches " + "(id=" + dbid + ")"18921892+ reports_menu.addAction(CreateAction(label, "Create a new window displaying branch events", lambda x=dbid: self.NewSelectedBranchView(x), self))2356189323571894 def TableMenu(self, tables, menu):23581895 table_menu = menu.addMenu("&Tables")···23671900 def NewBranchView(self, event_id):23681901 BranchWindow(self.glb, event_id, "", "", self)2369190219031903+ def NewSelectedBranchView(self, event_id):19041904+ dialog = SelectedBranchDialog(self.glb, self)19051905+ ret = dialog.exec_()19061906+ if ret:19071907+ BranchWindow(self.glb, event_id, dialog.name, dialog.where_clause, self)19081908+23701909 def NewTableView(self, table_name):23711910 TableWindow(self.glb, table_name, self)19111911+19121912+ def Help(self):19131913+ HelpWindow(self.glb, self)2372191423731915# XED Disassembler23741916···24051929class LibXED():2406193024071931 def __init__(self):24082408- self.libxed = CDLL("libxed.so")19321932+ try:19331933+ self.libxed = CDLL("libxed.so")19341934+ except:19351935+ self.libxed = None19361936+ if not self.libxed:19371937+ self.libxed = CDLL("/usr/local/lib/libxed.so")2409193824101939 self.xed_tables_init = self.libxed.xed_tables_init24111940 self.xed_tables_init.restype = None···2578209725792098def Main():25802099 if (len(sys.argv) < 2):25812581- print >> sys.stderr, "Usage is: exported-sql-viewer.py <database name>"21002100+ print >> sys.stderr, "Usage is: exported-sql-viewer.py {<database name> | --help-only}"25822101 raise Exception("Too few arguments")2583210225842103 dbname = sys.argv[1]21042104+ if dbname == "--help-only":21052105+ app = QApplication(sys.argv)21062106+ mainwindow = HelpOnlyWindow()21072107+ mainwindow.show()21082108+ err = app.exec_()21092109+ sys.exit(err)2585211025862111 is_sqlite3 = False25872112 try: