···168168169169Configuration of common clocks, which affect multiple consumer devices can170170be similarly specified in the clock provider node.171171+172172+==Protected clocks==173173+174174+Some platforms or firmwares may not fully expose all the clocks to the OS, such175175+as in situations where those clks are used by drivers running in ARM secure176176+execution levels. Such a configuration can be specified in device tree with the177177+protected-clocks property in the form of a clock specifier list. This property should178178+only be specified in the node that is providing the clocks being protected:179179+180180+ clock-controller@a000f000 {181181+ compatible = "vendor,clk95;182182+ reg = <0xa000f000 0x1000>183183+ #clocks-cells = <1>;184184+ ...185185+ protected-clocks = <UART3_CLK>, <SPI5_CLK>;186186+ };
···1212a set of keys.13131414Required property:1515-sysrq-reset-seq: array of Linux keycodes, one keycode per cell.1515+keyset: array of Linux keycodes, one keycode per cell.16161717Optional property:1818timeout-ms: duration keys must be pressed together in milliseconds before
···11-device-tree bindings for rockchip VPU codec22-33-Rockchip (Video Processing Unit) present in various Rockchip platforms,44-such as RK3288 and RK3399.55-66-Required properties:77-- compatible: value should be one of the following88- "rockchip,rk3288-vpu";99- "rockchip,rk3399-vpu";1010-- interrupts: encoding and decoding interrupt specifiers1111-- interrupt-names: should be "vepu" and "vdpu"1212-- clocks: phandle to VPU aclk, hclk clocks1313-- clock-names: should be "aclk" and "hclk"1414-- power-domains: phandle to power domain node1515-- iommus: phandle to a iommu node1616-1717-Example:1818-SoC-specific DT entry:1919- vpu: video-codec@ff9a0000 {2020- compatible = "rockchip,rk3288-vpu";2121- reg = <0x0 0xff9a0000 0x0 0x800>;2222- interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,2323- <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;2424- interrupt-names = "vepu", "vdpu";2525- clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;2626- clock-names = "aclk", "hclk";2727- power-domains = <&power RK3288_PD_VIDEO>;2828- iommus = <&vpu_mmu>;2929- };
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _media_ioc_request_alloc:428
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _media_request_ioc_queue:428
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _media_request_ioc_reinit:428
+25-1
Documentation/media/uapi/mediactl/request-api.rst
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _media-request-api:428
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _request-func-close:428
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _request-func-ioctl:428
···11-.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections11+.. This file is dual-licensed: you can use it either under the terms22+.. of the GPL or the GFDL 1.1+ license, at your option. Note that this33+.. dual licensing only applies to this file, and not this project as a44+.. whole.55+..66+.. a) This file is free software; you can redistribute it and/or77+.. modify it under the terms of the GNU General Public License as88+.. published by the Free Software Foundation; either version 2 of99+.. the License, or (at your option) any later version.1010+..1111+.. This file is distributed in the hope that it will be useful,1212+.. but WITHOUT ANY WARRANTY; without even the implied warranty of1313+.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+.. GNU General Public License for more details.1515+..1616+.. Or, alternatively,1717+..1818+.. b) Permission is granted to copy, distribute and/or modify this1919+.. document under the terms of the GNU Free Documentation License,2020+.. Version 1.1 or any later version published by the Free Software2121+.. Foundation, with no Invariant Sections, no Front-Cover Texts2222+.. and no Back-Cover Texts. A copy of the license is included at2323+.. Documentation/media/uapi/fdl-appendix.rst.2424+..2525+.. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections226327.. _request-func-poll:428
···109109110110choice111111 prompt "ARC Instruction Set"112112- default ISA_ARCOMPACT112112+ default ISA_ARCV2113113114114config ISA_ARCOMPACT115115 bool "ARCompact ISA"···176176177177config CPU_BIG_ENDIAN178178 bool "Enable Big Endian Mode"179179- default n180179 help181180 Build kernel for Big Endian Mode of ARC CPU182181183182config SMP184183 bool "Symmetric Multi-Processing"185185- default n186184 select ARC_MCIP if ISA_ARCV2187185 help188186 This enables support for systems with more than one CPU.···252254config ARC_CACHE_VIPT_ALIASING253255 bool "Support VIPT Aliasing D$"254256 depends on ARC_HAS_DCACHE && ISA_ARCOMPACT255255- default n256257257258endif #ARC_CACHE258259···259262 bool "Use ICCM"260263 help261264 Single Cycle RAMS to store Fast Path Code262262- default n263265264266config ARC_ICCM_SZ265267 int "ICCM Size in KB"···269273 bool "Use DCCM"270274 help271275 Single Cycle RAMS to store Fast Path Data272272- default n273276274277config ARC_DCCM_SZ275278 int "DCCM Size in KB"···361366362367config ARC_COMPACT_IRQ_LEVELS363368 bool "Setup Timer IRQ as high Priority"364364- default n365369 # if SMP, LV2 enabled ONLY if ARC implementation has LV2 re-entrancy366370 depends on !SMP367371368372config ARC_FPU_SAVE_RESTORE369373 bool "Enable FPU state persistence across context switch"370370- default n371374 help372375 Double Precision Floating Point unit had dedicated regs which373376 need to be saved/restored across context-switch.···446453447454config ARC_HAS_PAE40448455 bool "Support for the 40-bit Physical Address Extension"449449- default n450456 depends on ISA_ARCV2451457 select HIGHMEM452458 select PHYS_ADDR_T_64BIT···488496489497config ARC_METAWARE_HLINK490498 bool "Support for Metaware debugger assisted Host access"491491- default n492499 help493500 This options allows a Linux userland apps to directly access494501 host file system (open/creat/read/write etc) with help from···515524516525config ARC_DBG_TLB_PARANOIA517526 bool "Paranoia Checks in Low Level TLB Handlers"518518- default n519527520528endif521529522530config ARC_UBOOT_SUPPORT523531 bool "Support uboot arg Handling"524524- default n525532 help526533 ARC Linux by default checks for uboot provided args as pointers to527534 external cmdline or DTB. This however breaks in absence of uboot,
+1-1
arch/arc/Makefile
···66# published by the Free Software Foundation.77#8899-KBUILD_DEFCONFIG := nsim_700_defconfig99+KBUILD_DEFCONFIG := nsim_hs_defconfig10101111cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__1212cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
···1414# CONFIG_VM_EVENT_COUNTERS is not set1515# CONFIG_SLUB_DEBUG is not set1616# CONFIG_COMPAT_BRK is not set1717+CONFIG_ISA_ARCOMPACT=y1718CONFIG_MODULES=y1819CONFIG_MODULE_FORCE_LOAD=y1920CONFIG_MODULE_UNLOAD=y···9695CONFIG_NTFS_FS=y9796CONFIG_TMPFS=y9897CONFIG_NFS_FS=y9898+CONFIG_NFS_V3_ACL=y9999CONFIG_NLS_CODEPAGE_437=y100100CONFIG_NLS_ISO8859_1=y101101# CONFIG_ENABLE_WARN_DEPRECATED is not set
+1
arch/arc/configs/axs103_defconfig
···9494CONFIG_NTFS_FS=y9595CONFIG_TMPFS=y9696CONFIG_NFS_FS=y9797+CONFIG_NFS_V3_ACL=y9798CONFIG_NLS_CODEPAGE_437=y9899CONFIG_NLS_ISO8859_1=y99100# CONFIG_ENABLE_WARN_DEPRECATED is not set
+1
arch/arc/configs/axs103_smp_defconfig
···9797CONFIG_NTFS_FS=y9898CONFIG_TMPFS=y9999CONFIG_NFS_FS=y100100+CONFIG_NFS_V3_ACL=y100101CONFIG_NLS_CODEPAGE_437=y101102CONFIG_NLS_ISO8859_1=y102103# CONFIG_ENABLE_WARN_DEPRECATED is not set
+4
arch/arc/configs/hsdk_defconfig
···4545CONFIG_SERIAL_8250_DW=y4646CONFIG_SERIAL_OF_PLATFORM=y4747# CONFIG_HW_RANDOM is not set4848+CONFIG_GPIOLIB=y4949+CONFIG_GPIO_SYSFS=y5050+CONFIG_GPIO_DWAPB=y4851# CONFIG_HWMON is not set4952CONFIG_DRM=y5053# CONFIG_DRM_FBDEV_EMULATION is not set···6865CONFIG_VFAT_FS=y6966CONFIG_TMPFS=y7067CONFIG_NFS_FS=y6868+CONFIG_NFS_V3_ACL=y7169CONFIG_NLS_CODEPAGE_437=y7270CONFIG_NLS_ISO8859_1=y7371# CONFIG_ENABLE_WARN_DEPRECATED is not set
+2
arch/arc/configs/nps_defconfig
···1515CONFIG_EMBEDDED=y1616CONFIG_PERF_EVENTS=y1717# CONFIG_COMPAT_BRK is not set1818+CONFIG_ISA_ARCOMPACT=y1819CONFIG_KPROBES=y1920CONFIG_MODULES=y2021CONFIG_MODULE_FORCE_LOAD=y···7473CONFIG_TMPFS=y7574# CONFIG_MISC_FILESYSTEMS is not set7675CONFIG_NFS_FS=y7676+CONFIG_NFS_V3_ACL=y7777CONFIG_ROOT_NFS=y7878CONFIG_DEBUG_INFO=y7979# CONFIG_ENABLE_WARN_DEPRECATED is not set
+1
arch/arc/configs/nsim_700_defconfig
···1515CONFIG_PERF_EVENTS=y1616# CONFIG_SLUB_DEBUG is not set1717# CONFIG_COMPAT_BRK is not set1818+CONFIG_ISA_ARCOMPACT=y1819CONFIG_KPROBES=y1920CONFIG_MODULES=y2021# CONFIG_LBDAF is not set
+2
arch/arc/configs/nsimosci_defconfig
···1515CONFIG_PERF_EVENTS=y1616# CONFIG_SLUB_DEBUG is not set1717# CONFIG_COMPAT_BRK is not set1818+CONFIG_ISA_ARCOMPACT=y1819CONFIG_KPROBES=y1920CONFIG_MODULES=y2021# CONFIG_LBDAF is not set···6766CONFIG_TMPFS=y6867# CONFIG_MISC_FILESYSTEMS is not set6968CONFIG_NFS_FS=y6969+CONFIG_NFS_V3_ACL=y7070# CONFIG_ENABLE_WARN_DEPRECATED is not set7171# CONFIG_ENABLE_MUST_CHECK is not set
+1
arch/arc/configs/nsimosci_hs_defconfig
···6565CONFIG_TMPFS=y6666# CONFIG_MISC_FILESYSTEMS is not set6767CONFIG_NFS_FS=y6868+CONFIG_NFS_V3_ACL=y6869# CONFIG_ENABLE_WARN_DEPRECATED is not set6970# CONFIG_ENABLE_MUST_CHECK is not set
+1
arch/arc/configs/nsimosci_hs_smp_defconfig
···7676CONFIG_TMPFS=y7777# CONFIG_MISC_FILESYSTEMS is not set7878CONFIG_NFS_FS=y7979+CONFIG_NFS_V3_ACL=y7980# CONFIG_ENABLE_WARN_DEPRECATED is not set8081# CONFIG_ENABLE_MUST_CHECK is not set8182CONFIG_FTRACE=y
+1
arch/arc/configs/tb10x_defconfig
···1919# CONFIG_AIO is not set2020CONFIG_EMBEDDED=y2121# CONFIG_COMPAT_BRK is not set2222+CONFIG_ISA_ARCOMPACT=y2223CONFIG_SLAB=y2324CONFIG_MODULES=y2425CONFIG_MODULE_FORCE_LOAD=y
+1
arch/arc/configs/vdk_hs38_defconfig
···8585CONFIG_TMPFS=y8686CONFIG_JFFS2_FS=y8787CONFIG_NFS_FS=y8888+CONFIG_NFS_V3_ACL=y8889CONFIG_NLS_CODEPAGE_437=y8990CONFIG_NLS_ISO8859_1=y9091# CONFIG_ENABLE_WARN_DEPRECATED is not set
+1
arch/arc/configs/vdk_hs38_smp_defconfig
···9090CONFIG_TMPFS=y9191CONFIG_JFFS2_FS=y9292CONFIG_NFS_FS=y9393+CONFIG_NFS_V3_ACL=y9394CONFIG_NLS_CODEPAGE_437=y9495CONFIG_NLS_ISO8859_1=y9596# CONFIG_ENABLE_WARN_DEPRECATED is not set
···1212#include <linux/types.h>1313#include <asm/byteorder.h>1414#include <asm/page.h>1515+#include <asm/unaligned.h>15161617#ifdef CONFIG_ISA_ARCV21718#include <asm/barrier.h>···9594 return w;9695}97969797+/*9898+ * {read,write}s{b,w,l}() repeatedly access the same IO address in9999+ * native endianness in 8-, 16-, 32-bit chunks {into,from} memory,100100+ * @count times101101+ */102102+#define __raw_readsx(t,f) \103103+static inline void __raw_reads##f(const volatile void __iomem *addr, \104104+ void *ptr, unsigned int count) \105105+{ \106106+ bool is_aligned = ((unsigned long)ptr % ((t) / 8)) == 0; \107107+ u##t *buf = ptr; \108108+ \109109+ if (!count) \110110+ return; \111111+ \112112+ /* Some ARC CPU's don't support unaligned accesses */ \113113+ if (is_aligned) { \114114+ do { \115115+ u##t x = __raw_read##f(addr); \116116+ *buf++ = x; \117117+ } while (--count); \118118+ } else { \119119+ do { \120120+ u##t x = __raw_read##f(addr); \121121+ put_unaligned(x, buf++); \122122+ } while (--count); \123123+ } \124124+}125125+126126+#define __raw_readsb __raw_readsb127127+__raw_readsx(8, b)128128+#define __raw_readsw __raw_readsw129129+__raw_readsx(16, w)130130+#define __raw_readsl __raw_readsl131131+__raw_readsx(32, l)132132+98133#define __raw_writeb __raw_writeb99134static inline void __raw_writeb(u8 b, volatile void __iomem *addr)100135{···163126164127}165128129129+#define __raw_writesx(t,f) \130130+static inline void __raw_writes##f(volatile void __iomem *addr, \131131+ const void *ptr, unsigned int count) \132132+{ \133133+ bool is_aligned = ((unsigned long)ptr % ((t) / 8)) == 0; \134134+ const u##t *buf = ptr; \135135+ \136136+ if (!count) \137137+ return; \138138+ \139139+ /* Some ARC CPU's don't support unaligned accesses */ \140140+ if (is_aligned) { \141141+ do { \142142+ __raw_write##f(*buf++, addr); \143143+ } while (--count); \144144+ } else { \145145+ do { \146146+ __raw_write##f(get_unaligned(buf++), addr); \147147+ } while (--count); \148148+ } \149149+}150150+151151+#define __raw_writesb __raw_writesb152152+__raw_writesx(8, b)153153+#define __raw_writesw __raw_writesw154154+__raw_writesx(16, w)155155+#define __raw_writesl __raw_writesl156156+__raw_writesx(32, l)157157+166158/*167159 * MMIO can also get buffered/optimized in micro-arch, so barriers needed168160 * Based on ARM model for the typical use case···207141#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })208142#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })209143#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })144144+#define readsb(p,d,l) ({ __raw_readsb(p,d,l); __iormb(); })145145+#define readsw(p,d,l) ({ __raw_readsw(p,d,l); __iormb(); })146146+#define readsl(p,d,l) ({ __raw_readsl(p,d,l); __iormb(); })210147211148#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })212149#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })213150#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })151151+#define writesb(p,d,l) ({ __iowmb(); __raw_writesb(p,d,l); })152152+#define writesw(p,d,l) ({ __iowmb(); __raw_writesw(p,d,l); })153153+#define writesl(p,d,l) ({ __iowmb(); __raw_writesl(p,d,l); })214154215155/*216156 * Relaxed API for drivers which can handle barrier ordering themselves
+6-3
arch/arc/kernel/setup.c
···243243{244244 struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id];245245 struct bcr_identity *core = &cpu->core;246246- int i, n = 0;246246+ int i, n = 0, ua = 0;247247248248 FIX_PTR(cpu);249249···263263 IS_AVAIL2(cpu->extn.rtc, "RTC [UP 64-bit] ", CONFIG_ARC_TIMERS_64BIT),264264 IS_AVAIL2(cpu->extn.gfrc, "GFRC [SMP 64-bit] ", CONFIG_ARC_TIMERS_64BIT));265265266266- n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s",266266+#ifdef __ARC_UNALIGNED__267267+ ua = 1;268268+#endif269269+ n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s%s",267270 IS_AVAIL2(cpu->isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC),268271 IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64),269269- IS_AVAIL1(cpu->isa.unalign, "unalign (not used)"));272272+ IS_AVAIL1(cpu->isa.unalign, "unalign "), IS_USED_RUN(ua));270273271274 if (i)272275 n += scnprintf(buf + n, len - n, "\n\t\t: ");
+17-3
arch/arc/mm/cache.c
···11451145 unsigned int ioc_base, mem_sz;1146114611471147 /*11481148+ * If IOC was already enabled (due to bootloader) it technically needs to11491149+ * be reconfigured with aperture base,size corresponding to Linux memory map11501150+ * which will certainly be different than uboot's. But disabling and11511151+ * reenabling IOC when DMA might be potentially active is tricky business.11521152+ * To avoid random memory issues later, just panic here and ask user to11531153+ * upgrade bootloader to one which doesn't enable IOC11541154+ */11551155+ if (read_aux_reg(ARC_REG_IO_COH_ENABLE) & ARC_IO_COH_ENABLE_BIT)11561156+ panic("IOC already enabled, please upgrade bootloader!\n");11571157+11581158+ if (!ioc_enable)11591159+ return;11601160+11611161+ /*11481162 * As for today we don't support both IOC and ZONE_HIGHMEM enabled11491163 * simultaneously. This happens because as of today IOC aperture covers11501164 * only ZONE_NORMAL (low mem) and any dma transactions outside this···12011187 panic("IOC Aperture start must be aligned to the size of the aperture");1202118812031189 write_aux_reg(ARC_REG_IO_COH_AP0_BASE, ioc_base >> 12);12041204- write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1);12051205- write_aux_reg(ARC_REG_IO_COH_ENABLE, 1);11901190+ write_aux_reg(ARC_REG_IO_COH_PARTIAL, ARC_IO_COH_PARTIAL_BIT);11911191+ write_aux_reg(ARC_REG_IO_COH_ENABLE, ARC_IO_COH_ENABLE_BIT);1206119212071193 /* Re-enable L1 dcache */12081194 __dc_enable();···12791265 if (is_isa_arcv2() && l2_line_sz && !slc_enable)12801266 arc_slc_disable();1281126712821282- if (is_isa_arcv2() && ioc_enable)12681268+ if (is_isa_arcv2() && ioc_exists)12831269 arc_ioc_setup();1284127012851271 if (is_isa_arcv2() && l2_line_sz && slc_enable) {
+1-1
arch/arc/mm/fault.c
···6666 struct vm_area_struct *vma = NULL;6767 struct task_struct *tsk = current;6868 struct mm_struct *mm = tsk->mm;6969- int si_code;6969+ int si_code = 0;7070 int ret;7171 vm_fault_t fault;7272 int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */
+5-3
arch/arm/mm/cache-v7.S
···360360 ALT_UP(W(nop))361361#endif362362 mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line363363+ addne r0, r0, r2363364364365 tst r1, r3365366 bic r1, r1, r3366367 mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D / U line367367-1:368368- mcr p15, 0, r0, c7, c6, 1 @ invalidate D / U line369369- add r0, r0, r2370368 cmp r0, r1369369+1:370370+ mcrlo p15, 0, r0, c7, c6, 1 @ invalidate D / U line371371+ addlo r0, r0, r2372372+ cmplo r0, r1371373 blo 1b372374 dsb st373375 ret lr
+9-5
arch/arm/mm/cache-v7m.S
···7373/*7474 * dcimvac: Invalidate data cache line by MVA to PoC7575 */7676-.macro dcimvac, rt, tmp7777- v7m_cacheop \rt, \tmp, V7M_SCB_DCIMVAC7676+.irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo7777+.macro dcimvac\c, rt, tmp7878+ v7m_cacheop \rt, \tmp, V7M_SCB_DCIMVAC, \c7879.endm8080+.endr79818082/*8183 * dccmvau: Clean data cache line by MVA to PoU···371369 tst r0, r3372370 bic r0, r0, r3373371 dccimvacne r0, r3372372+ addne r0, r0, r2374373 subne r3, r2, #1 @ restore r3, corrupted by v7m's dccimvac375374 tst r1, r3376375 bic r1, r1, r3377376 dccimvacne r1, r3378378-1:379379- dcimvac r0, r3380380- add r0, r0, r2381377 cmp r0, r1378378+1:379379+ dcimvaclo r0, r3380380+ addlo r0, r0, r2381381+ cmplo r0, r1382382 blo 1b383383 dsb st384384 ret lr
+1-1
arch/arm/mm/dma-mapping.c
···829829 void *cpu_addr, dma_addr_t dma_addr, size_t size,830830 unsigned long attrs)831831{832832- int ret;832832+ int ret = -ENXIO;833833 unsigned long nr_vma_pages = vma_pages(vma);834834 unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;835835 unsigned long pfn = dma_to_pfn(dev, dma_addr);
+10
arch/arm/mm/proc-macros.S
···274274 .endm275275276276.macro define_processor_functions name:req, dabort:req, pabort:req, nommu=0, suspend=0, bugs=0277277+/*278278+ * If we are building for big.Little with branch predictor hardening,279279+ * we need the processor function tables to remain available after boot.280280+ */281281+#if 1 // defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)282282+ .section ".rodata"283283+#endif277284 .type \name\()_processor_functions, #object278285 .align 2279286ENTRY(\name\()_processor_functions)···316309 .endif317310318311 .size \name\()_processor_functions, . - \name\()_processor_functions312312+#if 1 // defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)313313+ .previous314314+#endif319315.endm320316321317.macro define_cache_functions name:req
+1-1
arch/arm/probes/kprobes/opt-arm.c
···247247 }248248249249 /* Copy arch-dep-instance from template. */250250- memcpy(code, &optprobe_template_entry,250250+ memcpy(code, (unsigned char *)optprobe_template_entry,251251 TMPL_END_IDX * sizeof(kprobe_opcode_t));252252253253 /* Adjust buffer according to instruction. */
···7171KBUILD_CFLAGS_KERNEL += -mlong-calls7272endif73737474+# Without this, "ld -r" results in .text sections that are too big (> 0x40000)7575+# for branches to reach stubs. And multiple .text sections trigger a warning7676+# when creating the sysfs module information section.7777+ifndef CONFIG_64BIT7878+KBUILD_CFLAGS_MODULE += -ffunction-sections7979+endif8080+7481# select which processor to optimise for7582cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=71007683cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200
+66
arch/powerpc/net/bpf_jit_comp64.c
···891891 return 0;892892}893893894894+/* Fix the branch target addresses for subprog calls */895895+static int bpf_jit_fixup_subprog_calls(struct bpf_prog *fp, u32 *image,896896+ struct codegen_context *ctx, u32 *addrs)897897+{898898+ const struct bpf_insn *insn = fp->insnsi;899899+ bool func_addr_fixed;900900+ u64 func_addr;901901+ u32 tmp_idx;902902+ int i, ret;903903+904904+ for (i = 0; i < fp->len; i++) {905905+ /*906906+ * During the extra pass, only the branch target addresses for907907+ * the subprog calls need to be fixed. All other instructions908908+ * can left untouched.909909+ *910910+ * The JITed image length does not change because we already911911+ * ensure that the JITed instruction sequence for these calls912912+ * are of fixed length by padding them with NOPs.913913+ */914914+ if (insn[i].code == (BPF_JMP | BPF_CALL) &&915915+ insn[i].src_reg == BPF_PSEUDO_CALL) {916916+ ret = bpf_jit_get_func_addr(fp, &insn[i], true,917917+ &func_addr,918918+ &func_addr_fixed);919919+ if (ret < 0)920920+ return ret;921921+922922+ /*923923+ * Save ctx->idx as this would currently point to the924924+ * end of the JITed image and set it to the offset of925925+ * the instruction sequence corresponding to the926926+ * subprog call temporarily.927927+ */928928+ tmp_idx = ctx->idx;929929+ ctx->idx = addrs[i] / 4;930930+ bpf_jit_emit_func_call_rel(image, ctx, func_addr);931931+932932+ /*933933+ * Restore ctx->idx here. This is safe as the length934934+ * of the JITed sequence remains unchanged.935935+ */936936+ ctx->idx = tmp_idx;937937+ }938938+ }939939+940940+ return 0;941941+}942942+894943struct powerpc64_jit_data {895944 struct bpf_binary_header *header;896945 u32 *addrs;···1038989skip_init_ctx:1039990 code_base = (u32 *)(image + FUNCTION_DESCR_SIZE);1040991992992+ if (extra_pass) {993993+ /*994994+ * Do not touch the prologue and epilogue as they will remain995995+ * unchanged. Only fix the branch target address for subprog996996+ * calls in the body.997997+ *998998+ * This does not change the offsets and lengths of the subprog999999+ * call instruction sequences and hence, the size of the JITed10001000+ * image as well.10011001+ */10021002+ bpf_jit_fixup_subprog_calls(fp, code_base, &cgctx, addrs);10031003+10041004+ /* There is no need to perform the usual passes. */10051005+ goto skip_codegen_passes;10061006+ }10071007+10411008 /* Code generation passes 1-2 */10421009 for (pass = 1; pass < 3; pass++) {10431010 /* Now build the prologue, body code & epilogue for real. */···10671002 proglen - (cgctx.idx * 4), cgctx.seen);10681003 }1069100410051005+skip_codegen_passes:10701006 if (bpf_jit_enable > 1)10711007 /*10721008 * Note that we output the base address of the code_base
···683683 regs->tpc -= 4;684684 regs->tnpc -= 4;685685 pt_regs_clear_syscall(regs);686686+ /* fall through */686687 case ERESTART_RESTARTBLOCK:687688 regs->u_regs[UREG_G1] = __NR_restart_syscall;688689 regs->tpc -= 4;
+1
arch/sparc/kernel/signal_32.c
···508508 regs->pc -= 4;509509 regs->npc -= 4;510510 pt_regs_clear_syscall(regs);511511+ /* fall through */511512 case ERESTART_RESTARTBLOCK:512513 regs->u_regs[UREG_G1] = __NR_restart_syscall;513514 regs->pc -= 4;
+1
arch/sparc/kernel/signal_64.c
···533533 regs->tpc -= 4;534534 regs->tnpc -= 4;535535 pt_regs_clear_syscall(regs);536536+ /* fall through */536537 case ERESTART_RESTARTBLOCK:537538 regs->u_regs[UREG_G1] = __NR_restart_syscall;538539 regs->tpc -= 4;
+7-3
arch/x86/Makefile
···220220221221# Avoid indirect branches in kernel to deal with Spectre222222ifdef CONFIG_RETPOLINE223223-ifeq ($(RETPOLINE_CFLAGS),)224224- $(error You are building kernel with non-retpoline compiler, please update your compiler.)225225-endif226223 KBUILD_CFLAGS += $(RETPOLINE_CFLAGS)227224endif228225···303306ifndef CC_HAVE_ASM_GOTO304307 @echo Compiler lacks asm-goto support.305308 @exit 1309309+endif310310+ifdef CONFIG_RETPOLINE311311+ifeq ($(RETPOLINE_CFLAGS),)312312+ @echo "You are building kernel with non-retpoline compiler." >&2313313+ @echo "Please update your compiler." >&2314314+ @false315315+endif306316endif307317308318archclean:
···3636 */3737 if (boot_params->sentinel) {3838 /* fields in boot_params are left uninitialized, clear them */3939+ boot_params->acpi_rsdp_addr = 0;3940 memset(&boot_params->ext_ramdisk_image, 0,4041 (char *)&boot_params->efi_info -4142 (char *)&boot_params->ext_ramdisk_image);
+1-1
arch/x86/kernel/kprobes/opt.c
···189189 int len = 0, ret;190190191191 while (len < RELATIVEJUMP_SIZE) {192192- ret = __copy_instruction(dest + len, src + len, real, &insn);192192+ ret = __copy_instruction(dest + len, src + len, real + len, &insn);193193 if (!ret || !can_boost(&insn, src + len))194194 return -EINVAL;195195 len += ret;
···638638 bfqd->queue_weights_tree.rb_node->rb_right)639639#ifdef CONFIG_BFQ_GROUP_IOSCHED640640 ) ||641641- (bfqd->num_active_groups > 0641641+ (bfqd->num_groups_with_pending_reqs > 0642642#endif643643 );644644}···802802 */803803 break;804804 }805805- bfqd->num_active_groups--;805805+806806+ /*807807+ * The decrement of num_groups_with_pending_reqs is808808+ * not performed immediately upon the deactivation of809809+ * entity, but it is delayed to when it also happens810810+ * that the first leaf descendant bfqq of entity gets811811+ * all its pending requests completed. The following812812+ * instructions perform this delayed decrement, if813813+ * needed. See the comments on814814+ * num_groups_with_pending_reqs for details.815815+ */816816+ if (entity->in_groups_with_pending_reqs) {817817+ entity->in_groups_with_pending_reqs = false;818818+ bfqd->num_groups_with_pending_reqs--;819819+ }806820 }807821}808822···35433529 * fact, if there are active groups, then, for condition (i)35443530 * to become false, it is enough that an active group contains35453531 * more active processes or sub-groups than some other active35463546- * group. We address this issue with the following bi-modal35473547- * behavior, implemented in the function35323532+ * group. More precisely, for condition (i) to hold because of35333533+ * such a group, it is not even necessary that the group is35343534+ * (still) active: it is sufficient that, even if the group35353535+ * has become inactive, some of its descendant processes still35363536+ * have some request already dispatched but still waiting for35373537+ * completion. In fact, requests have still to be guaranteed35383538+ * their share of the throughput even after being35393539+ * dispatched. In this respect, it is easy to show that, if a35403540+ * group frequently becomes inactive while still having35413541+ * in-flight requests, and if, when this happens, the group is35423542+ * not considered in the calculation of whether the scenario35433543+ * is asymmetric, then the group may fail to be guaranteed its35443544+ * fair share of the throughput (basically because idling may35453545+ * not be performed for the descendant processes of the group,35463546+ * but it had to be). We address this issue with the35473547+ * following bi-modal behavior, implemented in the function35483548 * bfq_symmetric_scenario().35493549 *35503550- * If there are active groups, then the scenario is tagged as35503550+ * If there are groups with requests waiting for completion35513551+ * (as commented above, some of these groups may even be35523552+ * already inactive), then the scenario is tagged as35513553 * asymmetric, conservatively, without checking any of the35523554 * conditions (i) and (ii). So the device is idled for bfqq.35533555 * This behavior matches also the fact that groups are created35543554- * exactly if controlling I/O (to preserve bandwidth and35553555- * latency guarantees) is a primary concern.35563556+ * exactly if controlling I/O is a primary concern (to35573557+ * preserve bandwidth and latency guarantees).35563558 *35573557- * On the opposite end, if there are no active groups, then35583558- * only condition (i) is actually controlled, i.e., provided35593559- * that condition (i) holds, idling is not performed,35603560- * regardless of whether condition (ii) holds. In other words,35613561- * only if condition (i) does not hold, then idling is35623562- * allowed, and the device tends to be prevented from queueing35633563- * many requests, possibly of several processes. Since there35643564- * are no active groups, then, to control condition (i) it is35653565- * enough to check whether all active queues have the same35663566- * weight.35593559+ * On the opposite end, if there are no groups with requests35603560+ * waiting for completion, then only condition (i) is actually35613561+ * controlled, i.e., provided that condition (i) holds, idling35623562+ * is not performed, regardless of whether condition (ii)35633563+ * holds. In other words, only if condition (i) does not hold,35643564+ * then idling is allowed, and the device tends to be35653565+ * prevented from queueing many requests, possibly of several35663566+ * processes. Since there are no groups with requests waiting35673567+ * for completion, then, to control condition (i) it is enough35683568+ * to check just whether all the queues with requests waiting35693569+ * for completion also have the same weight.35673570 *35683571 * Not checking condition (ii) evidently exposes bfqq to the35693572 * risk of getting less throughput than its fair share.···36383607 * bfqq is weight-raised is checked explicitly here. More36393608 * precisely, the compound condition below takes into account36403609 * also the fact that, even if bfqq is being weight-raised,36413641- * the scenario is still symmetric if all active queues happen36423642- * to be weight-raised. Actually, we should be even more36433643- * precise here, and differentiate between interactive weight36443644- * raising and soft real-time weight raising.36103610+ * the scenario is still symmetric if all queues with requests36113611+ * waiting for completion happen to be36123612+ * weight-raised. Actually, we should be even more precise36133613+ * here, and differentiate between interactive weight raising36143614+ * and soft real-time weight raising.36453615 *36463616 * As a side note, it is worth considering that the above36473617 * device-idling countermeasures may however fail in the···54495417 bfqd->idle_slice_timer.function = bfq_idle_slice_timer;5450541854515419 bfqd->queue_weights_tree = RB_ROOT;54525452- bfqd->num_active_groups = 0;54205420+ bfqd->num_groups_with_pending_reqs = 0;5453542154545422 INIT_LIST_HEAD(&bfqd->active_list);54555423 INIT_LIST_HEAD(&bfqd->idle_list);
+49-2
block/bfq-iosched.h
···196196197197 /* flag, set to request a weight, ioprio or ioprio_class change */198198 int prio_changed;199199+200200+ /* flag, set if the entity is counted in groups_with_pending_reqs */201201+ bool in_groups_with_pending_reqs;199202};200203201204struct bfq_group;···451448 * bfq_weights_tree_[add|remove] for further details).452449 */453450 struct rb_root queue_weights_tree;451451+454452 /*455455- * number of groups with requests still waiting for completion453453+ * Number of groups with at least one descendant process that454454+ * has at least one request waiting for completion. Note that455455+ * this accounts for also requests already dispatched, but not456456+ * yet completed. Therefore this number of groups may differ457457+ * (be larger) than the number of active groups, as a group is458458+ * considered active only if its corresponding entity has459459+ * descendant queues with at least one request queued. This460460+ * number is used to decide whether a scenario is symmetric.461461+ * For a detailed explanation see comments on the computation462462+ * of the variable asymmetric_scenario in the function463463+ * bfq_better_to_idle().464464+ *465465+ * However, it is hard to compute this number exactly, for466466+ * groups with multiple descendant processes. Consider a group467467+ * that is inactive, i.e., that has no descendant process with468468+ * pending I/O inside BFQ queues. Then suppose that469469+ * num_groups_with_pending_reqs is still accounting for this470470+ * group, because the group has descendant processes with some471471+ * I/O request still in flight. num_groups_with_pending_reqs472472+ * should be decremented when the in-flight request of the473473+ * last descendant process is finally completed (assuming that474474+ * nothing else has changed for the group in the meantime, in475475+ * terms of composition of the group and active/inactive state of child476476+ * groups and processes). To accomplish this, an additional477477+ * pending-request counter must be added to entities, and must478478+ * be updated correctly. To avoid this additional field and operations,479479+ * we resort to the following tradeoff between simplicity and480480+ * accuracy: for an inactive group that is still counted in481481+ * num_groups_with_pending_reqs, we decrement482482+ * num_groups_with_pending_reqs when the first descendant483483+ * process of the group remains with no request waiting for484484+ * completion.485485+ *486486+ * Even this simpler decrement strategy requires a little487487+ * carefulness: to avoid multiple decrements, we flag a group,488488+ * more precisely an entity representing a group, as still489489+ * counted in num_groups_with_pending_reqs when it becomes490490+ * inactive. Then, when the first descendant queue of the491491+ * entity remains with no request waiting for completion,492492+ * num_groups_with_pending_reqs is decremented, and this flag493493+ * is reset. After this flag is reset for the entity,494494+ * num_groups_with_pending_reqs won't be decremented any495495+ * longer in case a new descendant queue of the entity remains496496+ * with no request waiting for completion.456497 */457457- unsigned int num_active_groups;498498+ unsigned int num_groups_with_pending_reqs;458499459500 /*460501 * Number of bfq_queues containing requests (including the
···17641764 if (bypass_insert)17651765 return BLK_STS_RESOURCE;1766176617671767- blk_mq_sched_insert_request(rq, false, run_queue, false);17671767+ blk_mq_request_bypass_insert(rq, run_queue);17681768 return BLK_STS_OK;17691769}17701770···1780178017811781 ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false);17821782 if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)17831783- blk_mq_sched_insert_request(rq, false, true, false);17831783+ blk_mq_request_bypass_insert(rq, true);17841784 else if (ret != BLK_STS_OK)17851785 blk_mq_end_request(rq, ret);17861786···18151815 if (ret != BLK_STS_OK) {18161816 if (ret == BLK_STS_RESOURCE ||18171817 ret == BLK_STS_DEV_RESOURCE) {18181818- list_add(&rq->queuelist, list);18181818+ blk_mq_request_bypass_insert(rq,18191819+ list_empty(list));18191820 break;18201821 }18211822 blk_mq_end_request(rq, ret);
+1-1
crypto/Kconfig
···18121812 cipher algorithms.1813181318141814config CRYPTO_STATS18151815- bool "Crypto usage statistics for User-space"18151815+ bool18161816 help18171817 This option enables the gathering of crypto stats.18181818 This will collect:
···183183 pr_err("CLK %d has invalid pointer %p\n", id, clk);184184 return;185185 }186186- if (id > unit->nr_clks) {186186+ if (id >= unit->nr_clks) {187187 pr_err("CLK %d is invalid\n", id);188188 return;189189 }
+2-2
drivers/clk/mvebu/cp110-system-controller.c
···200200 unsigned int idx = clkspec->args[1];201201202202 if (type == CP110_CLK_TYPE_CORE) {203203- if (idx > CP110_MAX_CORE_CLOCKS)203203+ if (idx >= CP110_MAX_CORE_CLOCKS)204204 return ERR_PTR(-EINVAL);205205 return clk_data->hws[idx];206206 } else if (type == CP110_CLK_TYPE_GATABLE) {207207- if (idx > CP110_MAX_GATABLE_CLOCKS)207207+ if (idx >= CP110_MAX_GATABLE_CLOCKS)208208 return ERR_PTR(-EINVAL);209209 return clk_data->hws[CP110_MAX_CORE_CLOCKS + idx];210210 }
+18
drivers/clk/qcom/common.c
···191191}192192EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk);193193194194+/* Drop 'protected-clocks' from the list of clocks to register */195195+static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc)196196+{197197+ struct device_node *np = dev->of_node;198198+ struct property *prop;199199+ const __be32 *p;200200+ u32 i;201201+202202+ of_property_for_each_u32(np, "protected-clocks", prop, p, i) {203203+ if (i >= cc->num_rclks)204204+ continue;205205+206206+ cc->rclks[i] = NULL;207207+ }208208+}209209+194210static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec,195211 void *data)196212{···266250267251 cc->rclks = rclks;268252 cc->num_rclks = num_clks;253253+254254+ qcom_cc_drop_protected(dev, cc);269255270256 for (i = 0; i < num_clks; i++) {271257 if (!rclks[i])
+4-1
drivers/clk/zynqmp/clkc.c
···128128 */129129static inline int zynqmp_is_valid_clock(u32 clk_id)130130{131131- if (clk_id > clock_max_idx)131131+ if (clk_id >= clock_max_idx)132132 return -ENODEV;133133134134 return clock[clk_id].valid;···279279 qdata.arg1 = clk_id;280280281281 ret = eemi_ops->query_data(qdata, ret_payload);282282+ if (ret)283283+ return ERR_PTR(ret);284284+282285 mult = ret_payload[1];283286 div = ret_payload[2];284287
+3-3
drivers/dma/dw/core.c
···10591059/*10601060 * Program FIFO size of channels.10611061 *10621062- * By default full FIFO (1024 bytes) is assigned to channel 0. Here we10621062+ * By default full FIFO (512 bytes) is assigned to channel 0. Here we10631063 * slice FIFO on equal parts between channels.10641064 */10651065static void idma32_fifo_partition(struct dw_dma *dw)10661066{10671067- u64 value = IDMA32C_FP_PSIZE_CH0(128) | IDMA32C_FP_PSIZE_CH1(128) |10671067+ u64 value = IDMA32C_FP_PSIZE_CH0(64) | IDMA32C_FP_PSIZE_CH1(64) |10681068 IDMA32C_FP_UPDATE;10691069 u64 fifo_partition = 0;10701070···10771077 /* Fill FIFO_PARTITION high bits (Channels 2..3, 6..7) */10781078 fifo_partition |= value << 32;1079107910801080- /* Program FIFO Partition registers - 128 bytes for each channel */10801080+ /* Program FIFO Partition registers - 64 bytes per channel */10811081 idma32_writeq(dw, FIFO_PARTITION1, fifo_partition);10821082 idma32_writeq(dw, FIFO_PARTITION0, fifo_partition);10831083}
+44-25
drivers/dma/imx-sdma.c
···2424#include <linux/spinlock.h>2525#include <linux/device.h>2626#include <linux/dma-mapping.h>2727-#include <linux/dmapool.h>2827#include <linux/firmware.h>2928#include <linux/slab.h>3029#include <linux/platform_device.h>···3233#include <linux/of_address.h>3334#include <linux/of_device.h>3435#include <linux/of_dma.h>3636+#include <linux/workqueue.h>35373638#include <asm/irq.h>3739#include <linux/platform_data/dma-imx-sdma.h>···376376 u32 shp_addr, per_addr;377377 enum dma_status status;378378 struct imx_dma_data data;379379- struct dma_pool *bd_pool;379379+ struct work_struct terminate_worker;380380};381381382382#define IMX_DMA_SG_LOOP BIT(0)···1027102710281028 return 0;10291029}10301030-10311031-static int sdma_disable_channel_with_delay(struct dma_chan *chan)10301030+static void sdma_channel_terminate_work(struct work_struct *work)10321031{10331033- struct sdma_channel *sdmac = to_sdma_chan(chan);10321032+ struct sdma_channel *sdmac = container_of(work, struct sdma_channel,10331033+ terminate_worker);10341034 unsigned long flags;10351035 LIST_HEAD(head);10361036-10371037- sdma_disable_channel(chan);10381038- spin_lock_irqsave(&sdmac->vc.lock, flags);10391039- vchan_get_all_descriptors(&sdmac->vc, &head);10401040- sdmac->desc = NULL;10411041- spin_unlock_irqrestore(&sdmac->vc.lock, flags);10421042- vchan_dma_desc_free_list(&sdmac->vc, &head);1043103610441037 /*10451038 * According to NXP R&D team a delay of one BD SDMA cost time···10401047 * bit, to ensure SDMA core has really been stopped after SDMA10411048 * clients call .device_terminate_all.10421049 */10431043- mdelay(1);10501050+ usleep_range(1000, 2000);10511051+10521052+ spin_lock_irqsave(&sdmac->vc.lock, flags);10531053+ vchan_get_all_descriptors(&sdmac->vc, &head);10541054+ sdmac->desc = NULL;10551055+ spin_unlock_irqrestore(&sdmac->vc.lock, flags);10561056+ vchan_dma_desc_free_list(&sdmac->vc, &head);10571057+}10581058+10591059+static int sdma_disable_channel_async(struct dma_chan *chan)10601060+{10611061+ struct sdma_channel *sdmac = to_sdma_chan(chan);10621062+10631063+ sdma_disable_channel(chan);10641064+10651065+ if (sdmac->desc)10661066+ schedule_work(&sdmac->terminate_worker);1044106710451068 return 0;10691069+}10701070+10711071+static void sdma_channel_synchronize(struct dma_chan *chan)10721072+{10731073+ struct sdma_channel *sdmac = to_sdma_chan(chan);10741074+10751075+ vchan_synchronize(&sdmac->vc);10761076+10771077+ flush_work(&sdmac->terminate_worker);10461078}1047107910481080static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac)···1210119212111193static int sdma_alloc_bd(struct sdma_desc *desc)12121194{11951195+ u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor);12131196 int ret = 0;1214119712151215- desc->bd = dma_pool_alloc(desc->sdmac->bd_pool, GFP_NOWAIT,12161216- &desc->bd_phys);11981198+ desc->bd = dma_zalloc_coherent(NULL, bd_size, &desc->bd_phys,11991199+ GFP_NOWAIT);12171200 if (!desc->bd) {12181201 ret = -ENOMEM;12191202 goto out;···1225120612261207static void sdma_free_bd(struct sdma_desc *desc)12271208{12281228- dma_pool_free(desc->sdmac->bd_pool, desc->bd, desc->bd_phys);12091209+ u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor);12101210+12111211+ dma_free_coherent(NULL, bd_size, desc->bd, desc->bd_phys);12291212}1230121312311214static void sdma_desc_free(struct virt_dma_desc *vd)···12931272 if (ret)12941273 goto disable_clk_ahb;1295127412961296- sdmac->bd_pool = dma_pool_create("bd_pool", chan->device->dev,12971297- sizeof(struct sdma_buffer_descriptor),12981298- 32, 0);12991299-13001275 return 0;1301127613021277disable_clk_ahb:···13071290 struct sdma_channel *sdmac = to_sdma_chan(chan);13081291 struct sdma_engine *sdma = sdmac->sdma;1309129213101310- sdma_disable_channel_with_delay(chan);12931293+ sdma_disable_channel_async(chan);12941294+12951295+ sdma_channel_synchronize(chan);1311129613121297 if (sdmac->event_id0)13131298 sdma_event_disable(sdmac, sdmac->event_id0);···1323130413241305 clk_disable(sdma->clk_ipg);13251306 clk_disable(sdma->clk_ahb);13261326-13271327- dma_pool_destroy(sdmac->bd_pool);13281328- sdmac->bd_pool = NULL;13291307}1330130813311309static struct sdma_desc *sdma_transfer_init(struct sdma_channel *sdmac,···2015199920162000 sdmac->channel = i;20172001 sdmac->vc.desc_free = sdma_desc_free;20022002+ INIT_WORK(&sdmac->terminate_worker,20032003+ sdma_channel_terminate_work);20182004 /*20192005 * Add the channel to the DMAC list. Do not add channel 0 though20202006 * because we need it internally in the SDMA driver. This also means···20682050 sdma->dma_device.device_prep_slave_sg = sdma_prep_slave_sg;20692051 sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic;20702052 sdma->dma_device.device_config = sdma_config;20712071- sdma->dma_device.device_terminate_all = sdma_disable_channel_with_delay;20532053+ sdma->dma_device.device_terminate_all = sdma_disable_channel_async;20542054+ sdma->dma_device.device_synchronize = sdma_channel_synchronize;20722055 sdma->dma_device.src_addr_widths = SDMA_DMA_BUSWIDTHS;20732056 sdma->dma_device.dst_addr_widths = SDMA_DMA_BUSWIDTHS;20742057 sdma->dma_device.directions = SDMA_DMA_DIRECTIONS;
+15-1
drivers/dma/ti/cppi41.c
···723723724724 desc_phys = lower_32_bits(c->desc_phys);725725 desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);726726- if (!cdd->chan_busy[desc_num])726726+ if (!cdd->chan_busy[desc_num]) {727727+ struct cppi41_channel *cc, *_ct;728728+729729+ /*730730+ * channels might still be in the pendling list if731731+ * cppi41_dma_issue_pending() is called after732732+ * cppi41_runtime_suspend() is called733733+ */734734+ list_for_each_entry_safe(cc, _ct, &cdd->pending, node) {735735+ if (cc != c)736736+ continue;737737+ list_del(&cc->node);738738+ break;739739+ }727740 return 0;741741+ }728742729743 ret = cppi41_tear_down_chan(c);730744 if (ret)
+3-3
drivers/gnss/sirf.c
···168168 else169169 timeout = SIRF_HIBERNATE_TIMEOUT;170170171171- while (retries-- > 0) {171171+ do {172172 sirf_pulse_on_off(data);173173 ret = sirf_wait_for_power_state(data, active, timeout);174174 if (ret < 0) {···179179 }180180181181 break;182182- }182182+ } while (retries--);183183184184- if (retries == 0)184184+ if (retries < 0)185185 return -ETIMEDOUT;186186187187 return 0;
···467467 if (!info->return_size || !info->return_pointer)468468 return -EINVAL;469469470470- /* Ensure IB tests are run on ring */471471- flush_delayed_work(&adev->late_init_work);472472-473470 switch (info->query) {474471 case AMDGPU_INFO_ACCEL_WORKING:475472 ui32 = adev->accel_working;···946949 struct amdgpu_device *adev = dev->dev_private;947950 struct amdgpu_fpriv *fpriv;948951 int r, pasid;952952+953953+ /* Ensure IB tests are run on ring */954954+ flush_delayed_work(&adev->late_init_work);949955950956 file_priv->driver_priv = NULL;951957
+33-11
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
···5656MODULE_FIRMWARE("amdgpu/polaris11_mc.bin");5757MODULE_FIRMWARE("amdgpu/polaris10_mc.bin");5858MODULE_FIRMWARE("amdgpu/polaris12_mc.bin");5959+MODULE_FIRMWARE("amdgpu/polaris11_k_mc.bin");6060+MODULE_FIRMWARE("amdgpu/polaris10_k_mc.bin");6161+MODULE_FIRMWARE("amdgpu/polaris12_k_mc.bin");59626063static const u32 golden_settings_tonga_a11[] =6164{···227224 chip_name = "tonga";228225 break;229226 case CHIP_POLARIS11:230230- chip_name = "polaris11";227227+ if (((adev->pdev->device == 0x67ef) &&228228+ ((adev->pdev->revision == 0xe0) ||229229+ (adev->pdev->revision == 0xe5))) ||230230+ ((adev->pdev->device == 0x67ff) &&231231+ ((adev->pdev->revision == 0xcf) ||232232+ (adev->pdev->revision == 0xef) ||233233+ (adev->pdev->revision == 0xff))))234234+ chip_name = "polaris11_k";235235+ else if ((adev->pdev->device == 0x67ef) &&236236+ (adev->pdev->revision == 0xe2))237237+ chip_name = "polaris11_k";238238+ else239239+ chip_name = "polaris11";231240 break;232241 case CHIP_POLARIS10:233233- chip_name = "polaris10";242242+ if ((adev->pdev->device == 0x67df) &&243243+ ((adev->pdev->revision == 0xe1) ||244244+ (adev->pdev->revision == 0xf7)))245245+ chip_name = "polaris10_k";246246+ else247247+ chip_name = "polaris10";234248 break;235249 case CHIP_POLARIS12:236236- chip_name = "polaris12";250250+ if (((adev->pdev->device == 0x6987) &&251251+ ((adev->pdev->revision == 0xc0) ||252252+ (adev->pdev->revision == 0xc3))) ||253253+ ((adev->pdev->device == 0x6981) &&254254+ ((adev->pdev->revision == 0x00) ||255255+ (adev->pdev->revision == 0x01) ||256256+ (adev->pdev->revision == 0x10))))257257+ chip_name = "polaris12_k";258258+ else259259+ chip_name = "polaris12";237260 break;238261 case CHIP_FIJI:239262 case CHIP_CARRIZO:···366337 const struct mc_firmware_header_v1_0 *hdr;367338 const __le32 *fw_data = NULL;368339 const __le32 *io_mc_regs = NULL;369369- u32 data, vbios_version;340340+ u32 data;370341 int i, ucode_size, regs_size;371342372343 /* Skip MC ucode loading on SR-IOV capable boards.···375346 * for this adaptor.376347 */377348 if (amdgpu_sriov_bios(adev))378378- return 0;379379-380380- WREG32(mmMC_SEQ_IO_DEBUG_INDEX, 0x9F);381381- data = RREG32(mmMC_SEQ_IO_DEBUG_DATA);382382- vbios_version = data & 0xf;383383-384384- if (vbios_version == 0)385349 return 0;386350387351 if (!adev->gmc.fw)
···8080 PHM_FUNC_CHECK(hwmgr);8181 adev = hwmgr->adev;82828383- if (smum_is_dpm_running(hwmgr) && !amdgpu_passthrough(adev)) {8383+ /* Skip for suspend/resume case */8484+ if (smum_is_dpm_running(hwmgr) && !amdgpu_passthrough(adev)8585+ && adev->in_suspend) {8486 pr_info("dpm has been enabled\n");8587 return 0;8688 }
+3
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
···352352353353 switch (task_id) {354354 case AMD_PP_TASK_DISPLAY_CONFIG_CHANGE:355355+ ret = phm_pre_display_configuration_changed(hwmgr);356356+ if (ret)357357+ return ret;355358 ret = phm_set_cpu_power_state(hwmgr);356359 if (ret)357360 return ret;
-2
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
···265265 if (skip)266266 return 0;267267268268- phm_pre_display_configuration_changed(hwmgr);269269-270268 phm_display_configuration_changed(hwmgr);271269272270 if (hwmgr->ps)
+8-4
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
···35893589 }3590359035913591 if (i >= sclk_table->count) {35923592- data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_SCLK;35933593- sclk_table->dpm_levels[i-1].value = sclk;35923592+ if (sclk > sclk_table->dpm_levels[i-1].value) {35933593+ data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_SCLK;35943594+ sclk_table->dpm_levels[i-1].value = sclk;35953595+ }35943596 } else {35953597 /* TODO: Check SCLK in DAL's minimum clocks35963598 * in case DeepSleep divider update is required.···36093607 }3610360836113609 if (i >= mclk_table->count) {36123612- data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_MCLK;36133613- mclk_table->dpm_levels[i-1].value = mclk;36103610+ if (mclk > mclk_table->dpm_levels[i-1].value) {36113611+ data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_MCLK;36123612+ mclk_table->dpm_levels[i-1].value = mclk;36133613+ }36143614 }3615361536163616 if (data->display_timing.num_existing_displays != hwmgr->display_config->num_display)
···296296297297 if (master->lessor) {298298 /* Tell the master to check the lessee list */299299- drm_sysfs_hotplug_event(dev);299299+ drm_sysfs_lease_event(dev);300300 drm_master_put(&master->lessor);301301 }302302
···15941594 NULL);1595159515961596 drm_crtc_helper_add(crtc, &dpu_crtc_helper_funcs);15971597- plane->crtc = crtc;1598159715991598 /* save user friendly CRTC name for later */16001599 snprintf(dpu_crtc->name, DPU_CRTC_NAME_SIZE, "crtc%u", crtc->base.id);
···3434 if (!new_crtc_state->active)3535 continue;36363737+ if (drm_crtc_vblank_get(crtc))3838+ continue;3939+3740 kms->funcs->wait_for_crtc_commit_done(kms, crtc);4141+4242+ drm_crtc_vblank_put(crtc);3843 }3944}4045
+11-4
drivers/gpu/drm/msm/msm_debugfs.c
···84848585 ret = mutex_lock_interruptible(&dev->struct_mutex);8686 if (ret)8787- return ret;8787+ goto free_priv;88888989 pm_runtime_get_sync(&gpu->pdev->dev);9090 show_priv->state = gpu->funcs->gpu_state_get(gpu);···94949595 if (IS_ERR(show_priv->state)) {9696 ret = PTR_ERR(show_priv->state);9797- kfree(show_priv);9898- return ret;9797+ goto free_priv;9998 }10099101100 show_priv->dev = dev;102101103103- return single_open(file, msm_gpu_show, show_priv);102102+ ret = single_open(file, msm_gpu_show, show_priv);103103+ if (ret)104104+ goto free_priv;105105+106106+ return 0;107107+108108+free_priv:109109+ kfree(show_priv);110110+ return ret;104111}105112106113static const struct file_operations msm_gpu_fops = {
+16-33
drivers/gpu/drm/msm/msm_drv.c
···553553 kthread_run(kthread_worker_fn,554554 &priv->disp_thread[i].worker,555555 "crtc_commit:%d", priv->disp_thread[i].crtc_id);556556- ret = sched_setscheduler(priv->disp_thread[i].thread,557557- SCHED_FIFO, ¶m);558558- if (ret)559559- pr_warn("display thread priority update failed: %d\n",560560- ret);561561-562556 if (IS_ERR(priv->disp_thread[i].thread)) {563557 dev_err(dev, "failed to create crtc_commit kthread\n");564558 priv->disp_thread[i].thread = NULL;559559+ goto err_msm_uninit;565560 }561561+562562+ ret = sched_setscheduler(priv->disp_thread[i].thread,563563+ SCHED_FIFO, ¶m);564564+ if (ret)565565+ dev_warn(dev, "disp_thread set priority failed: %d\n",566566+ ret);566567567568 /* initialize event thread */568569 priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id;···573572 kthread_run(kthread_worker_fn,574573 &priv->event_thread[i].worker,575574 "crtc_event:%d", priv->event_thread[i].crtc_id);575575+ if (IS_ERR(priv->event_thread[i].thread)) {576576+ dev_err(dev, "failed to create crtc_event kthread\n");577577+ priv->event_thread[i].thread = NULL;578578+ goto err_msm_uninit;579579+ }580580+576581 /**577582 * event thread should also run at same priority as disp_thread578583 * because it is handling frame_done events. A lower priority···587580 * failure at crtc commit level.588581 */589582 ret = sched_setscheduler(priv->event_thread[i].thread,590590- SCHED_FIFO, ¶m);583583+ SCHED_FIFO, ¶m);591584 if (ret)592592- pr_warn("display event thread priority update failed: %d\n",593593- ret);594594-595595- if (IS_ERR(priv->event_thread[i].thread)) {596596- dev_err(dev, "failed to create crtc_event kthread\n");597597- priv->event_thread[i].thread = NULL;598598- }599599-600600- if ((!priv->disp_thread[i].thread) ||601601- !priv->event_thread[i].thread) {602602- /* clean up previously created threads if any */603603- for ( ; i >= 0; i--) {604604- if (priv->disp_thread[i].thread) {605605- kthread_stop(606606- priv->disp_thread[i].thread);607607- priv->disp_thread[i].thread = NULL;608608- }609609-610610- if (priv->event_thread[i].thread) {611611- kthread_stop(612612- priv->event_thread[i].thread);613613- priv->event_thread[i].thread = NULL;614614- }615615- }616616- goto err_msm_uninit;617617- }585585+ dev_warn(dev, "event_thread set priority failed:%d\n",586586+ ret);618587 }619588620589 ret = drm_vblank_init(ddev, priv->num_crtcs);
+11-7
drivers/gpu/drm/msm/msm_gem_submit.c
···317317 uint32_t *ptr;318318 int ret = 0;319319320320+ if (!nr_relocs)321321+ return 0;322322+320323 if (offset % 4) {321324 DRM_ERROR("non-aligned cmdstream buffer: %u\n", offset);322325 return -EINVAL;···413410 struct msm_file_private *ctx = file->driver_priv;414411 struct msm_gem_submit *submit;415412 struct msm_gpu *gpu = priv->gpu;416416- struct dma_fence *in_fence = NULL;417413 struct sync_file *sync_file = NULL;418414 struct msm_gpu_submitqueue *queue;419415 struct msm_ringbuffer *ring;···445443 ring = gpu->rb[queue->prio];446444447445 if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {446446+ struct dma_fence *in_fence;447447+448448 in_fence = sync_file_get_fence(args->fence_fd);449449450450 if (!in_fence)···456452 * Wait if the fence is from a foreign context, or if the fence457453 * array contains any fence from a foreign context.458454 */459459- if (!dma_fence_match_context(in_fence, ring->fctx->context)) {455455+ ret = 0;456456+ if (!dma_fence_match_context(in_fence, ring->fctx->context))460457 ret = dma_fence_wait(in_fence, true);461461- if (ret)462462- return ret;463463- }458458+459459+ dma_fence_put(in_fence);460460+ if (ret)461461+ return ret;464462 }465463466464 ret = mutex_lock_interruptible(&dev->struct_mutex);···588582 }589583590584out:591591- if (in_fence)592592- dma_fence_put(in_fence);593585 submit_cleanup(submit);594586 if (ret)595587 msm_gem_submit_free(submit);
+8-5
drivers/gpu/drm/msm/msm_gpu.c
···345345{346346 struct msm_gpu_state *state;347347348348+ /* Check if the target supports capturing crash state */349349+ if (!gpu->funcs->gpu_state_get)350350+ return;351351+348352 /* Only save one crash state at a time */349353 if (gpu->crashstate)350354 return;···438434 if (submit) {439435 struct task_struct *task;440436441441- rcu_read_lock();442442- task = pid_task(submit->pid, PIDTYPE_PID);437437+ task = get_pid_task(submit->pid, PIDTYPE_PID);443438 if (task) {444444- comm = kstrdup(task->comm, GFP_ATOMIC);439439+ comm = kstrdup(task->comm, GFP_KERNEL);445440446441 /*447442 * So slightly annoying, in other paths like···453450 * about the submit going away.454451 */455452 mutex_unlock(&dev->struct_mutex);456456- cmd = kstrdup_quotable_cmdline(task, GFP_ATOMIC);453453+ cmd = kstrdup_quotable_cmdline(task, GFP_KERNEL);454454+ put_task_struct(task);457455 mutex_lock(&dev->struct_mutex);458456 }459459- rcu_read_unlock();460457461458 if (comm && cmd) {462459 dev_err(dev->dev, "%s: offending task: %s (%s)\n",
···435435 }436436}437437438438-/*439439- * vmbus_process_offer - Process the offer by creating a channel/device440440- * associated with this offer441441- */442442-static void vmbus_process_offer(struct vmbus_channel *newchannel)438438+/* Note: the function can run concurrently for primary/sub channels. */439439+static void vmbus_add_channel_work(struct work_struct *work)443440{444444- struct vmbus_channel *channel;445445- bool fnew = true;441441+ struct vmbus_channel *newchannel =442442+ container_of(work, struct vmbus_channel, add_channel_work);443443+ struct vmbus_channel *primary_channel = newchannel->primary_channel;446444 unsigned long flags;447445 u16 dev_type;448446 int ret;449449-450450- /* Make sure this is a new offer */451451- mutex_lock(&vmbus_connection.channel_mutex);452452-453453- /*454454- * Now that we have acquired the channel_mutex,455455- * we can release the potentially racing rescind thread.456456- */457457- atomic_dec(&vmbus_connection.offer_in_progress);458458-459459- list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {460460- if (!uuid_le_cmp(channel->offermsg.offer.if_type,461461- newchannel->offermsg.offer.if_type) &&462462- !uuid_le_cmp(channel->offermsg.offer.if_instance,463463- newchannel->offermsg.offer.if_instance)) {464464- fnew = false;465465- break;466466- }467467- }468468-469469- if (fnew)470470- list_add_tail(&newchannel->listentry,471471- &vmbus_connection.chn_list);472472-473473- mutex_unlock(&vmbus_connection.channel_mutex);474474-475475- if (!fnew) {476476- /*477477- * Check to see if this is a sub-channel.478478- */479479- if (newchannel->offermsg.offer.sub_channel_index != 0) {480480- /*481481- * Process the sub-channel.482482- */483483- newchannel->primary_channel = channel;484484- spin_lock_irqsave(&channel->lock, flags);485485- list_add_tail(&newchannel->sc_list, &channel->sc_list);486486- channel->num_sc++;487487- spin_unlock_irqrestore(&channel->lock, flags);488488- } else {489489- goto err_free_chan;490490- }491491- }492447493448 dev_type = hv_get_dev_type(newchannel);494449···462507 /*463508 * This state is used to indicate a successful open464509 * so that when we do close the channel normally, we465465- * can cleanup properly510510+ * can cleanup properly.466511 */467512 newchannel->state = CHANNEL_OPEN_STATE;468513469469- if (!fnew) {470470- struct hv_device *dev471471- = newchannel->primary_channel->device_obj;514514+ if (primary_channel != NULL) {515515+ /* newchannel is a sub-channel. */516516+ struct hv_device *dev = primary_channel->device_obj;472517473518 if (vmbus_add_channel_kobj(dev, newchannel))474474- goto err_free_chan;519519+ goto err_deq_chan;475520476476- if (channel->sc_creation_callback != NULL)477477- channel->sc_creation_callback(newchannel);521521+ if (primary_channel->sc_creation_callback != NULL)522522+ primary_channel->sc_creation_callback(newchannel);523523+478524 newchannel->probe_done = true;479525 return;480526 }481527482528 /*483483- * Start the process of binding this offer to the driver484484- * We need to set the DeviceObject field before calling485485- * vmbus_child_dev_add()529529+ * Start the process of binding the primary channel to the driver486530 */487531 newchannel->device_obj = vmbus_device_create(488532 &newchannel->offermsg.offer.if_type,···510556511557err_deq_chan:512558 mutex_lock(&vmbus_connection.channel_mutex);513513- list_del(&newchannel->listentry);559559+560560+ /*561561+ * We need to set the flag, otherwise562562+ * vmbus_onoffer_rescind() can be blocked.563563+ */564564+ newchannel->probe_done = true;565565+566566+ if (primary_channel == NULL) {567567+ list_del(&newchannel->listentry);568568+ } else {569569+ spin_lock_irqsave(&primary_channel->lock, flags);570570+ list_del(&newchannel->sc_list);571571+ spin_unlock_irqrestore(&primary_channel->lock, flags);572572+ }573573+514574 mutex_unlock(&vmbus_connection.channel_mutex);515575516576 if (newchannel->target_cpu != get_cpu()) {517577 put_cpu();518578 smp_call_function_single(newchannel->target_cpu,519519- percpu_channel_deq, newchannel, true);579579+ percpu_channel_deq,580580+ newchannel, true);520581 } else {521582 percpu_channel_deq(newchannel);522583 put_cpu();···539570540571 vmbus_release_relid(newchannel->offermsg.child_relid);541572542542-err_free_chan:543573 free_channel(newchannel);574574+}575575+576576+/*577577+ * vmbus_process_offer - Process the offer by creating a channel/device578578+ * associated with this offer579579+ */580580+static void vmbus_process_offer(struct vmbus_channel *newchannel)581581+{582582+ struct vmbus_channel *channel;583583+ struct workqueue_struct *wq;584584+ unsigned long flags;585585+ bool fnew = true;586586+587587+ mutex_lock(&vmbus_connection.channel_mutex);588588+589589+ /*590590+ * Now that we have acquired the channel_mutex,591591+ * we can release the potentially racing rescind thread.592592+ */593593+ atomic_dec(&vmbus_connection.offer_in_progress);594594+595595+ list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {596596+ if (!uuid_le_cmp(channel->offermsg.offer.if_type,597597+ newchannel->offermsg.offer.if_type) &&598598+ !uuid_le_cmp(channel->offermsg.offer.if_instance,599599+ newchannel->offermsg.offer.if_instance)) {600600+ fnew = false;601601+ break;602602+ }603603+ }604604+605605+ if (fnew)606606+ list_add_tail(&newchannel->listentry,607607+ &vmbus_connection.chn_list);608608+ else {609609+ /*610610+ * Check to see if this is a valid sub-channel.611611+ */612612+ if (newchannel->offermsg.offer.sub_channel_index == 0) {613613+ mutex_unlock(&vmbus_connection.channel_mutex);614614+ /*615615+ * Don't call free_channel(), because newchannel->kobj616616+ * is not initialized yet.617617+ */618618+ kfree(newchannel);619619+ WARN_ON_ONCE(1);620620+ return;621621+ }622622+ /*623623+ * Process the sub-channel.624624+ */625625+ newchannel->primary_channel = channel;626626+ spin_lock_irqsave(&channel->lock, flags);627627+ list_add_tail(&newchannel->sc_list, &channel->sc_list);628628+ spin_unlock_irqrestore(&channel->lock, flags);629629+ }630630+631631+ mutex_unlock(&vmbus_connection.channel_mutex);632632+633633+ /*634634+ * vmbus_process_offer() mustn't call channel->sc_creation_callback()635635+ * directly for sub-channels, because sc_creation_callback() ->636636+ * vmbus_open() may never get the host's response to the637637+ * OPEN_CHANNEL message (the host may rescind a channel at any time,638638+ * e.g. in the case of hot removing a NIC), and vmbus_onoffer_rescind()639639+ * may not wake up the vmbus_open() as it's blocked due to a non-zero640640+ * vmbus_connection.offer_in_progress, and finally we have a deadlock.641641+ *642642+ * The above is also true for primary channels, if the related device643643+ * drivers use sync probing mode by default.644644+ *645645+ * And, usually the handling of primary channels and sub-channels can646646+ * depend on each other, so we should offload them to different647647+ * workqueues to avoid possible deadlock, e.g. in sync-probing mode,648648+ * NIC1's netvsc_subchan_work() can race with NIC2's netvsc_probe() ->649649+ * rtnl_lock(), and causes deadlock: the former gets the rtnl_lock650650+ * and waits for all the sub-channels to appear, but the latter651651+ * can't get the rtnl_lock and this blocks the handling of652652+ * sub-channels.653653+ */654654+ INIT_WORK(&newchannel->add_channel_work, vmbus_add_channel_work);655655+ wq = fnew ? vmbus_connection.handle_primary_chan_wq :656656+ vmbus_connection.handle_sub_chan_wq;657657+ queue_work(wq, &newchannel->add_channel_work);544658}545659546660/*547661 * We use this state to statically distribute the channel interrupt load.548662 */549663static int next_numa_node_id;664664+/*665665+ * init_vp_index() accesses global variables like next_numa_node_id, and666666+ * it can run concurrently for primary channels and sub-channels: see667667+ * vmbus_process_offer(), so we need the lock to protect the global668668+ * variables.669669+ */670670+static DEFINE_SPINLOCK(bind_channel_to_cpu_lock);550671551672/*552673 * Starting with Win8, we can statically distribute the incoming···671612 channel->target_vp = hv_cpu_number_to_vp_number(0);672613 return;673614 }615615+616616+ spin_lock(&bind_channel_to_cpu_lock);674617675618 /*676619 * Based on the channel affinity policy, we will assign the NUMA···755694756695 channel->target_cpu = cur_cpu;757696 channel->target_vp = hv_cpu_number_to_vp_number(cur_cpu);697697+698698+ spin_unlock(&bind_channel_to_cpu_lock);758699759700 free_cpumask_var(available_mask);760701}
+21-3
drivers/hv/connection.c
···190190 goto cleanup;191191 }192192193193+ vmbus_connection.handle_primary_chan_wq =194194+ create_workqueue("hv_pri_chan");195195+ if (!vmbus_connection.handle_primary_chan_wq) {196196+ ret = -ENOMEM;197197+ goto cleanup;198198+ }199199+200200+ vmbus_connection.handle_sub_chan_wq =201201+ create_workqueue("hv_sub_chan");202202+ if (!vmbus_connection.handle_sub_chan_wq) {203203+ ret = -ENOMEM;204204+ goto cleanup;205205+ }206206+193207 INIT_LIST_HEAD(&vmbus_connection.chn_msg_list);194208 spin_lock_init(&vmbus_connection.channelmsg_lock);195209···294280 */295281 vmbus_initiate_unload(false);296282297297- if (vmbus_connection.work_queue) {298298- drain_workqueue(vmbus_connection.work_queue);283283+ if (vmbus_connection.handle_sub_chan_wq)284284+ destroy_workqueue(vmbus_connection.handle_sub_chan_wq);285285+286286+ if (vmbus_connection.handle_primary_chan_wq)287287+ destroy_workqueue(vmbus_connection.handle_primary_chan_wq);288288+289289+ if (vmbus_connection.work_queue)299290 destroy_workqueue(vmbus_connection.work_queue);300300- }301291302292 if (vmbus_connection.int_page) {303293 free_pages((unsigned long)vmbus_connection.int_page, 0);
+7
drivers/hv/hyperv_vmbus.h
···335335 struct list_head chn_list;336336 struct mutex channel_mutex;337337338338+ /*339339+ * An offer message is handled first on the work_queue, and then340340+ * is further handled on handle_primary_chan_wq or341341+ * handle_sub_chan_wq.342342+ */338343 struct workqueue_struct *work_queue;344344+ struct workqueue_struct *handle_primary_chan_wq;345345+ struct workqueue_struct *handle_sub_chan_wq;339346};340347341348
+29-11
drivers/i2c/busses/i2c-axxia.c
···7474 MST_STATUS_ND)7575#define MST_STATUS_ERR (MST_STATUS_NAK | \7676 MST_STATUS_AL | \7777- MST_STATUS_IP | \7878- MST_STATUS_TSS)7777+ MST_STATUS_IP)7978#define MST_TX_BYTES_XFRD 0x508079#define MST_RX_BYTES_XFRD 0x548180#define SCL_HIGH_PERIOD 0x80···240241 */241242 if (c <= 0 || c > I2C_SMBUS_BLOCK_MAX) {242243 idev->msg_err = -EPROTO;243243- i2c_int_disable(idev, ~0);244244+ i2c_int_disable(idev, ~MST_STATUS_TSS);244245 complete(&idev->msg_complete);245246 break;246247 }···298299299300 if (status & MST_STATUS_SCC) {300301 /* Stop completed */301301- i2c_int_disable(idev, ~0);302302+ i2c_int_disable(idev, ~MST_STATUS_TSS);302303 complete(&idev->msg_complete);303304 } else if (status & MST_STATUS_SNS) {304305 /* Transfer done */305305- i2c_int_disable(idev, ~0);306306+ i2c_int_disable(idev, ~MST_STATUS_TSS);306307 if (i2c_m_rd(idev->msg) && idev->msg_xfrd < idev->msg->len)307308 axxia_i2c_empty_rx_fifo(idev);309309+ complete(&idev->msg_complete);310310+ } else if (status & MST_STATUS_TSS) {311311+ /* Transfer timeout */312312+ idev->msg_err = -ETIMEDOUT;313313+ i2c_int_disable(idev, ~MST_STATUS_TSS);308314 complete(&idev->msg_complete);309315 } else if (unlikely(status & MST_STATUS_ERR)) {310316 /* Transfer error */···343339 u32 rx_xfer, tx_xfer;344340 u32 addr_1, addr_2;345341 unsigned long time_left;342342+ unsigned int wt_value;346343347344 idev->msg = msg;348345 idev->msg_xfrd = 0;349349- idev->msg_err = 0;350346 reinit_completion(&idev->msg_complete);351347352348 if (i2c_m_ten(msg)) {···387383 else if (axxia_i2c_fill_tx_fifo(idev) != 0)388384 int_mask |= MST_STATUS_TFL;389385386386+ wt_value = WT_VALUE(readl(idev->base + WAIT_TIMER_CONTROL));387387+ /* Disable wait timer temporarly */388388+ writel(wt_value, idev->base + WAIT_TIMER_CONTROL);389389+ /* Check if timeout error happened */390390+ if (idev->msg_err)391391+ goto out;392392+390393 /* Start manual mode */391394 writel(CMD_MANUAL, idev->base + MST_COMMAND);395395+396396+ writel(WT_EN | wt_value, idev->base + WAIT_TIMER_CONTROL);392397393398 i2c_int_enable(idev, int_mask);394399···409396 if (readl(idev->base + MST_COMMAND) & CMD_BUSY)410397 dev_warn(idev->dev, "busy after xfer\n");411398412412- if (time_left == 0)399399+ if (time_left == 0) {413400 idev->msg_err = -ETIMEDOUT;414414-415415- if (idev->msg_err == -ETIMEDOUT)416401 i2c_recover_bus(&idev->adapter);402402+ axxia_i2c_init(idev);403403+ }417404418418- if (unlikely(idev->msg_err) && idev->msg_err != -ENXIO)405405+out:406406+ if (unlikely(idev->msg_err) && idev->msg_err != -ENXIO &&407407+ idev->msg_err != -ETIMEDOUT)419408 axxia_i2c_init(idev);420409421410 return idev->msg_err;···425410426411static int axxia_i2c_stop(struct axxia_i2c_dev *idev)427412{428428- u32 int_mask = MST_STATUS_ERR | MST_STATUS_SCC;413413+ u32 int_mask = MST_STATUS_ERR | MST_STATUS_SCC | MST_STATUS_TSS;429414 unsigned long time_left;430415431416 reinit_completion(&idev->msg_complete);···451436 struct axxia_i2c_dev *idev = i2c_get_adapdata(adap);452437 int i;453438 int ret = 0;439439+440440+ idev->msg_err = 0;441441+ i2c_int_enable(idev, MST_STATUS_TSS);454442455443 for (i = 0; ret == 0 && i < num; ++i)456444 ret = axxia_i2c_xfer_msg(idev, &msgs[i]);
···779779780780 pm_runtime_get_sync(dev);781781782782+ /* Check bus state before init otherwise bus busy info will be lost */783783+ ret = rcar_i2c_bus_barrier(priv);784784+ if (ret < 0)785785+ goto out;786786+782787 /* Gen3 needs a reset before allowing RXDMA once */783788 if (priv->devtype == I2C_RCAR_GEN3) {784789 priv->flags |= ID_P_NO_RXDMA;···795790 }796791797792 rcar_i2c_init(priv);798798-799799- ret = rcar_i2c_bus_barrier(priv);800800- if (ret < 0)801801- goto out;802793803794 for (i = 0; i < num; i++)804795 rcar_i2c_request_dma(priv, msgs + i);
+7-3
drivers/i2c/busses/i2c-scmi.c
···367367{368368 struct acpi_smbus_cmi *smbus_cmi;369369 const struct acpi_device_id *id;370370+ int ret;370371371372 smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);372373 if (!smbus_cmi)···389388 acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,390389 acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);391390392392- if (smbus_cmi->cap_info == 0)391391+ if (smbus_cmi->cap_info == 0) {392392+ ret = -ENODEV;393393 goto err;394394+ }394395395396 snprintf(smbus_cmi->adapter.name, sizeof(smbus_cmi->adapter.name),396397 "SMBus CMI adapter %s",···403400 smbus_cmi->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;404401 smbus_cmi->adapter.dev.parent = &device->dev;405402406406- if (i2c_add_adapter(&smbus_cmi->adapter)) {403403+ ret = i2c_add_adapter(&smbus_cmi->adapter);404404+ if (ret) {407405 dev_err(&device->dev, "Couldn't register adapter!\n");408406 goto err;409407 }···414410err:415411 kfree(smbus_cmi);416412 device->driver_data = NULL;417417- return -EIO;413413+ return ret;418414}419415420416static int acpi_smbus_cmi_remove(struct acpi_device *device)
+41-8
drivers/i2c/busses/i2c-uniphier-f.c
···173173 "interrupt: enabled_irqs=%04x, irq_status=%04x\n",174174 priv->enabled_irqs, irq_status);175175176176- uniphier_fi2c_clear_irqs(priv, irq_status);177177-178176 if (irq_status & UNIPHIER_FI2C_INT_STOP)179177 goto complete;180178···212214213215 if (irq_status & (UNIPHIER_FI2C_INT_RF | UNIPHIER_FI2C_INT_RB)) {214216 uniphier_fi2c_drain_rxfifo(priv);215215- if (!priv->len)217217+ /*218218+ * If the number of bytes to read is multiple of the FIFO size219219+ * (msg->len == 8, 16, 24, ...), the INT_RF bit is set a little220220+ * earlier than INT_RB. We wait for INT_RB to confirm the221221+ * completion of the current message.222222+ */223223+ if (!priv->len && (irq_status & UNIPHIER_FI2C_INT_RB))216224 goto data_done;217225218226 if (unlikely(priv->flags & UNIPHIER_FI2C_MANUAL_NACK)) {···257253 }258254259255handled:256256+ /*257257+ * This controller makes a pause while any bit of the IRQ status is258258+ * asserted. Clear the asserted bit to kick the controller just before259259+ * exiting the handler.260260+ */261261+ uniphier_fi2c_clear_irqs(priv, irq_status);262262+260263 spin_unlock(&priv->lock);261264262265 return IRQ_HANDLED;263266}264267265265-static void uniphier_fi2c_tx_init(struct uniphier_fi2c_priv *priv, u16 addr)268268+static void uniphier_fi2c_tx_init(struct uniphier_fi2c_priv *priv, u16 addr,269269+ bool repeat)266270{267271 priv->enabled_irqs |= UNIPHIER_FI2C_INT_TE;268272 uniphier_fi2c_set_irqs(priv);···280268 /* set slave address */281269 writel(UNIPHIER_FI2C_DTTX_CMD | addr << 1,282270 priv->membase + UNIPHIER_FI2C_DTTX);283283- /* first chunk of data */284284- uniphier_fi2c_fill_txfifo(priv, true);271271+ /*272272+ * First chunk of data. For a repeated START condition, do not write273273+ * data to the TX fifo here to avoid the timing issue.274274+ */275275+ if (!repeat)276276+ uniphier_fi2c_fill_txfifo(priv, true);285277}286278287279static void uniphier_fi2c_rx_init(struct uniphier_fi2c_priv *priv, u16 addr)···366350 if (is_read)367351 uniphier_fi2c_rx_init(priv, msg->addr);368352 else369369- uniphier_fi2c_tx_init(priv, msg->addr);353353+ uniphier_fi2c_tx_init(priv, msg->addr, repeat);370354371355 dev_dbg(&adap->dev, "start condition\n");372356 /*···518502519503 uniphier_fi2c_reset(priv);520504505505+ /*506506+ * Standard-mode: tLOW + tHIGH = 10 us507507+ * Fast-mode: tLOW + tHIGH = 2.5 us508508+ */521509 writel(cyc, priv->membase + UNIPHIER_FI2C_CYC);522522- writel(cyc / 2, priv->membase + UNIPHIER_FI2C_LCTL);510510+ /*511511+ * Standard-mode: tLOW = 4.7 us, tHIGH = 4.0 us, tBUF = 4.7 us512512+ * Fast-mode: tLOW = 1.3 us, tHIGH = 0.6 us, tBUF = 1.3 us513513+ * "tLow/tHIGH = 5/4" meets both.514514+ */515515+ writel(cyc * 5 / 9, priv->membase + UNIPHIER_FI2C_LCTL);516516+ /*517517+ * Standard-mode: tHD;STA = 4.0 us, tSU;STA = 4.7 us, tSU;STO = 4.0 us518518+ * Fast-mode: tHD;STA = 0.6 us, tSU;STA = 0.6 us, tSU;STO = 0.6 us519519+ */523520 writel(cyc / 2, priv->membase + UNIPHIER_FI2C_SSUT);521521+ /*522522+ * Standard-mode: tSU;DAT = 250 ns523523+ * Fast-mode: tSU;DAT = 100 ns524524+ */524525 writel(cyc / 16, priv->membase + UNIPHIER_FI2C_DSUT);525526526527 uniphier_fi2c_prepare_operation(priv);
···920920 struct device_node *root = of_find_node_by_path("/");921921 const char *model = of_get_property(root, "model", NULL);922922923923+ of_node_put(root);923924 /* Get cable type from device-tree. */924925 if (cable && !strncmp(cable, "80-", 3)) {925926 /* Some drives fail to detect 80c cable in PowerBook */
+6-10
drivers/input/joystick/xpad.c
···480480};481481482482/*483483- * This packet is required for some of the PDP pads to start483483+ * This packet is required for most (all?) of the PDP pads to start484484 * sending input reports. These pads include: (0x0e6f:0x02ab),485485- * (0x0e6f:0x02a4).485485+ * (0x0e6f:0x02a4), (0x0e6f:0x02a6).486486 */487487static const u8 xboxone_pdp_init1[] = {488488 0x0a, 0x20, 0x00, 0x03, 0x00, 0x01, 0x14489489};490490491491/*492492- * This packet is required for some of the PDP pads to start492492+ * This packet is required for most (all?) of the PDP pads to start493493 * sending input reports. These pads include: (0x0e6f:0x02ab),494494- * (0x0e6f:0x02a4).494494+ * (0x0e6f:0x02a4), (0x0e6f:0x02a6).495495 */496496static const u8 xboxone_pdp_init2[] = {497497 0x06, 0x20, 0x00, 0x02, 0x01, 0x00···527527 XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),528528 XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),529529 XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),530530- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init1),531531- XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2),532532- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1),533533- XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2),534534- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1),535535- XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2),530530+ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1),531531+ XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2),536532 XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),537533 XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),538534 XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
···493493 for (i = 0; i < ARRAY_SIZE(cros_ec_keyb_bs); i++) {494494 const struct cros_ec_bs_map *map = &cros_ec_keyb_bs[i];495495496496- if (buttons & BIT(map->bit))496496+ if ((map->ev_type == EV_KEY && (buttons & BIT(map->bit))) ||497497+ (map->ev_type == EV_SW && (switches & BIT(map->bit))))497498 input_set_capability(idev, map->ev_type, map->code);498499 }499500
+14-9
drivers/input/keyboard/matrix_keypad.c
···407407 struct matrix_keypad_platform_data *pdata;408408 struct device_node *np = dev->of_node;409409 unsigned int *gpios;410410- int i, nrow, ncol;410410+ int ret, i, nrow, ncol;411411412412 if (!np) {413413 dev_err(dev, "device lacks DT data\n");···452452 return ERR_PTR(-ENOMEM);453453 }454454455455- for (i = 0; i < pdata->num_row_gpios; i++)456456- gpios[i] = of_get_named_gpio(np, "row-gpios", i);455455+ for (i = 0; i < nrow; i++) {456456+ ret = of_get_named_gpio(np, "row-gpios", i);457457+ if (ret < 0)458458+ return ERR_PTR(ret);459459+ gpios[i] = ret;460460+ }457461458458- for (i = 0; i < pdata->num_col_gpios; i++)459459- gpios[pdata->num_row_gpios + i] =460460- of_get_named_gpio(np, "col-gpios", i);462462+ for (i = 0; i < ncol; i++) {463463+ ret = of_get_named_gpio(np, "col-gpios", i);464464+ if (ret < 0)465465+ return ERR_PTR(ret);466466+ gpios[nrow + i] = ret;467467+ }461468462469 pdata->row_gpios = gpios;463470 pdata->col_gpios = &gpios[pdata->num_row_gpios];···491484 pdata = dev_get_platdata(&pdev->dev);492485 if (!pdata) {493486 pdata = matrix_keypad_parse_dt(&pdev->dev);494494- if (IS_ERR(pdata)) {495495- dev_err(&pdev->dev, "no platform data defined\n");487487+ if (IS_ERR(pdata))496488 return PTR_ERR(pdata);497497- }498489 } else if (!pdata->keymap_data) {499490 dev_err(&pdev->dev, "no keymap data defined\n");500491 return -EINVAL;
+14-4
drivers/input/keyboard/omap4-keypad.c
···60606161/* OMAP4 values */6262#define OMAP4_VAL_IRQDISABLE 0x06363-#define OMAP4_VAL_DEBOUNCINGTIME 0x76464-#define OMAP4_VAL_PVT 0x76363+6464+/*6565+ * Errata i689: If a key is released for a time shorter than debounce time,6666+ * the keyboard will idle and never detect the key release. The workaround6767+ * is to use at least a 12ms debounce time. See omap5432 TRM chapter6868+ * "26.4.6.2 Keyboard Controller Timer" for more information.6969+ */7070+#define OMAP4_KEYPAD_PTV_DIV_128 0x67171+#define OMAP4_KEYPAD_DEBOUNCINGTIME_MS(dbms, ptv) \7272+ ((((dbms) * 1000) / ((1 << ((ptv) + 1)) * (1000000 / 32768))) - 1)7373+#define OMAP4_VAL_DEBOUNCINGTIME_16MS \7474+ OMAP4_KEYPAD_DEBOUNCINGTIME_MS(16, OMAP4_KEYPAD_PTV_DIV_128)65756676enum {6777 KBD_REVISION_OMAP4 = 0,···191181192182 kbd_writel(keypad_data, OMAP4_KBD_CTRL,193183 OMAP4_DEF_CTRL_NOSOFTMODE |194194- (OMAP4_VAL_PVT << OMAP4_DEF_CTRL_PTV_SHIFT));184184+ (OMAP4_KEYPAD_PTV_DIV_128 << OMAP4_DEF_CTRL_PTV_SHIFT));195185 kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,196196- OMAP4_VAL_DEBOUNCINGTIME);186186+ OMAP4_VAL_DEBOUNCINGTIME_16MS);197187 /* clear pending interrupts */198188 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,199189 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
···177177 * state because the Enter-UP can trigger a wakeup at once.178178 */179179 if (!(info & IS_BREAK))180180- pm_wakeup_event(&hv_dev->device, 0);180180+ pm_wakeup_hard_event(&hv_dev->device);181181182182 break;183183
+1-14
drivers/input/touchscreen/migor_ts.c
···11+// SPDX-License-Identifier: GPL-2.0+12/*23 * Touch Screen driver for Renesas MIGO-R Platform34 *45 * Copyright (c) 2008 Magnus Damm56 * Copyright (c) 2007 Ujjwal Pande <ujjwal@kenati.com>,67 * Kenati Technologies Pvt Ltd.77- *88- * This file is free software; you can redistribute it and/or99- * modify it under the terms of the GNU General Public1010- * License as published by the Free Software Foundation; either1111- * version 2 of the License, or (at your option) any later version.1212- *1313- * This file is distributed in the hope that it will be useful,1414- * but WITHOUT ANY WARRANTY; without even the implied warranty of1515- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1616- * General Public License for more details.1717- *1818- * You should have received a copy of the GNU General Public1919- * License along with this library; if not, write to the Free Software2020- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA218 */229#include <linux/module.h>2310#include <linux/kernel.h>
+2-10
drivers/input/touchscreen/st1232.c
···11+// SPDX-License-Identifier: GPL-2.012/*23 * ST1232 Touchscreen Controller Driver34 *···87 * Using code from:98 * - android.git.kernel.org: projects/kernel/common.git: synaptics_i2c_rmi.c109 * Copyright (C) 2007 Google, Inc.1111- *1212- * This software is licensed under the terms of the GNU General Public1313- * License version 2, as published by the Free Software Foundation, and1414- * may be copied, distributed, and modified under those terms.1515- *1616- * This program is distributed in the hope that it will be useful,1717- * but WITHOUT ANY WARRANTY; without even the implied warranty of1818- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1919- * GNU General Public License for more details.2010 */21112212#include <linux/delay.h>···287295288296MODULE_AUTHOR("Tony SIM <chinyeow.sim.xt@renesas.com>");289297MODULE_DESCRIPTION("SITRONIX ST1232 Touchscreen Controller Driver");290290-MODULE_LICENSE("GPL");298298+MODULE_LICENSE("GPL v2");
···20862086 aggregator->aggregator_identifier);2087208720882088 /* Tell the partner that this port is not suitable for aggregation */20892089+ port->actor_oper_port_state &= ~AD_STATE_SYNCHRONIZATION;20902090+ port->actor_oper_port_state &= ~AD_STATE_COLLECTING;20912091+ port->actor_oper_port_state &= ~AD_STATE_DISTRIBUTING;20892092 port->actor_oper_port_state &= ~AD_STATE_AGGREGATION;20902093 __update_lacpdu_from_port(port);20912094 ad_lacpdu_send(port);
+3-7
drivers/net/dsa/mv88e6060.c
···116116 /* Reset the switch. */117117 REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,118118 GLOBAL_ATU_CONTROL_SWRESET |119119- GLOBAL_ATU_CONTROL_ATUSIZE_1024 |120120- GLOBAL_ATU_CONTROL_ATE_AGE_5MIN);119119+ GLOBAL_ATU_CONTROL_LEARNDIS);121120122121 /* Wait up to one second for reset to complete. */123122 timeout = jiffies + 1 * HZ;···141142 */142143 REG_WRITE(REG_GLOBAL, GLOBAL_CONTROL, GLOBAL_CONTROL_MAX_FRAME_1536);143144144144- /* Enable automatic address learning, set the address145145- * database size to 1024 entries, and set the default aging146146- * time to 5 minutes.145145+ /* Disable automatic address learning.147146 */148147 REG_WRITE(REG_GLOBAL, GLOBAL_ATU_CONTROL,149149- GLOBAL_ATU_CONTROL_ATUSIZE_1024 |150150- GLOBAL_ATU_CONTROL_ATE_AGE_5MIN);148148+ GLOBAL_ATU_CONTROL_LEARNDIS);151149152150 return 0;153151}
···608608 goto hash_add;609609 }610610611611- err = -EBUSY;611611+ err = -EADDRINUSE;612612 if (macvlan_addr_busy(vlan->port, dev->dev_addr))613613 goto out;614614···706706 } else {707707 /* Rehash and update the device filters */708708 if (macvlan_addr_busy(vlan->port, addr))709709- return -EBUSY;709709+ return -EADDRINUSE;710710711711 if (!macvlan_passthru(port)) {712712 err = dev_uc_add(lowerdev, addr);···746746 macvlan_set_addr_change(vlan->port);747747 return dev_set_mac_address(vlan->lowerdev, addr);748748 }749749+750750+ if (macvlan_addr_busy(vlan->port, addr->sa_data))751751+ return -EADDRINUSE;749752750753 return macvlan_sync_address(dev, addr->sa_data);751754}
+8-11
drivers/net/phy/phy_device.c
···1880188018811881static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)18821882{18831883- phydev->supported &= ~(PHY_1000BT_FEATURES | PHY_100BT_FEATURES |18841884- PHY_10BT_FEATURES);18851885-18861883 switch (max_speed) {18871887- default:18881888- return -ENOTSUPP;18891889- case SPEED_1000:18901890- phydev->supported |= PHY_1000BT_FEATURES;18841884+ case SPEED_10:18851885+ phydev->supported &= ~PHY_100BT_FEATURES;18911886 /* fall through */18921887 case SPEED_100:18931893- phydev->supported |= PHY_100BT_FEATURES;18941894- /* fall through */18951895- case SPEED_10:18961896- phydev->supported |= PHY_10BT_FEATURES;18881888+ phydev->supported &= ~PHY_1000BT_FEATURES;18891889+ break;18901890+ case SPEED_1000:18911891+ break;18921892+ default:18931893+ return -ENOTSUPP;18971894 }1898189518991896 return 0;
+1-1
drivers/net/phy/sfp-bus.c
···162162 /* 1000Base-PX or 1000Base-BX10 */163163 if ((id->base.e_base_px || id->base.e_base_bx10) &&164164 br_min <= 1300 && br_max >= 1200)165165- phylink_set(support, 1000baseX_Full);165165+ phylink_set(modes, 1000baseX_Full);166166167167 /* For active or passive cables, select the link modes168168 * based on the bit rates and the cable compliance bytes.
···895895 struct pcie_link_state *link;896896 int blacklist = !!pcie_aspm_sanity_check(pdev);897897898898- if (!aspm_support_enabled || aspm_disabled)898898+ if (!aspm_support_enabled)899899 return;900900901901 if (pdev->link_state)
+14-3
drivers/s390/virtio/virtio_ccw.c
···5656 unsigned int revision; /* Transport revision */5757 wait_queue_head_t wait_q;5858 spinlock_t lock;5959+ struct mutex io_lock; /* Serializes I/O requests */5960 struct list_head virtqueues;6061 unsigned long indicators;6162 unsigned long indicators2;···297296 unsigned long flags;298297 int flag = intparm & VIRTIO_CCW_INTPARM_MASK;299298299299+ mutex_lock(&vcdev->io_lock);300300 do {301301 spin_lock_irqsave(get_ccwdev_lock(vcdev->cdev), flags);302302 ret = ccw_device_start(vcdev->cdev, ccw, intparm, 0, 0);···310308 cpu_relax();311309 } while (ret == -EBUSY);312310 wait_event(vcdev->wait_q, doing_io(vcdev, flag) == 0);313313- return ret ? ret : vcdev->err;311311+ ret = ret ? ret : vcdev->err;312312+ mutex_unlock(&vcdev->io_lock);313313+ return ret;314314}315315316316static void virtio_ccw_drop_indicator(struct virtio_ccw_device *vcdev,···832828 int ret;833829 struct ccw1 *ccw;834830 void *config_area;831831+ unsigned long flags;835832836833 ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);837834 if (!ccw)···851846 if (ret)852847 goto out_free;853848849849+ spin_lock_irqsave(&vcdev->lock, flags);854850 memcpy(vcdev->config, config_area, offset + len);855855- if (buf)856856- memcpy(buf, &vcdev->config[offset], len);857851 if (vcdev->config_ready < offset + len)858852 vcdev->config_ready = offset + len;853853+ spin_unlock_irqrestore(&vcdev->lock, flags);854854+ if (buf)855855+ memcpy(buf, config_area + offset, len);859856860857out_free:861858 kfree(config_area);···871864 struct virtio_ccw_device *vcdev = to_vc_device(vdev);872865 struct ccw1 *ccw;873866 void *config_area;867867+ unsigned long flags;874868875869 ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);876870 if (!ccw)···884876 /* Make sure we don't overwrite fields. */885877 if (vcdev->config_ready < offset)886878 virtio_ccw_get_config(vdev, 0, NULL, offset);879879+ spin_lock_irqsave(&vcdev->lock, flags);887880 memcpy(&vcdev->config[offset], buf, len);888881 /* Write the config area to the host. */889882 memcpy(config_area, vcdev->config, sizeof(vcdev->config));883883+ spin_unlock_irqrestore(&vcdev->lock, flags);890884 ccw->cmd_code = CCW_CMD_WRITE_CONF;891885 ccw->flags = 0;892886 ccw->count = offset + len;···12571247 init_waitqueue_head(&vcdev->wait_q);12581248 INIT_LIST_HEAD(&vcdev->virtqueues);12591249 spin_lock_init(&vcdev->lock);12501250+ mutex_init(&vcdev->io_lock);1260125112611252 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);12621253 dev_set_drvdata(&cdev->dev, vcdev);
···55* Userspace support for the Request API needs to be reviewed;66* Another stateless decoder driver should be submitted;77* At least one stateless encoder driver should be submitted.88+* When queueing a request containing references to I frames, the99+ refcount of the memory for those I frames needs to be incremented1010+ and decremented when the request is completed. This will likely1111+ require some help from vb2. The driver should fail the request1212+ if the memory/buffer is gone.
+1-1
drivers/staging/rtl8712/mlme_linux.c
···146146 p = buff;147147 p += sprintf(p, "ASSOCINFO(ReqIEs=");148148 len = sec_ie[1] + 2;149149- len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX - 1;149149+ len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX;150150 for (i = 0; i < len; i++)151151 p += sprintf(p, "%02x", sec_ie[i]);152152 p += sprintf(p, ")");
···15651565 if (pstat->aid > 0) {15661566 DBG_871X(" old AID %d\n", pstat->aid);15671567 } else {15681568- for (pstat->aid = 1; pstat->aid < NUM_STA; pstat->aid++)15681568+ for (pstat->aid = 1; pstat->aid <= NUM_STA; pstat->aid++)15691569 if (pstapriv->sta_aid[pstat->aid - 1] == NULL)15701570 break;15711571
+13-15
drivers/thermal/armada_thermal.c
···357357 int ret;358358359359 /* Valid check */360360- if (armada_is_valid(priv)) {360360+ if (!armada_is_valid(priv)) {361361 dev_err(priv->dev,362362 "Temperature sensor reading not valid\n");363363 return -EIO;···395395 return ret;396396}397397398398-static struct thermal_zone_of_device_ops of_ops = {398398+static const struct thermal_zone_of_device_ops of_ops = {399399 .get_temp = armada_get_temp,400400};401401···526526527527 /* First memory region points towards the status register */528528 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);529529- if (!res)530530- return -EIO;531531-532532- /*533533- * Edit the resource start address and length to map over all the534534- * registers, instead of pointing at them one by one.535535- */536536- res->start -= data->syscon_status_off;537537- res->end = res->start + max(data->syscon_status_off,538538- max(data->syscon_control0_off,539539- data->syscon_control1_off)) +540540- sizeof(unsigned int) - 1;541541-542529 base = devm_ioremap_resource(&pdev->dev, res);543530 if (IS_ERR(base))544531 return PTR_ERR(base);532532+533533+ /*534534+ * Fix up from the old individual DT register specification to535535+ * cover all the registers. We do this by adjusting the ioremap()536536+ * result, which should be fine as ioremap() deals with pages.537537+ * However, validate that we do not cross a page boundary while538538+ * making this adjustment.539539+ */540540+ if (((unsigned long)base & ~PAGE_MASK) < data->syscon_status_off)541541+ return -EINVAL;542542+ base -= data->syscon_status_off;545543546544 priv->syscon = devm_regmap_init_mmio(&pdev->dev, base,547545 &armada_thermal_regmap_config);
+1-10
drivers/thermal/broadcom/bcm2835_thermal.c
···11+// SPDX-License-Identifier: GPL-2.0+12/*23 * Driver for Broadcom BCM2835 SoC temperature sensor34 *45 * Copyright (C) 2016 Martin Sperl55- *66- * This program is free software; you can redistribute it and/or modify77- * it under the terms of the GNU General Public License as published by88- * the Free Software Foundation; either version 2 of the License, or99- * (at your option) any later version.1010- *1111- * This program is distributed in the hope that it will be useful,1212- * but WITHOUT ANY WARRANTY; without even the implied warranty of1313- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414- * GNU General Public License for more details.156 */167178#include <linux/clk.h>
···213213214214 platform_set_drvdata(pdev, data);215215216216- pm_runtime_enable(&pdev->dev);217217- if (!pm_runtime_enabled(&pdev->dev)) {218218- err = mtk8250_runtime_resume(&pdev->dev);219219- if (err)220220- return err;221221- }216216+ err = mtk8250_runtime_resume(&pdev->dev);217217+ if (err)218218+ return err;222219223220 data->line = serial8250_register_8250_port(&uart);224221 if (data->line < 0)225222 return data->line;223223+224224+ pm_runtime_set_active(&pdev->dev);225225+ pm_runtime_enable(&pdev->dev);226226227227 return 0;228228}···234234 pm_runtime_get_sync(&pdev->dev);235235236236 serial8250_unregister_port(data->line);237237+ mtk8250_runtime_suspend(&pdev->dev);237238238239 pm_runtime_disable(&pdev->dev);239240 pm_runtime_put_noidle(&pdev->dev);240240-241241- if (!pm_runtime_status_suspended(&pdev->dev))242242- mtk8250_runtime_suspend(&pdev->dev);243241244242 return 0;245243}
+2-2
drivers/tty/serial/kgdboc.c
···233233static int param_set_kgdboc_var(const char *kmessage,234234 const struct kernel_param *kp)235235{236236- int len = strlen(kmessage);236236+ size_t len = strlen(kmessage);237237238238 if (len >= MAX_CONFIG_LEN) {239239 pr_err("config string too long\n");···254254255255 strcpy(config, kmessage);256256 /* Chop out \n char as a result of echo */257257- if (config[len - 1] == '\n')257257+ if (len && config[len - 1] == '\n')258258 config[len - 1] = '\0';259259260260 if (configured == 1)
···968968 unsigned int delay = XHCI_MAX_HALT_USEC;969969 struct usb_hcd *hcd = xhci_to_hcd(xhci);970970 u32 command;971971+ u32 res;971972972973 if (!hcd->state)973974 return 0;···10221021 command = readl(&xhci->op_regs->command);10231022 command |= CMD_CSS;10241023 writel(command, &xhci->op_regs->command);10241024+ xhci->broken_suspend = 0;10251025 if (xhci_handshake(&xhci->op_regs->status,10261026 STS_SAVE, 0, 10 * 1000)) {10271027- xhci_warn(xhci, "WARN: xHC save state timeout\n");10281028- spin_unlock_irq(&xhci->lock);10291029- return -ETIMEDOUT;10271027+ /*10281028+ * AMD SNPS xHC 3.0 occasionally does not clear the10291029+ * SSS bit of USBSTS and when driver tries to poll10301030+ * to see if the xHC clears BIT(8) which never happens10311031+ * and driver assumes that controller is not responding10321032+ * and times out. To workaround this, its good to check10331033+ * if SRE and HCE bits are not set (as per xhci10341034+ * Section 5.4.2) and bypass the timeout.10351035+ */10361036+ res = readl(&xhci->op_regs->status);10371037+ if ((xhci->quirks & XHCI_SNPS_BROKEN_SUSPEND) &&10381038+ (((res & STS_SRE) == 0) &&10391039+ ((res & STS_HCE) == 0))) {10401040+ xhci->broken_suspend = 1;10411041+ } else {10421042+ xhci_warn(xhci, "WARN: xHC save state timeout\n");10431043+ spin_unlock_irq(&xhci->lock);10441044+ return -ETIMEDOUT;10451045+ }10301046 }10311047 spin_unlock_irq(&xhci->lock);10321048···10961078 set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);1097107910981080 spin_lock_irq(&xhci->lock);10991099- if (xhci->quirks & XHCI_RESET_ON_RESUME)10811081+ if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend)11001082 hibernated = true;1101108311021084 if (!hibernated) {···45144496{45154497 unsigned long long timeout_ns;4516449844994499+ /* Prevent U1 if service interval is shorter than U1 exit latency */45004500+ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) {45014501+ if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) {45024502+ dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n");45034503+ return USB3_LPM_DISABLED;45044504+ }45054505+ }45064506+45174507 if (xhci->quirks & XHCI_INTEL_HOST)45184508 timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc);45194509 else···45774551 struct usb_endpoint_descriptor *desc)45784552{45794553 unsigned long long timeout_ns;45544554+45554555+ /* Prevent U2 if service interval is shorter than U2 exit latency */45564556+ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) {45574557+ if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) {45584558+ dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n");45594559+ return USB3_LPM_DISABLED;45604560+ }45614561+ }4580456245814563 if (xhci->quirks & XHCI_INTEL_HOST)45824564 timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc);
+3
drivers/usb/host/xhci.h
···18501850#define XHCI_ZERO_64B_REGS BIT_ULL(32)18511851#define XHCI_DEFAULT_PM_RUNTIME_ALLOW BIT_ULL(33)18521852#define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34)18531853+#define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35)1853185418541855 unsigned int num_active_eps;18551856 unsigned int limit_active_eps;···18801879 void *dbc;18811880 /* platform-specific data -- must come last */18821881 unsigned long priv[0] __aligned(sizeof(s64));18821882+ /* Broken Suspend flag for SNPS Suspend resume issue */18831883+ u8 broken_suspend;18831884};1884188518851886/* Platform specific overrides to generic XHCI hc_driver ops */
···101101 cflag |= PARENB;102102 break;103103 }104104- co->cflag = cflag;105104106105 /*107106 * no need to check the index here: if the index is wrong, console···163164 serial->type->set_termios(tty, port, &dummy);164165165166 tty_port_tty_set(&port->port, NULL);167167+ tty_save_termios(tty);166168 tty_kref_put(tty);167169 }168170 tty_port_set_initialized(&port->port, 1);
···1515#include <net/sock.h>1616#include <linux/virtio_vsock.h>1717#include <linux/vhost.h>1818+#include <linux/hashtable.h>18191920#include <net/af_vsock.h>2021#include "vhost.h"···28272928/* Used to track all the vhost_vsock instances on the system. */3029static DEFINE_SPINLOCK(vhost_vsock_lock);3131-static LIST_HEAD(vhost_vsock_list);3030+static DEFINE_READ_MOSTLY_HASHTABLE(vhost_vsock_hash, 8);32313332struct vhost_vsock {3433 struct vhost_dev dev;3534 struct vhost_virtqueue vqs[2];36353737- /* Link to global vhost_vsock_list, protected by vhost_vsock_lock */3838- struct list_head list;3636+ /* Link to global vhost_vsock_hash, writes use vhost_vsock_lock */3737+ struct hlist_node hash;39384039 struct vhost_work send_pkt_work;4140 spinlock_t send_pkt_list_lock;···5150 return VHOST_VSOCK_DEFAULT_HOST_CID;5251}53525454-static struct vhost_vsock *__vhost_vsock_get(u32 guest_cid)5353+/* Callers that dereference the return value must hold vhost_vsock_lock or the5454+ * RCU read lock.5555+ */5656+static struct vhost_vsock *vhost_vsock_get(u32 guest_cid)5557{5658 struct vhost_vsock *vsock;57595858- list_for_each_entry(vsock, &vhost_vsock_list, list) {6060+ hash_for_each_possible_rcu(vhost_vsock_hash, vsock, hash, guest_cid) {5961 u32 other_cid = vsock->guest_cid;60626163 /* Skip instances that have no CID yet */···7167 }72687369 return NULL;7474-}7575-7676-static struct vhost_vsock *vhost_vsock_get(u32 guest_cid)7777-{7878- struct vhost_vsock *vsock;7979-8080- spin_lock_bh(&vhost_vsock_lock);8181- vsock = __vhost_vsock_get(guest_cid);8282- spin_unlock_bh(&vhost_vsock_lock);8383-8484- return vsock;8570}86718772static void···203210 struct vhost_vsock *vsock;204211 int len = pkt->len;205212213213+ rcu_read_lock();214214+206215 /* Find the vhost_vsock according to guest context id */207216 vsock = vhost_vsock_get(le64_to_cpu(pkt->hdr.dst_cid));208217 if (!vsock) {218218+ rcu_read_unlock();209219 virtio_transport_free_pkt(pkt);210220 return -ENODEV;211221 }···221225 spin_unlock_bh(&vsock->send_pkt_list_lock);222226223227 vhost_work_queue(&vsock->dev, &vsock->send_pkt_work);228228+229229+ rcu_read_unlock();224230 return len;225231}226232···232234 struct vhost_vsock *vsock;233235 struct virtio_vsock_pkt *pkt, *n;234236 int cnt = 0;237237+ int ret = -ENODEV;235238 LIST_HEAD(freeme);239239+240240+ rcu_read_lock();236241237242 /* Find the vhost_vsock according to guest context id */238243 vsock = vhost_vsock_get(vsk->remote_addr.svm_cid);239244 if (!vsock)240240- return -ENODEV;245245+ goto out;241246242247 spin_lock_bh(&vsock->send_pkt_list_lock);243248 list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) {···266265 vhost_poll_queue(&tx_vq->poll);267266 }268267269269- return 0;268268+ ret = 0;269269+out:270270+ rcu_read_unlock();271271+ return ret;270272}271273272274static struct virtio_vsock_pkt *···537533 spin_lock_init(&vsock->send_pkt_list_lock);538534 INIT_LIST_HEAD(&vsock->send_pkt_list);539535 vhost_work_init(&vsock->send_pkt_work, vhost_transport_send_pkt_work);540540-541541- spin_lock_bh(&vhost_vsock_lock);542542- list_add_tail(&vsock->list, &vhost_vsock_list);543543- spin_unlock_bh(&vhost_vsock_lock);544536 return 0;545537546538out:···563563 * executing.564564 */565565566566- if (!vhost_vsock_get(vsk->remote_addr.svm_cid)) {567567- sock_set_flag(sk, SOCK_DONE);568568- vsk->peer_shutdown = SHUTDOWN_MASK;569569- sk->sk_state = SS_UNCONNECTED;570570- sk->sk_err = ECONNRESET;571571- sk->sk_error_report(sk);572572- }566566+ /* If the peer is still valid, no need to reset connection */567567+ if (vhost_vsock_get(vsk->remote_addr.svm_cid))568568+ return;569569+570570+ /* If the close timeout is pending, let it expire. This avoids races571571+ * with the timeout callback.572572+ */573573+ if (vsk->close_work_scheduled)574574+ return;575575+576576+ sock_set_flag(sk, SOCK_DONE);577577+ vsk->peer_shutdown = SHUTDOWN_MASK;578578+ sk->sk_state = SS_UNCONNECTED;579579+ sk->sk_err = ECONNRESET;580580+ sk->sk_error_report(sk);573581}574582575583static int vhost_vsock_dev_release(struct inode *inode, struct file *file)···585577 struct vhost_vsock *vsock = file->private_data;586578587579 spin_lock_bh(&vhost_vsock_lock);588588- list_del(&vsock->list);580580+ if (vsock->guest_cid)581581+ hash_del_rcu(&vsock->hash);589582 spin_unlock_bh(&vhost_vsock_lock);583583+584584+ /* Wait for other CPUs to finish using vsock */585585+ synchronize_rcu();590586591587 /* Iterating over all connections for all CIDs to find orphans is592588 * inefficient. Room for improvement here. */···632620633621 /* Refuse if CID is already in use */634622 spin_lock_bh(&vhost_vsock_lock);635635- other = __vhost_vsock_get(guest_cid);623623+ other = vhost_vsock_get(guest_cid);636624 if (other && other != vsock) {637625 spin_unlock_bh(&vhost_vsock_lock);638626 return -EADDRINUSE;639627 }628628+629629+ if (vsock->guest_cid)630630+ hash_del_rcu(&vsock->hash);631631+640632 vsock->guest_cid = guest_cid;633633+ hash_add_rcu(vhost_vsock_hash, &vsock->hash, guest_cid);641634 spin_unlock_bh(&vhost_vsock_lock);642635643636 return 0;
+3-5
fs/btrfs/tree-checker.c
···389389390390 /*391391 * Here we don't really care about alignment since extent allocator can392392- * handle it. We care more about the size, as if one block group is393393- * larger than maximum size, it's must be some obvious corruption.392392+ * handle it. We care more about the size.394393 */395395- if (key->offset > BTRFS_MAX_DATA_CHUNK_SIZE || key->offset == 0) {394394+ if (key->offset == 0) {396395 block_group_err(fs_info, leaf, slot,397397- "invalid block group size, have %llu expect (0, %llu]",398398- key->offset, BTRFS_MAX_DATA_CHUNK_SIZE);396396+ "invalid block group size 0");399397 return -EUCLEAN;400398 }401399
+1-1
fs/cifs/Kconfig
···133133134134config CIFS_POSIX135135 bool "CIFS POSIX Extensions"136136- depends on CIFS_XATTR136136+ depends on CIFS && CIFS_ALLOW_INSECURE_LEGACY && CIFS_XATTR137137 help138138 Enabling this option will cause the cifs client to attempt to139139 negotiate a newer dialect with servers, such as Samba 3.0.5
+1-1
fs/cifs/dir.c
···174174175175 cifs_dbg(FYI, "using cifs_sb prepath <%s>\n", cifs_sb->prepath);176176 memcpy(full_path+dfsplen+1, cifs_sb->prepath, pplen-1);177177- full_path[dfsplen] = '\\';177177+ full_path[dfsplen] = dirsep;178178 for (i = 0; i < pplen-1; i++)179179 if (full_path[dfsplen+1+i] == '/')180180 full_path[dfsplen+1+i] = CIFS_DIR_SEP(cifs_sb);
+6-25
fs/cifs/file.c
···25412541cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,25422542 struct cifs_aio_ctx *ctx)25432543{25442544- int wait_retry = 0;25452544 unsigned int wsize, credits;25462545 int rc;25472546 struct TCP_Server_Info *server =25482547 tlink_tcon(wdata->cfile->tlink)->ses->server;2549254825502549 /*25512551- * Try to resend this wdata, waiting for credits up to 3 seconds.25502550+ * Wait for credits to resend this wdata.25522551 * Note: we are attempting to resend the whole wdata not in segments25532552 */25542553 do {···25552556 server, wdata->bytes, &wsize, &credits);2556255725572558 if (rc)25582558- break;25592559+ goto out;2559256025602561 if (wsize < wdata->bytes) {25612562 add_credits_and_wake_if(server, credits, 0);25622563 msleep(1000);25632563- wait_retry++;25642564 }25652565- } while (wsize < wdata->bytes && wait_retry < 3);25662566-25672567- if (wsize < wdata->bytes) {25682568- rc = -EBUSY;25692569- goto out;25702570- }25652565+ } while (wsize < wdata->bytes);2571256625722567 rc = -EAGAIN;25732568 while (rc == -EAGAIN) {···32273234 struct list_head *rdata_list,32283235 struct cifs_aio_ctx *ctx)32293236{32303230- int wait_retry = 0;32313237 unsigned int rsize, credits;32323238 int rc;32333239 struct TCP_Server_Info *server =32343240 tlink_tcon(rdata->cfile->tlink)->ses->server;3235324132363242 /*32373237- * Try to resend this rdata, waiting for credits up to 3 seconds.32433243+ * Wait for credits to resend this rdata.32383244 * Note: we are attempting to resend the whole rdata not in segments32393245 */32403246 do {···32413249 &rsize, &credits);3242325032433251 if (rc)32443244- break;32523252+ goto out;3245325332463254 if (rsize < rdata->bytes) {32473255 add_credits_and_wake_if(server, credits, 0);32483256 msleep(1000);32493249- wait_retry++;32503257 }32513251- } while (rsize < rdata->bytes && wait_retry < 3);32523252-32533253- /*32543254- * If we can't find enough credits to send this rdata32553255- * release the rdata and return failure, this will pass32563256- * whatever I/O amount we have finished to VFS.32573257- */32583258- if (rsize < rdata->bytes) {32593259- rc = -EBUSY;32603260- goto out;32613261- }32583258+ } while (rsize < rdata->bytes);3262325932633260 rc = -EAGAIN;32643261 while (rc == -EAGAIN) {
+38-17
fs/dax.c
···232232 }233233}234234235235+/*236236+ * The only thing keeping the address space around is the i_pages lock237237+ * (it's cycled in clear_inode() after removing the entries from i_pages)238238+ * After we call xas_unlock_irq(), we cannot touch xas->xa.239239+ */240240+static void wait_entry_unlocked(struct xa_state *xas, void *entry)241241+{242242+ struct wait_exceptional_entry_queue ewait;243243+ wait_queue_head_t *wq;244244+245245+ init_wait(&ewait.wait);246246+ ewait.wait.func = wake_exceptional_entry_func;247247+248248+ wq = dax_entry_waitqueue(xas, entry, &ewait.key);249249+ prepare_to_wait_exclusive(wq, &ewait.wait, TASK_UNINTERRUPTIBLE);250250+ xas_unlock_irq(xas);251251+ schedule();252252+ finish_wait(wq, &ewait.wait);253253+254254+ /*255255+ * Entry lock waits are exclusive. Wake up the next waiter since256256+ * we aren't sure we will acquire the entry lock and thus wake257257+ * the next waiter up on unlock.258258+ */259259+ if (waitqueue_active(wq))260260+ __wake_up(wq, TASK_NORMAL, 1, &ewait.key);261261+}262262+235263static void put_unlocked_entry(struct xa_state *xas, void *entry)236264{237265 /* If we were the only waiter woken, wake the next one */···379351 * @page: The page whose entry we want to lock380352 *381353 * Context: Process context.382382- * Return: %true if the entry was locked or does not need to be locked.354354+ * Return: A cookie to pass to dax_unlock_page() or 0 if the entry could355355+ * not be locked.383356 */384384-bool dax_lock_mapping_entry(struct page *page)357357+dax_entry_t dax_lock_page(struct page *page)385358{386359 XA_STATE(xas, NULL, 0);387360 void *entry;388388- bool locked;389361390362 /* Ensure page->mapping isn't freed while we look at it */391363 rcu_read_lock();392364 for (;;) {393365 struct address_space *mapping = READ_ONCE(page->mapping);394366395395- locked = false;396396- if (!dax_mapping(mapping))367367+ entry = NULL;368368+ if (!mapping || !dax_mapping(mapping))397369 break;398370399371 /*···403375 * otherwise we would not have a valid pfn_to_page()404376 * translation.405377 */406406- locked = true;378378+ entry = (void *)~0UL;407379 if (S_ISCHR(mapping->host->i_mode))408380 break;409381···417389 entry = xas_load(&xas);418390 if (dax_is_locked(entry)) {419391 rcu_read_unlock();420420- entry = get_unlocked_entry(&xas);421421- xas_unlock_irq(&xas);422422- put_unlocked_entry(&xas, entry);392392+ wait_entry_unlocked(&xas, entry);423393 rcu_read_lock();424394 continue;425395 }···426400 break;427401 }428402 rcu_read_unlock();429429- return locked;403403+ return (dax_entry_t)entry;430404}431405432432-void dax_unlock_mapping_entry(struct page *page)406406+void dax_unlock_page(struct page *page, dax_entry_t cookie)433407{434408 struct address_space *mapping = page->mapping;435409 XA_STATE(xas, &mapping->i_pages, page->index);436436- void *entry;437410438411 if (S_ISCHR(mapping->host->i_mode))439412 return;440413441441- rcu_read_lock();442442- entry = xas_load(&xas);443443- rcu_read_unlock();444444- entry = dax_make_entry(page_to_pfn_t(page), dax_is_pmd_entry(entry));445445- dax_unlock_entry(&xas, entry);414414+ dax_unlock_entry(&xas, (void *)cookie);446415}447416448417/*
+2-3
fs/exec.c
···6262#include <linux/oom.h>6363#include <linux/compat.h>6464#include <linux/vmalloc.h>6565-#include <linux/freezer.h>66656766#include <linux/uaccess.h>6867#include <asm/mmu_context.h>···10831084 while (sig->notify_count) {10841085 __set_current_state(TASK_KILLABLE);10851086 spin_unlock_irq(lock);10861086- freezable_schedule();10871087+ schedule();10871088 if (unlikely(__fatal_signal_pending(tsk)))10881089 goto killed;10891090 spin_lock_irq(lock);···11111112 __set_current_state(TASK_KILLABLE);11121113 write_unlock_irq(&tasklist_lock);11131114 cgroup_threadgroup_change_end(tsk);11141114- freezable_schedule();11151115+ schedule();11151116 if (unlikely(__fatal_signal_pending(tsk)))11161117 goto killed;11171118 }
-9
fs/iomap.c
···18771877 dio->wait_for_completion = true;18781878 ret = 0;18791879 }18801880-18811881- /*18821882- * Splicing to pipes can fail on a full pipe. We have to18831883- * swallow this to make it look like a short IO18841884- * otherwise the higher splice layers will completely18851885- * mishandle the error and stop moving data.18861886- */18871887- if (ret == -EFAULT)18881888- ret = 0;18891880 break;18901881 }18911882 pos += ret;
+8-1
fs/nfs/direct.c
···9898 struct pnfs_ds_commit_info ds_cinfo; /* Storage for cinfo */9999 struct work_struct work;100100 int flags;101101+ /* for write */101102#define NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */102103#define NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */104104+ /* for read */105105+#define NFS_ODIRECT_SHOULD_DIRTY (3) /* dirty user-space page after read */103106 struct nfs_writeverf verf; /* unstable write verifier */104107};105108···415412 struct nfs_page *req = nfs_list_entry(hdr->pages.next);416413 struct page *page = req->wb_page;417414418418- if (!PageCompound(page) && bytes < hdr->good_bytes)415415+ if (!PageCompound(page) && bytes < hdr->good_bytes &&416416+ (dreq->flags == NFS_ODIRECT_SHOULD_DIRTY))419417 set_page_dirty(page);420418 bytes += req->wb_bytes;421419 nfs_list_remove_request(req);···590586 dreq->l_ctx = l_ctx;591587 if (!is_sync_kiocb(iocb))592588 dreq->iocb = iocb;589589+590590+ if (iter_is_iovec(iter))591591+ dreq->flags = NFS_ODIRECT_SHOULD_DIRTY;593592594593 nfs_start_io_direct(inode);595594
+4-2
fs/nfs/flexfilelayout/flexfilelayout.c
···17331733 if (fh)17341734 hdr->args.fh = fh;1735173517361736- if (!nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid))17361736+ if (vers == 4 &&17371737+ !nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid))17371738 goto out_failed;1738173917391740 /*···17991798 if (fh)18001799 hdr->args.fh = fh;1801180018021802- if (!nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid))18011801+ if (vers == 4 &&18021802+ !nfs4_ff_layout_select_ds_stateid(lseg, idx, &hdr->args.stateid))18031803 goto out_failed;1804180418051805 /*
···945945 sd->flags &= ~SPLICE_F_NONBLOCK;946946 more = sd->flags & SPLICE_F_MORE;947947948948+ WARN_ON_ONCE(pipe->nrbufs != 0);949949+948950 while (len) {949951 size_t read_len;950952 loff_t pos = sd->pos, prev_pos = pos;951953952952- ret = do_splice_to(in, &pos, pipe, len, flags);954954+ /* Don't try to read more the pipe has space for. */955955+ read_len = min_t(size_t, len,956956+ (pipe->buffers - pipe->nrbufs) << PAGE_SHIFT);957957+ ret = do_splice_to(in, &pos, pipe, read_len, flags);953958 if (unlikely(ret <= 0))954959 goto out_release;955960
+1-1
fs/xfs/libxfs/xfs_btree.c
···330330331331 if (xfs_sb_version_hascrc(&mp->m_sb)) {332332 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn)))333333- return __this_address;333333+ return false;334334 return xfs_buf_verify_cksum(bp, XFS_BTREE_SBLOCK_CRC_OFF);335335 }336336
+2-2
fs/xfs/xfs_bmap_util.c
···11261126 * page could be mmap'd and iomap_zero_range doesn't do that for us.11271127 * Writeback of the eof page will do this, albeit clumsily.11281128 */11291129- if (offset + len >= XFS_ISIZE(ip) && ((offset + len) & PAGE_MASK)) {11291129+ if (offset + len >= XFS_ISIZE(ip) && offset_in_page(offset + len) > 0) {11301130 error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping,11311131- (offset + len) & ~PAGE_MASK, LLONG_MAX);11311131+ round_down(offset + len, PAGE_SIZE), LLONG_MAX);11321132 }1133113311341134 return error;
···905905906906 bool probe_done;907907908908+ /*909909+ * We must offload the handling of the primary/sub channels910910+ * from the single-threaded vmbus_connection.work_queue to911911+ * two different workqueue, otherwise we can block912912+ * vmbus_connection.work_queue and hang: see vmbus_process_offer().913913+ */914914+ struct work_struct add_channel_work;908915};909916910917static inline bool is_hvsock_channel(const struct vmbus_channel *c)
···224224 *225225 * See the SFF-8472 specification and related documents for the definition226226 * of these structure members. This can be obtained from227227- * ftp://ftp.seagate.com/sff227227+ * https://www.snia.org/technology-communities/sff/specifications228228 */229229struct sfp_eeprom_id {230230 struct sfp_eeprom_base base;
···21702170 * Return21712171 * 0 on success, or a negative error in case of failure.21722172 *21732173- * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)21732173+ * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)21742174 * Description21752175 * Look for TCP socket matching *tuple*, optionally in a child21762176 * network namespace *netns*. The return value must be checked,···21872187 * **sizeof**\ (*tuple*\ **->ipv6**)21882188 * Look for an IPv6 socket.21892189 *21902190- * If the *netns* is zero, then the socket lookup table in the21912191- * netns associated with the *ctx* will be used. For the TC hooks,21922192- * this in the netns of the device in the skb. For socket hooks,21932193- * this in the netns of the socket. If *netns* is non-zero, then21942194- * it specifies the ID of the netns relative to the netns21952195- * associated with the *ctx*.21902190+ * If the *netns* is a negative signed 32-bit integer, then the21912191+ * socket lookup table in the netns associated with the *ctx* will21922192+ * will be used. For the TC hooks, this is the netns of the device21932193+ * in the skb. For socket hooks, this is the netns of the socket.21942194+ * If *netns* is any other signed 32-bit value greater than or21952195+ * equal to zero then it specifies the ID of the netns relative to21962196+ * the netns associated with the *ctx*. *netns* values beyond the21972197+ * range of 32-bit integers are reserved for future use.21962198 *21972199 * All values for *flags* are reserved for future usage, and must21982200 * be left at zero.···22032201 * **CONFIG_NET** configuration option.22042202 * Return22052203 * Pointer to *struct bpf_sock*, or NULL in case of failure.22042204+ * For sockets with reuseport option, the *struct bpf_sock*22052205+ * result is from reuse->socks[] using the hash of the tuple.22062206 *22072207- * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)22072207+ * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)22082208 * Description22092209 * Look for UDP socket matching *tuple*, optionally in a child22102210 * network namespace *netns*. The return value must be checked,···22232219 * **sizeof**\ (*tuple*\ **->ipv6**)22242220 * Look for an IPv6 socket.22252221 *22262226- * If the *netns* is zero, then the socket lookup table in the22272227- * netns associated with the *ctx* will be used. For the TC hooks,22282228- * this in the netns of the device in the skb. For socket hooks,22292229- * this in the netns of the socket. If *netns* is non-zero, then22302230- * it specifies the ID of the netns relative to the netns22312231- * associated with the *ctx*.22222222+ * If the *netns* is a negative signed 32-bit integer, then the22232223+ * socket lookup table in the netns associated with the *ctx* will22242224+ * will be used. For the TC hooks, this is the netns of the device22252225+ * in the skb. For socket hooks, this is the netns of the socket.22262226+ * If *netns* is any other signed 32-bit value greater than or22272227+ * equal to zero then it specifies the ID of the netns relative to22282228+ * the netns associated with the *ctx*. *netns* values beyond the22292229+ * range of 32-bit integers are reserved for future use.22322230 *22332231 * All values for *flags* are reserved for future usage, and must22342232 * be left at zero.···22392233 * **CONFIG_NET** configuration option.22402234 * Return22412235 * Pointer to *struct bpf_sock*, or NULL in case of failure.22362236+ * For sockets with reuseport option, the *struct bpf_sock*22372237+ * result is from reuse->socks[] using the hash of the tuple.22422238 *22432239 * int bpf_sk_release(struct bpf_sock *sk)22442240 * Description···24132405/* BPF_FUNC_perf_event_output for sk_buff input context. */24142406#define BPF_F_CTXLEN_MASK (0xfffffULL << 32)2415240724082408+/* Current network namespace */24092409+#define BPF_F_CURRENT_NETNS (-1L)24102410+24162411/* Mode for BPF_FUNC_skb_adjust_room helper. */24172412enum bpf_adj_room_mode {24182413 BPF_ADJ_ROOM_NET,···24322421 BPF_LWT_ENCAP_SEG6,24332422 BPF_LWT_ENCAP_SEG6_INLINE24342423};24242424+24252425+#define __bpf_md_ptr(type, name) \24262426+union { \24272427+ type name; \24282428+ __u64 :64; \24292429+} __attribute__((aligned(8)))2435243024362431/* user accessible mirror of in-kernel sk_buff.24372432 * new fields can only be added to the end of this structure···24732456 /* ... here. */2474245724752458 __u32 data_meta;24762476- struct bpf_flow_keys *flow_keys;24592459+ __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);24772460};2478246124792462struct bpf_tunnel_key {···25892572 * be added to the end of this structure25902573 */25912574struct sk_msg_md {25922592- void *data;25932593- void *data_end;25752575+ __bpf_md_ptr(void *, data);25762576+ __bpf_md_ptr(void *, data_end);2594257725952578 __u32 family;25962579 __u32 remote_ip4; /* Stored in network byte order */···26062589 * Start of directly accessible data. It begins from26072590 * the tcp/udp header.26082591 */26092609- void *data;26102610- void *data_end; /* End of directly accessible data */25922592+ __bpf_md_ptr(void *, data);25932593+ /* End of directly accessible data */25942594+ __bpf_md_ptr(void *, data_end);26112595 /*26122596 * Total length of packet (starting from the tcp/udp header).26132597 * Note that the directly accessible bytes (data_end - data)
+82
kernel/bpf/btf.c
···55#include <uapi/linux/types.h>66#include <linux/seq_file.h>77#include <linux/compiler.h>88+#include <linux/ctype.h>89#include <linux/errno.h>910#include <linux/slab.h>1011#include <linux/anon_inodes.h>···425424{426425 return BTF_STR_OFFSET_VALID(offset) &&427426 offset < btf->hdr.str_len;427427+}428428+429429+/* Only C-style identifier is permitted. This can be relaxed if430430+ * necessary.431431+ */432432+static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)433433+{434434+ /* offset must be valid */435435+ const char *src = &btf->strings[offset];436436+ const char *src_limit;437437+438438+ if (!isalpha(*src) && *src != '_')439439+ return false;440440+441441+ /* set a limit on identifier length */442442+ src_limit = src + KSYM_NAME_LEN;443443+ src++;444444+ while (*src && src < src_limit) {445445+ if (!isalnum(*src) && *src != '_')446446+ return false;447447+ src++;448448+ }449449+450450+ return !*src;428451}429452430453static const char *btf_name_by_offset(const struct btf *btf, u32 offset)···11681143 return -EINVAL;11691144 }1170114511461146+ /* typedef type must have a valid name, and other ref types,11471147+ * volatile, const, restrict, should have a null name.11481148+ */11491149+ if (BTF_INFO_KIND(t->info) == BTF_KIND_TYPEDEF) {11501150+ if (!t->name_off ||11511151+ !btf_name_valid_identifier(env->btf, t->name_off)) {11521152+ btf_verifier_log_type(env, t, "Invalid name");11531153+ return -EINVAL;11541154+ }11551155+ } else {11561156+ if (t->name_off) {11571157+ btf_verifier_log_type(env, t, "Invalid name");11581158+ return -EINVAL;11591159+ }11601160+ }11611161+11711162 btf_verifier_log_type(env, t, NULL);1172116311731164 return 0;···13411300 return -EINVAL;13421301 }1343130213031303+ /* fwd type must have a valid name */13041304+ if (!t->name_off ||13051305+ !btf_name_valid_identifier(env->btf, t->name_off)) {13061306+ btf_verifier_log_type(env, t, "Invalid name");13071307+ return -EINVAL;13081308+ }13091309+13441310 btf_verifier_log_type(env, t, NULL);1345131113461312 return 0;···14011353 btf_verifier_log_basic(env, t,14021354 "meta_left:%u meta_needed:%u",14031355 meta_left, meta_needed);13561356+ return -EINVAL;13571357+ }13581358+13591359+ /* array type should not have a name */13601360+ if (t->name_off) {13611361+ btf_verifier_log_type(env, t, "Invalid name");14041362 return -EINVAL;14051363 }14061364···15861532 return -EINVAL;15871533 }1588153415351535+ /* struct type either no name or a valid one */15361536+ if (t->name_off &&15371537+ !btf_name_valid_identifier(env->btf, t->name_off)) {15381538+ btf_verifier_log_type(env, t, "Invalid name");15391539+ return -EINVAL;15401540+ }15411541+15891542 btf_verifier_log_type(env, t, NULL);1590154315911544 last_offset = 0;···16041543 return -EINVAL;16051544 }1606154515461546+ /* struct member either no name or a valid one */15471547+ if (member->name_off &&15481548+ !btf_name_valid_identifier(btf, member->name_off)) {15491549+ btf_verifier_log_member(env, t, member, "Invalid name");15501550+ return -EINVAL;15511551+ }16071552 /* A member cannot be in type void */16081553 if (!member->type || !BTF_TYPE_ID_VALID(member->type)) {16091554 btf_verifier_log_member(env, t, member,···17971730 return -EINVAL;17981731 }1799173217331733+ /* enum type either no name or a valid one */17341734+ if (t->name_off &&17351735+ !btf_name_valid_identifier(env->btf, t->name_off)) {17361736+ btf_verifier_log_type(env, t, "Invalid name");17371737+ return -EINVAL;17381738+ }17391739+18001740 btf_verifier_log_type(env, t, NULL);1801174118021742 for (i = 0; i < nr_enums; i++) {···18121738 enums[i].name_off);18131739 return -EINVAL;18141740 }17411741+17421742+ /* enum member must have a valid name */17431743+ if (!enums[i].name_off ||17441744+ !btf_name_valid_identifier(btf, enums[i].name_off)) {17451745+ btf_verifier_log_type(env, t, "Invalid name");17461746+ return -EINVAL;17471747+ }17481748+1815174918161750 btf_verifier_log(env, "\t%s val=%d\n",18171751 btf_name_by_offset(btf, enums[i].name_off),
+89-14
kernel/bpf/verifier.c
···175175176176#define BPF_COMPLEXITY_LIMIT_INSNS 131072177177#define BPF_COMPLEXITY_LIMIT_STACK 1024178178+#define BPF_COMPLEXITY_LIMIT_STATES 64178179179180#define BPF_MAP_PTR_UNPRIV 1UL180181#define BPF_MAP_PTR_POISON ((void *)((0xeB9FUL << 1) + \···37523751 }37533752}3754375337543754+/* compute branch direction of the expression "if (reg opcode val) goto target;"37553755+ * and return:37563756+ * 1 - branch will be taken and "goto target" will be executed37573757+ * 0 - branch will not be taken and fall-through to next insn37583758+ * -1 - unknown. Example: "if (reg < 5)" is unknown when register value range [0,10]37593759+ */37603760+static int is_branch_taken(struct bpf_reg_state *reg, u64 val, u8 opcode)37613761+{37623762+ if (__is_pointer_value(false, reg))37633763+ return -1;37643764+37653765+ switch (opcode) {37663766+ case BPF_JEQ:37673767+ if (tnum_is_const(reg->var_off))37683768+ return !!tnum_equals_const(reg->var_off, val);37693769+ break;37703770+ case BPF_JNE:37713771+ if (tnum_is_const(reg->var_off))37723772+ return !tnum_equals_const(reg->var_off, val);37733773+ break;37743774+ case BPF_JGT:37753775+ if (reg->umin_value > val)37763776+ return 1;37773777+ else if (reg->umax_value <= val)37783778+ return 0;37793779+ break;37803780+ case BPF_JSGT:37813781+ if (reg->smin_value > (s64)val)37823782+ return 1;37833783+ else if (reg->smax_value < (s64)val)37843784+ return 0;37853785+ break;37863786+ case BPF_JLT:37873787+ if (reg->umax_value < val)37883788+ return 1;37893789+ else if (reg->umin_value >= val)37903790+ return 0;37913791+ break;37923792+ case BPF_JSLT:37933793+ if (reg->smax_value < (s64)val)37943794+ return 1;37953795+ else if (reg->smin_value >= (s64)val)37963796+ return 0;37973797+ break;37983798+ case BPF_JGE:37993799+ if (reg->umin_value >= val)38003800+ return 1;38013801+ else if (reg->umax_value < val)38023802+ return 0;38033803+ break;38043804+ case BPF_JSGE:38053805+ if (reg->smin_value >= (s64)val)38063806+ return 1;38073807+ else if (reg->smax_value < (s64)val)38083808+ return 0;38093809+ break;38103810+ case BPF_JLE:38113811+ if (reg->umax_value <= val)38123812+ return 1;38133813+ else if (reg->umin_value > val)38143814+ return 0;38153815+ break;38163816+ case BPF_JSLE:38173817+ if (reg->smax_value <= (s64)val)38183818+ return 1;38193819+ else if (reg->smin_value > (s64)val)38203820+ return 0;38213821+ break;38223822+ }38233823+38243824+ return -1;38253825+}38263826+37553827/* Adjusts the register min/max values in the case that the dst_reg is the37563828 * variable register that we are working on, and src_reg is a constant or we're37573829 * simply doing a BPF_K check.···4226415242274153 dst_reg = ®s[insn->dst_reg];4228415442294229- /* detect if R == 0 where R was initialized to zero earlier */42304230- if (BPF_SRC(insn->code) == BPF_K &&42314231- (opcode == BPF_JEQ || opcode == BPF_JNE) &&42324232- dst_reg->type == SCALAR_VALUE &&42334233- tnum_is_const(dst_reg->var_off)) {42344234- if ((opcode == BPF_JEQ && dst_reg->var_off.value == insn->imm) ||42354235- (opcode == BPF_JNE && dst_reg->var_off.value != insn->imm)) {42364236- /* if (imm == imm) goto pc+off;42374237- * only follow the goto, ignore fall-through42384238- */41554155+ if (BPF_SRC(insn->code) == BPF_K) {41564156+ int pred = is_branch_taken(dst_reg, insn->imm, opcode);41574157+41584158+ if (pred == 1) {41594159+ /* only follow the goto, ignore fall-through */42394160 *insn_idx += insn->off;42404161 return 0;42414241- } else {42424242- /* if (imm != imm) goto pc+off;42434243- * only follow fall-through branch, since41624162+ } else if (pred == 0) {41634163+ /* only follow fall-through branch, since42444164 * that's where the program will go42454165 */42464166 return 0;···50484980 struct bpf_verifier_state_list *new_sl;50494981 struct bpf_verifier_state_list *sl;50504982 struct bpf_verifier_state *cur = env->cur_state, *new;50515051- int i, j, err;49834983+ int i, j, err, states_cnt = 0;5052498450534985 sl = env->explored_states[insn_idx];50544986 if (!sl)···50755007 return 1;50765008 }50775009 sl = sl->next;50105010+ states_cnt++;50785011 }50125012+50135013+ if (!env->allow_ptr_leaks && states_cnt > BPF_COMPLEXITY_LIMIT_STATES)50145014+ return 0;5079501550805016 /* there were no equivalent states, remember current one.50815017 * technically the current state is not proven to be safe yet,···52195147 }52205148 goto process_bpf_exit;52215149 }51505150+51515151+ if (signal_pending(current))51525152+ return -EAGAIN;5222515352235154 if (need_resched())52245155 cond_resched();
+2
kernel/events/uprobes.c
···572572 * gets called, we don't get a chance to remove uprobe from573573 * delayed_uprobe_list from remove_breakpoint(). Do it here.574574 */575575+ mutex_lock(&delayed_uprobe_lock);575576 delayed_uprobe_remove(uprobe, NULL);577577+ mutex_unlock(&delayed_uprobe_lock);576578 kfree(uprobe);577579 }578580}
+1-1
kernel/stackleak.c
···104104}105105NOKPROBE_SYMBOL(stackleak_erase);106106107107-void __used stackleak_track_stack(void)107107+void __used notrace stackleak_track_stack(void)108108{109109 /*110110 * N.B. stackleak_erase() fills the kernel stack with the poison value,
+20-31
mm/huge_memory.c
···629629 * available630630 * never: never stall for any thp allocation631631 */632632-static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma, unsigned long addr)632632+static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma)633633{634634 const bool vma_madvised = !!(vma->vm_flags & VM_HUGEPAGE);635635- gfp_t this_node = 0;636635637637-#ifdef CONFIG_NUMA638638- struct mempolicy *pol;639639- /*640640- * __GFP_THISNODE is used only when __GFP_DIRECT_RECLAIM is not641641- * specified, to express a general desire to stay on the current642642- * node for optimistic allocation attempts. If the defrag mode643643- * and/or madvise hint requires the direct reclaim then we prefer644644- * to fallback to other node rather than node reclaim because that645645- * can lead to excessive reclaim even though there is free memory646646- * on other nodes. We expect that NUMA preferences are specified647647- * by memory policies.648648- */649649- pol = get_vma_policy(vma, addr);650650- if (pol->mode != MPOL_BIND)651651- this_node = __GFP_THISNODE;652652- mpol_cond_put(pol);653653-#endif654654-636636+ /* Always do synchronous compaction */655637 if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags))656638 return GFP_TRANSHUGE | (vma_madvised ? 0 : __GFP_NORETRY);639639+640640+ /* Kick kcompactd and fail quickly */657641 if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags))658658- return GFP_TRANSHUGE_LIGHT | __GFP_KSWAPD_RECLAIM | this_node;642642+ return GFP_TRANSHUGE_LIGHT | __GFP_KSWAPD_RECLAIM;643643+644644+ /* Synchronous compaction if madvised, otherwise kick kcompactd */659645 if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags))660660- return GFP_TRANSHUGE_LIGHT | (vma_madvised ? __GFP_DIRECT_RECLAIM :661661- __GFP_KSWAPD_RECLAIM | this_node);646646+ return GFP_TRANSHUGE_LIGHT |647647+ (vma_madvised ? __GFP_DIRECT_RECLAIM :648648+ __GFP_KSWAPD_RECLAIM);649649+650650+ /* Only do synchronous compaction if madvised */662651 if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags))663663- return GFP_TRANSHUGE_LIGHT | (vma_madvised ? __GFP_DIRECT_RECLAIM :664664- this_node);665665- return GFP_TRANSHUGE_LIGHT | this_node;652652+ return GFP_TRANSHUGE_LIGHT |653653+ (vma_madvised ? __GFP_DIRECT_RECLAIM : 0);654654+655655+ return GFP_TRANSHUGE_LIGHT;666656}667657668658/* Caller must hold page table lock. */···724734 pte_free(vma->vm_mm, pgtable);725735 return ret;726736 }727727- gfp = alloc_hugepage_direct_gfpmask(vma, haddr);728728- page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, vma, haddr, numa_node_id());737737+ gfp = alloc_hugepage_direct_gfpmask(vma);738738+ page = alloc_hugepage_vma(gfp, vma, haddr, HPAGE_PMD_ORDER);729739 if (unlikely(!page)) {730740 count_vm_event(THP_FAULT_FALLBACK);731741 return VM_FAULT_FALLBACK;···12951305alloc:12961306 if (transparent_hugepage_enabled(vma) &&12971307 !transparent_hugepage_debug_cow()) {12981298- huge_gfp = alloc_hugepage_direct_gfpmask(vma, haddr);12991299- new_page = alloc_pages_vma(huge_gfp, HPAGE_PMD_ORDER, vma,13001300- haddr, numa_node_id());13081308+ huge_gfp = alloc_hugepage_direct_gfpmask(vma);13091309+ new_page = alloc_hugepage_vma(huge_gfp, vma, haddr, HPAGE_PMD_ORDER);13011310 } else13021311 new_page = NULL;13031312
+4-2
mm/memory-failure.c
···11611161 LIST_HEAD(tokill);11621162 int rc = -EBUSY;11631163 loff_t start;11641164+ dax_entry_t cookie;1164116511651166 /*11661167 * Prevent the inode from being freed while we are interrogating···11701169 * also prevents changes to the mapping of this pfn until11711170 * poison signaling is complete.11721171 */11731173- if (!dax_lock_mapping_entry(page))11721172+ cookie = dax_lock_page(page);11731173+ if (!cookie)11741174 goto out;1175117511761176 if (hwpoison_filter(page)) {···12221220 kill_procs(&tokill, flags & MF_MUST_KILL, !unmap_success, pfn, flags);12231221 rc = 0;12241222unlock:12251225- dax_unlock_mapping_entry(page);12231223+ dax_unlock_page(page, cookie);12261224out:12271225 /* drop pgmap ref acquired in caller */12281226 put_dev_pagemap(pgmap);
+30-4
mm/mempolicy.c
···11161116 } else if (PageTransHuge(page)) {11171117 struct page *thp;1118111811191119- thp = alloc_pages_vma(GFP_TRANSHUGE, HPAGE_PMD_ORDER, vma,11201120- address, numa_node_id());11191119+ thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,11201120+ HPAGE_PMD_ORDER);11211121 if (!thp)11221122 return NULL;11231123 prep_transhuge_page(thp);···16621662 * freeing by another task. It is the caller's responsibility to free the16631663 * extra reference for shared policies.16641664 */16651665-struct mempolicy *get_vma_policy(struct vm_area_struct *vma,16651665+static struct mempolicy *get_vma_policy(struct vm_area_struct *vma,16661666 unsigned long addr)16671667{16681668 struct mempolicy *pol = __get_vma_policy(vma, addr);···20112011 * @vma: Pointer to VMA or NULL if not available.20122012 * @addr: Virtual Address of the allocation. Must be inside the VMA.20132013 * @node: Which node to prefer for allocation (modulo policy).20142014+ * @hugepage: for hugepages try only the preferred node if possible20142015 *20152016 * This function allocates a page from the kernel page pool and applies20162017 * a NUMA policy associated with the VMA or the current process.···20222021 */20232022struct page *20242023alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,20252025- unsigned long addr, int node)20242024+ unsigned long addr, int node, bool hugepage)20262025{20272026 struct mempolicy *pol;20282027 struct page *page;···20382037 mpol_cond_put(pol);20392038 page = alloc_page_interleave(gfp, order, nid);20402039 goto out;20402040+ }20412041+20422042+ if (unlikely(IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && hugepage)) {20432043+ int hpage_node = node;20442044+20452045+ /*20462046+ * For hugepage allocation and non-interleave policy which20472047+ * allows the current node (or other explicitly preferred20482048+ * node) we only try to allocate from the current/preferred20492049+ * node and don't fall back to other nodes, as the cost of20502050+ * remote accesses would likely offset THP benefits.20512051+ *20522052+ * If the policy is interleave, or does not allow the current20532053+ * node in its nodemask, we allocate the standard way.20542054+ */20552055+ if (pol->mode == MPOL_PREFERRED && !(pol->flags & MPOL_F_LOCAL))20562056+ hpage_node = pol->v.preferred_node;20572057+20582058+ nmask = policy_nodemask(gfp, pol);20592059+ if (!nmask || node_isset(hpage_node, *nmask)) {20602060+ mpol_cond_put(pol);20612061+ page = __alloc_pages_node(hpage_node,20622062+ gfp | __GFP_THISNODE, order);20632063+ goto out;20642064+ }20412065 }2042206620432067 nmask = policy_nodemask(gfp, pol);
···158158 cpu_dp->orig_ethtool_ops = NULL;159159}160160161161+static ssize_t tagging_show(struct device *d, struct device_attribute *attr,162162+ char *buf)163163+{164164+ struct net_device *dev = to_net_dev(d);165165+ struct dsa_port *cpu_dp = dev->dsa_ptr;166166+167167+ return sprintf(buf, "%s\n",168168+ dsa_tag_protocol_to_str(cpu_dp->tag_ops));169169+}170170+static DEVICE_ATTR_RO(tagging);171171+172172+static struct attribute *dsa_slave_attrs[] = {173173+ &dev_attr_tagging.attr,174174+ NULL175175+};176176+177177+static const struct attribute_group dsa_group = {178178+ .name = "dsa",179179+ .attrs = dsa_slave_attrs,180180+};181181+161182int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp)162183{184184+ int ret;185185+163186 /* If we use a tagging format that doesn't have an ethertype164187 * field, make sure that all packets from this point on get165188 * sent to the tag format's receive function.···191168192169 dev->dsa_ptr = cpu_dp;193170194194- return dsa_master_ethtool_setup(dev);171171+ ret = dsa_master_ethtool_setup(dev);172172+ if (ret)173173+ return ret;174174+175175+ ret = sysfs_create_group(&dev->dev.kobj, &dsa_group);176176+ if (ret)177177+ dsa_master_ethtool_teardown(dev);178178+179179+ return ret;195180}196181197182void dsa_master_teardown(struct net_device *dev)198183{184184+ sysfs_remove_group(&dev->dev.kobj, &dsa_group);199185 dsa_master_ethtool_teardown(dev);200186201187 dev->dsa_ptr = NULL;
···515515 struct rb_node *rbn;516516 int len;517517 int ihlen;518518+ int delta;518519 int err;519520 u8 ecn;520521···557556 if (len > 65535)558557 goto out_oversize;559558559559+ delta = - head->truesize;560560+560561 /* Head of list must not be cloned. */561562 if (skb_unclone(head, GFP_ATOMIC))562563 goto out_nomem;564564+565565+ delta += head->truesize;566566+ if (delta)567567+ add_frag_mem_limit(qp->q.net, delta);563568564569 /* If the first fragment is fragmented itself, we split565570 * it to two chunks: the first with data and paged part
+2-2
net/ipv4/ip_input.c
···547547 list_for_each_entry_safe(skb, next, head, list) {548548 struct dst_entry *dst;549549550550- list_del(&skb->list);550550+ skb_list_del_init(skb);551551 /* if ingress device is enslaved to an L3 master device pass the552552 * skb to its handler for processing553553 */···594594 struct net_device *dev = skb->dev;595595 struct net *net = dev_net(dev);596596597597- list_del(&skb->list);597597+ skb_list_del_init(skb);598598 skb = ip_rcv_core(skb, net);599599 if (skb == NULL)600600 continue;
+32-13
net/ipv4/tcp_output.c
···19041904 * This algorithm is from John Heffner.19051905 */19061906static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb,19071907- bool *is_cwnd_limited, u32 max_segs)19071907+ bool *is_cwnd_limited,19081908+ bool *is_rwnd_limited,19091909+ u32 max_segs)19081910{19091911 const struct inet_connection_sock *icsk = inet_csk(sk);19101912 u32 age, send_win, cong_win, limit, in_flight;19111913 struct tcp_sock *tp = tcp_sk(sk);19121914 struct sk_buff *head;19131915 int win_divisor;19141914-19151915- if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)19161916- goto send_now;1917191619181917 if (icsk->icsk_ca_state >= TCP_CA_Recovery)19191918 goto send_now;···19721973 if (age < (tp->srtt_us >> 4))19731974 goto send_now;1974197519751975- /* Ok, it looks like it is advisable to defer. */19761976+ /* Ok, it looks like it is advisable to defer.19771977+ * Three cases are tracked :19781978+ * 1) We are cwnd-limited19791979+ * 2) We are rwnd-limited19801980+ * 3) We are application limited.19811981+ */19821982+ if (cong_win < send_win) {19831983+ if (cong_win <= skb->len) {19841984+ *is_cwnd_limited = true;19851985+ return true;19861986+ }19871987+ } else {19881988+ if (send_win <= skb->len) {19891989+ *is_rwnd_limited = true;19901990+ return true;19911991+ }19921992+ }1976199319771977- if (cong_win < send_win && cong_win <= skb->len)19781978- *is_cwnd_limited = true;19941994+ /* If this packet won't get more data, do not wait. */19951995+ if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)19961996+ goto send_now;1979199719801998 return true;19811999···23722356 } else {23732357 if (!push_one &&23742358 tcp_tso_should_defer(sk, skb, &is_cwnd_limited,23752375- max_segs))23592359+ &is_rwnd_limited, max_segs))23762360 break;23772361 }23782362···25102494 goto rearm_timer;25112495 }25122496 skb = skb_rb_last(&sk->tcp_rtx_queue);24972497+ if (unlikely(!skb)) {24982498+ WARN_ONCE(tp->packets_out,24992499+ "invalid inflight: %u state %u cwnd %u mss %d\n",25002500+ tp->packets_out, sk->sk_state, tp->snd_cwnd, mss);25012501+ inet_csk(sk)->icsk_pending = 0;25022502+ return;25032503+ }2513250425142505 /* At most one outstanding TLP retransmission. */25152506 if (tp->tlp_high_seq)25162516- goto rearm_timer;25172517-25182518- /* Retransmit last segment. */25192519- if (WARN_ON(!skb))25202507 goto rearm_timer;2521250825222509 if (skb_still_in_host_queue(sk, skb))···29392920 TCP_SKB_CB(skb)->sacked |= TCPCB_EVER_RETRANS;29402921 trace_tcp_retransmit_skb(sk, skb);29412922 } else if (err != -EBUSY) {29422942- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL);29232923+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPRETRANSFAIL, segs);29432924 }29442925 return err;29452926}
+5-5
net/ipv4/tcp_timer.c
···378378 return;379379 }380380381381- if (icsk->icsk_probes_out > max_probes) {381381+ if (icsk->icsk_probes_out >= max_probes) {382382abort: tcp_write_err(sk);383383 } else {384384 /* Only send another probe if we didn't close things up. */···484484 goto out_reset_timer;485485 }486486487487+ __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEOUTS);487488 if (tcp_write_timeout(sk))488489 goto out;489490490491 if (icsk->icsk_retransmits == 0) {491491- int mib_idx;492492+ int mib_idx = 0;492493493494 if (icsk->icsk_ca_state == TCP_CA_Recovery) {494495 if (tcp_is_sack(tp))···504503 mib_idx = LINUX_MIB_TCPSACKFAILURES;505504 else506505 mib_idx = LINUX_MIB_TCPRENOFAILURES;507507- } else {508508- mib_idx = LINUX_MIB_TCPTIMEOUTS;509506 }510510- __NET_INC_STATS(sock_net(sk), mib_idx);507507+ if (mib_idx)508508+ __NET_INC_STATS(sock_net(sk), mib_idx);511509 }512510513511 tcp_enter_loss(sk);
+2-2
net/ipv6/ip6_input.c
···9595 list_for_each_entry_safe(skb, next, head, list) {9696 struct dst_entry *dst;97979898- list_del(&skb->list);9898+ skb_list_del_init(skb);9999 /* if ingress device is enslaved to an L3 master device pass the100100 * skb to its handler for processing101101 */···296296 struct net_device *dev = skb->dev;297297 struct net *net = dev_net(dev);298298299299- list_del(&skb->list);299299+ skb_list_del_init(skb);300300 skb = ip6_rcv_core(skb, dev, net);301301 if (skb == NULL)302302 continue;
+21-21
net/ipv6/ip6_output.c
···195195 const struct ipv6_pinfo *np = inet6_sk(sk);196196 struct in6_addr *first_hop = &fl6->daddr;197197 struct dst_entry *dst = skb_dst(skb);198198+ unsigned int head_room;198199 struct ipv6hdr *hdr;199200 u8 proto = fl6->flowi6_proto;200201 int seg_len = skb->len;201202 int hlimit = -1;202203 u32 mtu;203204204204- if (opt) {205205- unsigned int head_room;205205+ head_room = sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);206206+ if (opt)207207+ head_room += opt->opt_nflen + opt->opt_flen;206208207207- /* First: exthdrs may take lots of space (~8K for now)208208- MAX_HEADER is not enough.209209- */210210- head_room = opt->opt_nflen + opt->opt_flen;211211- seg_len += head_room;212212- head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);213213-214214- if (skb_headroom(skb) < head_room) {215215- struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);216216- if (!skb2) {217217- IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),218218- IPSTATS_MIB_OUTDISCARDS);219219- kfree_skb(skb);220220- return -ENOBUFS;221221- }222222- if (skb->sk)223223- skb_set_owner_w(skb2, skb->sk);224224- consume_skb(skb);225225- skb = skb2;209209+ if (unlikely(skb_headroom(skb) < head_room)) {210210+ struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);211211+ if (!skb2) {212212+ IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),213213+ IPSTATS_MIB_OUTDISCARDS);214214+ kfree_skb(skb);215215+ return -ENOBUFS;226216 }217217+ if (skb->sk)218218+ skb_set_owner_w(skb2, skb->sk);219219+ consume_skb(skb);220220+ skb = skb2;221221+ }222222+223223+ if (opt) {224224+ seg_len += opt->opt_nflen + opt->opt_flen;225225+227226 if (opt->opt_flen)228227 ipv6_push_frag_opts(skb, opt, &proto);228228+229229 if (opt->opt_nflen)230230 ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop,231231 &fl6->saddr);
+7-1
net/ipv6/netfilter/nf_conntrack_reasm.c
···341341nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *prev, struct net_device *dev)342342{343343 struct sk_buff *fp, *head = fq->q.fragments;344344- int payload_len;344344+ int payload_len, delta;345345 u8 ecn;346346347347 inet_frag_kill(&fq->q);···363363 return false;364364 }365365366366+ delta = - head->truesize;367367+366368 /* Head of list must not be cloned. */367369 if (skb_unclone(head, GFP_ATOMIC))368370 return false;371371+372372+ delta += head->truesize;373373+ if (delta)374374+ add_frag_mem_limit(fq->q.net, delta);369375370376 /* If the first fragment is fragmented itself, we split371377 * it to two chunks: the first with data and paged part
+7-1
net/ipv6/reassembly.c
···281281{282282 struct net *net = container_of(fq->q.net, struct net, ipv6.frags);283283 struct sk_buff *fp, *head = fq->q.fragments;284284- int payload_len;284284+ int payload_len, delta;285285 unsigned int nhoff;286286 int sum_truesize;287287 u8 ecn;···322322 if (payload_len > IPV6_MAXPLEN)323323 goto out_oversize;324324325325+ delta = - head->truesize;326326+325327 /* Head of list must not be cloned. */326328 if (skb_unclone(head, GFP_ATOMIC))327329 goto out_oom;330330+331331+ delta += head->truesize;332332+ if (delta)333333+ add_frag_mem_limit(fq->q.net, delta);328334329335 /* If the first fragment is fragmented itself, we split330336 * it to two chunks: the first with data and paged part
···2891289128922892 len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len +28932893 beacon->proberesp_ies_len + beacon->assocresp_ies_len +28942894- beacon->probe_resp_len;28942894+ beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len;2895289528962896 new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL);28972897 if (!new_beacon)···29342934 memcpy(pos, beacon->probe_resp, beacon->probe_resp_len);29352935 pos += beacon->probe_resp_len;29362936 }29372937- if (beacon->ftm_responder)29382938- new_beacon->ftm_responder = beacon->ftm_responder;29372937+29382938+ /* might copy -1, meaning no changes requested */29392939+ new_beacon->ftm_responder = beacon->ftm_responder;29392940 if (beacon->lci) {29402941 new_beacon->lci_len = beacon->lci_len;29412942 new_beacon->lci = pos;
+2
net/mac80211/iface.c
···10151015 if (local->open_count == 0)10161016 ieee80211_clear_tx_pending(local);1017101710181018+ sdata->vif.bss_conf.beacon_int = 0;10191019+10181020 /*10191021 * If the interface goes down while suspended, presumably because10201022 * the device was unplugged and that happens before our resume,
+8-4
net/mac80211/mlme.c
···27662766{27672767 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;27682768 struct sta_info *sta;27692769+ bool result = true;2769277027702771 sdata_info(sdata, "authenticated\n");27712772 ifmgd->auth_data->done = true;···27792778 sta = sta_info_get(sdata, bssid);27802779 if (!sta) {27812780 WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);27822782- return false;27812781+ result = false;27822782+ goto out;27832783 }27842784 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {27852785 sdata_info(sdata, "failed moving %pM to auth\n", bssid);27862786- return false;27862786+ result = false;27872787+ goto out;27872788 }27882788- mutex_unlock(&sdata->local->sta_mtx);2789278927902790- return true;27902790+out:27912791+ mutex_unlock(&sdata->local->sta_mtx);27922792+ return result;27912793}2792279427932795static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
···964964 /* Track when last TDLS packet was ACKed */965965 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))966966 sta->status_stats.last_tdls_pkt_time = jiffies;967967+ } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) {968968+ return;967969 } else {968970 ieee80211_lost_packet(sta, info);969971 }
+2-2
net/mac80211/tx.c
···439439 if (ieee80211_hw_check(&tx->local->hw, QUEUE_CONTROL))440440 info->hw_queue = tx->sdata->vif.cab_queue;441441442442- /* no stations in PS mode */443443- if (!atomic_read(&ps->num_sta_ps))442442+ /* no stations in PS mode and no buffered packets */443443+ if (!atomic_read(&ps->num_sta_ps) && skb_queue_empty(&ps->bc_buf))444444 return TX_CONTINUE;445445446446 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM;
···431431 int count = 1;432432 int rc = NET_XMIT_SUCCESS;433433434434+ /* Do not fool qdisc_drop_all() */435435+ skb->prev = NULL;436436+434437 /* Random duplication */435438 if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor))436439 ++count;
+5-4
net/sctp/associola.c
···118118 asoc->flowlabel = sp->flowlabel;119119 asoc->dscp = sp->dscp;120120121121- /* Initialize default path MTU. */122122- asoc->pathmtu = sp->pathmtu;123123-124121 /* Set association default SACK delay */125122 asoc->sackdelay = msecs_to_jiffies(sp->sackdelay);126123 asoc->sackfreq = sp->sackfreq;···248251 if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams,249252 0, gfp))250253 goto fail_init;254254+255255+ /* Initialize default path MTU. */256256+ asoc->pathmtu = sp->pathmtu;257257+ sctp_assoc_update_frag_point(asoc);251258252259 /* Assume that peer would support both address types unless we are253260 * told otherwise.···435434436435 WARN_ON(atomic_read(&asoc->rmem_alloc));437436438438- kfree(asoc);437437+ kfree_rcu(asoc, rcu);439438 SCTP_DBG_OBJCNT_DEC(assoc);440439}441440
+6
net/sctp/chunk.c
···191191 * the packet192192 */193193 max_data = asoc->frag_point;194194+ if (unlikely(!max_data)) {195195+ max_data = sctp_min_frag_point(sctp_sk(asoc->base.sk),196196+ sctp_datachk_len(&asoc->stream));197197+ pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%Zu)",198198+ __func__, asoc, max_data);199199+ }194200195201 /* If the the peer requested that we authenticate DATA chunks196202 * we need to account for bundling of the AUTH chunks along with
+3
net/sctp/sm_make_chunk.c
···24622462 asoc->c.sinit_max_instreams, gfp))24632463 goto clean_up;2464246424652465+ /* Update frag_point when stream_interleave may get changed. */24662466+ sctp_assoc_update_frag_point(asoc);24672467+24652468 if (!asoc->temp && sctp_assoc_set_id(asoc, gfp))24662469 goto clean_up;24672470
···330330{331331 size_t i,n;332332333333- if (!(buf->flags & XDRBUF_SPARSE_PAGES))333333+ if (!want || !(buf->flags & XDRBUF_SPARSE_PAGES))334334 return want;335335- if (want > buf->page_len)336336- want = buf->page_len;337335 n = (buf->page_base + want + PAGE_SIZE - 1) >> PAGE_SHIFT;338336 for (i = 0; i < n; i++) {339337 if (buf->pages[i])340338 continue;341339 buf->bvec[i].bv_page = buf->pages[i] = alloc_page(gfp);342340 if (!buf->pages[i]) {343343- buf->page_len = (i * PAGE_SIZE) - buf->page_base;344344- return buf->page_len;341341+ i *= PAGE_SIZE;342342+ return i > buf->page_base ? i - buf->page_base : 0;345343 }346344 }347345 return want;···376378xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,377379 size_t count)378380{379379- struct kvec kvec = { 0 };380380- return xs_read_kvec(sock, msg, flags | MSG_TRUNC, &kvec, count, 0);381381+ iov_iter_discard(&msg->msg_iter, READ, count);382382+ return sock_recvmsg(sock, msg, flags);381383}382384383385static ssize_t···396398 if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC))397399 goto out;398400 if (ret != want)399399- goto eagain;401401+ goto out;400402 seek = 0;401403 } else {402404 seek -= buf->head[0].iov_len;403405 offset += buf->head[0].iov_len;404406 }405405- if (seek < buf->page_len) {406406- want = xs_alloc_sparse_pages(buf,407407- min_t(size_t, count - offset, buf->page_len),408408- GFP_NOWAIT);407407+408408+ want = xs_alloc_sparse_pages(buf,409409+ min_t(size_t, count - offset, buf->page_len),410410+ GFP_NOWAIT);411411+ if (seek < want) {409412 ret = xs_read_bvec(sock, msg, flags, buf->bvec,410413 xdr_buf_pagecount(buf),411414 want + buf->page_base,···417418 if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC))418419 goto out;419420 if (ret != want)420420- goto eagain;421421+ goto out;421422 seek = 0;422423 } else {423423- seek -= buf->page_len;424424- offset += buf->page_len;424424+ seek -= want;425425+ offset += want;425426 }427427+426428 if (seek < buf->tail[0].iov_len) {427429 want = min_t(size_t, count - offset, buf->tail[0].iov_len);428430 ret = xs_read_kvec(sock, msg, flags, &buf->tail[0], want, seek);···433433 if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC))434434 goto out;435435 if (ret != want)436436- goto eagain;436436+ goto out;437437 } else438438 offset += buf->tail[0].iov_len;439439 ret = -EMSGSIZE;440440- msg->msg_flags |= MSG_TRUNC;441440out:442441 *read = offset - seek_init;443442 return ret;444444-eagain:445445- ret = -EAGAIN;446446- goto out;447443sock_err:448444 offset += seek;449445 goto out;···482486 if (transport->recv.offset == transport->recv.len) {483487 if (xs_read_stream_request_done(transport))484488 msg->msg_flags |= MSG_EOR;485485- return transport->recv.copied;489489+ return read;486490 }487491488492 switch (ret) {493493+ default:494494+ break;495495+ case -EFAULT:489496 case -EMSGSIZE:490490- return transport->recv.copied;497497+ msg->msg_flags |= MSG_TRUNC;498498+ return read;491499 case 0:492500 return -ESHUTDOWN;493493- default:494494- if (ret < 0)495495- return ret;496501 }497497- return -EAGAIN;502502+ return ret < 0 ? ret : read;498503}499504500505static size_t···534537535538 ret = xs_read_stream_request(transport, msg, flags, req);536539 if (msg->msg_flags & (MSG_EOR|MSG_TRUNC))537537- xprt_complete_bc_request(req, ret);540540+ xprt_complete_bc_request(req, transport->recv.copied);538541539542 return ret;540543}···567570568571 spin_lock(&xprt->queue_lock);569572 if (msg->msg_flags & (MSG_EOR|MSG_TRUNC))570570- xprt_complete_rqst(req->rq_task, ret);573573+ xprt_complete_rqst(req->rq_task, transport->recv.copied);571574 xprt_unpin_rqst(req);572575out:573576 spin_unlock(&xprt->queue_lock);···588591 if (ret <= 0)589592 goto out_err;590593 transport->recv.offset = ret;591591- if (ret != want) {592592- ret = -EAGAIN;593593- goto out_err;594594- }594594+ if (transport->recv.offset != want)595595+ return transport->recv.offset;595596 transport->recv.len = be32_to_cpu(transport->recv.fraghdr) &596597 RPC_FRAGMENT_SIZE_MASK;597598 transport->recv.offset -= sizeof(transport->recv.fraghdr);···597602 }598603599604 switch (be32_to_cpu(transport->recv.calldir)) {605605+ default:606606+ msg.msg_flags |= MSG_TRUNC;607607+ break;600608 case RPC_CALL:601609 ret = xs_read_stream_call(transport, &msg, flags);602610 break;···614616 goto out_err;615617 read += ret;616618 if (transport->recv.offset < transport->recv.len) {619619+ if (!(msg.msg_flags & MSG_TRUNC))620620+ return read;621621+ msg.msg_flags = 0;617622 ret = xs_read_discard(transport->sock, &msg, flags,618623 transport->recv.len - transport->recv.offset);619624 if (ret <= 0)···624623 transport->recv.offset += ret;625624 read += ret;626625 if (transport->recv.offset != transport->recv.len)627627- return -EAGAIN;626626+ return read;628627 }629628 if (xs_read_stream_request_done(transport)) {630629 trace_xs_stream_read_request(transport);···634633 transport->recv.len = 0;635634 return read;636635out_err:637637- switch (ret) {638638- case 0:639639- case -ESHUTDOWN:640640- xprt_force_disconnect(&transport->xprt);641641- return -ESHUTDOWN;642642- }643643- return ret;636636+ return ret != 0 ? ret : -ESHUTDOWN;644637}645638646639static void xs_stream_data_receive(struct sock_xprt *transport)···643648 ssize_t ret = 0;644649645650 mutex_lock(&transport->recv_mutex);651651+ clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state);646652 if (transport->sock == NULL)647653 goto out;648648- clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state);649654 for (;;) {650655 ret = xs_read_stream(transport, MSG_DONTWAIT);651651- if (ret <= 0)656656+ if (ret < 0)652657 break;653658 read += ret;654659 cond_resched();···13401345 int err;1341134613421347 mutex_lock(&transport->recv_mutex);13481348+ clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state);13431349 sk = transport->inet;13441350 if (sk == NULL)13451351 goto out;13461346- clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state);13471352 for (;;) {13481353 skb = skb_recv_udp(sk, 0, 1, &err);13491354 if (skb == NULL)
+2-2
net/wireless/mlme.c
···272272273273 p1 = (u8*)(ht_capa);274274 p2 = (u8*)(ht_capa_mask);275275- for (i = 0; i<sizeof(*ht_capa); i++)275275+ for (i = 0; i < sizeof(*ht_capa); i++)276276 p1[i] &= p2[i];277277}278278279279-/* Do a logical ht_capa &= ht_capa_mask. */279279+/* Do a logical vht_capa &= vht_capa_mask. */280280void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,281281 const struct ieee80211_vht_cap *vht_capa_mask)282282{
···642642 * All devices must be idle as otherwise if you are actively643643 * scanning some new beacon hints could be learned and would644644 * count as new regulatory hints.645645+ * Also if there is any other active beaconing interface we646646+ * need not issue a disconnect hint and reset any info such647647+ * as chan dfs state, etc.645648 */646649 list_for_each_entry(rdev, &cfg80211_rdev_list, list) {647650 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {648651 wdev_lock(wdev);649649- if (wdev->conn || wdev->current_bss)652652+ if (wdev->conn || wdev->current_bss ||653653+ cfg80211_beaconing_iface_active(wdev))650654 is_all_idle = false;651655 wdev_unlock(wdev);652656 }···1175117111761172 cfg80211_oper_and_ht_capa(&connect->ht_capa_mask,11771173 rdev->wiphy.ht_capa_mod_mask);11741174+ cfg80211_oper_and_vht_capa(&connect->vht_capa_mask,11751175+ rdev->wiphy.vht_capa_mod_mask);1178117611791177 if (connkeys && connkeys->def >= 0) {11801178 int idx;
···363363 PASS_POS_INSERT_BEFORE);364364365365 /*366366- * The stackleak_cleanup pass should be executed after the367367- * "reload" pass, when the stack frame size is final.366366+ * The stackleak_cleanup pass should be executed before the "*free_cfg"367367+ * pass. It's the moment when the stack frame size is already final,368368+ * function prologues and epilogues are generated, and the369369+ * machine-dependent code transformations are not done.368370 */369369- PASS_INFO(stackleak_cleanup, "reload", 1, PASS_POS_INSERT_AFTER);371371+ PASS_INFO(stackleak_cleanup, "*free_cfg", 1, PASS_POS_INSERT_BEFORE);370372371373 if (!plugin_default_version_check(version, &gcc_version)) {372374 error(G_("incompatible gcc/plugin versions"));
+8-6
sound/core/pcm_native.c
···3636#include <sound/timer.h>3737#include <sound/minors.h>3838#include <linux/uio.h>3939+#include <linux/delay.h>39404041#include "pcm_local.h"4142···9291 * and this may lead to a deadlock when the code path takes read sem9392 * twice (e.g. one in snd_pcm_action_nonatomic() and another in9493 * snd_pcm_stream_lock()). As a (suboptimal) workaround, let writer to9595- * spin until it gets the lock.9494+ * sleep until all the readers are completed without blocking by writer.9695 */9797-static inline void down_write_nonblock(struct rw_semaphore *lock)9696+static inline void down_write_nonfifo(struct rw_semaphore *lock)9897{9998 while (!down_write_trylock(lock))100100- cond_resched();9999+ msleep(1);101100}102101103102#define PCM_LOCK_DEFAULT 0···19681967 res = -ENOMEM;19691968 goto _nolock;19701969 }19711971- down_write_nonblock(&snd_pcm_link_rwsem);19701970+ down_write_nonfifo(&snd_pcm_link_rwsem);19721971 write_lock_irq(&snd_pcm_link_rwlock);19731972 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN ||19741973 substream->runtime->status->state != substream1->runtime->status->state ||···20152014 struct snd_pcm_substream *s;20162015 int res = 0;2017201620182018- down_write_nonblock(&snd_pcm_link_rwsem);20172017+ down_write_nonfifo(&snd_pcm_link_rwsem);20192018 write_lock_irq(&snd_pcm_link_rwlock);20202019 if (!snd_pcm_stream_linked(substream)) {20212020 res = -EALREADY;···2370236923712370static void pcm_release_private(struct snd_pcm_substream *substream)23722371{23732373- snd_pcm_unlink(substream);23722372+ if (snd_pcm_stream_linked(substream))23732373+ snd_pcm_unlink(substream);23742374}2375237523762376void snd_pcm_release_substream(struct snd_pcm_substream *substream)
···682682683683 __error:684684 if (chip) {685685+ /* chip->active is inside the chip->card object,686686+ * decrement before memory is possibly returned.687687+ */688688+ atomic_dec(&chip->active);685689 if (!chip->num_interfaces)686690 snd_card_free(chip->card);687687- atomic_dec(&chip->active);688691 }689692 mutex_unlock(®ister_mutex);690693 return err;
+1
sound/usb/quirks.c
···13731373 return SNDRV_PCM_FMTBIT_DSD_U32_BE;13741374 break;1375137513761376+ case USB_ID(0x152a, 0x85de): /* SMSL D1 DAC */13761377 case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */13771378 case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */13781379 case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */
+3-3
tools/bpf/bpftool/btf_dumper.c
···3232}33333434static int btf_dumper_modifier(const struct btf_dumper *d, __u32 type_id,3535- const void *data)3535+ __u8 bit_offset, const void *data)3636{3737 int actual_type_id;3838···4040 if (actual_type_id < 0)4141 return actual_type_id;42424343- return btf_dumper_do_type(d, actual_type_id, 0, data);4343+ return btf_dumper_do_type(d, actual_type_id, bit_offset, data);4444}45454646static void btf_dumper_enum(const void *data, json_writer_t *jw)···237237 case BTF_KIND_VOLATILE:238238 case BTF_KIND_CONST:239239 case BTF_KIND_RESTRICT:240240- return btf_dumper_modifier(d, type_id, data);240240+ return btf_dumper_modifier(d, type_id, bit_offset, data);241241 default:242242 jsonw_printf(d->jw, "(unsupported-kind");243243 return -EINVAL;
+37-19
tools/include/uapi/linux/bpf.h
···21702170 * Return21712171 * 0 on success, or a negative error in case of failure.21722172 *21732173- * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)21732173+ * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)21742174 * Description21752175 * Look for TCP socket matching *tuple*, optionally in a child21762176 * network namespace *netns*. The return value must be checked,···21872187 * **sizeof**\ (*tuple*\ **->ipv6**)21882188 * Look for an IPv6 socket.21892189 *21902190- * If the *netns* is zero, then the socket lookup table in the21912191- * netns associated with the *ctx* will be used. For the TC hooks,21922192- * this in the netns of the device in the skb. For socket hooks,21932193- * this in the netns of the socket. If *netns* is non-zero, then21942194- * it specifies the ID of the netns relative to the netns21952195- * associated with the *ctx*.21902190+ * If the *netns* is a negative signed 32-bit integer, then the21912191+ * socket lookup table in the netns associated with the *ctx* will21922192+ * will be used. For the TC hooks, this is the netns of the device21932193+ * in the skb. For socket hooks, this is the netns of the socket.21942194+ * If *netns* is any other signed 32-bit value greater than or21952195+ * equal to zero then it specifies the ID of the netns relative to21962196+ * the netns associated with the *ctx*. *netns* values beyond the21972197+ * range of 32-bit integers are reserved for future use.21962198 *21972199 * All values for *flags* are reserved for future usage, and must21982200 * be left at zero.···22032201 * **CONFIG_NET** configuration option.22042202 * Return22052203 * Pointer to *struct bpf_sock*, or NULL in case of failure.22042204+ * For sockets with reuseport option, the *struct bpf_sock*22052205+ * result is from reuse->socks[] using the hash of the tuple.22062206 *22072207- * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)22072207+ * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)22082208 * Description22092209 * Look for UDP socket matching *tuple*, optionally in a child22102210 * network namespace *netns*. The return value must be checked,···22232219 * **sizeof**\ (*tuple*\ **->ipv6**)22242220 * Look for an IPv6 socket.22252221 *22262226- * If the *netns* is zero, then the socket lookup table in the22272227- * netns associated with the *ctx* will be used. For the TC hooks,22282228- * this in the netns of the device in the skb. For socket hooks,22292229- * this in the netns of the socket. If *netns* is non-zero, then22302230- * it specifies the ID of the netns relative to the netns22312231- * associated with the *ctx*.22222222+ * If the *netns* is a negative signed 32-bit integer, then the22232223+ * socket lookup table in the netns associated with the *ctx* will22242224+ * will be used. For the TC hooks, this is the netns of the device22252225+ * in the skb. For socket hooks, this is the netns of the socket.22262226+ * If *netns* is any other signed 32-bit value greater than or22272227+ * equal to zero then it specifies the ID of the netns relative to22282228+ * the netns associated with the *ctx*. *netns* values beyond the22292229+ * range of 32-bit integers are reserved for future use.22322230 *22332231 * All values for *flags* are reserved for future usage, and must22342232 * be left at zero.···22392233 * **CONFIG_NET** configuration option.22402234 * Return22412235 * Pointer to *struct bpf_sock*, or NULL in case of failure.22362236+ * For sockets with reuseport option, the *struct bpf_sock*22372237+ * result is from reuse->socks[] using the hash of the tuple.22422238 *22432239 * int bpf_sk_release(struct bpf_sock *sk)22442240 * Description···24132405/* BPF_FUNC_perf_event_output for sk_buff input context. */24142406#define BPF_F_CTXLEN_MASK (0xfffffULL << 32)2415240724082408+/* Current network namespace */24092409+#define BPF_F_CURRENT_NETNS (-1L)24102410+24162411/* Mode for BPF_FUNC_skb_adjust_room helper. */24172412enum bpf_adj_room_mode {24182413 BPF_ADJ_ROOM_NET,···24322421 BPF_LWT_ENCAP_SEG6,24332422 BPF_LWT_ENCAP_SEG6_INLINE24342423};24242424+24252425+#define __bpf_md_ptr(type, name) \24262426+union { \24272427+ type name; \24282428+ __u64 :64; \24292429+} __attribute__((aligned(8)))2435243024362431/* user accessible mirror of in-kernel sk_buff.24372432 * new fields can only be added to the end of this structure···24732456 /* ... here. */2474245724752458 __u32 data_meta;24762476- struct bpf_flow_keys *flow_keys;24592459+ __bpf_md_ptr(struct bpf_flow_keys *, flow_keys);24772460};2478246124792462struct bpf_tunnel_key {···25892572 * be added to the end of this structure25902573 */25912574struct sk_msg_md {25922592- void *data;25932593- void *data_end;25752575+ __bpf_md_ptr(void *, data);25762576+ __bpf_md_ptr(void *, data_end);2594257725952578 __u32 family;25962579 __u32 remote_ip4; /* Stored in network byte order */···26062589 * Start of directly accessible data. It begins from26072590 * the tcp/udp header.26082591 */26092609- void *data;26102610- void *data_end; /* End of directly accessible data */25922592+ __bpf_md_ptr(void *, data);25932593+ /* End of directly accessible data */25942594+ __bpf_md_ptr(void *, data_end);26112595 /*26122596 * Total length of packet (starting from the tcp/udp header).26132597 * Note that the directly accessible bytes (data_end - data)
+33-2
tools/testing/nvdimm/test/nfit.c
···1515#include <linux/dma-mapping.h>1616#include <linux/workqueue.h>1717#include <linux/libnvdimm.h>1818+#include <linux/genalloc.h>1819#include <linux/vmalloc.h>1920#include <linux/device.h>2021#include <linux/module.h>···215214};216215217216static struct workqueue_struct *nfit_wq;217217+218218+static struct gen_pool *nfit_pool;218219219220static struct nfit_test *to_nfit_test(struct device *dev)220221{···11351132 list_del(&nfit_res->list);11361133 spin_unlock(&nfit_test_lock);1137113411351135+ if (resource_size(&nfit_res->res) >= DIMM_SIZE)11361136+ gen_pool_free(nfit_pool, nfit_res->res.start,11371137+ resource_size(&nfit_res->res));11381138 vfree(nfit_res->buf);11391139 kfree(nfit_res);11401140}···11501144 GFP_KERNEL);11511145 int rc;1152114611531153- if (!buf || !nfit_res)11471147+ if (!buf || !nfit_res || !*dma)11541148 goto err;11551149 rc = devm_add_action(dev, release_nfit_res, nfit_res);11561150 if (rc)···1170116411711165 return nfit_res->buf;11721166 err:11671167+ if (*dma && size >= DIMM_SIZE)11681168+ gen_pool_free(nfit_pool, *dma, size);11731169 if (buf)11741170 vfree(buf);11751171 kfree(nfit_res);···1180117211811173static void *test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma)11821174{11751175+ struct genpool_data_align data = {11761176+ .align = SZ_128M,11771177+ };11831178 void *buf = vmalloc(size);1184117911851185- *dma = (unsigned long) buf;11801180+ if (size >= DIMM_SIZE)11811181+ *dma = gen_pool_alloc_algo(nfit_pool, size,11821182+ gen_pool_first_fit_align, &data);11831183+ else11841184+ *dma = (unsigned long) buf;11861185 return __test_alloc(t, size, dma, buf);11871186}11881187···28542839 goto err_register;28552840 }2856284128422842+ nfit_pool = gen_pool_create(ilog2(SZ_4M), NUMA_NO_NODE);28432843+ if (!nfit_pool) {28442844+ rc = -ENOMEM;28452845+ goto err_register;28462846+ }28472847+28482848+ if (gen_pool_add(nfit_pool, SZ_4G, SZ_4G, NUMA_NO_NODE)) {28492849+ rc = -ENOMEM;28502850+ goto err_register;28512851+ }28522852+28572853 for (i = 0; i < NUM_NFITS; i++) {28582854 struct nfit_test *nfit_test;28592855 struct platform_device *pdev;···29202894 return 0;2921289529222896 err_register:28972897+ if (nfit_pool)28982898+ gen_pool_destroy(nfit_pool);28992899+29232900 destroy_workqueue(nfit_wq);29242901 for (i = 0; i < NUM_NFITS; i++)29252902 if (instances[i])···29452916 platform_device_unregister(&instances[i]->pdev);29462917 platform_driver_unregister(&nfit_test_driver);29472918 nfit_test_teardown();29192919+29202920+ gen_pool_destroy(nfit_pool);2948292129492922 for (i = 0; i < NUM_NFITS; i++)29502923 put_device(&instances[i]->pdev.dev);
+2-2
tools/testing/selftests/bpf/bpf_helpers.h
···154154 (void *) BPF_FUNC_skb_ancestor_cgroup_id;155155static struct bpf_sock *(*bpf_sk_lookup_tcp)(void *ctx,156156 struct bpf_sock_tuple *tuple,157157- int size, unsigned int netns_id,157157+ int size, unsigned long long netns_id,158158 unsigned long long flags) =159159 (void *) BPF_FUNC_sk_lookup_tcp;160160static struct bpf_sock *(*bpf_sk_lookup_udp)(void *ctx,161161 struct bpf_sock_tuple *tuple,162162- int size, unsigned int netns_id,162162+ int size, unsigned long long netns_id,163163 unsigned long long flags) =164164 (void *) BPF_FUNC_sk_lookup_udp;165165static int (*bpf_sk_release)(struct bpf_sock *sk) =