Unified · Split
| @@ -16,11 +16,13 @@ Required Properties: · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | - clocks: |
| 18 | 18 | Array of clocks required for SDHC. |
| 19 | − Require at least input clock for Xenon IP core. | |
| 19 | + Require at least input clock for Xenon IP core. For Armada AP806 and | |
| 20 | + CP110, the AXI clock is also mandatory. | |
| 20 | 21 | |
| 21 | 22 | - clock-names: |
| 22 | 23 | Array of names corresponding to clocks property. |
| 23 | 24 | The input clock for Xenon IP core should be named as "core". |
| 25 | + The input clock for the AXI bus must be named as "axi". | |
| 24 | 26 | |
| 25 | 27 | - reg: |
| 26 | 28 | * For "marvell,armada-3700-sdhci", two register areas. |
| @@ -106,8 +108,8 @@ Example: · 79 unmodified lines | ||
| 106 | 108 | compatible = "marvell,armada-ap806-sdhci"; |
| 107 | 109 | reg = <0xaa0000 0x1000>; |
| 108 | 110 | interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH> |
| 109 | − clocks = <&emmc_clk>; | |
| 110 | − clock-names = "core"; | |
| 111 | + clocks = <&emmc_clk>,<&axi_clk>; | |
| 112 | + clock-names = "core", "axi"; | |
| 111 | 113 | bus-width = <4>; |
| 112 | 114 | marvell,xenon-phy-slow-mode; |
| 113 | 115 | marvell,xenon-tun-count = <11>; |
| @@ -126,8 +128,8 @@ Example: · 12 unmodified lines | ||
| 126 | 128 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH> |
| 127 | 129 | vqmmc-supply = <&sd_vqmmc_regulator>; |
| 128 | 130 | vmmc-supply = <&sd_vmmc_regulator>; |
| 129 | − clocks = <&sdclk>; | |
| 130 | − clock-names = "core"; | |
| 131 | + clocks = <&sdclk>, <&axi_clk>; | |
| 132 | + clock-names = "core", "axi"; | |
| 131 | 133 | bus-width = <4>; |
| 132 | 134 | marvell,xenon-tun-count = <9>; |
| 133 | 135 | }; |
| @@ -210,8 +210,11 @@ path as another overlay mount and it may use a lower layer path that is · 209 unmodified lines | ||
| 210 | 210 | beneath or above the path of another overlay lower layer path. |
| 211 | 211 | |
| 212 | 212 | Using an upper layer path and/or a workdir path that are already used by |
| 213 | −another overlay mount is not allowed and will fail with EBUSY. Using | |
| 213 | +another overlay mount is not allowed and may fail with EBUSY. Using | |
| 214 | 214 | partially overlapping paths is not allowed but will not fail with EBUSY. |
| 215 | +If files are accessed from two overlayfs mounts which share or overlap the | |
| 216 | +upper layer and/or workdir path the behavior of the overlay is undefined, | |
| 217 | +though it will not result in a crash or deadlock. | |
| 215 | 218 | |
| 216 | 219 | Mounting an overlay using an upper layer path, where the upper layer path |
| 217 | 220 | was previously used by another mounted overlay in combination with a |
| @@ -36,6 +36,7 @@ Supported adapters: · 35 unmodified lines | ||
| 36 | 36 | * Intel Gemini Lake (SOC) |
| 37 | 37 | * Intel Cannon Lake-H (PCH) |
| 38 | 38 | * Intel Cannon Lake-LP (PCH) |
| 39 | + * Intel Cedar Fork (PCH) | |
| 39 | 40 | Datasheets: Publicly available at the Intel website |
| 40 | 41 | |
| 41 | 42 | On Intel Patsburg and later chipsets, both the normal host SMBus controller |
| @@ -2387,7 +2387,7 @@ broadcast: Like active-backup, there is not much advantage to this · 2386 unmodified lines | ||
| 2387 | 2387 | and packet type ID), so in a "gatewayed" configuration, all |
| 2388 | 2388 | outgoing traffic will generally use the same device. Incoming |
| 2389 | 2389 | traffic may also end up on a single device, but that is |
| 2390 | − dependent upon the balancing policy of the peer's 8023.ad | |
| 2390 | + dependent upon the balancing policy of the peer's 802.3ad | |
| 2391 | 2391 | implementation. In a "local" configuration, traffic will be |
| 2392 | 2392 | distributed across the devices in the bond. |
| 2393 | 2393 | |
| @@ -5259,7 +5259,8 @@ S: Maintained · 5258 unmodified lines | ||
| 5259 | 5259 | F: drivers/iommu/exynos-iommu.c |
| 5260 | 5260 | |
| 5261 | 5261 | EZchip NPS platform support |
| 5262 | −M: Noam Camus <noamc@ezchip.com> | |
| 5262 | +M: Elad Kanfi <eladkan@mellanox.com> | |
| 5263 | +M: Vineet Gupta <vgupta@synopsys.com> | |
| 5263 | 5264 | S: Supported |
| 5264 | 5265 | F: arch/arc/plat-eznps |
| 5265 | 5266 | F: arch/arc/boot/dts/eznps.dts |
| @@ -9360,7 +9361,7 @@ NETWORK BLOCK DEVICE (NBD) · 4094 unmodified lines | ||
| 9360 | 9361 | M: Josef Bacik <jbacik@fb.com> |
| 9361 | 9362 | S: Maintained |
| 9362 | 9363 | L: linux-block@vger.kernel.org |
| 9363 | −L: nbd-general@lists.sourceforge.net | |
| 9364 | +L: nbd@other.debian.org | |
| 9364 | 9365 | F: Documentation/blockdev/nbd.txt |
| 9365 | 9366 | F: drivers/block/nbd.c |
| 9366 | 9367 | F: include/uapi/linux/nbd.h |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 4 |
| 2 | 2 | PATCHLEVEL = 14 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc3 | |
| 4 | +EXTRAVERSION = -rc4 | |
| 5 | 5 | NAME = Fearless Coyote |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -937,9 +937,6 @@ config STRICT_MODULE_RWX · 936 unmodified lines | ||
| 937 | 937 | and non-text memory will be made non-executable. This provides |
| 938 | 938 | protection against certain security exploits (e.g. writing to text) |
| 939 | 939 | |
| 940 | −config ARCH_WANT_RELAX_ORDER | |
| 941 | − bool | |
| 942 | − | |
| 943 | 940 | config ARCH_HAS_REFCOUNT |
| 944 | 941 | bool |
| 945 | 942 | help |
| @@ -24,7 +24,7 @@ config ARC · 23 unmodified lines | ||
| 24 | 24 | select GENERIC_SMP_IDLE_THREAD |
| 25 | 25 | select HAVE_ARCH_KGDB |
| 26 | 26 | select HAVE_ARCH_TRACEHOOK |
| 27 | − select HAVE_FUTEX_CMPXCHG | |
| 27 | + select HAVE_FUTEX_CMPXCHG if FUTEX | |
| 28 | 28 | select HAVE_IOREMAP_PROT |
| 29 | 29 | select HAVE_KPROBES |
| 30 | 30 | select HAVE_KRETPROBES |
| @@ -6,8 +6,6 @@ · 5 unmodified lines | ||
| 6 | 6 | # published by the Free Software Foundation. |
| 7 | 7 | # |
| 8 | 8 | |
| 9 | −UTS_MACHINE := arc | |
| 10 | − | |
| 11 | 9 | ifeq ($(CROSS_COMPILE),) |
| 12 | 10 | ifndef CONFIG_CPU_BIG_ENDIAN |
| 13 | 11 | CROSS_COMPILE := arc-linux- |
| @@ -44,7 +44,14 @@ · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | mmcclk: mmcclk { |
| 46 | 46 | compatible = "fixed-clock"; |
| 47 | − clock-frequency = <50000000>; | |
| 47 | + /* | |
| 48 | + * DW sdio controller has external ciu clock divider | |
| 49 | + * controlled via register in SDIO IP. It divides | |
| 50 | + * sdio_ref_clk (which comes from CGU) by 16 for | |
| 51 | + * default. So default mmcclk clock (which comes | |
| 52 | + * to sdk_in) is 25000000 Hz. | |
| 53 | + */ | |
| 54 | + clock-frequency = <25000000>; | |
| 48 | 55 | #clock-cells = <0>; |
| 49 | 56 | }; |
| 50 | 57 | |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | /dts-v1/; |
| 13 | 13 | |
| 14 | 14 | #include <dt-bindings/net/ti-dp83867.h> |
| 15 | +#include <dt-bindings/reset/snps,hsdk-reset.h> | |
| 15 | 16 | |
| 16 | 17 | / { |
| 17 | 18 | model = "snps,hsdk"; |
| @@ -57,10 +58,10 @@ · 39 unmodified lines | ||
| 57 | 58 | }; |
| 58 | 59 | }; |
| 59 | 60 | |
| 60 | − core_clk: core-clk { | |
| 61 | + input_clk: input-clk { | |
| 61 | 62 | #clock-cells = <0>; |
| 62 | 63 | compatible = "fixed-clock"; |
| 63 | − clock-frequency = <500000000>; | |
| 64 | + clock-frequency = <33333333>; | |
| 64 | 65 | }; |
| 65 | 66 | |
| 66 | 67 | cpu_intc: cpu-interrupt-controller { |
| @@ -102,6 +103,19 @@ · 35 unmodified lines | ||
| 102 | 103 | |
| 103 | 104 | ranges = <0x00000000 0xf0000000 0x10000000>; |
| 104 | 105 | |
| 106 | + cgu_rst: reset-controller@8a0 { | |
| 107 | + compatible = "snps,hsdk-reset"; | |
| 108 | + #reset-cells = <1>; | |
| 109 | + reg = <0x8A0 0x4>, <0xFF0 0x4>; | |
| 110 | + }; | |
| 111 | + | |
| 112 | + core_clk: core-clk@0 { | |
| 113 | + compatible = "snps,hsdk-core-pll-clock"; | |
| 114 | + reg = <0x00 0x10>, <0x14B8 0x4>; | |
| 115 | + #clock-cells = <0>; | |
| 116 | + clocks = <&input_clk>; | |
| 117 | + }; | |
| 118 | + | |
| 105 | 119 | serial: serial@5000 { |
| 106 | 120 | compatible = "snps,dw-apb-uart"; |
| 107 | 121 | reg = <0x5000 0x100>; |
| @@ -120,7 +134,17 @@ · 12 unmodified lines | ||
| 120 | 134 | |
| 121 | 135 | mmcclk_ciu: mmcclk-ciu { |
| 122 | 136 | compatible = "fixed-clock"; |
| 123 | − clock-frequency = <100000000>; | |
| 137 | + /* | |
| 138 | + * DW sdio controller has external ciu clock divider | |
| 139 | + * controlled via register in SDIO IP. Due to its | |
| 140 | + * unexpected default value (it should devide by 1 | |
| 141 | + * but it devides by 8) SDIO IP uses wrong clock and | |
| 142 | + * works unstable (see STAR 9001204800) | |
| 143 | + * So add temporary fix and change clock frequency | |
| 144 | + * from 100000000 to 12500000 Hz until we fix dw sdio | |
| 145 | + * driver itself. | |
| 146 | + */ | |
| 147 | + clock-frequency = <12500000>; | |
| 124 | 148 | #clock-cells = <0>; |
| 125 | 149 | }; |
| 126 | 150 | |
| @@ -141,6 +165,8 @@ · 14 unmodified lines | ||
| 141 | 165 | clocks = <&gmacclk>; |
| 142 | 166 | clock-names = "stmmaceth"; |
| 143 | 167 | phy-handle = <&phy0>; |
| 168 | + resets = <&cgu_rst HSDK_ETH_RESET>; | |
| 169 | + reset-names = "stmmaceth"; | |
| 144 | 170 | |
| 145 | 171 | mdio { |
| 146 | 172 | #address-cells = <1>; |
| @@ -105,7 +105,7 @@ CONFIG_NLS_ISO8859_1=y · 104 unmodified lines | ||
| 105 | 105 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 106 | 106 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 107 | 107 | CONFIG_STRIP_ASM_SYMS=y |
| 108 | −CONFIG_LOCKUP_DETECTOR=y | |
| 108 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 109 | 109 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 110 | 110 | # CONFIG_SCHED_DEBUG is not set |
| 111 | 111 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -104,7 +104,7 @@ CONFIG_NLS_ISO8859_1=y · 103 unmodified lines | ||
| 104 | 104 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 105 | 105 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 106 | 106 | CONFIG_STRIP_ASM_SYMS=y |
| 107 | −CONFIG_LOCKUP_DETECTOR=y | |
| 107 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 108 | 108 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 109 | 109 | # CONFIG_SCHED_DEBUG is not set |
| 110 | 110 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -107,7 +107,7 @@ CONFIG_NLS_ISO8859_1=y · 106 unmodified lines | ||
| 107 | 107 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 108 | 108 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 109 | 109 | CONFIG_STRIP_ASM_SYMS=y |
| 110 | −CONFIG_LOCKUP_DETECTOR=y | |
| 110 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 111 | 111 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 112 | 112 | # CONFIG_SCHED_DEBUG is not set |
| 113 | 113 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -84,5 +84,5 @@ CONFIG_TMPFS=y · 83 unmodified lines | ||
| 84 | 84 | CONFIG_NFS_FS=y |
| 85 | 85 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 86 | 86 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 87 | −CONFIG_LOCKUP_DETECTOR=y | |
| 87 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 88 | 88 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -63,6 +63,7 @@ CONFIG_MMC_SDHCI=y · 62 unmodified lines | ||
| 63 | 63 | CONFIG_MMC_SDHCI_PLTFM=y |
| 64 | 64 | CONFIG_MMC_DW=y |
| 65 | 65 | # CONFIG_IOMMU_SUPPORT is not set |
| 66 | +CONFIG_RESET_HSDK=y | |
| 66 | 67 | CONFIG_EXT3_FS=y |
| 67 | 68 | CONFIG_VFAT_FS=y |
| 68 | 69 | CONFIG_TMPFS=y |
| @@ -72,7 +73,7 @@ CONFIG_NLS_ISO8859_1=y · 3 unmodified lines | ||
| 72 | 73 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
| 73 | 74 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 74 | 75 | CONFIG_STRIP_ASM_SYMS=y |
| 75 | −CONFIG_LOCKUP_DETECTOR=y | |
| 76 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 76 | 77 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 77 | 78 | # CONFIG_SCHED_DEBUG is not set |
| 78 | 79 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -94,7 +94,7 @@ CONFIG_NLS_ISO8859_1=y · 93 unmodified lines | ||
| 94 | 94 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 95 | 95 | CONFIG_STRIP_ASM_SYMS=y |
| 96 | 96 | CONFIG_DEBUG_SHIRQ=y |
| 97 | −CONFIG_LOCKUP_DETECTOR=y | |
| 97 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 98 | 98 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 99 | 99 | # CONFIG_SCHED_DEBUG is not set |
| 100 | 100 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -98,7 +98,7 @@ CONFIG_NLS_ISO8859_1=y · 97 unmodified lines | ||
| 98 | 98 | # CONFIG_ENABLE_MUST_CHECK is not set |
| 99 | 99 | CONFIG_STRIP_ASM_SYMS=y |
| 100 | 100 | CONFIG_DEBUG_SHIRQ=y |
| 101 | −CONFIG_LOCKUP_DETECTOR=y | |
| 101 | +CONFIG_SOFTLOCKUP_DETECTOR=y | |
| 102 | 102 | CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 |
| 103 | 103 | # CONFIG_SCHED_DEBUG is not set |
| 104 | 104 | # CONFIG_DEBUG_PREEMPT is not set |
| @@ -98,6 +98,7 @@ · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | /* Auxiliary registers */ |
| 100 | 100 | #define AUX_IDENTITY 4 |
| 101 | +#define AUX_EXEC_CTRL 8 | |
| 101 | 102 | #define AUX_INTR_VEC_BASE 0x25 |
| 102 | 103 | #define AUX_VOL 0x5e |
| 103 | 104 | |
| @@ -135,12 +136,12 @@ struct bcr_identity { · 31 unmodified lines | ||
| 135 | 136 | #endif |
| 136 | 137 | }; |
| 137 | 138 | |
| 138 | −struct bcr_isa { | |
| 139 | +struct bcr_isa_arcv2 { | |
| 139 | 140 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 140 | 141 | unsigned int div_rem:4, pad2:4, ldd:1, unalign:1, atomic:1, be:1, |
| 141 | − pad1:11, atomic1:1, ver:8; | |
| 142 | + pad1:12, ver:8; | |
| 142 | 143 | #else |
| 143 | − unsigned int ver:8, atomic1:1, pad1:11, be:1, atomic:1, unalign:1, | |
| 144 | + unsigned int ver:8, pad1:12, be:1, atomic:1, unalign:1, | |
| 144 | 145 | ldd:1, pad2:4, div_rem:4; |
| 145 | 146 | #endif |
| 146 | 147 | }; |
| @@ -263,13 +264,13 @@ struct cpuinfo_arc { · 116 unmodified lines | ||
| 263 | 264 | struct cpuinfo_arc_mmu mmu; |
| 264 | 265 | struct cpuinfo_arc_bpu bpu; |
| 265 | 266 | struct bcr_identity core; |
| 266 | − struct bcr_isa isa; | |
| 267 | + struct bcr_isa_arcv2 isa; | |
| 267 | 268 | const char *details, *name; |
| 268 | 269 | unsigned int vec_base; |
| 269 | 270 | struct cpuinfo_arc_ccm iccm, dccm; |
| 270 | 271 | struct { |
| 271 | 272 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, |
| 272 | − fpu_sp:1, fpu_dp:1, pad2:6, | |
| 273 | + fpu_sp:1, fpu_dp:1, dual_iss_enb:1, dual_iss_exist:1, pad2:4, | |
| 273 | 274 | debug:1, ap:1, smart:1, rtt:1, pad3:4, |
| 274 | 275 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; |
| 275 | 276 | } extn; |
| @@ -51,6 +51,7 @@ static const struct id_to_str arc_cpu_rel[] = { · 50 unmodified lines | ||
| 51 | 51 | { 0x51, "R2.0" }, |
| 52 | 52 | { 0x52, "R2.1" }, |
| 53 | 53 | { 0x53, "R3.0" }, |
| 54 | + { 0x54, "R4.0" }, | |
| 54 | 55 | #endif |
| 55 | 56 | { 0x00, NULL } |
| 56 | 57 | }; |
| @@ -62,6 +63,7 @@ static const struct id_to_str arc_cpu_nm[] = { · 5 unmodified lines | ||
| 62 | 63 | #else |
| 63 | 64 | { 0x40, "ARC EM" }, |
| 64 | 65 | { 0x50, "ARC HS38" }, |
| 66 | + { 0x54, "ARC HS48" }, | |
| 65 | 67 | #endif |
| 66 | 68 | { 0x00, "Unknown" } |
| 67 | 69 | }; |
| @@ -119,11 +121,11 @@ static void read_arc_build_cfg_regs(void) · 51 unmodified lines | ||
| 119 | 121 | struct bcr_generic bcr; |
| 120 | 122 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 121 | 123 | const struct id_to_str *tbl; |
| 124 | + struct bcr_isa_arcv2 isa; | |
| 122 | 125 | |
| 123 | 126 | FIX_PTR(cpu); |
| 124 | 127 | |
| 125 | 128 | READ_BCR(AUX_IDENTITY, cpu->core); |
| 126 | − READ_BCR(ARC_REG_ISA_CFG_BCR, cpu->isa); | |
| 127 | 129 | |
| 128 | 130 | for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) { |
| 129 | 131 | if (cpu->core.family == tbl->id) { |
| @@ -133,7 +135,7 @@ static void read_arc_build_cfg_regs(void) · 3 unmodified lines | ||
| 133 | 135 | } |
| 134 | 136 | |
| 135 | 137 | for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) { |
| 136 | − if ((cpu->core.family & 0xF0) == tbl->id) | |
| 138 | + if ((cpu->core.family & 0xF4) == tbl->id) | |
| 137 | 139 | break; |
| 138 | 140 | } |
| 139 | 141 | cpu->name = tbl->str; |
| @@ -192,6 +194,14 @@ static void read_arc_build_cfg_regs(void) · 52 unmodified lines | ||
| 192 | 194 | cpu->bpu.full = bpu.ft; |
| 193 | 195 | cpu->bpu.num_cache = 256 << bpu.bce; |
| 194 | 196 | cpu->bpu.num_pred = 2048 << bpu.pte; |
| 197 | + | |
| 198 | + if (cpu->core.family >= 0x54) { | |
| 199 | + unsigned int exec_ctrl; | |
| 200 | + | |
| 201 | + READ_BCR(AUX_EXEC_CTRL, exec_ctrl); | |
| 202 | + cpu->extn.dual_iss_exist = 1; | |
| 203 | + cpu->extn.dual_iss_enb = exec_ctrl & 1; | |
| 204 | + } | |
| 195 | 205 | } |
| 196 | 206 | |
| 197 | 207 | READ_BCR(ARC_REG_AP_BCR, bcr); |
| @@ -205,18 +215,25 @@ static void read_arc_build_cfg_regs(void) · 7 unmodified lines | ||
| 205 | 215 | |
| 206 | 216 | cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; |
| 207 | 217 | |
| 218 | + READ_BCR(ARC_REG_ISA_CFG_BCR, isa); | |
| 219 | + | |
| 208 | 220 | /* some hacks for lack of feature BCR info in old ARC700 cores */ |
| 209 | 221 | if (is_isa_arcompact()) { |
| 210 | − if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */ | |
| 222 | + if (!isa.ver) /* ISA BCR absent, use Kconfig info */ | |
| 211 | 223 | cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC); |
| 212 | − else | |
| 213 | − cpu->isa.atomic = cpu->isa.atomic1; | |
| 224 | + else { | |
| 225 | + /* ARC700_BUILD only has 2 bits of isa info */ | |
| 226 | + struct bcr_generic bcr = *(struct bcr_generic *)&isa; | |
| 227 | + cpu->isa.atomic = bcr.info & 1; | |
| 228 | + } | |
| 214 | 229 | |
| 215 | 230 | cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); |
| 216 | 231 | |
| 217 | 232 | /* there's no direct way to distinguish 750 vs. 770 */ |
| 218 | 233 | if (unlikely(cpu->core.family < 0x34 || cpu->mmu.ver < 3)) |
| 219 | 234 | cpu->name = "ARC750"; |
| 235 | + } else { | |
| 236 | + cpu->isa = isa; | |
| 220 | 237 | } |
| 221 | 238 | } |
| 222 | 239 | |
| @@ -232,10 +249,11 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) · 9 unmodified lines | ||
| 232 | 249 | "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", |
| 233 | 250 | core->family, core->cpu_id, core->chip_id); |
| 234 | 251 | |
| 235 | − n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s\n", | |
| 252 | + n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n", | |
| 236 | 253 | cpu_id, cpu->name, cpu->details, |
| 237 | 254 | is_isa_arcompact() ? "ARCompact" : "ARCv2", |
| 238 | − IS_AVAIL1(cpu->isa.be, "[Big-Endian]")); | |
| 255 | + IS_AVAIL1(cpu->isa.be, "[Big-Endian]"), | |
| 256 | + IS_AVAIL3(cpu->extn.dual_iss_exist, cpu->extn.dual_iss_enb, " Dual-Issue")); | |
| 239 | 257 | |
| 240 | 258 | n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s%s%s\nISA Extn\t: ", |
| 241 | 259 | IS_AVAIL1(cpu->extn.timer0, "Timer0 "), |
| @@ -111,6 +111,13 @@ static void __init axs10x_early_init(void) · 110 unmodified lines | ||
| 111 | 111 | |
| 112 | 112 | axs10x_enable_gpio_intc_wire(); |
| 113 | 113 | |
| 114 | + /* | |
| 115 | + * Reset ethernet IP core. | |
| 116 | + * TODO: get rid of this quirk after axs10x reset driver (or simple | |
| 117 | + * reset driver) will be available in upstream. | |
| 118 | + */ | |
| 119 | + iowrite32((1 << 5), (void __iomem *) CREG_MB_SW_RESET); | |
| 120 | + | |
| 114 | 121 | scnprintf(mb, 32, "MainBoard v%d", mb_rev); |
| 115 | 122 | axs10x_print_board_ver(CREG_MB_VER, mb); |
| 116 | 123 | } |
| @@ -6,4 +6,5 @@ · 5 unmodified lines | ||
| 6 | 6 | # |
| 7 | 7 | |
| 8 | 8 | menuconfig ARC_SOC_HSDK |
| 9 | − bool "ARC HS Development Kit SOC" | |
| 9 | + bool "ARC HS Development Kit SOC" | |
| 10 | + select CLK_HSDK | |
| @@ -38,6 +38,42 @@ static void __init hsdk_init_per_cpu(unsigned int cpu) · 37 unmodified lines | ||
| 38 | 38 | #define CREG_PAE (CREG_BASE + 0x180) |
| 39 | 39 | #define CREG_PAE_UPDATE (CREG_BASE + 0x194) |
| 40 | 40 | |
| 41 | +#define CREG_CORE_IF_CLK_DIV (CREG_BASE + 0x4B8) | |
| 42 | +#define CREG_CORE_IF_CLK_DIV_2 0x1 | |
| 43 | +#define CGU_BASE ARC_PERIPHERAL_BASE | |
| 44 | +#define CGU_PLL_STATUS (ARC_PERIPHERAL_BASE + 0x4) | |
| 45 | +#define CGU_PLL_CTRL (ARC_PERIPHERAL_BASE + 0x0) | |
| 46 | +#define CGU_PLL_STATUS_LOCK BIT(0) | |
| 47 | +#define CGU_PLL_STATUS_ERR BIT(1) | |
| 48 | +#define CGU_PLL_CTRL_1GHZ 0x3A10 | |
| 49 | +#define HSDK_PLL_LOCK_TIMEOUT 500 | |
| 50 | + | |
| 51 | +#define HSDK_PLL_LOCKED() \ | |
| 52 | + !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_LOCK) | |
| 53 | + | |
| 54 | +#define HSDK_PLL_ERR() \ | |
| 55 | + !!(ioread32((void __iomem *) CGU_PLL_STATUS) & CGU_PLL_STATUS_ERR) | |
| 56 | + | |
| 57 | +static void __init hsdk_set_cpu_freq_1ghz(void) | |
| 58 | +{ | |
| 59 | + u32 timeout = HSDK_PLL_LOCK_TIMEOUT; | |
| 60 | + | |
| 61 | + /* | |
| 62 | + * As we set cpu clock which exceeds 500MHz, the divider for the interface | |
| 63 | + * clock must be programmed to div-by-2. | |
| 64 | + */ | |
| 65 | + iowrite32(CREG_CORE_IF_CLK_DIV_2, (void __iomem *) CREG_CORE_IF_CLK_DIV); | |
| 66 | + | |
| 67 | + /* Set cpu clock to 1GHz */ | |
| 68 | + iowrite32(CGU_PLL_CTRL_1GHZ, (void __iomem *) CGU_PLL_CTRL); | |
| 69 | + | |
| 70 | + while (!HSDK_PLL_LOCKED() && timeout--) | |
| 71 | + cpu_relax(); | |
| 72 | + | |
| 73 | + if (!HSDK_PLL_LOCKED() || HSDK_PLL_ERR()) | |
| 74 | + pr_err("Failed to setup CPU frequency to 1GHz!"); | |
| 75 | +} | |
| 76 | + | |
| 41 | 77 | static void __init hsdk_init_early(void) |
| 42 | 78 | { |
| 43 | 79 | /* |
| @@ -52,6 +88,12 @@ static void __init hsdk_init_early(void) · 8 unmodified lines | ||
| 52 | 88 | |
| 53 | 89 | /* Really apply settings made above */ |
| 54 | 90 | writel(1, (void __iomem *) CREG_PAE_UPDATE); |
| 91 | + | |
| 92 | + /* | |
| 93 | + * Setup CPU frequency to 1GHz. | |
| 94 | + * TODO: remove it after smart hsdk pll driver will be introduced. | |
| 95 | + */ | |
| 96 | + hsdk_set_cpu_freq_1ghz(); | |
| 55 | 97 | } |
| 56 | 98 | |
| 57 | 99 | static const char *hsdk_compat[] __initconst = { |
| @@ -95,16 +95,19 @@ · 94 unmodified lines | ||
| 95 | 95 | #define KERNEL_END _end |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | − * The size of the KASAN shadow region. This should be 1/8th of the | |
| 99 | − * size of the entire kernel virtual address space. | |
| 98 | + * KASAN requires 1/8th of the kernel virtual address space for the shadow | |
| 99 | + * region. KASAN can bloat the stack significantly, so double the (minimum) | |
| 100 | + * stack size when KASAN is in use. | |
| 100 | 101 | */ |
| 101 | 102 | #ifdef CONFIG_KASAN |
| 102 | 103 | #define KASAN_SHADOW_SIZE (UL(1) << (VA_BITS - 3)) |
| 104 | +#define KASAN_THREAD_SHIFT 1 | |
| 103 | 105 | #else |
| 104 | 106 | #define KASAN_SHADOW_SIZE (0) |
| 107 | +#define KASAN_THREAD_SHIFT 0 | |
| 105 | 108 | #endif |
| 106 | 109 | |
| 107 | −#define MIN_THREAD_SHIFT 14 | |
| 110 | +#define MIN_THREAD_SHIFT (14 + KASAN_THREAD_SHIFT) | |
| 108 | 111 | |
| 109 | 112 | /* |
| 110 | 113 | * VMAP'd stacks are allocated at page granularity, so we must ensure that such |
| @@ -649,4 +649,4 @@ static int __init armv8_deprecated_init(void) · 648 unmodified lines | ||
| 649 | 649 | return 0; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | −late_initcall(armv8_deprecated_init); | |
| 652 | +core_initcall(armv8_deprecated_init); | |
| @@ -1307,4 +1307,4 @@ static int __init enable_mrs_emulation(void) · 1306 unmodified lines | ||
| 1307 | 1307 | return 0; |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | −late_initcall(enable_mrs_emulation); | |
| 1310 | +core_initcall(enable_mrs_emulation); | |
| @@ -444,4 +444,4 @@ static int __init fpsimd_init(void) · 443 unmodified lines | ||
| 444 | 444 | |
| 445 | 445 | return 0; |
| 446 | 446 | } |
| 447 | −late_initcall(fpsimd_init); | |
| 447 | +core_initcall(fpsimd_init); | |
| @@ -97,7 +97,7 @@ static void data_abort_decode(unsigned int esr) · 96 unmodified lines | ||
| 97 | 97 | (esr & ESR_ELx_SF) >> ESR_ELx_SF_SHIFT, |
| 98 | 98 | (esr & ESR_ELx_AR) >> ESR_ELx_AR_SHIFT); |
| 99 | 99 | } else { |
| 100 | − pr_alert(" ISV = 0, ISS = 0x%08lu\n", esr & ESR_ELx_ISS_MASK); | |
| 100 | + pr_alert(" ISV = 0, ISS = 0x%08lx\n", esr & ESR_ELx_ISS_MASK); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | pr_alert(" CM = %lu, WnR = %lu\n", |
| @@ -146,7 +146,7 @@ void machine_power_off(void) · 145 unmodified lines | ||
| 146 | 146 | |
| 147 | 147 | /* prevent soft lockup/stalled CPU messages for endless loop. */ |
| 148 | 148 | rcu_sysrq_start(); |
| 149 | − lockup_detector_suspend(); | |
| 149 | + lockup_detector_soft_poweroff(); | |
| 150 | 150 | for (;;); |
| 151 | 151 | } |
| 152 | 152 | |
| @@ -102,10 +102,10 @@ static void cpufeatures_flush_tlb(void) · 101 unmodified lines | ||
| 102 | 102 | case PVR_POWER8: |
| 103 | 103 | case PVR_POWER8E: |
| 104 | 104 | case PVR_POWER8NVL: |
| 105 | − __flush_tlb_power8(POWER8_TLB_SETS); | |
| 105 | + __flush_tlb_power8(TLB_INVAL_SCOPE_GLOBAL); | |
| 106 | 106 | break; |
| 107 | 107 | case PVR_POWER9: |
| 108 | − __flush_tlb_power9(POWER9_TLB_SETS_HASH); | |
| 108 | + __flush_tlb_power9(TLB_INVAL_SCOPE_GLOBAL); | |
| 109 | 109 | break; |
| 110 | 110 | default: |
| 111 | 111 | pr_err("unknown CPU version for boot TLB flush\n"); |
| @@ -734,7 +734,29 @@ EXC_REAL(program_check, 0x700, 0x100) · 733 unmodified lines | ||
| 734 | 734 | EXC_VIRT(program_check, 0x4700, 0x100, 0x700) |
| 735 | 735 | TRAMP_KVM(PACA_EXGEN, 0x700) |
| 736 | 736 | EXC_COMMON_BEGIN(program_check_common) |
| 737 | − EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) | |
| 737 | + /* | |
| 738 | + * It's possible to receive a TM Bad Thing type program check with | |
| 739 | + * userspace register values (in particular r1), but with SRR1 reporting | |
| 740 | + * that we came from the kernel. Normally that would confuse the bad | |
| 741 | + * stack logic, and we would report a bad kernel stack pointer. Instead | |
| 742 | + * we switch to the emergency stack if we're taking a TM Bad Thing from | |
| 743 | + * the kernel. | |
| 744 | + */ | |
| 745 | + li r10,MSR_PR /* Build a mask of MSR_PR .. */ | |
| 746 | + oris r10,r10,0x200000@h /* .. and SRR1_PROGTM */ | |
| 747 | + and r10,r10,r12 /* Mask SRR1 with that. */ | |
| 748 | + srdi r10,r10,8 /* Shift it so we can compare */ | |
| 749 | + cmpldi r10,(0x200000 >> 8) /* .. with an immediate. */ | |
| 750 | + bne 1f /* If != go to normal path. */ | |
| 751 | + | |
| 752 | + /* SRR1 had PR=0 and SRR1_PROGTM=1, so use the emergency stack */ | |
| 753 | + andi. r10,r12,MSR_PR; /* Set CR0 correctly for label */ | |
| 754 | + /* 3 in EXCEPTION_PROLOG_COMMON */ | |
| 755 | + mr r10,r1 /* Save r1 */ | |
| 756 | + ld r1,PACAEMERGSP(r13) /* Use emergency stack */ | |
| 757 | + subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */ | |
| 758 | + b 3f /* Jump into the macro !! */ | |
| 759 | +1: EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) | |
| 738 | 760 | bl save_nvgprs |
| 739 | 761 | RECONCILE_IRQ_STATE(r10, r11) |
| 740 | 762 | addi r3,r1,STACK_FRAME_OVERHEAD |
| @@ -624,5 +624,18 @@ long __machine_check_early_realmode_p8(struct pt_regs *regs) · 623 unmodified lines | ||
| 624 | 624 | |
| 625 | 625 | long __machine_check_early_realmode_p9(struct pt_regs *regs) |
| 626 | 626 | { |
| 627 | + /* | |
| 628 | + * On POWER9 DD2.1 and below, it's possible to get a machine check | |
| 629 | + * caused by a paste instruction where only DSISR bit 25 is set. This | |
| 630 | + * will result in the MCE handler seeing an unknown event and the kernel | |
| 631 | + * crashing. An MCE that occurs like this is spurious, so we don't need | |
| 632 | + * to do anything in terms of servicing it. If there is something that | |
| 633 | + * needs to be serviced, the CPU will raise the MCE again with the | |
| 634 | + * correct DSISR so that it can be serviced properly. So detect this | |
| 635 | + * case and mark it as handled. | |
| 636 | + */ | |
| 637 | + if (SRR1_MC_LOADSTORE(regs->msr) && regs->dsisr == 0x02000000) | |
| 638 | + return 1; | |
| 639 | + | |
| 627 | 640 | return mce_handle_error(regs, mce_p9_derror_table, mce_p9_ierror_table); |
| 628 | 641 | } |
| @@ -904,9 +904,6 @@ void __init setup_arch(char **cmdline_p) · 903 unmodified lines | ||
| 904 | 904 | #endif |
| 905 | 905 | #endif |
| 906 | 906 | |
| 907 | −#ifdef CONFIG_PPC_64K_PAGES | |
| 908 | − init_mm.context.pte_frag = NULL; | |
| 909 | −#endif | |
| 910 | 907 | #ifdef CONFIG_SPAPR_TCE_IOMMU |
| 911 | 908 | mm_iommu_init(&init_mm); |
| 912 | 909 | #endif |
| @@ -452,9 +452,20 @@ static long restore_tm_sigcontexts(struct task_struct *tsk, · 451 unmodified lines | ||
| 452 | 452 | if (MSR_TM_RESV(msr)) |
| 453 | 453 | return -EINVAL; |
| 454 | 454 | |
| 455 | − /* pull in MSR TM from user context */ | |
| 455 | + /* pull in MSR TS bits from user context */ | |
| 456 | 456 | regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK); |
| 457 | 457 | |
| 458 | + /* | |
| 459 | + * Ensure that TM is enabled in regs->msr before we leave the signal | |
| 460 | + * handler. It could be the case that (a) user disabled the TM bit | |
| 461 | + * through the manipulation of the MSR bits in uc_mcontext or (b) the | |
| 462 | + * TM bit was disabled because a sufficient number of context switches | |
| 463 | + * happened whilst in the signal handler and load_tm overflowed, | |
| 464 | + * disabling the TM bit. In either case we can end up with an illegal | |
| 465 | + * TM state leading to a TM Bad Thing when we return to userspace. | |
| 466 | + */ | |
| 467 | + regs->msr |= MSR_TM; | |
| 468 | + | |
| 458 | 469 | /* pull in MSR LE from user context */ |
| 459 | 470 | regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE); |
| 460 | 471 | |
| @@ -310,9 +310,6 @@ static int start_wd_on_cpu(unsigned int cpu) · 309 unmodified lines | ||
| 310 | 310 | if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) |
| 311 | 311 | return 0; |
| 312 | 312 | |
| 313 | − if (watchdog_suspended) | |
| 314 | − return 0; | |
| 315 | − | |
| 316 | 313 | if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
| 317 | 314 | return 0; |
| 318 | 315 | |
| @@ -358,36 +355,39 @@ static void watchdog_calc_timeouts(void) · 39 unmodified lines | ||
| 358 | 355 | wd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5; |
| 359 | 356 | } |
| 360 | 357 | |
| 361 | −void watchdog_nmi_reconfigure(void) | |
| 358 | +void watchdog_nmi_stop(void) | |
| 362 | 359 | { |
| 363 | 360 | int cpu; |
| 364 | 361 | |
| 365 | − watchdog_calc_timeouts(); | |
| 366 | − | |
| 367 | 362 | for_each_cpu(cpu, &wd_cpus_enabled) |
| 368 | 363 | stop_wd_on_cpu(cpu); |
| 364 | +} | |
| 369 | 365 | |
| 366 | +void watchdog_nmi_start(void) | |
| 367 | +{ | |
| 368 | + int cpu; | |
| 369 | + | |
| 370 | + watchdog_calc_timeouts(); | |
| 370 | 371 | for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask) |
| 371 | 372 | start_wd_on_cpu(cpu); |
| 372 | 373 | } |
| 373 | 374 | |
| 374 | 375 | /* |
| 375 | − * This runs after lockup_detector_init() which sets up watchdog_cpumask. | |
| 376 | + * Invoked from core watchdog init. | |
| 376 | 377 | */ |
| 377 | −static int __init powerpc_watchdog_init(void) | |
| 378 | +int __init watchdog_nmi_probe(void) | |
| 378 | 379 | { |
| 379 | 380 | int err; |
| 380 | 381 | |
| 381 | − watchdog_calc_timeouts(); | |
| 382 | − | |
| 383 | − err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "powerpc/watchdog:online", | |
| 384 | − start_wd_on_cpu, stop_wd_on_cpu); | |
| 385 | − if (err < 0) | |
| 382 | + err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, | |
| 383 | + "powerpc/watchdog:online", | |
| 384 | + start_wd_on_cpu, stop_wd_on_cpu); | |
| 385 | + if (err < 0) { | |
| 386 | 386 | pr_warn("Watchdog could not be initialized"); |
| 387 | − | |
| 387 | + return err; | |
| 388 | + } | |
| 388 | 389 | return 0; |
| 389 | 390 | } |
| 390 | −arch_initcall(powerpc_watchdog_init); | |
| 391 | 391 | |
| 392 | 392 | static void handle_backtrace_ipi(struct pt_regs *regs) |
| 393 | 393 | { |
| @@ -622,7 +622,7 @@ int kvmppc_xive_get_xive(struct kvm *kvm, u32 irq, u32 *server, · 621 unmodified lines | ||
| 622 | 622 | return -EINVAL; |
| 623 | 623 | state = &sb->irq_state[idx]; |
| 624 | 624 | arch_spin_lock(&sb->lock); |
| 625 | − *server = state->guest_server; | |
| 625 | + *server = state->act_server; | |
| 626 | 626 | *priority = state->guest_priority; |
| 627 | 627 | arch_spin_unlock(&sb->lock); |
| 628 | 628 | |
| @@ -1331,7 +1331,7 @@ static int xive_get_source(struct kvmppc_xive *xive, long irq, u64 addr) · 702 unmodified lines | ||
| 1331 | 1331 | xive->saved_src_count++; |
| 1332 | 1332 | |
| 1333 | 1333 | /* Convert saved state into something compatible with xics */ |
| 1334 | − val = state->guest_server; | |
| 1334 | + val = state->act_server; | |
| 1335 | 1335 | prio = state->saved_scan_prio; |
| 1336 | 1336 | |
| 1337 | 1337 | if (prio == MASKED) { |
| @@ -1507,7 +1507,6 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) · 169 unmodified lines | ||
| 1507 | 1507 | /* First convert prio and mark interrupt as untargetted */ |
| 1508 | 1508 | act_prio = xive_prio_from_guest(guest_prio); |
| 1509 | 1509 | state->act_priority = MASKED; |
| 1510 | − state->guest_server = server; | |
| 1511 | 1510 | |
| 1512 | 1511 | /* |
| 1513 | 1512 | * We need to drop the lock due to the mutex below. Hopefully |
| @@ -35,7 +35,6 @@ struct kvmppc_xive_irq_state { · 34 unmodified lines | ||
| 35 | 35 | struct xive_irq_data *pt_data; /* XIVE Pass-through associated data */ |
| 36 | 36 | |
| 37 | 37 | /* Targetting as set by guest */ |
| 38 | − u32 guest_server; /* Current guest selected target */ | |
| 39 | 38 | u8 guest_priority; /* Guest set priority */ |
| 40 | 39 | u8 saved_priority; /* Saved priority when masking */ |
| 41 | 40 | |
| @@ -361,9 +361,9 @@ static int change_page_attr(struct page *page, int numpages, pgprot_t prot) · 360 unmodified lines | ||
| 361 | 361 | break; |
| 362 | 362 | } |
| 363 | 363 | wmb(); |
| 364 | + local_irq_restore(flags); | |
| 364 | 365 | flush_tlb_kernel_range((unsigned long)page_address(start), |
| 365 | 366 | (unsigned long)page_address(page)); |
| 366 | − local_irq_restore(flags); | |
| 367 | 367 | return err; |
| 368 | 368 | } |
| 369 | 369 | |
| @@ -272,7 +272,15 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) · 271 unmodified lines | ||
| 272 | 272 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE |
| 273 | 273 | static unsigned long pnv_memory_block_size(void) |
| 274 | 274 | { |
| 275 | − return 256UL * 1024 * 1024; | |
| 275 | + /* | |
| 276 | + * We map the kernel linear region with 1GB large pages on radix. For | |
| 277 | + * memory hot unplug to work our memory block size must be at least | |
| 278 | + * this size. | |
| 279 | + */ | |
| 280 | + if (radix_enabled()) | |
| 281 | + return 1UL * 1024 * 1024 * 1024; | |
| 282 | + else | |
| 283 | + return 256UL * 1024 * 1024; | |
| 276 | 284 | } |
| 277 | 285 | #endif |
| 278 | 286 | |
| @@ -1402,6 +1402,14 @@ void xive_teardown_cpu(void) · 1401 unmodified lines | ||
| 1402 | 1402 | |
| 1403 | 1403 | if (xive_ops->teardown_cpu) |
| 1404 | 1404 | xive_ops->teardown_cpu(cpu, xc); |
| 1405 | + | |
| 1406 | +#ifdef CONFIG_SMP | |
| 1407 | + /* Get rid of IPI */ | |
| 1408 | + xive_cleanup_cpu_ipi(cpu, xc); | |
| 1409 | +#endif | |
| 1410 | + | |
| 1411 | + /* Disable and free the queues */ | |
| 1412 | + xive_cleanup_cpu_queues(cpu, xc); | |
| 1405 | 1413 | } |
| 1406 | 1414 | |
| 1407 | 1415 | void xive_kexec_teardown_cpu(int secondary) |
| @@ -431,7 +431,11 @@ static int xive_spapr_get_ipi(unsigned int cpu, struct xive_cpu *xc) · 430 unmodified lines | ||
| 431 | 431 | |
| 432 | 432 | static void xive_spapr_put_ipi(unsigned int cpu, struct xive_cpu *xc) |
| 433 | 433 | { |
| 434 | + if (!xc->hw_ipi) | |
| 435 | + return; | |
| 436 | + | |
| 434 | 437 | xive_irq_bitmap_free(xc->hw_ipi); |
| 438 | + xc->hw_ipi = 0; | |
| 435 | 439 | } |
| 436 | 440 | #endif /* CONFIG_SMP */ |
| 437 | 441 | |
| @@ -44,7 +44,6 @@ config SPARC · 43 unmodified lines | ||
| 44 | 44 | select ARCH_HAS_SG_CHAIN |
| 45 | 45 | select CPU_NO_EFFICIENT_FFS |
| 46 | 46 | select LOCKDEP_SMALL if LOCKDEP |
| 47 | − select ARCH_WANT_RELAX_ORDER | |
| 48 | 47 | |
| 49 | 48 | config SPARC32 |
| 50 | 49 | def_bool !64BIT |
| @@ -4409,10 +4409,9 @@ static __init int fixup_ht_bug(void) · 4408 unmodified lines | ||
| 4409 | 4409 | return 0; |
| 4410 | 4410 | } |
| 4411 | 4411 | |
| 4412 | − if (lockup_detector_suspend() != 0) { | |
| 4413 | − pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); | |
| 4414 | − return 0; | |
| 4415 | − } | |
| 4412 | + cpus_read_lock(); | |
| 4413 | + | |
| 4414 | + hardlockup_detector_perf_stop(); | |
| 4416 | 4415 | |
| 4417 | 4416 | x86_pmu.flags &= ~(PMU_FL_EXCL_CNTRS | PMU_FL_EXCL_ENABLED); |
| 4418 | 4417 | |
| @@ -4420,9 +4419,7 @@ static __init int fixup_ht_bug(void) · 1 unmodified line | ||
| 4420 | 4419 | x86_pmu.commit_scheduling = NULL; |
| 4421 | 4420 | x86_pmu.stop_scheduling = NULL; |
| 4422 | 4421 | |
| 4423 | − lockup_detector_resume(); | |
| 4424 | − | |
| 4425 | − cpus_read_lock(); | |
| 4422 | + hardlockup_detector_perf_restart(); | |
| 4426 | 4423 | |
| 4427 | 4424 | for_each_online_cpu(c) |
| 4428 | 4425 | free_excl_cntrs(c); |
| @@ -88,7 +88,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, · 87 unmodified lines | ||
| 88 | 88 | bool kvm_para_available(void); |
| 89 | 89 | unsigned int kvm_arch_para_features(void); |
| 90 | 90 | void __init kvm_guest_init(void); |
| 91 | −void kvm_async_pf_task_wait(u32 token); | |
| 91 | +void kvm_async_pf_task_wait(u32 token, int interrupt_kernel); | |
| 92 | 92 | void kvm_async_pf_task_wake(u32 token); |
| 93 | 93 | u32 kvm_read_and_reset_pf_reason(void); |
| 94 | 94 | extern void kvm_disable_steal_time(void); |
| @@ -103,7 +103,7 @@ static inline void kvm_spinlock_init(void) · 8 unmodified lines | ||
| 103 | 103 | |
| 104 | 104 | #else /* CONFIG_KVM_GUEST */ |
| 105 | 105 | #define kvm_guest_init() do {} while (0) |
| 106 | −#define kvm_async_pf_task_wait(T) do {} while(0) | |
| 106 | +#define kvm_async_pf_task_wait(T, I) do {} while(0) | |
| 107 | 107 | #define kvm_async_pf_task_wake(T) do {} while(0) |
| 108 | 108 | |
| 109 | 109 | static inline bool kvm_para_available(void) |
| @@ -117,7 +117,11 @@ static struct kvm_task_sleep_node *_find_apf_task(struct kvm_task_sleep_head *b, · 116 unmodified lines | ||
| 117 | 117 | return NULL; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | −void kvm_async_pf_task_wait(u32 token) | |
| 120 | +/* | |
| 121 | + * @interrupt_kernel: Is this called from a routine which interrupts the kernel | |
| 122 | + * (other than user space)? | |
| 123 | + */ | |
| 124 | +void kvm_async_pf_task_wait(u32 token, int interrupt_kernel) | |
| 121 | 125 | { |
| 122 | 126 | u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS); |
| 123 | 127 | struct kvm_task_sleep_head *b = &async_pf_sleepers[key]; |
| @@ -140,8 +144,10 @@ void kvm_async_pf_task_wait(u32 token) · 16 unmodified lines | ||
| 140 | 144 | |
| 141 | 145 | n.token = token; |
| 142 | 146 | n.cpu = smp_processor_id(); |
| 143 | − n.halted = is_idle_task(current) || preempt_count() > 1 || | |
| 144 | − rcu_preempt_depth(); | |
| 147 | + n.halted = is_idle_task(current) || | |
| 148 | + (IS_ENABLED(CONFIG_PREEMPT_COUNT) | |
| 149 | + ? preempt_count() > 1 || rcu_preempt_depth() | |
| 150 | + : interrupt_kernel); | |
| 145 | 151 | init_swait_queue_head(&n.wq); |
| 146 | 152 | hlist_add_head(&n.link, &b->list); |
| 147 | 153 | raw_spin_unlock(&b->lock); |
| @@ -269,7 +275,7 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) · 121 unmodified lines | ||
| 269 | 275 | case KVM_PV_REASON_PAGE_NOT_PRESENT: |
| 270 | 276 | /* page is swapped out by the host. */ |
| 271 | 277 | prev_state = exception_enter(); |
| 272 | − kvm_async_pf_task_wait((u32)read_cr2()); | |
| 278 | + kvm_async_pf_task_wait((u32)read_cr2(), !user_mode(regs)); | |
| 273 | 279 | exception_exit(prev_state); |
| 274 | 280 | break; |
| 275 | 281 | case KVM_PV_REASON_PAGE_READY: |
| @@ -23,6 +23,7 @@ config KVM · 22 unmodified lines | ||
| 23 | 23 | depends on HIGH_RES_TIMERS |
| 24 | 24 | # for TASKSTATS/TASK_DELAY_ACCT: |
| 25 | 25 | depends on NET && MULTIUSER |
| 26 | + depends on X86_LOCAL_APIC | |
| 26 | 27 | select PREEMPT_NOTIFIERS |
| 27 | 28 | select MMU_NOTIFIER |
| 28 | 29 | select ANON_INODES |
| @@ -425,8 +425,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)); · 424 unmodified lines | ||
| 425 | 425 | #op " %al \n\t" \ |
| 426 | 426 | FOP_RET |
| 427 | 427 | |
| 428 | −asm(".global kvm_fastop_exception \n" | |
| 429 | − "kvm_fastop_exception: xor %esi, %esi; ret"); | |
| 428 | +asm(".pushsection .fixup, \"ax\"\n" | |
| 429 | + ".global kvm_fastop_exception \n" | |
| 430 | + "kvm_fastop_exception: xor %esi, %esi; ret\n" | |
| 431 | + ".popsection"); | |
| 430 | 432 | |
| 431 | 433 | FOP_START(setcc) |
| 432 | 434 | FOP_SETCC(seto) |
| @@ -3837,7 +3837,7 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code, · 3836 unmodified lines | ||
| 3837 | 3837 | case KVM_PV_REASON_PAGE_NOT_PRESENT: |
| 3838 | 3838 | vcpu->arch.apf.host_apf_reason = 0; |
| 3839 | 3839 | local_irq_disable(); |
| 3840 | − kvm_async_pf_task_wait(fault_address); | |
| 3840 | + kvm_async_pf_task_wait(fault_address, 0); | |
| 3841 | 3841 | local_irq_enable(); |
| 3842 | 3842 | break; |
| 3843 | 3843 | case KVM_PV_REASON_PAGE_READY: |
| @@ -815,10 +815,14 @@ int blk_mq_debugfs_register(struct request_queue *q) · 814 unmodified lines | ||
| 815 | 815 | goto err; |
| 816 | 816 | |
| 817 | 817 | /* |
| 818 | − * blk_mq_init_hctx() attempted to do this already, but q->debugfs_dir | |
| 818 | + * blk_mq_init_sched() attempted to do this already, but q->debugfs_dir | |
| 819 | 819 | * didn't exist yet (because we don't know what to name the directory |
| 820 | 820 | * until the queue is registered to a gendisk). |
| 821 | 821 | */ |
| 822 | + if (q->elevator && !q->sched_debugfs_dir) | |
| 823 | + blk_mq_debugfs_register_sched(q); | |
| 824 | + | |
| 825 | + /* Similarly, blk_mq_init_hctx() couldn't do this previously. */ | |
| 822 | 826 | queue_for_each_hw_ctx(q, hctx, i) { |
| 823 | 827 | if (!hctx->debugfs_dir && blk_mq_debugfs_register_hctx(q, hctx)) |
| 824 | 828 | goto err; |
| @@ -1911,11 +1911,11 @@ static void throtl_upgrade_state(struct throtl_data *td) · 1910 unmodified lines | ||
| 1911 | 1911 | |
| 1912 | 1912 | tg->disptime = jiffies - 1; |
| 1913 | 1913 | throtl_select_dispatch(sq); |
| 1914 | − throtl_schedule_next_dispatch(sq, false); | |
| 1914 | + throtl_schedule_next_dispatch(sq, true); | |
| 1915 | 1915 | } |
| 1916 | 1916 | rcu_read_unlock(); |
| 1917 | 1917 | throtl_select_dispatch(&td->service_queue); |
| 1918 | − throtl_schedule_next_dispatch(&td->service_queue, false); | |
| 1918 | + throtl_schedule_next_dispatch(&td->service_queue, true); | |
| 1919 | 1919 | queue_work(kthrotld_workqueue, &td->dispatch_work); |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| @@ -207,20 +207,34 @@ static int bsg_init_rq(struct request_queue *q, struct request *req, gfp_t gfp) · 206 unmodified lines | ||
| 207 | 207 | struct bsg_job *job = blk_mq_rq_to_pdu(req); |
| 208 | 208 | struct scsi_request *sreq = &job->sreq; |
| 209 | 209 | |
| 210 | + /* called right after the request is allocated for the request_queue */ | |
| 211 | + | |
| 212 | + sreq->sense = kzalloc(SCSI_SENSE_BUFFERSIZE, gfp); | |
| 213 | + if (!sreq->sense) | |
| 214 | + return -ENOMEM; | |
| 215 | + | |
| 216 | + return 0; | |
| 217 | +} | |
| 218 | + | |
| 219 | +static void bsg_initialize_rq(struct request *req) | |
| 220 | +{ | |
| 221 | + struct bsg_job *job = blk_mq_rq_to_pdu(req); | |
| 222 | + struct scsi_request *sreq = &job->sreq; | |
| 223 | + void *sense = sreq->sense; | |
| 224 | + | |
| 225 | + /* called right before the request is given to the request_queue user */ | |
| 226 | + | |
| 210 | 227 | memset(job, 0, sizeof(*job)); |
| 211 | 228 | |
| 212 | 229 | scsi_req_init(sreq); |
| 230 | + | |
| 231 | + sreq->sense = sense; | |
| 213 | 232 | sreq->sense_len = SCSI_SENSE_BUFFERSIZE; |
| 214 | − sreq->sense = kzalloc(sreq->sense_len, gfp); | |
| 215 | − if (!sreq->sense) | |
| 216 | − return -ENOMEM; | |
| 217 | 233 | |
| 218 | 234 | job->req = req; |
| 219 | − job->reply = sreq->sense; | |
| 235 | + job->reply = sense; | |
| 220 | 236 | job->reply_len = sreq->sense_len; |
| 221 | 237 | job->dd_data = job + 1; |
| 222 | − | |
| 223 | − return 0; | |
| 224 | 238 | } |
| 225 | 239 | |
| 226 | 240 | static void bsg_exit_rq(struct request_queue *q, struct request *req) |
| @@ -251,6 +265,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name, · 24 unmodified lines | ||
| 251 | 265 | q->cmd_size = sizeof(struct bsg_job) + dd_job_size; |
| 252 | 266 | q->init_rq_fn = bsg_init_rq; |
| 253 | 267 | q->exit_rq_fn = bsg_exit_rq; |
| 268 | + q->initialize_rq_fn = bsg_initialize_rq; | |
| 254 | 269 | q->request_fn = bsg_request_fn; |
| 255 | 270 | |
| 256 | 271 | ret = blk_init_allocated_queue(q); |
| @@ -1178,12 +1178,44 @@ dev_put: · 1177 unmodified lines | ||
| 1178 | 1178 | return ret; |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | +static bool __init iort_enable_acs(struct acpi_iort_node *iort_node) | |
| 1182 | +{ | |
| 1183 | + if (iort_node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX) { | |
| 1184 | + struct acpi_iort_node *parent; | |
| 1185 | + struct acpi_iort_id_mapping *map; | |
| 1186 | + int i; | |
| 1187 | + | |
| 1188 | + map = ACPI_ADD_PTR(struct acpi_iort_id_mapping, iort_node, | |
| 1189 | + iort_node->mapping_offset); | |
| 1190 | + | |
| 1191 | + for (i = 0; i < iort_node->mapping_count; i++, map++) { | |
| 1192 | + if (!map->output_reference) | |
| 1193 | + continue; | |
| 1194 | + | |
| 1195 | + parent = ACPI_ADD_PTR(struct acpi_iort_node, | |
| 1196 | + iort_table, map->output_reference); | |
| 1197 | + /* | |
| 1198 | + * If we detect a RC->SMMU mapping, make sure | |
| 1199 | + * we enable ACS on the system. | |
| 1200 | + */ | |
| 1201 | + if ((parent->type == ACPI_IORT_NODE_SMMU) || | |
| 1202 | + (parent->type == ACPI_IORT_NODE_SMMU_V3)) { | |
| 1203 | + pci_request_acs(); | |
| 1204 | + return true; | |
| 1205 | + } | |
| 1206 | + } | |
| 1207 | + } | |
| 1208 | + | |
| 1209 | + return false; | |
| 1210 | +} | |
| 1211 | + | |
| 1181 | 1212 | static void __init iort_init_platform_devices(void) |
| 1182 | 1213 | { |
| 1183 | 1214 | struct acpi_iort_node *iort_node, *iort_end; |
| 1184 | 1215 | struct acpi_table_iort *iort; |
| 1185 | 1216 | struct fwnode_handle *fwnode; |
| 1186 | 1217 | int i, ret; |
| 1218 | + bool acs_enabled = false; | |
| 1187 | 1219 | |
| 1188 | 1220 | /* |
| 1189 | 1221 | * iort_table and iort both point to the start of IORT table, but |
| @@ -1203,6 +1235,9 @@ static void __init iort_init_platform_devices(void) · 13 unmodified lines | ||
| 1203 | 1235 | return; |
| 1204 | 1236 | } |
| 1205 | 1237 | |
| 1238 | + if (!acs_enabled) | |
| 1239 | + acs_enabled = iort_enable_acs(iort_node); | |
| 1240 | + | |
| 1206 | 1241 | if ((iort_node->type == ACPI_IORT_NODE_SMMU) || |
| 1207 | 1242 | (iort_node->type == ACPI_IORT_NODE_SMMU_V3)) { |
| 1208 | 1243 | |
| @@ -17,7 +17,7 @@ if BLK_DEV · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | config BLK_DEV_NULL_BLK |
| 19 | 19 | tristate "Null test block driver" |
| 20 | − depends on CONFIGFS_FS | |
| 20 | + select CONFIGFS_FS | |
| 21 | 21 | |
| 22 | 22 | config BLK_DEV_FD |
| 23 | 23 | tristate "Normal floppy disk support" |
| @@ -820,9 +820,13 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx, · 819 unmodified lines | ||
| 820 | 820 | * appropriate. |
| 821 | 821 | */ |
| 822 | 822 | ret = nbd_handle_cmd(cmd, hctx->queue_num); |
| 823 | + if (ret < 0) | |
| 824 | + ret = BLK_STS_IOERR; | |
| 825 | + else if (!ret) | |
| 826 | + ret = BLK_STS_OK; | |
| 823 | 827 | complete(&cmd->send_complete); |
| 824 | 828 | |
| 825 | − return ret < 0 ? BLK_STS_IOERR : BLK_STS_OK; | |
| 829 | + return ret; | |
| 826 | 830 | } |
| 827 | 831 | |
| 828 | 832 | static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, |
| @@ -105,6 +105,7 @@ err: · 104 unmodified lines | ||
| 105 | 105 | |
| 106 | 106 | return ret; |
| 107 | 107 | } |
| 108 | +EXPORT_SYMBOL_GPL(clk_bulk_prepare); | |
| 108 | 109 | |
| 109 | 110 | #endif /* CONFIG_HAVE_CLK_PREPARE */ |
| 110 | 111 | |
| @@ -315,13 +315,13 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { · 314 unmodified lines | ||
| 315 | 315 | RK2928_CLKGATE_CON(10), 8, GFLAGS), |
| 316 | 316 | |
| 317 | 317 | GATE(SCLK_PVTM_CORE, "clk_pvtm_core", "xin24m", 0, |
| 318 | − RK2928_CLKGATE_CON(10), 8, GFLAGS), | |
| 318 | + RK2928_CLKGATE_CON(10), 0, GFLAGS), | |
| 319 | 319 | GATE(SCLK_PVTM_GPU, "clk_pvtm_gpu", "xin24m", 0, |
| 320 | − RK2928_CLKGATE_CON(10), 8, GFLAGS), | |
| 320 | + RK2928_CLKGATE_CON(10), 1, GFLAGS), | |
| 321 | 321 | GATE(SCLK_PVTM_FUNC, "clk_pvtm_func", "xin24m", 0, |
| 322 | − RK2928_CLKGATE_CON(10), 8, GFLAGS), | |
| 322 | + RK2928_CLKGATE_CON(10), 2, GFLAGS), | |
| 323 | 323 | GATE(SCLK_MIPI_24M, "clk_mipi_24m", "xin24m", CLK_IGNORE_UNUSED, |
| 324 | − RK2928_CLKGATE_CON(10), 8, GFLAGS), | |
| 324 | + RK2928_CLKGATE_CON(2), 15, GFLAGS), | |
| 325 | 325 | |
| 326 | 326 | COMPOSITE(SCLK_SDMMC, "sclk_sdmmc0", mux_mmc_src_p, 0, |
| 327 | 327 | RK2928_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS, |
| @@ -541,7 +541,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { · 213 unmodified lines | ||
| 541 | 541 | GATE(0, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS), |
| 542 | 542 | GATE(0, "pclk_mipiphy", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 0, GFLAGS), |
| 543 | 543 | |
| 544 | − GATE(0, "pclk_pmu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 2, GFLAGS), | |
| 544 | + GATE(0, "pclk_pmu", "pclk_pmu_pre", 0, RK2928_CLKGATE_CON(9), 2, GFLAGS), | |
| 545 | 545 | GATE(0, "pclk_pmu_niu", "pclk_pmu_pre", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 3, GFLAGS), |
| 546 | 546 | |
| 547 | 547 | /* PD_MMC */ |
| @@ -577,6 +577,8 @@ static const char *const rk3128_critical_clocks[] __initconst = { · 29 unmodified lines | ||
| 577 | 577 | "aclk_peri", |
| 578 | 578 | "hclk_peri", |
| 579 | 579 | "pclk_peri", |
| 580 | + "pclk_pmu", | |
| 581 | + "sclk_timer5", | |
| 580 | 582 | }; |
| 581 | 583 | |
| 582 | 584 | static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np) |
| @@ -294,6 +294,18 @@ static const struct samsung_clk_reg_dump src_mask_suspend_e4210[] = { · 293 unmodified lines | ||
| 294 | 294 | #define PLL_ENABLED (1 << 31) |
| 295 | 295 | #define PLL_LOCKED (1 << 29) |
| 296 | 296 | |
| 297 | +static void exynos4_clk_enable_pll(u32 reg) | |
| 298 | +{ | |
| 299 | + u32 pll_con = readl(reg_base + reg); | |
| 300 | + pll_con |= PLL_ENABLED; | |
| 301 | + writel(pll_con, reg_base + reg); | |
| 302 | + | |
| 303 | + while (!(pll_con & PLL_LOCKED)) { | |
| 304 | + cpu_relax(); | |
| 305 | + pll_con = readl(reg_base + reg); | |
| 306 | + } | |
| 307 | +} | |
| 308 | + | |
| 297 | 309 | static void exynos4_clk_wait_for_pll(u32 reg) |
| 298 | 310 | { |
| 299 | 311 | u32 pll_con; |
| @@ -315,6 +327,9 @@ static int exynos4_clk_suspend(void) · 15 unmodified lines | ||
| 315 | 327 | samsung_clk_save(reg_base, exynos4_save_pll, |
| 316 | 328 | ARRAY_SIZE(exynos4_clk_pll_regs)); |
| 317 | 329 | |
| 330 | + exynos4_clk_enable_pll(EPLL_CON0); | |
| 331 | + exynos4_clk_enable_pll(VPLL_CON0); | |
| 332 | + | |
| 318 | 333 | if (exynos4_soc == EXYNOS4210) { |
| 319 | 334 | samsung_clk_save(reg_base, exynos4_save_soc, |
| 320 | 335 | ARRAY_SIZE(exynos4210_clk_save)); |
| @@ -606,11 +606,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder, · 605 unmodified lines | ||
| 606 | 606 | connector->encoder->base.id, |
| 607 | 607 | connector->encoder->name); |
| 608 | 608 | |
| 609 | − /* ELD Conn_Type */ | |
| 610 | − connector->eld[5] &= ~(3 << 2); | |
| 611 | − if (intel_crtc_has_dp_encoder(crtc_state)) | |
| 612 | − connector->eld[5] |= (1 << 2); | |
| 613 | − | |
| 614 | 609 | connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2; |
| 615 | 610 | |
| 616 | 611 | if (dev_priv->display.audio_codec_enable) |
| @@ -1163,6 +1163,13 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, · 1162 unmodified lines | ||
| 1163 | 1163 | is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0; |
| 1164 | 1164 | is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR); |
| 1165 | 1165 | |
| 1166 | + if (port == PORT_A && is_dvi) { | |
| 1167 | + DRM_DEBUG_KMS("VBT claims port A supports DVI%s, ignoring\n", | |
| 1168 | + is_hdmi ? "/HDMI" : ""); | |
| 1169 | + is_dvi = false; | |
| 1170 | + is_hdmi = false; | |
| 1171 | + } | |
| 1172 | + | |
| 1166 | 1173 | info->supports_dvi = is_dvi; |
| 1167 | 1174 | info->supports_hdmi = is_hdmi; |
| 1168 | 1175 | info->supports_dp = is_dp; |
| @@ -216,7 +216,7 @@ static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv) · 215 unmodified lines | ||
| 216 | 216 | |
| 217 | 217 | mask = DC_STATE_DEBUG_MASK_MEMORY_UP; |
| 218 | 218 | |
| 219 | − if (IS_BROXTON(dev_priv)) | |
| 219 | + if (IS_GEN9_LP(dev_priv)) | |
| 220 | 220 | mask |= DC_STATE_DEBUG_MASK_CORES; |
| 221 | 221 | |
| 222 | 222 | /* The below bit doesn't need to be cleared ever afterwards */ |
| @@ -1655,7 +1655,8 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · 1654 unmodified lines | ||
| 1655 | 1655 | out: |
| 1656 | 1656 | if (ret && IS_GEN9_LP(dev_priv)) { |
| 1657 | 1657 | tmp = I915_READ(BXT_PHY_CTL(port)); |
| 1658 | − if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK | | |
| 1658 | + if ((tmp & (BXT_PHY_CMNLANE_POWERDOWN_ACK | | |
| 1659 | + BXT_PHY_LANE_POWERDOWN_ACK | | |
| 1659 | 1660 | BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) |
| 1660 | 1661 | DRM_ERROR("Port %c enabled but PHY powered down? " |
| 1661 | 1662 | "(PHY_CTL %08x)\n", port_name(port), tmp); |
| @@ -12359,7 +12359,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) · 12358 unmodified lines | ||
| 12359 | 12359 | struct drm_crtc_state *old_crtc_state, *new_crtc_state; |
| 12360 | 12360 | struct drm_crtc *crtc; |
| 12361 | 12361 | struct intel_crtc_state *intel_cstate; |
| 12362 | − bool hw_check = intel_state->modeset; | |
| 12363 | 12362 | u64 put_domains[I915_MAX_PIPES] = {}; |
| 12364 | 12363 | unsigned crtc_vblank_mask = 0; |
| 12365 | 12364 | int i; |
| @@ -12376,7 +12375,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state) · 10 unmodified lines | ||
| 12376 | 12375 | |
| 12377 | 12376 | if (needs_modeset(new_crtc_state) || |
| 12378 | 12377 | to_intel_crtc_state(new_crtc_state)->update_pipe) { |
| 12379 | − hw_check = true; | |
| 12380 | 12378 | |
| 12381 | 12379 | put_domains[to_intel_crtc(crtc)->pipe] = |
| 12382 | 12380 | modeset_get_crtc_power_domains(crtc, |
| @@ -208,12 +208,6 @@ static const struct bxt_ddi_phy_info glk_ddi_phy_info[] = { · 207 unmodified lines | ||
| 208 | 208 | }, |
| 209 | 209 | }; |
| 210 | 210 | |
| 211 | −static u32 bxt_phy_port_mask(const struct bxt_ddi_phy_info *phy_info) | |
| 212 | −{ | |
| 213 | − return (phy_info->dual_channel * BIT(phy_info->channel[DPIO_CH1].port)) | | |
| 214 | − BIT(phy_info->channel[DPIO_CH0].port); | |
| 215 | −} | |
| 216 | − | |
| 217 | 211 | static const struct bxt_ddi_phy_info * |
| 218 | 212 | bxt_get_phy_list(struct drm_i915_private *dev_priv, int *count) |
| 219 | 213 | { |
| @@ -313,7 +307,6 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, · 93 unmodified lines | ||
| 313 | 307 | enum dpio_phy phy) |
| 314 | 308 | { |
| 315 | 309 | const struct bxt_ddi_phy_info *phy_info; |
| 316 | − enum port port; | |
| 317 | 310 | |
| 318 | 311 | phy_info = bxt_get_phy_info(dev_priv, phy); |
| 319 | 312 | |
| @@ -335,19 +328,6 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, · 15 unmodified lines | ||
| 335 | 328 | return false; |
| 336 | 329 | } |
| 337 | 330 | |
| 338 | − for_each_port_masked(port, bxt_phy_port_mask(phy_info)) { | |
| 339 | − u32 tmp = I915_READ(BXT_PHY_CTL(port)); | |
| 340 | − | |
| 341 | − if (tmp & BXT_PHY_CMNLANE_POWERDOWN_ACK) { | |
| 342 | − DRM_DEBUG_DRIVER("DDI PHY %d powered, but common lane " | |
| 343 | − "for port %c powered down " | |
| 344 | − "(PHY_CTL %08x)\n", | |
| 345 | − phy, port_name(port), tmp); | |
| 346 | − | |
| 347 | − return false; | |
| 348 | − } | |
| 349 | − } | |
| 350 | − | |
| 351 | 331 | return true; |
| 352 | 332 | } |
| 353 | 333 | |
| @@ -30,6 +30,21 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "intel_drv.h" |
| 31 | 31 | #include "i915_drv.h" |
| 32 | 32 | |
| 33 | +static void intel_connector_update_eld_conn_type(struct drm_connector *connector) | |
| 34 | +{ | |
| 35 | + u8 conn_type; | |
| 36 | + | |
| 37 | + if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || | |
| 38 | + connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | |
| 39 | + conn_type = DRM_ELD_CONN_TYPE_DP; | |
| 40 | + } else { | |
| 41 | + conn_type = DRM_ELD_CONN_TYPE_HDMI; | |
| 42 | + } | |
| 43 | + | |
| 44 | + connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] &= ~DRM_ELD_CONN_TYPE_MASK; | |
| 45 | + connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= conn_type; | |
| 46 | +} | |
| 47 | + | |
| 33 | 48 | /** |
| 34 | 49 | * intel_connector_update_modes - update connector from edid |
| 35 | 50 | * @connector: DRM connector device to use |
| @@ -44,6 +59,8 @@ int intel_connector_update_modes(struct drm_connector *connector, · 8 unmodified lines | ||
| 44 | 59 | ret = drm_add_edid_modes(connector, edid); |
| 45 | 60 | drm_edid_to_eld(connector, edid); |
| 46 | 61 | |
| 62 | + intel_connector_update_eld_conn_type(connector); | |
| 63 | + | |
| 47 | 64 | return ret; |
| 48 | 65 | } |
| 49 | 66 | |
| @@ -2782,6 +2782,9 @@ static void cnl_display_core_init(struct drm_i915_private *dev_priv, bool resume · 2781 unmodified lines | ||
| 2782 | 2782 | |
| 2783 | 2783 | /* 6. Enable DBUF */ |
| 2784 | 2784 | gen9_dbuf_enable(dev_priv); |
| 2785 | + | |
| 2786 | + if (resume && dev_priv->csr.dmc_payload) | |
| 2787 | + intel_csr_load_program(dev_priv); | |
| 2785 | 2788 | } |
| 2786 | 2789 | |
| 2787 | 2790 | #undef CNL_PROCMON_IDX |
| @@ -302,26 +302,29 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, · 301 unmodified lines | ||
| 302 | 302 | hdmi->mod_clk = devm_clk_get(dev, "mod"); |
| 303 | 303 | if (IS_ERR(hdmi->mod_clk)) { |
| 304 | 304 | dev_err(dev, "Couldn't get the HDMI mod clock\n"); |
| 305 | − return PTR_ERR(hdmi->mod_clk); | |
| 305 | + ret = PTR_ERR(hdmi->mod_clk); | |
| 306 | + goto err_disable_bus_clk; | |
| 306 | 307 | } |
| 307 | 308 | clk_prepare_enable(hdmi->mod_clk); |
| 308 | 309 | |
| 309 | 310 | hdmi->pll0_clk = devm_clk_get(dev, "pll-0"); |
| 310 | 311 | if (IS_ERR(hdmi->pll0_clk)) { |
| 311 | 312 | dev_err(dev, "Couldn't get the HDMI PLL 0 clock\n"); |
| 312 | − return PTR_ERR(hdmi->pll0_clk); | |
| 313 | + ret = PTR_ERR(hdmi->pll0_clk); | |
| 314 | + goto err_disable_mod_clk; | |
| 313 | 315 | } |
| 314 | 316 | |
| 315 | 317 | hdmi->pll1_clk = devm_clk_get(dev, "pll-1"); |
| 316 | 318 | if (IS_ERR(hdmi->pll1_clk)) { |
| 317 | 319 | dev_err(dev, "Couldn't get the HDMI PLL 1 clock\n"); |
| 318 | − return PTR_ERR(hdmi->pll1_clk); | |
| 320 | + ret = PTR_ERR(hdmi->pll1_clk); | |
| 321 | + goto err_disable_mod_clk; | |
| 319 | 322 | } |
| 320 | 323 | |
| 321 | 324 | ret = sun4i_tmds_create(hdmi); |
| 322 | 325 | if (ret) { |
| 323 | 326 | dev_err(dev, "Couldn't create the TMDS clock\n"); |
| 324 | − return ret; | |
| 327 | + goto err_disable_mod_clk; | |
| 325 | 328 | } |
| 326 | 329 | |
| 327 | 330 | writel(SUN4I_HDMI_CTRL_ENABLE, hdmi->base + SUN4I_HDMI_CTRL_REG); |
| @@ -362,7 +365,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, · 34 unmodified lines | ||
| 362 | 365 | ret = sun4i_hdmi_i2c_create(dev, hdmi); |
| 363 | 366 | if (ret) { |
| 364 | 367 | dev_err(dev, "Couldn't create the HDMI I2C adapter\n"); |
| 365 | − return ret; | |
| 368 | + goto err_disable_mod_clk; | |
| 366 | 369 | } |
| 367 | 370 | |
| 368 | 371 | drm_encoder_helper_add(&hdmi->encoder, |
| @@ -422,6 +425,10 @@ err_cleanup_connector: · 53 unmodified lines | ||
| 422 | 425 | drm_encoder_cleanup(&hdmi->encoder); |
| 423 | 426 | err_del_i2c_adapter: |
| 424 | 427 | i2c_del_adapter(hdmi->i2c); |
| 428 | +err_disable_mod_clk: | |
| 429 | + clk_disable_unprepare(hdmi->mod_clk); | |
| 430 | +err_disable_bus_clk: | |
| 431 | + clk_disable_unprepare(hdmi->bus_clk); | |
| 425 | 432 | return ret; |
| 426 | 433 | } |
| 427 | 434 | |
| @@ -434,6 +441,8 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master, · 6 unmodified lines | ||
| 434 | 441 | drm_connector_cleanup(&hdmi->connector); |
| 435 | 442 | drm_encoder_cleanup(&hdmi->encoder); |
| 436 | 443 | i2c_del_adapter(hdmi->i2c); |
| 444 | + clk_disable_unprepare(hdmi->mod_clk); | |
| 445 | + clk_disable_unprepare(hdmi->bus_clk); | |
| 437 | 446 | } |
| 438 | 447 | |
| 439 | 448 | static const struct component_ops sun4i_hdmi_ops = { |
| @@ -630,7 +630,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 629 unmodified lines | ||
| 630 | 630 | sizeof(struct slimpro_resp_msg) * ASYNC_MSG_FIFO_SIZE, |
| 631 | 631 | GFP_KERNEL); |
| 632 | 632 | if (rc) |
| 633 | − goto out_mbox_free; | |
| 633 | + return -ENOMEM; | |
| 634 | 634 | |
| 635 | 635 | INIT_WORK(&ctx->workq, xgene_hwmon_evt_work); |
| 636 | 636 | |
| @@ -646,7 +646,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 9 unmodified lines | ||
| 646 | 646 | if (IS_ERR(ctx->mbox_chan)) { |
| 647 | 647 | dev_err(&pdev->dev, |
| 648 | 648 | "SLIMpro mailbox channel request failed\n"); |
| 649 | − return -ENODEV; | |
| 649 | + rc = -ENODEV; | |
| 650 | + goto out_mbox_free; | |
| 650 | 651 | } |
| 651 | 652 | } else { |
| 652 | 653 | struct acpi_pcct_hw_reduced *cppc_ss; |
| @@ -654,7 +655,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 654 | 655 | if (device_property_read_u32(&pdev->dev, "pcc-channel", |
| 655 | 656 | &ctx->mbox_idx)) { |
| 656 | 657 | dev_err(&pdev->dev, "no pcc-channel property\n"); |
| 657 | − return -ENODEV; | |
| 658 | + rc = -ENODEV; | |
| 659 | + goto out_mbox_free; | |
| 658 | 660 | } |
| 659 | 661 | |
| 660 | 662 | cl->rx_callback = xgene_hwmon_pcc_rx_cb; |
| @@ -662,7 +664,8 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 662 | 664 | if (IS_ERR(ctx->mbox_chan)) { |
| 663 | 665 | dev_err(&pdev->dev, |
| 664 | 666 | "PPC channel request failed\n"); |
| 665 | − return -ENODEV; | |
| 667 | + rc = -ENODEV; | |
| 668 | + goto out_mbox_free; | |
| 666 | 669 | } |
| 667 | 670 | |
| 668 | 671 | /* |
| @@ -675,13 +678,13 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 675 | 678 | if (!cppc_ss) { |
| 676 | 679 | dev_err(&pdev->dev, "PPC subspace not found\n"); |
| 677 | 680 | rc = -ENODEV; |
| 678 | − goto out_mbox_free; | |
| 681 | + goto out; | |
| 679 | 682 | } |
| 680 | 683 | |
| 681 | 684 | if (!ctx->mbox_chan->mbox->txdone_irq) { |
| 682 | 685 | dev_err(&pdev->dev, "PCC IRQ not supported\n"); |
| 683 | 686 | rc = -ENODEV; |
| 684 | − goto out_mbox_free; | |
| 687 | + goto out; | |
| 685 | 688 | } |
| 686 | 689 | |
| 687 | 690 | /* |
| @@ -696,14 +699,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev) · 8 unmodified lines | ||
| 696 | 699 | } else { |
| 697 | 700 | dev_err(&pdev->dev, "Failed to get PCC comm region\n"); |
| 698 | 701 | rc = -ENODEV; |
| 699 | − goto out_mbox_free; | |
| 702 | + goto out; | |
| 700 | 703 | } |
| 701 | 704 | |
| 702 | 705 | if (!ctx->pcc_comm_addr) { |
| 703 | 706 | dev_err(&pdev->dev, |
| 704 | 707 | "Failed to ioremap PCC comm region\n"); |
| 705 | 708 | rc = -ENOMEM; |
| 706 | − goto out_mbox_free; | |
| 709 | + goto out; | |
| 707 | 710 | } |
| 708 | 711 | |
| 709 | 712 | /* |
| @@ -131,6 +131,7 @@ config I2C_I801 · 130 unmodified lines | ||
| 131 | 131 | Gemini Lake (SOC) |
| 132 | 132 | Cannon Lake-H (PCH) |
| 133 | 133 | Cannon Lake-LP (PCH) |
| 134 | + Cedar Fork (PCH) | |
| 134 | 135 | |
| 135 | 136 | This driver can also be built as a module. If so, the module |
| 136 | 137 | will be called i2c-i801. |
| @@ -68,6 +68,7 @@ · 67 unmodified lines | ||
| 68 | 68 | * Gemini Lake (SOC) 0x31d4 32 hard yes yes yes |
| 69 | 69 | * Cannon Lake-H (PCH) 0xa323 32 hard yes yes yes |
| 70 | 70 | * Cannon Lake-LP (PCH) 0x9da3 32 hard yes yes yes |
| 71 | + * Cedar Fork (PCH) 0x18df 32 hard yes yes yes | |
| 71 | 72 | * |
| 72 | 73 | * Features supported by this driver: |
| 73 | 74 | * Software PEC no |
| @@ -204,6 +205,7 @@ · 130 unmodified lines | ||
| 204 | 205 | |
| 205 | 206 | /* Older devices have their ID defined in <linux/pci_ids.h> */ |
| 206 | 207 | #define PCI_DEVICE_ID_INTEL_BAYTRAIL_SMBUS 0x0f12 |
| 208 | +#define PCI_DEVICE_ID_INTEL_CDF_SMBUS 0x18df | |
| 207 | 209 | #define PCI_DEVICE_ID_INTEL_DNV_SMBUS 0x19df |
| 208 | 210 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 |
| 209 | 211 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 |
| @@ -1025,6 +1027,7 @@ static const struct pci_device_id i801_ids[] = { · 815 unmodified lines | ||
| 1025 | 1027 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BRASWELL_SMBUS) }, |
| 1026 | 1028 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_SMBUS) }, |
| 1027 | 1029 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_SMBUS) }, |
| 1030 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CDF_SMBUS) }, | |
| 1028 | 1031 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMBUS) }, |
| 1029 | 1032 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BROXTON_SMBUS) }, |
| 1030 | 1033 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS) }, |
| @@ -1513,6 +1516,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 482 unmodified lines | ||
| 1513 | 1516 | case PCI_DEVICE_ID_INTEL_CANNONLAKE_LP_SMBUS: |
| 1514 | 1517 | case PCI_DEVICE_ID_INTEL_LEWISBURG_SMBUS: |
| 1515 | 1518 | case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS: |
| 1519 | + case PCI_DEVICE_ID_INTEL_CDF_SMBUS: | |
| 1516 | 1520 | case PCI_DEVICE_ID_INTEL_DNV_SMBUS: |
| 1517 | 1521 | case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS: |
| 1518 | 1522 | priv->features |= FEATURE_I2C_BLOCK_READ; |
| @@ -627,6 +627,7 @@ static const struct dev_pm_ops sprd_i2c_pm_ops = { · 626 unmodified lines | ||
| 627 | 627 | |
| 628 | 628 | static const struct of_device_id sprd_i2c_of_match[] = { |
| 629 | 629 | { .compatible = "sprd,sc9860-i2c", }, |
| 630 | + {}, | |
| 630 | 631 | }; |
| 631 | 632 | |
| 632 | 633 | static struct platform_driver sprd_i2c_driver = { |
| @@ -215,7 +215,7 @@ struct stm32f7_i2c_dev { · 214 unmodified lines | ||
| 215 | 215 | unsigned int msg_num; |
| 216 | 216 | unsigned int msg_id; |
| 217 | 217 | struct stm32f7_i2c_msg f7_msg; |
| 218 | − struct stm32f7_i2c_setup *setup; | |
| 218 | + struct stm32f7_i2c_setup setup; | |
| 219 | 219 | struct stm32f7_i2c_timings timing; |
| 220 | 220 | }; |
| 221 | 221 | |
| @@ -265,7 +265,7 @@ static struct stm32f7_i2c_spec i2c_specs[] = { · 43 unmodified lines | ||
| 265 | 265 | }, |
| 266 | 266 | }; |
| 267 | 267 | |
| 268 | −struct stm32f7_i2c_setup stm32f7_setup = { | |
| 268 | +static const struct stm32f7_i2c_setup stm32f7_setup = { | |
| 269 | 269 | .rise_time = STM32F7_I2C_RISE_TIME_DEFAULT, |
| 270 | 270 | .fall_time = STM32F7_I2C_FALL_TIME_DEFAULT, |
| 271 | 271 | .dnf = STM32F7_I2C_DNF_DEFAULT, |
| @@ -537,7 +537,7 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev) · 265 unmodified lines | ||
| 537 | 537 | writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR); |
| 538 | 538 | |
| 539 | 539 | /* Enable I2C */ |
| 540 | − if (i2c_dev->setup->analog_filter) | |
| 540 | + if (i2c_dev->setup.analog_filter) | |
| 541 | 541 | stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, |
| 542 | 542 | STM32F7_I2C_CR1_ANFOFF); |
| 543 | 543 | else |
| @@ -887,22 +887,19 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) · 343 unmodified lines | ||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | setup = of_device_get_match_data(&pdev->dev); |
| 890 | − i2c_dev->setup->rise_time = setup->rise_time; | |
| 891 | − i2c_dev->setup->fall_time = setup->fall_time; | |
| 892 | − i2c_dev->setup->dnf = setup->dnf; | |
| 893 | − i2c_dev->setup->analog_filter = setup->analog_filter; | |
| 890 | + i2c_dev->setup = *setup; | |
| 894 | 891 | |
| 895 | 892 | ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns", |
| 896 | 893 | &rise_time); |
| 897 | 894 | if (!ret) |
| 898 | − i2c_dev->setup->rise_time = rise_time; | |
| 895 | + i2c_dev->setup.rise_time = rise_time; | |
| 899 | 896 | |
| 900 | 897 | ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-falling-time-ns", |
| 901 | 898 | &fall_time); |
| 902 | 899 | if (!ret) |
| 903 | − i2c_dev->setup->fall_time = fall_time; | |
| 900 | + i2c_dev->setup.fall_time = fall_time; | |
| 904 | 901 | |
| 905 | − ret = stm32f7_i2c_setup_timing(i2c_dev, i2c_dev->setup); | |
| 902 | + ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup); | |
| 906 | 903 | if (ret) |
| 907 | 904 | goto clk_free; |
| 908 | 905 | |
| @@ -1451,6 +1451,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, · 1450 unmodified lines | ||
| 1451 | 1451 | if (hwif_init(hwif) == 0) { |
| 1452 | 1452 | printk(KERN_INFO "%s: failed to initialize IDE " |
| 1453 | 1453 | "interface\n", hwif->name); |
| 1454 | + device_unregister(hwif->portdev); | |
| 1454 | 1455 | device_unregister(&hwif->gendev); |
| 1455 | 1456 | ide_disable_port(hwif); |
| 1456 | 1457 | continue; |
| @@ -56,6 +56,7 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) · 55 unmodified lines | ||
| 56 | 56 | { |
| 57 | 57 | struct list_head *l; |
| 58 | 58 | struct pci_driver *d; |
| 59 | + int ret; | |
| 59 | 60 | |
| 60 | 61 | list_for_each(l, &ide_pci_drivers) { |
| 61 | 62 | d = list_entry(l, struct pci_driver, node); |
| @@ -63,10 +64,14 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) · 1 unmodified line | ||
| 63 | 64 | const struct pci_device_id *id = |
| 64 | 65 | pci_match_id(d->id_table, dev); |
| 65 | 66 | |
| 66 | − if (id != NULL && d->probe(dev, id) >= 0) { | |
| 67 | − dev->driver = d; | |
| 68 | − pci_dev_get(dev); | |
| 69 | − return 1; | |
| 67 | + if (id != NULL) { | |
| 68 | + pci_assign_irq(dev); | |
| 69 | + ret = d->probe(dev, id); | |
| 70 | + if (ret >= 0) { | |
| 71 | + dev->driver = d; | |
| 72 | + pci_dev_get(dev); | |
| 73 | + return 1; | |
| 74 | + } | |
| 70 | 75 | } |
| 71 | 76 | } |
| 72 | 77 | } |
| @@ -179,6 +179,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); · 178 unmodified lines | ||
| 179 | 179 | /** |
| 180 | 180 | * ide_pci_enable - do PCI enables |
| 181 | 181 | * @dev: PCI device |
| 182 | + * @bars: PCI BARs mask | |
| 182 | 183 | * @d: IDE port info |
| 183 | 184 | * |
| 184 | 185 | * Enable the IDE PCI device. We attempt to enable the device in full |
| @@ -189,9 +190,10 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); · 4 unmodified lines | ||
| 189 | 190 | * Returns zero on success or an error code |
| 190 | 191 | */ |
| 191 | 192 | |
| 192 | −static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) | |
| 193 | +static int ide_pci_enable(struct pci_dev *dev, int bars, | |
| 194 | + const struct ide_port_info *d) | |
| 193 | 195 | { |
| 194 | − int ret, bars; | |
| 196 | + int ret; | |
| 195 | 197 | |
| 196 | 198 | if (pci_enable_device(dev)) { |
| 197 | 199 | ret = pci_enable_device_io(dev); |
| @@ -216,18 +218,6 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) · 18 unmodified lines | ||
| 216 | 218 | goto out; |
| 217 | 219 | } |
| 218 | 220 | |
| 219 | − if (d->host_flags & IDE_HFLAG_SINGLE) | |
| 220 | − bars = (1 << 2) - 1; | |
| 221 | − else | |
| 222 | − bars = (1 << 4) - 1; | |
| 223 | − | |
| 224 | − if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { | |
| 225 | − if (d->host_flags & IDE_HFLAG_CS5520) | |
| 226 | − bars |= (1 << 2); | |
| 227 | − else | |
| 228 | − bars |= (1 << 4); | |
| 229 | − } | |
| 230 | − | |
| 231 | 221 | ret = pci_request_selected_regions(dev, bars, d->name); |
| 232 | 222 | if (ret < 0) |
| 233 | 223 | printk(KERN_ERR "%s %s: can't reserve resources\n", |
| @@ -403,6 +393,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) · 169 unmodified lines | ||
| 403 | 393 | /** |
| 404 | 394 | * ide_setup_pci_controller - set up IDE PCI |
| 405 | 395 | * @dev: PCI device |
| 396 | + * @bars: PCI BARs mask | |
| 406 | 397 | * @d: IDE port info |
| 407 | 398 | * @noisy: verbose flag |
| 408 | 399 | * |
| @@ -411,7 +402,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) · 2 unmodified lines | ||
| 411 | 402 | * and enables it if need be |
| 412 | 403 | */ |
| 413 | 404 | |
| 414 | −static int ide_setup_pci_controller(struct pci_dev *dev, | |
| 405 | +static int ide_setup_pci_controller(struct pci_dev *dev, int bars, | |
| 415 | 406 | const struct ide_port_info *d, int noisy) |
| 416 | 407 | { |
| 417 | 408 | int ret; |
| @@ -420,7 +411,7 @@ static int ide_setup_pci_controller(struct pci_dev *dev, · 2 unmodified lines | ||
| 420 | 411 | if (noisy) |
| 421 | 412 | ide_setup_pci_noise(dev, d); |
| 422 | 413 | |
| 423 | − ret = ide_pci_enable(dev, d); | |
| 414 | + ret = ide_pci_enable(dev, bars, d); | |
| 424 | 415 | if (ret < 0) |
| 425 | 416 | goto out; |
| 426 | 417 | |
| @@ -428,16 +419,20 @@ static int ide_setup_pci_controller(struct pci_dev *dev, · 1 unmodified line | ||
| 428 | 419 | if (ret < 0) { |
| 429 | 420 | printk(KERN_ERR "%s %s: error accessing PCI regs\n", |
| 430 | 421 | d->name, pci_name(dev)); |
| 431 | − goto out; | |
| 422 | + goto out_free_bars; | |
| 432 | 423 | } |
| 433 | 424 | if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */ |
| 434 | 425 | ret = ide_pci_configure(dev, d); |
| 435 | 426 | if (ret < 0) |
| 436 | − goto out; | |
| 427 | + goto out_free_bars; | |
| 437 | 428 | printk(KERN_INFO "%s %s: device enabled (Linux)\n", |
| 438 | 429 | d->name, pci_name(dev)); |
| 439 | 430 | } |
| 440 | 431 | |
| 432 | + goto out; | |
| 433 | + | |
| 434 | +out_free_bars: | |
| 435 | + pci_release_selected_regions(dev, bars); | |
| 441 | 436 | out: |
| 442 | 437 | return ret; |
| 443 | 438 | } |
| @@ -540,13 +535,28 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, · 96 unmodified lines | ||
| 540 | 535 | { |
| 541 | 536 | struct pci_dev *pdev[] = { dev1, dev2 }; |
| 542 | 537 | struct ide_host *host; |
| 543 | − int ret, i, n_ports = dev2 ? 4 : 2; | |
| 538 | + int ret, i, n_ports = dev2 ? 4 : 2, bars; | |
| 544 | 539 | struct ide_hw hw[4], *hws[] = { NULL, NULL, NULL, NULL }; |
| 545 | 540 | |
| 541 | + if (d->host_flags & IDE_HFLAG_SINGLE) | |
| 542 | + bars = (1 << 2) - 1; | |
| 543 | + else | |
| 544 | + bars = (1 << 4) - 1; | |
| 545 | + | |
| 546 | + if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { | |
| 547 | + if (d->host_flags & IDE_HFLAG_CS5520) | |
| 548 | + bars |= (1 << 2); | |
| 549 | + else | |
| 550 | + bars |= (1 << 4); | |
| 551 | + } | |
| 552 | + | |
| 546 | 553 | for (i = 0; i < n_ports / 2; i++) { |
| 547 | − ret = ide_setup_pci_controller(pdev[i], d, !i); | |
| 548 | − if (ret < 0) | |
| 554 | + ret = ide_setup_pci_controller(pdev[i], bars, d, !i); | |
| 555 | + if (ret < 0) { | |
| 556 | + if (i == 1) | |
| 557 | + pci_release_selected_regions(pdev[0], bars); | |
| 549 | 558 | goto out; |
| 559 | + } | |
| 550 | 560 | |
| 551 | 561 | ide_pci_setup_ports(pdev[i], d, &hw[i*2], &hws[i*2]); |
| 552 | 562 | } |
| @@ -554,7 +564,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, · 1 unmodified line | ||
| 554 | 564 | host = ide_host_alloc(d, hws, n_ports); |
| 555 | 565 | if (host == NULL) { |
| 556 | 566 | ret = -ENOMEM; |
| 557 | − goto out; | |
| 567 | + goto out_free_bars; | |
| 558 | 568 | } |
| 559 | 569 | |
| 560 | 570 | host->dev[0] = &dev1->dev; |
| @@ -576,7 +586,7 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, · 15 unmodified lines | ||
| 576 | 586 | * do_ide_setup_pci_device() on the first device! |
| 577 | 587 | */ |
| 578 | 588 | if (ret < 0) |
| 579 | − goto out; | |
| 589 | + goto out_free_bars; | |
| 580 | 590 | |
| 581 | 591 | /* fixup IRQ */ |
| 582 | 592 | if (ide_pci_is_in_compatibility_mode(pdev[i])) { |
| @@ -589,6 +599,13 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, · 6 unmodified lines | ||
| 589 | 599 | ret = ide_host_register(host, d, hws); |
| 590 | 600 | if (ret) |
| 591 | 601 | ide_host_free(host); |
| 602 | + else | |
| 603 | + goto out; | |
| 604 | + | |
| 605 | +out_free_bars: | |
| 606 | + i = n_ports / 2; | |
| 607 | + while (i--) | |
| 608 | + pci_release_selected_regions(pdev[i], bars); | |
| 592 | 609 | out: |
| 593 | 610 | return ret; |
| 594 | 611 | } |
| @@ -100,6 +100,8 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client) · 99 unmodified lines | ||
| 100 | 100 | if (ret) |
| 101 | 101 | goto pid_query_error; |
| 102 | 102 | |
| 103 | + nlmsg_end(skb, nlh); | |
| 104 | + | |
| 103 | 105 | pr_debug("%s: Multicasting a nlmsg (dev = %s ifname = %s iwpm = %s)\n", |
| 104 | 106 | __func__, pm_msg->dev_name, pm_msg->if_name, iwpm_ulib_name); |
| 105 | 107 | |
| @@ -170,6 +172,8 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) · 64 unmodified lines | ||
| 170 | 172 | &pm_msg->loc_addr, IWPM_NLA_MANAGE_ADDR); |
| 171 | 173 | if (ret) |
| 172 | 174 | goto add_mapping_error; |
| 175 | + | |
| 176 | + nlmsg_end(skb, nlh); | |
| 173 | 177 | nlmsg_request->req_buffer = pm_msg; |
| 174 | 178 | |
| 175 | 179 | ret = rdma_nl_unicast_wait(skb, iwpm_user_pid); |
| @@ -246,6 +250,8 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client) · 70 unmodified lines | ||
| 246 | 250 | &pm_msg->rem_addr, IWPM_NLA_QUERY_REMOTE_ADDR); |
| 247 | 251 | if (ret) |
| 248 | 252 | goto query_mapping_error; |
| 253 | + | |
| 254 | + nlmsg_end(skb, nlh); | |
| 249 | 255 | nlmsg_request->req_buffer = pm_msg; |
| 250 | 256 | |
| 251 | 257 | ret = rdma_nl_unicast_wait(skb, iwpm_user_pid); |
| @@ -308,6 +314,8 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client) · 56 unmodified lines | ||
| 308 | 314 | if (ret) |
| 309 | 315 | goto remove_mapping_error; |
| 310 | 316 | |
| 317 | + nlmsg_end(skb, nlh); | |
| 318 | + | |
| 311 | 319 | ret = rdma_nl_unicast_wait(skb, iwpm_user_pid); |
| 312 | 320 | if (ret) { |
| 313 | 321 | skb = NULL; /* skb is freed in the netlink send-op handling */ |
| @@ -597,6 +597,9 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid) · 596 unmodified lines | ||
| 597 | 597 | &mapping_num, IWPM_NLA_MAPINFO_SEND_NUM); |
| 598 | 598 | if (ret) |
| 599 | 599 | goto mapinfo_num_error; |
| 600 | + | |
| 601 | + nlmsg_end(skb, nlh); | |
| 602 | + | |
| 600 | 603 | ret = rdma_nl_unicast(skb, iwpm_pid); |
| 601 | 604 | if (ret) { |
| 602 | 605 | skb = NULL; |
| @@ -678,6 +681,8 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid) · 75 unmodified lines | ||
| 678 | 681 | if (ret) |
| 679 | 682 | goto send_mapping_info_unlock; |
| 680 | 683 | |
| 684 | + nlmsg_end(skb, nlh); | |
| 685 | + | |
| 681 | 686 | iwpm_print_sockaddr(&map_info->local_sockaddr, |
| 682 | 687 | "send_mapping_info: Local sockaddr:"); |
| 683 | 688 | iwpm_print_sockaddr(&map_info->mapped_sockaddr, |
| @@ -48,7 +48,7 @@ · 47 unmodified lines | ||
| 48 | 48 | * @wqe: cqp wqe for header |
| 49 | 49 | * @header: header for the cqp wqe |
| 50 | 50 | */ |
| 51 | −static inline void i40iw_insert_wqe_hdr(u64 *wqe, u64 header) | |
| 51 | +void i40iw_insert_wqe_hdr(u64 *wqe, u64 header) | |
| 52 | 52 | { |
| 53 | 53 | wmb(); /* make sure WQE is populated before polarity is set */ |
| 54 | 54 | set_64bit_val(wqe, 24, header); |
| @@ -59,6 +59,8 @@ enum i40iw_status_code i40iw_sc_mr_fast_register(struct i40iw_sc_qp *qp, · 58 unmodified lines | ||
| 59 | 59 | struct i40iw_fast_reg_stag_info *info, |
| 60 | 60 | bool post_sq); |
| 61 | 61 | |
| 62 | +void i40iw_insert_wqe_hdr(u64 *wqe, u64 header); | |
| 63 | + | |
| 62 | 64 | /* HMC/FPM functions */ |
| 63 | 65 | enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev, |
| 64 | 66 | u8 hmc_fn_id); |
| @@ -123,12 +123,11 @@ static void i40iw_puda_post_recvbuf(struct i40iw_puda_rsrc *rsrc, u32 wqe_idx, · 122 unmodified lines | ||
| 123 | 123 | get_64bit_val(wqe, 24, &offset24); |
| 124 | 124 | |
| 125 | 125 | offset24 = (offset24) ? 0 : LS_64(1, I40IWQPSQ_VALID); |
| 126 | − set_64bit_val(wqe, 24, offset24); | |
| 127 | 126 | |
| 128 | 127 | set_64bit_val(wqe, 0, buf->mem.pa); |
| 129 | 128 | set_64bit_val(wqe, 8, |
| 130 | 129 | LS_64(buf->mem.size, I40IWQPSQ_FRAG_LEN)); |
| 131 | − set_64bit_val(wqe, 24, offset24); | |
| 130 | + i40iw_insert_wqe_hdr(wqe, offset24); | |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | /** |
| @@ -409,9 +408,7 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp, · 274 unmodified lines | ||
| 409 | 408 | set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN)); |
| 410 | 409 | set_64bit_val(wqe, 16, header[0]); |
| 411 | 410 | |
| 412 | − /* Ensure all data is written before writing valid bit */ | |
| 413 | − wmb(); | |
| 414 | − set_64bit_val(wqe, 24, header[1]); | |
| 411 | + i40iw_insert_wqe_hdr(wqe, header[1]); | |
| 415 | 412 | |
| 416 | 413 | i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32); |
| 417 | 414 | i40iw_qp_post_wr(&qp->qp_uk); |
| @@ -539,7 +536,7 @@ static enum i40iw_status_code i40iw_puda_qp_wqe(struct i40iw_sc_dev *dev, struct · 121 unmodified lines | ||
| 539 | 536 | LS_64(2, I40IW_CQPSQ_QP_NEXTIWSTATE) | |
| 540 | 537 | LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID); |
| 541 | 538 | |
| 542 | − set_64bit_val(wqe, 24, header); | |
| 539 | + i40iw_insert_wqe_hdr(wqe, header); | |
| 543 | 540 | |
| 544 | 541 | i40iw_debug_buf(cqp->dev, I40IW_DEBUG_PUDA, "PUDA CQE", wqe, 32); |
| 545 | 542 | i40iw_sc_cqp_post_sq(cqp); |
| @@ -655,7 +652,7 @@ static enum i40iw_status_code i40iw_puda_cq_wqe(struct i40iw_sc_dev *dev, struct · 109 unmodified lines | ||
| 655 | 652 | LS_64(1, I40IW_CQPSQ_CQ_ENCEQEMASK) | |
| 656 | 653 | LS_64(1, I40IW_CQPSQ_CQ_CEQIDVALID) | |
| 657 | 654 | LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID); |
| 658 | − set_64bit_val(wqe, 24, header); | |
| 655 | + i40iw_insert_wqe_hdr(wqe, header); | |
| 659 | 656 | |
| 660 | 657 | i40iw_debug_buf(dev, I40IW_DEBUG_PUDA, "PUDA CQE", |
| 661 | 658 | wqe, I40IW_CQP_WQE_SIZE * 8); |
| @@ -826,12 +826,14 @@ static int i40iw_query_qp(struct ib_qp *ibqp, · 825 unmodified lines | ||
| 826 | 826 | attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE; |
| 827 | 827 | attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT; |
| 828 | 828 | attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT; |
| 829 | + attr->port_num = 1; | |
| 829 | 830 | init_attr->event_handler = iwqp->ibqp.event_handler; |
| 830 | 831 | init_attr->qp_context = iwqp->ibqp.qp_context; |
| 831 | 832 | init_attr->send_cq = iwqp->ibqp.send_cq; |
| 832 | 833 | init_attr->recv_cq = iwqp->ibqp.recv_cq; |
| 833 | 834 | init_attr->srq = iwqp->ibqp.srq; |
| 834 | 835 | init_attr->cap = attr->cap; |
| 836 | + init_attr->port_num = 1; | |
| 835 | 837 | return 0; |
| 836 | 838 | } |
| 837 | 839 | |
| @@ -4174,9 +4174,9 @@ err_bfreg: · 4173 unmodified lines | ||
| 4174 | 4174 | err_uar_page: |
| 4175 | 4175 | mlx5_put_uars_page(dev->mdev, dev->mdev->priv.uar); |
| 4176 | 4176 | |
| 4177 | −err_cnt: | |
| 4178 | − mlx5_ib_cleanup_cong_debugfs(dev); | |
| 4179 | 4177 | err_cong: |
| 4178 | + mlx5_ib_cleanup_cong_debugfs(dev); | |
| 4179 | +err_cnt: | |
| 4180 | 4180 | if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) |
| 4181 | 4181 | mlx5_ib_dealloc_counters(dev); |
| 4182 | 4182 | |
| @@ -387,7 +387,7 @@ struct qedr_qp { · 386 unmodified lines | ||
| 387 | 387 | u8 wqe_size; |
| 388 | 388 | |
| 389 | 389 | u8 smac[ETH_ALEN]; |
| 390 | − u16 vlan_id; | |
| 390 | + u16 vlan; | |
| 391 | 391 | int rc; |
| 392 | 392 | } *rqe_wr_id; |
| 393 | 393 | |
| @@ -105,7 +105,7 @@ void qedr_ll2_complete_rx_packet(void *cxt, · 104 unmodified lines | ||
| 105 | 105 | |
| 106 | 106 | qp->rqe_wr_id[qp->rq.gsi_cons].rc = data->u.data_length_error ? |
| 107 | 107 | -EINVAL : 0; |
| 108 | − qp->rqe_wr_id[qp->rq.gsi_cons].vlan_id = data->vlan; | |
| 108 | + qp->rqe_wr_id[qp->rq.gsi_cons].vlan = data->vlan; | |
| 109 | 109 | /* note: length stands for data length i.e. GRH is excluded */ |
| 110 | 110 | qp->rqe_wr_id[qp->rq.gsi_cons].sg_list[0].length = |
| 111 | 111 | data->length.data_length; |
| @@ -694,6 +694,7 @@ int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 582 unmodified lines | ||
| 694 | 694 | struct qedr_cq *cq = get_qedr_cq(ibcq); |
| 695 | 695 | struct qedr_qp *qp = dev->gsi_qp; |
| 696 | 696 | unsigned long flags; |
| 697 | + u16 vlan_id; | |
| 697 | 698 | int i = 0; |
| 698 | 699 | |
| 699 | 700 | spin_lock_irqsave(&cq->cq_lock, flags); |
| @@ -712,9 +713,14 @@ int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 12 unmodified lines | ||
| 712 | 713 | wc[i].wc_flags |= IB_WC_GRH | IB_WC_IP_CSUM_OK; |
| 713 | 714 | ether_addr_copy(wc[i].smac, qp->rqe_wr_id[qp->rq.cons].smac); |
| 714 | 715 | wc[i].wc_flags |= IB_WC_WITH_SMAC; |
| 715 | − if (qp->rqe_wr_id[qp->rq.cons].vlan_id) { | |
| 716 | + | |
| 717 | + vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan & | |
| 718 | + VLAN_VID_MASK; | |
| 719 | + if (vlan_id) { | |
| 716 | 720 | wc[i].wc_flags |= IB_WC_WITH_VLAN; |
| 717 | − wc[i].vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan_id; | |
| 721 | + wc[i].vlan_id = vlan_id; | |
| 722 | + wc[i].sl = (qp->rqe_wr_id[qp->rq.cons].vlan & | |
| 723 | + VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; | |
| 718 | 724 | } |
| 719 | 725 | |
| 720 | 726 | qedr_inc_sw_cons(&qp->rq); |
| @@ -64,7 +64,7 @@ EXPORT_SYMBOL(closure_put); · 63 unmodified lines | ||
| 64 | 64 | void __closure_wake_up(struct closure_waitlist *wait_list) |
| 65 | 65 | { |
| 66 | 66 | struct llist_node *list; |
| 67 | − struct closure *cl; | |
| 67 | + struct closure *cl, *t; | |
| 68 | 68 | struct llist_node *reverse = NULL; |
| 69 | 69 | |
| 70 | 70 | list = llist_del_all(&wait_list->list); |
| @@ -73,7 +73,7 @@ void __closure_wake_up(struct closure_waitlist *wait_list) · 2 unmodified lines | ||
| 73 | 73 | reverse = llist_reverse_order(list); |
| 74 | 74 | |
| 75 | 75 | /* Then do the wakeups */ |
| 76 | − llist_for_each_entry(cl, reverse, list) { | |
| 76 | + llist_for_each_entry_safe(cl, t, reverse, list) { | |
| 77 | 77 | closure_set_waiting(cl, 0); |
| 78 | 78 | closure_sub(cl, CLOSURE_WAITING + 1); |
| 79 | 79 | } |
| @@ -219,8 +219,17 @@ int cxllib_handle_fault(struct mm_struct *mm, u64 addr, u64 size, u64 flags) · 218 unmodified lines | ||
| 219 | 219 | |
| 220 | 220 | down_read(&mm->mmap_sem); |
| 221 | 221 | |
| 222 | − for (dar = addr; dar < addr + size; dar += page_size) { | |
| 223 | − if (!vma || dar < vma->vm_start || dar > vma->vm_end) { | |
| 222 | + vma = find_vma(mm, addr); | |
| 223 | + if (!vma) { | |
| 224 | + pr_err("Can't find vma for addr %016llx\n", addr); | |
| 225 | + rc = -EFAULT; | |
| 226 | + goto out; | |
| 227 | + } | |
| 228 | + /* get the size of the pages allocated */ | |
| 229 | + page_size = vma_kernel_pagesize(vma); | |
| 230 | + | |
| 231 | + for (dar = (addr & ~(page_size - 1)); dar < (addr + size); dar += page_size) { | |
| 232 | + if (dar < vma->vm_start || dar >= vma->vm_end) { | |
| 224 | 233 | vma = find_vma(mm, addr); |
| 225 | 234 | if (!vma) { |
| 226 | 235 | pr_err("Can't find vma for addr %016llx\n", addr); |
| @@ -1634,8 +1634,6 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq, · 1633 unmodified lines | ||
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | 1636 | mqrq->areq.mrq = &brq->mrq; |
| 1637 | − | |
| 1638 | − mmc_queue_bounce_pre(mqrq); | |
| 1639 | 1637 | } |
| 1640 | 1638 | |
| 1641 | 1639 | static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, |
| @@ -1829,7 +1827,6 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req) · 187 unmodified lines | ||
| 1829 | 1827 | brq = &mq_rq->brq; |
| 1830 | 1828 | old_req = mmc_queue_req_to_req(mq_rq); |
| 1831 | 1829 | type = rq_data_dir(old_req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE; |
| 1832 | − mmc_queue_bounce_post(mq_rq); | |
| 1833 | 1830 | |
| 1834 | 1831 | switch (status) { |
| 1835 | 1832 | case MMC_BLK_SUCCESS: |
| @@ -1286,6 +1286,23 @@ out_err: · 1285 unmodified lines | ||
| 1286 | 1286 | return err; |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | +static void mmc_select_driver_type(struct mmc_card *card) | |
| 1290 | +{ | |
| 1291 | + int card_drv_type, drive_strength, drv_type; | |
| 1292 | + | |
| 1293 | + card_drv_type = card->ext_csd.raw_driver_strength | | |
| 1294 | + mmc_driver_type_mask(0); | |
| 1295 | + | |
| 1296 | + drive_strength = mmc_select_drive_strength(card, | |
| 1297 | + card->ext_csd.hs200_max_dtr, | |
| 1298 | + card_drv_type, &drv_type); | |
| 1299 | + | |
| 1300 | + card->drive_strength = drive_strength; | |
| 1301 | + | |
| 1302 | + if (drv_type) | |
| 1303 | + mmc_set_driver_type(card->host, drv_type); | |
| 1304 | +} | |
| 1305 | + | |
| 1289 | 1306 | static int mmc_select_hs400es(struct mmc_card *card) |
| 1290 | 1307 | { |
| 1291 | 1308 | struct mmc_host *host = card->host; |
| @@ -1341,6 +1358,8 @@ static int mmc_select_hs400es(struct mmc_card *card) · 49 unmodified lines | ||
| 1341 | 1358 | goto out_err; |
| 1342 | 1359 | } |
| 1343 | 1360 | |
| 1361 | + mmc_select_driver_type(card); | |
| 1362 | + | |
| 1344 | 1363 | /* Switch card to HS400 */ |
| 1345 | 1364 | val = EXT_CSD_TIMING_HS400 | |
| 1346 | 1365 | card->drive_strength << EXT_CSD_DRV_STR_SHIFT; |
| @@ -1374,23 +1393,6 @@ out_err: · 27 unmodified lines | ||
| 1374 | 1393 | return err; |
| 1375 | 1394 | } |
| 1376 | 1395 | |
| 1377 | −static void mmc_select_driver_type(struct mmc_card *card) | |
| 1378 | −{ | |
| 1379 | − int card_drv_type, drive_strength, drv_type; | |
| 1380 | − | |
| 1381 | − card_drv_type = card->ext_csd.raw_driver_strength | | |
| 1382 | − mmc_driver_type_mask(0); | |
| 1383 | − | |
| 1384 | − drive_strength = mmc_select_drive_strength(card, | |
| 1385 | − card->ext_csd.hs200_max_dtr, | |
| 1386 | − card_drv_type, &drv_type); | |
| 1387 | − | |
| 1388 | − card->drive_strength = drive_strength; | |
| 1389 | − | |
| 1390 | − if (drv_type) | |
| 1391 | − mmc_set_driver_type(card->host, drv_type); | |
| 1392 | −} | |
| 1393 | − | |
| 1394 | 1396 | /* |
| 1395 | 1397 | * For device supporting HS200 mode, the following sequence |
| 1396 | 1398 | * should be done before executing the tuning process. |
| @@ -23,8 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "core.h" |
| 24 | 24 | #include "card.h" |
| 25 | 25 | |
| 26 | −#define MMC_QUEUE_BOUNCESZ 65536 | |
| 27 | − | |
| 28 | 26 | /* |
| 29 | 27 | * Prepare a MMC request. This just filters out odd stuff. |
| 30 | 28 | */ |
| @@ -150,26 +148,6 @@ static void mmc_queue_setup_discard(struct request_queue *q, · 119 unmodified lines | ||
| 150 | 148 | queue_flag_set_unlocked(QUEUE_FLAG_SECERASE, q); |
| 151 | 149 | } |
| 152 | 150 | |
| 153 | −static unsigned int mmc_queue_calc_bouncesz(struct mmc_host *host) | |
| 154 | −{ | |
| 155 | − unsigned int bouncesz = MMC_QUEUE_BOUNCESZ; | |
| 156 | − | |
| 157 | − if (host->max_segs != 1 || (host->caps & MMC_CAP_NO_BOUNCE_BUFF)) | |
| 158 | − return 0; | |
| 159 | − | |
| 160 | − if (bouncesz > host->max_req_size) | |
| 161 | − bouncesz = host->max_req_size; | |
| 162 | − if (bouncesz > host->max_seg_size) | |
| 163 | − bouncesz = host->max_seg_size; | |
| 164 | − if (bouncesz > host->max_blk_count * 512) | |
| 165 | − bouncesz = host->max_blk_count * 512; | |
| 166 | − | |
| 167 | − if (bouncesz <= 512) | |
| 168 | − return 0; | |
| 169 | − | |
| 170 | − return bouncesz; | |
| 171 | −} | |
| 172 | − | |
| 173 | 151 | /** |
| 174 | 152 | * mmc_init_request() - initialize the MMC-specific per-request data |
| 175 | 153 | * @q: the request queue |
| @@ -184,26 +162,9 @@ static int mmc_init_request(struct request_queue *q, struct request *req, · 8 unmodified lines | ||
| 184 | 162 | struct mmc_card *card = mq->card; |
| 185 | 163 | struct mmc_host *host = card->host; |
| 186 | 164 | |
| 187 | − if (card->bouncesz) { | |
| 188 | − mq_rq->bounce_buf = kmalloc(card->bouncesz, gfp); | |
| 189 | − if (!mq_rq->bounce_buf) | |
| 190 | − return -ENOMEM; | |
| 191 | − if (card->bouncesz > 512) { | |
| 192 | − mq_rq->sg = mmc_alloc_sg(1, gfp); | |
| 193 | − if (!mq_rq->sg) | |
| 194 | − return -ENOMEM; | |
| 195 | − mq_rq->bounce_sg = mmc_alloc_sg(card->bouncesz / 512, | |
| 196 | − gfp); | |
| 197 | − if (!mq_rq->bounce_sg) | |
| 198 | − return -ENOMEM; | |
| 199 | − } | |
| 200 | − } else { | |
| 201 | − mq_rq->bounce_buf = NULL; | |
| 202 | − mq_rq->bounce_sg = NULL; | |
| 203 | − mq_rq->sg = mmc_alloc_sg(host->max_segs, gfp); | |
| 204 | − if (!mq_rq->sg) | |
| 205 | − return -ENOMEM; | |
| 206 | − } | |
| 165 | + mq_rq->sg = mmc_alloc_sg(host->max_segs, gfp); | |
| 166 | + if (!mq_rq->sg) | |
| 167 | + return -ENOMEM; | |
| 207 | 168 | |
| 208 | 169 | return 0; |
| 209 | 170 | } |
| @@ -212,13 +173,6 @@ static void mmc_exit_request(struct request_queue *q, struct request *req) · 2 unmodified lines | ||
| 212 | 173 | { |
| 213 | 174 | struct mmc_queue_req *mq_rq = req_to_mmc_queue_req(req); |
| 214 | 175 | |
| 215 | − /* It is OK to kfree(NULL) so this will be smooth */ | |
| 216 | − kfree(mq_rq->bounce_sg); | |
| 217 | − mq_rq->bounce_sg = NULL; | |
| 218 | − | |
| 219 | − kfree(mq_rq->bounce_buf); | |
| 220 | − mq_rq->bounce_buf = NULL; | |
| 221 | − | |
| 222 | 176 | kfree(mq_rq->sg); |
| 223 | 177 | mq_rq->sg = NULL; |
| 224 | 178 | } |
| @@ -242,12 +196,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, · 17 unmodified lines | ||
| 242 | 196 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) |
| 243 | 197 | limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT; |
| 244 | 198 | |
| 245 | − /* | |
| 246 | − * mmc_init_request() depends on card->bouncesz so it must be calculated | |
| 247 | − * before blk_init_allocated_queue() starts allocating requests. | |
| 248 | − */ | |
| 249 | − card->bouncesz = mmc_queue_calc_bouncesz(host); | |
| 250 | − | |
| 251 | 199 | mq->card = card; |
| 252 | 200 | mq->queue = blk_alloc_queue(GFP_KERNEL); |
| 253 | 201 | if (!mq->queue) |
| @@ -271,17 +219,11 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, · 17 unmodified lines | ||
| 271 | 219 | if (mmc_can_erase(card)) |
| 272 | 220 | mmc_queue_setup_discard(mq->queue, card); |
| 273 | 221 | |
| 274 | − if (card->bouncesz) { | |
| 275 | − blk_queue_max_hw_sectors(mq->queue, card->bouncesz / 512); | |
| 276 | − blk_queue_max_segments(mq->queue, card->bouncesz / 512); | |
| 277 | − blk_queue_max_segment_size(mq->queue, card->bouncesz); | |
| 278 | − } else { | |
| 279 | − blk_queue_bounce_limit(mq->queue, limit); | |
| 280 | − blk_queue_max_hw_sectors(mq->queue, | |
| 281 | − min(host->max_blk_count, host->max_req_size / 512)); | |
| 282 | − blk_queue_max_segments(mq->queue, host->max_segs); | |
| 283 | − blk_queue_max_segment_size(mq->queue, host->max_seg_size); | |
| 284 | − } | |
| 222 | + blk_queue_bounce_limit(mq->queue, limit); | |
| 223 | + blk_queue_max_hw_sectors(mq->queue, | |
| 224 | + min(host->max_blk_count, host->max_req_size / 512)); | |
| 225 | + blk_queue_max_segments(mq->queue, host->max_segs); | |
| 226 | + blk_queue_max_segment_size(mq->queue, host->max_seg_size); | |
| 285 | 227 | |
| 286 | 228 | sema_init(&mq->thread_sem, 1); |
| 287 | 229 | |
| @@ -370,56 +312,7 @@ void mmc_queue_resume(struct mmc_queue *mq) · 82 unmodified lines | ||
| 370 | 312 | */ |
| 371 | 313 | unsigned int mmc_queue_map_sg(struct mmc_queue *mq, struct mmc_queue_req *mqrq) |
| 372 | 314 | { |
| 373 | − unsigned int sg_len; | |
| 374 | − size_t buflen; | |
| 375 | − struct scatterlist *sg; | |
| 376 | 315 | struct request *req = mmc_queue_req_to_req(mqrq); |
| 377 | − int i; | |
| 378 | − | |
| 379 | − if (!mqrq->bounce_buf) | |
| 380 | − return blk_rq_map_sg(mq->queue, req, mqrq->sg); | |
| 381 | − | |
| 382 | − sg_len = blk_rq_map_sg(mq->queue, req, mqrq->bounce_sg); | |
| 383 | − | |
| 384 | − mqrq->bounce_sg_len = sg_len; | |
| 385 | − | |
| 386 | − buflen = 0; | |
| 387 | − for_each_sg(mqrq->bounce_sg, sg, sg_len, i) | |
| 388 | − buflen += sg->length; | |
| 389 | − | |
| 390 | − sg_init_one(mqrq->sg, mqrq->bounce_buf, buflen); | |
| 391 | − | |
| 392 | − return 1; | |
| 393 | −} | |
| 394 | − | |
| 395 | −/* | |
| 396 | − * If writing, bounce the data to the buffer before the request | |
| 397 | − * is sent to the host driver | |
| 398 | − */ | |
| 399 | −void mmc_queue_bounce_pre(struct mmc_queue_req *mqrq) | |
| 400 | −{ | |
| 401 | − if (!mqrq->bounce_buf) | |
| 402 | − return; | |
| 403 | − | |
| 404 | − if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != WRITE) | |
| 405 | − return; | |
| 406 | − | |
| 407 | − sg_copy_to_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, | |
| 408 | − mqrq->bounce_buf, mqrq->sg[0].length); | |
| 409 | −} | |
| 410 | − | |
| 411 | −/* | |
| 412 | − * If reading, bounce the data from the buffer after the request | |
| 413 | − * has been handled by the host driver | |
| 414 | − */ | |
| 415 | −void mmc_queue_bounce_post(struct mmc_queue_req *mqrq) | |
| 416 | −{ | |
| 417 | − if (!mqrq->bounce_buf) | |
| 418 | − return; | |
| 419 | − | |
| 420 | − if (rq_data_dir(mmc_queue_req_to_req(mqrq)) != READ) | |
| 421 | − return; | |
| 422 | 316 | |
| 423 | − sg_copy_from_buffer(mqrq->bounce_sg, mqrq->bounce_sg_len, | |
| 424 | − mqrq->bounce_buf, mqrq->sg[0].length); | |
| 317 | + return blk_rq_map_sg(mq->queue, req, mqrq->sg); | |
| 425 | 318 | } |
| @@ -49,9 +49,6 @@ enum mmc_drv_op { · 48 unmodified lines | ||
| 49 | 49 | struct mmc_queue_req { |
| 50 | 50 | struct mmc_blk_request brq; |
| 51 | 51 | struct scatterlist *sg; |
| 52 | − char *bounce_buf; | |
| 53 | − struct scatterlist *bounce_sg; | |
| 54 | − unsigned int bounce_sg_len; | |
| 55 | 52 | struct mmc_async_req areq; |
| 56 | 53 | enum mmc_drv_op drv_op; |
| 57 | 54 | int drv_op_result; |
| @@ -81,11 +78,8 @@ extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *, · 23 unmodified lines | ||
| 81 | 78 | extern void mmc_cleanup_queue(struct mmc_queue *); |
| 82 | 79 | extern void mmc_queue_suspend(struct mmc_queue *); |
| 83 | 80 | extern void mmc_queue_resume(struct mmc_queue *); |
| 84 | − | |
| 85 | 81 | extern unsigned int mmc_queue_map_sg(struct mmc_queue *, |
| 86 | 82 | struct mmc_queue_req *); |
| 87 | −extern void mmc_queue_bounce_pre(struct mmc_queue_req *); | |
| 88 | −extern void mmc_queue_bounce_post(struct mmc_queue_req *); | |
| 89 | 83 | |
| 90 | 84 | extern int mmc_access_rpmb(struct mmc_queue *); |
| 91 | 85 | |
| @@ -1038,7 +1038,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host) · 1037 unmodified lines | ||
| 1038 | 1038 | */ |
| 1039 | 1039 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
| 1040 | 1040 | MMC_CAP_ERASE | MMC_CAP_CMD23 | MMC_CAP_POWER_OFF_CARD | |
| 1041 | − MMC_CAP_3_3V_DDR | MMC_CAP_NO_BOUNCE_BUFF; | |
| 1041 | + MMC_CAP_3_3V_DDR; | |
| 1042 | 1042 | |
| 1043 | 1043 | if (host->use_sg) |
| 1044 | 1044 | mmc->max_segs = 16; |
| @@ -531,8 +531,7 @@ static int meson_mmc_clk_init(struct meson_host *host) · 530 unmodified lines | ||
| 531 | 531 | div->shift = __ffs(CLK_DIV_MASK); |
| 532 | 532 | div->width = __builtin_popcountl(CLK_DIV_MASK); |
| 533 | 533 | div->hw.init = &init; |
| 534 | − div->flags = (CLK_DIVIDER_ONE_BASED | | |
| 535 | − CLK_DIVIDER_ROUND_CLOSEST); | |
| 534 | + div->flags = CLK_DIVIDER_ONE_BASED; | |
| 536 | 535 | |
| 537 | 536 | clk = devm_clk_register(host->dev, &div->hw); |
| 538 | 537 | if (WARN_ON(IS_ERR(clk))) |
| @@ -717,6 +716,22 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode, · 178 unmodified lines | ||
| 717 | 716 | static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) |
| 718 | 717 | { |
| 719 | 718 | struct meson_host *host = mmc_priv(mmc); |
| 719 | + int ret; | |
| 720 | + | |
| 721 | + /* | |
| 722 | + * If this is the initial tuning, try to get a sane Rx starting | |
| 723 | + * phase before doing the actual tuning. | |
| 724 | + */ | |
| 725 | + if (!mmc->doing_retune) { | |
| 726 | + ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); | |
| 727 | + | |
| 728 | + if (ret) | |
| 729 | + return ret; | |
| 730 | + } | |
| 731 | + | |
| 732 | + ret = meson_mmc_clk_phase_tuning(mmc, opcode, host->tx_clk); | |
| 733 | + if (ret) | |
| 734 | + return ret; | |
| 720 | 735 | |
| 721 | 736 | return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); |
| 722 | 737 | } |
| @@ -746,6 +761,11 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 23 unmodified lines | ||
| 746 | 761 | case MMC_POWER_UP: |
| 747 | 762 | if (!IS_ERR(mmc->supply.vmmc)) |
| 748 | 763 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); |
| 764 | + | |
| 765 | + /* Reset phases */ | |
| 766 | + clk_set_phase(host->rx_clk, 0); | |
| 767 | + clk_set_phase(host->tx_clk, 270); | |
| 768 | + | |
| 749 | 769 | break; |
| 750 | 770 | |
| 751 | 771 | case MMC_POWER_ON: |
| @@ -759,8 +779,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 7 unmodified lines | ||
| 759 | 779 | host->vqmmc_enabled = true; |
| 760 | 780 | } |
| 761 | 781 | |
| 762 | − /* Reset rx phase */ | |
| 763 | − clk_set_phase(host->rx_clk, 0); | |
| 764 | 782 | break; |
| 765 | 783 | } |
| 766 | 784 | |
| @@ -702,11 +702,7 @@ static int pxamci_probe(struct platform_device *pdev) · 701 unmodified lines | ||
| 702 | 702 | |
| 703 | 703 | pxamci_init_ocr(host); |
| 704 | 704 | |
| 705 | − /* | |
| 706 | − * This architecture used to disable bounce buffers through its | |
| 707 | − * defconfig, now it is done at runtime as a host property. | |
| 708 | − */ | |
| 709 | − mmc->caps = MMC_CAP_NO_BOUNCE_BUFF; | |
| 705 | + mmc->caps = 0; | |
| 710 | 706 | host->cmdat = 0; |
| 711 | 707 | if (!cpu_is_pxa25x()) { |
| 712 | 708 | mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; |
| @@ -466,6 +466,7 @@ static int xenon_probe(struct platform_device *pdev) · 465 unmodified lines | ||
| 466 | 466 | { |
| 467 | 467 | struct sdhci_pltfm_host *pltfm_host; |
| 468 | 468 | struct sdhci_host *host; |
| 469 | + struct xenon_priv *priv; | |
| 469 | 470 | int err; |
| 470 | 471 | |
| 471 | 472 | host = sdhci_pltfm_init(pdev, &sdhci_xenon_pdata, |
| @@ -474,6 +475,7 @@ static int xenon_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 474 | 475 | return PTR_ERR(host); |
| 475 | 476 | |
| 476 | 477 | pltfm_host = sdhci_priv(host); |
| 478 | + priv = sdhci_pltfm_priv(pltfm_host); | |
| 477 | 479 | |
| 478 | 480 | /* |
| 479 | 481 | * Link Xenon specific mmc_host_ops function, |
| @@ -491,9 +493,20 @@ static int xenon_probe(struct platform_device *pdev) · 11 unmodified lines | ||
| 491 | 493 | if (err) |
| 492 | 494 | goto free_pltfm; |
| 493 | 495 | |
| 496 | + priv->axi_clk = devm_clk_get(&pdev->dev, "axi"); | |
| 497 | + if (IS_ERR(priv->axi_clk)) { | |
| 498 | + err = PTR_ERR(priv->axi_clk); | |
| 499 | + if (err == -EPROBE_DEFER) | |
| 500 | + goto err_clk; | |
| 501 | + } else { | |
| 502 | + err = clk_prepare_enable(priv->axi_clk); | |
| 503 | + if (err) | |
| 504 | + goto err_clk; | |
| 505 | + } | |
| 506 | + | |
| 494 | 507 | err = mmc_of_parse(host->mmc); |
| 495 | 508 | if (err) |
| 496 | − goto err_clk; | |
| 509 | + goto err_clk_axi; | |
| 497 | 510 | |
| 498 | 511 | sdhci_get_of_property(pdev); |
| 499 | 512 | |
| @@ -502,11 +515,11 @@ static int xenon_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 502 | 515 | /* Xenon specific dt parse */ |
| 503 | 516 | err = xenon_probe_dt(pdev); |
| 504 | 517 | if (err) |
| 505 | − goto err_clk; | |
| 518 | + goto err_clk_axi; | |
| 506 | 519 | |
| 507 | 520 | err = xenon_sdhc_prepare(host); |
| 508 | 521 | if (err) |
| 509 | − goto err_clk; | |
| 522 | + goto err_clk_axi; | |
| 510 | 523 | |
| 511 | 524 | pm_runtime_get_noresume(&pdev->dev); |
| 512 | 525 | pm_runtime_set_active(&pdev->dev); |
| @@ -527,6 +540,8 @@ remove_sdhc: · 14 unmodified lines | ||
| 527 | 540 | pm_runtime_disable(&pdev->dev); |
| 528 | 541 | pm_runtime_put_noidle(&pdev->dev); |
| 529 | 542 | xenon_sdhc_unprepare(host); |
| 543 | +err_clk_axi: | |
| 544 | + clk_disable_unprepare(priv->axi_clk); | |
| 530 | 545 | err_clk: |
| 531 | 546 | clk_disable_unprepare(pltfm_host->clk); |
| 532 | 547 | free_pltfm: |
| @@ -538,6 +553,7 @@ static int xenon_remove(struct platform_device *pdev) · 5 unmodified lines | ||
| 538 | 553 | { |
| 539 | 554 | struct sdhci_host *host = platform_get_drvdata(pdev); |
| 540 | 555 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
| 556 | + struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); | |
| 541 | 557 | |
| 542 | 558 | pm_runtime_get_sync(&pdev->dev); |
| 543 | 559 | pm_runtime_disable(&pdev->dev); |
| @@ -546,7 +562,7 @@ static int xenon_remove(struct platform_device *pdev) · 2 unmodified lines | ||
| 546 | 562 | sdhci_remove_host(host, 0); |
| 547 | 563 | |
| 548 | 564 | xenon_sdhc_unprepare(host); |
| 549 | − | |
| 565 | + clk_disable_unprepare(priv->axi_clk); | |
| 550 | 566 | clk_disable_unprepare(pltfm_host->clk); |
| 551 | 567 | |
| 552 | 568 | sdhci_pltfm_free(pdev); |
| @@ -83,6 +83,7 @@ struct xenon_priv { · 82 unmodified lines | ||
| 83 | 83 | unsigned char bus_width; |
| 84 | 84 | unsigned char timing; |
| 85 | 85 | unsigned int clock; |
| 86 | + struct clk *axi_clk; | |
| 86 | 87 | |
| 87 | 88 | int phy_type; |
| 88 | 89 | /* |
| @@ -566,8 +566,10 @@ static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog, · 565 unmodified lines | ||
| 566 | 566 | return true; |
| 567 | 567 | default: |
| 568 | 568 | bpf_warn_invalid_xdp_action(action); |
| 569 | + /* fall through */ | |
| 569 | 570 | case XDP_ABORTED: |
| 570 | 571 | trace_xdp_exception(nic->netdev, prog, action); |
| 572 | + /* fall through */ | |
| 571 | 573 | case XDP_DROP: |
| 572 | 574 | /* Check if it's a recycled page, if not |
| 573 | 575 | * unmap the DMA mapping. |
| @@ -175,31 +175,9 @@ static s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) · 174 unmodified lines | ||
| 175 | 175 | **/ |
| 176 | 176 | static s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw) |
| 177 | 177 | { |
| 178 | −#ifndef CONFIG_SPARC | |
| 179 | − u32 regval; | |
| 180 | − u32 i; | |
| 181 | −#endif | |
| 182 | 178 | s32 ret_val; |
| 183 | 179 | |
| 184 | 180 | ret_val = ixgbe_start_hw_generic(hw); |
| 185 | − | |
| 186 | −#ifndef CONFIG_SPARC | |
| 187 | − /* Disable relaxed ordering */ | |
| 188 | − for (i = 0; ((i < hw->mac.max_tx_queues) && | |
| 189 | − (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) { | |
| 190 | − regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(i)); | |
| 191 | − regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN; | |
| 192 | − IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(i), regval); | |
| 193 | − } | |
| 194 | − | |
| 195 | − for (i = 0; ((i < hw->mac.max_rx_queues) && | |
| 196 | − (i < IXGBE_DCA_MAX_QUEUES_82598)); i++) { | |
| 197 | − regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); | |
| 198 | − regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN | | |
| 199 | − IXGBE_DCA_RXCTRL_HEAD_WRO_EN); | |
| 200 | − IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); | |
| 201 | − } | |
| 202 | −#endif | |
| 203 | 181 | if (ret_val) |
| 204 | 182 | return ret_val; |
| 205 | 183 | |
| @@ -366,25 +366,6 @@ s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) · 365 unmodified lines | ||
| 366 | 366 | } |
| 367 | 367 | IXGBE_WRITE_FLUSH(hw); |
| 368 | 368 | |
| 369 | −#ifndef CONFIG_ARCH_WANT_RELAX_ORDER | |
| 370 | − /* Disable relaxed ordering */ | |
| 371 | − for (i = 0; i < hw->mac.max_tx_queues; i++) { | |
| 372 | − u32 regval; | |
| 373 | − | |
| 374 | − regval = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(i)); | |
| 375 | − regval &= ~IXGBE_DCA_TXCTRL_DESC_WRO_EN; | |
| 376 | − IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(i), regval); | |
| 377 | − } | |
| 378 | − | |
| 379 | − for (i = 0; i < hw->mac.max_rx_queues; i++) { | |
| 380 | − u32 regval; | |
| 381 | − | |
| 382 | − regval = IXGBE_READ_REG(hw, IXGBE_DCA_RXCTRL(i)); | |
| 383 | − regval &= ~(IXGBE_DCA_RXCTRL_DATA_WRO_EN | | |
| 384 | − IXGBE_DCA_RXCTRL_HEAD_WRO_EN); | |
| 385 | − IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); | |
| 386 | − } | |
| 387 | −#endif | |
| 388 | 369 | return 0; |
| 389 | 370 | } |
| 390 | 371 | |
| @@ -1049,7 +1049,7 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 1048 unmodified lines | ||
| 1049 | 1049 | { |
| 1050 | 1050 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| 1051 | 1051 | struct ixgbe_ring *temp_ring; |
| 1052 | − int i, err = 0; | |
| 1052 | + int i, j, err = 0; | |
| 1053 | 1053 | u32 new_rx_count, new_tx_count; |
| 1054 | 1054 | |
| 1055 | 1055 | if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) |
| @@ -1086,8 +1086,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 30 unmodified lines | ||
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | /* allocate temporary buffer to store rings in */ |
| 1089 | − i = max_t(int, adapter->num_tx_queues, adapter->num_rx_queues); | |
| 1090 | − i = max_t(int, i, adapter->num_xdp_queues); | |
| 1089 | + i = max_t(int, adapter->num_tx_queues + adapter->num_xdp_queues, | |
| 1090 | + adapter->num_rx_queues); | |
| 1091 | 1091 | temp_ring = vmalloc(i * sizeof(struct ixgbe_ring)); |
| 1092 | 1092 | |
| 1093 | 1093 | if (!temp_ring) { |
| @@ -1119,8 +1119,8 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 25 unmodified lines | ||
| 1119 | 1119 | } |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | − for (i = 0; i < adapter->num_xdp_queues; i++) { | |
| 1123 | − memcpy(&temp_ring[i], adapter->xdp_ring[i], | |
| 1122 | + for (j = 0; j < adapter->num_xdp_queues; j++, i++) { | |
| 1123 | + memcpy(&temp_ring[i], adapter->xdp_ring[j], | |
| 1124 | 1124 | sizeof(struct ixgbe_ring)); |
| 1125 | 1125 | |
| 1126 | 1126 | temp_ring[i].count = new_tx_count; |
| @@ -1140,10 +1140,10 @@ static int ixgbe_set_ringparam(struct net_device *netdev, · 13 unmodified lines | ||
| 1140 | 1140 | memcpy(adapter->tx_ring[i], &temp_ring[i], |
| 1141 | 1141 | sizeof(struct ixgbe_ring)); |
| 1142 | 1142 | } |
| 1143 | − for (i = 0; i < adapter->num_xdp_queues; i++) { | |
| 1144 | − ixgbe_free_tx_resources(adapter->xdp_ring[i]); | |
| 1143 | + for (j = 0; j < adapter->num_xdp_queues; j++, i++) { | |
| 1144 | + ixgbe_free_tx_resources(adapter->xdp_ring[j]); | |
| 1145 | 1145 | |
| 1146 | − memcpy(adapter->xdp_ring[i], &temp_ring[i], | |
| 1146 | + memcpy(adapter->xdp_ring[j], &temp_ring[i], | |
| 1147 | 1147 | sizeof(struct ixgbe_ring)); |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| @@ -5014,7 +5014,7 @@ static void ixgbe_clear_udp_tunnel_port(struct ixgbe_adapter *adapter, u32 mask) · 5013 unmodified lines | ||
| 5014 | 5014 | IXGBE_FLAG_GENEVE_OFFLOAD_CAPABLE))) |
| 5015 | 5015 | return; |
| 5016 | 5016 | |
| 5017 | − vxlanctrl = IXGBE_READ_REG(hw, IXGBE_VXLANCTRL) && ~mask; | |
| 5017 | + vxlanctrl = IXGBE_READ_REG(hw, IXGBE_VXLANCTRL) & ~mask; | |
| 5018 | 5018 | IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, vxlanctrl); |
| 5019 | 5019 | |
| 5020 | 5020 | if (mask & IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK) |
| @@ -8665,6 +8665,10 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd) · 3644 unmodified lines | ||
| 8665 | 8665 | return ixgbe_ptp_set_ts_config(adapter, req); |
| 8666 | 8666 | case SIOCGHWTSTAMP: |
| 8667 | 8667 | return ixgbe_ptp_get_ts_config(adapter, req); |
| 8668 | + case SIOCGMIIPHY: | |
| 8669 | + if (!adapter->hw.phy.ops.read_reg) | |
| 8670 | + return -EOPNOTSUPP; | |
| 8671 | + /* fall through */ | |
| 8668 | 8672 | default: |
| 8669 | 8673 | return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd); |
| 8670 | 8674 | } |
| @@ -3640,20 +3640,6 @@ static int mlxsw_sp_fib_lpm_tree_link(struct mlxsw_sp *mlxsw_sp, · 3639 unmodified lines | ||
| 3640 | 3640 | static void mlxsw_sp_fib_lpm_tree_unlink(struct mlxsw_sp *mlxsw_sp, |
| 3641 | 3641 | struct mlxsw_sp_fib *fib) |
| 3642 | 3642 | { |
| 3643 | − struct mlxsw_sp_prefix_usage req_prefix_usage = {{ 0 } }; | |
| 3644 | − struct mlxsw_sp_lpm_tree *lpm_tree; | |
| 3645 | − | |
| 3646 | − /* Aggregate prefix lengths across all virtual routers to make | |
| 3647 | − * sure we only have used prefix lengths in the LPM tree. | |
| 3648 | − */ | |
| 3649 | − mlxsw_sp_vrs_prefixes(mlxsw_sp, fib->proto, &req_prefix_usage); | |
| 3650 | − lpm_tree = mlxsw_sp_lpm_tree_get(mlxsw_sp, &req_prefix_usage, | |
| 3651 | − fib->proto); | |
| 3652 | − if (IS_ERR(lpm_tree)) | |
| 3653 | − goto err_tree_get; | |
| 3654 | − mlxsw_sp_vrs_lpm_tree_replace(mlxsw_sp, fib, lpm_tree); | |
| 3655 | − | |
| 3656 | −err_tree_get: | |
| 3657 | 3643 | if (!mlxsw_sp_prefix_usage_none(&fib->prefix_usage)) |
| 3658 | 3644 | return; |
| 3659 | 3645 | mlxsw_sp_vr_lpm_tree_unbind(mlxsw_sp, fib); |
| @@ -1339,7 +1339,17 @@ ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64) · 1338 unmodified lines | ||
| 1339 | 1339 | |
| 1340 | 1340 | static int ppp_dev_init(struct net_device *dev) |
| 1341 | 1341 | { |
| 1342 | + struct ppp *ppp; | |
| 1343 | + | |
| 1342 | 1344 | netdev_lockdep_set_classes(dev); |
| 1345 | + | |
| 1346 | + ppp = netdev_priv(dev); | |
| 1347 | + /* Let the netdevice take a reference on the ppp file. This ensures | |
| 1348 | + * that ppp_destroy_interface() won't run before the device gets | |
| 1349 | + * unregistered. | |
| 1350 | + */ | |
| 1351 | + atomic_inc(&ppp->file.refcnt); | |
| 1352 | + | |
| 1343 | 1353 | return 0; |
| 1344 | 1354 | } |
| 1345 | 1355 | |
| @@ -1362,6 +1372,15 @@ static void ppp_dev_uninit(struct net_device *dev) · 16 unmodified lines | ||
| 1362 | 1372 | wake_up_interruptible(&ppp->file.rwait); |
| 1363 | 1373 | } |
| 1364 | 1374 | |
| 1375 | +static void ppp_dev_priv_destructor(struct net_device *dev) | |
| 1376 | +{ | |
| 1377 | + struct ppp *ppp; | |
| 1378 | + | |
| 1379 | + ppp = netdev_priv(dev); | |
| 1380 | + if (atomic_dec_and_test(&ppp->file.refcnt)) | |
| 1381 | + ppp_destroy_interface(ppp); | |
| 1382 | +} | |
| 1383 | + | |
| 1365 | 1384 | static const struct net_device_ops ppp_netdev_ops = { |
| 1366 | 1385 | .ndo_init = ppp_dev_init, |
| 1367 | 1386 | .ndo_uninit = ppp_dev_uninit, |
| @@ -1387,6 +1406,7 @@ static void ppp_setup(struct net_device *dev) · 19 unmodified lines | ||
| 1387 | 1406 | dev->tx_queue_len = 3; |
| 1388 | 1407 | dev->type = ARPHRD_PPP; |
| 1389 | 1408 | dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; |
| 1409 | + dev->priv_destructor = ppp_dev_priv_destructor; | |
| 1390 | 1410 | netif_keep_dst(dev); |
| 1391 | 1411 | } |
| 1392 | 1412 | |
| @@ -560,6 +560,7 @@ static const struct driver_info wwan_info = { · 559 unmodified lines | ||
| 560 | 560 | #define NVIDIA_VENDOR_ID 0x0955 |
| 561 | 561 | #define HP_VENDOR_ID 0x03f0 |
| 562 | 562 | #define MICROSOFT_VENDOR_ID 0x045e |
| 563 | +#define UBLOX_VENDOR_ID 0x1546 | |
| 563 | 564 | |
| 564 | 565 | static const struct usb_device_id products[] = { |
| 565 | 566 | /* BLACKLIST !! |
| @@ -868,6 +869,18 @@ static const struct usb_device_id products[] = { · 302 unmodified lines | ||
| 868 | 869 | USB_CDC_SUBCLASS_ETHERNET, |
| 869 | 870 | USB_CDC_PROTO_NONE), |
| 870 | 871 | .driver_info = (unsigned long)&zte_cdc_info, |
| 872 | +}, { | |
| 873 | + /* U-blox TOBY-L2 */ | |
| 874 | + USB_DEVICE_AND_INTERFACE_INFO(UBLOX_VENDOR_ID, 0x1143, USB_CLASS_COMM, | |
| 875 | + USB_CDC_SUBCLASS_ETHERNET, | |
| 876 | + USB_CDC_PROTO_NONE), | |
| 877 | + .driver_info = (unsigned long)&wwan_info, | |
| 878 | +}, { | |
| 879 | + /* U-blox SARA-U2 */ | |
| 880 | + USB_DEVICE_AND_INTERFACE_INFO(UBLOX_VENDOR_ID, 0x1104, USB_CLASS_COMM, | |
| 881 | + USB_CDC_SUBCLASS_ETHERNET, | |
| 882 | + USB_CDC_PROTO_NONE), | |
| 883 | + .driver_info = (unsigned long)&wwan_info, | |
| 871 | 884 | }, { |
| 872 | 885 | USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, |
| 873 | 886 | USB_CDC_PROTO_NONE), |
| @@ -2136,7 +2136,7 @@ static umode_t nvme_ns_attrs_are_visible(struct kobject *kobj, · 2135 unmodified lines | ||
| 2136 | 2136 | struct nvme_ns *ns = nvme_get_ns_from_dev(dev); |
| 2137 | 2137 | |
| 2138 | 2138 | if (a == &dev_attr_uuid.attr) { |
| 2139 | − if (uuid_is_null(&ns->uuid) || | |
| 2139 | + if (uuid_is_null(&ns->uuid) && | |
| 2140 | 2140 | !memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) |
| 2141 | 2141 | return 0; |
| 2142 | 2142 | } |
| @@ -94,7 +94,7 @@ struct nvme_dev { · 93 unmodified lines | ||
| 94 | 94 | struct mutex shutdown_lock; |
| 95 | 95 | bool subsystem; |
| 96 | 96 | void __iomem *cmb; |
| 97 | − dma_addr_t cmb_dma_addr; | |
| 97 | + pci_bus_addr_t cmb_bus_addr; | |
| 98 | 98 | u64 cmb_size; |
| 99 | 99 | u32 cmbsz; |
| 100 | 100 | u32 cmbloc; |
| @@ -1226,7 +1226,7 @@ static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvmeq, · 1125 unmodified lines | ||
| 1226 | 1226 | if (qid && dev->cmb && use_cmb_sqes && NVME_CMB_SQS(dev->cmbsz)) { |
| 1227 | 1227 | unsigned offset = (qid - 1) * roundup(SQ_SIZE(depth), |
| 1228 | 1228 | dev->ctrl.page_size); |
| 1229 | − nvmeq->sq_dma_addr = dev->cmb_dma_addr + offset; | |
| 1229 | + nvmeq->sq_dma_addr = dev->cmb_bus_addr + offset; | |
| 1230 | 1230 | nvmeq->sq_cmds_io = dev->cmb + offset; |
| 1231 | 1231 | } else { |
| 1232 | 1232 | nvmeq->sq_cmds = dma_alloc_coherent(dev->dev, SQ_SIZE(depth), |
| @@ -1527,7 +1527,7 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev) · 294 unmodified lines | ||
| 1527 | 1527 | resource_size_t bar_size; |
| 1528 | 1528 | struct pci_dev *pdev = to_pci_dev(dev->dev); |
| 1529 | 1529 | void __iomem *cmb; |
| 1530 | − dma_addr_t dma_addr; | |
| 1530 | + int bar; | |
| 1531 | 1531 | |
| 1532 | 1532 | dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ); |
| 1533 | 1533 | if (!(NVME_CMB_SZ(dev->cmbsz))) |
| @@ -1540,7 +1540,8 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev) · 6 unmodified lines | ||
| 1540 | 1540 | szu = (u64)1 << (12 + 4 * NVME_CMB_SZU(dev->cmbsz)); |
| 1541 | 1541 | size = szu * NVME_CMB_SZ(dev->cmbsz); |
| 1542 | 1542 | offset = szu * NVME_CMB_OFST(dev->cmbloc); |
| 1543 | − bar_size = pci_resource_len(pdev, NVME_CMB_BIR(dev->cmbloc)); | |
| 1543 | + bar = NVME_CMB_BIR(dev->cmbloc); | |
| 1544 | + bar_size = pci_resource_len(pdev, bar); | |
| 1544 | 1545 | |
| 1545 | 1546 | if (offset > bar_size) |
| 1546 | 1547 | return NULL; |
| @@ -1553,12 +1554,11 @@ static void __iomem *nvme_map_cmb(struct nvme_dev *dev) · 6 unmodified lines | ||
| 1553 | 1554 | if (size > bar_size - offset) |
| 1554 | 1555 | size = bar_size - offset; |
| 1555 | 1556 | |
| 1556 | − dma_addr = pci_resource_start(pdev, NVME_CMB_BIR(dev->cmbloc)) + offset; | |
| 1557 | − cmb = ioremap_wc(dma_addr, size); | |
| 1557 | + cmb = ioremap_wc(pci_resource_start(pdev, bar) + offset, size); | |
| 1558 | 1558 | if (!cmb) |
| 1559 | 1559 | return NULL; |
| 1560 | 1560 | |
| 1561 | − dev->cmb_dma_addr = dma_addr; | |
| 1561 | + dev->cmb_bus_addr = pci_bus_address(pdev, bar) + offset; | |
| 1562 | 1562 | dev->cmb_size = size; |
| 1563 | 1563 | return cmb; |
| 1564 | 1564 | } |
| @@ -3767,7 +3767,7 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd) · 3766 unmodified lines | ||
| 3767 | 3767 | */ |
| 3768 | 3768 | if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) { |
| 3769 | 3769 | pr_err("write_pending failed since: %d\n", vscsi->flags); |
| 3770 | − return 0; | |
| 3770 | + return -EIO; | |
| 3771 | 3771 | } |
| 3772 | 3772 | |
| 3773 | 3773 | rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, |
| @@ -2851,9 +2851,6 @@ EXPORT_SYMBOL_GPL(iscsi_session_setup); · 2850 unmodified lines | ||
| 2851 | 2851 | /** |
| 2852 | 2852 | * iscsi_session_teardown - destroy session, host, and cls_session |
| 2853 | 2853 | * @cls_session: iscsi session |
| 2854 | − * | |
| 2855 | − * The driver must have called iscsi_remove_session before | |
| 2856 | − * calling this. | |
| 2857 | 2854 | */ |
| 2858 | 2855 | void iscsi_session_teardown(struct iscsi_cls_session *cls_session) |
| 2859 | 2856 | { |
| @@ -2863,6 +2860,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) · 3 unmodified lines | ||
| 2863 | 2860 | |
| 2864 | 2861 | iscsi_pool_free(&session->cmdpool); |
| 2865 | 2862 | |
| 2863 | + iscsi_remove_session(cls_session); | |
| 2864 | + | |
| 2866 | 2865 | kfree(session->password); |
| 2867 | 2866 | kfree(session->password_in); |
| 2868 | 2867 | kfree(session->username); |
| @@ -2877,7 +2876,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) · 8 unmodified lines | ||
| 2877 | 2876 | kfree(session->portal_type); |
| 2878 | 2877 | kfree(session->discovery_parent_type); |
| 2879 | 2878 | |
| 2880 | − iscsi_destroy_session(cls_session); | |
| 2879 | + iscsi_free_session(cls_session); | |
| 2880 | + | |
| 2881 | 2881 | iscsi_host_dec_session_cnt(shost); |
| 2882 | 2882 | module_put(owner); |
| 2883 | 2883 | } |
| @@ -956,6 +956,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, · 955 unmodified lines | ||
| 956 | 956 | if (*bflags & BLIST_NO_DIF) |
| 957 | 957 | sdev->no_dif = 1; |
| 958 | 958 | |
| 959 | + if (*bflags & BLIST_UNMAP_LIMIT_WS) | |
| 960 | + sdev->unmap_limit_for_ws = 1; | |
| 961 | + | |
| 959 | 962 | sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; |
| 960 | 963 | |
| 961 | 964 | if (*bflags & BLIST_TRY_VPD_PAGES) |
| @@ -2210,22 +2210,6 @@ void iscsi_free_session(struct iscsi_cls_session *session) · 2209 unmodified lines | ||
| 2210 | 2210 | } |
| 2211 | 2211 | EXPORT_SYMBOL_GPL(iscsi_free_session); |
| 2212 | 2212 | |
| 2213 | −/** | |
| 2214 | − * iscsi_destroy_session - destroy iscsi session | |
| 2215 | − * @session: iscsi_session | |
| 2216 | − * | |
| 2217 | − * Can be called by a LLD or iscsi_transport. There must not be | |
| 2218 | − * any running connections. | |
| 2219 | − */ | |
| 2220 | −int iscsi_destroy_session(struct iscsi_cls_session *session) | |
| 2221 | −{ | |
| 2222 | − iscsi_remove_session(session); | |
| 2223 | − ISCSI_DBG_TRANS_SESSION(session, "Completing session destruction\n"); | |
| 2224 | − iscsi_free_session(session); | |
| 2225 | − return 0; | |
| 2226 | −} | |
| 2227 | −EXPORT_SYMBOL_GPL(iscsi_destroy_session); | |
| 2228 | − | |
| 2229 | 2213 | /** |
| 2230 | 2214 | * iscsi_create_conn - create iscsi class connection |
| 2231 | 2215 | * @session: iscsi cls session |
| @@ -715,13 +715,21 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) · 714 unmodified lines | ||
| 715 | 715 | break; |
| 716 | 716 | |
| 717 | 717 | case SD_LBP_WS16: |
| 718 | − max_blocks = min_not_zero(sdkp->max_ws_blocks, | |
| 719 | − (u32)SD_MAX_WS16_BLOCKS); | |
| 718 | + if (sdkp->device->unmap_limit_for_ws) | |
| 719 | + max_blocks = sdkp->max_unmap_blocks; | |
| 720 | + else | |
| 721 | + max_blocks = sdkp->max_ws_blocks; | |
| 722 | + | |
| 723 | + max_blocks = min_not_zero(max_blocks, (u32)SD_MAX_WS16_BLOCKS); | |
| 720 | 724 | break; |
| 721 | 725 | |
| 722 | 726 | case SD_LBP_WS10: |
| 723 | − max_blocks = min_not_zero(sdkp->max_ws_blocks, | |
| 724 | − (u32)SD_MAX_WS10_BLOCKS); | |
| 727 | + if (sdkp->device->unmap_limit_for_ws) | |
| 728 | + max_blocks = sdkp->max_unmap_blocks; | |
| 729 | + else | |
| 730 | + max_blocks = sdkp->max_ws_blocks; | |
| 731 | + | |
| 732 | + max_blocks = min_not_zero(max_blocks, (u32)SD_MAX_WS10_BLOCKS); | |
| 725 | 733 | break; |
| 726 | 734 | |
| 727 | 735 | case SD_LBP_ZERO: |
| @@ -3099,8 +3107,6 @@ static int sd_revalidate_disk(struct gendisk *disk) · 2371 unmodified lines | ||
| 3099 | 3107 | sd_read_security(sdkp, buffer); |
| 3100 | 3108 | } |
| 3101 | 3109 | |
| 3102 | − sdkp->first_scan = 0; | |
| 3103 | − | |
| 3104 | 3110 | /* |
| 3105 | 3111 | * We now have all cache related info, determine how we deal |
| 3106 | 3112 | * with flush requests. |
| @@ -3115,7 +3121,7 @@ static int sd_revalidate_disk(struct gendisk *disk) · 8 unmodified lines | ||
| 3115 | 3121 | q->limits.max_dev_sectors = logical_to_sectors(sdp, dev_max); |
| 3116 | 3122 | |
| 3117 | 3123 | /* |
| 3118 | − * Use the device's preferred I/O size for reads and writes | |
| 3124 | + * Determine the device's preferred I/O size for reads and writes | |
| 3119 | 3125 | * unless the reported value is unreasonably small, large, or |
| 3120 | 3126 | * garbage. |
| 3121 | 3127 | */ |
| @@ -3129,8 +3135,19 @@ static int sd_revalidate_disk(struct gendisk *disk) · 7 unmodified lines | ||
| 3129 | 3135 | rw_max = min_not_zero(logical_to_sectors(sdp, dev_max), |
| 3130 | 3136 | (sector_t)BLK_DEF_MAX_SECTORS); |
| 3131 | 3137 | |
| 3132 | − /* Combine with controller limits */ | |
| 3133 | − q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); | |
| 3138 | + /* Do not exceed controller limit */ | |
| 3139 | + rw_max = min(rw_max, queue_max_hw_sectors(q)); | |
| 3140 | + | |
| 3141 | + /* | |
| 3142 | + * Only update max_sectors if previously unset or if the current value | |
| 3143 | + * exceeds the capabilities of the hardware. | |
| 3144 | + */ | |
| 3145 | + if (sdkp->first_scan || | |
| 3146 | + q->limits.max_sectors > q->limits.max_dev_sectors || | |
| 3147 | + q->limits.max_sectors > q->limits.max_hw_sectors) | |
| 3148 | + q->limits.max_sectors = rw_max; | |
| 3149 | + | |
| 3150 | + sdkp->first_scan = 0; | |
| 3134 | 3151 | |
| 3135 | 3152 | set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity)); |
| 3136 | 3153 | sd_config_write_same(sdkp); |
| @@ -722,7 +722,7 @@ struct btrfs_delayed_root; · 721 unmodified lines | ||
| 722 | 722 | * Indicate that a whole-filesystem exclusive operation is running |
| 723 | 723 | * (device replace, resize, device add/delete, balance) |
| 724 | 724 | */ |
| 725 | −#define BTRFS_FS_EXCL_OP 14 | |
| 725 | +#define BTRFS_FS_EXCL_OP 16 | |
| 726 | 726 | |
| 727 | 727 | struct btrfs_fs_info { |
| 728 | 728 | u8 fsid[BTRFS_FSID_SIZE]; |
| @@ -2801,7 +2801,7 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, · 2800 unmodified lines | ||
| 2801 | 2801 | } |
| 2802 | 2802 | } |
| 2803 | 2803 | |
| 2804 | − bio = btrfs_bio_alloc(bdev, sector << 9); | |
| 2804 | + bio = btrfs_bio_alloc(bdev, (u64)sector << 9); | |
| 2805 | 2805 | bio_add_page(bio, page, page_size, offset); |
| 2806 | 2806 | bio->bi_end_io = end_io_func; |
| 2807 | 2807 | bio->bi_private = tree; |
| @@ -734,12 +734,13 @@ static int __choose_mds(struct ceph_mds_client *mdsc, · 733 unmodified lines | ||
| 734 | 734 | inode = req->r_inode; |
| 735 | 735 | ihold(inode); |
| 736 | 736 | } else { |
| 737 | − /* req->r_dentry is non-null for LSSNAP request. | |
| 738 | − * fall-thru */ | |
| 739 | − WARN_ON_ONCE(!req->r_dentry); | |
| 737 | + /* req->r_dentry is non-null for LSSNAP request */ | |
| 738 | + rcu_read_lock(); | |
| 739 | + inode = get_nonsnap_parent(req->r_dentry); | |
| 740 | + rcu_read_unlock(); | |
| 741 | + dout("__choose_mds using snapdir's parent %p\n", inode); | |
| 740 | 742 | } |
| 741 | − } | |
| 742 | − if (!inode && req->r_dentry) { | |
| 743 | + } else if (req->r_dentry) { | |
| 743 | 744 | /* ignore race with rename; old or new d_parent is okay */ |
| 744 | 745 | struct dentry *parent; |
| 745 | 746 | struct inode *dir; |
| @@ -374,12 +374,10 @@ static int build_snap_context(struct ceph_snap_realm *realm, · 373 unmodified lines | ||
| 374 | 374 | realm->ino, realm, snapc, snapc->seq, |
| 375 | 375 | (unsigned int) snapc->num_snaps); |
| 376 | 376 | |
| 377 | − if (realm->cached_context) { | |
| 378 | − ceph_put_snap_context(realm->cached_context); | |
| 379 | − /* queue realm for cap_snap creation */ | |
| 380 | − list_add_tail(&realm->dirty_item, dirty_realms); | |
| 381 | − } | |
| 377 | + ceph_put_snap_context(realm->cached_context); | |
| 382 | 378 | realm->cached_context = snapc; |
| 379 | + /* queue realm for cap_snap creation */ | |
| 380 | + list_add_tail(&realm->dirty_item, dirty_realms); | |
| 383 | 381 | return 0; |
| 384 | 382 | |
| 385 | 383 | fail: |
| @@ -468,7 +468,9 @@ static inline int may_write_real(struct file *file) · 467 unmodified lines | ||
| 468 | 468 | |
| 469 | 469 | /* File refers to upper, writable layer? */ |
| 470 | 470 | upperdentry = d_real(dentry, NULL, 0, D_REAL_UPPER); |
| 471 | − if (upperdentry && file_inode(file) == d_inode(upperdentry)) | |
| 471 | + if (upperdentry && | |
| 472 | + (file_inode(file) == d_inode(upperdentry) || | |
| 473 | + file_inode(file) == d_inode(dentry))) | |
| 472 | 474 | return 0; |
| 473 | 475 | |
| 474 | 476 | /* Lower layer: can't write to real file, sorry... */ |
| @@ -218,7 +218,6 @@ static void nfs_cb_idr_remove_locked(struct nfs_client *clp) · 217 unmodified lines | ||
| 218 | 218 | static void pnfs_init_server(struct nfs_server *server) |
| 219 | 219 | { |
| 220 | 220 | rpc_init_wait_queue(&server->roc_rpcwaitq, "pNFS ROC"); |
| 221 | − rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC"); | |
| 222 | 221 | } |
| 223 | 222 | |
| 224 | 223 | #else |
| @@ -888,6 +887,7 @@ struct nfs_server *nfs_alloc_server(void) · 663 unmodified lines | ||
| 888 | 887 | ida_init(&server->openowner_id); |
| 889 | 888 | ida_init(&server->lockowner_id); |
| 890 | 889 | pnfs_init_server(server); |
| 890 | + rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC"); | |
| 891 | 891 | |
| 892 | 892 | return server; |
| 893 | 893 | } |
| @@ -745,7 +745,8 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg) · 744 unmodified lines | ||
| 745 | 745 | struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg); |
| 746 | 746 | |
| 747 | 747 | dprintk("--> %s\n", __func__); |
| 748 | − nfs4_fl_put_deviceid(fl->dsaddr); | |
| 748 | + if (fl->dsaddr != NULL) | |
| 749 | + nfs4_fl_put_deviceid(fl->dsaddr); | |
| 749 | 750 | /* This assumes a single RW lseg */ |
| 750 | 751 | if (lseg->pls_range.iomode == IOMODE_RW) { |
| 751 | 752 | struct nfs4_filelayout *flo; |
| @@ -274,7 +274,7 @@ static struct key *nfs_idmap_request_key(const char *name, size_t namelen, · 273 unmodified lines | ||
| 274 | 274 | ssize_t ret; |
| 275 | 275 | |
| 276 | 276 | ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc); |
| 277 | − if (ret <= 0) | |
| 277 | + if (ret < 0) | |
| 278 | 278 | return ERR_PTR(ret); |
| 279 | 279 | |
| 280 | 280 | rkey = request_key(&key_type_id_resolver, desc, ""); |
| @@ -8399,8 +8399,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task, · 8398 unmodified lines | ||
| 8399 | 8399 | lo = NFS_I(inode)->layout; |
| 8400 | 8400 | /* If the open stateid was bad, then recover it. */ |
| 8401 | 8401 | if (!lo || test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags) || |
| 8402 | − nfs4_stateid_match_other(&lgp->args.stateid, | |
| 8403 | − &lgp->args.ctx->state->stateid)) { | |
| 8402 | + !nfs4_stateid_match_other(&lgp->args.stateid, &lo->plh_stateid)) { | |
| 8404 | 8403 | spin_unlock(&inode->i_lock); |
| 8405 | 8404 | exception->state = lgp->args.ctx->state; |
| 8406 | 8405 | exception->stateid = &lgp->args.stateid; |
| @@ -1842,8 +1842,8 @@ static void encode_create_session(struct xdr_stream *xdr, · 1841 unmodified lines | ||
| 1842 | 1842 | * Assumes OPEN is the biggest non-idempotent compound. |
| 1843 | 1843 | * 2 is the verifier. |
| 1844 | 1844 | */ |
| 1845 | − max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + | |
| 1846 | − RPC_MAX_AUTH_SIZE + 2) * XDR_UNIT; | |
| 1845 | + max_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + 2) | |
| 1846 | + * XDR_UNIT + RPC_MAX_AUTH_SIZE; | |
| 1847 | 1847 | |
| 1848 | 1848 | encode_op_hdr(xdr, OP_CREATE_SESSION, decode_create_session_maxsz, hdr); |
| 1849 | 1849 | p = reserve_space(xdr, 16 + 2*28 + 20 + clnt->cl_nodelen + 12); |
| @@ -561,10 +561,8 @@ static int ovl_do_copy_up(struct ovl_copy_up_ctx *c) · 560 unmodified lines | ||
| 561 | 561 | c->tmpfile = true; |
| 562 | 562 | err = ovl_copy_up_locked(c); |
| 563 | 563 | } else { |
| 564 | − err = -EIO; | |
| 565 | − if (lock_rename(c->workdir, c->destdir) != NULL) { | |
| 566 | − pr_err("overlayfs: failed to lock workdir+upperdir\n"); | |
| 567 | − } else { | |
| 564 | + err = ovl_lock_rename_workdir(c->workdir, c->destdir); | |
| 565 | + if (!err) { | |
| 568 | 566 | err = ovl_copy_up_locked(c); |
| 569 | 567 | unlock_rename(c->workdir, c->destdir); |
| 570 | 568 | } |
| @@ -216,26 +216,6 @@ out_unlock: · 215 unmodified lines | ||
| 216 | 216 | return err; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | −static int ovl_lock_rename_workdir(struct dentry *workdir, | |
| 220 | − struct dentry *upperdir) | |
| 221 | −{ | |
| 222 | − /* Workdir should not be the same as upperdir */ | |
| 223 | − if (workdir == upperdir) | |
| 224 | − goto err; | |
| 225 | − | |
| 226 | − /* Workdir should not be subdir of upperdir and vice versa */ | |
| 227 | − if (lock_rename(workdir, upperdir) != NULL) | |
| 228 | − goto err_unlock; | |
| 229 | − | |
| 230 | − return 0; | |
| 231 | − | |
| 232 | −err_unlock: | |
| 233 | − unlock_rename(workdir, upperdir); | |
| 234 | −err: | |
| 235 | − pr_err("overlayfs: failed to lock workdir+upperdir\n"); | |
| 236 | − return -EIO; | |
| 237 | −} | |
| 238 | − | |
| 239 | 219 | static struct dentry *ovl_clear_empty(struct dentry *dentry, |
| 240 | 220 | struct list_head *list) |
| 241 | 221 | { |
| @@ -506,6 +506,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry, · 505 unmodified lines | ||
| 506 | 506 | |
| 507 | 507 | index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len); |
| 508 | 508 | if (IS_ERR(index)) { |
| 509 | + err = PTR_ERR(index); | |
| 509 | 510 | pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" |
| 510 | 511 | "overlayfs: mount with '-o index=off' to disable inodes index.\n", |
| 511 | 512 | d_inode(origin)->i_ino, name.len, name.name, |
| @@ -235,6 +235,7 @@ bool ovl_inuse_trylock(struct dentry *dentry); · 234 unmodified lines | ||
| 235 | 235 | void ovl_inuse_unlock(struct dentry *dentry); |
| 236 | 236 | int ovl_nlink_start(struct dentry *dentry, bool *locked); |
| 237 | 237 | void ovl_nlink_end(struct dentry *dentry, bool locked); |
| 238 | +int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir); | |
| 238 | 239 | |
| 239 | 240 | static inline bool ovl_is_impuredir(struct dentry *dentry) |
| 240 | 241 | { |
| @@ -37,6 +37,9 @@ struct ovl_fs { · 36 unmodified lines | ||
| 37 | 37 | bool noxattr; |
| 38 | 38 | /* sb common to all layers */ |
| 39 | 39 | struct super_block *same_sb; |
| 40 | + /* Did we take the inuse lock? */ | |
| 41 | + bool upperdir_locked; | |
| 42 | + bool workdir_locked; | |
| 40 | 43 | }; |
| 41 | 44 | |
| 42 | 45 | /* private information held for every overlayfs dentry */ |
| @@ -988,6 +988,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 987 unmodified lines | ||
| 988 | 988 | struct path *lowerstack, unsigned int numlower) |
| 989 | 989 | { |
| 990 | 990 | int err; |
| 991 | + struct dentry *index = NULL; | |
| 991 | 992 | struct inode *dir = dentry->d_inode; |
| 992 | 993 | struct path path = { .mnt = mnt, .dentry = dentry }; |
| 993 | 994 | LIST_HEAD(list); |
| @@ -1007,8 +1008,6 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 13 unmodified lines | ||
| 1007 | 1008 | |
| 1008 | 1009 | inode_lock_nested(dir, I_MUTEX_PARENT); |
| 1009 | 1010 | list_for_each_entry(p, &list, l_node) { |
| 1010 | − struct dentry *index; | |
| 1011 | − | |
| 1012 | 1011 | if (p->name[0] == '.') { |
| 1013 | 1012 | if (p->len == 1) |
| 1014 | 1013 | continue; |
| @@ -1018,6 +1017,7 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 3 unmodified lines | ||
| 1018 | 1017 | index = lookup_one_len(p->name, dentry, p->len); |
| 1019 | 1018 | if (IS_ERR(index)) { |
| 1020 | 1019 | err = PTR_ERR(index); |
| 1020 | + index = NULL; | |
| 1021 | 1021 | break; |
| 1022 | 1022 | } |
| 1023 | 1023 | err = ovl_verify_index(index, lowerstack, numlower); |
| @@ -1029,7 +1029,9 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, · 5 unmodified lines | ||
| 1029 | 1029 | break; |
| 1030 | 1030 | } |
| 1031 | 1031 | dput(index); |
| 1032 | + index = NULL; | |
| 1032 | 1033 | } |
| 1034 | + dput(index); | |
| 1033 | 1035 | inode_unlock(dir); |
| 1034 | 1036 | out: |
| 1035 | 1037 | ovl_cache_free(&list); |
| @@ -211,9 +211,10 @@ static void ovl_put_super(struct super_block *sb) · 210 unmodified lines | ||
| 211 | 211 | |
| 212 | 212 | dput(ufs->indexdir); |
| 213 | 213 | dput(ufs->workdir); |
| 214 | − ovl_inuse_unlock(ufs->workbasedir); | |
| 214 | + if (ufs->workdir_locked) | |
| 215 | + ovl_inuse_unlock(ufs->workbasedir); | |
| 215 | 216 | dput(ufs->workbasedir); |
| 216 | − if (ufs->upper_mnt) | |
| 217 | + if (ufs->upper_mnt && ufs->upperdir_locked) | |
| 217 | 218 | ovl_inuse_unlock(ufs->upper_mnt->mnt_root); |
| 218 | 219 | mntput(ufs->upper_mnt); |
| 219 | 220 | for (i = 0; i < ufs->numlower; i++) |
| @@ -881,9 +882,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) · 661 unmodified lines | ||
| 881 | 882 | goto out_put_upperpath; |
| 882 | 883 | |
| 883 | 884 | err = -EBUSY; |
| 884 | − if (!ovl_inuse_trylock(upperpath.dentry)) { | |
| 885 | − pr_err("overlayfs: upperdir is in-use by another mount\n"); | |
| 885 | + if (ovl_inuse_trylock(upperpath.dentry)) { | |
| 886 | + ufs->upperdir_locked = true; | |
| 887 | + } else if (ufs->config.index) { | |
| 888 | + pr_err("overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.\n"); | |
| 886 | 889 | goto out_put_upperpath; |
| 890 | + } else { | |
| 891 | + pr_warn("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n"); | |
| 887 | 892 | } |
| 888 | 893 | |
| 889 | 894 | err = ovl_mount_dir(ufs->config.workdir, &workpath); |
| @@ -901,9 +906,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) · 11 unmodified lines | ||
| 901 | 906 | } |
| 902 | 907 | |
| 903 | 908 | err = -EBUSY; |
| 904 | − if (!ovl_inuse_trylock(workpath.dentry)) { | |
| 905 | − pr_err("overlayfs: workdir is in-use by another mount\n"); | |
| 909 | + if (ovl_inuse_trylock(workpath.dentry)) { | |
| 910 | + ufs->workdir_locked = true; | |
| 911 | + } else if (ufs->config.index) { | |
| 912 | + pr_err("overlayfs: workdir is in-use by another mount, mount with '-o index=off' to override exclusive workdir protection.\n"); | |
| 906 | 913 | goto out_put_workpath; |
| 914 | + } else { | |
| 915 | + pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n"); | |
| 907 | 916 | } |
| 908 | 917 | |
| 909 | 918 | ufs->workbasedir = workpath.dentry; |
| @@ -1156,11 +1165,13 @@ out_put_lowerpath: · 246 unmodified lines | ||
| 1156 | 1165 | out_free_lowertmp: |
| 1157 | 1166 | kfree(lowertmp); |
| 1158 | 1167 | out_unlock_workdentry: |
| 1159 | − ovl_inuse_unlock(workpath.dentry); | |
| 1168 | + if (ufs->workdir_locked) | |
| 1169 | + ovl_inuse_unlock(workpath.dentry); | |
| 1160 | 1170 | out_put_workpath: |
| 1161 | 1171 | path_put(&workpath); |
| 1162 | 1172 | out_unlock_upperdentry: |
| 1163 | − ovl_inuse_unlock(upperpath.dentry); | |
| 1173 | + if (ufs->upperdir_locked) | |
| 1174 | + ovl_inuse_unlock(upperpath.dentry); | |
| 1164 | 1175 | out_put_upperpath: |
| 1165 | 1176 | path_put(&upperpath); |
| 1166 | 1177 | out_free_config: |
| @@ -430,7 +430,7 @@ void ovl_inuse_unlock(struct dentry *dentry) · 429 unmodified lines | ||
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | −/* Called must hold OVL_I(inode)->oi_lock */ | |
| 433 | +/* Caller must hold OVL_I(inode)->lock */ | |
| 434 | 434 | static void ovl_cleanup_index(struct dentry *dentry) |
| 435 | 435 | { |
| 436 | 436 | struct inode *dir = ovl_indexdir(dentry->d_sb)->d_inode; |
| @@ -469,6 +469,9 @@ static void ovl_cleanup_index(struct dentry *dentry) · 32 unmodified lines | ||
| 469 | 469 | err = PTR_ERR(index); |
| 470 | 470 | if (!IS_ERR(index)) |
| 471 | 471 | err = ovl_cleanup(dir, index); |
| 472 | + else | |
| 473 | + index = NULL; | |
| 474 | + | |
| 472 | 475 | inode_unlock(dir); |
| 473 | 476 | if (err) |
| 474 | 477 | goto fail; |
| @@ -557,3 +560,22 @@ void ovl_nlink_end(struct dentry *dentry, bool locked) · 82 unmodified lines | ||
| 557 | 560 | mutex_unlock(&OVL_I(d_inode(dentry))->lock); |
| 558 | 561 | } |
| 559 | 562 | } |
| 563 | + | |
| 564 | +int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir) | |
| 565 | +{ | |
| 566 | + /* Workdir should not be the same as upperdir */ | |
| 567 | + if (workdir == upperdir) | |
| 568 | + goto err; | |
| 569 | + | |
| 570 | + /* Workdir should not be subdir of upperdir and vice versa */ | |
| 571 | + if (lock_rename(workdir, upperdir) != NULL) | |
| 572 | + goto err_unlock; | |
| 573 | + | |
| 574 | + return 0; | |
| 575 | + | |
| 576 | +err_unlock: | |
| 577 | + unlock_rename(workdir, upperdir); | |
| 578 | +err: | |
| 579 | + pr_err("overlayfs: failed to lock workdir+upperdir\n"); | |
| 580 | + return -EIO; | |
| 581 | +} | |
| @@ -2122,11 +2122,31 @@ xfs_swap_extents( · 2121 unmodified lines | ||
| 2122 | 2122 | ip->i_d.di_flags2 |= tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK; |
| 2123 | 2123 | tip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK; |
| 2124 | 2124 | tip->i_d.di_flags2 |= f & XFS_DIFLAG2_REFLINK; |
| 2125 | + } | |
| 2126 | + | |
| 2127 | + /* Swap the cow forks. */ | |
| 2128 | + if (xfs_sb_version_hasreflink(&mp->m_sb)) { | |
| 2129 | + xfs_extnum_t extnum; | |
| 2130 | + | |
| 2131 | + ASSERT(ip->i_cformat == XFS_DINODE_FMT_EXTENTS); | |
| 2132 | + ASSERT(tip->i_cformat == XFS_DINODE_FMT_EXTENTS); | |
| 2133 | + | |
| 2134 | + extnum = ip->i_cnextents; | |
| 2135 | + ip->i_cnextents = tip->i_cnextents; | |
| 2136 | + tip->i_cnextents = extnum; | |
| 2137 | + | |
| 2125 | 2138 | cowfp = ip->i_cowfp; |
| 2126 | 2139 | ip->i_cowfp = tip->i_cowfp; |
| 2127 | 2140 | tip->i_cowfp = cowfp; |
| 2128 | − xfs_inode_set_cowblocks_tag(ip); | |
| 2129 | − xfs_inode_set_cowblocks_tag(tip); | |
| 2141 | + | |
| 2142 | + if (ip->i_cowfp && ip->i_cnextents) | |
| 2143 | + xfs_inode_set_cowblocks_tag(ip); | |
| 2144 | + else | |
| 2145 | + xfs_inode_clear_cowblocks_tag(ip); | |
| 2146 | + if (tip->i_cowfp && tip->i_cnextents) | |
| 2147 | + xfs_inode_set_cowblocks_tag(tip); | |
| 2148 | + else | |
| 2149 | + xfs_inode_clear_cowblocks_tag(tip); | |
| 2130 | 2150 | } |
| 2131 | 2151 | |
| 2132 | 2152 | xfs_trans_log_inode(tp, ip, src_log_flags); |
| @@ -736,7 +736,13 @@ xfs_reflink_end_cow( · 735 unmodified lines | ||
| 736 | 736 | /* If there is a hole at end_fsb - 1 go to the previous extent */ |
| 737 | 737 | if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) || |
| 738 | 738 | got.br_startoff > end_fsb) { |
| 739 | − ASSERT(idx > 0); | |
| 739 | + /* | |
| 740 | + * In case of racing, overlapping AIO writes no COW extents | |
| 741 | + * might be left by the time I/O completes for the loser of | |
| 742 | + * the race. In that case we are done. | |
| 743 | + */ | |
| 744 | + if (idx <= 0) | |
| 745 | + goto out_cancel; | |
| 740 | 746 | xfs_iext_get_extent(ifp, --idx, &got); |
| 741 | 747 | } |
| 742 | 748 | |
| @@ -809,6 +815,7 @@ next_extent: · 66 unmodified lines | ||
| 809 | 815 | |
| 810 | 816 | out_defer: |
| 811 | 817 | xfs_defer_cancel(&dfops); |
| 818 | +out_cancel: | |
| 812 | 819 | xfs_trans_cancel(tp); |
| 813 | 820 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
| 814 | 821 | out: |
| @@ -407,6 +407,11 @@ static inline void __bpf_prog_uncharge(struct user_struct *user, u32 pages) · 406 unmodified lines | ||
| 407 | 407 | { |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | +static inline int bpf_obj_get_user(const char __user *pathname) | |
| 411 | +{ | |
| 412 | + return -EOPNOTSUPP; | |
| 413 | +} | |
| 414 | + | |
| 410 | 415 | static inline struct net_device *__dev_map_lookup_elem(struct bpf_map *map, |
| 411 | 416 | u32 key) |
| 412 | 417 | { |
| @@ -316,7 +316,7 @@ struct mmc_host { · 315 unmodified lines | ||
| 316 | 316 | #define MMC_CAP_UHS_SDR50 (1 << 18) /* Host supports UHS SDR50 mode */ |
| 317 | 317 | #define MMC_CAP_UHS_SDR104 (1 << 19) /* Host supports UHS SDR104 mode */ |
| 318 | 318 | #define MMC_CAP_UHS_DDR50 (1 << 20) /* Host supports UHS DDR50 mode */ |
| 319 | −#define MMC_CAP_NO_BOUNCE_BUFF (1 << 21) /* Disable bounce buffers on host */ | |
| 319 | +/* (1 << 21) is free for reuse */ | |
| 320 | 320 | #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ |
| 321 | 321 | #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ |
| 322 | 322 | #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ |
| @@ -108,9 +108,10 @@ struct ebt_table { · 107 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | #define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \ |
| 110 | 110 | ~(__alignof__(struct _xt_align)-1)) |
| 111 | −extern struct ebt_table *ebt_register_table(struct net *net, | |
| 112 | − const struct ebt_table *table, | |
| 113 | − const struct nf_hook_ops *); | |
| 111 | +extern int ebt_register_table(struct net *net, | |
| 112 | + const struct ebt_table *table, | |
| 113 | + const struct nf_hook_ops *ops, | |
| 114 | + struct ebt_table **res); | |
| 114 | 115 | extern void ebt_unregister_table(struct net *net, struct ebt_table *table, |
| 115 | 116 | const struct nf_hook_ops *); |
| 116 | 117 | extern unsigned int ebt_do_table(struct sk_buff *skb, |
| @@ -12,11 +12,31 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #ifdef CONFIG_LOCKUP_DETECTOR |
| 14 | 14 | void lockup_detector_init(void); |
| 15 | +void lockup_detector_soft_poweroff(void); | |
| 16 | +void lockup_detector_cleanup(void); | |
| 17 | +bool is_hardlockup(void); | |
| 18 | + | |
| 19 | +extern int watchdog_user_enabled; | |
| 20 | +extern int nmi_watchdog_user_enabled; | |
| 21 | +extern int soft_watchdog_user_enabled; | |
| 22 | +extern int watchdog_thresh; | |
| 23 | +extern unsigned long watchdog_enabled; | |
| 24 | + | |
| 25 | +extern struct cpumask watchdog_cpumask; | |
| 26 | +extern unsigned long *watchdog_cpumask_bits; | |
| 27 | +#ifdef CONFIG_SMP | |
| 28 | +extern int sysctl_softlockup_all_cpu_backtrace; | |
| 29 | +extern int sysctl_hardlockup_all_cpu_backtrace; | |
| 15 | 30 | #else |
| 16 | −static inline void lockup_detector_init(void) | |
| 17 | −{ | |
| 18 | −} | |
| 19 | −#endif | |
| 31 | +#define sysctl_softlockup_all_cpu_backtrace 0 | |
| 32 | +#define sysctl_hardlockup_all_cpu_backtrace 0 | |
| 33 | +#endif /* !CONFIG_SMP */ | |
| 34 | + | |
| 35 | +#else /* CONFIG_LOCKUP_DETECTOR */ | |
| 36 | +static inline void lockup_detector_init(void) { } | |
| 37 | +static inline void lockup_detector_soft_poweroff(void) { } | |
| 38 | +static inline void lockup_detector_cleanup(void) { } | |
| 39 | +#endif /* !CONFIG_LOCKUP_DETECTOR */ | |
| 20 | 40 | |
| 21 | 41 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR |
| 22 | 42 | extern void touch_softlockup_watchdog_sched(void); |
| @@ -24,29 +44,17 @@ extern void touch_softlockup_watchdog(void); · 1 unmodified line | ||
| 24 | 44 | extern void touch_softlockup_watchdog_sync(void); |
| 25 | 45 | extern void touch_all_softlockup_watchdogs(void); |
| 26 | 46 | extern unsigned int softlockup_panic; |
| 27 | −extern int soft_watchdog_enabled; | |
| 28 | −extern atomic_t watchdog_park_in_progress; | |
| 29 | 47 | #else |
| 30 | −static inline void touch_softlockup_watchdog_sched(void) | |
| 31 | −{ | |
| 32 | −} | |
| 33 | −static inline void touch_softlockup_watchdog(void) | |
| 34 | −{ | |
| 35 | −} | |
| 36 | −static inline void touch_softlockup_watchdog_sync(void) | |
| 37 | −{ | |
| 38 | −} | |
| 39 | −static inline void touch_all_softlockup_watchdogs(void) | |
| 40 | −{ | |
| 41 | −} | |
| 48 | +static inline void touch_softlockup_watchdog_sched(void) { } | |
| 49 | +static inline void touch_softlockup_watchdog(void) { } | |
| 50 | +static inline void touch_softlockup_watchdog_sync(void) { } | |
| 51 | +static inline void touch_all_softlockup_watchdogs(void) { } | |
| 42 | 52 | #endif |
| 43 | 53 | |
| 44 | 54 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 45 | 55 | void reset_hung_task_detector(void); |
| 46 | 56 | #else |
| 47 | −static inline void reset_hung_task_detector(void) | |
| 48 | −{ | |
| 49 | −} | |
| 57 | +static inline void reset_hung_task_detector(void) { } | |
| 50 | 58 | #endif |
| 51 | 59 | |
| 52 | 60 | /* |
| @@ -54,12 +62,12 @@ static inline void reset_hung_task_detector(void) · 1 unmodified line | ||
| 54 | 62 | * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit - |
| 55 | 63 | * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector. |
| 56 | 64 | * |
| 57 | − * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled' | |
| 58 | − * are variables that are only used as an 'interface' between the parameters | |
| 59 | − * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The | |
| 60 | − * 'watchdog_thresh' variable is handled differently because its value is not | |
| 61 | − * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh' | |
| 62 | − * is equal zero. | |
| 65 | + * 'watchdog_user_enabled', 'nmi_watchdog_user_enabled' and | |
| 66 | + * 'soft_watchdog_user_enabled' are variables that are only used as an | |
| 67 | + * 'interface' between the parameters in /proc/sys/kernel and the internal | |
| 68 | + * state bits in 'watchdog_enabled'. The 'watchdog_thresh' variable is | |
| 69 | + * handled differently because its value is not boolean, and the lockup | |
| 70 | + * detectors are 'suspended' while 'watchdog_thresh' is equal zero. | |
| 63 | 71 | */ |
| 64 | 72 | #define NMI_WATCHDOG_ENABLED_BIT 0 |
| 65 | 73 | #define SOFT_WATCHDOG_ENABLED_BIT 1 |
| @@ -73,17 +81,41 @@ extern unsigned int hardlockup_panic; · 7 unmodified lines | ||
| 73 | 81 | static inline void hardlockup_detector_disable(void) {} |
| 74 | 82 | #endif |
| 75 | 83 | |
| 84 | +#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) | |
| 85 | +# define NMI_WATCHDOG_SYSCTL_PERM 0644 | |
| 86 | +#else | |
| 87 | +# define NMI_WATCHDOG_SYSCTL_PERM 0444 | |
| 88 | +#endif | |
| 89 | + | |
| 76 | 90 | #if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF) |
| 77 | 91 | extern void arch_touch_nmi_watchdog(void); |
| 92 | +extern void hardlockup_detector_perf_stop(void); | |
| 93 | +extern void hardlockup_detector_perf_restart(void); | |
| 94 | +extern void hardlockup_detector_perf_disable(void); | |
| 95 | +extern void hardlockup_detector_perf_enable(void); | |
| 96 | +extern void hardlockup_detector_perf_cleanup(void); | |
| 97 | +extern int hardlockup_detector_perf_init(void); | |
| 78 | 98 | #else |
| 79 | −#if !defined(CONFIG_HAVE_NMI_WATCHDOG) | |
| 99 | +static inline void hardlockup_detector_perf_stop(void) { } | |
| 100 | +static inline void hardlockup_detector_perf_restart(void) { } | |
| 101 | +static inline void hardlockup_detector_perf_disable(void) { } | |
| 102 | +static inline void hardlockup_detector_perf_enable(void) { } | |
| 103 | +static inline void hardlockup_detector_perf_cleanup(void) { } | |
| 104 | +# if !defined(CONFIG_HAVE_NMI_WATCHDOG) | |
| 105 | +static inline int hardlockup_detector_perf_init(void) { return -ENODEV; } | |
| 80 | 106 | static inline void arch_touch_nmi_watchdog(void) {} |
| 107 | +# else | |
| 108 | +static inline int hardlockup_detector_perf_init(void) { return 0; } | |
| 109 | +# endif | |
| 81 | 110 | #endif |
| 82 | −#endif | |
| 111 | + | |
| 112 | +void watchdog_nmi_stop(void); | |
| 113 | +void watchdog_nmi_start(void); | |
| 114 | +int watchdog_nmi_probe(void); | |
| 83 | 115 | |
| 84 | 116 | /** |
| 85 | 117 | * touch_nmi_watchdog - restart NMI watchdog timeout. |
| 86 | − * | |
| 118 | + * | |
| 87 | 119 | * If the architecture supports the NMI watchdog, touch_nmi_watchdog() |
| 88 | 120 | * may be used to reset the timeout - for code which intentionally |
| 89 | 121 | * disables interrupts for a long time. This call is stateless. |
| @@ -153,22 +185,6 @@ static inline bool trigger_single_cpu_backtrace(int cpu) · 63 unmodified lines | ||
| 153 | 185 | u64 hw_nmi_get_sample_period(int watchdog_thresh); |
| 154 | 186 | #endif |
| 155 | 187 | |
| 156 | −#ifdef CONFIG_LOCKUP_DETECTOR | |
| 157 | −extern int nmi_watchdog_enabled; | |
| 158 | −extern int watchdog_user_enabled; | |
| 159 | −extern int watchdog_thresh; | |
| 160 | −extern unsigned long watchdog_enabled; | |
| 161 | −extern struct cpumask watchdog_cpumask; | |
| 162 | −extern unsigned long *watchdog_cpumask_bits; | |
| 163 | −extern int __read_mostly watchdog_suspended; | |
| 164 | −#ifdef CONFIG_SMP | |
| 165 | −extern int sysctl_softlockup_all_cpu_backtrace; | |
| 166 | −extern int sysctl_hardlockup_all_cpu_backtrace; | |
| 167 | −#else | |
| 168 | −#define sysctl_softlockup_all_cpu_backtrace 0 | |
| 169 | −#define sysctl_hardlockup_all_cpu_backtrace 0 | |
| 170 | −#endif | |
| 171 | − | |
| 172 | 188 | #if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \ |
| 173 | 189 | defined(CONFIG_HARDLOCKUP_DETECTOR) |
| 174 | 190 | void watchdog_update_hrtimer_threshold(u64 period); |
| @@ -176,7 +192,6 @@ void watchdog_update_hrtimer_threshold(u64 period); · 1 unmodified line | ||
| 176 | 192 | static inline void watchdog_update_hrtimer_threshold(u64 period) { } |
| 177 | 193 | #endif |
| 178 | 194 | |
| 179 | −extern bool is_hardlockup(void); | |
| 180 | 195 | struct ctl_table; |
| 181 | 196 | extern int proc_watchdog(struct ctl_table *, int , |
| 182 | 197 | void __user *, size_t *, loff_t *); |
| @@ -188,18 +203,6 @@ extern int proc_watchdog_thresh(struct ctl_table *, int , · 5 unmodified lines | ||
| 188 | 203 | void __user *, size_t *, loff_t *); |
| 189 | 204 | extern int proc_watchdog_cpumask(struct ctl_table *, int, |
| 190 | 205 | void __user *, size_t *, loff_t *); |
| 191 | −extern int lockup_detector_suspend(void); | |
| 192 | −extern void lockup_detector_resume(void); | |
| 193 | −#else | |
| 194 | −static inline int lockup_detector_suspend(void) | |
| 195 | −{ | |
| 196 | − return 0; | |
| 197 | −} | |
| 198 | − | |
| 199 | −static inline void lockup_detector_resume(void) | |
| 200 | −{ | |
| 201 | −} | |
| 202 | −#endif | |
| 203 | 206 | |
| 204 | 207 | #ifdef CONFIG_HAVE_ACPI_APEI_NMI |
| 205 | 208 | #include <asm/nmi.h> |
| @@ -55,7 +55,7 @@ smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) · 54 unmodified lines | ||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); |
| 58 | −int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, | |
| 59 | − const struct cpumask *); | |
| 58 | +void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, | |
| 59 | + const struct cpumask *); | |
| 60 | 60 | |
| 61 | 61 | #endif |
| @@ -192,6 +192,7 @@ struct scsi_device { · 191 unmodified lines | ||
| 192 | 192 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ |
| 193 | 193 | unsigned broken_fua:1; /* Don't set FUA bit */ |
| 194 | 194 | unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */ |
| 195 | + unsigned unmap_limit_for_ws:1; /* Use the UNMAP limit for WRITE SAME */ | |
| 195 | 196 | |
| 196 | 197 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ |
| 197 | 198 | |
| @@ -29,5 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | #define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ |
| 30 | 30 | #define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */ |
| 31 | 31 | #define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */ |
| 32 | +#define BLIST_UNMAP_LIMIT_WS 0x80000000 /* Use UNMAP limit for WRITE SAME */ | |
| 32 | 33 | |
| 33 | 34 | #endif |
| @@ -434,7 +434,6 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, · 433 unmodified lines | ||
| 434 | 434 | unsigned int target_id); |
| 435 | 435 | extern void iscsi_remove_session(struct iscsi_cls_session *session); |
| 436 | 436 | extern void iscsi_free_session(struct iscsi_cls_session *session); |
| 437 | −extern int iscsi_destroy_session(struct iscsi_cls_session *session); | |
| 438 | 437 | extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess, |
| 439 | 438 | int dd_size, uint32_t cid); |
| 440 | 439 | extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); |
| @@ -23,6 +23,7 @@ enum xt_bpf_modes { · 22 unmodified lines | ||
| 23 | 23 | XT_BPF_MODE_FD_PINNED, |
| 24 | 24 | XT_BPF_MODE_FD_ELF, |
| 25 | 25 | }; |
| 26 | +#define XT_BPF_MODE_PATH_PINNED XT_BPF_MODE_FD_PINNED | |
| 26 | 27 | |
| 27 | 28 | struct xt_bpf_info_v1 { |
| 28 | 29 | __u16 mode; |
| @@ -363,6 +363,7 @@ out: · 362 unmodified lines | ||
| 363 | 363 | putname(pname); |
| 364 | 364 | return ret; |
| 365 | 365 | } |
| 366 | +EXPORT_SYMBOL_GPL(bpf_obj_get_user); | |
| 366 | 367 | |
| 367 | 368 | static void bpf_evict_inode(struct inode *inode) |
| 368 | 369 | { |
| @@ -704,6 +704,10 @@ static void mark_reg_read(const struct bpf_verifier_state *state, u32 regno) · 703 unmodified lines | ||
| 704 | 704 | { |
| 705 | 705 | struct bpf_verifier_state *parent = state->parent; |
| 706 | 706 | |
| 707 | + if (regno == BPF_REG_FP) | |
| 708 | + /* We don't need to worry about FP liveness because it's read-only */ | |
| 709 | + return; | |
| 710 | + | |
| 707 | 711 | while (parent) { |
| 708 | 712 | /* if read wasn't screened by an earlier write ... */ |
| 709 | 713 | if (state->regs[regno].live & REG_LIVE_WRITTEN) |
| @@ -2402,6 +2406,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) · 1692 unmodified lines | ||
| 2402 | 2406 | * copy register state to dest reg |
| 2403 | 2407 | */ |
| 2404 | 2408 | regs[insn->dst_reg] = regs[insn->src_reg]; |
| 2409 | + regs[insn->dst_reg].live |= REG_LIVE_WRITTEN; | |
| 2405 | 2410 | } else { |
| 2406 | 2411 | /* R1 = (u32) R2 */ |
| 2407 | 2412 | if (is_pointer_value(env, insn->src_reg)) { |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/lockdep.h> |
| 25 | 25 | #include <linux/tick.h> |
| 26 | 26 | #include <linux/irq.h> |
| 27 | +#include <linux/nmi.h> | |
| 27 | 28 | #include <linux/smpboot.h> |
| 28 | 29 | #include <linux/relay.h> |
| 29 | 30 | #include <linux/slab.h> |
| @@ -897,6 +898,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen, · 867 unmodified lines | ||
| 897 | 898 | |
| 898 | 899 | out: |
| 899 | 900 | cpus_write_unlock(); |
| 901 | + /* | |
| 902 | + * Do post unplug cleanup. This is still protected against | |
| 903 | + * concurrent CPU hotplug via cpu_add_remove_lock. | |
| 904 | + */ | |
| 905 | + lockup_detector_cleanup(); | |
| 900 | 906 | return ret; |
| 901 | 907 | } |
| 902 | 908 | |
| @@ -344,39 +344,30 @@ EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread); · 343 unmodified lines | ||
| 344 | 344 | * by the client, but only by calling this function. |
| 345 | 345 | * This function can only be called on a registered smp_hotplug_thread. |
| 346 | 346 | */ |
| 347 | −int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, | |
| 348 | − const struct cpumask *new) | |
| 347 | +void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread, | |
| 348 | + const struct cpumask *new) | |
| 349 | 349 | { |
| 350 | 350 | struct cpumask *old = plug_thread->cpumask; |
| 351 | − cpumask_var_t tmp; | |
| 351 | + static struct cpumask tmp; | |
| 352 | 352 | unsigned int cpu; |
| 353 | 353 | |
| 354 | − if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) | |
| 355 | − return -ENOMEM; | |
| 356 | − | |
| 357 | − get_online_cpus(); | |
| 354 | + lockdep_assert_cpus_held(); | |
| 358 | 355 | mutex_lock(&smpboot_threads_lock); |
| 359 | 356 | |
| 360 | 357 | /* Park threads that were exclusively enabled on the old mask. */ |
| 361 | − cpumask_andnot(tmp, old, new); | |
| 362 | − for_each_cpu_and(cpu, tmp, cpu_online_mask) | |
| 358 | + cpumask_andnot(&tmp, old, new); | |
| 359 | + for_each_cpu_and(cpu, &tmp, cpu_online_mask) | |
| 363 | 360 | smpboot_park_thread(plug_thread, cpu); |
| 364 | 361 | |
| 365 | 362 | /* Unpark threads that are exclusively enabled on the new mask. */ |
| 366 | − cpumask_andnot(tmp, new, old); | |
| 367 | − for_each_cpu_and(cpu, tmp, cpu_online_mask) | |
| 363 | + cpumask_andnot(&tmp, new, old); | |
| 364 | + for_each_cpu_and(cpu, &tmp, cpu_online_mask) | |
| 368 | 365 | smpboot_unpark_thread(plug_thread, cpu); |
| 369 | 366 | |
| 370 | 367 | cpumask_copy(old, new); |
| 371 | 368 | |
| 372 | 369 | mutex_unlock(&smpboot_threads_lock); |
| 373 | − put_online_cpus(); | |
| 374 | − | |
| 375 | − free_cpumask_var(tmp); | |
| 376 | − | |
| 377 | − return 0; | |
| 378 | 370 | } |
| 379 | −EXPORT_SYMBOL_GPL(smpboot_update_cpumask_percpu_thread); | |
| 380 | 371 | |
| 381 | 372 | static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = ATOMIC_INIT(CPU_POST_DEAD); |
| 382 | 373 | |
| @@ -872,9 +872,9 @@ static struct ctl_table kern_table[] = { · 871 unmodified lines | ||
| 872 | 872 | #if defined(CONFIG_LOCKUP_DETECTOR) |
| 873 | 873 | { |
| 874 | 874 | .procname = "watchdog", |
| 875 | − .data = &watchdog_user_enabled, | |
| 876 | − .maxlen = sizeof (int), | |
| 877 | − .mode = 0644, | |
| 875 | + .data = &watchdog_user_enabled, | |
| 876 | + .maxlen = sizeof(int), | |
| 877 | + .mode = 0644, | |
| 878 | 878 | .proc_handler = proc_watchdog, |
| 879 | 879 | .extra1 = &zero, |
| 880 | 880 | .extra2 = &one, |
| @@ -890,16 +890,12 @@ static struct ctl_table kern_table[] = { · 9 unmodified lines | ||
| 890 | 890 | }, |
| 891 | 891 | { |
| 892 | 892 | .procname = "nmi_watchdog", |
| 893 | − .data = &nmi_watchdog_enabled, | |
| 894 | − .maxlen = sizeof (int), | |
| 895 | − .mode = 0644, | |
| 893 | + .data = &nmi_watchdog_user_enabled, | |
| 894 | + .maxlen = sizeof(int), | |
| 895 | + .mode = NMI_WATCHDOG_SYSCTL_PERM, | |
| 896 | 896 | .proc_handler = proc_nmi_watchdog, |
| 897 | 897 | .extra1 = &zero, |
| 898 | −#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) | |
| 899 | 898 | .extra2 = &one, |
| 900 | −#else | |
| 901 | − .extra2 = &zero, | |
| 902 | −#endif | |
| 903 | 899 | }, |
| 904 | 900 | { |
| 905 | 901 | .procname = "watchdog_cpumask", |
| @@ -911,9 +907,9 @@ static struct ctl_table kern_table[] = { · 5 unmodified lines | ||
| 911 | 907 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR |
| 912 | 908 | { |
| 913 | 909 | .procname = "soft_watchdog", |
| 914 | − .data = &soft_watchdog_enabled, | |
| 915 | − .maxlen = sizeof (int), | |
| 916 | − .mode = 0644, | |
| 910 | + .data = &soft_watchdog_user_enabled, | |
| 911 | + .maxlen = sizeof(int), | |
| 912 | + .mode = 0644, | |
| 917 | 913 | .proc_handler = proc_soft_watchdog, |
| 918 | 914 | .extra1 = &zero, |
| 919 | 915 | .extra2 = &one, |
| @@ -29,20 +29,29 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <linux/kvm_para.h> |
| 30 | 30 | #include <linux/kthread.h> |
| 31 | 31 | |
| 32 | −/* Watchdog configuration */ | |
| 33 | −static DEFINE_MUTEX(watchdog_proc_mutex); | |
| 34 | − | |
| 35 | −int __read_mostly nmi_watchdog_enabled; | |
| 32 | +static DEFINE_MUTEX(watchdog_mutex); | |
| 36 | 33 | |
| 37 | 34 | #if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG) |
| 38 | −unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED | | |
| 39 | − NMI_WATCHDOG_ENABLED; | |
| 35 | +# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED | NMI_WATCHDOG_ENABLED) | |
| 36 | +# define NMI_WATCHDOG_DEFAULT 1 | |
| 40 | 37 | #else |
| 41 | −unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED; | |
| 38 | +# define WATCHDOG_DEFAULT (SOFT_WATCHDOG_ENABLED) | |
| 39 | +# define NMI_WATCHDOG_DEFAULT 0 | |
| 42 | 40 | #endif |
| 43 | 41 | |
| 42 | +unsigned long __read_mostly watchdog_enabled; | |
| 43 | +int __read_mostly watchdog_user_enabled = 1; | |
| 44 | +int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT; | |
| 45 | +int __read_mostly soft_watchdog_user_enabled = 1; | |
| 46 | +int __read_mostly watchdog_thresh = 10; | |
| 47 | +int __read_mostly nmi_watchdog_available; | |
| 48 | + | |
| 49 | +struct cpumask watchdog_allowed_mask __read_mostly; | |
| 50 | + | |
| 51 | +struct cpumask watchdog_cpumask __read_mostly; | |
| 52 | +unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask); | |
| 53 | + | |
| 44 | 54 | #ifdef CONFIG_HARDLOCKUP_DETECTOR |
| 45 | −/* boot commands */ | |
| 46 | 55 | /* |
| 47 | 56 | * Should we panic when a soft-lockup or hard-lockup occurs: |
| 48 | 57 | */ |
| @@ -56,9 +65,9 @@ unsigned int __read_mostly hardlockup_panic = · 7 unmodified lines | ||
| 56 | 65 | * kernel command line parameters are parsed, because otherwise it is not |
| 57 | 66 | * possible to override this in hardlockup_panic_setup(). |
| 58 | 67 | */ |
| 59 | −void hardlockup_detector_disable(void) | |
| 68 | +void __init hardlockup_detector_disable(void) | |
| 60 | 69 | { |
| 61 | − watchdog_enabled &= ~NMI_WATCHDOG_ENABLED; | |
| 70 | + nmi_watchdog_user_enabled = 0; | |
| 62 | 71 | } |
| 63 | 72 | |
| 64 | 73 | static int __init hardlockup_panic_setup(char *str) |
| @@ -68,48 +77,24 @@ static int __init hardlockup_panic_setup(char *str) · 3 unmodified lines | ||
| 68 | 77 | else if (!strncmp(str, "nopanic", 7)) |
| 69 | 78 | hardlockup_panic = 0; |
| 70 | 79 | else if (!strncmp(str, "0", 1)) |
| 71 | − watchdog_enabled &= ~NMI_WATCHDOG_ENABLED; | |
| 80 | + nmi_watchdog_user_enabled = 0; | |
| 72 | 81 | else if (!strncmp(str, "1", 1)) |
| 73 | − watchdog_enabled |= NMI_WATCHDOG_ENABLED; | |
| 82 | + nmi_watchdog_user_enabled = 1; | |
| 74 | 83 | return 1; |
| 75 | 84 | } |
| 76 | 85 | __setup("nmi_watchdog=", hardlockup_panic_setup); |
| 77 | 86 | |
| 78 | −#endif | |
| 79 | − | |
| 80 | −#ifdef CONFIG_SOFTLOCKUP_DETECTOR | |
| 81 | −int __read_mostly soft_watchdog_enabled; | |
| 82 | −#endif | |
| 83 | − | |
| 84 | −int __read_mostly watchdog_user_enabled; | |
| 85 | −int __read_mostly watchdog_thresh = 10; | |
| 86 | − | |
| 87 | −#ifdef CONFIG_SMP | |
| 88 | −int __read_mostly sysctl_softlockup_all_cpu_backtrace; | |
| 87 | +# ifdef CONFIG_SMP | |
| 89 | 88 | int __read_mostly sysctl_hardlockup_all_cpu_backtrace; |
| 90 | −#endif | |
| 91 | −struct cpumask watchdog_cpumask __read_mostly; | |
| 92 | −unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask); | |
| 93 | 89 | |
| 94 | −/* | |
| 95 | − * The 'watchdog_running' variable is set to 1 when the watchdog threads | |
| 96 | − * are registered/started and is set to 0 when the watchdog threads are | |
| 97 | − * unregistered/stopped, so it is an indicator whether the threads exist. | |
| 98 | − */ | |
| 99 | −static int __read_mostly watchdog_running; | |
| 100 | −/* | |
| 101 | − * If a subsystem has a need to deactivate the watchdog temporarily, it | |
| 102 | − * can use the suspend/resume interface to achieve this. The content of | |
| 103 | − * the 'watchdog_suspended' variable reflects this state. Existing threads | |
| 104 | − * are parked/unparked by the lockup_detector_{suspend|resume} functions | |
| 105 | − * (see comment blocks pertaining to those functions for further details). | |
| 106 | − * | |
| 107 | − * 'watchdog_suspended' also prevents threads from being registered/started | |
| 108 | − * or unregistered/stopped via parameters in /proc/sys/kernel, so the state | |
| 109 | − * of 'watchdog_running' cannot change while the watchdog is deactivated | |
| 110 | − * temporarily (see related code in 'proc' handlers). | |
| 111 | − */ | |
| 112 | −int __read_mostly watchdog_suspended; | |
| 90 | +static int __init hardlockup_all_cpu_backtrace_setup(char *str) | |
| 91 | +{ | |
| 92 | + sysctl_hardlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0); | |
| 93 | + return 1; | |
| 94 | +} | |
| 95 | +__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup); | |
| 96 | +# endif /* CONFIG_SMP */ | |
| 97 | +#endif /* CONFIG_HARDLOCKUP_DETECTOR */ | |
| 113 | 98 | |
| 114 | 99 | /* |
| 115 | 100 | * These functions can be overridden if an architecture implements its |
| @@ -121,36 +106,68 @@ int __read_mostly watchdog_suspended; · 5 unmodified lines | ||
| 121 | 106 | */ |
| 122 | 107 | int __weak watchdog_nmi_enable(unsigned int cpu) |
| 123 | 108 | { |
| 109 | + hardlockup_detector_perf_enable(); | |
| 124 | 110 | return 0; |
| 125 | 111 | } |
| 112 | + | |
| 126 | 113 | void __weak watchdog_nmi_disable(unsigned int cpu) |
| 127 | 114 | { |
| 115 | + hardlockup_detector_perf_disable(); | |
| 128 | 116 | } |
| 129 | 117 | |
| 130 | −/* | |
| 131 | − * watchdog_nmi_reconfigure can be implemented to be notified after any | |
| 132 | − * watchdog configuration change. The arch hardlockup watchdog should | |
| 133 | − * respond to the following variables: | |
| 134 | − * - nmi_watchdog_enabled | |
| 118 | +/* Return 0, if a NMI watchdog is available. Error code otherwise */ | |
| 119 | +int __weak __init watchdog_nmi_probe(void) | |
| 120 | +{ | |
| 121 | + return hardlockup_detector_perf_init(); | |
| 122 | +} | |
| 123 | + | |
| 124 | +/** | |
| 125 | + * watchdog_nmi_stop - Stop the watchdog for reconfiguration | |
| 126 | + * | |
| 127 | + * The reconfiguration steps are: | |
| 128 | + * watchdog_nmi_stop(); | |
| 129 | + * update_variables(); | |
| 130 | + * watchdog_nmi_start(); | |
| 131 | + */ | |
| 132 | +void __weak watchdog_nmi_stop(void) { } | |
| 133 | + | |
| 134 | +/** | |
| 135 | + * watchdog_nmi_start - Start the watchdog after reconfiguration | |
| 136 | + * | |
| 137 | + * Counterpart to watchdog_nmi_stop(). | |
| 138 | + * | |
| 139 | + * The following variables have been updated in update_variables() and | |
| 140 | + * contain the currently valid configuration: | |
| 141 | + * - watchdog_enabled | |
| 135 | 142 | * - watchdog_thresh |
| 136 | 143 | * - watchdog_cpumask |
| 137 | − * - sysctl_hardlockup_all_cpu_backtrace | |
| 138 | − * - hardlockup_panic | |
| 139 | − * - watchdog_suspended | |
| 140 | 144 | */ |
| 141 | −void __weak watchdog_nmi_reconfigure(void) | |
| 145 | +void __weak watchdog_nmi_start(void) { } | |
| 146 | + | |
| 147 | +/** | |
| 148 | + * lockup_detector_update_enable - Update the sysctl enable bit | |
| 149 | + * | |
| 150 | + * Caller needs to make sure that the NMI/perf watchdogs are off, so this | |
| 151 | + * can't race with watchdog_nmi_disable(). | |
| 152 | + */ | |
| 153 | +static void lockup_detector_update_enable(void) | |
| 142 | 154 | { |
| 155 | + watchdog_enabled = 0; | |
| 156 | + if (!watchdog_user_enabled) | |
| 157 | + return; | |
| 158 | + if (nmi_watchdog_available && nmi_watchdog_user_enabled) | |
| 159 | + watchdog_enabled |= NMI_WATCHDOG_ENABLED; | |
| 160 | + if (soft_watchdog_user_enabled) | |
| 161 | + watchdog_enabled |= SOFT_WATCHDOG_ENABLED; | |
| 143 | 162 | } |
| 144 | 163 | |
| 145 | − | |
| 146 | 164 | #ifdef CONFIG_SOFTLOCKUP_DETECTOR |
| 147 | 165 | |
| 148 | −/* Helper for online, unparked cpus. */ | |
| 149 | −#define for_each_watchdog_cpu(cpu) \ | |
| 150 | − for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask) | |
| 151 | − | |
| 152 | −atomic_t watchdog_park_in_progress = ATOMIC_INIT(0); | |
| 166 | +/* Global variables, exported for sysctl */ | |
| 167 | +unsigned int __read_mostly softlockup_panic = | |
| 168 | + CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE; | |
| 153 | 169 | |
| 170 | +static bool softlockup_threads_initialized __read_mostly; | |
| 154 | 171 | static u64 __read_mostly sample_period; |
| 155 | 172 | |
| 156 | 173 | static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); |
| @@ -164,50 +181,40 @@ static DEFINE_PER_CPU(struct task_struct *, softlockup_task_ptr_saved); · 7 unmodified lines | ||
| 164 | 181 | static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); |
| 165 | 182 | static unsigned long soft_lockup_nmi_warn; |
| 166 | 183 | |
| 167 | −unsigned int __read_mostly softlockup_panic = | |
| 168 | − CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE; | |
| 169 | − | |
| 170 | 184 | static int __init softlockup_panic_setup(char *str) |
| 171 | 185 | { |
| 172 | 186 | softlockup_panic = simple_strtoul(str, NULL, 0); |
| 173 | − | |
| 174 | 187 | return 1; |
| 175 | 188 | } |
| 176 | 189 | __setup("softlockup_panic=", softlockup_panic_setup); |
| 177 | 190 | |
| 178 | 191 | static int __init nowatchdog_setup(char *str) |
| 179 | 192 | { |
| 180 | − watchdog_enabled = 0; | |
| 193 | + watchdog_user_enabled = 0; | |
| 181 | 194 | return 1; |
| 182 | 195 | } |
| 183 | 196 | __setup("nowatchdog", nowatchdog_setup); |
| 184 | 197 | |
| 185 | 198 | static int __init nosoftlockup_setup(char *str) |
| 186 | 199 | { |
| 187 | − watchdog_enabled &= ~SOFT_WATCHDOG_ENABLED; | |
| 200 | + soft_watchdog_user_enabled = 0; | |
| 188 | 201 | return 1; |
| 189 | 202 | } |
| 190 | 203 | __setup("nosoftlockup", nosoftlockup_setup); |
| 191 | 204 | |
| 192 | 205 | #ifdef CONFIG_SMP |
| 206 | +int __read_mostly sysctl_softlockup_all_cpu_backtrace; | |
| 207 | + | |
| 193 | 208 | static int __init softlockup_all_cpu_backtrace_setup(char *str) |
| 194 | 209 | { |
| 195 | − sysctl_softlockup_all_cpu_backtrace = | |
| 196 | − !!simple_strtol(str, NULL, 0); | |
| 210 | + sysctl_softlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0); | |
| 197 | 211 | return 1; |
| 198 | 212 | } |
| 199 | 213 | __setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup); |
| 200 | −#ifdef CONFIG_HARDLOCKUP_DETECTOR | |
| 201 | −static int __init hardlockup_all_cpu_backtrace_setup(char *str) | |
| 202 | −{ | |
| 203 | − sysctl_hardlockup_all_cpu_backtrace = | |
| 204 | − !!simple_strtol(str, NULL, 0); | |
| 205 | − return 1; | |
| 206 | −} | |
| 207 | −__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup); | |
| 208 | −#endif | |
| 209 | 214 | #endif |
| 210 | 215 | |
| 216 | +static void __lockup_detector_cleanup(void); | |
| 217 | + | |
| 211 | 218 | /* |
| 212 | 219 | * Hard-lockup warnings should be triggered after just a few seconds. Soft- |
| 213 | 220 | * lockups can have false positives under extreme conditions. So we generally |
| @@ -278,11 +285,15 @@ void touch_all_softlockup_watchdogs(void) · 64 unmodified lines | ||
| 278 | 285 | int cpu; |
| 279 | 286 | |
| 280 | 287 | /* |
| 281 | − * this is done lockless | |
| 282 | − * do we care if a 0 races with a timestamp? | |
| 283 | − * all it means is the softlock check starts one cycle later | |
| 288 | + * watchdog_mutex cannpt be taken here, as this might be called | |
| 289 | + * from (soft)interrupt context, so the access to | |
| 290 | + * watchdog_allowed_cpumask might race with a concurrent update. | |
| 291 | + * | |
| 292 | + * The watchdog time stamp can race against a concurrent real | |
| 293 | + * update as well, the only side effect might be a cycle delay for | |
| 294 | + * the softlockup check. | |
| 284 | 295 | */ |
| 285 | − for_each_watchdog_cpu(cpu) | |
| 296 | + for_each_cpu(cpu, &watchdog_allowed_mask) | |
| 286 | 297 | per_cpu(watchdog_touch_ts, cpu) = 0; |
| 287 | 298 | wq_watchdog_touch(-1); |
| 288 | 299 | } |
| @@ -322,9 +333,6 @@ static void watchdog_interrupt_count(void) · 33 unmodified lines | ||
| 322 | 333 | __this_cpu_inc(hrtimer_interrupts); |
| 323 | 334 | } |
| 324 | 335 | |
| 325 | −static int watchdog_enable_all_cpus(void); | |
| 326 | −static void watchdog_disable_all_cpus(void); | |
| 327 | − | |
| 328 | 336 | /* watchdog kicker functions */ |
| 329 | 337 | static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) |
| 330 | 338 | { |
| @@ -333,7 +341,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) · 2 unmodified lines | ||
| 333 | 341 | int duration; |
| 334 | 342 | int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace; |
| 335 | 343 | |
| 336 | − if (atomic_read(&watchdog_park_in_progress) != 0) | |
| 344 | + if (!watchdog_enabled) | |
| 337 | 345 | return HRTIMER_NORESTART; |
| 338 | 346 | |
| 339 | 347 | /* kick the hardlockup detector */ |
| @@ -447,32 +455,38 @@ static void watchdog_set_prio(unsigned int policy, unsigned int prio) · 107 unmodified lines | ||
| 447 | 455 | |
| 448 | 456 | static void watchdog_enable(unsigned int cpu) |
| 449 | 457 | { |
| 450 | − struct hrtimer *hrtimer = raw_cpu_ptr(&watchdog_hrtimer); | |
| 458 | + struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer); | |
| 451 | 459 | |
| 452 | − /* kick off the timer for the hardlockup detector */ | |
| 460 | + /* | |
| 461 | + * Start the timer first to prevent the NMI watchdog triggering | |
| 462 | + * before the timer has a chance to fire. | |
| 463 | + */ | |
| 453 | 464 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
| 454 | 465 | hrtimer->function = watchdog_timer_fn; |
| 455 | − | |
| 456 | − /* Enable the perf event */ | |
| 457 | − watchdog_nmi_enable(cpu); | |
| 458 | − | |
| 459 | − /* done here because hrtimer_start can only pin to smp_processor_id() */ | |
| 460 | 466 | hrtimer_start(hrtimer, ns_to_ktime(sample_period), |
| 461 | 467 | HRTIMER_MODE_REL_PINNED); |
| 462 | 468 | |
| 463 | − /* initialize timestamp */ | |
| 464 | − watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1); | |
| 469 | + /* Initialize timestamp */ | |
| 465 | 470 | __touch_watchdog(); |
| 471 | + /* Enable the perf event */ | |
| 472 | + if (watchdog_enabled & NMI_WATCHDOG_ENABLED) | |
| 473 | + watchdog_nmi_enable(cpu); | |
| 474 | + | |
| 475 | + watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1); | |
| 466 | 476 | } |
| 467 | 477 | |
| 468 | 478 | static void watchdog_disable(unsigned int cpu) |
| 469 | 479 | { |
| 470 | − struct hrtimer *hrtimer = raw_cpu_ptr(&watchdog_hrtimer); | |
| 480 | + struct hrtimer *hrtimer = this_cpu_ptr(&watchdog_hrtimer); | |
| 471 | 481 | |
| 472 | 482 | watchdog_set_prio(SCHED_NORMAL, 0); |
| 473 | − hrtimer_cancel(hrtimer); | |
| 474 | − /* disable the perf event */ | |
| 483 | + /* | |
| 484 | + * Disable the perf event first. That prevents that a large delay | |
| 485 | + * between disabling the timer and disabling the perf event causes | |
| 486 | + * the perf NMI to detect a false positive. | |
| 487 | + */ | |
| 475 | 488 | watchdog_nmi_disable(cpu); |
| 489 | + hrtimer_cancel(hrtimer); | |
| 476 | 490 | } |
| 477 | 491 | |
| 478 | 492 | static void watchdog_cleanup(unsigned int cpu, bool online) |
| @@ -499,21 +513,6 @@ static void watchdog(unsigned int cpu) · 20 unmodified lines | ||
| 499 | 513 | __this_cpu_write(soft_lockup_hrtimer_cnt, |
| 500 | 514 | __this_cpu_read(hrtimer_interrupts)); |
| 501 | 515 | __touch_watchdog(); |
| 502 | − | |
| 503 | − /* | |
| 504 | − * watchdog_nmi_enable() clears the NMI_WATCHDOG_ENABLED bit in the | |
| 505 | − * failure path. Check for failures that can occur asynchronously - | |
| 506 | − * for example, when CPUs are on-lined - and shut down the hardware | |
| 507 | − * perf event on each CPU accordingly. | |
| 508 | − * | |
| 509 | − * The only non-obvious place this bit can be cleared is through | |
| 510 | − * watchdog_nmi_enable(), so a pr_info() is placed there. Placing a | |
| 511 | − * pr_info here would be too noisy as it would result in a message | |
| 512 | − * every few seconds if the hardlockup was disabled but the softlockup | |
| 513 | − * enabled. | |
| 514 | − */ | |
| 515 | − if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) | |
| 516 | − watchdog_nmi_disable(cpu); | |
| 517 | 516 | } |
| 518 | 517 | |
| 519 | 518 | static struct smp_hotplug_thread watchdog_threads = { |
| @@ -527,295 +526,174 @@ static struct smp_hotplug_thread watchdog_threads = { · 7 unmodified lines | ||
| 527 | 526 | .unpark = watchdog_enable, |
| 528 | 527 | }; |
| 529 | 528 | |
| 530 | −/* | |
| 531 | − * park all watchdog threads that are specified in 'watchdog_cpumask' | |
| 532 | − * | |
| 533 | − * This function returns an error if kthread_park() of a watchdog thread | |
| 534 | − * fails. In this situation, the watchdog threads of some CPUs can already | |
| 535 | − * be parked and the watchdog threads of other CPUs can still be runnable. | |
| 536 | − * Callers are expected to handle this special condition as appropriate in | |
| 537 | − * their context. | |
| 538 | − * | |
| 539 | − * This function may only be called in a context that is protected against | |
| 540 | − * races with CPU hotplug - for example, via get_online_cpus(). | |
| 541 | − */ | |
| 542 | −static int watchdog_park_threads(void) | |
| 529 | +static void softlockup_update_smpboot_threads(void) | |
| 543 | 530 | { |
| 544 | − int cpu, ret = 0; | |
| 531 | + lockdep_assert_held(&watchdog_mutex); | |
| 545 | 532 | |
| 546 | − atomic_set(&watchdog_park_in_progress, 1); | |
| 533 | + if (!softlockup_threads_initialized) | |
| 534 | + return; | |
| 547 | 535 | |
| 548 | − for_each_watchdog_cpu(cpu) { | |
| 549 | − ret = kthread_park(per_cpu(softlockup_watchdog, cpu)); | |
| 550 | − if (ret) | |
| 551 | − break; | |
| 552 | − } | |
| 553 | − | |
| 554 | − atomic_set(&watchdog_park_in_progress, 0); | |
| 555 | − | |
| 556 | − return ret; | |
| 536 | + smpboot_update_cpumask_percpu_thread(&watchdog_threads, | |
| 537 | + &watchdog_allowed_mask); | |
| 557 | 538 | } |
| 558 | 539 | |
| 559 | −/* | |
| 560 | − * unpark all watchdog threads that are specified in 'watchdog_cpumask' | |
| 561 | − * | |
| 562 | − * This function may only be called in a context that is protected against | |
| 563 | − * races with CPU hotplug - for example, via get_online_cpus(). | |
| 564 | − */ | |
| 565 | −static void watchdog_unpark_threads(void) | |
| 540 | +/* Temporarily park all watchdog threads */ | |
| 541 | +static void softlockup_park_all_threads(void) | |
| 566 | 542 | { |
| 567 | − int cpu; | |
| 568 | − | |
| 569 | − for_each_watchdog_cpu(cpu) | |
| 570 | − kthread_unpark(per_cpu(softlockup_watchdog, cpu)); | |
| 543 | + cpumask_clear(&watchdog_allowed_mask); | |
| 544 | + softlockup_update_smpboot_threads(); | |
| 571 | 545 | } |
| 572 | 546 | |
| 573 | −static int update_watchdog_all_cpus(void) | |
| 547 | +/* Unpark enabled threads */ | |
| 548 | +static void softlockup_unpark_threads(void) | |
| 574 | 549 | { |
| 575 | − int ret; | |
| 576 | − | |
| 577 | − ret = watchdog_park_threads(); | |
| 578 | − if (ret) | |
| 579 | − return ret; | |
| 580 | − | |
| 581 | − watchdog_unpark_threads(); | |
| 582 | − | |
| 583 | − return 0; | |
| 550 | + cpumask_copy(&watchdog_allowed_mask, &watchdog_cpumask); | |
| 551 | + softlockup_update_smpboot_threads(); | |
| 584 | 552 | } |
| 585 | 553 | |
| 586 | −static int watchdog_enable_all_cpus(void) | |
| 554 | +static void lockup_detector_reconfigure(void) | |
| 587 | 555 | { |
| 588 | − int err = 0; | |
| 589 | − | |
| 590 | − if (!watchdog_running) { | |
| 591 | − err = smpboot_register_percpu_thread_cpumask(&watchdog_threads, | |
| 592 | − &watchdog_cpumask); | |
| 593 | − if (err) | |
| 594 | − pr_err("Failed to create watchdog threads, disabled\n"); | |
| 595 | − else | |
| 596 | − watchdog_running = 1; | |
| 597 | − } else { | |
| 598 | − /* | |
| 599 | − * Enable/disable the lockup detectors or | |
| 600 | − * change the sample period 'on the fly'. | |
| 601 | − */ | |
| 602 | − err = update_watchdog_all_cpus(); | |
| 603 | − | |
| 604 | − if (err) { | |
| 605 | − watchdog_disable_all_cpus(); | |
| 606 | − pr_err("Failed to update lockup detectors, disabled\n"); | |
| 607 | − } | |
| 608 | − } | |
| 609 | − | |
| 610 | − if (err) | |
| 611 | − watchdog_enabled = 0; | |
| 612 | − | |
| 613 | − return err; | |
| 556 | + cpus_read_lock(); | |
| 557 | + watchdog_nmi_stop(); | |
| 558 | + softlockup_park_all_threads(); | |
| 559 | + set_sample_period(); | |
| 560 | + lockup_detector_update_enable(); | |
| 561 | + if (watchdog_enabled && watchdog_thresh) | |
| 562 | + softlockup_unpark_threads(); | |
| 563 | + watchdog_nmi_start(); | |
| 564 | + cpus_read_unlock(); | |
| 565 | + /* | |
| 566 | + * Must be called outside the cpus locked section to prevent | |
| 567 | + * recursive locking in the perf code. | |
| 568 | + */ | |
| 569 | + __lockup_detector_cleanup(); | |
| 614 | 570 | } |
| 615 | 571 | |
| 616 | −static void watchdog_disable_all_cpus(void) | |
| 572 | +/* | |
| 573 | + * Create the watchdog thread infrastructure and configure the detector(s). | |
| 574 | + * | |
| 575 | + * The threads are not unparked as watchdog_allowed_mask is empty. When | |
| 576 | + * the threads are sucessfully initialized, take the proper locks and | |
| 577 | + * unpark the threads in the watchdog_cpumask if the watchdog is enabled. | |
| 578 | + */ | |
| 579 | +static __init void lockup_detector_setup(void) | |
| 617 | 580 | { |
| 618 | − if (watchdog_running) { | |
| 619 | − watchdog_running = 0; | |
| 620 | − smpboot_unregister_percpu_thread(&watchdog_threads); | |
| 621 | − } | |
| 622 | −} | |
| 581 | + int ret; | |
| 623 | 582 | |
| 624 | −#ifdef CONFIG_SYSCTL | |
| 625 | −static int watchdog_update_cpus(void) | |
| 626 | −{ | |
| 627 | − return smpboot_update_cpumask_percpu_thread( | |
| 628 | − &watchdog_threads, &watchdog_cpumask); | |
| 629 | −} | |
| 630 | −#endif | |
| 583 | + /* | |
| 584 | + * If sysctl is off and watchdog got disabled on the command line, | |
| 585 | + * nothing to do here. | |
| 586 | + */ | |
| 587 | + lockup_detector_update_enable(); | |
| 631 | 588 | |
| 632 | −#else /* SOFTLOCKUP */ | |
| 633 | −static int watchdog_park_threads(void) | |
| 634 | −{ | |
| 635 | − return 0; | |
| 636 | −} | |
| 589 | + if (!IS_ENABLED(CONFIG_SYSCTL) && | |
| 590 | + !(watchdog_enabled && watchdog_thresh)) | |
| 591 | + return; | |
| 637 | 592 | |
| 638 | −static void watchdog_unpark_threads(void) | |
| 639 | −{ | |
| 640 | −} | |
| 593 | + ret = smpboot_register_percpu_thread_cpumask(&watchdog_threads, | |
| 594 | + &watchdog_allowed_mask); | |
| 595 | + if (ret) { | |
| 596 | + pr_err("Failed to initialize soft lockup detector threads\n"); | |
| 597 | + return; | |
| 598 | + } | |
| 641 | 599 | |
| 642 | −static int watchdog_enable_all_cpus(void) | |
| 643 | −{ | |
| 644 | − return 0; | |
| 600 | + mutex_lock(&watchdog_mutex); | |
| 601 | + softlockup_threads_initialized = true; | |
| 602 | + lockup_detector_reconfigure(); | |
| 603 | + mutex_unlock(&watchdog_mutex); | |
| 645 | 604 | } |
| 646 | 605 | |
| 647 | −static void watchdog_disable_all_cpus(void) | |
| 606 | +#else /* CONFIG_SOFTLOCKUP_DETECTOR */ | |
| 607 | +static inline int watchdog_park_threads(void) { return 0; } | |
| 608 | +static inline void watchdog_unpark_threads(void) { } | |
| 609 | +static inline int watchdog_enable_all_cpus(void) { return 0; } | |
| 610 | +static inline void watchdog_disable_all_cpus(void) { } | |
| 611 | +static void lockup_detector_reconfigure(void) | |
| 648 | 612 | { |
| 613 | + cpus_read_lock(); | |
| 614 | + watchdog_nmi_stop(); | |
| 615 | + lockup_detector_update_enable(); | |
| 616 | + watchdog_nmi_start(); | |
| 617 | + cpus_read_unlock(); | |
| 649 | 618 | } |
| 650 | − | |
| 651 | −#ifdef CONFIG_SYSCTL | |
| 652 | −static int watchdog_update_cpus(void) | |
| 619 | +static inline void lockup_detector_setup(void) | |
| 653 | 620 | { |
| 654 | − return 0; | |
| 621 | + lockup_detector_reconfigure(); | |
| 655 | 622 | } |
| 656 | −#endif | |
| 623 | +#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */ | |
| 657 | 624 | |
| 658 | −static void set_sample_period(void) | |
| 625 | +static void __lockup_detector_cleanup(void) | |
| 659 | 626 | { |
| 627 | + lockdep_assert_held(&watchdog_mutex); | |
| 628 | + hardlockup_detector_perf_cleanup(); | |
| 660 | 629 | } |
| 661 | −#endif /* SOFTLOCKUP */ | |
| 662 | 630 | |
| 663 | −/* | |
| 664 | − * Suspend the hard and soft lockup detector by parking the watchdog threads. | |
| 631 | +/** | |
| 632 | + * lockup_detector_cleanup - Cleanup after cpu hotplug or sysctl changes | |
| 633 | + * | |
| 634 | + * Caller must not hold the cpu hotplug rwsem. | |
| 665 | 635 | */ |
| 666 | −int lockup_detector_suspend(void) | |
| 636 | +void lockup_detector_cleanup(void) | |
| 667 | 637 | { |
| 668 | − int ret = 0; | |
| 669 | − | |
| 670 | − get_online_cpus(); | |
| 671 | − mutex_lock(&watchdog_proc_mutex); | |
| 672 | − /* | |
| 673 | − * Multiple suspend requests can be active in parallel (counted by | |
| 674 | − * the 'watchdog_suspended' variable). If the watchdog threads are | |
| 675 | − * running, the first caller takes care that they will be parked. | |
| 676 | − * The state of 'watchdog_running' cannot change while a suspend | |
| 677 | − * request is active (see related code in 'proc' handlers). | |
| 678 | − */ | |
| 679 | − if (watchdog_running && !watchdog_suspended) | |
| 680 | − ret = watchdog_park_threads(); | |
| 681 | − | |
| 682 | − if (ret == 0) | |
| 683 | − watchdog_suspended++; | |
| 684 | − else { | |
| 685 | − watchdog_disable_all_cpus(); | |
| 686 | − pr_err("Failed to suspend lockup detectors, disabled\n"); | |
| 687 | − watchdog_enabled = 0; | |
| 688 | − } | |
| 689 | − | |
| 690 | − watchdog_nmi_reconfigure(); | |
| 691 | − | |
| 692 | − mutex_unlock(&watchdog_proc_mutex); | |
| 693 | − | |
| 694 | − return ret; | |
| 638 | + mutex_lock(&watchdog_mutex); | |
| 639 | + __lockup_detector_cleanup(); | |
| 640 | + mutex_unlock(&watchdog_mutex); | |
| 695 | 641 | } |
| 696 | 642 | |
| 697 | −/* | |
| 698 | − * Resume the hard and soft lockup detector by unparking the watchdog threads. | |
| 643 | +/** | |
| 644 | + * lockup_detector_soft_poweroff - Interface to stop lockup detector(s) | |
| 645 | + * | |
| 646 | + * Special interface for parisc. It prevents lockup detector warnings from | |
| 647 | + * the default pm_poweroff() function which busy loops forever. | |
| 699 | 648 | */ |
| 700 | −void lockup_detector_resume(void) | |
| 649 | +void lockup_detector_soft_poweroff(void) | |
| 701 | 650 | { |
| 702 | − mutex_lock(&watchdog_proc_mutex); | |
| 703 | − | |
| 704 | − watchdog_suspended--; | |
| 705 | − /* | |
| 706 | − * The watchdog threads are unparked if they were previously running | |
| 707 | − * and if there is no more active suspend request. | |
| 708 | − */ | |
| 709 | − if (watchdog_running && !watchdog_suspended) | |
| 710 | − watchdog_unpark_threads(); | |
| 711 | − | |
| 712 | − watchdog_nmi_reconfigure(); | |
| 713 | − | |
| 714 | − mutex_unlock(&watchdog_proc_mutex); | |
| 715 | − put_online_cpus(); | |
| 651 | + watchdog_enabled = 0; | |
| 716 | 652 | } |
| 717 | 653 | |
| 718 | 654 | #ifdef CONFIG_SYSCTL |
| 719 | 655 | |
| 720 | −/* | |
| 721 | − * Update the run state of the lockup detectors. | |
| 722 | − */ | |
| 723 | −static int proc_watchdog_update(void) | |
| 656 | +/* Propagate any changes to the watchdog threads */ | |
| 657 | +static void proc_watchdog_update(void) | |
| 724 | 658 | { |
| 725 | − int err = 0; | |
| 726 | − | |
| 727 | − /* | |
| 728 | − * Watchdog threads won't be started if they are already active. | |
| 729 | − * The 'watchdog_running' variable in watchdog_*_all_cpus() takes | |
| 730 | − * care of this. If those threads are already active, the sample | |
| 731 | − * period will be updated and the lockup detectors will be enabled | |
| 732 | − * or disabled 'on the fly'. | |
| 733 | − */ | |
| 734 | − if (watchdog_enabled && watchdog_thresh) | |
| 735 | − err = watchdog_enable_all_cpus(); | |
| 736 | − else | |
| 737 | − watchdog_disable_all_cpus(); | |
| 738 | − | |
| 739 | − watchdog_nmi_reconfigure(); | |
| 740 | − | |
| 741 | − return err; | |
| 742 | − | |
| 659 | + /* Remove impossible cpus to keep sysctl output clean. */ | |
| 660 | + cpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask); | |
| 661 | + lockup_detector_reconfigure(); | |
| 743 | 662 | } |
| 744 | 663 | |
| 745 | 664 | /* |
| 746 | 665 | * common function for watchdog, nmi_watchdog and soft_watchdog parameter |
| 747 | 666 | * |
| 748 | − * caller | table->data points to | 'which' contains the flag(s) | |
| 749 | − * -------------------|-----------------------|----------------------------- | |
| 750 | − * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED or'ed | |
| 751 | − * | | with SOFT_WATCHDOG_ENABLED | |
| 752 | − * -------------------|-----------------------|----------------------------- | |
| 753 | − * proc_nmi_watchdog | nmi_watchdog_enabled | NMI_WATCHDOG_ENABLED | |
| 754 | − * -------------------|-----------------------|----------------------------- | |
| 755 | − * proc_soft_watchdog | soft_watchdog_enabled | SOFT_WATCHDOG_ENABLED | |
| 667 | + * caller | table->data points to | 'which' | |
| 668 | + * -------------------|----------------------------|-------------------------- | |
| 669 | + * proc_watchdog | watchdog_user_enabled | NMI_WATCHDOG_ENABLED | | |
| 670 | + * | | SOFT_WATCHDOG_ENABLED | |
| 671 | + * -------------------|----------------------------|-------------------------- | |
| 672 | + * proc_nmi_watchdog | nmi_watchdog_user_enabled | NMI_WATCHDOG_ENABLED | |
| 673 | + * -------------------|----------------------------|-------------------------- | |
| 674 | + * proc_soft_watchdog | soft_watchdog_user_enabled | SOFT_WATCHDOG_ENABLED | |
| 756 | 675 | */ |
| 757 | 676 | static int proc_watchdog_common(int which, struct ctl_table *table, int write, |
| 758 | 677 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 759 | 678 | { |
| 760 | − int err, old, new; | |
| 761 | − int *watchdog_param = (int *)table->data; | |
| 679 | + int err, old, *param = table->data; | |
| 762 | 680 | |
| 763 | − get_online_cpus(); | |
| 764 | − mutex_lock(&watchdog_proc_mutex); | |
| 681 | + mutex_lock(&watchdog_mutex); | |
| 765 | 682 | |
| 766 | − if (watchdog_suspended) { | |
| 767 | − /* no parameter changes allowed while watchdog is suspended */ | |
| 768 | − err = -EAGAIN; | |
| 769 | − goto out; | |
| 770 | − } | |
| 771 | − | |
| 772 | − /* | |
| 773 | − * If the parameter is being read return the state of the corresponding | |
| 774 | − * bit(s) in 'watchdog_enabled', else update 'watchdog_enabled' and the | |
| 775 | − * run state of the lockup detectors. | |
| 776 | − */ | |
| 777 | 683 | if (!write) { |
| 778 | − *watchdog_param = (watchdog_enabled & which) != 0; | |
| 684 | + /* | |
| 685 | + * On read synchronize the userspace interface. This is a | |
| 686 | + * racy snapshot. | |
| 687 | + */ | |
| 688 | + *param = (watchdog_enabled & which) != 0; | |
| 779 | 689 | err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 780 | 690 | } else { |
| 691 | + old = READ_ONCE(*param); | |
| 781 | 692 | err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 782 | − if (err) | |
| 783 | − goto out; | |
| 784 | − | |
| 785 | − /* | |
| 786 | − * There is a race window between fetching the current value | |
| 787 | − * from 'watchdog_enabled' and storing the new value. During | |
| 788 | − * this race window, watchdog_nmi_enable() can sneak in and | |
| 789 | − * clear the NMI_WATCHDOG_ENABLED bit in 'watchdog_enabled'. | |
| 790 | − * The 'cmpxchg' detects this race and the loop retries. | |
| 791 | − */ | |
| 792 | − do { | |
| 793 | − old = watchdog_enabled; | |
| 794 | − /* | |
| 795 | − * If the parameter value is not zero set the | |
| 796 | − * corresponding bit(s), else clear it(them). | |
| 797 | − */ | |
| 798 | − if (*watchdog_param) | |
| 799 | − new = old | which; | |
| 800 | − else | |
| 801 | − new = old & ~which; | |
| 802 | − } while (cmpxchg(&watchdog_enabled, old, new) != old); | |
| 803 | − | |
| 804 | − /* | |
| 805 | − * Update the run state of the lockup detectors. There is _no_ | |
| 806 | − * need to check the value returned by proc_watchdog_update() | |
| 807 | − * and to restore the previous value of 'watchdog_enabled' as | |
| 808 | − * both lockup detectors are disabled if proc_watchdog_update() | |
| 809 | − * returns an error. | |
| 810 | − */ | |
| 811 | − if (old == new) | |
| 812 | − goto out; | |
| 813 | − | |
| 814 | − err = proc_watchdog_update(); | |
| 693 | + if (!err && old != READ_ONCE(*param)) | |
| 694 | + proc_watchdog_update(); | |
| 815 | 695 | } |
| 816 | −out: | |
| 817 | − mutex_unlock(&watchdog_proc_mutex); | |
| 818 | − put_online_cpus(); | |
| 696 | + mutex_unlock(&watchdog_mutex); | |
| 819 | 697 | return err; |
| 820 | 698 | } |
| 821 | 699 | |
| @@ -835,6 +713,8 @@ int proc_watchdog(struct ctl_table *table, int write, · 13 unmodified lines | ||
| 835 | 713 | int proc_nmi_watchdog(struct ctl_table *table, int write, |
| 836 | 714 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 837 | 715 | { |
| 716 | + if (!nmi_watchdog_available && write) | |
| 717 | + return -ENOTSUPP; | |
| 838 | 718 | return proc_watchdog_common(NMI_WATCHDOG_ENABLED, |
| 839 | 719 | table, write, buffer, lenp, ppos); |
| 840 | 720 | } |
| @@ -855,39 +735,17 @@ int proc_soft_watchdog(struct ctl_table *table, int write, · 14 unmodified lines | ||
| 855 | 735 | int proc_watchdog_thresh(struct ctl_table *table, int write, |
| 856 | 736 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 857 | 737 | { |
| 858 | − int err, old, new; | |
| 859 | − | |
| 860 | − get_online_cpus(); | |
| 861 | − mutex_lock(&watchdog_proc_mutex); | |
| 738 | + int err, old; | |
| 862 | 739 | |
| 863 | − if (watchdog_suspended) { | |
| 864 | − /* no parameter changes allowed while watchdog is suspended */ | |
| 865 | − err = -EAGAIN; | |
| 866 | − goto out; | |
| 867 | − } | |
| 740 | + mutex_lock(&watchdog_mutex); | |
| 868 | 741 | |
| 869 | − old = ACCESS_ONCE(watchdog_thresh); | |
| 742 | + old = READ_ONCE(watchdog_thresh); | |
| 870 | 743 | err = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
| 871 | 744 | |
| 872 | − if (err || !write) | |
| 873 | − goto out; | |
| 874 | − | |
| 875 | − /* | |
| 876 | − * Update the sample period. Restore on failure. | |
| 877 | − */ | |
| 878 | − new = ACCESS_ONCE(watchdog_thresh); | |
| 879 | − if (old == new) | |
| 880 | − goto out; | |
| 745 | + if (!err && write && old != READ_ONCE(watchdog_thresh)) | |
| 746 | + proc_watchdog_update(); | |
| 881 | 747 | |
| 882 | − set_sample_period(); | |
| 883 | − err = proc_watchdog_update(); | |
| 884 | − if (err) { | |
| 885 | − watchdog_thresh = old; | |
| 886 | − set_sample_period(); | |
| 887 | − } | |
| 888 | −out: | |
| 889 | − mutex_unlock(&watchdog_proc_mutex); | |
| 890 | − put_online_cpus(); | |
| 748 | + mutex_unlock(&watchdog_mutex); | |
| 891 | 749 | return err; |
| 892 | 750 | } |
| 893 | 751 | |
| @@ -902,45 +760,19 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write, · 8 unmodified lines | ||
| 902 | 760 | { |
| 903 | 761 | int err; |
| 904 | 762 | |
| 905 | − get_online_cpus(); | |
| 906 | − mutex_lock(&watchdog_proc_mutex); | |
| 907 | − | |
| 908 | − if (watchdog_suspended) { | |
| 909 | − /* no parameter changes allowed while watchdog is suspended */ | |
| 910 | − err = -EAGAIN; | |
| 911 | − goto out; | |
| 912 | − } | |
| 763 | + mutex_lock(&watchdog_mutex); | |
| 913 | 764 | |
| 914 | 765 | err = proc_do_large_bitmap(table, write, buffer, lenp, ppos); |
| 915 | − if (!err && write) { | |
| 916 | − /* Remove impossible cpus to keep sysctl output cleaner. */ | |
| 917 | − cpumask_and(&watchdog_cpumask, &watchdog_cpumask, | |
| 918 | − cpu_possible_mask); | |
| 919 | − | |
| 920 | − if (watchdog_running) { | |
| 921 | − /* | |
| 922 | − * Failure would be due to being unable to allocate | |
| 923 | − * a temporary cpumask, so we are likely not in a | |
| 924 | − * position to do much else to make things better. | |
| 925 | − */ | |
| 926 | − if (watchdog_update_cpus() != 0) | |
| 927 | − pr_err("cpumask update failed\n"); | |
| 928 | − } | |
| 766 | + if (!err && write) | |
| 767 | + proc_watchdog_update(); | |
| 929 | 768 | |
| 930 | − watchdog_nmi_reconfigure(); | |
| 931 | − } | |
| 932 | −out: | |
| 933 | − mutex_unlock(&watchdog_proc_mutex); | |
| 934 | − put_online_cpus(); | |
| 769 | + mutex_unlock(&watchdog_mutex); | |
| 935 | 770 | return err; |
| 936 | 771 | } |
| 937 | − | |
| 938 | 772 | #endif /* CONFIG_SYSCTL */ |
| 939 | 773 | |
| 940 | 774 | void __init lockup_detector_init(void) |
| 941 | 775 | { |
| 942 | − set_sample_period(); | |
| 943 | − | |
| 944 | 776 | #ifdef CONFIG_NO_HZ_FULL |
| 945 | 777 | if (tick_nohz_full_enabled()) { |
| 946 | 778 | pr_info("Disabling watchdog on nohz_full cores by default\n"); |
| @@ -951,6 +783,7 @@ void __init lockup_detector_init(void) · 4 unmodified lines | ||
| 951 | 783 | cpumask_copy(&watchdog_cpumask, cpu_possible_mask); |
| 952 | 784 | #endif |
| 953 | 785 | |
| 954 | − if (watchdog_enabled) | |
| 955 | − watchdog_enable_all_cpus(); | |
| 786 | + if (!watchdog_nmi_probe()) | |
| 787 | + nmi_watchdog_available = true; | |
| 788 | + lockup_detector_setup(); | |
| 956 | 789 | } |
| @@ -21,8 +21,10 @@ · 20 unmodified lines | ||
| 21 | 21 | static DEFINE_PER_CPU(bool, hard_watchdog_warn); |
| 22 | 22 | static DEFINE_PER_CPU(bool, watchdog_nmi_touch); |
| 23 | 23 | static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); |
| 24 | +static struct cpumask dead_events_mask; | |
| 24 | 25 | |
| 25 | 26 | static unsigned long hardlockup_allcpu_dumped; |
| 27 | +static unsigned int watchdog_cpus; | |
| 26 | 28 | |
| 27 | 29 | void arch_touch_nmi_watchdog(void) |
| 28 | 30 | { |
| @@ -103,15 +105,12 @@ static struct perf_event_attr wd_hw_attr = { · 74 unmodified lines | ||
| 103 | 105 | |
| 104 | 106 | /* Callback function for perf event subsystem */ |
| 105 | 107 | static void watchdog_overflow_callback(struct perf_event *event, |
| 106 | − struct perf_sample_data *data, | |
| 107 | − struct pt_regs *regs) | |
| 108 | + struct perf_sample_data *data, | |
| 109 | + struct pt_regs *regs) | |
| 108 | 110 | { |
| 109 | 111 | /* Ensure the watchdog never gets throttled */ |
| 110 | 112 | event->hw.interrupts = 0; |
| 111 | 113 | |
| 112 | − if (atomic_read(&watchdog_park_in_progress) != 0) | |
| 113 | − return; | |
| 114 | − | |
| 115 | 114 | if (__this_cpu_read(watchdog_nmi_touch) == true) { |
| 116 | 115 | __this_cpu_write(watchdog_nmi_touch, false); |
| 117 | 116 | return; |
| @@ -160,104 +159,131 @@ static void watchdog_overflow_callback(struct perf_event *event, · 42 unmodified lines | ||
| 160 | 159 | return; |
| 161 | 160 | } |
| 162 | 161 | |
| 163 | −/* | |
| 164 | − * People like the simple clean cpu node info on boot. | |
| 165 | − * Reduce the watchdog noise by only printing messages | |
| 166 | − * that are different from what cpu0 displayed. | |
| 167 | − */ | |
| 168 | −static unsigned long firstcpu_err; | |
| 169 | −static atomic_t watchdog_cpus; | |
| 170 | − | |
| 171 | −int watchdog_nmi_enable(unsigned int cpu) | |
| 162 | +static int hardlockup_detector_event_create(void) | |
| 172 | 163 | { |
| 164 | + unsigned int cpu = smp_processor_id(); | |
| 173 | 165 | struct perf_event_attr *wd_attr; |
| 174 | − struct perf_event *event = per_cpu(watchdog_ev, cpu); | |
| 175 | − int firstcpu = 0; | |
| 176 | − | |
| 177 | − /* nothing to do if the hard lockup detector is disabled */ | |
| 178 | − if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) | |
| 179 | − goto out; | |
| 180 | − | |
| 181 | − /* is it already setup and enabled? */ | |
| 182 | − if (event && event->state > PERF_EVENT_STATE_OFF) | |
| 183 | − goto out; | |
| 184 | − | |
| 185 | − /* it is setup but not enabled */ | |
| 186 | − if (event != NULL) | |
| 187 | − goto out_enable; | |
| 188 | − | |
| 189 | − if (atomic_inc_return(&watchdog_cpus) == 1) | |
| 190 | − firstcpu = 1; | |
| 166 | + struct perf_event *evt; | |
| 191 | 167 | |
| 192 | 168 | wd_attr = &wd_hw_attr; |
| 193 | 169 | wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh); |
| 194 | 170 | |
| 195 | 171 | /* Try to register using hardware perf events */ |
| 196 | − event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL); | |
| 172 | + evt = perf_event_create_kernel_counter(wd_attr, cpu, NULL, | |
| 173 | + watchdog_overflow_callback, NULL); | |
| 174 | + if (IS_ERR(evt)) { | |
| 175 | + pr_info("Perf event create on CPU %d failed with %ld\n", cpu, | |
| 176 | + PTR_ERR(evt)); | |
| 177 | + return PTR_ERR(evt); | |
| 178 | + } | |
| 179 | + this_cpu_write(watchdog_ev, evt); | |
| 180 | + return 0; | |
| 181 | +} | |
| 197 | 182 | |
| 198 | − /* save the first cpu's error for future comparision */ | |
| 199 | − if (firstcpu && IS_ERR(event)) | |
| 200 | − firstcpu_err = PTR_ERR(event); | |
| 183 | +/** | |
| 184 | + * hardlockup_detector_perf_enable - Enable the local event | |
| 185 | + */ | |
| 186 | +void hardlockup_detector_perf_enable(void) | |
| 187 | +{ | |
| 188 | + if (hardlockup_detector_event_create()) | |
| 189 | + return; | |
| 201 | 190 | |
| 202 | − if (!IS_ERR(event)) { | |
| 203 | − /* only print for the first cpu initialized */ | |
| 204 | − if (firstcpu || firstcpu_err) | |
| 205 | − pr_info("enabled on all CPUs, permanently consumes one hw-PMU counter.\n"); | |
| 206 | − goto out_save; | |
| 207 | − } | |
| 191 | + if (!watchdog_cpus++) | |
| 192 | + pr_info("Enabled. Permanently consumes one hw-PMU counter.\n"); | |
| 208 | 193 | |
| 209 | − /* | |
| 210 | − * Disable the hard lockup detector if _any_ CPU fails to set up | |
| 211 | − * set up the hardware perf event. The watchdog() function checks | |
| 212 | − * the NMI_WATCHDOG_ENABLED bit periodically. | |
| 213 | − * | |
| 214 | − * The barriers are for syncing up watchdog_enabled across all the | |
| 215 | − * cpus, as clear_bit() does not use barriers. | |
| 216 | − */ | |
| 217 | − smp_mb__before_atomic(); | |
| 218 | − clear_bit(NMI_WATCHDOG_ENABLED_BIT, &watchdog_enabled); | |
| 219 | − smp_mb__after_atomic(); | |
| 220 | − | |
| 221 | − /* skip displaying the same error again */ | |
| 222 | − if (!firstcpu && (PTR_ERR(event) == firstcpu_err)) | |
| 223 | − return PTR_ERR(event); | |
| 224 | − | |
| 225 | − /* vary the KERN level based on the returned errno */ | |
| 226 | − if (PTR_ERR(event) == -EOPNOTSUPP) | |
| 227 | − pr_info("disabled (cpu%i): not supported (no LAPIC?)\n", cpu); | |
| 228 | − else if (PTR_ERR(event) == -ENOENT) | |
| 229 | − pr_warn("disabled (cpu%i): hardware events not enabled\n", | |
| 230 | − cpu); | |
| 231 | − else | |
| 232 | − pr_err("disabled (cpu%i): unable to create perf event: %ld\n", | |
| 233 | − cpu, PTR_ERR(event)); | |
| 234 | − | |
| 235 | − pr_info("Shutting down hard lockup detector on all cpus\n"); | |
| 236 | − | |
| 237 | − return PTR_ERR(event); | |
| 238 | − | |
| 239 | − /* success path */ | |
| 240 | −out_save: | |
| 241 | − per_cpu(watchdog_ev, cpu) = event; | |
| 242 | −out_enable: | |
| 243 | − perf_event_enable(per_cpu(watchdog_ev, cpu)); | |
| 244 | −out: | |
| 245 | − return 0; | |
| 194 | + perf_event_enable(this_cpu_read(watchdog_ev)); | |
| 246 | 195 | } |
| 247 | 196 | |
| 248 | −void watchdog_nmi_disable(unsigned int cpu) | |
| 197 | +/** | |
| 198 | + * hardlockup_detector_perf_disable - Disable the local event | |
| 199 | + */ | |
| 200 | +void hardlockup_detector_perf_disable(void) | |
| 249 | 201 | { |
| 250 | − struct perf_event *event = per_cpu(watchdog_ev, cpu); | |
| 202 | + struct perf_event *event = this_cpu_read(watchdog_ev); | |
| 251 | 203 | |
| 252 | 204 | if (event) { |
| 253 | 205 | perf_event_disable(event); |
| 206 | + cpumask_set_cpu(smp_processor_id(), &dead_events_mask); | |
| 207 | + watchdog_cpus--; | |
| 208 | + } | |
| 209 | +} | |
| 210 | + | |
| 211 | +/** | |
| 212 | + * hardlockup_detector_perf_cleanup - Cleanup disabled events and destroy them | |
| 213 | + * | |
| 214 | + * Called from lockup_detector_cleanup(). Serialized by the caller. | |
| 215 | + */ | |
| 216 | +void hardlockup_detector_perf_cleanup(void) | |
| 217 | +{ | |
| 218 | + int cpu; | |
| 219 | + | |
| 220 | + for_each_cpu(cpu, &dead_events_mask) { | |
| 221 | + struct perf_event *event = per_cpu(watchdog_ev, cpu); | |
| 222 | + | |
| 223 | + /* | |
| 224 | + * Required because for_each_cpu() reports unconditionally | |
| 225 | + * CPU0 as set on UP kernels. Sigh. | |
| 226 | + */ | |
| 227 | + if (event) | |
| 228 | + perf_event_release_kernel(event); | |
| 254 | 229 | per_cpu(watchdog_ev, cpu) = NULL; |
| 230 | + } | |
| 231 | + cpumask_clear(&dead_events_mask); | |
| 232 | +} | |
| 233 | + | |
| 234 | +/** | |
| 235 | + * hardlockup_detector_perf_stop - Globally stop watchdog events | |
| 236 | + * | |
| 237 | + * Special interface for x86 to handle the perf HT bug. | |
| 238 | + */ | |
| 239 | +void __init hardlockup_detector_perf_stop(void) | |
| 240 | +{ | |
| 241 | + int cpu; | |
| 242 | + | |
| 243 | + lockdep_assert_cpus_held(); | |
| 244 | + | |
| 245 | + for_each_online_cpu(cpu) { | |
| 246 | + struct perf_event *event = per_cpu(watchdog_ev, cpu); | |
| 247 | + | |
| 248 | + if (event) | |
| 249 | + perf_event_disable(event); | |
| 250 | + } | |
| 251 | +} | |
| 255 | 252 | |
| 256 | − /* should be in cleanup, but blocks oprofile */ | |
| 257 | − perf_event_release_kernel(event); | |
| 253 | +/** | |
| 254 | + * hardlockup_detector_perf_restart - Globally restart watchdog events | |
| 255 | + * | |
| 256 | + * Special interface for x86 to handle the perf HT bug. | |
| 257 | + */ | |
| 258 | +void __init hardlockup_detector_perf_restart(void) | |
| 259 | +{ | |
| 260 | + int cpu; | |
| 261 | + | |
| 262 | + lockdep_assert_cpus_held(); | |
| 263 | + | |
| 264 | + if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) | |
| 265 | + return; | |
| 266 | + | |
| 267 | + for_each_online_cpu(cpu) { | |
| 268 | + struct perf_event *event = per_cpu(watchdog_ev, cpu); | |
| 269 | + | |
| 270 | + if (event) | |
| 271 | + perf_event_enable(event); | |
| 272 | + } | |
| 273 | +} | |
| 274 | + | |
| 275 | +/** | |
| 276 | + * hardlockup_detector_perf_init - Probe whether NMI event is available at all | |
| 277 | + */ | |
| 278 | +int __init hardlockup_detector_perf_init(void) | |
| 279 | +{ | |
| 280 | + int ret = hardlockup_detector_event_create(); | |
| 258 | 281 | |
| 259 | − /* watchdog_nmi_enable() expects this to be zero initially. */ | |
| 260 | − if (atomic_dec_and_test(&watchdog_cpus)) | |
| 261 | − firstcpu_err = 0; | |
| 282 | + if (ret) { | |
| 283 | + pr_info("Perf NMI watchdog permanently disabled\n"); | |
| 284 | + } else { | |
| 285 | + perf_event_release_kernel(this_cpu_read(watchdog_ev)); | |
| 286 | + this_cpu_write(watchdog_ev, NULL); | |
| 262 | 287 | } |
| 288 | + return ret; | |
| 263 | 289 | } |
| @@ -65,8 +65,8 @@ static int ebt_broute(struct sk_buff *skb) · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | static int __net_init broute_net_init(struct net *net) |
| 67 | 67 | { |
| 68 | − net->xt.broute_table = ebt_register_table(net, &broute_table, NULL); | |
| 69 | − return PTR_ERR_OR_ZERO(net->xt.broute_table); | |
| 68 | + return ebt_register_table(net, &broute_table, NULL, | |
| 69 | + &net->xt.broute_table); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | static void __net_exit broute_net_exit(struct net *net) |
| @@ -93,8 +93,8 @@ static const struct nf_hook_ops ebt_ops_filter[] = { · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | static int __net_init frame_filter_net_init(struct net *net) |
| 95 | 95 | { |
| 96 | − net->xt.frame_filter = ebt_register_table(net, &frame_filter, ebt_ops_filter); | |
| 97 | − return PTR_ERR_OR_ZERO(net->xt.frame_filter); | |
| 96 | + return ebt_register_table(net, &frame_filter, ebt_ops_filter, | |
| 97 | + &net->xt.frame_filter); | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static void __net_exit frame_filter_net_exit(struct net *net) |
| @@ -93,8 +93,8 @@ static const struct nf_hook_ops ebt_ops_nat[] = { · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | static int __net_init frame_nat_net_init(struct net *net) |
| 95 | 95 | { |
| 96 | − net->xt.frame_nat = ebt_register_table(net, &frame_nat, ebt_ops_nat); | |
| 97 | − return PTR_ERR_OR_ZERO(net->xt.frame_nat); | |
| 96 | + return ebt_register_table(net, &frame_nat, ebt_ops_nat, | |
| 97 | + &net->xt.frame_nat); | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | static void __net_exit frame_nat_net_exit(struct net *net) |
| @@ -1169,9 +1169,8 @@ static void __ebt_unregister_table(struct net *net, struct ebt_table *table) · 1168 unmodified lines | ||
| 1169 | 1169 | kfree(table); |
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | −struct ebt_table * | |
| 1173 | −ebt_register_table(struct net *net, const struct ebt_table *input_table, | |
| 1174 | − const struct nf_hook_ops *ops) | |
| 1172 | +int ebt_register_table(struct net *net, const struct ebt_table *input_table, | |
| 1173 | + const struct nf_hook_ops *ops, struct ebt_table **res) | |
| 1175 | 1174 | { |
| 1176 | 1175 | struct ebt_table_info *newinfo; |
| 1177 | 1176 | struct ebt_table *t, *table; |
| @@ -1183,7 +1182,7 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table, · 5 unmodified lines | ||
| 1183 | 1182 | repl->entries == NULL || repl->entries_size == 0 || |
| 1184 | 1183 | repl->counters != NULL || input_table->private != NULL) { |
| 1185 | 1184 | BUGPRINT("Bad table data for ebt_register_table!!!\n"); |
| 1186 | − return ERR_PTR(-EINVAL); | |
| 1185 | + return -EINVAL; | |
| 1187 | 1186 | } |
| 1188 | 1187 | |
| 1189 | 1188 | /* Don't add one table to multiple lists. */ |
| @@ -1252,16 +1251,18 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table, · 62 unmodified lines | ||
| 1252 | 1251 | list_add(&table->list, &net->xt.tables[NFPROTO_BRIDGE]); |
| 1253 | 1252 | mutex_unlock(&ebt_mutex); |
| 1254 | 1253 | |
| 1254 | + WRITE_ONCE(*res, table); | |
| 1255 | + | |
| 1255 | 1256 | if (!ops) |
| 1256 | − return table; | |
| 1257 | + return 0; | |
| 1257 | 1258 | |
| 1258 | 1259 | ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks)); |
| 1259 | 1260 | if (ret) { |
| 1260 | 1261 | __ebt_unregister_table(net, table); |
| 1261 | − return ERR_PTR(ret); | |
| 1262 | + *res = NULL; | |
| 1262 | 1263 | } |
| 1263 | 1264 | |
| 1264 | − return table; | |
| 1265 | + return ret; | |
| 1265 | 1266 | free_unlock: |
| 1266 | 1267 | mutex_unlock(&ebt_mutex); |
| 1267 | 1268 | free_chainstack: |
| @@ -1276,7 +1277,7 @@ free_newinfo: · 8 unmodified lines | ||
| 1276 | 1277 | free_table: |
| 1277 | 1278 | kfree(table); |
| 1278 | 1279 | out: |
| 1279 | − return ERR_PTR(ret); | |
| 1280 | + return ret; | |
| 1280 | 1281 | } |
| 1281 | 1282 | |
| 1282 | 1283 | void ebt_unregister_table(struct net *net, struct ebt_table *table, |
| @@ -86,7 +86,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, · 85 unmodified lines | ||
| 86 | 86 | greh = (struct gre_base_hdr *)skb_transport_header(skb); |
| 87 | 87 | pcsum = (__sum16 *)(greh + 1); |
| 88 | 88 | |
| 89 | − if (gso_partial) { | |
| 89 | + if (gso_partial && skb_is_gso(skb)) { | |
| 90 | 90 | unsigned int partial_adj; |
| 91 | 91 | |
| 92 | 92 | /* Adjust checksum to account for the fact that |
| @@ -330,7 +330,8 @@ static unsigned int ipv4_synproxy_hook(void *priv, · 329 unmodified lines | ||
| 330 | 330 | if (synproxy == NULL) |
| 331 | 331 | return NF_ACCEPT; |
| 332 | 332 | |
| 333 | − if (nf_is_loopback_packet(skb)) | |
| 333 | + if (nf_is_loopback_packet(skb) || | |
| 334 | + ip_hdr(skb)->protocol != IPPROTO_TCP) | |
| 334 | 335 | return NF_ACCEPT; |
| 335 | 336 | |
| 336 | 337 | thoff = ip_hdrlen(skb); |
| @@ -2513,7 +2513,7 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or · 2512 unmodified lines | ||
| 2513 | 2513 | struct rtable *ort = (struct rtable *) dst_orig; |
| 2514 | 2514 | struct rtable *rt; |
| 2515 | 2515 | |
| 2516 | − rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_NONE, 0); | |
| 2516 | + rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, 1, DST_OBSOLETE_DEAD, 0); | |
| 2517 | 2517 | if (rt) { |
| 2518 | 2518 | struct dst_entry *new = &rt->dst; |
| 2519 | 2519 | |
| @@ -2239,20 +2239,16 @@ int udp_v4_early_demux(struct sk_buff *skb) · 2238 unmodified lines | ||
| 2239 | 2239 | iph = ip_hdr(skb); |
| 2240 | 2240 | uh = udp_hdr(skb); |
| 2241 | 2241 | |
| 2242 | − if (skb->pkt_type == PACKET_BROADCAST || | |
| 2243 | − skb->pkt_type == PACKET_MULTICAST) { | |
| 2242 | + if (skb->pkt_type == PACKET_MULTICAST) { | |
| 2244 | 2243 | in_dev = __in_dev_get_rcu(skb->dev); |
| 2245 | 2244 | |
| 2246 | 2245 | if (!in_dev) |
| 2247 | 2246 | return 0; |
| 2248 | 2247 | |
| 2249 | − /* we are supposed to accept bcast packets */ | |
| 2250 | − if (skb->pkt_type == PACKET_MULTICAST) { | |
| 2251 | − ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, | |
| 2252 | − iph->protocol); | |
| 2253 | − if (!ours) | |
| 2254 | − return 0; | |
| 2255 | − } | |
| 2248 | + ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, | |
| 2249 | + iph->protocol); | |
| 2250 | + if (!ours) | |
| 2251 | + return 0; | |
| 2256 | 2252 | |
| 2257 | 2253 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, |
| 2258 | 2254 | uh->source, iph->saddr, |
| @@ -120,7 +120,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, · 119 unmodified lines | ||
| 120 | 120 | * will be using a length value equal to only one MSS sized |
| 121 | 121 | * segment instead of the entire frame. |
| 122 | 122 | */ |
| 123 | − if (gso_partial) { | |
| 123 | + if (gso_partial && skb_is_gso(skb)) { | |
| 124 | 124 | uh->len = htons(skb_shinfo(skb)->gso_size + |
| 125 | 125 | SKB_GSO_CB(skb)->data_offset + |
| 126 | 126 | skb->head - (unsigned char *)uh); |
| @@ -3800,8 +3800,8 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) · 3799 unmodified lines | ||
| 3800 | 3800 | goto out; |
| 3801 | 3801 | |
| 3802 | 3802 | if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) || |
| 3803 | − dev_net(dev)->ipv6.devconf_all->accept_dad < 1 || | |
| 3804 | − idev->cnf.accept_dad < 1 || | |
| 3803 | + (dev_net(dev)->ipv6.devconf_all->accept_dad < 1 && | |
| 3804 | + idev->cnf.accept_dad < 1) || | |
| 3805 | 3805 | !(ifp->flags&IFA_F_TENTATIVE) || |
| 3806 | 3806 | ifp->flags & IFA_F_NODAD) { |
| 3807 | 3807 | bump_id = ifp->flags & IFA_F_TENTATIVE; |
| @@ -105,7 +105,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, · 104 unmodified lines | ||
| 105 | 105 | |
| 106 | 106 | for (skb = segs; skb; skb = skb->next) { |
| 107 | 107 | ipv6h = (struct ipv6hdr *)(skb_mac_header(skb) + nhoff); |
| 108 | − if (gso_partial) | |
| 108 | + if (gso_partial && skb_is_gso(skb)) | |
| 109 | 109 | payload_len = skb_shinfo(skb)->gso_size + |
| 110 | 110 | SKB_GSO_CB(skb)->data_offset + |
| 111 | 111 | skb->head - (unsigned char *)(ipv6h + 1); |
| @@ -353,7 +353,7 @@ static unsigned int ipv6_synproxy_hook(void *priv, · 352 unmodified lines | ||
| 353 | 353 | nexthdr = ipv6_hdr(skb)->nexthdr; |
| 354 | 354 | thoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr, |
| 355 | 355 | &frag_off); |
| 356 | − if (thoff < 0) | |
| 356 | + if (thoff < 0 || nexthdr != IPPROTO_TCP) | |
| 357 | 357 | return NF_ACCEPT; |
| 358 | 358 | |
| 359 | 359 | th = skb_header_pointer(skb, thoff, sizeof(_th), &_th); |
| @@ -1877,7 +1877,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori · 1876 unmodified lines | ||
| 1877 | 1877 | struct dst_entry *new = NULL; |
| 1878 | 1878 | |
| 1879 | 1879 | rt = dst_alloc(&ip6_dst_blackhole_ops, loopback_dev, 1, |
| 1880 | − DST_OBSOLETE_NONE, 0); | |
| 1880 | + DST_OBSOLETE_DEAD, 0); | |
| 1881 | 1881 | if (rt) { |
| 1882 | 1882 | rt6_info_init(rt); |
| 1883 | 1883 | atomic_inc(&net->ipv6.rt6_stats->fib_rt_alloc); |
| @@ -1191,14 +1191,17 @@ static int ip_set_swap(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 1190 unmodified lines | ||
| 1191 | 1191 | from->family == to->family)) |
| 1192 | 1192 | return -IPSET_ERR_TYPE_MISMATCH; |
| 1193 | 1193 | |
| 1194 | − if (from->ref_netlink || to->ref_netlink) | |
| 1194 | + write_lock_bh(&ip_set_ref_lock); | |
| 1195 | + | |
| 1196 | + if (from->ref_netlink || to->ref_netlink) { | |
| 1197 | + write_unlock_bh(&ip_set_ref_lock); | |
| 1195 | 1198 | return -EBUSY; |
| 1199 | + } | |
| 1196 | 1200 | |
| 1197 | 1201 | strncpy(from_name, from->name, IPSET_MAXNAMELEN); |
| 1198 | 1202 | strncpy(from->name, to->name, IPSET_MAXNAMELEN); |
| 1199 | 1203 | strncpy(to->name, from_name, IPSET_MAXNAMELEN); |
| 1200 | 1204 | |
| 1201 | − write_lock_bh(&ip_set_ref_lock); | |
| 1202 | 1205 | swap(from->ref, to->ref); |
| 1203 | 1206 | ip_set(inst, from_id) = to; |
| 1204 | 1207 | ip_set(inst, to_id) = from; |
| @@ -2072,25 +2075,28 @@ static struct pernet_operations ip_set_net_ops = { · 867 unmodified lines | ||
| 2072 | 2075 | static int __init |
| 2073 | 2076 | ip_set_init(void) |
| 2074 | 2077 | { |
| 2075 | − int ret = nfnetlink_subsys_register(&ip_set_netlink_subsys); | |
| 2078 | + int ret = register_pernet_subsys(&ip_set_net_ops); | |
| 2079 | + | |
| 2080 | + if (ret) { | |
| 2081 | + pr_err("ip_set: cannot register pernet_subsys.\n"); | |
| 2082 | + return ret; | |
| 2083 | + } | |
| 2076 | 2084 | |
| 2085 | + ret = nfnetlink_subsys_register(&ip_set_netlink_subsys); | |
| 2077 | 2086 | if (ret != 0) { |
| 2078 | 2087 | pr_err("ip_set: cannot register with nfnetlink.\n"); |
| 2088 | + unregister_pernet_subsys(&ip_set_net_ops); | |
| 2079 | 2089 | return ret; |
| 2080 | 2090 | } |
| 2091 | + | |
| 2081 | 2092 | ret = nf_register_sockopt(&so_set); |
| 2082 | 2093 | if (ret != 0) { |
| 2083 | 2094 | pr_err("SO_SET registry failed: %d\n", ret); |
| 2084 | 2095 | nfnetlink_subsys_unregister(&ip_set_netlink_subsys); |
| 2096 | + unregister_pernet_subsys(&ip_set_net_ops); | |
| 2085 | 2097 | return ret; |
| 2086 | 2098 | } |
| 2087 | − ret = register_pernet_subsys(&ip_set_net_ops); | |
| 2088 | − if (ret) { | |
| 2089 | − pr_err("ip_set: cannot register pernet_subsys.\n"); | |
| 2090 | − nf_unregister_sockopt(&so_set); | |
| 2091 | − nfnetlink_subsys_unregister(&ip_set_netlink_subsys); | |
| 2092 | − return ret; | |
| 2093 | − } | |
| 2099 | + | |
| 2094 | 2100 | pr_info("ip_set: protocol %u\n", IPSET_PROTOCOL); |
| 2095 | 2101 | return 0; |
| 2096 | 2102 | } |
| @@ -2098,9 +2104,10 @@ ip_set_init(void) · 1 unmodified line | ||
| 2098 | 2104 | static void __exit |
| 2099 | 2105 | ip_set_fini(void) |
| 2100 | 2106 | { |
| 2101 | − unregister_pernet_subsys(&ip_set_net_ops); | |
| 2102 | 2107 | nf_unregister_sockopt(&so_set); |
| 2103 | 2108 | nfnetlink_subsys_unregister(&ip_set_netlink_subsys); |
| 2109 | + | |
| 2110 | + unregister_pernet_subsys(&ip_set_net_ops); | |
| 2104 | 2111 | pr_debug("these are the famous last words\n"); |
| 2105 | 2112 | } |
| 2106 | 2113 | |
| @@ -123,13 +123,12 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 122 unmodified lines | ||
| 123 | 123 | return ret; |
| 124 | 124 | |
| 125 | 125 | ip &= ip_set_hostmask(h->netmask); |
| 126 | + e.ip = htonl(ip); | |
| 127 | + if (e.ip == 0) | |
| 128 | + return -IPSET_ERR_HASH_ELEM; | |
| 126 | 129 | |
| 127 | − if (adt == IPSET_TEST) { | |
| 128 | − e.ip = htonl(ip); | |
| 129 | − if (e.ip == 0) | |
| 130 | − return -IPSET_ERR_HASH_ELEM; | |
| 130 | + if (adt == IPSET_TEST) | |
| 131 | 131 | return adtfn(set, &e, &ext, &ext, flags); |
| 132 | − } | |
| 133 | 132 | |
| 134 | 133 | ip_to = ip; |
| 135 | 134 | if (tb[IPSET_ATTR_IP_TO]) { |
| @@ -148,17 +147,20 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], · 12 unmodified lines | ||
| 148 | 147 | |
| 149 | 148 | hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1); |
| 150 | 149 | |
| 151 | − if (retried) | |
| 150 | + if (retried) { | |
| 152 | 151 | ip = ntohl(h->next.ip); |
| 153 | − for (; !before(ip_to, ip); ip += hosts) { | |
| 154 | 152 | e.ip = htonl(ip); |
| 155 | − if (e.ip == 0) | |
| 156 | − return -IPSET_ERR_HASH_ELEM; | |
| 153 | + } | |
| 154 | + for (; ip <= ip_to;) { | |
| 157 | 155 | ret = adtfn(set, &e, &ext, &ext, flags); |
| 158 | − | |
| 159 | 156 | if (ret && !ip_set_eexist(ret, flags)) |
| 160 | 157 | return ret; |
| 161 | 158 | |
| 159 | + ip += hosts; | |
| 160 | + e.ip = htonl(ip); | |
| 161 | + if (e.ip == 0) | |
| 162 | + return 0; | |
| 163 | + | |
| 162 | 164 | ret = 0; |
| 163 | 165 | } |
| 164 | 166 | return ret; |
| @@ -149,7 +149,7 @@ hash_ipmark4_uadt(struct ip_set *set, struct nlattr *tb[], · 148 unmodified lines | ||
| 149 | 149 | |
| 150 | 150 | if (retried) |
| 151 | 151 | ip = ntohl(h->next.ip); |
| 152 | − for (; !before(ip_to, ip); ip++) { | |
| 152 | + for (; ip <= ip_to; ip++) { | |
| 153 | 153 | e.ip = htonl(ip); |
| 154 | 154 | ret = adtfn(set, &e, &ext, &ext, flags); |
| 155 | 155 | |
| @@ -178,7 +178,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], · 177 unmodified lines | ||
| 178 | 178 | |
| 179 | 179 | if (retried) |
| 180 | 180 | ip = ntohl(h->next.ip); |
| 181 | − for (; !before(ip_to, ip); ip++) { | |
| 181 | + for (; ip <= ip_to; ip++) { | |
| 182 | 182 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
| 183 | 183 | : port; |
| 184 | 184 | for (; p <= port_to; p++) { |
| @@ -185,7 +185,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], · 184 unmodified lines | ||
| 185 | 185 | |
| 186 | 186 | if (retried) |
| 187 | 187 | ip = ntohl(h->next.ip); |
| 188 | − for (; !before(ip_to, ip); ip++) { | |
| 188 | + for (; ip <= ip_to; ip++) { | |
| 189 | 189 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
| 190 | 190 | : port; |
| 191 | 191 | for (; p <= port_to; p++) { |
| @@ -271,7 +271,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 270 unmodified lines | ||
| 271 | 271 | |
| 272 | 272 | if (retried) |
| 273 | 273 | ip = ntohl(h->next.ip); |
| 274 | − for (; !before(ip_to, ip); ip++) { | |
| 274 | + for (; ip <= ip_to; ip++) { | |
| 275 | 275 | e.ip = htonl(ip); |
| 276 | 276 | p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port) |
| 277 | 277 | : port; |
| @@ -281,7 +281,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 3 unmodified lines | ||
| 281 | 281 | ip == ntohl(h->next.ip) && |
| 282 | 282 | p == ntohs(h->next.port) |
| 283 | 283 | ? ntohl(h->next.ip2) : ip2_from; |
| 284 | − while (!after(ip2, ip2_to)) { | |
| 284 | + while (ip2 <= ip2_to) { | |
| 285 | 285 | e.ip2 = htonl(ip2); |
| 286 | 286 | ip2_last = ip_set_range_to_cidr(ip2, ip2_to, |
| 287 | 287 | &cidr); |
| @@ -193,7 +193,7 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[], · 192 unmodified lines | ||
| 193 | 193 | } |
| 194 | 194 | if (retried) |
| 195 | 195 | ip = ntohl(h->next.ip); |
| 196 | − while (!after(ip, ip_to)) { | |
| 196 | + while (ip <= ip_to) { | |
| 197 | 197 | e.ip = htonl(ip); |
| 198 | 198 | last = ip_set_range_to_cidr(ip, ip_to, &e.cidr); |
| 199 | 199 | ret = adtfn(set, &e, &ext, &ext, flags); |
| @@ -255,7 +255,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[], · 254 unmodified lines | ||
| 255 | 255 | |
| 256 | 256 | if (retried) |
| 257 | 257 | ip = ntohl(h->next.ip); |
| 258 | − while (!after(ip, ip_to)) { | |
| 258 | + while (ip <= ip_to) { | |
| 259 | 259 | e.ip = htonl(ip); |
| 260 | 260 | last = ip_set_range_to_cidr(ip, ip_to, &e.cidr); |
| 261 | 261 | ret = adtfn(set, &e, &ext, &ext, flags); |
| @@ -250,13 +250,13 @@ hash_netnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 249 unmodified lines | ||
| 250 | 250 | if (retried) |
| 251 | 251 | ip = ntohl(h->next.ip[0]); |
| 252 | 252 | |
| 253 | − while (!after(ip, ip_to)) { | |
| 253 | + while (ip <= ip_to) { | |
| 254 | 254 | e.ip[0] = htonl(ip); |
| 255 | 255 | last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]); |
| 256 | 256 | ip2 = (retried && |
| 257 | 257 | ip == ntohl(h->next.ip[0])) ? ntohl(h->next.ip[1]) |
| 258 | 258 | : ip2_from; |
| 259 | − while (!after(ip2, ip2_to)) { | |
| 259 | + while (ip2 <= ip2_to) { | |
| 260 | 260 | e.ip[1] = htonl(ip2); |
| 261 | 261 | last2 = ip_set_range_to_cidr(ip2, ip2_to, &e.cidr[1]); |
| 262 | 262 | ret = adtfn(set, &e, &ext, &ext, flags); |
| @@ -241,7 +241,7 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[], · 240 unmodified lines | ||
| 241 | 241 | |
| 242 | 242 | if (retried) |
| 243 | 243 | ip = ntohl(h->next.ip); |
| 244 | − while (!after(ip, ip_to)) { | |
| 244 | + while (ip <= ip_to) { | |
| 245 | 245 | e.ip = htonl(ip); |
| 246 | 246 | last = ip_set_range_to_cidr(ip, ip_to, &cidr); |
| 247 | 247 | e.cidr = cidr - 1; |
| @@ -291,7 +291,7 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 290 unmodified lines | ||
| 291 | 291 | if (retried) |
| 292 | 292 | ip = ntohl(h->next.ip[0]); |
| 293 | 293 | |
| 294 | − while (!after(ip, ip_to)) { | |
| 294 | + while (ip <= ip_to) { | |
| 295 | 295 | e.ip[0] = htonl(ip); |
| 296 | 296 | ip_last = ip_set_range_to_cidr(ip, ip_to, &e.cidr[0]); |
| 297 | 297 | p = retried && ip == ntohl(h->next.ip[0]) ? ntohs(h->next.port) |
| @@ -301,7 +301,7 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], · 3 unmodified lines | ||
| 301 | 301 | ip2 = (retried && ip == ntohl(h->next.ip[0]) && |
| 302 | 302 | p == ntohs(h->next.port)) ? ntohl(h->next.ip[1]) |
| 303 | 303 | : ip2_from; |
| 304 | − while (!after(ip2, ip2_to)) { | |
| 304 | + while (ip2 <= ip2_to) { | |
| 305 | 305 | e.ip[1] = htonl(ip2); |
| 306 | 306 | ip2_last = ip_set_range_to_cidr(ip2, ip2_to, |
| 307 | 307 | &e.cidr[1]); |
| @@ -921,6 +921,7 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 920 unmodified lines | ||
| 921 | 921 | { |
| 922 | 922 | struct sk_buff *new_skb = NULL; |
| 923 | 923 | struct iphdr *old_iph = NULL; |
| 924 | + __u8 old_dsfield; | |
| 924 | 925 | #ifdef CONFIG_IP_VS_IPV6 |
| 925 | 926 | struct ipv6hdr *old_ipv6h = NULL; |
| 926 | 927 | #endif |
| @@ -945,7 +946,7 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 18 unmodified lines | ||
| 945 | 946 | *payload_len = |
| 946 | 947 | ntohs(old_ipv6h->payload_len) + |
| 947 | 948 | sizeof(*old_ipv6h); |
| 948 | − *dsfield = ipv6_get_dsfield(old_ipv6h); | |
| 949 | + old_dsfield = ipv6_get_dsfield(old_ipv6h); | |
| 949 | 950 | *ttl = old_ipv6h->hop_limit; |
| 950 | 951 | if (df) |
| 951 | 952 | *df = 0; |
| @@ -960,12 +961,15 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, · 8 unmodified lines | ||
| 960 | 961 | |
| 961 | 962 | /* fix old IP header checksum */ |
| 962 | 963 | ip_send_check(old_iph); |
| 963 | − *dsfield = ipv4_get_dsfield(old_iph); | |
| 964 | + old_dsfield = ipv4_get_dsfield(old_iph); | |
| 964 | 965 | *ttl = old_iph->ttl; |
| 965 | 966 | if (payload_len) |
| 966 | 967 | *payload_len = ntohs(old_iph->tot_len); |
| 967 | 968 | } |
| 968 | 969 | |
| 970 | + /* Implement full-functionality option for ECN encapsulation */ | |
| 971 | + *dsfield = INET_ECN_encapsulate(old_dsfield, old_dsfield); | |
| 972 | + | |
| 969 | 973 | return skb; |
| 970 | 974 | error: |
| 971 | 975 | kfree_skb(skb); |
| @@ -1048,7 +1048,7 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, · 1047 unmodified lines | ||
| 1048 | 1048 | if (nla_put_string(skb, NFTA_CHAIN_TYPE, basechain->type->name)) |
| 1049 | 1049 | goto nla_put_failure; |
| 1050 | 1050 | |
| 1051 | − if (nft_dump_stats(skb, nft_base_chain(chain)->stats)) | |
| 1051 | + if (basechain->stats && nft_dump_stats(skb, basechain->stats)) | |
| 1052 | 1052 | goto nla_put_failure; |
| 1053 | 1053 | } |
| 1054 | 1054 | |
| @@ -1487,8 +1487,8 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 432 unmodified lines | ||
| 1487 | 1487 | |
| 1488 | 1488 | chain2 = nf_tables_chain_lookup(table, nla[NFTA_CHAIN_NAME], |
| 1489 | 1489 | genmask); |
| 1490 | − if (IS_ERR(chain2)) | |
| 1491 | − return PTR_ERR(chain2); | |
| 1490 | + if (!IS_ERR(chain2)) | |
| 1491 | + return -EEXIST; | |
| 1492 | 1492 | } |
| 1493 | 1493 | |
| 1494 | 1494 | if (nla[NFTA_CHAIN_COUNTERS]) { |
| @@ -2741,8 +2741,10 @@ cont: · 1246 unmodified lines | ||
| 2741 | 2741 | list_for_each_entry(i, &ctx->table->sets, list) { |
| 2742 | 2742 | if (!nft_is_active_next(ctx->net, i)) |
| 2743 | 2743 | continue; |
| 2744 | − if (!strcmp(set->name, i->name)) | |
| 2744 | + if (!strcmp(set->name, i->name)) { | |
| 2745 | + kfree(set->name); | |
| 2745 | 2746 | return -ENFILE; |
| 2747 | + } | |
| 2746 | 2748 | } |
| 2747 | 2749 | return 0; |
| 2748 | 2750 | } |
| @@ -892,7 +892,7 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len, · 891 unmodified lines | ||
| 892 | 892 | if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0) |
| 893 | 893 | return ERR_PTR(-EFAULT); |
| 894 | 894 | |
| 895 | − strlcpy(info->name, compat_tmp.name, sizeof(info->name)); | |
| 895 | + memcpy(info->name, compat_tmp.name, sizeof(info->name) - 1); | |
| 896 | 896 | info->num_counters = compat_tmp.num_counters; |
| 897 | 897 | user += sizeof(compat_tmp); |
| 898 | 898 | } else |
| @@ -905,9 +905,9 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len, · 6 unmodified lines | ||
| 905 | 905 | if (copy_from_user(info, user, sizeof(*info)) != 0) |
| 906 | 906 | return ERR_PTR(-EFAULT); |
| 907 | 907 | |
| 908 | − info->name[sizeof(info->name) - 1] = '\0'; | |
| 909 | 908 | user += sizeof(*info); |
| 910 | 909 | } |
| 910 | + info->name[sizeof(info->name) - 1] = '\0'; | |
| 911 | 911 | |
| 912 | 912 | size = sizeof(struct xt_counters); |
| 913 | 913 | size *= info->num_counters; |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | #include <linux/module.h> |
| 11 | +#include <linux/syscalls.h> | |
| 11 | 12 | #include <linux/skbuff.h> |
| 12 | 13 | #include <linux/filter.h> |
| 13 | 14 | #include <linux/bpf.h> |
| @@ -49,6 +50,22 @@ static int __bpf_mt_check_fd(int fd, struct bpf_prog **ret) · 35 unmodified lines | ||
| 49 | 50 | return 0; |
| 50 | 51 | } |
| 51 | 52 | |
| 53 | +static int __bpf_mt_check_path(const char *path, struct bpf_prog **ret) | |
| 54 | +{ | |
| 55 | + mm_segment_t oldfs = get_fs(); | |
| 56 | + int retval, fd; | |
| 57 | + | |
| 58 | + set_fs(KERNEL_DS); | |
| 59 | + fd = bpf_obj_get_user(path); | |
| 60 | + set_fs(oldfs); | |
| 61 | + if (fd < 0) | |
| 62 | + return fd; | |
| 63 | + | |
| 64 | + retval = __bpf_mt_check_fd(fd, ret); | |
| 65 | + sys_close(fd); | |
| 66 | + return retval; | |
| 67 | +} | |
| 68 | + | |
| 52 | 69 | static int bpf_mt_check(const struct xt_mtchk_param *par) |
| 53 | 70 | { |
| 54 | 71 | struct xt_bpf_info *info = par->matchinfo; |
| @@ -66,9 +83,10 @@ static int bpf_mt_check_v1(const struct xt_mtchk_param *par) · 11 unmodified lines | ||
| 66 | 83 | return __bpf_mt_check_bytecode(info->bpf_program, |
| 67 | 84 | info->bpf_program_num_elem, |
| 68 | 85 | &info->filter); |
| 69 | − else if (info->mode == XT_BPF_MODE_FD_PINNED || | |
| 70 | − info->mode == XT_BPF_MODE_FD_ELF) | |
| 86 | + else if (info->mode == XT_BPF_MODE_FD_ELF) | |
| 71 | 87 | return __bpf_mt_check_fd(info->fd, &info->filter); |
| 88 | + else if (info->mode == XT_BPF_MODE_PATH_PINNED) | |
| 89 | + return __bpf_mt_check_path(info->path, &info->filter); | |
| 72 | 90 | else |
| 73 | 91 | return -EINVAL; |
| 74 | 92 | } |
| @@ -76,7 +76,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, · 75 unmodified lines | ||
| 76 | 76 | transparent = nf_sk_is_transparent(sk); |
| 77 | 77 | |
| 78 | 78 | if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard && |
| 79 | − transparent) | |
| 79 | + transparent && sk_fullsock(sk)) | |
| 80 | 80 | pskb->mark = sk->sk_mark; |
| 81 | 81 | |
| 82 | 82 | if (sk != skb->sk) |
| @@ -133,7 +133,7 @@ socket_mt6_v1_v2_v3(const struct sk_buff *skb, struct xt_action_param *par) · 50 unmodified lines | ||
| 133 | 133 | transparent = nf_sk_is_transparent(sk); |
| 134 | 134 | |
| 135 | 135 | if (info->flags & XT_SOCKET_RESTORESKMARK && !wildcard && |
| 136 | − transparent) | |
| 136 | + transparent && sk_fullsock(sk)) | |
| 137 | 137 | pskb->mark = sk->sk_mark; |
| 138 | 138 | |
| 139 | 139 | if (sk != skb->sk) |
| @@ -2266,16 +2266,17 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb, · 2265 unmodified lines | ||
| 2266 | 2266 | cb->min_dump_alloc = control->min_dump_alloc; |
| 2267 | 2267 | cb->skb = skb; |
| 2268 | 2268 | |
| 2269 | + if (cb->start) { | |
| 2270 | + ret = cb->start(cb); | |
| 2271 | + if (ret) | |
| 2272 | + goto error_unlock; | |
| 2273 | + } | |
| 2274 | + | |
| 2269 | 2275 | nlk->cb_running = true; |
| 2270 | 2276 | |
| 2271 | 2277 | mutex_unlock(nlk->cb_mutex); |
| 2272 | 2278 | |
| 2273 | − ret = 0; | |
| 2274 | − if (cb->start) | |
| 2275 | − ret = cb->start(cb); | |
| 2276 | − | |
| 2277 | − if (!ret) | |
| 2278 | − ret = netlink_dump(sk); | |
| 2279 | + ret = netlink_dump(sk); | |
| 2279 | 2280 | |
| 2280 | 2281 | sock_put(sk); |
| 2281 | 2282 | |
| @@ -2203,7 +2203,7 @@ static void xs_udp_setup_socket(struct work_struct *work) · 2202 unmodified lines | ||
| 2203 | 2203 | struct sock_xprt *transport = |
| 2204 | 2204 | container_of(work, struct sock_xprt, connect_worker.work); |
| 2205 | 2205 | struct rpc_xprt *xprt = &transport->xprt; |
| 2206 | − struct socket *sock = transport->sock; | |
| 2206 | + struct socket *sock; | |
| 2207 | 2207 | int status = -EIO; |
| 2208 | 2208 | |
| 2209 | 2209 | sock = xs_create_sock(xprt, transport, |
| @@ -233,7 +233,7 @@ static int tipc_bcast_xmit(struct net *net, struct sk_buff_head *pkts, · 232 unmodified lines | ||
| 233 | 233 | struct sk_buff_head xmitq; |
| 234 | 234 | int rc = 0; |
| 235 | 235 | |
| 236 | − __skb_queue_head_init(&xmitq); | |
| 236 | + skb_queue_head_init(&xmitq); | |
| 237 | 237 | tipc_bcast_lock(net); |
| 238 | 238 | if (tipc_link_bc_peers(l)) |
| 239 | 239 | rc = tipc_link_xmit(l, pkts, &xmitq); |
| @@ -263,7 +263,7 @@ static int tipc_rcast_xmit(struct net *net, struct sk_buff_head *pkts, · 23 unmodified lines | ||
| 263 | 263 | u32 dst, selector; |
| 264 | 264 | |
| 265 | 265 | selector = msg_link_selector(buf_msg(skb_peek(pkts))); |
| 266 | − __skb_queue_head_init(&_pkts); | |
| 266 | + skb_queue_head_init(&_pkts); | |
| 267 | 267 | |
| 268 | 268 | list_for_each_entry_safe(n, tmp, &dests->list, list) { |
| 269 | 269 | dst = n->value; |
| @@ -568,6 +568,14 @@ bool tipc_msg_lookup_dest(struct net *net, struct sk_buff *skb, int *err) · 567 unmodified lines | ||
| 568 | 568 | msg_set_destnode(msg, dnode); |
| 569 | 569 | msg_set_destport(msg, dport); |
| 570 | 570 | *err = TIPC_OK; |
| 571 | + | |
| 572 | + if (!skb_cloned(skb)) | |
| 573 | + return true; | |
| 574 | + | |
| 575 | + /* Unclone buffer in case it was bundled */ | |
| 576 | + if (pskb_expand_head(skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC)) | |
| 577 | + return false; | |
| 578 | + | |
| 571 | 579 | return true; |
| 572 | 580 | } |
| 573 | 581 | |
| @@ -549,6 +549,14 @@ nl80211_nan_srf_policy[NL80211_NAN_SRF_ATTR_MAX + 1] = { · 548 unmodified lines | ||
| 549 | 549 | [NL80211_NAN_SRF_MAC_ADDRS] = { .type = NLA_NESTED }, |
| 550 | 550 | }; |
| 551 | 551 | |
| 552 | +/* policy for packet pattern attributes */ | |
| 553 | +static const struct nla_policy | |
| 554 | +nl80211_packet_pattern_policy[MAX_NL80211_PKTPAT + 1] = { | |
| 555 | + [NL80211_PKTPAT_MASK] = { .type = NLA_BINARY, }, | |
| 556 | + [NL80211_PKTPAT_PATTERN] = { .type = NLA_BINARY, }, | |
| 557 | + [NL80211_PKTPAT_OFFSET] = { .type = NLA_U32 }, | |
| 558 | +}; | |
| 559 | + | |
| 552 | 560 | static int nl80211_prepare_wdev_dump(struct sk_buff *skb, |
| 553 | 561 | struct netlink_callback *cb, |
| 554 | 562 | struct cfg80211_registered_device **rdev, |
| @@ -10532,7 +10540,8 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) · 9977 unmodified lines | ||
| 10532 | 10540 | u8 *mask_pat; |
| 10533 | 10541 | |
| 10534 | 10542 | nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, |
| 10535 | − NULL, info->extack); | |
| 10543 | + nl80211_packet_pattern_policy, | |
| 10544 | + info->extack); | |
| 10536 | 10545 | err = -EINVAL; |
| 10537 | 10546 | if (!pat_tb[NL80211_PKTPAT_MASK] || |
| 10538 | 10547 | !pat_tb[NL80211_PKTPAT_PATTERN]) |
| @@ -10781,7 +10790,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, · 242 unmodified lines | ||
| 10781 | 10790 | rem) { |
| 10782 | 10791 | u8 *mask_pat; |
| 10783 | 10792 | |
| 10784 | − nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, NULL, NULL); | |
| 10793 | + nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, | |
| 10794 | + nl80211_packet_pattern_policy, NULL); | |
| 10785 | 10795 | if (!pat_tb[NL80211_PKTPAT_MASK] || |
| 10786 | 10796 | !pat_tb[NL80211_PKTPAT_PATTERN]) |
| 10787 | 10797 | return -EINVAL; |
| @@ -91,6 +91,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, · 90 unmodified lines | ||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) { |
| 94 | + xso->dev = NULL; | |
| 94 | 95 | dev_put(dev); |
| 95 | 96 | return 0; |
| 96 | 97 | } |
| @@ -429,7 +429,8 @@ resume: · 428 unmodified lines | ||
| 429 | 429 | nf_reset(skb); |
| 430 | 430 | |
| 431 | 431 | if (decaps) { |
| 432 | − skb->sp->olen = 0; | |
| 432 | + if (skb->sp) | |
| 433 | + skb->sp->olen = 0; | |
| 433 | 434 | skb_dst_drop(skb); |
| 434 | 435 | gro_cells_receive(&gro_cells, skb); |
| 435 | 436 | return 0; |
| @@ -440,7 +441,8 @@ resume: · 4 unmodified lines | ||
| 440 | 441 | |
| 441 | 442 | err = x->inner_mode->afinfo->transport_finish(skb, xfrm_gro || async); |
| 442 | 443 | if (xfrm_gro) { |
| 443 | − skb->sp->olen = 0; | |
| 444 | + if (skb->sp) | |
| 445 | + skb->sp->olen = 0; | |
| 444 | 446 | skb_dst_drop(skb); |
| 445 | 447 | gro_cells_receive(&gro_cells, skb); |
| 446 | 448 | return err; |
| @@ -732,12 +732,12 @@ restart: · 731 unmodified lines | ||
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | } |
| 735 | +out: | |
| 736 | + spin_unlock_bh(&net->xfrm.xfrm_state_lock); | |
| 735 | 737 | if (cnt) { |
| 736 | 738 | err = 0; |
| 737 | 739 | xfrm_policy_cache_flush(); |
| 738 | 740 | } |
| 739 | −out: | |
| 740 | − spin_unlock_bh(&net->xfrm.xfrm_state_lock); | |
| 741 | 741 | return err; |
| 742 | 742 | } |
| 743 | 743 | EXPORT_SYMBOL(xfrm_state_flush); |
| @@ -657,6 +657,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, · 656 unmodified lines | ||
| 657 | 657 | |
| 658 | 658 | if (err < 0) { |
| 659 | 659 | x->km.state = XFRM_STATE_DEAD; |
| 660 | + xfrm_dev_state_delete(x); | |
| 660 | 661 | __xfrm_state_put(x); |
| 661 | 662 | goto out; |
| 662 | 663 | } |
| @@ -341,7 +341,7 @@ int main(int argc, char **argv) · 340 unmodified lines | ||
| 341 | 341 | return 0; |
| 342 | 342 | case 'n': |
| 343 | 343 | t = atoi(optarg); |
| 344 | − if (t > ARRAY_SIZE(test_cases)) | |
| 344 | + if (t >= ARRAY_SIZE(test_cases)) | |
| 345 | 345 | error(1, 0, "Invalid test case: %d", t); |
| 346 | 346 | all_tests = false; |
| 347 | 347 | test_cases[t].enabled = true; |