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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: Merge up fixes

We need this to get the i.MX platforms working in CI again.

+3296 -1841
+5 -4
.mailmap
··· 337 337 Karthikeyan Periyasamy <quic_periyasa@quicinc.com> <periyasa@codeaurora.org> 338 338 Kathiravan T <quic_kathirav@quicinc.com> <kathirav@codeaurora.org> 339 339 Kay Sievers <kay.sievers@vrfy.org> 340 - Kees Cook <keescook@chromium.org> <kees.cook@canonical.com> 341 - Kees Cook <keescook@chromium.org> <keescook@google.com> 342 - Kees Cook <keescook@chromium.org> <kees@outflux.net> 343 - Kees Cook <keescook@chromium.org> <kees@ubuntu.com> 340 + Kees Cook <kees@kernel.org> <kees.cook@canonical.com> 341 + Kees Cook <kees@kernel.org> <keescook@chromium.org> 342 + Kees Cook <kees@kernel.org> <keescook@google.com> 343 + Kees Cook <kees@kernel.org> <kees@outflux.net> 344 + Kees Cook <kees@kernel.org> <kees@ubuntu.com> 344 345 Keith Busch <kbusch@kernel.org> <keith.busch@intel.com> 345 346 Keith Busch <kbusch@kernel.org> <keith.busch@linux.intel.com> 346 347 Kenneth W Chen <kenneth.w.chen@intel.com>
+22
Documentation/admin-guide/kernel-parameters.txt
··· 1921 1921 Format: 1922 1922 <bus_id>,<clkrate> 1923 1923 1924 + i2c_touchscreen_props= [HW,ACPI,X86] 1925 + Set device-properties for ACPI-enumerated I2C-attached 1926 + touchscreen, to e.g. fix coordinates of upside-down 1927 + mounted touchscreens. If you need this option please 1928 + submit a drivers/platform/x86/touchscreen_dmi.c patch 1929 + adding a DMI quirk for this. 1930 + 1931 + Format: 1932 + <ACPI_HW_ID>:<prop_name>=<val>[:prop_name=val][:...] 1933 + Where <val> is one of: 1934 + Omit "=<val>" entirely Set a boolean device-property 1935 + Unsigned number Set a u32 device-property 1936 + Anything else Set a string device-property 1937 + 1938 + Examples (split over multiple lines): 1939 + i2c_touchscreen_props=GDIX1001:touchscreen-inverted-x: 1940 + touchscreen-inverted-y 1941 + 1942 + i2c_touchscreen_props=MSSL1680:touchscreen-size-x=1920: 1943 + touchscreen-size-y=1080:touchscreen-inverted-y: 1944 + firmware-name=gsl1680-vendor-model.fw:silead,home-button 1945 + 1924 1946 i8042.debug [HW] Toggle i8042 debug mode 1925 1947 i8042.unmask_kbd_data 1926 1948 [HW] Enable printing of interrupt data from the KBD port
+3 -1
Documentation/arch/riscv/uabi.rst
··· 65 65 Misaligned accesses 66 66 ------------------- 67 67 68 - Misaligned accesses are supported in userspace, but they may perform poorly. 68 + Misaligned scalar accesses are supported in userspace, but they may perform 69 + poorly. Misaligned vector accesses are only supported if the Zicclsm extension 70 + is supported.
+1 -1
Documentation/core-api/swiotlb.rst
··· 192 192 193 193 Dynamic swiotlb 194 194 --------------- 195 - When CONFIG_DYNAMIC_SWIOTLB is enabled, swiotlb can do on-demand expansion of 195 + When CONFIG_SWIOTLB_DYNAMIC is enabled, swiotlb can do on-demand expansion of 196 196 the amount of memory available for allocation as bounce buffers. If a bounce 197 197 buffer request fails due to lack of available space, an asynchronous background 198 198 task is kicked off to allocate memory from general system memory and turn it
+9 -2
Documentation/devicetree/bindings/net/pse-pd/microchip,pd692x0.yaml
··· 24 24 25 25 managers: 26 26 type: object 27 + additionalProperties: false 27 28 description: 28 29 List of the PD69208T4/PD69204T4/PD69208M PSE managers. Each manager 29 30 have 4 or 8 physical ports according to the chip version. No need to ··· 48 47 - "#size-cells" 49 48 50 49 patternProperties: 51 - "^manager@0[0-9a-b]$": 50 + "^manager@[0-9a-b]$": 52 51 type: object 52 + additionalProperties: false 53 53 description: 54 54 PD69208T4/PD69204T4/PD69208M PSE manager exposing 4 or 8 physical 55 55 ports. ··· 71 69 patternProperties: 72 70 '^port@[0-7]$': 73 71 type: object 72 + additionalProperties: false 73 + 74 + properties: 75 + reg: 76 + maxItems: 1 77 + 74 78 required: 75 79 - reg 76 - additionalProperties: false 77 80 78 81 required: 79 82 - reg
+18
Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
··· 29 29 of the ports conversion matrix that establishes relationship between 30 30 the logical ports and the physical channels. 31 31 type: object 32 + additionalProperties: false 33 + 34 + properties: 35 + "#address-cells": 36 + const: 1 37 + 38 + "#size-cells": 39 + const: 0 32 40 33 41 patternProperties: 34 42 '^channel@[0-7]$': 35 43 type: object 44 + additionalProperties: false 45 + 46 + properties: 47 + reg: 48 + maxItems: 1 49 + 36 50 required: 37 51 - reg 52 + 53 + required: 54 + - "#address-cells" 55 + - "#size-cells" 38 56 39 57 unevaluatedProperties: false 40 58
+4
Documentation/netlink/specs/netdev.yaml
··· 350 350 buffer space, host descriptors etc. 351 351 type: uint 352 352 - 353 + name: rx-csum-complete 354 + doc: Number of packets that were marked as CHECKSUM_COMPLETE. 355 + type: uint 356 + - 353 357 name: rx-csum-unnecessary 354 358 doc: Number of packets that were marked as CHECKSUM_UNNECESSARY. 355 359 type: uint
+1 -1
Documentation/process/maintainer-netdev.rst
··· 227 227 The amount of mooing will depend on packet rate so should match 228 228 the diurnal cycle quite well. 229 229 230 - Signed-of-by: Joe Defarmer <joe@barn.org> 230 + Signed-off-by: Joe Defarmer <joe@barn.org> 231 231 --- 232 232 v3: 233 233 - add a note about time-of-day mooing fluctuation to the commit message
+2 -2
MAINTAINERS
··· 3854 3854 M: Daniel Borkmann <daniel@iogearbox.net> 3855 3855 M: Alexei Starovoitov <ast@kernel.org> 3856 3856 M: Puranjay Mohan <puranjay@kernel.org> 3857 + R: Xu Kuohai <xukuohai@huaweicloud.com> 3857 3858 L: bpf@vger.kernel.org 3858 3859 S: Supported 3859 3860 F: arch/arm64/net/ ··· 5188 5187 F: drivers/media/cec/i2c/ch7322.c 5189 5188 5190 5189 CIRRUS LOGIC AUDIO CODEC DRIVERS 5191 - M: James Schulman <james.schulman@cirrus.com> 5192 5190 M: David Rhodes <david.rhodes@cirrus.com> 5193 5191 M: Richard Fitzgerald <rf@opensource.cirrus.com> 5194 5192 L: alsa-devel@alsa-project.org (moderated for non-subscribers) ··· 21316 21316 21317 21317 STARFIVE DWMAC GLUE LAYER 21318 21318 M: Emil Renner Berthing <kernel@esmil.dk> 21319 - M: Samin Guo <samin.guo@starfivetech.com> 21319 + M: Minda Chen <minda.chen@starfivetech.com> 21320 21320 S: Maintained 21321 21321 F: Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml 21322 21322 F: drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 10 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc1 5 + EXTRAVERSION = -rc2 6 6 NAME = Baby Opossum Posse 7 7 8 8 # *DOCUMENTATION*
+1 -1
arch/arc/net/bpf_jit.h
··· 39 39 40 40 /************** Functions that the back-end must provide **************/ 41 41 /* Extension for 32-bit operations. */ 42 - inline u8 zext(u8 *buf, u8 rd); 42 + u8 zext(u8 *buf, u8 rd); 43 43 /***** Moves *****/ 44 44 u8 mov_r32(u8 *buf, u8 rd, u8 rs, u8 sign_ext); 45 45 u8 mov_r32_i32(u8 *buf, u8 reg, s32 imm);
+6 -4
arch/arc/net/bpf_jit_arcv2.c
··· 62 62 * If/when we decide to add ARCv2 instructions that do use register pairs, 63 63 * the mapping, hopefully, doesn't need to be revisited. 64 64 */ 65 - const u8 bpf2arc[][2] = { 65 + static const u8 bpf2arc[][2] = { 66 66 /* Return value from in-kernel function, and exit value from eBPF */ 67 67 [BPF_REG_0] = {ARC_R_8, ARC_R_9}, 68 68 /* Arguments from eBPF program to in-kernel function */ ··· 1302 1302 1303 1303 /************* Packers (Deal with BPF_REGs) **************/ 1304 1304 1305 - inline u8 zext(u8 *buf, u8 rd) 1305 + u8 zext(u8 *buf, u8 rd) 1306 1306 { 1307 1307 if (rd != BPF_REG_FP) 1308 1308 return arc_movi_r(buf, REG_HI(rd), 0); ··· 2235 2235 break; 2236 2236 default: 2237 2237 /* The caller must have handled this. */ 2238 + break; 2238 2239 } 2239 2240 } else { 2240 2241 /* ··· 2254 2253 break; 2255 2254 default: 2256 2255 /* The caller must have handled this. */ 2256 + break; 2257 2257 } 2258 2258 } 2259 2259 ··· 2519 2517 #define JCC64_NR_OF_JMPS 3 /* Number of jumps in jcc64 template. */ 2520 2518 #define JCC64_INSNS_TO_END 3 /* Number of insn. inclusive the 2nd jmp to end. */ 2521 2519 #define JCC64_SKIP_JMP 1 /* Index of the "skip" jump to "end". */ 2522 - const struct { 2520 + static const struct { 2523 2521 /* 2524 2522 * "jit_off" is common between all "jmp[]" and is coupled with 2525 2523 * "cond" of each "jmp[]" instance. e.g.: ··· 2885 2883 * The "ARC_CC_SET" becomes "CC_unequal" because of the "tst" 2886 2884 * instruction that precedes the conditional branch. 2887 2885 */ 2888 - const u8 arcv2_32_jmps[ARC_CC_LAST] = { 2886 + static const u8 arcv2_32_jmps[ARC_CC_LAST] = { 2889 2887 [ARC_CC_UGT] = CC_great_u, 2890 2888 [ARC_CC_UGE] = CC_great_eq_u, 2891 2889 [ARC_CC_ULT] = CC_less_u,
+11 -11
arch/arc/net/bpf_jit_core.c
··· 159 159 /* Initialise the context so there's no garbage. */ 160 160 static int jit_ctx_init(struct jit_context *ctx, struct bpf_prog *prog) 161 161 { 162 - memset(ctx, 0, sizeof(ctx)); 162 + memset(ctx, 0, sizeof(*ctx)); 163 163 164 164 ctx->orig_prog = prog; 165 165 ··· 167 167 ctx->prog = bpf_jit_blind_constants(prog); 168 168 if (IS_ERR(ctx->prog)) 169 169 return PTR_ERR(ctx->prog); 170 - ctx->blinded = (ctx->prog == ctx->orig_prog ? false : true); 170 + ctx->blinded = (ctx->prog != ctx->orig_prog); 171 171 172 172 /* If the verifier doesn't zero-extend, then we have to do it. */ 173 173 ctx->do_zext = !ctx->prog->aux->verifier_zext; ··· 1182 1182 } 1183 1183 1184 1184 /* 1185 - * All the "handle_*()" functions have been called before by the 1186 - * "jit_prepare()". If there was an error, we would know by now. 1187 - * Therefore, no extra error checking at this point, other than 1188 - * a sanity check at the end that expects the calculated length 1189 - * (jit.len) to be equal to the length of generated instructions 1190 - * (jit.index). 1185 + * jit_compile() is the real compilation phase. jit_prepare() is 1186 + * invoked before jit_compile() as a dry-run to make sure everything 1187 + * will go OK and allocate the necessary memory. 1188 + * 1189 + * In the end, jit_compile() checks if it has produced the same number 1190 + * of instructions as jit_prepare() would. 1191 1191 */ 1192 1192 static int jit_compile(struct jit_context *ctx) 1193 1193 { ··· 1407 1407 1408 1408 /* 1409 1409 * This function may be invoked twice for the same stream of BPF 1410 - * instructions. The "extra pass" happens, when there are "call"s 1411 - * involved that their addresses are not known during the first 1412 - * invocation. 1410 + * instructions. The "extra pass" happens, when there are 1411 + * (re)locations involved that their addresses are not known 1412 + * during the first run. 1413 1413 */ 1414 1414 struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) 1415 1415 {
+1 -1
arch/powerpc/Kconfig
··· 137 137 select ARCH_HAS_GCOV_PROFILE_ALL 138 138 select ARCH_HAS_HUGEPD if HUGETLB_PAGE 139 139 select ARCH_HAS_KCOV 140 - select ARCH_HAS_KERNEL_FPU_SUPPORT if PPC_FPU 140 + select ARCH_HAS_KERNEL_FPU_SUPPORT if PPC64 && PPC_FPU 141 141 select ARCH_HAS_MEMBARRIER_CALLBACKS 142 142 select ARCH_HAS_MEMBARRIER_SYNC_CORE 143 143 select ARCH_HAS_MEMREMAP_COMPAT_ALIGN if PPC_64S_HASH_MMU
+27
arch/powerpc/include/asm/uaccess.h
··· 92 92 : label) 93 93 #endif 94 94 95 + #ifdef CONFIG_CC_IS_CLANG 96 + #define DS_FORM_CONSTRAINT "Z<>" 97 + #else 98 + #define DS_FORM_CONSTRAINT "YZ<>" 99 + #endif 100 + 95 101 #ifdef __powerpc64__ 102 + #ifdef CONFIG_PPC_KERNEL_PREFIXED 96 103 #define __put_user_asm2_goto(x, ptr, label) \ 97 104 __put_user_asm_goto(x, ptr, label, "std") 105 + #else 106 + #define __put_user_asm2_goto(x, addr, label) \ 107 + asm goto ("1: std%U1%X1 %0,%1 # put_user\n" \ 108 + EX_TABLE(1b, %l2) \ 109 + : \ 110 + : "r" (x), DS_FORM_CONSTRAINT (*addr) \ 111 + : \ 112 + : label) 113 + #endif // CONFIG_PPC_KERNEL_PREFIXED 98 114 #else /* __powerpc64__ */ 99 115 #define __put_user_asm2_goto(x, addr, label) \ 100 116 asm goto( \ ··· 181 165 #endif 182 166 183 167 #ifdef __powerpc64__ 168 + #ifdef CONFIG_PPC_KERNEL_PREFIXED 184 169 #define __get_user_asm2_goto(x, addr, label) \ 185 170 __get_user_asm_goto(x, addr, label, "ld") 171 + #else 172 + #define __get_user_asm2_goto(x, addr, label) \ 173 + asm_goto_output( \ 174 + "1: ld%U1%X1 %0, %1 # get_user\n" \ 175 + EX_TABLE(1b, %l2) \ 176 + : "=r" (x) \ 177 + : DS_FORM_CONSTRAINT (*addr) \ 178 + : \ 179 + : label) 180 + #endif // CONFIG_PPC_KERNEL_PREFIXED 186 181 #else /* __powerpc64__ */ 187 182 #define __get_user_asm2_goto(x, addr, label) \ 188 183 asm_goto_output( \
+12
arch/powerpc/net/bpf_jit_comp32.c
··· 900 900 901 901 /* Get offset into TMP_REG */ 902 902 EMIT(PPC_RAW_LI(tmp_reg, off)); 903 + /* 904 + * Enforce full ordering for operations with BPF_FETCH by emitting a 'sync' 905 + * before and after the operation. 906 + * 907 + * This is a requirement in the Linux Kernel Memory Model. 908 + * See __cmpxchg_u32() in asm/cmpxchg.h as an example. 909 + */ 910 + if ((imm & BPF_FETCH) && IS_ENABLED(CONFIG_SMP)) 911 + EMIT(PPC_RAW_SYNC()); 903 912 tmp_idx = ctx->idx * 4; 904 913 /* load value from memory into r0 */ 905 914 EMIT(PPC_RAW_LWARX(_R0, tmp_reg, dst_reg, 0)); ··· 962 953 963 954 /* For the BPF_FETCH variant, get old data into src_reg */ 964 955 if (imm & BPF_FETCH) { 956 + /* Emit 'sync' to enforce full ordering */ 957 + if (IS_ENABLED(CONFIG_SMP)) 958 + EMIT(PPC_RAW_SYNC()); 965 959 EMIT(PPC_RAW_MR(ret_reg, ax_reg)); 966 960 if (!fp->aux->verifier_zext) 967 961 EMIT(PPC_RAW_LI(ret_reg - 1, 0)); /* higher 32-bit */
+12
arch/powerpc/net/bpf_jit_comp64.c
··· 846 846 847 847 /* Get offset into TMP_REG_1 */ 848 848 EMIT(PPC_RAW_LI(tmp1_reg, off)); 849 + /* 850 + * Enforce full ordering for operations with BPF_FETCH by emitting a 'sync' 851 + * before and after the operation. 852 + * 853 + * This is a requirement in the Linux Kernel Memory Model. 854 + * See __cmpxchg_u64() in asm/cmpxchg.h as an example. 855 + */ 856 + if ((imm & BPF_FETCH) && IS_ENABLED(CONFIG_SMP)) 857 + EMIT(PPC_RAW_SYNC()); 849 858 tmp_idx = ctx->idx * 4; 850 859 /* load value from memory into TMP_REG_2 */ 851 860 if (size == BPF_DW) ··· 917 908 PPC_BCC_SHORT(COND_NE, tmp_idx); 918 909 919 910 if (imm & BPF_FETCH) { 911 + /* Emit 'sync' to enforce full ordering */ 912 + if (IS_ENABLED(CONFIG_SMP)) 913 + EMIT(PPC_RAW_SYNC()); 920 914 EMIT(PPC_RAW_MR(ret_reg, _R0)); 921 915 /* 922 916 * Skip unnecessary zero-extension for 32-bit cmpxchg.
+2 -2
arch/powerpc/platforms/pseries/lparcfg.c
··· 371 371 372 372 static void read_lpar_name(struct seq_file *m) 373 373 { 374 - if (read_rtas_lpar_name(m) && read_dt_lpar_name(m)) 375 - pr_err_once("Error can't get the LPAR name"); 374 + if (read_rtas_lpar_name(m)) 375 + read_dt_lpar_name(m); 376 376 } 377 377 378 378 #define SPLPAR_MAXLENGTH 1026*(sizeof(char))
+1 -1
arch/riscv/Kconfig
··· 106 106 select HAS_IOPORT if MMU 107 107 select HAVE_ARCH_AUDITSYSCALL 108 108 select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP 109 - select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT && !XIP_KERNEL 109 + select HAVE_ARCH_HUGE_VMAP if MMU && 64BIT 110 110 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 111 111 select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL 112 112 select HAVE_ARCH_KASAN if MMU && 64BIT
+12 -10
arch/riscv/include/asm/cmpxchg.h
··· 10 10 11 11 #include <asm/fence.h> 12 12 13 - #define __arch_xchg_masked(prepend, append, r, p, n) \ 13 + #define __arch_xchg_masked(sc_sfx, prepend, append, r, p, n) \ 14 14 ({ \ 15 15 u32 *__ptr32b = (u32 *)((ulong)(p) & ~0x3); \ 16 16 ulong __s = ((ulong)(p) & (0x4 - sizeof(*p))) * BITS_PER_BYTE; \ ··· 25 25 "0: lr.w %0, %2\n" \ 26 26 " and %1, %0, %z4\n" \ 27 27 " or %1, %1, %z3\n" \ 28 - " sc.w %1, %1, %2\n" \ 28 + " sc.w" sc_sfx " %1, %1, %2\n" \ 29 29 " bnez %1, 0b\n" \ 30 30 append \ 31 31 : "=&r" (__retx), "=&r" (__rc), "+A" (*(__ptr32b)) \ ··· 46 46 : "memory"); \ 47 47 }) 48 48 49 - #define _arch_xchg(ptr, new, sfx, prepend, append) \ 49 + #define _arch_xchg(ptr, new, sc_sfx, swap_sfx, prepend, \ 50 + sc_append, swap_append) \ 50 51 ({ \ 51 52 __typeof__(ptr) __ptr = (ptr); \ 52 53 __typeof__(*(__ptr)) __new = (new); \ ··· 56 55 switch (sizeof(*__ptr)) { \ 57 56 case 1: \ 58 57 case 2: \ 59 - __arch_xchg_masked(prepend, append, \ 58 + __arch_xchg_masked(sc_sfx, prepend, sc_append, \ 60 59 __ret, __ptr, __new); \ 61 60 break; \ 62 61 case 4: \ 63 - __arch_xchg(".w" sfx, prepend, append, \ 62 + __arch_xchg(".w" swap_sfx, prepend, swap_append, \ 64 63 __ret, __ptr, __new); \ 65 64 break; \ 66 65 case 8: \ 67 - __arch_xchg(".d" sfx, prepend, append, \ 66 + __arch_xchg(".d" swap_sfx, prepend, swap_append, \ 68 67 __ret, __ptr, __new); \ 69 68 break; \ 70 69 default: \ ··· 74 73 }) 75 74 76 75 #define arch_xchg_relaxed(ptr, x) \ 77 - _arch_xchg(ptr, x, "", "", "") 76 + _arch_xchg(ptr, x, "", "", "", "", "") 78 77 79 78 #define arch_xchg_acquire(ptr, x) \ 80 - _arch_xchg(ptr, x, "", "", RISCV_ACQUIRE_BARRIER) 79 + _arch_xchg(ptr, x, "", "", "", \ 80 + RISCV_ACQUIRE_BARRIER, RISCV_ACQUIRE_BARRIER) 81 81 82 82 #define arch_xchg_release(ptr, x) \ 83 - _arch_xchg(ptr, x, "", RISCV_RELEASE_BARRIER, "") 83 + _arch_xchg(ptr, x, "", "", RISCV_RELEASE_BARRIER, "", "") 84 84 85 85 #define arch_xchg(ptr, x) \ 86 - _arch_xchg(ptr, x, ".aqrl", "", "") 86 + _arch_xchg(ptr, x, ".rl", ".aqrl", "", RISCV_FULL_BARRIER, "") 87 87 88 88 #define xchg32(ptr, x) \ 89 89 ({ \
+1 -1
arch/riscv/kernel/cpu_ops_sbi.c
··· 72 72 /* Make sure tidle is updated */ 73 73 smp_mb(); 74 74 bdata->task_ptr = tidle; 75 - bdata->stack_ptr = task_stack_page(tidle) + THREAD_SIZE; 75 + bdata->stack_ptr = task_pt_regs(tidle); 76 76 /* Make sure boot data is updated */ 77 77 smp_mb(); 78 78 hsm_data = __pa(bdata);
+1 -2
arch/riscv/kernel/cpu_ops_spinwait.c
··· 34 34 35 35 /* Make sure tidle is updated */ 36 36 smp_mb(); 37 - WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid], 38 - task_stack_page(tidle) + THREAD_SIZE); 37 + WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid], task_pt_regs(tidle)); 39 38 WRITE_ONCE(__cpu_spinwait_task_pointer[hartid], tidle); 40 39 } 41 40
+1
arch/x86/events/intel/cstate.c
··· 114 114 #include "../perf_event.h" 115 115 #include "../probe.h" 116 116 117 + MODULE_DESCRIPTION("Support for Intel cstate performance events"); 117 118 MODULE_LICENSE("GPL"); 118 119 119 120 #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format) \
+1
arch/x86/events/intel/uncore.c
··· 34 34 struct event_constraint uncore_constraint_empty = 35 35 EVENT_CONSTRAINT(0, 0, 0); 36 36 37 + MODULE_DESCRIPTION("Support for Intel uncore performance events"); 37 38 MODULE_LICENSE("GPL"); 38 39 39 40 int uncore_pcibus_to_dieid(struct pci_bus *bus)
+1
arch/x86/events/rapl.c
··· 64 64 #include "perf_event.h" 65 65 #include "probe.h" 66 66 67 + MODULE_DESCRIPTION("Support Intel/AMD RAPL energy consumption counters"); 67 68 MODULE_LICENSE("GPL"); 68 69 69 70 /*
+1
arch/x86/kernel/cpu/aperfmperf.c
··· 345 345 disable_freq_invariance_workfn); 346 346 347 347 DEFINE_PER_CPU(unsigned long, arch_freq_scale) = SCHED_CAPACITY_SCALE; 348 + EXPORT_PER_CPU_SYMBOL_GPL(arch_freq_scale); 348 349 349 350 static void scale_freq_tick(u64 acnt, u64 mcnt) 350 351 {
+6 -1
arch/x86/kernel/cpu/common.c
··· 1075 1075 1076 1076 c->x86_virt_bits = (eax >> 8) & 0xff; 1077 1077 c->x86_phys_bits = eax & 0xff; 1078 + 1079 + /* Provide a sane default if not enumerated: */ 1080 + if (!c->x86_clflush_size) 1081 + c->x86_clflush_size = 32; 1078 1082 } 1079 1083 1080 1084 c->x86_cache_bits = c->x86_phys_bits; ··· 1589 1585 if (have_cpuid_p()) { 1590 1586 cpu_detect(c); 1591 1587 get_cpu_vendor(c); 1588 + intel_unlock_cpuid_leafs(c); 1592 1589 get_cpu_cap(c); 1593 1590 setup_force_cpu_cap(X86_FEATURE_CPUID); 1594 1591 get_cpu_address_sizes(c); ··· 1749 1744 cpu_detect(c); 1750 1745 1751 1746 get_cpu_vendor(c); 1752 - 1747 + intel_unlock_cpuid_leafs(c); 1753 1748 get_cpu_cap(c); 1754 1749 1755 1750 get_cpu_address_sizes(c);
+2
arch/x86/kernel/cpu/cpu.h
··· 61 61 62 62 extern void __init tsx_init(void); 63 63 void tsx_ap_init(void); 64 + void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c); 64 65 #else 65 66 static inline void tsx_init(void) { } 66 67 static inline void tsx_ap_init(void) { } 68 + static inline void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c) { } 67 69 #endif /* CONFIG_CPU_SUP_INTEL */ 68 70 69 71 extern void init_spectral_chicken(struct cpuinfo_x86 *c);
+16 -9
arch/x86/kernel/cpu/intel.c
··· 269 269 c->x86_phys_bits -= keyid_bits; 270 270 } 271 271 272 + void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c) 273 + { 274 + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) 275 + return; 276 + 277 + if (c->x86 < 6 || (c->x86 == 6 && c->x86_model < 0xd)) 278 + return; 279 + 280 + /* 281 + * The BIOS can have limited CPUID to leaf 2, which breaks feature 282 + * enumeration. Unlock it and update the maximum leaf info. 283 + */ 284 + if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) 285 + c->cpuid_level = cpuid_eax(0); 286 + } 287 + 272 288 static void early_init_intel(struct cpuinfo_x86 *c) 273 289 { 274 290 u64 misc_enable; 275 - 276 - /* Unmask CPUID levels if masked: */ 277 - if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { 278 - if (msr_clear_bit(MSR_IA32_MISC_ENABLE, 279 - MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) { 280 - c->cpuid_level = cpuid_eax(0); 281 - get_cpu_cap(c); 282 - } 283 - } 284 291 285 292 if ((c->x86 == 0xf && c->x86_model >= 0x03) || 286 293 (c->x86 == 0x6 && c->x86_model >= 0x0e))
+2 -2
arch/x86/kernel/cpu/topology_amd.c
··· 84 84 85 85 /* 86 86 * If leaf 0xb is available, then the domain shifts are set 87 - * already and nothing to do here. 87 + * already and nothing to do here. Only valid for family >= 0x17. 88 88 */ 89 - if (!has_topoext) { 89 + if (!has_topoext && tscan->c->x86 >= 0x17) { 90 90 /* 91 91 * Leaf 0x80000008 set the CORE domain shift already. 92 92 * Update the SMT domain, but do not propagate it.
+8 -2
block/blk-settings.c
··· 104 104 static int blk_validate_limits(struct queue_limits *lim) 105 105 { 106 106 unsigned int max_hw_sectors; 107 + unsigned int logical_block_sectors; 107 108 108 109 /* 109 110 * Unless otherwise specified, default to 512 byte logical blocks and a ··· 135 134 lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS; 136 135 if (WARN_ON_ONCE(lim->max_hw_sectors < PAGE_SECTORS)) 137 136 return -EINVAL; 137 + logical_block_sectors = lim->logical_block_size >> SECTOR_SHIFT; 138 + if (WARN_ON_ONCE(logical_block_sectors > lim->max_hw_sectors)) 139 + return -EINVAL; 138 140 lim->max_hw_sectors = round_down(lim->max_hw_sectors, 139 - lim->logical_block_size >> SECTOR_SHIFT); 141 + logical_block_sectors); 140 142 141 143 /* 142 144 * The actual max_sectors value is a complex beast and also takes the ··· 157 153 lim->max_sectors = min(max_hw_sectors, BLK_DEF_MAX_SECTORS_CAP); 158 154 } 159 155 lim->max_sectors = round_down(lim->max_sectors, 160 - lim->logical_block_size >> SECTOR_SHIFT); 156 + logical_block_sectors); 161 157 162 158 /* 163 159 * Random default for the maximum number of segments. Driver should not ··· 615 611 unsigned int top, bottom, alignment, ret = 0; 616 612 617 613 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); 614 + t->max_user_sectors = min_not_zero(t->max_user_sectors, 615 + b->max_user_sectors); 618 616 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); 619 617 t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors); 620 618 t->max_write_zeroes_sectors = min(t->max_write_zeroes_sectors,
-1
block/blk-stat.h
··· 64 64 65 65 struct blk_queue_stats *blk_alloc_queue_stats(void); 66 66 void blk_free_queue_stats(struct blk_queue_stats *); 67 - bool blk_stats_alloc_enable(struct request_queue *q); 68 67 69 68 void blk_stat_add(struct request *rq, u64 now); 70 69
+12 -12
block/blk-throttle.c
··· 1399 1399 bps_dft = U64_MAX; 1400 1400 iops_dft = UINT_MAX; 1401 1401 1402 - if (tg->bps_conf[READ] == bps_dft && 1403 - tg->bps_conf[WRITE] == bps_dft && 1404 - tg->iops_conf[READ] == iops_dft && 1405 - tg->iops_conf[WRITE] == iops_dft) 1402 + if (tg->bps[READ] == bps_dft && 1403 + tg->bps[WRITE] == bps_dft && 1404 + tg->iops[READ] == iops_dft && 1405 + tg->iops[WRITE] == iops_dft) 1406 1406 return 0; 1407 1407 1408 1408 seq_printf(sf, "%s", dname); 1409 - if (tg->bps_conf[READ] == U64_MAX) 1409 + if (tg->bps[READ] == U64_MAX) 1410 1410 seq_printf(sf, " rbps=max"); 1411 1411 else 1412 - seq_printf(sf, " rbps=%llu", tg->bps_conf[READ]); 1412 + seq_printf(sf, " rbps=%llu", tg->bps[READ]); 1413 1413 1414 - if (tg->bps_conf[WRITE] == U64_MAX) 1414 + if (tg->bps[WRITE] == U64_MAX) 1415 1415 seq_printf(sf, " wbps=max"); 1416 1416 else 1417 - seq_printf(sf, " wbps=%llu", tg->bps_conf[WRITE]); 1417 + seq_printf(sf, " wbps=%llu", tg->bps[WRITE]); 1418 1418 1419 - if (tg->iops_conf[READ] == UINT_MAX) 1419 + if (tg->iops[READ] == UINT_MAX) 1420 1420 seq_printf(sf, " riops=max"); 1421 1421 else 1422 - seq_printf(sf, " riops=%u", tg->iops_conf[READ]); 1422 + seq_printf(sf, " riops=%u", tg->iops[READ]); 1423 1423 1424 - if (tg->iops_conf[WRITE] == UINT_MAX) 1424 + if (tg->iops[WRITE] == UINT_MAX) 1425 1425 seq_printf(sf, " wiops=max"); 1426 1426 else 1427 - seq_printf(sf, " wiops=%u", tg->iops_conf[WRITE]); 1427 + seq_printf(sf, " wiops=%u", tg->iops[WRITE]); 1428 1428 1429 1429 seq_printf(sf, "\n"); 1430 1430 return 0;
+2 -6
block/blk-throttle.h
··· 95 95 bool has_rules_bps[2]; 96 96 bool has_rules_iops[2]; 97 97 98 - /* internally used bytes per second rate limits */ 98 + /* bytes per second rate limits */ 99 99 uint64_t bps[2]; 100 - /* user configured bps limits */ 101 - uint64_t bps_conf[2]; 102 100 103 - /* internally used IOPS limits */ 101 + /* IOPS limits */ 104 102 unsigned int iops[2]; 105 - /* user configured IOPS limits */ 106 - unsigned int iops_conf[2]; 107 103 108 104 /* Number of bytes dispatched in current slice */ 109 105 uint64_t bytes_disp[2];
+36 -11
block/blk-zoned.c
··· 450 450 return test_bit(disk_zone_no(disk, sector), disk->conv_zones_bitmap); 451 451 } 452 452 453 + static bool disk_zone_is_last(struct gendisk *disk, struct blk_zone *zone) 454 + { 455 + return zone->start + zone->len >= get_capacity(disk); 456 + } 457 + 458 + static bool disk_zone_is_full(struct gendisk *disk, 459 + unsigned int zno, unsigned int offset_in_zone) 460 + { 461 + if (zno < disk->nr_zones - 1) 462 + return offset_in_zone >= disk->zone_capacity; 463 + return offset_in_zone >= disk->last_zone_capacity; 464 + } 465 + 466 + static bool disk_zone_wplug_is_full(struct gendisk *disk, 467 + struct blk_zone_wplug *zwplug) 468 + { 469 + return disk_zone_is_full(disk, zwplug->zone_no, zwplug->wp_offset); 470 + } 471 + 453 472 static bool disk_insert_zone_wplug(struct gendisk *disk, 454 473 struct blk_zone_wplug *zwplug) 455 474 { ··· 562 543 return false; 563 544 564 545 /* We can remove zone write plugs for zones that are empty or full. */ 565 - return !zwplug->wp_offset || zwplug->wp_offset >= disk->zone_capacity; 546 + return !zwplug->wp_offset || disk_zone_wplug_is_full(disk, zwplug); 566 547 } 567 548 568 549 static void disk_remove_zone_wplug(struct gendisk *disk, ··· 683 664 static void disk_zone_wplug_abort_unaligned(struct gendisk *disk, 684 665 struct blk_zone_wplug *zwplug) 685 666 { 686 - unsigned int zone_capacity = disk->zone_capacity; 687 667 unsigned int wp_offset = zwplug->wp_offset; 688 668 struct bio_list bl = BIO_EMPTY_LIST; 689 669 struct bio *bio; 690 670 691 671 while ((bio = bio_list_pop(&zwplug->bio_list))) { 692 - if (wp_offset >= zone_capacity || 672 + if (disk_zone_is_full(disk, zwplug->zone_no, wp_offset) || 693 673 (bio_op(bio) != REQ_OP_ZONE_APPEND && 694 674 bio_offset_from_zone_start(bio) != wp_offset)) { 695 675 blk_zone_wplug_bio_io_error(zwplug, bio); ··· 927 909 sector_t req_back_sector = blk_rq_pos(req) + blk_rq_sectors(req); 928 910 struct request_queue *q = req->q; 929 911 struct gendisk *disk = q->disk; 930 - unsigned int zone_capacity = disk->zone_capacity; 931 912 struct blk_zone_wplug *zwplug = 932 913 disk_get_zone_wplug(disk, blk_rq_pos(req)); 933 914 unsigned long flags; ··· 950 933 * into the back of the request. 951 934 */ 952 935 spin_lock_irqsave(&zwplug->lock, flags); 953 - while (zwplug->wp_offset < zone_capacity) { 936 + while (!disk_zone_wplug_is_full(disk, zwplug)) { 954 937 bio = bio_list_peek(&zwplug->bio_list); 955 938 if (!bio) 956 939 break; ··· 996 979 * We know such BIO will fail, and that would potentially overflow our 997 980 * write pointer offset beyond the end of the zone. 998 981 */ 999 - if (zwplug->wp_offset >= disk->zone_capacity) 982 + if (disk_zone_wplug_is_full(disk, zwplug)) 1000 983 goto err; 1001 984 1002 985 if (bio_op(bio) == REQ_OP_ZONE_APPEND) { ··· 1573 1556 kfree(disk->conv_zones_bitmap); 1574 1557 disk->conv_zones_bitmap = NULL; 1575 1558 disk->zone_capacity = 0; 1559 + disk->last_zone_capacity = 0; 1576 1560 disk->nr_zones = 0; 1577 1561 } 1578 1562 ··· 1618 1600 unsigned long *conv_zones_bitmap; 1619 1601 unsigned int nr_zones; 1620 1602 unsigned int zone_capacity; 1603 + unsigned int last_zone_capacity; 1621 1604 sector_t sector; 1622 1605 }; 1623 1606 ··· 1636 1617 1637 1618 disk->nr_zones = args->nr_zones; 1638 1619 disk->zone_capacity = args->zone_capacity; 1620 + disk->last_zone_capacity = args->last_zone_capacity; 1639 1621 swap(disk->conv_zones_bitmap, args->conv_zones_bitmap); 1640 1622 if (disk->conv_zones_bitmap) 1641 1623 nr_conv_zones = bitmap_weight(disk->conv_zones_bitmap, ··· 1688 1668 return -ENODEV; 1689 1669 } 1690 1670 1671 + if (disk_zone_is_last(disk, zone)) 1672 + args->last_zone_capacity = zone->capacity; 1673 + 1691 1674 if (!disk_need_zone_resources(disk)) 1692 1675 return 0; 1693 1676 ··· 1716 1693 1717 1694 /* 1718 1695 * Remember the capacity of the first sequential zone and check 1719 - * if it is constant for all zones. 1696 + * if it is constant for all zones, ignoring the last zone as it can be 1697 + * smaller. 1720 1698 */ 1721 1699 if (!args->zone_capacity) 1722 1700 args->zone_capacity = zone->capacity; 1723 - if (zone->capacity != args->zone_capacity) { 1701 + if (disk_zone_is_last(disk, zone)) { 1702 + args->last_zone_capacity = zone->capacity; 1703 + } else if (zone->capacity != args->zone_capacity) { 1724 1704 pr_warn("%s: Invalid variable zone capacity\n", 1725 1705 disk->disk_name); 1726 1706 return -ENODEV; ··· 1758 1732 { 1759 1733 struct blk_revalidate_zone_args *args = data; 1760 1734 struct gendisk *disk = args->disk; 1761 - sector_t capacity = get_capacity(disk); 1762 1735 sector_t zone_sectors = disk->queue->limits.chunk_sectors; 1763 1736 int ret; 1764 1737 ··· 1768 1743 return -ENODEV; 1769 1744 } 1770 1745 1771 - if (zone->start >= capacity || !zone->len) { 1746 + if (zone->start >= get_capacity(disk) || !zone->len) { 1772 1747 pr_warn("%s: Invalid zone start %llu, length %llu\n", 1773 1748 disk->disk_name, zone->start, zone->len); 1774 1749 return -ENODEV; ··· 1778 1753 * All zones must have the same size, with the exception on an eventual 1779 1754 * smaller last zone. 1780 1755 */ 1781 - if (zone->start + zone->len < capacity) { 1756 + if (!disk_zone_is_last(disk, zone)) { 1782 1757 if (zone->len != zone_sectors) { 1783 1758 pr_warn("%s: Invalid zoned device with non constant zone size\n", 1784 1759 disk->disk_name);
-1
drivers/ata/ahci.c
··· 429 429 { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_pcs_quirk }, /* Comet Lake PCH RAID */ 430 430 /* Elkhart Lake IDs 0x4b60 & 0x4b62 https://sata-io.org/product/8803 not tested yet */ 431 431 { PCI_VDEVICE(INTEL, 0x4b63), board_ahci_pcs_quirk }, /* Elkhart Lake AHCI */ 432 - { PCI_VDEVICE(INTEL, 0x7ae2), board_ahci_pcs_quirk }, /* Alder Lake-P AHCI */ 433 432 434 433 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 435 434 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+8 -1
drivers/ata/libata-core.c
··· 4136 4136 { "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM }, 4137 4137 { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM }, 4138 4138 4139 - /* Crucial BX100 SSD 500GB has broken LPM support */ 4139 + /* Crucial devices with broken LPM support */ 4140 4140 { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, 4141 + { "CT240BX500SSD1", NULL, ATA_HORKAGE_NOLPM }, 4141 4142 4142 4143 /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */ 4143 4144 { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ··· 4155 4154 { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4156 4155 ATA_HORKAGE_ZERO_AFTER_TRIM | 4157 4156 ATA_HORKAGE_NOLPM }, 4157 + 4158 + /* AMD Radeon devices with broken LPM support */ 4159 + { "R3SL240G", NULL, ATA_HORKAGE_NOLPM }, 4160 + 4161 + /* Apacer models with LPM issues */ 4162 + { "Apacer AS340*", NULL, ATA_HORKAGE_NOLPM }, 4158 4163 4159 4164 /* These specific Samsung models/firmware-revs do not handle LPM well */ 4160 4165 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM },
+2 -1
drivers/base/regmap/regmap-i2c.c
··· 350 350 351 351 if (quirks->max_write_len && 352 352 (bus->max_raw_write == 0 || bus->max_raw_write > quirks->max_write_len)) 353 - max_write = quirks->max_write_len; 353 + max_write = quirks->max_write_len - 354 + (config->reg_bits + config->pad_bits) / BITS_PER_BYTE; 354 355 355 356 if (max_read || max_write) { 356 357 ret_bus = kmemdup(bus, sizeof(*bus), GFP_KERNEL);
+1
drivers/block/null_blk/main.c
··· 494 494 495 495 set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags); 496 496 dev->power = newp; 497 + ret = count; 497 498 } else if (dev->power && !newp) { 498 499 if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) { 499 500 dev->power = newp;
+12 -1
drivers/block/null_blk/zoned.c
··· 74 74 return -EINVAL; 75 75 } 76 76 77 + /* 78 + * If a smaller zone capacity was requested, do not allow a smaller last 79 + * zone at the same time as such zone configuration does not correspond 80 + * to any real zoned device. 81 + */ 82 + if (dev->zone_capacity != dev->zone_size && 83 + dev->size & (dev->zone_size - 1)) { 84 + pr_err("A smaller last zone is not allowed with zone capacity smaller than zone size.\n"); 85 + return -EINVAL; 86 + } 87 + 77 88 zone_capacity_sects = mb_to_sects(dev->zone_capacity); 78 89 dev_capacity_sects = mb_to_sects(dev->size); 79 90 dev->zone_size_sects = mb_to_sects(dev->zone_size); ··· 119 108 if (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) { 120 109 dev->zone_max_open = dev->zone_max_active; 121 110 pr_info("changed the maximum number of open zones to %u\n", 122 - dev->nr_zones); 111 + dev->zone_max_open); 123 112 } else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) { 124 113 dev->zone_max_open = 0; 125 114 pr_info("zone_max_open limit disabled, limit >= zone count\n");
+4 -43
drivers/char/hw_random/core.c
··· 64 64 return RNG_BUFFER_SIZE; 65 65 } 66 66 67 - static void add_early_randomness(struct hwrng *rng) 68 - { 69 - int bytes_read; 70 - 71 - mutex_lock(&reading_mutex); 72 - bytes_read = rng_get_data(rng, rng_fillbuf, 32, 0); 73 - mutex_unlock(&reading_mutex); 74 - if (bytes_read > 0) { 75 - size_t entropy = bytes_read * 8 * rng->quality / 1024; 76 - add_hwgenerator_randomness(rng_fillbuf, bytes_read, entropy, false); 77 - } 78 - } 79 - 80 67 static inline void cleanup_rng(struct kref *kref) 81 68 { 82 69 struct hwrng *rng = container_of(kref, struct hwrng, ref); ··· 327 340 const char *buf, size_t len) 328 341 { 329 342 int err; 330 - struct hwrng *rng, *old_rng, *new_rng; 343 + struct hwrng *rng, *new_rng; 331 344 332 345 err = mutex_lock_interruptible(&rng_mutex); 333 346 if (err) 334 347 return -ERESTARTSYS; 335 348 336 - old_rng = current_rng; 337 349 if (sysfs_streq(buf, "")) { 338 350 err = enable_best_rng(); 339 351 } else { ··· 348 362 new_rng = get_current_rng_nolock(); 349 363 mutex_unlock(&rng_mutex); 350 364 351 - if (new_rng) { 352 - if (new_rng != old_rng) 353 - add_early_randomness(new_rng); 365 + if (new_rng) 354 366 put_rng(new_rng); 355 - } 356 367 357 368 return err ? : len; 358 369 } ··· 527 544 { 528 545 int err = -EINVAL; 529 546 struct hwrng *tmp; 530 - bool is_new_current = false; 531 547 532 548 if (!rng->name || (!rng->data_read && !rng->read)) 533 549 goto out; ··· 555 573 err = set_current_rng(rng); 556 574 if (err) 557 575 goto out_unlock; 558 - /* to use current_rng in add_early_randomness() we need 559 - * to take a ref 560 - */ 561 - is_new_current = true; 562 - kref_get(&rng->ref); 563 576 } 564 577 mutex_unlock(&rng_mutex); 565 - if (is_new_current || !rng->init) { 566 - /* 567 - * Use a new device's input to add some randomness to 568 - * the system. If this rng device isn't going to be 569 - * used right away, its init function hasn't been 570 - * called yet by set_current_rng(); so only use the 571 - * randomness from devices that don't need an init callback 572 - */ 573 - add_early_randomness(rng); 574 - } 575 - if (is_new_current) 576 - put_rng(rng); 577 578 return 0; 578 579 out_unlock: 579 580 mutex_unlock(&rng_mutex); ··· 567 602 568 603 void hwrng_unregister(struct hwrng *rng) 569 604 { 570 - struct hwrng *old_rng, *new_rng; 605 + struct hwrng *new_rng; 571 606 int err; 572 607 573 608 mutex_lock(&rng_mutex); 574 609 575 - old_rng = current_rng; 576 610 list_del(&rng->list); 577 611 complete_all(&rng->dying); 578 612 if (current_rng == rng) { ··· 590 626 } else 591 627 mutex_unlock(&rng_mutex); 592 628 593 - if (new_rng) { 594 - if (old_rng != new_rng) 595 - add_early_randomness(new_rng); 629 + if (new_rng) 596 630 put_rng(new_rng); 597 - } 598 631 599 632 wait_for_completion(&rng->cleanup_done); 600 633 }
+1 -1
drivers/char/tpm/Kconfig
··· 29 29 30 30 config TCG_TPM2_HMAC 31 31 bool "Use HMAC and encrypted transactions on the TPM bus" 32 - default y 32 + default X86_64 33 33 select CRYPTO_ECDH 34 34 select CRYPTO_LIB_AESCFB 35 35 select CRYPTO_LIB_SHA256
-26
drivers/char/tpm/tpm-buf.c
··· 223 223 } 224 224 EXPORT_SYMBOL_GPL(tpm_buf_read_u32); 225 225 226 - static u16 tpm_buf_tag(struct tpm_buf *buf) 227 - { 228 - struct tpm_header *head = (struct tpm_header *)buf->data; 229 226 230 - return be16_to_cpu(head->tag); 231 - } 232 - 233 - /** 234 - * tpm_buf_parameters - return the TPM response parameters area of the tpm_buf 235 - * @buf: tpm_buf to use 236 - * 237 - * Where the parameters are located depends on the tag of a TPM 238 - * command (it's immediately after the header for TPM_ST_NO_SESSIONS 239 - * or 4 bytes after for TPM_ST_SESSIONS). Evaluate this and return a 240 - * pointer to the first byte of the parameters area. 241 - * 242 - * @return: pointer to parameters area 243 - */ 244 - u8 *tpm_buf_parameters(struct tpm_buf *buf) 245 - { 246 - int offset = TPM_HEADER_SIZE; 247 - 248 - if (tpm_buf_tag(buf) == TPM2_ST_SESSIONS) 249 - offset += 4; 250 - 251 - return &buf->data[offset]; 252 - }
+9 -1
drivers/char/tpm/tpm2-cmd.c
··· 281 281 int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) 282 282 { 283 283 struct tpm2_get_random_out *out; 284 + struct tpm_header *head; 284 285 struct tpm_buf buf; 285 286 u32 recd; 286 287 u32 num_bytes = max; ··· 289 288 int total = 0; 290 289 int retries = 5; 291 290 u8 *dest_ptr = dest; 291 + off_t offset; 292 292 293 293 if (!num_bytes || max > TPM_MAX_RNG_DATA) 294 294 return -EINVAL; ··· 322 320 goto out; 323 321 } 324 322 325 - out = (struct tpm2_get_random_out *)tpm_buf_parameters(&buf); 323 + head = (struct tpm_header *)buf.data; 324 + offset = TPM_HEADER_SIZE; 325 + /* Skip the parameter size field: */ 326 + if (be16_to_cpu(head->tag) == TPM2_ST_SESSIONS) 327 + offset += 4; 328 + 329 + out = (struct tpm2_get_random_out *)&buf.data[offset]; 326 330 recd = min_t(u32, be16_to_cpu(out->size), num_bytes); 327 331 if (tpm_buf_length(&buf) < 328 332 TPM_HEADER_SIZE +
+19 -2
drivers/char/tpm/tpm2-sessions.c
··· 80 80 /* maximum number of names the TPM must remember for authorization */ 81 81 #define AUTH_MAX_NAMES 3 82 82 83 + #define AES_KEY_BYTES AES_KEYSIZE_128 84 + #define AES_KEY_BITS (AES_KEY_BYTES*8) 85 + 83 86 static int tpm2_create_primary(struct tpm_chip *chip, u32 hierarchy, 84 87 u32 *handle, u8 *name); 85 88 ··· 957 954 } 958 955 EXPORT_SYMBOL(tpm2_start_auth_session); 959 956 957 + /* 958 + * A mask containing the object attributes for the kernel held null primary key 959 + * used in HMAC encryption. For more information on specific attributes look up 960 + * to "8.3 TPMA_OBJECT (Object Attributes)". 961 + */ 962 + #define TPM2_OA_NULL_KEY ( \ 963 + TPM2_OA_NO_DA | \ 964 + TPM2_OA_FIXED_TPM | \ 965 + TPM2_OA_FIXED_PARENT | \ 966 + TPM2_OA_SENSITIVE_DATA_ORIGIN | \ 967 + TPM2_OA_USER_WITH_AUTH | \ 968 + TPM2_OA_DECRYPT | \ 969 + TPM2_OA_RESTRICTED) 970 + 960 971 /** 961 972 * tpm2_parse_create_primary() - parse the data returned from TPM_CC_CREATE_PRIMARY 962 973 * ··· 1035 1018 val = tpm_buf_read_u32(buf, &offset_t); 1036 1019 1037 1020 /* object properties */ 1038 - if (val != TPM2_OA_TMPL) 1021 + if (val != TPM2_OA_NULL_KEY) 1039 1022 return -EINVAL; 1040 1023 1041 1024 /* auth policy (empty) */ ··· 1195 1178 tpm_buf_append_u16(&template, TPM_ALG_SHA256); 1196 1179 1197 1180 /* object properties */ 1198 - tpm_buf_append_u32(&template, TPM2_OA_TMPL); 1181 + tpm_buf_append_u32(&template, TPM2_OA_NULL_KEY); 1199 1182 1200 1183 /* sauth policy (empty) */ 1201 1184 tpm_buf_append_u16(&template, 0);
+2 -1
drivers/char/tpm/tpm_tis_spi_main.c
··· 37 37 #include "tpm_tis_spi.h" 38 38 39 39 #define MAX_SPI_FRAMESIZE 64 40 + #define SPI_HDRSIZE 4 40 41 41 42 /* 42 43 * TCG SPI flow control is documented in section 6.4 of the spec[1]. In short, ··· 248 247 int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy, 249 248 int irq, const struct tpm_tis_phy_ops *phy_ops) 250 249 { 251 - phy->iobuf = devm_kmalloc(&spi->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL); 250 + phy->iobuf = devm_kmalloc(&spi->dev, SPI_HDRSIZE + MAX_SPI_FRAMESIZE, GFP_KERNEL); 252 251 if (!phy->iobuf) 253 252 return -ENOMEM; 254 253
+6
drivers/dma-buf/st-dma-fence.c
··· 540 540 t[i].before = pass; 541 541 t[i].task = kthread_run(thread_signal_callback, &t[i], 542 542 "dma-fence:%d", i); 543 + if (IS_ERR(t[i].task)) { 544 + ret = PTR_ERR(t[i].task); 545 + while (--i >= 0) 546 + kthread_stop_put(t[i].task); 547 + return ret; 548 + } 543 549 get_task_struct(t[i].task); 544 550 } 545 551
+2 -2
drivers/dma-buf/sync_debug.c
··· 110 110 111 111 seq_printf(s, "%s: %d\n", obj->name, obj->value); 112 112 113 - spin_lock_irq(&obj->lock); 113 + spin_lock(&obj->lock); /* Caller already disabled IRQ. */ 114 114 list_for_each(pos, &obj->pt_list) { 115 115 struct sync_pt *pt = container_of(pos, struct sync_pt, link); 116 116 sync_print_fence(s, &pt->base, false); 117 117 } 118 - spin_unlock_irq(&obj->lock); 118 + spin_unlock(&obj->lock); 119 119 } 120 120 121 121 static void sync_print_sync_file(struct seq_file *s,
+1
drivers/firewire/packet-serdes-test.c
··· 579 579 }; 580 580 kunit_test_suite(packet_serdes_test_suite); 581 581 582 + MODULE_DESCRIPTION("FireWire packet serialization/deserialization unit test suite"); 582 583 MODULE_LICENSE("GPL");
+1
drivers/firewire/uapi-test.c
··· 86 86 }; 87 87 kunit_test_suite(structure_layout_test_suite); 88 88 89 + MODULE_DESCRIPTION("FireWire UAPI unit test suite"); 89 90 MODULE_LICENSE("GPL");
+8 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 196 196 return -EINVAL; 197 197 198 198 vram_size = KFD_XCP_MEMORY_SIZE(adev, xcp_id); 199 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 199 + if (adev->flags & AMD_IS_APU) { 200 200 system_mem_needed = size; 201 201 ttm_mem_needed = size; 202 202 } ··· 233 233 if (adev && xcp_id >= 0) { 234 234 adev->kfd.vram_used[xcp_id] += vram_needed; 235 235 adev->kfd.vram_used_aligned[xcp_id] += 236 - (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ? 236 + (adev->flags & AMD_IS_APU) ? 237 237 vram_needed : 238 238 ALIGN(vram_needed, VRAM_AVAILABLITY_ALIGN); 239 239 } ··· 261 261 262 262 if (adev) { 263 263 adev->kfd.vram_used[xcp_id] -= size; 264 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 264 + if (adev->flags & AMD_IS_APU) { 265 265 adev->kfd.vram_used_aligned[xcp_id] -= size; 266 266 kfd_mem_limit.system_mem_used -= size; 267 267 kfd_mem_limit.ttm_mem_used -= size; ··· 890 890 * if peer device has large BAR. In contrast, access over xGMI is 891 891 * allowed for both small and large BAR configurations of peer device 892 892 */ 893 - if ((adev != bo_adev && !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU)) && 893 + if ((adev != bo_adev && !(adev->flags & AMD_IS_APU)) && 894 894 ((mem->domain == AMDGPU_GEM_DOMAIN_VRAM) || 895 895 (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL) || 896 896 (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP))) { ··· 1658 1658 - atomic64_read(&adev->vram_pin_size) 1659 1659 - reserved_for_pt; 1660 1660 1661 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 1661 + if (adev->flags & AMD_IS_APU) { 1662 1662 system_mem_available = no_system_mem_limit ? 1663 1663 kfd_mem_limit.max_system_mem_limit : 1664 1664 kfd_mem_limit.max_system_mem_limit - ··· 1706 1706 if (flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) { 1707 1707 domain = alloc_domain = AMDGPU_GEM_DOMAIN_VRAM; 1708 1708 1709 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 1709 + if (adev->flags & AMD_IS_APU) { 1710 1710 domain = AMDGPU_GEM_DOMAIN_GTT; 1711 1711 alloc_domain = AMDGPU_GEM_DOMAIN_GTT; 1712 1712 alloc_flags = 0; ··· 1953 1953 if (size) { 1954 1954 if (!is_imported && 1955 1955 (mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM || 1956 - ((adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) && 1956 + ((adev->flags & AMD_IS_APU) && 1957 1957 mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT))) 1958 1958 *size = bo_size; 1959 1959 else ··· 2376 2376 (*mem)->bo = bo; 2377 2377 (*mem)->va = va; 2378 2378 (*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) && 2379 - !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ? 2379 + !(adev->flags & AMD_IS_APU) ? 2380 2380 AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT; 2381 2381 2382 2382 (*mem)->mapped_to_gpu_memory = 0;
+12 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 5944 5944 *speed = PCI_SPEED_UNKNOWN; 5945 5945 *width = PCIE_LNK_WIDTH_UNKNOWN; 5946 5946 5947 - while ((parent = pci_upstream_bridge(parent))) { 5948 - /* skip upstream/downstream switches internal to dGPU*/ 5949 - if (parent->vendor == PCI_VENDOR_ID_ATI) 5950 - continue; 5951 - *speed = pcie_get_speed_cap(parent); 5952 - *width = pcie_get_width_cap(parent); 5953 - break; 5947 + if (amdgpu_device_pcie_dynamic_switching_supported(adev)) { 5948 + while ((parent = pci_upstream_bridge(parent))) { 5949 + /* skip upstream/downstream switches internal to dGPU*/ 5950 + if (parent->vendor == PCI_VENDOR_ID_ATI) 5951 + continue; 5952 + *speed = pcie_get_speed_cap(parent); 5953 + *width = pcie_get_width_cap(parent); 5954 + break; 5955 + } 5956 + } else { 5957 + /* use the current speeds rather than max if switching is not supported */ 5958 + pcie_bandwidth_available(adev->pdev, NULL, speed, width); 5954 5959 } 5955 5960 } 5956 5961
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 46 46 #define AMDGPU_RAS_GPU_ERR_HBM_BIST_TEST(x) AMDGPU_GET_REG_FIELD(x, 7, 7) 47 47 #define AMDGPU_RAS_GPU_ERR_SOCKET_ID(x) AMDGPU_GET_REG_FIELD(x, 10, 8) 48 48 #define AMDGPU_RAS_GPU_ERR_AID_ID(x) AMDGPU_GET_REG_FIELD(x, 12, 11) 49 - #define AMDGPU_RAS_GPU_ERR_HBM_ID(x) AMDGPU_GET_REG_FIELD(x, 13, 13) 49 + #define AMDGPU_RAS_GPU_ERR_HBM_ID(x) AMDGPU_GET_REG_FIELD(x, 14, 13) 50 50 #define AMDGPU_RAS_GPU_ERR_BOOT_STATUS(x) AMDGPU_GET_REG_FIELD(x, 31, 31) 51 51 52 52 #define AMDGPU_RAS_BOOT_STATUS_POLLING_LIMIT 1000
+5 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
··· 706 706 struct amdgpu_vm_bo_base *entry) 707 707 { 708 708 struct amdgpu_vm_bo_base *parent = amdgpu_vm_pt_parent(entry); 709 - struct amdgpu_bo *bo = parent->bo, *pbo; 709 + struct amdgpu_bo *bo, *pbo; 710 710 struct amdgpu_vm *vm = params->vm; 711 711 uint64_t pde, pt, flags; 712 712 unsigned int level; 713 713 714 + if (WARN_ON(!parent)) 715 + return -EINVAL; 716 + 717 + bo = parent->bo; 714 718 for (level = 0, pbo = bo->parent; pbo; ++level) 715 719 pbo = pbo->parent; 716 720
+1 -1
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
··· 422 422 423 423 if (adev->gmc.num_mem_partitions == num_xcc / 2) 424 424 return (adev->flags & AMD_IS_APU) ? AMDGPU_TPX_PARTITION_MODE : 425 - AMDGPU_QPX_PARTITION_MODE; 425 + AMDGPU_CPX_PARTITION_MODE; 426 426 427 427 if (adev->gmc.num_mem_partitions == 2 && !(adev->flags & AMD_IS_APU)) 428 428 return AMDGPU_DPX_PARTITION_MODE;
+2 -9
drivers/gpu/drm/amd/amdkfd/kfd_device.c
··· 408 408 f2g = &gfx_v11_kfd2kgd; 409 409 break; 410 410 case IP_VERSION(11, 0, 3): 411 - if ((adev->pdev->device == 0x7460 && 412 - adev->pdev->revision == 0x00) || 413 - (adev->pdev->device == 0x7461 && 414 - adev->pdev->revision == 0x00)) 415 - /* Note: Compiler version is 11.0.5 while HW version is 11.0.3 */ 416 - gfx_target_version = 110005; 417 - else 418 - /* Note: Compiler version is 11.0.1 while HW version is 11.0.3 */ 419 - gfx_target_version = 110001; 411 + /* Note: Compiler version is 11.0.1 while HW version is 11.0.3 */ 412 + gfx_target_version = 110001; 420 413 f2g = &gfx_v11_kfd2kgd; 421 414 break; 422 415 case IP_VERSION(11, 5, 0):
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
··· 1023 1023 if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 0, 1)) 1024 1024 return -EINVAL; 1025 1025 1026 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) 1026 + if (adev->flags & AMD_IS_APU) 1027 1027 return 0; 1028 1028 1029 1029 pgmap = &kfddev->pgmap;
+2 -4
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 2619 2619 return -1; 2620 2620 } 2621 2621 2622 - if (node->adev->gmc.is_app_apu || 2623 - node->adev->flags & AMD_IS_APU) 2622 + if (node->adev->flags & AMD_IS_APU) 2624 2623 return 0; 2625 2624 2626 2625 if (prange->preferred_loc == gpuid || ··· 3337 3338 goto out; 3338 3339 } 3339 3340 3340 - if (bo_node->adev->gmc.is_app_apu || 3341 - bo_node->adev->flags & AMD_IS_APU) { 3341 + if (bo_node->adev->flags & AMD_IS_APU) { 3342 3342 best_loc = 0; 3343 3343 goto out; 3344 3344 }
-1
drivers/gpu/drm/amd/amdkfd/kfd_svm.h
··· 201 201 * is initialized to not 0 when page migration register device memory. 202 202 */ 203 203 #define KFD_IS_SVM_API_SUPPORTED(adev) ((adev)->kfd.pgmap.type != 0 ||\ 204 - (adev)->gmc.is_app_apu ||\ 205 204 ((adev)->flags & AMD_IS_APU)) 206 205 207 206 void svm_range_bo_unref_async(struct svm_range_bo *svm_bo);
+3
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 613 613 &connector->base, 614 614 dev->mode_config.tile_property, 615 615 0); 616 + connector->colorspace_property = master->base.colorspace_property; 617 + if (connector->colorspace_property) 618 + drm_connector_attach_colorspace_property(connector); 616 619 617 620 drm_connector_set_path_property(connector, pathprop); 618 621
+1 -1
drivers/gpu/drm/amd/include/atomfirmware.h
··· 3583 3583 uint8_t phase_delay_us; // phase delay in unit of micro second 3584 3584 uint8_t reserved; 3585 3585 uint32_t gpio_mask_val; // GPIO Mask value 3586 - struct atom_voltage_gpio_map_lut voltage_gpio_lut[1]; 3586 + struct atom_voltage_gpio_map_lut voltage_gpio_lut[] __counted_by(gpio_entry_num); 3587 3587 }; 3588 3588 3589 3589 struct atom_svid2_voltage_object_v4
-1
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
··· 1562 1562 smu_i2c->port = i; 1563 1563 mutex_init(&smu_i2c->mutex); 1564 1564 control->owner = THIS_MODULE; 1565 - control->class = I2C_CLASS_SPD; 1566 1565 control->dev.parent = &adev->pdev->dev; 1567 1566 control->algo = &smu_v14_0_2_i2c_algo; 1568 1567 snprintf(control->name, sizeof(control->name), "AMDGPU SMU %d", i);
+1 -1
drivers/gpu/drm/drm_buddy.c
··· 239 239 if (size < chunk_size) 240 240 return -EINVAL; 241 241 242 - if (chunk_size < PAGE_SIZE) 242 + if (chunk_size < SZ_4K) 243 243 return -EINVAL; 244 244 245 245 if (!is_power_of_2(chunk_size))
+5
drivers/gpu/drm/drm_gem_shmem_helper.c
··· 233 233 234 234 dma_resv_assert_held(shmem->base.resv); 235 235 236 + drm_WARN_ON(shmem->base.dev, shmem->base.import_attach); 237 + 236 238 ret = drm_gem_shmem_get_pages(shmem); 237 239 238 240 return ret; ··· 612 610 613 611 return ret; 614 612 } 613 + 614 + if (is_cow_mapping(vma->vm_flags)) 615 + return -EINVAL; 615 616 616 617 dma_resv_lock(shmem->base.resv, NULL); 617 618 ret = drm_gem_shmem_get_pages(shmem);
+21 -11
drivers/gpu/drm/i915/display/intel_audio.c
··· 1252 1252 static void i915_audio_component_init(struct drm_i915_private *i915) 1253 1253 { 1254 1254 u32 aud_freq, aud_freq_init; 1255 - int ret; 1256 - 1257 - ret = component_add_typed(i915->drm.dev, 1258 - &i915_audio_component_bind_ops, 1259 - I915_COMPONENT_AUDIO); 1260 - if (ret < 0) { 1261 - drm_err(&i915->drm, 1262 - "failed to add audio component (%d)\n", ret); 1263 - /* continue with reduced functionality */ 1264 - return; 1265 - } 1266 1255 1267 1256 if (DISPLAY_VER(i915) >= 9) { 1268 1257 aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL); ··· 1274 1285 1275 1286 /* init with current cdclk */ 1276 1287 intel_audio_cdclk_change_post(i915); 1288 + } 1289 + 1290 + static void i915_audio_component_register(struct drm_i915_private *i915) 1291 + { 1292 + int ret; 1293 + 1294 + ret = component_add_typed(i915->drm.dev, 1295 + &i915_audio_component_bind_ops, 1296 + I915_COMPONENT_AUDIO); 1297 + if (ret < 0) { 1298 + drm_err(&i915->drm, 1299 + "failed to add audio component (%d)\n", ret); 1300 + /* continue with reduced functionality */ 1301 + return; 1302 + } 1277 1303 1278 1304 i915->display.audio.component_registered = true; 1279 1305 } ··· 1319 1315 { 1320 1316 if (intel_lpe_audio_init(i915) < 0) 1321 1317 i915_audio_component_init(i915); 1318 + } 1319 + 1320 + void intel_audio_register(struct drm_i915_private *i915) 1321 + { 1322 + if (!i915->display.audio.lpe.platdev) 1323 + i915_audio_component_register(i915); 1322 1324 } 1323 1325 1324 1326 /**
+1
drivers/gpu/drm/i915/display/intel_audio.h
··· 28 28 void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv); 29 29 void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv); 30 30 void intel_audio_init(struct drm_i915_private *dev_priv); 31 + void intel_audio_register(struct drm_i915_private *i915); 31 32 void intel_audio_deinit(struct drm_i915_private *dev_priv); 32 33 void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state); 33 34
+2
drivers/gpu/drm/i915/display/intel_display_driver.c
··· 540 540 541 541 intel_display_driver_enable_user_access(i915); 542 542 543 + intel_audio_register(i915); 544 + 543 545 intel_display_debugfs_register(i915); 544 546 545 547 /*
+18
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 255 255 struct intel_context *context; /* logical state for the request */ 256 256 struct i915_gem_context *gem_context; /** caller's context */ 257 257 intel_wakeref_t wakeref; 258 + intel_wakeref_t wakeref_gt0; 258 259 259 260 /** our requests to build */ 260 261 struct i915_request *requests[MAX_ENGINE_INSTANCE + 1]; ··· 2686 2685 eb_select_engine(struct i915_execbuffer *eb) 2687 2686 { 2688 2687 struct intel_context *ce, *child; 2688 + struct intel_gt *gt; 2689 2689 unsigned int idx; 2690 2690 int err; 2691 2691 ··· 2710 2708 } 2711 2709 } 2712 2710 eb->num_batches = ce->parallel.number_children + 1; 2711 + gt = ce->engine->gt; 2713 2712 2714 2713 for_each_child(ce, child) 2715 2714 intel_context_get(child); 2716 2715 eb->wakeref = intel_gt_pm_get(ce->engine->gt); 2716 + /* 2717 + * Keep GT0 active on MTL so that i915_vma_parked() doesn't 2718 + * free VMAs while execbuf ioctl is validating VMAs. 2719 + */ 2720 + if (gt->info.id) 2721 + eb->wakeref_gt0 = intel_gt_pm_get(to_gt(gt->i915)); 2717 2722 2718 2723 if (!test_bit(CONTEXT_ALLOC_BIT, &ce->flags)) { 2719 2724 err = intel_context_alloc_state(ce); ··· 2759 2750 return err; 2760 2751 2761 2752 err: 2753 + if (gt->info.id) 2754 + intel_gt_pm_put(to_gt(gt->i915), eb->wakeref_gt0); 2755 + 2762 2756 intel_gt_pm_put(ce->engine->gt, eb->wakeref); 2763 2757 for_each_child(ce, child) 2764 2758 intel_context_put(child); ··· 2775 2763 struct intel_context *child; 2776 2764 2777 2765 i915_vm_put(eb->context->vm); 2766 + /* 2767 + * This works in conjunction with eb_select_engine() to prevent 2768 + * i915_vma_parked() from interfering while execbuf validates vmas. 2769 + */ 2770 + if (eb->gt->info.id) 2771 + intel_gt_pm_put(to_gt(eb->gt->i915), eb->wakeref_gt0); 2778 2772 intel_gt_pm_put(eb->context->engine->gt, eb->wakeref); 2779 2773 for_each_child(eb->context, child) 2780 2774 intel_context_put(child);
+3 -1
drivers/gpu/drm/i915/gem/i915_gem_object.h
··· 284 284 static inline bool 285 285 i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) 286 286 { 287 - return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE); 287 + /* TODO: make DPT shrinkable when it has no bound vmas */ 288 + return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) && 289 + !obj->is_dpt; 288 290 } 289 291 290 292 static inline bool
+1 -1
drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
··· 196 196 if (err) 197 197 goto out_file; 198 198 199 - mode = intel_gt_coherent_map_type(to_gt(i915), native_obj, true); 199 + mode = intel_gt_coherent_map_type(to_gt(i915), native_obj, false); 200 200 vaddr = i915_gem_object_pin_map_unlocked(native_obj, mode); 201 201 if (IS_ERR(vaddr)) { 202 202 err = PTR_ERR(vaddr);
+7 -8
drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
··· 263 263 i915_request_put(rq); 264 264 } 265 265 266 + /* Lazy irq enabling after HW submission */ 266 267 if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers)) 267 268 intel_breadcrumbs_arm_irq(b); 269 + 270 + /* And confirm that we still want irqs enabled before we yield */ 271 + if (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) 272 + intel_breadcrumbs_disarm_irq(b); 268 273 } 269 274 270 275 struct intel_breadcrumbs * ··· 320 315 return; 321 316 322 317 /* Kick the work once more to drain the signalers, and disarm the irq */ 323 - irq_work_sync(&b->irq_work); 324 - while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) { 325 - local_irq_disable(); 326 - signal_irq_work(&b->irq_work); 327 - local_irq_enable(); 328 - cond_resched(); 329 - } 318 + irq_work_queue(&b->irq_work); 330 319 } 331 320 332 321 void intel_breadcrumbs_free(struct kref *kref) ··· 403 404 * the request as it may have completed and raised the interrupt as 404 405 * we were attaching it into the lists. 405 406 */ 406 - if (!b->irq_armed || __i915_request_is_complete(rq)) 407 + if (!READ_ONCE(b->irq_armed) || __i915_request_is_complete(rq)) 407 408 irq_work_queue(&b->irq_work); 408 409 } 409 410
+6
drivers/gpu/drm/i915/gt/intel_engine_cs.c
··· 885 885 if (IS_DG2(gt->i915)) { 886 886 u8 first_ccs = __ffs(CCS_MASK(gt)); 887 887 888 + /* 889 + * Store the number of active cslices before 890 + * changing the CCS engine configuration 891 + */ 892 + gt->ccs.cslices = CCS_MASK(gt); 893 + 888 894 /* Mask off all the CCS engine */ 889 895 info->engine_mask &= ~GENMASK(CCS3, CCS0); 890 896 /* Put back in the first CCS engine */
+1 -1
drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
··· 19 19 20 20 /* Build the value for the fixed CCS load balancing */ 21 21 for (cslice = 0; cslice < I915_MAX_CCS; cslice++) { 22 - if (CCS_MASK(gt) & BIT(cslice)) 22 + if (gt->ccs.cslices & BIT(cslice)) 23 23 /* 24 24 * If available, assign the cslice 25 25 * to the first available engine...
+8
drivers/gpu/drm/i915/gt/intel_gt_types.h
··· 207 207 [MAX_ENGINE_INSTANCE + 1]; 208 208 enum intel_submission_method submission_method; 209 209 210 + struct { 211 + /* 212 + * Mask of the non fused CCS slices 213 + * to be used for the load balancing 214 + */ 215 + intel_engine_mask_t cslices; 216 + } ccs; 217 + 210 218 /* 211 219 * Default address space (either GGTT or ppGTT depending on arch). 212 220 *
+3 -3
drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
··· 29 29 */ 30 30 31 31 #define GUC_KLV_LEN_MIN 1u 32 - #define GUC_KLV_0_KEY (0xffff << 16) 33 - #define GUC_KLV_0_LEN (0xffff << 0) 34 - #define GUC_KLV_n_VALUE (0xffffffff << 0) 32 + #define GUC_KLV_0_KEY (0xffffu << 16) 33 + #define GUC_KLV_0_LEN (0xffffu << 0) 34 + #define GUC_KLV_n_VALUE (0xffffffffu << 0) 35 35 36 36 /** 37 37 * DOC: GuC Self Config KLVs
+1 -1
drivers/gpu/drm/lima/lima_gem.c
··· 185 185 if (bo->heap_size) 186 186 return -EINVAL; 187 187 188 - return drm_gem_shmem_pin(&bo->base); 188 + return drm_gem_shmem_pin_locked(&bo->base); 189 189 } 190 190 191 191 static int lima_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
+3 -2
drivers/gpu/drm/msm/registers/gen_header.py
··· 538 538 self.variants.add(reg.domain) 539 539 540 540 def do_validate(self, schemafile): 541 - if self.validate == False: 541 + if not self.validate: 542 542 return 543 543 544 544 try: ··· 948 948 parser = argparse.ArgumentParser() 949 949 parser.add_argument('--rnn', type=str, required=True) 950 950 parser.add_argument('--xml', type=str, required=True) 951 - parser.add_argument('--validate', action=argparse.BooleanOptionalAction) 951 + parser.add_argument('--validate', default=False, action='store_true') 952 + parser.add_argument('--no-validate', dest='validate', action='store_false') 952 953 953 954 subparsers = parser.add_subparsers() 954 955 subparsers.required = True
+18 -6
drivers/gpu/drm/nouveau/nvif/object.c
··· 142 142 struct nvif_ioctl_v0 ioctl; 143 143 struct nvif_ioctl_mthd_v0 mthd; 144 144 } *args; 145 + u32 args_size; 145 146 u8 stack[128]; 146 147 int ret; 147 148 148 - if (sizeof(*args) + size > sizeof(stack)) { 149 - if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) 149 + if (check_add_overflow(sizeof(*args), size, &args_size)) 150 + return -ENOMEM; 151 + 152 + if (args_size > sizeof(stack)) { 153 + args = kmalloc(args_size, GFP_KERNEL); 154 + if (!args) 150 155 return -ENOMEM; 151 156 } else { 152 157 args = (void *)stack; ··· 162 157 args->mthd.method = mthd; 163 158 164 159 memcpy(args->mthd.data, data, size); 165 - ret = nvif_object_ioctl(object, args, sizeof(*args) + size, NULL); 160 + ret = nvif_object_ioctl(object, args, args_size, NULL); 166 161 memcpy(data, args->mthd.data, size); 167 162 if (args != (void *)stack) 168 163 kfree(args); ··· 281 276 object->map.size = 0; 282 277 283 278 if (parent) { 284 - if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) { 279 + u32 args_size; 280 + 281 + if (check_add_overflow(sizeof(*args), size, &args_size)) { 282 + nvif_object_dtor(object); 283 + return -ENOMEM; 284 + } 285 + 286 + args = kmalloc(args_size, GFP_KERNEL); 287 + if (!args) { 285 288 nvif_object_dtor(object); 286 289 return -ENOMEM; 287 290 } ··· 306 293 args->new.oclass = oclass; 307 294 308 295 memcpy(args->new.data, data, size); 309 - ret = nvif_object_ioctl(parent, args, sizeof(*args) + size, 310 - &object->priv); 296 + ret = nvif_object_ioctl(parent, args, args_size, &object->priv); 311 297 memcpy(data, args->new.data, size); 312 298 kfree(args); 313 299 if (ret == 0)
+2
drivers/gpu/drm/panel/Kconfig
··· 340 340 depends on OF 341 341 depends on DRM_MIPI_DSI 342 342 depends on BACKLIGHT_CLASS_DEVICE 343 + select DRM_DISPLAY_DP_HELPER 344 + select DRM_DISPLAY_HELPER 343 345 help 344 346 Say Y here if you want to enable support for LG sw43408 panel. 345 347 The panel has a 1080x2160@60Hz resolution and uses 24 bit RGB per
+1 -1
drivers/gpu/drm/panel/panel-lg-sw43408.c
··· 182 182 return mipi_dsi_dcs_set_display_brightness_large(dsi, brightness); 183 183 } 184 184 185 - const struct backlight_ops sw43408_backlight_ops = { 185 + static const struct backlight_ops sw43408_backlight_ops = { 186 186 .update_status = sw43408_backlight_update_status, 187 187 }; 188 188
+8 -8
drivers/gpu/drm/panel/panel-sitronix-st7789v.c
··· 282 282 static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = { 283 283 .clock = 6000, 284 284 .hdisplay = 240, 285 - .hsync_start = 240 + 28, 286 - .hsync_end = 240 + 28 + 10, 287 - .htotal = 240 + 28 + 10 + 10, 285 + .hsync_start = 240 + 38, 286 + .hsync_end = 240 + 38 + 10, 287 + .htotal = 240 + 38 + 10 + 10, 288 288 .vdisplay = 280, 289 - .vsync_start = 280 + 8, 290 - .vsync_end = 280 + 8 + 4, 291 - .vtotal = 280 + 8 + 4 + 4, 292 - .width_mm = 43, 293 - .height_mm = 37, 289 + .vsync_start = 280 + 48, 290 + .vsync_end = 280 + 48 + 4, 291 + .vtotal = 280 + 48 + 4 + 4, 292 + .width_mm = 37, 293 + .height_mm = 43, 294 294 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC, 295 295 }; 296 296
+1 -1
drivers/gpu/drm/panfrost/panfrost_gem.c
··· 192 192 if (bo->is_heap) 193 193 return -EINVAL; 194 194 195 - return drm_gem_shmem_pin(&bo->base); 195 + return drm_gem_shmem_pin_locked(&bo->base); 196 196 } 197 197 198 198 static enum drm_gem_object_status panfrost_gem_status(struct drm_gem_object *obj)
+21 -21
drivers/gpu/drm/tests/drm_buddy_test.c
··· 505 505 * Eventually we will have a fully 50% fragmented mm. 506 506 */ 507 507 508 - mm_size = PAGE_SIZE << max_order; 509 - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), 508 + mm_size = SZ_4K << max_order; 509 + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K), 510 510 "buddy_init failed\n"); 511 511 512 512 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); ··· 520 520 } 521 521 522 522 for (order = top; order--;) { 523 - size = get_size(order, PAGE_SIZE); 523 + size = get_size(order, mm.chunk_size); 524 524 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, 525 525 mm_size, size, size, 526 526 &tmp, flags), ··· 534 534 } 535 535 536 536 /* There should be one final page for this sub-allocation */ 537 - size = get_size(0, PAGE_SIZE); 537 + size = get_size(0, mm.chunk_size); 538 538 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 539 539 size, size, &tmp, flags), 540 540 "buddy_alloc hit -ENOMEM for hole\n"); ··· 544 544 545 545 list_move_tail(&block->link, &holes); 546 546 547 - size = get_size(top, PAGE_SIZE); 547 + size = get_size(top, mm.chunk_size); 548 548 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 549 549 size, size, &tmp, flags), 550 550 "buddy_alloc unexpectedly succeeded at top-order %d/%d, it should be full!", ··· 555 555 556 556 /* Nothing larger than blocks of chunk_size now available */ 557 557 for (order = 1; order <= max_order; order++) { 558 - size = get_size(order, PAGE_SIZE); 558 + size = get_size(order, mm.chunk_size); 559 559 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 560 560 size, size, &tmp, flags), 561 561 "buddy_alloc unexpectedly succeeded at order %d, it should be full!", ··· 584 584 * page left. 585 585 */ 586 586 587 - mm_size = PAGE_SIZE << max_order; 588 - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), 587 + mm_size = SZ_4K << max_order; 588 + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K), 589 589 "buddy_init failed\n"); 590 590 591 591 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); 592 592 593 593 for (order = 0; order < max_order; order++) { 594 - size = get_size(order, PAGE_SIZE); 594 + size = get_size(order, mm.chunk_size); 595 595 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 596 596 size, size, &tmp, flags), 597 597 "buddy_alloc hit -ENOMEM with order=%d\n", ··· 604 604 } 605 605 606 606 /* And now the last remaining block available */ 607 - size = get_size(0, PAGE_SIZE); 607 + size = get_size(0, mm.chunk_size); 608 608 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 609 609 size, size, &tmp, flags), 610 610 "buddy_alloc hit -ENOMEM on final alloc\n"); ··· 616 616 617 617 /* Should be completely full! */ 618 618 for (order = max_order; order--;) { 619 - size = get_size(order, PAGE_SIZE); 619 + size = get_size(order, mm.chunk_size); 620 620 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 621 621 size, size, &tmp, flags), 622 622 "buddy_alloc unexpectedly succeeded, it should be full!"); ··· 632 632 list_del(&block->link); 633 633 drm_buddy_free_block(&mm, block); 634 634 635 - size = get_size(order, PAGE_SIZE); 635 + size = get_size(order, mm.chunk_size); 636 636 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 637 637 size, size, &tmp, flags), 638 638 "buddy_alloc hit -ENOMEM with order=%d\n", ··· 647 647 } 648 648 649 649 /* To confirm, now the whole mm should be available */ 650 - size = get_size(max_order, PAGE_SIZE); 650 + size = get_size(max_order, mm.chunk_size); 651 651 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 652 652 size, size, &tmp, flags), 653 653 "buddy_alloc (realloc) hit -ENOMEM with order=%d\n", ··· 678 678 * try to allocate them all. 679 679 */ 680 680 681 - mm_size = PAGE_SIZE * ((1 << (max_order + 1)) - 1); 681 + mm_size = SZ_4K * ((1 << (max_order + 1)) - 1); 682 682 683 - KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), 683 + KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, SZ_4K), 684 684 "buddy_init failed\n"); 685 685 686 686 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); 687 687 688 688 for (order = 0; order <= max_order; order++) { 689 - size = get_size(order, PAGE_SIZE); 689 + size = get_size(order, mm.chunk_size); 690 690 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 691 691 size, size, &tmp, flags), 692 692 "buddy_alloc hit -ENOMEM with order=%d\n", ··· 699 699 } 700 700 701 701 /* Should be completely full! */ 702 - size = get_size(0, PAGE_SIZE); 702 + size = get_size(0, mm.chunk_size); 703 703 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, 704 704 size, size, &tmp, flags), 705 705 "buddy_alloc unexpectedly succeeded, it should be full!"); ··· 716 716 LIST_HEAD(allocated); 717 717 struct drm_buddy mm; 718 718 719 - KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, PAGE_SIZE)); 719 + KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, SZ_4K)); 720 720 721 721 KUNIT_EXPECT_EQ_MSG(test, mm.max_order, DRM_BUDDY_MAX_ORDER, 722 722 "mm.max_order(%d) != %d\n", mm.max_order, ··· 724 724 725 725 size = mm.chunk_size << mm.max_order; 726 726 KUNIT_EXPECT_FALSE(test, drm_buddy_alloc_blocks(&mm, start, size, size, 727 - PAGE_SIZE, &allocated, flags)); 727 + mm.chunk_size, &allocated, flags)); 728 728 729 729 block = list_first_entry_or_null(&allocated, struct drm_buddy_block, link); 730 730 KUNIT_EXPECT_TRUE(test, block); ··· 734 734 drm_buddy_block_order(block), mm.max_order); 735 735 736 736 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_size(&mm, block), 737 - BIT_ULL(mm.max_order) * PAGE_SIZE, 737 + BIT_ULL(mm.max_order) * mm.chunk_size, 738 738 "block size(%llu) != %llu\n", 739 739 drm_buddy_block_size(&mm, block), 740 - BIT_ULL(mm.max_order) * PAGE_SIZE); 740 + BIT_ULL(mm.max_order) * mm.chunk_size); 741 741 742 742 drm_buddy_free_list(&mm, &allocated, 0); 743 743 drm_buddy_fini(&mm);
+1
drivers/gpu/drm/xe/xe_guc_submit.c
··· 1240 1240 return 0; 1241 1241 1242 1242 err_entity: 1243 + mutex_unlock(&guc->submission_state.lock); 1243 1244 xe_sched_entity_fini(&ge->entity); 1244 1245 err_sched: 1245 1246 xe_sched_fini(&ge->sched);
+5 -7
drivers/gpu/drm/xe/xe_migrate.c
··· 34 34 #include "xe_sync.h" 35 35 #include "xe_trace.h" 36 36 #include "xe_vm.h" 37 - #include "xe_wa.h" 38 37 39 38 /** 40 39 * struct xe_migrate - migrate context. ··· 299 300 } 300 301 301 302 /* 302 - * Due to workaround 16017236439, odd instance hardware copy engines are 303 - * faster than even instance ones. 304 - * This function returns the mask involving all fast copy engines and the 305 - * reserved copy engine to be used as logical mask for migrate engine. 306 303 * Including the reserved copy engine is required to avoid deadlocks due to 307 304 * migrate jobs servicing the faults gets stuck behind the job that faulted. 308 305 */ ··· 312 317 if (hwe->class != XE_ENGINE_CLASS_COPY) 313 318 continue; 314 319 315 - if (!XE_WA(gt, 16017236439) || 316 - xe_gt_is_usm_hwe(gt, hwe) || hwe->instance & 1) 320 + if (xe_gt_is_usm_hwe(gt, hwe)) 317 321 logical_mask |= BIT(hwe->logical_instance); 318 322 } 319 323 ··· 363 369 if (!hwe || !logical_mask) 364 370 return ERR_PTR(-EINVAL); 365 371 372 + /* 373 + * XXX: Currently only reserving 1 (likely slow) BCS instance on 374 + * PVC, may want to revisit if performance is needed. 375 + */ 366 376 m->q = xe_exec_queue_create(xe, vm, logical_mask, 1, hwe, 367 377 EXEC_QUEUE_FLAG_KERNEL | 368 378 EXEC_QUEUE_FLAG_PERMANENT |
+1 -1
drivers/gpu/drm/xe/xe_pcode.c
··· 191 191 drm_WARN_ON_ONCE(&gt_to_xe(gt)->drm, timeout_base_ms > 1); 192 192 preempt_disable(); 193 193 ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status, 194 - true, timeout_base_ms * 1000, true); 194 + true, 50 * 1000, true); 195 195 preempt_enable(); 196 196 197 197 out:
+8
drivers/hwmon/dell-smm-hwmon.c
··· 1545 1545 }, 1546 1546 .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1547 1547 }, 1548 + { 1549 + .ident = "Dell G15 5511", 1550 + .matches = { 1551 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 1552 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), 1553 + }, 1554 + .driver_data = (void *)&i8k_fan_control_data[I8K_FAN_30A3_31A3], 1555 + }, 1548 1556 { } 1549 1557 }; 1550 1558
+1 -1
drivers/hwmon/intel-m10-bmc-hwmon.c
··· 429 429 }; 430 430 431 431 static const struct m10bmc_sdata n6000bmc_power_tbl[] = { 432 - { 0x724, 0x0, 0x0, 0x0, 0x0, 1, "Board Power" }, 432 + { 0x724, 0x0, 0x0, 0x0, 0x0, 1000, "Board Power" }, 433 433 }; 434 434 435 435 static const struct hwmon_channel_info * const n6000bmc_hinfo[] = {
+3 -1
drivers/hwmon/ltc2992.c
··· 876 876 877 877 ret = fwnode_property_read_u32(child, "shunt-resistor-micro-ohms", &val); 878 878 if (!ret) { 879 - if (!val) 879 + if (!val) { 880 + fwnode_handle_put(child); 880 881 return dev_err_probe(&st->client->dev, -EINVAL, 881 882 "shunt resistor value cannot be zero\n"); 883 + } 882 884 st->r_sense_uohm[addr] = val; 883 885 } 884 886 }
+1 -1
drivers/hwmon/shtc1.c
··· 238 238 239 239 if (np) { 240 240 data->setup.blocking_io = of_property_read_bool(np, "sensirion,blocking-io"); 241 - data->setup.high_precision = !of_property_read_bool(np, "sensicon,low-precision"); 241 + data->setup.high_precision = !of_property_read_bool(np, "sensirion,low-precision"); 242 242 } else { 243 243 if (client->dev.platform_data) 244 244 data->setup = *(struct shtc1_platform_data *)dev->platform_data;
-1
drivers/mailbox/zynqmp-ipi-mailbox.c
··· 850 850 return ret; 851 851 } 852 852 853 - irq_to_desc(pdata->virq_sgi); 854 853 irq_set_status_flags(pdata->virq_sgi, IRQ_PER_CPU); 855 854 856 855 /* Setup function for the CPU hot-plug cases */
+7 -14
drivers/md/bcache/alloc.c
··· 129 129 130 130 bool bch_can_invalidate_bucket(struct cache *ca, struct bucket *b) 131 131 { 132 - BUG_ON(!ca->set->gc_mark_valid); 133 - 134 - return (!GC_MARK(b) || 135 - GC_MARK(b) == GC_MARK_RECLAIMABLE) && 136 - !atomic_read(&b->pin) && 137 - can_inc_bucket_gen(b); 132 + return (ca->set->gc_mark_valid || b->reclaimable_in_gc) && 133 + ((!GC_MARK(b) || GC_MARK(b) == GC_MARK_RECLAIMABLE) && 134 + !atomic_read(&b->pin) && can_inc_bucket_gen(b)); 138 135 } 139 136 140 137 void __bch_invalidate_one_bucket(struct cache *ca, struct bucket *b) ··· 145 148 bch_inc_gen(ca, b); 146 149 b->prio = INITIAL_PRIO; 147 150 atomic_inc(&b->pin); 151 + b->reclaimable_in_gc = 0; 148 152 } 149 153 150 154 static void bch_invalidate_one_bucket(struct cache *ca, struct bucket *b) ··· 350 352 */ 351 353 352 354 retry_invalidate: 353 - allocator_wait(ca, ca->set->gc_mark_valid && 354 - !ca->invalidate_needs_gc); 355 + allocator_wait(ca, !ca->invalidate_needs_gc); 355 356 invalidate_buckets(ca); 356 357 357 358 /* ··· 498 501 499 502 ca = c->cache; 500 503 b = bch_bucket_alloc(ca, reserve, wait); 501 - if (b == -1) 502 - goto err; 504 + if (b < 0) 505 + return -1; 503 506 504 507 k->ptr[0] = MAKE_PTR(ca->buckets[b].gen, 505 508 bucket_to_sector(c, b), ··· 508 511 SET_KEY_PTRS(k, 1); 509 512 510 513 return 0; 511 - err: 512 - bch_bucket_free(c, k); 513 - bkey_put(c, k); 514 - return -1; 515 514 } 516 515 517 516 int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
+1
drivers/md/bcache/bcache.h
··· 200 200 uint8_t gen; 201 201 uint8_t last_gc; /* Most out of date gen in the btree */ 202 202 uint16_t gc_mark; /* Bitfield used by GC. See below for field */ 203 + uint16_t reclaimable_in_gc:1; 203 204 }; 204 205 205 206 /*
+6 -1
drivers/md/bcache/btree.c
··· 1741 1741 1742 1742 mutex_lock(&c->bucket_lock); 1743 1743 1744 - c->gc_mark_valid = 0; 1745 1744 c->gc_done = ZERO_KEY; 1746 1745 1747 1746 ca = c->cache; 1748 1747 for_each_bucket(b, ca) { 1749 1748 b->last_gc = b->gen; 1749 + if (bch_can_invalidate_bucket(ca, b)) 1750 + b->reclaimable_in_gc = 1; 1750 1751 if (!atomic_read(&b->pin)) { 1751 1752 SET_GC_MARK(b, 0); 1752 1753 SET_GC_SECTORS_USED(b, 0); 1753 1754 } 1754 1755 } 1755 1756 1757 + c->gc_mark_valid = 0; 1756 1758 mutex_unlock(&c->bucket_lock); 1757 1759 } 1758 1760 ··· 1810 1808 1811 1809 for_each_bucket(b, ca) { 1812 1810 c->need_gc = max(c->need_gc, bucket_gc_gen(b)); 1811 + 1812 + if (b->reclaimable_in_gc) 1813 + b->reclaimable_in_gc = 0; 1813 1814 1814 1815 if (atomic_read(&b->pin)) 1815 1816 continue;
+15 -1
drivers/md/bcache/request.c
··· 369 369 struct io *i; 370 370 371 371 if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) || 372 - c->gc_stats.in_use > CUTOFF_CACHE_ADD || 373 372 (bio_op(bio) == REQ_OP_DISCARD)) 374 373 goto skip; 374 + 375 + if (c->gc_stats.in_use > CUTOFF_CACHE_ADD) { 376 + /* 377 + * If cached buckets are all clean now, 'true' will be 378 + * returned and all requests will bypass the cache device. 379 + * Then c->sectors_to_gc has no chance to be negative, and 380 + * gc thread won't wake up and caching won't work forever. 381 + * Here call force_wake_up_gc() to avoid such aftermath. 382 + */ 383 + if (BDEV_STATE(&dc->sb) == BDEV_STATE_CLEAN && 384 + c->gc_mark_valid) 385 + force_wake_up_gc(c); 386 + 387 + goto skip; 388 + } 375 389 376 390 if (mode == CACHE_MODE_NONE || 377 391 (mode == CACHE_MODE_WRITEAROUND &&
+6 -9
drivers/md/dm-table.c
··· 1981 1981 if (!dm_table_supports_secure_erase(t)) 1982 1982 limits->max_secure_erase_sectors = 0; 1983 1983 1984 - r = queue_limits_set(q, limits); 1985 - if (r) 1986 - return r; 1987 - 1988 1984 if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_WC))) { 1989 1985 wc = true; 1990 1986 if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_FUA))) ··· 2032 2036 * For a zoned target, setup the zones related queue attributes 2033 2037 * and resources necessary for zone append emulation if necessary. 2034 2038 */ 2035 - if (blk_queue_is_zoned(q)) { 2036 - r = dm_set_zones_restrictions(t, q); 2039 + if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && limits->zoned) { 2040 + r = dm_set_zones_restrictions(t, q, limits); 2037 2041 if (r) 2038 2042 return r; 2039 - if (blk_queue_is_zoned(q) && 2040 - !static_key_enabled(&zoned_enabled.key)) 2041 - static_branch_enable(&zoned_enabled); 2042 2043 } 2044 + 2045 + r = queue_limits_set(q, limits); 2046 + if (r) 2047 + return r; 2043 2048 2044 2049 dm_update_crypto_profile(q, t); 2045 2050
+33 -39
drivers/md/dm-zone.c
··· 160 160 return 0; 161 161 } 162 162 163 - static int dm_check_zoned(struct mapped_device *md, struct dm_table *t) 164 - { 165 - struct gendisk *disk = md->disk; 166 - unsigned int nr_conv_zones = 0; 167 - int ret; 168 - 169 - /* Count conventional zones */ 170 - md->zone_revalidate_map = t; 171 - ret = dm_blk_report_zones(disk, 0, UINT_MAX, 172 - dm_check_zoned_cb, &nr_conv_zones); 173 - md->zone_revalidate_map = NULL; 174 - if (ret < 0) { 175 - DMERR("Check zoned failed %d", ret); 176 - return ret; 177 - } 178 - 179 - /* 180 - * If we only have conventional zones, expose the mapped device as 181 - * a regular device. 182 - */ 183 - if (nr_conv_zones >= ret) { 184 - disk->queue->limits.max_open_zones = 0; 185 - disk->queue->limits.max_active_zones = 0; 186 - disk->queue->limits.zoned = false; 187 - clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 188 - disk->nr_zones = 0; 189 - } 190 - 191 - return 0; 192 - } 193 - 194 163 /* 195 164 * Revalidate the zones of a mapped device to initialize resource necessary 196 165 * for zone append emulation. Note that we cannot simply use the block layer ··· 220 251 return true; 221 252 } 222 253 223 - int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q) 254 + int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, 255 + struct queue_limits *lim) 224 256 { 225 257 struct mapped_device *md = t->md; 258 + struct gendisk *disk = md->disk; 259 + unsigned int nr_conv_zones = 0; 226 260 int ret; 227 261 228 262 /* ··· 237 265 clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 238 266 } else { 239 267 set_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 240 - blk_queue_max_zone_append_sectors(q, 0); 268 + lim->max_zone_append_sectors = 0; 241 269 } 242 270 243 271 if (!get_capacity(md->disk)) 244 272 return 0; 245 273 246 274 /* 247 - * Check that the mapped device will indeed be zoned, that is, that it 248 - * has sequential write required zones. 275 + * Count conventional zones to check that the mapped device will indeed 276 + * have sequential write required zones. 249 277 */ 250 - ret = dm_check_zoned(md, t); 251 - if (ret) 278 + md->zone_revalidate_map = t; 279 + ret = dm_blk_report_zones(disk, 0, UINT_MAX, 280 + dm_check_zoned_cb, &nr_conv_zones); 281 + md->zone_revalidate_map = NULL; 282 + if (ret < 0) { 283 + DMERR("Check zoned failed %d", ret); 252 284 return ret; 253 - if (!blk_queue_is_zoned(q)) 285 + } 286 + 287 + /* 288 + * If we only have conventional zones, expose the mapped device as 289 + * a regular device. 290 + */ 291 + if (nr_conv_zones >= ret) { 292 + lim->max_open_zones = 0; 293 + lim->max_active_zones = 0; 294 + lim->zoned = false; 295 + clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 296 + disk->nr_zones = 0; 254 297 return 0; 298 + } 255 299 256 300 if (!md->disk->nr_zones) { 257 301 DMINFO("%s using %s zone append", ··· 275 287 queue_emulates_zone_append(q) ? "emulated" : "native"); 276 288 } 277 289 278 - return dm_revalidate_zones(md, t); 290 + ret = dm_revalidate_zones(md, t); 291 + if (ret < 0) 292 + return ret; 293 + 294 + if (!static_key_enabled(&zoned_enabled.key)) 295 + static_branch_enable(&zoned_enabled); 296 + return 0; 279 297 } 280 298 281 299 /*
+2 -1
drivers/md/dm.h
··· 101 101 /* 102 102 * Zoned targets related functions. 103 103 */ 104 - int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q); 104 + int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, 105 + struct queue_limits *lim); 105 106 void dm_zone_endio(struct dm_io *io, struct bio *clone); 106 107 #ifdef CONFIG_BLK_DEV_ZONED 107 108 int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
+1 -1
drivers/net/dsa/microchip/ksz_common.c
··· 3142 3142 else 3143 3143 interface = PHY_INTERFACE_MODE_MII; 3144 3144 } else if (val == bitval[P_RMII_SEL]) { 3145 - interface = PHY_INTERFACE_MODE_RGMII; 3145 + interface = PHY_INTERFACE_MODE_RMII; 3146 3146 } else { 3147 3147 interface = PHY_INTERFACE_MODE_RGMII; 3148 3148 if (data8 & P_RGMII_ID_EG_ENABLE)
-11
drivers/net/ethernet/amazon/ena/ena_com.c
··· 312 312 struct ena_com_io_sq *io_sq) 313 313 { 314 314 size_t size; 315 - int dev_node = 0; 316 315 317 316 memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr)); 318 317 ··· 324 325 size = io_sq->desc_entry_size * io_sq->q_depth; 325 326 326 327 if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST) { 327 - dev_node = dev_to_node(ena_dev->dmadev); 328 - set_dev_node(ena_dev->dmadev, ctx->numa_node); 329 328 io_sq->desc_addr.virt_addr = 330 329 dma_alloc_coherent(ena_dev->dmadev, size, &io_sq->desc_addr.phys_addr, 331 330 GFP_KERNEL); 332 - set_dev_node(ena_dev->dmadev, dev_node); 333 331 if (!io_sq->desc_addr.virt_addr) { 334 332 io_sq->desc_addr.virt_addr = 335 333 dma_alloc_coherent(ena_dev->dmadev, size, ··· 350 354 size = (size_t)io_sq->bounce_buf_ctrl.buffer_size * 351 355 io_sq->bounce_buf_ctrl.buffers_num; 352 356 353 - dev_node = dev_to_node(ena_dev->dmadev); 354 - set_dev_node(ena_dev->dmadev, ctx->numa_node); 355 357 io_sq->bounce_buf_ctrl.base_buffer = devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); 356 - set_dev_node(ena_dev->dmadev, dev_node); 357 358 if (!io_sq->bounce_buf_ctrl.base_buffer) 358 359 io_sq->bounce_buf_ctrl.base_buffer = 359 360 devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); ··· 390 397 struct ena_com_io_cq *io_cq) 391 398 { 392 399 size_t size; 393 - int prev_node = 0; 394 400 395 401 memset(&io_cq->cdesc_addr, 0x0, sizeof(io_cq->cdesc_addr)); 396 402 ··· 401 409 402 410 size = io_cq->cdesc_entry_size_in_bytes * io_cq->q_depth; 403 411 404 - prev_node = dev_to_node(ena_dev->dmadev); 405 - set_dev_node(ena_dev->dmadev, ctx->numa_node); 406 412 io_cq->cdesc_addr.virt_addr = 407 413 dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr, GFP_KERNEL); 408 - set_dev_node(ena_dev->dmadev, prev_node); 409 414 if (!io_cq->cdesc_addr.virt_addr) { 410 415 io_cq->cdesc_addr.virt_addr = 411 416 dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr,
+12
drivers/net/ethernet/cisco/enic/enic_main.c
··· 1117 1117 pp->request = nla_get_u8(port[IFLA_PORT_REQUEST]); 1118 1118 1119 1119 if (port[IFLA_PORT_PROFILE]) { 1120 + if (nla_len(port[IFLA_PORT_PROFILE]) != PORT_PROFILE_MAX) { 1121 + memcpy(pp, &prev_pp, sizeof(*pp)); 1122 + return -EINVAL; 1123 + } 1120 1124 pp->set |= ENIC_SET_NAME; 1121 1125 memcpy(pp->name, nla_data(port[IFLA_PORT_PROFILE]), 1122 1126 PORT_PROFILE_MAX); 1123 1127 } 1124 1128 1125 1129 if (port[IFLA_PORT_INSTANCE_UUID]) { 1130 + if (nla_len(port[IFLA_PORT_INSTANCE_UUID]) != PORT_UUID_MAX) { 1131 + memcpy(pp, &prev_pp, sizeof(*pp)); 1132 + return -EINVAL; 1133 + } 1126 1134 pp->set |= ENIC_SET_INSTANCE; 1127 1135 memcpy(pp->instance_uuid, 1128 1136 nla_data(port[IFLA_PORT_INSTANCE_UUID]), PORT_UUID_MAX); 1129 1137 } 1130 1138 1131 1139 if (port[IFLA_PORT_HOST_UUID]) { 1140 + if (nla_len(port[IFLA_PORT_HOST_UUID]) != PORT_UUID_MAX) { 1141 + memcpy(pp, &prev_pp, sizeof(*pp)); 1142 + return -EINVAL; 1143 + } 1132 1144 pp->set |= ENIC_SET_HOST; 1133 1145 memcpy(pp->host_uuid, 1134 1146 nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX);
+10
drivers/net/ethernet/freescale/fec_main.c
··· 4130 4130 return ret; 4131 4131 } 4132 4132 4133 + static void fec_enet_deinit(struct net_device *ndev) 4134 + { 4135 + struct fec_enet_private *fep = netdev_priv(ndev); 4136 + 4137 + netif_napi_del(&fep->napi); 4138 + fec_enet_free_queue(ndev); 4139 + } 4140 + 4133 4141 #ifdef CONFIG_OF 4134 4142 static int fec_reset_phy(struct platform_device *pdev) 4135 4143 { ··· 4532 4524 fec_enet_mii_remove(fep); 4533 4525 failed_mii_init: 4534 4526 failed_irq: 4527 + fec_enet_deinit(ndev); 4535 4528 failed_init: 4536 4529 fec_ptp_stop(pdev); 4537 4530 failed_reset: ··· 4596 4587 pm_runtime_put_noidle(&pdev->dev); 4597 4588 pm_runtime_disable(&pdev->dev); 4598 4589 4590 + fec_enet_deinit(ndev); 4599 4591 free_netdev(ndev); 4600 4592 } 4601 4593
+22
drivers/net/ethernet/intel/e1000e/ich8lan.c
··· 1225 1225 } 1226 1226 1227 1227 release: 1228 + /* Switching PHY interface always returns MDI error 1229 + * so disable retry mechanism to avoid wasting time 1230 + */ 1231 + e1000e_disable_phy_retry(hw); 1232 + 1233 + /* Force SMBus mode in PHY */ 1234 + ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg); 1235 + if (ret_val) { 1236 + e1000e_enable_phy_retry(hw); 1237 + hw->phy.ops.release(hw); 1238 + goto out; 1239 + } 1240 + phy_reg |= CV_SMB_CTRL_FORCE_SMBUS; 1241 + e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg); 1242 + 1243 + e1000e_enable_phy_retry(hw); 1244 + 1245 + /* Force SMBus mode in MAC */ 1246 + mac_reg = er32(CTRL_EXT); 1247 + mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS; 1248 + ew32(CTRL_EXT, mac_reg); 1249 + 1228 1250 hw->phy.ops.release(hw); 1229 1251 out: 1230 1252 if (ret_val)
-18
drivers/net/ethernet/intel/e1000e/netdev.c
··· 6623 6623 struct e1000_hw *hw = &adapter->hw; 6624 6624 u32 ctrl, ctrl_ext, rctl, status, wufc; 6625 6625 int retval = 0; 6626 - u16 smb_ctrl; 6627 6626 6628 6627 /* Runtime suspend should only enable wakeup for link changes */ 6629 6628 if (runtime) ··· 6696 6697 if (retval) 6697 6698 return retval; 6698 6699 } 6699 - 6700 - /* Force SMBUS to allow WOL */ 6701 - /* Switching PHY interface always returns MDI error 6702 - * so disable retry mechanism to avoid wasting time 6703 - */ 6704 - e1000e_disable_phy_retry(hw); 6705 - 6706 - e1e_rphy(hw, CV_SMB_CTRL, &smb_ctrl); 6707 - smb_ctrl |= CV_SMB_CTRL_FORCE_SMBUS; 6708 - e1e_wphy(hw, CV_SMB_CTRL, smb_ctrl); 6709 - 6710 - e1000e_enable_phy_retry(hw); 6711 - 6712 - /* Force SMBus mode in MAC */ 6713 - ctrl_ext = er32(CTRL_EXT); 6714 - ctrl_ext |= E1000_CTRL_EXT_FORCE_SMBUS; 6715 - ew32(CTRL_EXT, ctrl_ext); 6716 6700 } 6717 6701 6718 6702 /* Ensure that the appropriate bits are set in LPI_CTRL
+141 -117
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 11171 11171 ret = i40e_reset(pf); 11172 11172 if (!ret) 11173 11173 i40e_rebuild(pf, reinit, lock_acquired); 11174 + else 11175 + dev_err(&pf->pdev->dev, "%s: i40e_reset() FAILED", __func__); 11174 11176 } 11175 11177 11176 11178 /** ··· 16337 16335 } 16338 16336 16339 16337 /** 16338 + * i40e_enable_mc_magic_wake - enable multicast magic packet wake up 16339 + * using the mac_address_write admin q function 16340 + * @pf: pointer to i40e_pf struct 16341 + **/ 16342 + static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) 16343 + { 16344 + struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); 16345 + struct i40e_hw *hw = &pf->hw; 16346 + u8 mac_addr[6]; 16347 + u16 flags = 0; 16348 + int ret; 16349 + 16350 + /* Get current MAC address in case it's an LAA */ 16351 + if (main_vsi && main_vsi->netdev) { 16352 + ether_addr_copy(mac_addr, main_vsi->netdev->dev_addr); 16353 + } else { 16354 + dev_err(&pf->pdev->dev, 16355 + "Failed to retrieve MAC address; using default\n"); 16356 + ether_addr_copy(mac_addr, hw->mac.addr); 16357 + } 16358 + 16359 + /* The FW expects the mac address write cmd to first be called with 16360 + * one of these flags before calling it again with the multicast 16361 + * enable flags. 16362 + */ 16363 + flags = I40E_AQC_WRITE_TYPE_LAA_WOL; 16364 + 16365 + if (hw->func_caps.flex10_enable && hw->partition_id != 1) 16366 + flags = I40E_AQC_WRITE_TYPE_LAA_ONLY; 16367 + 16368 + ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16369 + if (ret) { 16370 + dev_err(&pf->pdev->dev, 16371 + "Failed to update MAC address registers; cannot enable Multicast Magic packet wake up"); 16372 + return; 16373 + } 16374 + 16375 + flags = I40E_AQC_MC_MAG_EN 16376 + | I40E_AQC_WOL_PRESERVE_ON_PFR 16377 + | I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG; 16378 + ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16379 + if (ret) 16380 + dev_err(&pf->pdev->dev, 16381 + "Failed to enable Multicast Magic Packet wake up\n"); 16382 + } 16383 + 16384 + /** 16385 + * i40e_io_suspend - suspend all IO operations 16386 + * @pf: pointer to i40e_pf struct 16387 + * 16388 + **/ 16389 + static int i40e_io_suspend(struct i40e_pf *pf) 16390 + { 16391 + struct i40e_hw *hw = &pf->hw; 16392 + 16393 + set_bit(__I40E_DOWN, pf->state); 16394 + 16395 + /* Ensure service task will not be running */ 16396 + del_timer_sync(&pf->service_timer); 16397 + cancel_work_sync(&pf->service_task); 16398 + 16399 + /* Client close must be called explicitly here because the timer 16400 + * has been stopped. 16401 + */ 16402 + i40e_notify_client_of_netdev_close(pf, false); 16403 + 16404 + if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && 16405 + pf->wol_en) 16406 + i40e_enable_mc_magic_wake(pf); 16407 + 16408 + /* Since we're going to destroy queues during the 16409 + * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this 16410 + * whole section 16411 + */ 16412 + rtnl_lock(); 16413 + 16414 + i40e_prep_for_reset(pf); 16415 + 16416 + wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); 16417 + wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); 16418 + 16419 + /* Clear the interrupt scheme and release our IRQs so that the system 16420 + * can safely hibernate even when there are a large number of CPUs. 16421 + * Otherwise hibernation might fail when mapping all the vectors back 16422 + * to CPU0. 16423 + */ 16424 + i40e_clear_interrupt_scheme(pf); 16425 + 16426 + rtnl_unlock(); 16427 + 16428 + return 0; 16429 + } 16430 + 16431 + /** 16432 + * i40e_io_resume - resume IO operations 16433 + * @pf: pointer to i40e_pf struct 16434 + * 16435 + **/ 16436 + static int i40e_io_resume(struct i40e_pf *pf) 16437 + { 16438 + struct device *dev = &pf->pdev->dev; 16439 + int err; 16440 + 16441 + /* We need to hold the RTNL lock prior to restoring interrupt schemes, 16442 + * since we're going to be restoring queues 16443 + */ 16444 + rtnl_lock(); 16445 + 16446 + /* We cleared the interrupt scheme when we suspended, so we need to 16447 + * restore it now to resume device functionality. 16448 + */ 16449 + err = i40e_restore_interrupt_scheme(pf); 16450 + if (err) { 16451 + dev_err(dev, "Cannot restore interrupt scheme: %d\n", 16452 + err); 16453 + } 16454 + 16455 + clear_bit(__I40E_DOWN, pf->state); 16456 + i40e_reset_and_rebuild(pf, false, true); 16457 + 16458 + rtnl_unlock(); 16459 + 16460 + /* Clear suspended state last after everything is recovered */ 16461 + clear_bit(__I40E_SUSPENDED, pf->state); 16462 + 16463 + /* Restart the service task */ 16464 + mod_timer(&pf->service_timer, 16465 + round_jiffies(jiffies + pf->service_timer_period)); 16466 + 16467 + return 0; 16468 + } 16469 + 16470 + /** 16340 16471 * i40e_pci_error_detected - warning that something funky happened in PCI land 16341 16472 * @pdev: PCI device information struct 16342 16473 * @error: the type of PCI error ··· 16493 16358 16494 16359 /* shutdown all operations */ 16495 16360 if (!test_bit(__I40E_SUSPENDED, pf->state)) 16496 - i40e_prep_for_reset(pf); 16361 + i40e_io_suspend(pf); 16497 16362 16498 16363 /* Request a slot reset */ 16499 16364 return PCI_ERS_RESULT_NEED_RESET; ··· 16515 16380 u32 reg; 16516 16381 16517 16382 dev_dbg(&pdev->dev, "%s\n", __func__); 16518 - if (pci_enable_device_mem(pdev)) { 16383 + /* enable I/O and memory of the device */ 16384 + if (pci_enable_device(pdev)) { 16519 16385 dev_info(&pdev->dev, 16520 16386 "Cannot re-enable PCI device after reset.\n"); 16521 16387 result = PCI_ERS_RESULT_DISCONNECT; ··· 16579 16443 if (test_bit(__I40E_SUSPENDED, pf->state)) 16580 16444 return; 16581 16445 16582 - i40e_handle_reset_warning(pf, false); 16583 - } 16584 - 16585 - /** 16586 - * i40e_enable_mc_magic_wake - enable multicast magic packet wake up 16587 - * using the mac_address_write admin q function 16588 - * @pf: pointer to i40e_pf struct 16589 - **/ 16590 - static void i40e_enable_mc_magic_wake(struct i40e_pf *pf) 16591 - { 16592 - struct i40e_vsi *main_vsi = i40e_pf_get_main_vsi(pf); 16593 - struct i40e_hw *hw = &pf->hw; 16594 - u8 mac_addr[6]; 16595 - u16 flags = 0; 16596 - int ret; 16597 - 16598 - /* Get current MAC address in case it's an LAA */ 16599 - if (main_vsi && main_vsi->netdev) { 16600 - ether_addr_copy(mac_addr, main_vsi->netdev->dev_addr); 16601 - } else { 16602 - dev_err(&pf->pdev->dev, 16603 - "Failed to retrieve MAC address; using default\n"); 16604 - ether_addr_copy(mac_addr, hw->mac.addr); 16605 - } 16606 - 16607 - /* The FW expects the mac address write cmd to first be called with 16608 - * one of these flags before calling it again with the multicast 16609 - * enable flags. 16610 - */ 16611 - flags = I40E_AQC_WRITE_TYPE_LAA_WOL; 16612 - 16613 - if (hw->func_caps.flex10_enable && hw->partition_id != 1) 16614 - flags = I40E_AQC_WRITE_TYPE_LAA_ONLY; 16615 - 16616 - ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16617 - if (ret) { 16618 - dev_err(&pf->pdev->dev, 16619 - "Failed to update MAC address registers; cannot enable Multicast Magic packet wake up"); 16620 - return; 16621 - } 16622 - 16623 - flags = I40E_AQC_MC_MAG_EN 16624 - | I40E_AQC_WOL_PRESERVE_ON_PFR 16625 - | I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG; 16626 - ret = i40e_aq_mac_address_write(hw, flags, mac_addr, NULL); 16627 - if (ret) 16628 - dev_err(&pf->pdev->dev, 16629 - "Failed to enable Multicast Magic Packet wake up\n"); 16446 + i40e_io_resume(pf); 16630 16447 } 16631 16448 16632 16449 /** ··· 16641 16552 static int i40e_suspend(struct device *dev) 16642 16553 { 16643 16554 struct i40e_pf *pf = dev_get_drvdata(dev); 16644 - struct i40e_hw *hw = &pf->hw; 16645 16555 16646 16556 /* If we're already suspended, then there is nothing to do */ 16647 16557 if (test_and_set_bit(__I40E_SUSPENDED, pf->state)) 16648 16558 return 0; 16649 - 16650 - set_bit(__I40E_DOWN, pf->state); 16651 - 16652 - /* Ensure service task will not be running */ 16653 - del_timer_sync(&pf->service_timer); 16654 - cancel_work_sync(&pf->service_task); 16655 - 16656 - /* Client close must be called explicitly here because the timer 16657 - * has been stopped. 16658 - */ 16659 - i40e_notify_client_of_netdev_close(pf, false); 16660 - 16661 - if (test_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, pf->hw.caps) && 16662 - pf->wol_en) 16663 - i40e_enable_mc_magic_wake(pf); 16664 - 16665 - /* Since we're going to destroy queues during the 16666 - * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this 16667 - * whole section 16668 - */ 16669 - rtnl_lock(); 16670 - 16671 - i40e_prep_for_reset(pf); 16672 - 16673 - wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); 16674 - wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); 16675 - 16676 - /* Clear the interrupt scheme and release our IRQs so that the system 16677 - * can safely hibernate even when there are a large number of CPUs. 16678 - * Otherwise hibernation might fail when mapping all the vectors back 16679 - * to CPU0. 16680 - */ 16681 - i40e_clear_interrupt_scheme(pf); 16682 - 16683 - rtnl_unlock(); 16684 - 16685 - return 0; 16559 + return i40e_io_suspend(pf); 16686 16560 } 16687 16561 16688 16562 /** ··· 16655 16603 static int i40e_resume(struct device *dev) 16656 16604 { 16657 16605 struct i40e_pf *pf = dev_get_drvdata(dev); 16658 - int err; 16659 16606 16660 16607 /* If we're not suspended, then there is nothing to do */ 16661 16608 if (!test_bit(__I40E_SUSPENDED, pf->state)) 16662 16609 return 0; 16663 - 16664 - /* We need to hold the RTNL lock prior to restoring interrupt schemes, 16665 - * since we're going to be restoring queues 16666 - */ 16667 - rtnl_lock(); 16668 - 16669 - /* We cleared the interrupt scheme when we suspended, so we need to 16670 - * restore it now to resume device functionality. 16671 - */ 16672 - err = i40e_restore_interrupt_scheme(pf); 16673 - if (err) { 16674 - dev_err(dev, "Cannot restore interrupt scheme: %d\n", 16675 - err); 16676 - } 16677 - 16678 - clear_bit(__I40E_DOWN, pf->state); 16679 - i40e_reset_and_rebuild(pf, false, true); 16680 - 16681 - rtnl_unlock(); 16682 - 16683 - /* Clear suspended state last after everything is recovered */ 16684 - clear_bit(__I40E_SUSPENDED, pf->state); 16685 - 16686 - /* Restart the service task */ 16687 - mod_timer(&pf->service_timer, 16688 - round_jiffies(jiffies + pf->service_timer_period)); 16689 - 16690 - return 0; 16610 + return i40e_io_resume(pf); 16691 16611 } 16692 16612 16693 16613 static const struct pci_error_handlers i40e_err_handler = {
+22 -9
drivers/net/ethernet/intel/ice/devlink/devlink.c
··· 1388 1388 ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS, 1389 1389 }; 1390 1390 1391 - static const struct devlink_param ice_devlink_params[] = { 1391 + static const struct devlink_param ice_dvl_rdma_params[] = { 1392 1392 DEVLINK_PARAM_GENERIC(ENABLE_ROCE, BIT(DEVLINK_PARAM_CMODE_RUNTIME), 1393 1393 ice_devlink_enable_roce_get, 1394 1394 ice_devlink_enable_roce_set, ··· 1397 1397 ice_devlink_enable_iw_get, 1398 1398 ice_devlink_enable_iw_set, 1399 1399 ice_devlink_enable_iw_validate), 1400 + }; 1401 + 1402 + static const struct devlink_param ice_dvl_sched_params[] = { 1400 1403 DEVLINK_PARAM_DRIVER(ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS, 1401 1404 "tx_scheduling_layers", 1402 1405 DEVLINK_PARAM_TYPE_U8, ··· 1467 1464 { 1468 1465 struct devlink *devlink = priv_to_devlink(pf); 1469 1466 struct ice_hw *hw = &pf->hw; 1470 - size_t params_size; 1467 + int status; 1471 1468 1472 - params_size = ARRAY_SIZE(ice_devlink_params); 1469 + status = devl_params_register(devlink, ice_dvl_rdma_params, 1470 + ARRAY_SIZE(ice_dvl_rdma_params)); 1471 + if (status) 1472 + return status; 1473 1473 1474 - if (!hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) 1475 - params_size--; 1474 + if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) 1475 + status = devl_params_register(devlink, ice_dvl_sched_params, 1476 + ARRAY_SIZE(ice_dvl_sched_params)); 1476 1477 1477 - return devl_params_register(devlink, ice_devlink_params, 1478 - params_size); 1478 + return status; 1479 1479 } 1480 1480 1481 1481 void ice_devlink_unregister_params(struct ice_pf *pf) 1482 1482 { 1483 - devl_params_unregister(priv_to_devlink(pf), ice_devlink_params, 1484 - ARRAY_SIZE(ice_devlink_params)); 1483 + struct devlink *devlink = priv_to_devlink(pf); 1484 + struct ice_hw *hw = &pf->hw; 1485 + 1486 + devl_params_unregister(devlink, ice_dvl_rdma_params, 1487 + ARRAY_SIZE(ice_dvl_rdma_params)); 1488 + 1489 + if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) 1490 + devl_params_unregister(devlink, ice_dvl_sched_params, 1491 + ARRAY_SIZE(ice_dvl_sched_params)); 1485 1492 } 1486 1493 1487 1494 #define ICE_DEVLINK_READ_BLK_SIZE (1024 * 1024)
+10
drivers/net/ethernet/intel/ice/ice_common.c
··· 3148 3148 case ICE_PHY_TYPE_HIGH_100G_AUI2: 3149 3149 speed_phy_type_high = ICE_AQ_LINK_SPEED_100GB; 3150 3150 break; 3151 + case ICE_PHY_TYPE_HIGH_200G_CR4_PAM4: 3152 + case ICE_PHY_TYPE_HIGH_200G_SR4: 3153 + case ICE_PHY_TYPE_HIGH_200G_FR4: 3154 + case ICE_PHY_TYPE_HIGH_200G_LR4: 3155 + case ICE_PHY_TYPE_HIGH_200G_DR4: 3156 + case ICE_PHY_TYPE_HIGH_200G_KR4_PAM4: 3157 + case ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC: 3158 + case ICE_PHY_TYPE_HIGH_200G_AUI4: 3159 + speed_phy_type_high = ICE_AQ_LINK_SPEED_200GB; 3160 + break; 3151 3161 default: 3152 3162 speed_phy_type_high = ICE_AQ_LINK_SPEED_UNKNOWN; 3153 3163 break;
+6 -5
drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
··· 45 45 return -EINVAL; 46 46 47 47 err = ice_fltr_add_vlan(vsi, vlan); 48 - if (err && err != -EEXIST) { 48 + if (!err) 49 + vsi->num_vlan++; 50 + else if (err == -EEXIST) 51 + err = 0; 52 + else 49 53 dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i, status %d\n", 50 54 vlan->vid, vsi->vsi_num, err); 51 - return err; 52 - } 53 55 54 - vsi->num_vlan++; 55 - return 0; 56 + return err; 56 57 } 57 58 58 59 /**
+1
drivers/net/ethernet/intel/idpf/idpf_lib.c
··· 1394 1394 } 1395 1395 1396 1396 idpf_rx_init_buf_tail(vport); 1397 + idpf_vport_intr_ena(vport); 1397 1398 1398 1399 err = idpf_send_config_queues_msg(vport); 1399 1400 if (err) {
+7 -5
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 3746 3746 */ 3747 3747 void idpf_vport_intr_deinit(struct idpf_vport *vport) 3748 3748 { 3749 + idpf_vport_intr_dis_irq_all(vport); 3749 3750 idpf_vport_intr_napi_dis_all(vport); 3750 3751 idpf_vport_intr_napi_del_all(vport); 3751 - idpf_vport_intr_dis_irq_all(vport); 3752 3752 idpf_vport_intr_rel_irq(vport); 3753 3753 } 3754 3754 ··· 4179 4179 4180 4180 idpf_vport_intr_map_vector_to_qs(vport); 4181 4181 idpf_vport_intr_napi_add_all(vport); 4182 - idpf_vport_intr_napi_ena_all(vport); 4183 4182 4184 4183 err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport); 4185 4184 if (err) ··· 4192 4193 if (err) 4193 4194 goto unroll_vectors_alloc; 4194 4195 4195 - idpf_vport_intr_ena_irq_all(vport); 4196 - 4197 4196 return 0; 4198 4197 4199 4198 unroll_vectors_alloc: 4200 - idpf_vport_intr_napi_dis_all(vport); 4201 4199 idpf_vport_intr_napi_del_all(vport); 4202 4200 4203 4201 return err; 4202 + } 4203 + 4204 + void idpf_vport_intr_ena(struct idpf_vport *vport) 4205 + { 4206 + idpf_vport_intr_napi_ena_all(vport); 4207 + idpf_vport_intr_ena_irq_all(vport); 4204 4208 } 4205 4209 4206 4210 /**
+1
drivers/net/ethernet/intel/idpf/idpf_txrx.h
··· 990 990 void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector); 991 991 void idpf_vport_intr_deinit(struct idpf_vport *vport); 992 992 int idpf_vport_intr_init(struct idpf_vport *vport); 993 + void idpf_vport_intr_ena(struct idpf_vport *vport); 993 994 enum pkt_hash_types idpf_ptype_to_htype(const struct idpf_rx_ptype_decoded *decoded); 994 995 int idpf_config_rss(struct idpf_vport *vport); 995 996 int idpf_init_rss(struct idpf_vport *vport);
+4
drivers/net/ethernet/marvell/octeontx2/nic/qos.c
··· 1422 1422 otx2_qos_read_txschq_cfg(pfvf, node, old_cfg); 1423 1423 1424 1424 /* delete the txschq nodes allocated for this node */ 1425 + otx2_qos_disable_sq(pfvf, qid); 1426 + otx2_qos_free_hw_node_schq(pfvf, node); 1425 1427 otx2_qos_free_sw_node_schq(pfvf, node); 1428 + pfvf->qos.qid_to_sqmap[qid] = OTX2_QOS_INVALID_SQ; 1426 1429 1427 1430 /* mark this node as htb inner node */ 1428 1431 WRITE_ONCE(node->qid, OTX2_QOS_QID_INNER); ··· 1635 1632 dwrr_del_node = true; 1636 1633 1637 1634 /* destroy the leaf node */ 1635 + otx2_qos_disable_sq(pfvf, qid); 1638 1636 otx2_qos_destroy_node(pfvf, node); 1639 1637 pfvf->qos.qid_to_sqmap[qid] = OTX2_QOS_INVALID_SQ; 1640 1638
+7 -1
drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
··· 102 102 mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb) 103 103 { 104 104 int payload_len = skb_shinfo(skb)->gso_size + sizeof(struct udphdr); 105 + struct udphdr *udphdr; 105 106 106 - udp_hdr(skb)->len = htons(payload_len); 107 + if (skb->encapsulation) 108 + udphdr = (struct udphdr *)skb_inner_transport_header(skb); 109 + else 110 + udphdr = udp_hdr(skb); 111 + 112 + udphdr->len = htons(payload_len); 107 113 } 108 114 109 115 struct mlx5e_accel_tx_state {
+1 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
··· 750 750 err_fs_ft: 751 751 if (rx->allow_tunnel_mode) 752 752 mlx5_eswitch_unblock_encap(mdev); 753 - mlx5_del_flow_rules(rx->status.rule); 754 - mlx5_modify_header_dealloc(mdev, rx->status.modify_hdr); 753 + mlx5_ipsec_rx_status_destroy(ipsec, rx); 755 754 err_add: 756 755 mlx5_destroy_flow_table(rx->ft.status); 757 756 err_fs_ft_status:
+5 -12
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
··· 97 97 if (!x || !x->xso.offload_handle) 98 98 goto out_disable; 99 99 100 - if (xo->inner_ipproto) { 101 - /* Cannot support tunnel packet over IPsec tunnel mode 102 - * because we cannot offload three IP header csum 103 - */ 104 - if (x->props.mode == XFRM_MODE_TUNNEL) 105 - goto out_disable; 106 - 107 - /* Only support UDP or TCP L4 checksum */ 108 - if (xo->inner_ipproto != IPPROTO_UDP && 109 - xo->inner_ipproto != IPPROTO_TCP) 110 - goto out_disable; 111 - } 100 + /* Only support UDP or TCP L4 checksum */ 101 + if (xo->inner_ipproto && 102 + xo->inner_ipproto != IPPROTO_UDP && 103 + xo->inner_ipproto != IPPROTO_TCP) 104 + goto out_disable; 112 105 113 106 return features; 114 107
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 3886 3886 mlx5e_fold_sw_stats64(priv, stats); 3887 3887 } 3888 3888 3889 - stats->rx_dropped = priv->stats.qcnt.rx_out_of_buffer; 3889 + stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer; 3890 3890 3891 3891 stats->rx_length_errors = 3892 3892 PPORT_802_3_GET(pstats, a_in_range_length_errors) +
+4
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
··· 1186 1186 ts_stats->err = 0; 1187 1187 ts_stats->lost = 0; 1188 1188 1189 + if (!ptp) 1190 + goto out; 1191 + 1189 1192 /* Aggregate stats across all TCs */ 1190 1193 for (i = 0; i < ptp->num_tc; i++) { 1191 1194 struct mlx5e_ptp_cq_stats *stats = ··· 1217 1214 } 1218 1215 } 1219 1216 1217 + out: 1220 1218 mutex_unlock(&priv->state_lock); 1221 1219 } 1222 1220
+5 -1
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 153 153 154 154 *hopbyhop = 0; 155 155 if (skb->encapsulation) { 156 - ihs = skb_inner_tcp_all_headers(skb); 156 + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) 157 + ihs = skb_inner_transport_offset(skb) + 158 + sizeof(struct udphdr); 159 + else 160 + ihs = skb_inner_tcp_all_headers(skb); 157 161 stats->tso_inner_packets++; 158 162 stats->tso_inner_bytes += skb->len - ihs; 159 163 } else {
+10 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
··· 719 719 struct mlx5_core_dev *dev; 720 720 u8 mode; 721 721 #endif 722 + bool roce_support; 722 723 int i; 723 724 724 725 for (i = 0; i < ldev->ports; i++) ··· 744 743 if (mlx5_sriov_is_enabled(ldev->pf[i].dev)) 745 744 return false; 746 745 #endif 746 + roce_support = mlx5_get_roce_state(ldev->pf[MLX5_LAG_P1].dev); 747 + for (i = 1; i < ldev->ports; i++) 748 + if (mlx5_get_roce_state(ldev->pf[i].dev) != roce_support) 749 + return false; 750 + 747 751 return true; 748 752 } 749 753 ··· 916 910 } else if (roce_lag) { 917 911 dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV; 918 912 mlx5_rescan_drivers_locked(dev0); 919 - for (i = 1; i < ldev->ports; i++) 920 - mlx5_nic_vport_enable_roce(ldev->pf[i].dev); 913 + for (i = 1; i < ldev->ports; i++) { 914 + if (mlx5_get_roce_state(ldev->pf[i].dev)) 915 + mlx5_nic_vport_enable_roce(ldev->pf[i].dev); 916 + } 921 917 } else if (shared_fdb) { 922 918 int i; 923 919
+8 -4
drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c
··· 100 100 101 101 static bool mlx5_sd_is_supported(struct mlx5_core_dev *dev, u8 host_buses) 102 102 { 103 - /* Feature is currently implemented for PFs only */ 104 - if (!mlx5_core_is_pf(dev)) 105 - return false; 106 - 107 103 /* Honor the SW implementation limit */ 108 104 if (host_buses > MLX5_SD_MAX_GROUP_SZ) 109 105 return false; ··· 157 161 u32 group_id; 158 162 bool sdm; 159 163 int err; 164 + 165 + /* Feature is currently implemented for PFs only */ 166 + if (!mlx5_core_is_pf(dev)) 167 + return 0; 168 + 169 + /* Block on embedded CPU PFs */ 170 + if (mlx5_core_is_ecpf(dev)) 171 + return 0; 160 172 161 173 if (!MLX5_CAP_MCAM_REG(dev, mpir)) 162 174 return 0;
+1 -1
drivers/net/ethernet/ti/icssg/icssg_classifier.c
··· 455 455 { 456 456 const u8 mask_addr[] = { 0, 0, 0, 0, 0, 0, }; 457 457 458 - rx_class_ft1_set_start_len(miig_rt, slice, 0, 6); 458 + rx_class_ft1_set_start_len(miig_rt, slice, ETH_ALEN, ETH_ALEN); 459 459 rx_class_ft1_set_da(miig_rt, slice, 0, mac_addr); 460 460 rx_class_ft1_set_da_mask(miig_rt, slice, 0, mask_addr); 461 461 rx_class_ft1_cfg_set_type(miig_rt, slice, 0, FT1_CFG_TYPE_EQ);
+2 -2
drivers/net/ipvlan/ipvlan_core.c
··· 439 439 440 440 memset(IPCB(skb), 0, sizeof(*IPCB(skb))); 441 441 442 - err = ip_local_out(net, skb->sk, skb); 442 + err = ip_local_out(net, NULL, skb); 443 443 if (unlikely(net_xmit_eval(err))) 444 444 DEV_STATS_INC(dev, tx_errors); 445 445 else ··· 494 494 495 495 memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); 496 496 497 - err = ip6_local_out(dev_net(dev), skb->sk, skb); 497 + err = ip6_local_out(dev_net(dev), NULL, skb); 498 498 if (unlikely(net_xmit_eval(err))) 499 499 DEV_STATS_INC(dev, tx_errors); 500 500 else
+24 -6
drivers/net/netkit.c
··· 55 55 skb_scrub_packet(skb, xnet); 56 56 skb->priority = 0; 57 57 nf_skip_egress(skb, true); 58 + skb_reset_mac_header(skb); 58 59 } 59 60 60 61 static struct netkit *netkit_priv(const struct net_device *dev) ··· 79 78 skb_orphan_frags(skb, GFP_ATOMIC))) 80 79 goto drop; 81 80 netkit_prep_forward(skb, !net_eq(dev_net(dev), dev_net(peer))); 81 + eth_skb_pkt_type(skb, peer); 82 82 skb->dev = peer; 83 83 entry = rcu_dereference(nk->active); 84 84 if (entry) ··· 87 85 switch (ret) { 88 86 case NETKIT_NEXT: 89 87 case NETKIT_PASS: 90 - skb->protocol = eth_type_trans(skb, skb->dev); 88 + eth_skb_pull_mac(skb); 91 89 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); 92 90 if (likely(__netif_rx(skb) == NET_RX_SUCCESS)) { 93 91 dev_sw_netstats_tx_add(dev, 1, len); ··· 157 155 /* Nothing to do, we receive whatever gets pushed to us! */ 158 156 } 159 157 158 + static int netkit_set_macaddr(struct net_device *dev, void *sa) 159 + { 160 + struct netkit *nk = netkit_priv(dev); 161 + 162 + if (nk->mode != NETKIT_L2) 163 + return -EOPNOTSUPP; 164 + 165 + return eth_mac_addr(dev, sa); 166 + } 167 + 160 168 static void netkit_set_headroom(struct net_device *dev, int headroom) 161 169 { 162 170 struct netkit *nk = netkit_priv(dev), *nk2; ··· 210 198 .ndo_start_xmit = netkit_xmit, 211 199 .ndo_set_rx_mode = netkit_set_multicast, 212 200 .ndo_set_rx_headroom = netkit_set_headroom, 201 + .ndo_set_mac_address = netkit_set_macaddr, 213 202 .ndo_get_iflink = netkit_get_iflink, 214 203 .ndo_get_peer_dev = netkit_peer_dev, 215 204 .ndo_get_stats64 = netkit_get_stats, ··· 313 300 314 301 if (!attr) 315 302 return 0; 316 - NL_SET_ERR_MSG_ATTR(extack, attr, 317 - "Setting Ethernet address is not supported"); 318 - return -EOPNOTSUPP; 303 + if (nla_len(attr) != ETH_ALEN) 304 + return -EINVAL; 305 + if (!is_valid_ether_addr(nla_data(attr))) 306 + return -EADDRNOTAVAIL; 307 + return 0; 319 308 } 320 309 321 310 static struct rtnl_link_ops netkit_link_ops; ··· 380 365 strscpy(ifname, "nk%d", IFNAMSIZ); 381 366 ifname_assign_type = NET_NAME_ENUM; 382 367 } 368 + if (mode != NETKIT_L2 && 369 + (tb[IFLA_ADDRESS] || tbp[IFLA_ADDRESS])) 370 + return -EOPNOTSUPP; 383 371 384 372 net = rtnl_link_get_net(src_net, tbp); 385 373 if (IS_ERR(net)) ··· 397 379 398 380 netif_inherit_tso_max(peer, dev); 399 381 400 - if (mode == NETKIT_L2) 382 + if (mode == NETKIT_L2 && !(ifmp && tbp[IFLA_ADDRESS])) 401 383 eth_hw_addr_random(peer); 402 384 if (ifmp && dev->ifindex) 403 385 peer->ifindex = ifmp->ifi_index; ··· 420 402 if (err < 0) 421 403 goto err_configure_peer; 422 404 423 - if (mode == NETKIT_L2) 405 + if (mode == NETKIT_L2 && !tb[IFLA_ADDRESS]) 424 406 eth_hw_addr_random(dev); 425 407 if (tb[IFLA_IFNAME]) 426 408 nla_strscpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
+10 -1
drivers/net/phy/micrel.c
··· 4029 4029 4030 4030 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 4031 4031 err = phy_read(phydev, LAN8814_INTS); 4032 - if (err) 4032 + if (err < 0) 4033 4033 return err; 4034 4034 4035 4035 /* Enable / disable interrupts. It is OK to enable PTP interrupt ··· 4045 4045 return err; 4046 4046 4047 4047 err = phy_read(phydev, LAN8814_INTS); 4048 + if (err < 0) 4049 + return err; 4050 + 4051 + /* Getting a positive value doesn't mean that is an error, it 4052 + * just indicates what was the status. Therefore make sure to 4053 + * clear the value and say that there is no error. 4054 + */ 4055 + err = 0; 4048 4056 } 4049 4057 4050 4058 return err; ··· 5335 5327 /* PHY_BASIC_FEATURES */ 5336 5328 .probe = kszphy_probe, 5337 5329 .config_init = ksz8061_config_init, 5330 + .soft_reset = genphy_soft_reset, 5338 5331 .config_intr = kszphy_config_intr, 5339 5332 .handle_interrupt = kszphy_handle_interrupt, 5340 5333 .suspend = kszphy_suspend,
+7 -4
drivers/net/usb/smsc95xx.c
··· 879 879 static int smsc95xx_reset(struct usbnet *dev) 880 880 { 881 881 struct smsc95xx_priv *pdata = dev->driver_priv; 882 - u32 read_buf, write_buf, burst_cap; 882 + u32 read_buf, burst_cap; 883 883 int ret = 0, timeout; 884 884 885 885 netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n"); ··· 1003 1003 return ret; 1004 1004 netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf); 1005 1005 1006 + ret = smsc95xx_read_reg(dev, LED_GPIO_CFG, &read_buf); 1007 + if (ret < 0) 1008 + return ret; 1006 1009 /* Configure GPIO pins as LED outputs */ 1007 - write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | 1008 - LED_GPIO_CFG_FDX_LED; 1009 - ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf); 1010 + read_buf |= LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | 1011 + LED_GPIO_CFG_FDX_LED; 1012 + ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, read_buf); 1010 1013 if (ret < 0) 1011 1014 return ret; 1012 1015
+4
drivers/nfc/virtual_ncidev.c
··· 125 125 kfree_skb(skb); 126 126 return -EFAULT; 127 127 } 128 + if (strnlen(skb->data, count) != count) { 129 + kfree_skb(skb); 130 + return -EINVAL; 131 + } 128 132 129 133 nci_recv_frame(vdev->ndev, skb); 130 134 return count;
+70 -46
drivers/nvme/host/core.c
··· 414 414 } 415 415 } 416 416 417 - static inline void nvme_end_req(struct request *req) 417 + static inline void __nvme_end_req(struct request *req) 418 + { 419 + nvme_end_req_zoned(req); 420 + nvme_trace_bio_complete(req); 421 + if (req->cmd_flags & REQ_NVME_MPATH) 422 + nvme_mpath_end_request(req); 423 + } 424 + 425 + void nvme_end_req(struct request *req) 418 426 { 419 427 blk_status_t status = nvme_error_status(nvme_req(req)->status); 420 428 ··· 432 424 else 433 425 nvme_log_error(req); 434 426 } 435 - nvme_end_req_zoned(req); 436 - nvme_trace_bio_complete(req); 437 - if (req->cmd_flags & REQ_NVME_MPATH) 438 - nvme_mpath_end_request(req); 427 + __nvme_end_req(req); 439 428 blk_mq_end_request(req, status); 440 429 } 441 430 ··· 481 476 { 482 477 trace_nvme_complete_rq(req); 483 478 nvme_cleanup_cmd(req); 484 - nvme_end_req_zoned(req); 479 + __nvme_end_req(req); 485 480 } 486 481 EXPORT_SYMBOL_GPL(nvme_complete_batch_req); 487 482 ··· 678 673 kfree(ns); 679 674 } 680 675 681 - static inline bool nvme_get_ns(struct nvme_ns *ns) 676 + bool nvme_get_ns(struct nvme_ns *ns) 682 677 { 683 678 return kref_get_unless_zero(&ns->kref); 684 679 } ··· 3684 3679 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) 3685 3680 { 3686 3681 struct nvme_ns *ns, *ret = NULL; 3682 + int srcu_idx; 3687 3683 3688 - down_read(&ctrl->namespaces_rwsem); 3689 - list_for_each_entry(ns, &ctrl->namespaces, list) { 3684 + srcu_idx = srcu_read_lock(&ctrl->srcu); 3685 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 3690 3686 if (ns->head->ns_id == nsid) { 3691 3687 if (!nvme_get_ns(ns)) 3692 3688 continue; ··· 3697 3691 if (ns->head->ns_id > nsid) 3698 3692 break; 3699 3693 } 3700 - up_read(&ctrl->namespaces_rwsem); 3694 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 3701 3695 return ret; 3702 3696 } 3703 3697 EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); ··· 3711 3705 3712 3706 list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { 3713 3707 if (tmp->head->ns_id < ns->head->ns_id) { 3714 - list_add(&ns->list, &tmp->list); 3708 + list_add_rcu(&ns->list, &tmp->list); 3715 3709 return; 3716 3710 } 3717 3711 } ··· 3777 3771 if (nvme_update_ns_info(ns, info)) 3778 3772 goto out_unlink_ns; 3779 3773 3780 - down_write(&ctrl->namespaces_rwsem); 3774 + mutex_lock(&ctrl->namespaces_lock); 3781 3775 /* 3782 3776 * Ensure that no namespaces are added to the ctrl list after the queues 3783 3777 * are frozen, thereby avoiding a deadlock between scan and reset. 3784 3778 */ 3785 3779 if (test_bit(NVME_CTRL_FROZEN, &ctrl->flags)) { 3786 - up_write(&ctrl->namespaces_rwsem); 3780 + mutex_unlock(&ctrl->namespaces_lock); 3787 3781 goto out_unlink_ns; 3788 3782 } 3789 3783 nvme_ns_add_to_ctrl_list(ns); 3790 - up_write(&ctrl->namespaces_rwsem); 3784 + mutex_unlock(&ctrl->namespaces_lock); 3785 + synchronize_srcu(&ctrl->srcu); 3791 3786 nvme_get_ctrl(ctrl); 3792 3787 3793 3788 if (device_add_disk(ctrl->device, ns->disk, nvme_ns_attr_groups)) ··· 3811 3804 3812 3805 out_cleanup_ns_from_list: 3813 3806 nvme_put_ctrl(ctrl); 3814 - down_write(&ctrl->namespaces_rwsem); 3815 - list_del_init(&ns->list); 3816 - up_write(&ctrl->namespaces_rwsem); 3807 + mutex_lock(&ctrl->namespaces_lock); 3808 + list_del_rcu(&ns->list); 3809 + mutex_unlock(&ctrl->namespaces_lock); 3810 + synchronize_srcu(&ctrl->srcu); 3817 3811 out_unlink_ns: 3818 3812 mutex_lock(&ctrl->subsys->lock); 3819 3813 list_del_rcu(&ns->siblings); ··· 3864 3856 nvme_cdev_del(&ns->cdev, &ns->cdev_device); 3865 3857 del_gendisk(ns->disk); 3866 3858 3867 - down_write(&ns->ctrl->namespaces_rwsem); 3868 - list_del_init(&ns->list); 3869 - up_write(&ns->ctrl->namespaces_rwsem); 3859 + mutex_lock(&ns->ctrl->namespaces_lock); 3860 + list_del_rcu(&ns->list); 3861 + mutex_unlock(&ns->ctrl->namespaces_lock); 3862 + synchronize_srcu(&ns->ctrl->srcu); 3870 3863 3871 3864 if (last_path) 3872 3865 nvme_mpath_shutdown_disk(ns->head); ··· 3957 3948 struct nvme_ns *ns, *next; 3958 3949 LIST_HEAD(rm_list); 3959 3950 3960 - down_write(&ctrl->namespaces_rwsem); 3951 + mutex_lock(&ctrl->namespaces_lock); 3961 3952 list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) { 3962 3953 if (ns->head->ns_id > nsid) 3963 - list_move_tail(&ns->list, &rm_list); 3954 + list_splice_init_rcu(&ns->list, &rm_list, 3955 + synchronize_rcu); 3964 3956 } 3965 - up_write(&ctrl->namespaces_rwsem); 3957 + mutex_unlock(&ctrl->namespaces_lock); 3958 + synchronize_srcu(&ctrl->srcu); 3966 3959 3967 3960 list_for_each_entry_safe(ns, next, &rm_list, list) 3968 3961 nvme_ns_remove(ns); 3969 - 3970 3962 } 3971 3963 3972 3964 static int nvme_scan_ns_list(struct nvme_ctrl *ctrl) ··· 4137 4127 /* this is a no-op when called from the controller reset handler */ 4138 4128 nvme_change_ctrl_state(ctrl, NVME_CTRL_DELETING_NOIO); 4139 4129 4140 - down_write(&ctrl->namespaces_rwsem); 4141 - list_splice_init(&ctrl->namespaces, &ns_list); 4142 - up_write(&ctrl->namespaces_rwsem); 4130 + mutex_lock(&ctrl->namespaces_lock); 4131 + list_splice_init_rcu(&ctrl->namespaces, &ns_list, synchronize_rcu); 4132 + mutex_unlock(&ctrl->namespaces_lock); 4133 + synchronize_srcu(&ctrl->srcu); 4143 4134 4144 4135 list_for_each_entry_safe(ns, next, &ns_list, list) 4145 4136 nvme_ns_remove(ns); ··· 4588 4577 key_put(ctrl->tls_key); 4589 4578 nvme_free_cels(ctrl); 4590 4579 nvme_mpath_uninit(ctrl); 4580 + cleanup_srcu_struct(&ctrl->srcu); 4591 4581 nvme_auth_stop(ctrl); 4592 4582 nvme_auth_free(ctrl); 4593 4583 __free_page(ctrl->discard_page); ··· 4621 4609 ctrl->passthru_err_log_enabled = false; 4622 4610 clear_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags); 4623 4611 spin_lock_init(&ctrl->lock); 4612 + mutex_init(&ctrl->namespaces_lock); 4613 + 4614 + ret = init_srcu_struct(&ctrl->srcu); 4615 + if (ret) 4616 + return ret; 4617 + 4624 4618 mutex_init(&ctrl->scan_lock); 4625 4619 INIT_LIST_HEAD(&ctrl->namespaces); 4626 4620 xa_init(&ctrl->cels); 4627 - init_rwsem(&ctrl->namespaces_rwsem); 4628 4621 ctrl->dev = dev; 4629 4622 ctrl->ops = ops; 4630 4623 ctrl->quirks = quirks; ··· 4709 4692 out: 4710 4693 if (ctrl->discard_page) 4711 4694 __free_page(ctrl->discard_page); 4695 + cleanup_srcu_struct(&ctrl->srcu); 4712 4696 return ret; 4713 4697 } 4714 4698 EXPORT_SYMBOL_GPL(nvme_init_ctrl); ··· 4718 4700 void nvme_mark_namespaces_dead(struct nvme_ctrl *ctrl) 4719 4701 { 4720 4702 struct nvme_ns *ns; 4703 + int srcu_idx; 4721 4704 4722 - down_read(&ctrl->namespaces_rwsem); 4723 - list_for_each_entry(ns, &ctrl->namespaces, list) 4705 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4706 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4724 4707 blk_mark_disk_dead(ns->disk); 4725 - up_read(&ctrl->namespaces_rwsem); 4708 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4726 4709 } 4727 4710 EXPORT_SYMBOL_GPL(nvme_mark_namespaces_dead); 4728 4711 4729 4712 void nvme_unfreeze(struct nvme_ctrl *ctrl) 4730 4713 { 4731 4714 struct nvme_ns *ns; 4715 + int srcu_idx; 4732 4716 4733 - down_read(&ctrl->namespaces_rwsem); 4734 - list_for_each_entry(ns, &ctrl->namespaces, list) 4717 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4718 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4735 4719 blk_mq_unfreeze_queue(ns->queue); 4736 - up_read(&ctrl->namespaces_rwsem); 4720 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4737 4721 clear_bit(NVME_CTRL_FROZEN, &ctrl->flags); 4738 4722 } 4739 4723 EXPORT_SYMBOL_GPL(nvme_unfreeze); ··· 4743 4723 int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) 4744 4724 { 4745 4725 struct nvme_ns *ns; 4726 + int srcu_idx; 4746 4727 4747 - down_read(&ctrl->namespaces_rwsem); 4748 - list_for_each_entry(ns, &ctrl->namespaces, list) { 4728 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4729 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 4749 4730 timeout = blk_mq_freeze_queue_wait_timeout(ns->queue, timeout); 4750 4731 if (timeout <= 0) 4751 4732 break; 4752 4733 } 4753 - up_read(&ctrl->namespaces_rwsem); 4734 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4754 4735 return timeout; 4755 4736 } 4756 4737 EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); ··· 4759 4738 void nvme_wait_freeze(struct nvme_ctrl *ctrl) 4760 4739 { 4761 4740 struct nvme_ns *ns; 4741 + int srcu_idx; 4762 4742 4763 - down_read(&ctrl->namespaces_rwsem); 4764 - list_for_each_entry(ns, &ctrl->namespaces, list) 4743 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4744 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4765 4745 blk_mq_freeze_queue_wait(ns->queue); 4766 - up_read(&ctrl->namespaces_rwsem); 4746 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4767 4747 } 4768 4748 EXPORT_SYMBOL_GPL(nvme_wait_freeze); 4769 4749 4770 4750 void nvme_start_freeze(struct nvme_ctrl *ctrl) 4771 4751 { 4772 4752 struct nvme_ns *ns; 4753 + int srcu_idx; 4773 4754 4774 4755 set_bit(NVME_CTRL_FROZEN, &ctrl->flags); 4775 - down_read(&ctrl->namespaces_rwsem); 4776 - list_for_each_entry(ns, &ctrl->namespaces, list) 4756 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4757 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4777 4758 blk_freeze_queue_start(ns->queue); 4778 - up_read(&ctrl->namespaces_rwsem); 4759 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4779 4760 } 4780 4761 EXPORT_SYMBOL_GPL(nvme_start_freeze); 4781 4762 ··· 4820 4797 void nvme_sync_io_queues(struct nvme_ctrl *ctrl) 4821 4798 { 4822 4799 struct nvme_ns *ns; 4800 + int srcu_idx; 4823 4801 4824 - down_read(&ctrl->namespaces_rwsem); 4825 - list_for_each_entry(ns, &ctrl->namespaces, list) 4802 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4803 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4826 4804 blk_sync_queue(ns->queue); 4827 - up_read(&ctrl->namespaces_rwsem); 4805 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4828 4806 } 4829 4807 EXPORT_SYMBOL_GPL(nvme_sync_io_queues); 4830 4808
+9 -6
drivers/nvme/host/ioctl.c
··· 789 789 bool open_for_write) 790 790 { 791 791 struct nvme_ns *ns; 792 - int ret; 792 + int ret, srcu_idx; 793 793 794 - down_read(&ctrl->namespaces_rwsem); 794 + srcu_idx = srcu_read_lock(&ctrl->srcu); 795 795 if (list_empty(&ctrl->namespaces)) { 796 796 ret = -ENOTTY; 797 797 goto out_unlock; 798 798 } 799 799 800 - ns = list_first_entry(&ctrl->namespaces, struct nvme_ns, list); 800 + ns = list_first_or_null_rcu(&ctrl->namespaces, struct nvme_ns, list); 801 801 if (ns != list_last_entry(&ctrl->namespaces, struct nvme_ns, list)) { 802 802 dev_warn(ctrl->device, 803 803 "NVME_IOCTL_IO_CMD not supported when multiple namespaces present!\n"); ··· 807 807 808 808 dev_warn(ctrl->device, 809 809 "using deprecated NVME_IOCTL_IO_CMD ioctl on the char device!\n"); 810 - kref_get(&ns->kref); 811 - up_read(&ctrl->namespaces_rwsem); 810 + if (!nvme_get_ns(ns)) { 811 + ret = -ENXIO; 812 + goto out_unlock; 813 + } 814 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 812 815 813 816 ret = nvme_user_cmd(ctrl, ns, argp, 0, open_for_write); 814 817 nvme_put_ns(ns); 815 818 return ret; 816 819 817 820 out_unlock: 818 - up_read(&ctrl->namespaces_rwsem); 821 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 819 822 return ret; 820 823 } 821 824
+15 -11
drivers/nvme/host/multipath.c
··· 118 118 blk_steal_bios(&ns->head->requeue_list, req); 119 119 spin_unlock_irqrestore(&ns->head->requeue_lock, flags); 120 120 121 - blk_mq_end_request(req, 0); 121 + nvme_req(req)->status = 0; 122 + nvme_end_req(req); 122 123 kblockd_schedule_work(&ns->head->requeue_work); 123 124 } 124 125 ··· 151 150 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) 152 151 { 153 152 struct nvme_ns *ns; 153 + int srcu_idx; 154 154 155 - down_read(&ctrl->namespaces_rwsem); 156 - list_for_each_entry(ns, &ctrl->namespaces, list) { 155 + srcu_idx = srcu_read_lock(&ctrl->srcu); 156 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 157 157 if (!ns->head->disk) 158 158 continue; 159 159 kblockd_schedule_work(&ns->head->requeue_work); 160 160 if (nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE) 161 161 disk_uevent(ns->head->disk, KOBJ_CHANGE); 162 162 } 163 - up_read(&ctrl->namespaces_rwsem); 163 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 164 164 } 165 165 166 166 static const char *nvme_ana_state_names[] = { ··· 195 193 void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) 196 194 { 197 195 struct nvme_ns *ns; 196 + int srcu_idx; 198 197 199 - down_read(&ctrl->namespaces_rwsem); 200 - list_for_each_entry(ns, &ctrl->namespaces, list) { 198 + srcu_idx = srcu_read_lock(&ctrl->srcu); 199 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 201 200 nvme_mpath_clear_current_path(ns); 202 201 kblockd_schedule_work(&ns->head->requeue_work); 203 202 } 204 - up_read(&ctrl->namespaces_rwsem); 203 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 205 204 } 206 205 207 206 void nvme_mpath_revalidate_paths(struct nvme_ns *ns) ··· 598 595 int node, srcu_idx; 599 596 600 597 srcu_idx = srcu_read_lock(&head->srcu); 601 - for_each_node(node) 598 + for_each_online_node(node) 602 599 __nvme_find_path(head, node); 603 600 srcu_read_unlock(&head->srcu, srcu_idx); 604 601 } ··· 683 680 u32 nr_nsids = le32_to_cpu(desc->nnsids), n = 0; 684 681 unsigned *nr_change_groups = data; 685 682 struct nvme_ns *ns; 683 + int srcu_idx; 686 684 687 685 dev_dbg(ctrl->device, "ANA group %d: %s.\n", 688 686 le32_to_cpu(desc->grpid), ··· 695 691 if (!nr_nsids) 696 692 return 0; 697 693 698 - down_read(&ctrl->namespaces_rwsem); 699 - list_for_each_entry(ns, &ctrl->namespaces, list) { 694 + srcu_idx = srcu_read_lock(&ctrl->srcu); 695 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 700 696 unsigned nsid; 701 697 again: 702 698 nsid = le32_to_cpu(desc->nsids[n]); ··· 709 705 if (ns->head->ns_id > nsid) 710 706 goto again; 711 707 } 712 - up_read(&ctrl->namespaces_rwsem); 708 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 713 709 return 0; 714 710 } 715 711
+4 -3
drivers/nvme/host/nvme.h
··· 282 282 struct blk_mq_tag_set *tagset; 283 283 struct blk_mq_tag_set *admin_tagset; 284 284 struct list_head namespaces; 285 - struct rw_semaphore namespaces_rwsem; 285 + struct mutex namespaces_lock; 286 + struct srcu_struct srcu; 286 287 struct device ctrl_device; 287 288 struct device *device; /* char device */ 288 289 #ifdef CONFIG_NVME_HWMON ··· 472 471 u8 pi_type; 473 472 u8 pi_offset; 474 473 u8 guard_type; 475 - u16 sgs; 476 - u32 sws; 477 474 #ifdef CONFIG_BLK_DEV_ZONED 478 475 u64 zsze; 479 476 #endif ··· 766 767 } 767 768 } 768 769 770 + void nvme_end_req(struct request *req); 769 771 void nvme_complete_rq(struct request *req); 770 772 void nvme_complete_batch_req(struct request *req); 771 773 ··· 1161 1161 struct nvme_command *cmd, int status); 1162 1162 struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); 1163 1163 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); 1164 + bool nvme_get_ns(struct nvme_ns *ns); 1164 1165 void nvme_put_ns(struct nvme_ns *ns); 1165 1166 1166 1167 static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
+2 -1
drivers/nvme/host/pci.c
··· 778 778 struct bio_vec bv = req_bvec(req); 779 779 780 780 if (!is_pci_p2pdma_page(bv.bv_page)) { 781 - if (bv.bv_offset + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2) 781 + if ((bv.bv_offset & (NVME_CTRL_PAGE_SIZE - 1)) + 782 + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2) 782 783 return nvme_setup_prp_simple(dev, req, 783 784 &cmnd->rw, &bv); 784 785
+8
drivers/nvme/target/configfs.c
··· 676 676 if (kstrtobool(page, &enable)) 677 677 return -EINVAL; 678 678 679 + /* 680 + * take a global nvmet_config_sem because the disable routine has a 681 + * window where it releases the subsys-lock, giving a chance to 682 + * a parallel enable to concurrently execute causing the disable to 683 + * have a misaccounting of the ns percpu_ref. 684 + */ 685 + down_write(&nvmet_config_sem); 679 686 if (enable) 680 687 ret = nvmet_ns_enable(ns); 681 688 else 682 689 nvmet_ns_disable(ns); 690 + up_write(&nvmet_config_sem); 683 691 684 692 return ret ? ret : count; 685 693 }
+9
drivers/nvme/target/core.c
··· 818 818 percpu_ref_exit(&sq->ref); 819 819 nvmet_auth_sq_free(sq); 820 820 821 + /* 822 + * we must reference the ctrl again after waiting for inflight IO 823 + * to complete. Because admin connect may have sneaked in after we 824 + * store sq->ctrl locally, but before we killed the percpu_ref. the 825 + * admin connect allocates and assigns sq->ctrl, which now needs a 826 + * final ref put, as this ctrl is going away. 827 + */ 828 + ctrl = sq->ctrl; 829 + 821 830 if (ctrl) { 822 831 /* 823 832 * The teardown flow may take some time, and the host may not
+1
drivers/platform/x86/Kconfig
··· 515 515 select NVRAM 516 516 select NEW_LEDS 517 517 select LEDS_CLASS 518 + select INPUT_SPARSEKMAP 518 519 help 519 520 This is a driver for the IBM and Lenovo ThinkPad laptops. It adds 520 521 support for Fn-Fx key combinations, Bluetooth control, video
+1 -1
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c
··· 1610 1610 tpmi_sst->partition_mask_current &= ~BIT(plat_info->partition); 1611 1611 /* Free the package instance when the all partitions are removed */ 1612 1612 if (!tpmi_sst->partition_mask_current) { 1613 - kfree(tpmi_sst); 1614 1613 isst_common.sst_inst[tpmi_sst->package_id] = NULL; 1614 + kfree(tpmi_sst); 1615 1615 } 1616 1616 mutex_unlock(&isst_tpmi_dev_lock); 1617 1617 }
+113 -4
drivers/platform/x86/touchscreen_dmi.c
··· 9 9 */ 10 10 11 11 #include <linux/acpi.h> 12 + #include <linux/ctype.h> 12 13 #include <linux/device.h> 13 14 #include <linux/dmi.h> 14 15 #include <linux/efi_embedded_fw.h> 15 16 #include <linux/i2c.h> 17 + #include <linux/init.h> 18 + #include <linux/kstrtox.h> 16 19 #include <linux/notifier.h> 17 20 #include <linux/property.h> 18 21 #include <linux/string.h> ··· 900 897 .properties = schneider_sct101ctm_props, 901 898 }; 902 899 900 + static const struct property_entry globalspace_solt_ivw116_props[] = { 901 + PROPERTY_ENTRY_U32("touchscreen-min-x", 7), 902 + PROPERTY_ENTRY_U32("touchscreen-min-y", 22), 903 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1723), 904 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1077), 905 + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-globalspace-solt-ivw116.fw"), 906 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 907 + PROPERTY_ENTRY_BOOL("silead,home-button"), 908 + { } 909 + }; 910 + 911 + static const struct ts_dmi_data globalspace_solt_ivw116_data = { 912 + .acpi_name = "MSSL1680:00", 913 + .properties = globalspace_solt_ivw116_props, 914 + }; 915 + 903 916 static const struct property_entry techbite_arc_11_6_props[] = { 904 917 PROPERTY_ENTRY_U32("touchscreen-min-x", 5), 905 918 PROPERTY_ENTRY_U32("touchscreen-min-y", 7), ··· 1405 1386 }, 1406 1387 }, 1407 1388 { 1389 + /* Jumper EZpad 6s Pro */ 1390 + .driver_data = (void *)&jumper_ezpad_6_pro_b_data, 1391 + .matches = { 1392 + DMI_MATCH(DMI_SYS_VENDOR, "Jumper"), 1393 + DMI_MATCH(DMI_PRODUCT_NAME, "Ezpad"), 1394 + /* Above matches are too generic, add bios match */ 1395 + DMI_MATCH(DMI_BIOS_VERSION, "E.WSA116_8.E1.042.bin"), 1396 + DMI_MATCH(DMI_BIOS_DATE, "01/08/2020"), 1397 + }, 1398 + }, 1399 + { 1408 1400 /* Jumper EZpad 6 m4 */ 1409 1401 .driver_data = (void *)&jumper_ezpad_6_m4_data, 1410 1402 .matches = { ··· 1655 1625 }, 1656 1626 }, 1657 1627 { 1628 + /* GlobalSpace SoLT IVW 11.6" */ 1629 + .driver_data = (void *)&globalspace_solt_ivw116_data, 1630 + .matches = { 1631 + DMI_MATCH(DMI_SYS_VENDOR, "Globalspace Tech Pvt Ltd"), 1632 + DMI_MATCH(DMI_PRODUCT_NAME, "SolTIVW"), 1633 + DMI_MATCH(DMI_PRODUCT_SKU, "PN20170413488"), 1634 + }, 1635 + }, 1636 + { 1658 1637 /* Techbite Arc 11.6 */ 1659 1638 .driver_data = (void *)&techbite_arc_11_6_data, 1660 1639 .matches = { ··· 1856 1817 { } 1857 1818 }; 1858 1819 1859 - static const struct ts_dmi_data *ts_data; 1820 + static struct ts_dmi_data *ts_data; 1860 1821 1861 1822 static void ts_dmi_add_props(struct i2c_client *client) 1862 1823 { ··· 1891 1852 return 0; 1892 1853 } 1893 1854 1855 + #define MAX_CMDLINE_PROPS 16 1856 + 1857 + static struct property_entry ts_cmdline_props[MAX_CMDLINE_PROPS + 1]; 1858 + 1859 + static struct ts_dmi_data ts_cmdline_data = { 1860 + .properties = ts_cmdline_props, 1861 + }; 1862 + 1863 + static int __init ts_parse_props(char *str) 1864 + { 1865 + /* Save the original str to show it on syntax errors */ 1866 + char orig_str[256]; 1867 + char *name, *value; 1868 + u32 u32val; 1869 + int i, ret; 1870 + 1871 + strscpy(orig_str, str, sizeof(orig_str)); 1872 + 1873 + /* 1874 + * str is part of the static_command_line from init/main.c and poking 1875 + * holes in that by writing 0 to it is allowed, as is taking long 1876 + * lasting references to it. 1877 + */ 1878 + ts_cmdline_data.acpi_name = strsep(&str, ":"); 1879 + 1880 + for (i = 0; i < MAX_CMDLINE_PROPS; i++) { 1881 + name = strsep(&str, ":"); 1882 + if (!name || !name[0]) 1883 + break; 1884 + 1885 + /* Replace '=' with 0 and make value point past '=' or NULL */ 1886 + value = name; 1887 + strsep(&value, "="); 1888 + if (!value) { 1889 + ts_cmdline_props[i] = PROPERTY_ENTRY_BOOL(name); 1890 + } else if (isdigit(value[0])) { 1891 + ret = kstrtou32(value, 0, &u32val); 1892 + if (ret) 1893 + goto syntax_error; 1894 + 1895 + ts_cmdline_props[i] = PROPERTY_ENTRY_U32(name, u32val); 1896 + } else { 1897 + ts_cmdline_props[i] = PROPERTY_ENTRY_STRING(name, value); 1898 + } 1899 + } 1900 + 1901 + if (!i || str) 1902 + goto syntax_error; 1903 + 1904 + ts_data = &ts_cmdline_data; 1905 + return 1; 1906 + 1907 + syntax_error: 1908 + pr_err("Invalid '%s' value for 'i2c_touchscreen_props='\n", orig_str); 1909 + return 1; /* "i2c_touchscreen_props=" is still a known parameter */ 1910 + } 1911 + __setup("i2c_touchscreen_props=", ts_parse_props); 1912 + 1894 1913 static struct notifier_block ts_dmi_notifier = { 1895 1914 .notifier_call = ts_dmi_notifier_call, 1896 1915 }; ··· 1956 1859 static int __init ts_dmi_init(void) 1957 1860 { 1958 1861 const struct dmi_system_id *dmi_id; 1862 + struct ts_dmi_data *ts_data_dmi; 1959 1863 int error; 1960 1864 1961 1865 dmi_id = dmi_first_match(touchscreen_dmi_table); 1962 - if (!dmi_id) 1963 - return 0; /* Not an error */ 1866 + ts_data_dmi = dmi_id ? dmi_id->driver_data : NULL; 1964 1867 1965 - ts_data = dmi_id->driver_data; 1868 + if (ts_data) { 1869 + /* 1870 + * Kernel cmdline provided data takes precedence, copy over 1871 + * DMI efi_embedded_fw info if available. 1872 + */ 1873 + if (ts_data_dmi) 1874 + ts_data->embedded_fw = ts_data_dmi->embedded_fw; 1875 + } else if (ts_data_dmi) { 1876 + ts_data = ts_data_dmi; 1877 + } else { 1878 + return 0; /* Not an error */ 1879 + } 1880 + 1966 1881 /* Some dmi table entries only provide an efi_embedded_fw_desc */ 1967 1882 if (!ts_data->properties) 1968 1883 return 0;
+2
drivers/platform/x86/x86-android-tablets/Kconfig
··· 6 6 config X86_ANDROID_TABLETS 7 7 tristate "X86 Android tablet support" 8 8 depends on I2C && SPI && SERIAL_DEV_BUS && ACPI && EFI && GPIOLIB && PMIC_OPREGION 9 + select NEW_LEDS 10 + select LEDS_CLASS 9 11 help 10 12 X86 tablets which ship with Android as (part of) the factory image 11 13 typically have various problems with their DSDTs. The factory kernels
+11
drivers/pmdomain/imx/gpcv2.c
··· 393 393 * automatically there. Just add a delay and suppose the handshake finish 394 394 * after that. 395 395 */ 396 + 397 + /* 398 + * For some BLK-CTL module (eg. AudioMix on i.MX8MP) doesn't have BUS 399 + * clk-en bit, it is better to add delay here, as the BLK-CTL module 400 + * doesn't need to care about how it is powered up. 401 + * 402 + * regmap_read_bypassed() is to make sure the above write IO transaction 403 + * already reaches target before udelay() 404 + */ 405 + regmap_read_bypassed(domain->regmap, domain->regs->hsk, &reg_val); 406 + udelay(5); 396 407 } 397 408 398 409 /* Disable reset clocks for all devices in the domain */
+12 -10
drivers/regulator/rtq2208-regulator.c
··· 228 228 .set_suspend_disable = rtq2208_set_suspend_disable, 229 229 }; 230 230 231 + static struct of_regulator_match rtq2208_ldo_match[] = { 232 + {.name = "ldo2", }, 233 + {.name = "ldo1", }, 234 + }; 235 + 231 236 static unsigned int rtq2208_of_map_mode(unsigned int mode) 232 237 { 233 238 switch (mode) { ··· 327 322 return IRQ_HANDLED; 328 323 } 329 324 330 - static int rtq2208_of_get_fixed_voltage(struct device *dev, 331 - struct of_regulator_match *rtq2208_ldo_match, int n_fixed) 325 + static int rtq2208_of_get_ldo_dvs_ability(struct device *dev) 332 326 { 333 327 struct device_node *np; 334 328 struct of_regulator_match *match; ··· 342 338 if (!np) 343 339 np = dev->of_node; 344 340 345 - ret = of_regulator_match(dev, np, rtq2208_ldo_match, n_fixed); 341 + ret = of_regulator_match(dev, np, rtq2208_ldo_match, ARRAY_SIZE(rtq2208_ldo_match)); 346 342 347 343 of_node_put(np); 348 344 349 345 if (ret < 0) 350 346 return ret; 351 347 352 - for (i = 0; i < n_fixed; i++) { 348 + for (i = 0; i < ARRAY_SIZE(rtq2208_ldo_match); i++) { 353 349 match = rtq2208_ldo_match + i; 354 350 init_data = match->init_data; 355 351 rdesc = (struct rtq2208_regulator_desc *)match->driver_data; ··· 392 388 REGULATOR_LINEAR_RANGE(1310000, 181, 255, 10000), 393 389 }; 394 390 395 - static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, int mtp_sel, 396 - int idx, struct of_regulator_match *rtq2208_ldo_match, int *ldo_idx) 391 + static void rtq2208_init_regulator_desc(struct rtq2208_regulator_desc *rdesc, int mtp_sel, int idx) 397 392 { 398 393 struct regulator_desc *desc; 399 394 static const struct { ··· 464 461 static int rtq2208_parse_regulator_dt_data(int n_regulator, const unsigned int *regulator_idx_table, 465 462 struct rtq2208_regulator_desc *rdesc[RTQ2208_LDO_MAX], struct device *dev) 466 463 { 467 - struct of_regulator_match rtq2208_ldo_match[2]; 468 - int mtp_sel, ret, i, idx, ldo_idx = 0; 464 + int mtp_sel, i, idx, ret; 469 465 470 466 /* get mtp_sel0 or mtp_sel1 */ 471 467 mtp_sel = device_property_read_bool(dev, "richtek,mtp-sel-high"); ··· 476 474 if (!rdesc[i]) 477 475 return -ENOMEM; 478 476 479 - rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx, rtq2208_ldo_match, &ldo_idx); 477 + rtq2208_init_regulator_desc(rdesc[i], mtp_sel, idx); 480 478 481 479 /* init ldo dvs ability */ 482 480 if (idx >= RTQ2208_LDO2) ··· 484 482 } 485 483 486 484 /* init ldo fixed_uV */ 487 - ret = rtq2208_of_get_fixed_voltage(dev, rtq2208_ldo_match, ldo_idx); 485 + ret = rtq2208_of_get_ldo_dvs_ability(dev); 488 486 if (ret) 489 487 return dev_err_probe(dev, ret, "Failed to get ldo fixed_uV\n"); 490 488
+1 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 4774 4774 char desc[17] = {0}; 4775 4775 u32 iounit_pg1_flags; 4776 4776 4777 - strscpy(desc, ioc->manu_pg0.ChipName, sizeof(desc)); 4777 + memtostr(desc, ioc->manu_pg0.ChipName); 4778 4778 ioc_info(ioc, "%s: FWVersion(%02d.%02d.%02d.%02d), ChipRevision(0x%02x)\n", 4779 4779 desc, 4780 4780 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
+5 -9
drivers/scsi/mpt3sas/mpt3sas_transport.c
··· 458 458 goto out; 459 459 460 460 manufacture_reply = data_out + sizeof(struct rep_manu_request); 461 - strscpy(edev->vendor_id, manufacture_reply->vendor_id, 462 - sizeof(edev->vendor_id)); 463 - strscpy(edev->product_id, manufacture_reply->product_id, 464 - sizeof(edev->product_id)); 465 - strscpy(edev->product_rev, manufacture_reply->product_rev, 466 - sizeof(edev->product_rev)); 461 + memtostr(edev->vendor_id, manufacture_reply->vendor_id); 462 + memtostr(edev->product_id, manufacture_reply->product_id); 463 + memtostr(edev->product_rev, manufacture_reply->product_rev); 467 464 edev->level = manufacture_reply->sas_format & 1; 468 465 if (edev->level) { 469 - strscpy(edev->component_vendor_id, 470 - manufacture_reply->component_vendor_id, 471 - sizeof(edev->component_vendor_id)); 466 + memtostr(edev->component_vendor_id, 467 + manufacture_reply->component_vendor_id); 472 468 tmp = (u8 *)&manufacture_reply->component_id; 473 469 edev->component_id = tmp[0] << 8 | tmp[1]; 474 470 edev->component_revision_id =
+3 -1
drivers/scsi/sd.c
··· 3700 3700 */ 3701 3701 if (sdkp->first_scan || 3702 3702 q->limits.max_sectors > q->limits.max_dev_sectors || 3703 - q->limits.max_sectors > q->limits.max_hw_sectors) 3703 + q->limits.max_sectors > q->limits.max_hw_sectors) { 3704 3704 q->limits.max_sectors = rw_max; 3705 + q->limits.max_user_sectors = rw_max; 3706 + } 3705 3707 3706 3708 sdkp->first_scan = 0; 3707 3709
+15 -5
drivers/spi/spi-cadence-xspi.c
··· 145 145 #define CDNS_XSPI_STIG_DONE_FLAG BIT(0) 146 146 #define CDNS_XSPI_TRD_STATUS 0x0104 147 147 148 + #define MODE_NO_OF_BYTES GENMASK(25, 24) 149 + #define MODEBYTES_COUNT 1 150 + 148 151 /* Helper macros for filling command registers */ 149 152 #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_1(op, data_phase) ( \ 150 153 FIELD_PREP(CDNS_XSPI_CMD_INSTR_TYPE, (data_phase) ? \ ··· 160 157 FIELD_PREP(CDNS_XSPI_CMD_P1_R2_ADDR3, ((op)->addr.val >> 24) & 0xFF) | \ 161 158 FIELD_PREP(CDNS_XSPI_CMD_P1_R2_ADDR4, ((op)->addr.val >> 32) & 0xFF)) 162 159 163 - #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op) ( \ 160 + #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op, modebytes) ( \ 164 161 FIELD_PREP(CDNS_XSPI_CMD_P1_R3_ADDR5, ((op)->addr.val >> 40) & 0xFF) | \ 165 162 FIELD_PREP(CDNS_XSPI_CMD_P1_R3_CMD, (op)->cmd.opcode) | \ 163 + FIELD_PREP(MODE_NO_OF_BYTES, modebytes) | \ 166 164 FIELD_PREP(CDNS_XSPI_CMD_P1_R3_NUM_ADDR_BYTES, (op)->addr.nbytes)) 167 165 168 166 #define CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_4(op, chipsel) ( \ ··· 177 173 #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_2(op) \ 178 174 FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R2_DCNT_L, (op)->data.nbytes & 0xFFFF) 179 175 180 - #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op) ( \ 176 + #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op, dummybytes) ( \ 181 177 FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_DCNT_H, \ 182 178 ((op)->data.nbytes >> 16) & 0xffff) | \ 183 179 FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_NUM_OF_DUMMY, \ 184 180 (op)->dummy.buswidth != 0 ? \ 185 - (((op)->dummy.nbytes * 8) / (op)->dummy.buswidth) : \ 181 + (((dummybytes) * 8) / (op)->dummy.buswidth) : \ 186 182 0)) 187 183 188 184 #define CDNS_XSPI_CMD_FLD_DSEQ_CMD_4(op, chipsel) ( \ ··· 355 351 u32 cmd_regs[6]; 356 352 u32 cmd_status; 357 353 int ret; 354 + int dummybytes = op->dummy.nbytes; 358 355 359 356 ret = cdns_xspi_wait_for_controller_idle(cdns_xspi); 360 357 if (ret < 0) ··· 370 365 memset(cmd_regs, 0, sizeof(cmd_regs)); 371 366 cmd_regs[1] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_1(op, data_phase); 372 367 cmd_regs[2] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_2(op); 373 - cmd_regs[3] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op); 368 + if (dummybytes != 0) { 369 + cmd_regs[3] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op, 1); 370 + dummybytes--; 371 + } else { 372 + cmd_regs[3] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_3(op, 0); 373 + } 374 374 cmd_regs[4] = CDNS_XSPI_CMD_FLD_P1_INSTR_CMD_4(op, 375 375 cdns_xspi->cur_cs); 376 376 ··· 385 375 cmd_regs[0] = CDNS_XSPI_STIG_DONE_FLAG; 386 376 cmd_regs[1] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_1(op); 387 377 cmd_regs[2] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_2(op); 388 - cmd_regs[3] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op); 378 + cmd_regs[3] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op, dummybytes); 389 379 cmd_regs[4] = CDNS_XSPI_CMD_FLD_DSEQ_CMD_4(op, 390 380 cdns_xspi->cur_cs); 391 381
+13 -3
drivers/spi/spi-stm32.c
··· 1016 1016 static irqreturn_t stm32fx_spi_irq_thread(int irq, void *dev_id) 1017 1017 { 1018 1018 struct spi_controller *ctrl = dev_id; 1019 + struct stm32_spi *spi = spi_controller_get_devdata(ctrl); 1019 1020 1020 1021 spi_finalize_current_transfer(ctrl); 1022 + stm32fx_spi_disable(spi); 1021 1023 1022 1024 return IRQ_HANDLED; 1023 1025 } ··· 1057 1055 mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP; 1058 1056 1059 1057 if (!(sr & mask)) { 1060 - dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n", 1058 + dev_vdbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n", 1061 1059 sr, ier); 1062 1060 spin_unlock_irqrestore(&spi->lock, flags); 1063 1061 return IRQ_NONE; ··· 1187 1185 ~clrb) | setb, 1188 1186 spi->base + spi->cfg->regs->cpol.reg); 1189 1187 1190 - stm32_spi_enable(spi); 1191 - 1192 1188 spin_unlock_irqrestore(&spi->lock, flags); 1193 1189 1194 1190 return 0; ··· 1204 1204 1205 1205 if (spi->cur_comm == SPI_SIMPLEX_TX || spi->cur_comm == SPI_3WIRE_TX) { 1206 1206 spi_finalize_current_transfer(spi->ctrl); 1207 + stm32fx_spi_disable(spi); 1207 1208 } 1208 1209 } 1209 1210 ··· 1219 1218 struct stm32_spi *spi = data; 1220 1219 1221 1220 spi_finalize_current_transfer(spi->ctrl); 1221 + spi->cfg->disable(spi); 1222 1222 } 1223 1223 1224 1224 /** ··· 1307 1305 1308 1306 stm32_spi_set_bits(spi, STM32FX_SPI_CR2, cr2); 1309 1307 1308 + stm32_spi_enable(spi); 1309 + 1310 1310 /* starting data transfer when buffer is loaded */ 1311 1311 if (spi->tx_buf) 1312 1312 spi->cfg->write_tx(spi); ··· 1345 1341 1346 1342 spin_lock_irqsave(&spi->lock, flags); 1347 1343 1344 + stm32_spi_enable(spi); 1345 + 1348 1346 /* Be sure to have data in fifo before starting data transfer */ 1349 1347 if (spi->tx_buf) 1350 1348 stm32h7_spi_write_txfifo(spi); ··· 1378 1372 */ 1379 1373 stm32_spi_set_bits(spi, STM32FX_SPI_CR2, STM32FX_SPI_CR2_ERRIE); 1380 1374 } 1375 + 1376 + stm32_spi_enable(spi); 1381 1377 } 1382 1378 1383 1379 /** ··· 1412 1404 ier |= STM32H7_SPI_IER_EOTIE | STM32H7_SPI_IER_TXTFIE; 1413 1405 1414 1406 stm32_spi_set_bits(spi, STM32H7_SPI_IER, ier); 1407 + 1408 + stm32_spi_enable(spi); 1415 1409 1416 1410 if (STM32_SPI_HOST_MODE(spi)) 1417 1411 stm32_spi_set_bits(spi, STM32H7_SPI_CR1, STM32H7_SPI_CR1_CSTART);
+26 -5
drivers/spi/spi.c
··· 1220 1220 spi_unmap_buf_attrs(ctlr, dev, sgt, dir, 0); 1221 1221 } 1222 1222 1223 + /* Dummy SG for unidirect transfers */ 1224 + static struct scatterlist dummy_sg = { 1225 + .page_link = SG_END, 1226 + }; 1227 + 1223 1228 static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) 1224 1229 { 1225 1230 struct device *tx_dev, *rx_dev; ··· 1248 1243 else 1249 1244 rx_dev = ctlr->dev.parent; 1250 1245 1246 + ret = -ENOMSG; 1251 1247 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 1252 1248 /* The sync is done before each transfer. */ 1253 1249 unsigned long attrs = DMA_ATTR_SKIP_CPU_SYNC; ··· 1263 1257 attrs); 1264 1258 if (ret != 0) 1265 1259 return ret; 1260 + } else { 1261 + xfer->tx_sg.sgl = &dummy_sg; 1266 1262 } 1267 1263 1268 1264 if (xfer->rx_buf != NULL) { ··· 1278 1270 1279 1271 return ret; 1280 1272 } 1273 + } else { 1274 + xfer->rx_sg.sgl = &dummy_sg; 1281 1275 } 1282 1276 } 1277 + /* No transfer has been mapped, bail out with success */ 1278 + if (ret) 1279 + return 0; 1283 1280 1284 1281 ctlr->cur_rx_dma_dev = rx_dev; 1285 1282 ctlr->cur_tx_dma_dev = tx_dev; ··· 1320 1307 return 0; 1321 1308 } 1322 1309 1323 - static void spi_dma_sync_for_device(struct spi_controller *ctlr, 1310 + static void spi_dma_sync_for_device(struct spi_controller *ctlr, struct spi_message *msg, 1324 1311 struct spi_transfer *xfer) 1325 1312 { 1326 1313 struct device *rx_dev = ctlr->cur_rx_dma_dev; ··· 1329 1316 if (!ctlr->cur_msg_mapped) 1330 1317 return; 1331 1318 1319 + if (!ctlr->can_dma(ctlr, msg->spi, xfer)) 1320 + return; 1321 + 1332 1322 dma_sync_sgtable_for_device(tx_dev, &xfer->tx_sg, DMA_TO_DEVICE); 1333 1323 dma_sync_sgtable_for_device(rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); 1334 1324 } 1335 1325 1336 - static void spi_dma_sync_for_cpu(struct spi_controller *ctlr, 1326 + static void spi_dma_sync_for_cpu(struct spi_controller *ctlr, struct spi_message *msg, 1337 1327 struct spi_transfer *xfer) 1338 1328 { 1339 1329 struct device *rx_dev = ctlr->cur_rx_dma_dev; 1340 1330 struct device *tx_dev = ctlr->cur_tx_dma_dev; 1341 1331 1342 1332 if (!ctlr->cur_msg_mapped) 1333 + return; 1334 + 1335 + if (!ctlr->can_dma(ctlr, msg->spi, xfer)) 1343 1336 return; 1344 1337 1345 1338 dma_sync_sgtable_for_cpu(rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); ··· 1365 1346 } 1366 1347 1367 1348 static void spi_dma_sync_for_device(struct spi_controller *ctrl, 1349 + struct spi_message *msg, 1368 1350 struct spi_transfer *xfer) 1369 1351 { 1370 1352 } 1371 1353 1372 1354 static void spi_dma_sync_for_cpu(struct spi_controller *ctrl, 1355 + struct spi_message *msg, 1373 1356 struct spi_transfer *xfer) 1374 1357 { 1375 1358 } ··· 1643 1622 reinit_completion(&ctlr->xfer_completion); 1644 1623 1645 1624 fallback_pio: 1646 - spi_dma_sync_for_device(ctlr, xfer); 1625 + spi_dma_sync_for_device(ctlr, msg, xfer); 1647 1626 ret = ctlr->transfer_one(ctlr, msg->spi, xfer); 1648 1627 if (ret < 0) { 1649 - spi_dma_sync_for_cpu(ctlr, xfer); 1628 + spi_dma_sync_for_cpu(ctlr, msg, xfer); 1650 1629 1651 1630 if (ctlr->cur_msg_mapped && 1652 1631 (xfer->error & SPI_TRANS_FAIL_NO_START)) { ··· 1671 1650 msg->status = ret; 1672 1651 } 1673 1652 1674 - spi_dma_sync_for_cpu(ctlr, xfer); 1653 + spi_dma_sync_for_cpu(ctlr, msg, xfer); 1675 1654 } else { 1676 1655 if (xfer->len) 1677 1656 dev_err(&msg->spi->dev,
+7 -2
fs/9p/vfs_dentry.c
··· 48 48 static void v9fs_dentry_release(struct dentry *dentry) 49 49 { 50 50 struct hlist_node *p, *n; 51 + struct hlist_head head; 51 52 52 53 p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n", 53 54 dentry, dentry); 54 - hlist_for_each_safe(p, n, (struct hlist_head *)&dentry->d_fsdata) 55 + 56 + spin_lock(&dentry->d_lock); 57 + hlist_move_list((struct hlist_head *)&dentry->d_fsdata, &head); 58 + spin_unlock(&dentry->d_lock); 59 + 60 + hlist_for_each_safe(p, n, &head) 55 61 p9_fid_put(hlist_entry(p, struct p9_fid, dlist)); 56 - dentry->d_fsdata = NULL; 57 62 } 58 63 59 64 static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
+1
fs/9p/vfs_inode.c
··· 348 348 __le32 __maybe_unused version; 349 349 350 350 if (!is_bad_inode(inode)) { 351 + netfs_wait_for_outstanding_io(inode); 351 352 truncate_inode_pages_final(&inode->i_data); 352 353 353 354 version = cpu_to_le32(v9inode->qid.version);
+1
fs/afs/inode.c
··· 648 648 649 649 ASSERTCMP(inode->i_ino, ==, vnode->fid.vnode); 650 650 651 + netfs_wait_for_outstanding_io(inode); 651 652 truncate_inode_pages_final(&inode->i_data); 652 653 653 654 afs_set_cache_aux(vnode, &aux);
+5
fs/afs/mntpt.c
··· 140 140 put_page(page); 141 141 if (ret < 0) 142 142 return ret; 143 + 144 + /* Don't cross a backup volume mountpoint from a backup volume */ 145 + if (src_as->volume && src_as->volume->type == AFSVL_BACKVOL && 146 + ctx->type == AFSVL_BACKVOL) 147 + return -ENODEV; 143 148 } 144 149 145 150 return 0;
+1 -1
fs/bcachefs/backpointers.c
··· 690 690 691 691 ptrs = bch2_bkey_ptrs_c(k); 692 692 bkey_for_each_ptr_decode(k.k, ptrs, p, entry) { 693 - struct bpos bucket_pos; 693 + struct bpos bucket_pos = POS_MIN; 694 694 struct bch_backpointer bp; 695 695 696 696 if (p.ptr.cached)
+1 -43
fs/bcachefs/bcachefs.h
··· 457 457 }; 458 458 459 459 #include "alloc_types.h" 460 + #include "btree_gc_types.h" 460 461 #include "btree_types.h" 461 462 #include "btree_node_scan_types.h" 462 463 #include "btree_write_buffer_types.h" ··· 488 487 #define BTREE_NODE_OPEN_BUCKET_RESERVE (BTREE_RESERVE_MAX * BCH_REPLICAS_MAX) 489 488 490 489 struct btree; 491 - 492 - enum gc_phase { 493 - GC_PHASE_NOT_RUNNING, 494 - GC_PHASE_START, 495 - GC_PHASE_SB, 496 - 497 - GC_PHASE_BTREE_stripes, 498 - GC_PHASE_BTREE_extents, 499 - GC_PHASE_BTREE_inodes, 500 - GC_PHASE_BTREE_dirents, 501 - GC_PHASE_BTREE_xattrs, 502 - GC_PHASE_BTREE_alloc, 503 - GC_PHASE_BTREE_quotas, 504 - GC_PHASE_BTREE_reflink, 505 - GC_PHASE_BTREE_subvolumes, 506 - GC_PHASE_BTREE_snapshots, 507 - GC_PHASE_BTREE_lru, 508 - GC_PHASE_BTREE_freespace, 509 - GC_PHASE_BTREE_need_discard, 510 - GC_PHASE_BTREE_backpointers, 511 - GC_PHASE_BTREE_bucket_gens, 512 - GC_PHASE_BTREE_snapshot_trees, 513 - GC_PHASE_BTREE_deleted_inodes, 514 - GC_PHASE_BTREE_logged_ops, 515 - GC_PHASE_BTREE_rebalance_work, 516 - GC_PHASE_BTREE_subvolume_children, 517 - 518 - GC_PHASE_PENDING_DELETE, 519 - }; 520 - 521 - struct gc_pos { 522 - enum gc_phase phase; 523 - u16 level; 524 - struct bpos pos; 525 - }; 526 - 527 - struct reflink_gc { 528 - u64 offset; 529 - u32 size; 530 - u32 refcount; 531 - }; 532 - 533 - typedef GENRADIX(struct reflink_gc) reflink_gc_table; 534 490 535 491 struct io_count { 536 492 u64 sectors[2][BCH_DATA_NR];
+10 -185
fs/bcachefs/bcachefs_format.h
··· 503 503 504 504 #include "alloc_background_format.h" 505 505 #include "extents_format.h" 506 - #include "reflink_format.h" 507 506 #include "ec_format.h" 508 - #include "inode_format.h" 509 507 #include "dirent_format.h" 510 - #include "xattr_format.h" 511 - #include "quota_format.h" 508 + #include "disk_groups_format.h" 509 + #include "inode_format.h" 510 + #include "journal_seq_blacklist_format.h" 512 511 #include "logged_ops_format.h" 512 + #include "quota_format.h" 513 + #include "reflink_format.h" 514 + #include "replicas_format.h" 513 515 #include "snapshot_format.h" 514 516 #include "subvolume_format.h" 515 517 #include "sb-counters_format.h" 518 + #include "sb-downgrade_format.h" 519 + #include "sb-errors_format.h" 520 + #include "sb-members_format.h" 521 + #include "xattr_format.h" 516 522 517 523 enum bch_sb_field_type { 518 524 #define x(f, nr) BCH_SB_FIELD_##f = nr, ··· 549 543 __le64 start; 550 544 __le64 nr; 551 545 } d[]; 552 - }; 553 - 554 - /* BCH_SB_FIELD_members_v1: */ 555 - 556 - #define BCH_MIN_NR_NBUCKETS (1 << 6) 557 - 558 - #define BCH_IOPS_MEASUREMENTS() \ 559 - x(seqread, 0) \ 560 - x(seqwrite, 1) \ 561 - x(randread, 2) \ 562 - x(randwrite, 3) 563 - 564 - enum bch_iops_measurement { 565 - #define x(t, n) BCH_IOPS_##t = n, 566 - BCH_IOPS_MEASUREMENTS() 567 - #undef x 568 - BCH_IOPS_NR 569 - }; 570 - 571 - #define BCH_MEMBER_ERROR_TYPES() \ 572 - x(read, 0) \ 573 - x(write, 1) \ 574 - x(checksum, 2) 575 - 576 - enum bch_member_error_type { 577 - #define x(t, n) BCH_MEMBER_ERROR_##t = n, 578 - BCH_MEMBER_ERROR_TYPES() 579 - #undef x 580 - BCH_MEMBER_ERROR_NR 581 - }; 582 - 583 - struct bch_member { 584 - __uuid_t uuid; 585 - __le64 nbuckets; /* device size */ 586 - __le16 first_bucket; /* index of first bucket used */ 587 - __le16 bucket_size; /* sectors */ 588 - __u8 btree_bitmap_shift; 589 - __u8 pad[3]; 590 - __le64 last_mount; /* time_t */ 591 - 592 - __le64 flags; 593 - __le32 iops[4]; 594 - __le64 errors[BCH_MEMBER_ERROR_NR]; 595 - __le64 errors_at_reset[BCH_MEMBER_ERROR_NR]; 596 - __le64 errors_reset_time; 597 - __le64 seq; 598 - __le64 btree_allocated_bitmap; 599 - /* 600 - * On recovery from a clean shutdown we don't normally read the journal, 601 - * but we still want to resume writing from where we left off so we 602 - * don't overwrite more than is necessary, for list journal debugging: 603 - */ 604 - __le32 last_journal_bucket; 605 - __le32 last_journal_bucket_offset; 606 - }; 607 - 608 - /* 609 - * This limit comes from the bucket_gens array - it's a single allocation, and 610 - * kernel allocation are limited to INT_MAX 611 - */ 612 - #define BCH_MEMBER_NBUCKETS_MAX (INT_MAX - 64) 613 - 614 - #define BCH_MEMBER_V1_BYTES 56 615 - 616 - LE64_BITMASK(BCH_MEMBER_STATE, struct bch_member, flags, 0, 4) 617 - /* 4-14 unused, was TIER, HAS_(META)DATA, REPLACEMENT */ 618 - LE64_BITMASK(BCH_MEMBER_DISCARD, struct bch_member, flags, 14, 15) 619 - LE64_BITMASK(BCH_MEMBER_DATA_ALLOWED, struct bch_member, flags, 15, 20) 620 - LE64_BITMASK(BCH_MEMBER_GROUP, struct bch_member, flags, 20, 28) 621 - LE64_BITMASK(BCH_MEMBER_DURABILITY, struct bch_member, flags, 28, 30) 622 - LE64_BITMASK(BCH_MEMBER_FREESPACE_INITIALIZED, 623 - struct bch_member, flags, 30, 31) 624 - 625 - #if 0 626 - LE64_BITMASK(BCH_MEMBER_NR_READ_ERRORS, struct bch_member, flags[1], 0, 20); 627 - LE64_BITMASK(BCH_MEMBER_NR_WRITE_ERRORS,struct bch_member, flags[1], 20, 40); 628 - #endif 629 - 630 - #define BCH_MEMBER_STATES() \ 631 - x(rw, 0) \ 632 - x(ro, 1) \ 633 - x(failed, 2) \ 634 - x(spare, 3) 635 - 636 - enum bch_member_state { 637 - #define x(t, n) BCH_MEMBER_STATE_##t = n, 638 - BCH_MEMBER_STATES() 639 - #undef x 640 - BCH_MEMBER_STATE_NR 641 - }; 642 - 643 - struct bch_sb_field_members_v1 { 644 - struct bch_sb_field field; 645 - struct bch_member _members[]; //Members are now variable size 646 - }; 647 - 648 - struct bch_sb_field_members_v2 { 649 - struct bch_sb_field field; 650 - __le16 member_bytes; //size of single member entry 651 - u8 pad[6]; 652 - struct bch_member _members[]; 653 546 }; 654 547 655 548 /* BCH_SB_FIELD_crypt: */ ··· 599 694 LE64_BITMASK(BCH_KDF_SCRYPT_R, struct bch_sb_field_crypt, kdf_flags, 16, 32); 600 695 LE64_BITMASK(BCH_KDF_SCRYPT_P, struct bch_sb_field_crypt, kdf_flags, 32, 48); 601 696 602 - /* BCH_SB_FIELD_replicas: */ 603 - 604 697 #define BCH_DATA_TYPES() \ 605 698 x(free, 0) \ 606 699 x(sb, 1) \ ··· 641 738 } 642 739 } 643 740 644 - struct bch_replicas_entry_v0 { 645 - __u8 data_type; 646 - __u8 nr_devs; 647 - __u8 devs[]; 648 - } __packed; 649 - 650 - struct bch_sb_field_replicas_v0 { 651 - struct bch_sb_field field; 652 - struct bch_replicas_entry_v0 entries[]; 653 - } __packed __aligned(8); 654 - 655 - struct bch_replicas_entry_v1 { 656 - __u8 data_type; 657 - __u8 nr_devs; 658 - __u8 nr_required; 659 - __u8 devs[]; 660 - } __packed; 661 - 662 - #define replicas_entry_bytes(_i) \ 663 - (offsetof(typeof(*(_i)), devs) + (_i)->nr_devs) 664 - 665 - struct bch_sb_field_replicas { 666 - struct bch_sb_field field; 667 - struct bch_replicas_entry_v1 entries[]; 668 - } __packed __aligned(8); 669 - 670 - /* BCH_SB_FIELD_disk_groups: */ 671 - 672 - #define BCH_SB_LABEL_SIZE 32 673 - 674 - struct bch_disk_group { 675 - __u8 label[BCH_SB_LABEL_SIZE]; 676 - __le64 flags[2]; 677 - } __packed __aligned(8); 678 - 679 - LE64_BITMASK(BCH_GROUP_DELETED, struct bch_disk_group, flags[0], 0, 1) 680 - LE64_BITMASK(BCH_GROUP_DATA_ALLOWED, struct bch_disk_group, flags[0], 1, 6) 681 - LE64_BITMASK(BCH_GROUP_PARENT, struct bch_disk_group, flags[0], 6, 24) 682 - 683 - struct bch_sb_field_disk_groups { 684 - struct bch_sb_field field; 685 - struct bch_disk_group entries[]; 686 - } __packed __aligned(8); 687 - 688 741 /* 689 742 * On clean shutdown, store btree roots and current journal sequence number in 690 743 * the superblock: ··· 668 809 __u64 _data[]; 669 810 }; 670 811 671 - struct journal_seq_blacklist_entry { 672 - __le64 start; 673 - __le64 end; 674 - }; 675 - 676 - struct bch_sb_field_journal_seq_blacklist { 677 - struct bch_sb_field field; 678 - struct journal_seq_blacklist_entry start[]; 679 - }; 680 - 681 - struct bch_sb_field_errors { 682 - struct bch_sb_field field; 683 - struct bch_sb_field_error_entry { 684 - __le64 v; 685 - __le64 last_error_time; 686 - } entries[]; 687 - }; 688 - 689 - LE64_BITMASK(BCH_SB_ERROR_ENTRY_ID, struct bch_sb_field_error_entry, v, 0, 16); 690 - LE64_BITMASK(BCH_SB_ERROR_ENTRY_NR, struct bch_sb_field_error_entry, v, 16, 64); 691 - 692 812 struct bch_sb_field_ext { 693 813 struct bch_sb_field field; 694 814 __le64 recovery_passes_required[2]; 695 815 __le64 errors_silent[8]; 696 816 __le64 btrees_lost_data; 697 - }; 698 - 699 - struct bch_sb_field_downgrade_entry { 700 - __le16 version; 701 - __le64 recovery_passes[2]; 702 - __le16 nr_errors; 703 - __le16 errors[] __counted_by(nr_errors); 704 - } __packed __aligned(2); 705 - 706 - struct bch_sb_field_downgrade { 707 - struct bch_sb_field field; 708 - struct bch_sb_field_downgrade_entry entries[]; 709 817 }; 710 818 711 819 /* Superblock: */ ··· 735 909 #define bcachefs_metadata_version_current (bcachefs_metadata_version_max - 1) 736 910 737 911 #define BCH_SB_SECTOR 8 738 - #define BCH_SB_MEMBERS_MAX 64 /* XXX kill */ 739 912 740 913 #define BCH_SB_LAYOUT_SIZE_BITS_MAX 16 /* 32 MB */ 741 914
+9 -9
fs/bcachefs/btree_gc.c
··· 585 585 586 586 if (fsck_err_on(k.k->version.lo > atomic64_read(&c->key_version), c, 587 587 bkey_version_in_future, 588 - "key version number higher than recorded: %llu > %llu", 589 - k.k->version.lo, 590 - atomic64_read(&c->key_version))) 588 + "key version number higher than recorded %llu\n %s", 589 + atomic64_read(&c->key_version), 590 + (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) 591 591 atomic64_set(&c->key_version, k.k->version.lo); 592 592 } 593 593 594 594 if (mustfix_fsck_err_on(level && !bch2_dev_btree_bitmap_marked(c, k), 595 595 c, btree_bitmap_not_marked, 596 596 "btree ptr not marked in member info btree allocated bitmap\n %s", 597 - (bch2_bkey_val_to_text(&buf, c, k), 597 + (printbuf_reset(&buf), 598 + bch2_bkey_val_to_text(&buf, c, k), 598 599 buf.buf))) { 599 600 mutex_lock(&c->sb_lock); 600 601 bch2_dev_btree_bitmap_mark(c, k); ··· 674 673 675 674 static inline int btree_id_gc_phase_cmp(enum btree_id l, enum btree_id r) 676 675 { 677 - return (int) btree_id_to_gc_phase(l) - 678 - (int) btree_id_to_gc_phase(r); 676 + return cmp_int(gc_btree_order(l), gc_btree_order(r)); 679 677 } 680 678 681 679 static int bch2_gc_btrees(struct bch_fs *c) ··· 711 711 static int bch2_mark_superblocks(struct bch_fs *c) 712 712 { 713 713 mutex_lock(&c->sb_lock); 714 - gc_pos_set(c, gc_phase(GC_PHASE_SB)); 714 + gc_pos_set(c, gc_phase(GC_PHASE_sb)); 715 715 716 716 int ret = bch2_trans_mark_dev_sbs_flags(c, BTREE_TRIGGER_gc); 717 717 mutex_unlock(&c->sb_lock); ··· 1209 1209 if (ret) 1210 1210 goto out; 1211 1211 1212 - gc_pos_set(c, gc_phase(GC_PHASE_START)); 1212 + gc_pos_set(c, gc_phase(GC_PHASE_start)); 1213 1213 1214 1214 ret = bch2_mark_superblocks(c); 1215 1215 BUG_ON(ret); ··· 1231 1231 1232 1232 percpu_down_write(&c->mark_lock); 1233 1233 /* Indicates that gc is no longer in progress: */ 1234 - __gc_pos_set(c, gc_phase(GC_PHASE_NOT_RUNNING)); 1234 + __gc_pos_set(c, gc_phase(GC_PHASE_not_running)); 1235 1235 1236 1236 bch2_gc_free(c); 1237 1237 percpu_up_write(&c->mark_lock);
+20 -24
fs/bcachefs/btree_gc.h
··· 3 3 #define _BCACHEFS_BTREE_GC_H 4 4 5 5 #include "bkey.h" 6 + #include "btree_gc_types.h" 6 7 #include "btree_types.h" 7 8 8 9 int bch2_check_topology(struct bch_fs *); ··· 33 32 /* Position of (the start of) a gc phase: */ 34 33 static inline struct gc_pos gc_phase(enum gc_phase phase) 35 34 { 36 - return (struct gc_pos) { 37 - .phase = phase, 38 - .level = 0, 39 - .pos = POS_MIN, 40 - }; 41 - } 42 - 43 - static inline int gc_pos_cmp(struct gc_pos l, struct gc_pos r) 44 - { 45 - return cmp_int(l.phase, r.phase) ?: 46 - -cmp_int(l.level, r.level) ?: 47 - bpos_cmp(l.pos, r.pos); 48 - } 49 - 50 - static inline enum gc_phase btree_id_to_gc_phase(enum btree_id id) 51 - { 52 - switch (id) { 53 - #define x(name, v, ...) case BTREE_ID_##name: return GC_PHASE_BTREE_##name; 54 - BCH_BTREE_IDS() 55 - #undef x 56 - default: 57 - BUG(); 58 - } 35 + return (struct gc_pos) { .phase = phase, }; 59 36 } 60 37 61 38 static inline struct gc_pos gc_pos_btree(enum btree_id btree, unsigned level, 62 39 struct bpos pos) 63 40 { 64 41 return (struct gc_pos) { 65 - .phase = btree_id_to_gc_phase(btree), 42 + .phase = GC_PHASE_btree, 43 + .btree = btree, 66 44 .level = level, 67 45 .pos = pos, 68 46 }; ··· 54 74 static inline struct gc_pos gc_pos_btree_node(struct btree *b) 55 75 { 56 76 return gc_pos_btree(b->c.btree_id, b->c.level, b->key.k.p); 77 + } 78 + 79 + static inline int gc_btree_order(enum btree_id btree) 80 + { 81 + if (btree == BTREE_ID_stripes) 82 + return -1; 83 + return btree; 84 + } 85 + 86 + static inline int gc_pos_cmp(struct gc_pos l, struct gc_pos r) 87 + { 88 + return cmp_int(l.phase, r.phase) ?: 89 + cmp_int(gc_btree_order(l.btree), 90 + gc_btree_order(r.btree)) ?: 91 + -cmp_int(l.level, r.level) ?: 92 + bpos_cmp(l.pos, r.pos); 57 93 } 58 94 59 95 static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos)
+29
fs/bcachefs/btree_gc_types.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_BTREE_GC_TYPES_H 3 + #define _BCACHEFS_BTREE_GC_TYPES_H 4 + 5 + #include <linux/generic-radix-tree.h> 6 + 7 + enum gc_phase { 8 + GC_PHASE_not_running, 9 + GC_PHASE_start, 10 + GC_PHASE_sb, 11 + GC_PHASE_btree, 12 + }; 13 + 14 + struct gc_pos { 15 + enum gc_phase phase:8; 16 + enum btree_id btree:8; 17 + u16 level; 18 + struct bpos pos; 19 + }; 20 + 21 + struct reflink_gc { 22 + u64 offset; 23 + u32 size; 24 + u32 refcount; 25 + }; 26 + 27 + typedef GENRADIX(struct reflink_gc) reflink_gc_table; 28 + 29 + #endif /* _BCACHEFS_BTREE_GC_TYPES_H */
+45 -40
fs/bcachefs/btree_io.c
··· 519 519 520 520 static void btree_err_msg(struct printbuf *out, struct bch_fs *c, 521 521 struct bch_dev *ca, 522 - struct btree *b, struct bset *i, 522 + struct btree *b, struct bset *i, struct bkey_packed *k, 523 523 unsigned offset, int write) 524 524 { 525 525 prt_printf(out, bch2_log_msg(c, "%s"), ··· 537 537 b->written, btree_ptr_sectors_written(&b->key)); 538 538 if (i) 539 539 prt_printf(out, " bset u64s %u", le16_to_cpu(i->u64s)); 540 + if (k) 541 + prt_printf(out, " bset byte offset %lu", 542 + (unsigned long)(void *)k - 543 + ((unsigned long)(void *)i & ~511UL)); 540 544 prt_str(out, ": "); 541 545 } 542 546 543 - __printf(9, 10) 547 + __printf(10, 11) 544 548 static int __btree_err(int ret, 545 549 struct bch_fs *c, 546 550 struct bch_dev *ca, 547 551 struct btree *b, 548 552 struct bset *i, 553 + struct bkey_packed *k, 549 554 int write, 550 555 bool have_retry, 551 556 enum bch_sb_error_id err_type, ··· 560 555 bool silent = c->curr_recovery_pass == BCH_RECOVERY_PASS_scan_for_btree_nodes; 561 556 va_list args; 562 557 563 - btree_err_msg(&out, c, ca, b, i, b->written, write); 558 + btree_err_msg(&out, c, ca, b, i, k, b->written, write); 564 559 565 560 va_start(args, fmt); 566 561 prt_vprintf(&out, fmt, args); ··· 616 611 return ret; 617 612 } 618 613 619 - #define btree_err(type, c, ca, b, i, _err_type, msg, ...) \ 614 + #define btree_err(type, c, ca, b, i, k, _err_type, msg, ...) \ 620 615 ({ \ 621 - int _ret = __btree_err(type, c, ca, b, i, write, have_retry, \ 616 + int _ret = __btree_err(type, c, ca, b, i, k, write, have_retry, \ 622 617 BCH_FSCK_ERR_##_err_type, \ 623 618 msg, ##__VA_ARGS__); \ 624 619 \ ··· 695 690 696 691 btree_err_on(!bch2_version_compatible(version), 697 692 -BCH_ERR_btree_node_read_err_incompatible, 698 - c, ca, b, i, 693 + c, ca, b, i, NULL, 699 694 btree_node_unsupported_version, 700 695 "unsupported bset version %u.%u", 701 696 BCH_VERSION_MAJOR(version), ··· 703 698 704 699 if (btree_err_on(version < c->sb.version_min, 705 700 -BCH_ERR_btree_node_read_err_fixable, 706 - c, NULL, b, i, 701 + c, NULL, b, i, NULL, 707 702 btree_node_bset_older_than_sb_min, 708 703 "bset version %u older than superblock version_min %u", 709 704 version, c->sb.version_min)) { ··· 716 711 if (btree_err_on(BCH_VERSION_MAJOR(version) > 717 712 BCH_VERSION_MAJOR(c->sb.version), 718 713 -BCH_ERR_btree_node_read_err_fixable, 719 - c, NULL, b, i, 714 + c, NULL, b, i, NULL, 720 715 btree_node_bset_newer_than_sb, 721 716 "bset version %u newer than superblock version %u", 722 717 version, c->sb.version)) { ··· 728 723 729 724 btree_err_on(BSET_SEPARATE_WHITEOUTS(i), 730 725 -BCH_ERR_btree_node_read_err_incompatible, 731 - c, ca, b, i, 726 + c, ca, b, i, NULL, 732 727 btree_node_unsupported_version, 733 728 "BSET_SEPARATE_WHITEOUTS no longer supported"); 734 729 735 730 if (btree_err_on(offset + sectors > btree_sectors(c), 736 731 -BCH_ERR_btree_node_read_err_fixable, 737 - c, ca, b, i, 732 + c, ca, b, i, NULL, 738 733 bset_past_end_of_btree_node, 739 734 "bset past end of btree node")) { 740 735 i->u64s = 0; ··· 744 739 745 740 btree_err_on(offset && !i->u64s, 746 741 -BCH_ERR_btree_node_read_err_fixable, 747 - c, ca, b, i, 742 + c, ca, b, i, NULL, 748 743 bset_empty, 749 744 "empty bset"); 750 745 751 746 btree_err_on(BSET_OFFSET(i) && BSET_OFFSET(i) != offset, 752 747 -BCH_ERR_btree_node_read_err_want_retry, 753 - c, ca, b, i, 748 + c, ca, b, i, NULL, 754 749 bset_wrong_sector_offset, 755 750 "bset at wrong sector offset"); 756 751 ··· 766 761 /* XXX endianness */ 767 762 btree_err_on(bp->seq != bn->keys.seq, 768 763 -BCH_ERR_btree_node_read_err_must_retry, 769 - c, ca, b, NULL, 764 + c, ca, b, NULL, NULL, 770 765 bset_bad_seq, 771 766 "incorrect sequence number (wrong btree node)"); 772 767 } 773 768 774 769 btree_err_on(BTREE_NODE_ID(bn) != b->c.btree_id, 775 770 -BCH_ERR_btree_node_read_err_must_retry, 776 - c, ca, b, i, 771 + c, ca, b, i, NULL, 777 772 btree_node_bad_btree, 778 773 "incorrect btree id"); 779 774 780 775 btree_err_on(BTREE_NODE_LEVEL(bn) != b->c.level, 781 776 -BCH_ERR_btree_node_read_err_must_retry, 782 - c, ca, b, i, 777 + c, ca, b, i, NULL, 783 778 btree_node_bad_level, 784 779 "incorrect level"); 785 780 ··· 798 793 799 794 btree_err_on(!bpos_eq(b->data->min_key, bp->min_key), 800 795 -BCH_ERR_btree_node_read_err_must_retry, 801 - c, ca, b, NULL, 796 + c, ca, b, NULL, NULL, 802 797 btree_node_bad_min_key, 803 798 "incorrect min_key: got %s should be %s", 804 799 (printbuf_reset(&buf1), ··· 809 804 810 805 btree_err_on(!bpos_eq(bn->max_key, b->key.k.p), 811 806 -BCH_ERR_btree_node_read_err_must_retry, 812 - c, ca, b, i, 807 + c, ca, b, i, NULL, 813 808 btree_node_bad_max_key, 814 809 "incorrect max key %s", 815 810 (printbuf_reset(&buf1), ··· 821 816 822 817 btree_err_on(bch2_bkey_format_invalid(c, &bn->format, write, &buf1), 823 818 -BCH_ERR_btree_node_read_err_bad_node, 824 - c, ca, b, i, 819 + c, ca, b, i, NULL, 825 820 btree_node_bad_format, 826 821 "invalid bkey format: %s\n %s", buf1.buf, 827 822 (printbuf_reset(&buf2), ··· 888 883 889 884 if (btree_err_on(bkey_p_next(k) > vstruct_last(i), 890 885 -BCH_ERR_btree_node_read_err_fixable, 891 - c, NULL, b, i, 886 + c, NULL, b, i, k, 892 887 btree_node_bkey_past_bset_end, 893 888 "key extends past end of bset")) { 894 889 i->u64s = cpu_to_le16((u64 *) k - i->_data); ··· 897 892 898 893 if (btree_err_on(k->format > KEY_FORMAT_CURRENT, 899 894 -BCH_ERR_btree_node_read_err_fixable, 900 - c, NULL, b, i, 895 + c, NULL, b, i, k, 901 896 btree_node_bkey_bad_format, 902 897 "invalid bkey format %u", k->format)) 903 898 goto drop_this_key; 904 899 905 900 if (btree_err_on(!bkeyp_u64s_valid(&b->format, k), 906 901 -BCH_ERR_btree_node_read_err_fixable, 907 - c, NULL, b, i, 902 + c, NULL, b, i, k, 908 903 btree_node_bkey_bad_u64s, 909 904 "bad k->u64s %u (min %u max %zu)", k->u64s, 910 905 bkeyp_key_u64s(&b->format, k), ··· 926 921 bch2_bkey_val_to_text(&buf, c, u.s_c); 927 922 928 923 btree_err(-BCH_ERR_btree_node_read_err_fixable, 929 - c, NULL, b, i, 924 + c, NULL, b, i, k, 930 925 btree_node_bad_bkey, 931 926 "invalid bkey: %s", buf.buf); 932 927 goto drop_this_key; ··· 947 942 bch2_bkey_to_text(&buf, u.k); 948 943 949 944 if (btree_err(-BCH_ERR_btree_node_read_err_fixable, 950 - c, NULL, b, i, 945 + c, NULL, b, i, k, 951 946 btree_node_bkey_out_of_order, 952 947 "%s", buf.buf)) 953 948 goto drop_this_key; ··· 1016 1011 1017 1012 if (bch2_meta_read_fault("btree")) 1018 1013 btree_err(-BCH_ERR_btree_node_read_err_must_retry, 1019 - c, ca, b, NULL, 1014 + c, ca, b, NULL, NULL, 1020 1015 btree_node_fault_injected, 1021 1016 "dynamic fault"); 1022 1017 1023 1018 btree_err_on(le64_to_cpu(b->data->magic) != bset_magic(c), 1024 1019 -BCH_ERR_btree_node_read_err_must_retry, 1025 - c, ca, b, NULL, 1020 + c, ca, b, NULL, NULL, 1026 1021 btree_node_bad_magic, 1027 1022 "bad magic: want %llx, got %llx", 1028 1023 bset_magic(c), le64_to_cpu(b->data->magic)); ··· 1037 1032 1038 1033 btree_err_on(b->data->keys.seq != bp->seq, 1039 1034 -BCH_ERR_btree_node_read_err_must_retry, 1040 - c, ca, b, NULL, 1035 + c, ca, b, NULL, NULL, 1041 1036 btree_node_bad_seq, 1042 1037 "got wrong btree node: got\n%s", 1043 1038 (printbuf_reset(&buf), ··· 1046 1041 } else { 1047 1042 btree_err_on(!b->data->keys.seq, 1048 1043 -BCH_ERR_btree_node_read_err_must_retry, 1049 - c, ca, b, NULL, 1044 + c, ca, b, NULL, NULL, 1050 1045 btree_node_bad_seq, 1051 1046 "bad btree header: seq 0\n%s", 1052 1047 (printbuf_reset(&buf), ··· 1065 1060 1066 1061 btree_err_on(!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i)), 1067 1062 -BCH_ERR_btree_node_read_err_want_retry, 1068 - c, ca, b, i, 1063 + c, ca, b, i, NULL, 1069 1064 bset_unknown_csum, 1070 1065 "unknown checksum type %llu", BSET_CSUM_TYPE(i)); 1071 1066 ··· 1078 1073 1079 1074 btree_err_on(csum_bad, 1080 1075 -BCH_ERR_btree_node_read_err_want_retry, 1081 - c, ca, b, i, 1076 + c, ca, b, i, NULL, 1082 1077 bset_bad_csum, 1083 1078 "%s", 1084 1079 (printbuf_reset(&buf), ··· 1093 1088 btree_err_on(btree_node_type_is_extents(btree_node_type(b)) && 1094 1089 !BTREE_NODE_NEW_EXTENT_OVERWRITE(b->data), 1095 1090 -BCH_ERR_btree_node_read_err_incompatible, 1096 - c, NULL, b, NULL, 1091 + c, NULL, b, NULL, NULL, 1097 1092 btree_node_unsupported_version, 1098 1093 "btree node does not have NEW_EXTENT_OVERWRITE set"); 1099 1094 ··· 1107 1102 1108 1103 btree_err_on(!bch2_checksum_type_valid(c, BSET_CSUM_TYPE(i)), 1109 1104 -BCH_ERR_btree_node_read_err_want_retry, 1110 - c, ca, b, i, 1105 + c, ca, b, i, NULL, 1111 1106 bset_unknown_csum, 1112 1107 "unknown checksum type %llu", BSET_CSUM_TYPE(i)); 1113 1108 ··· 1119 1114 1120 1115 btree_err_on(csum_bad, 1121 1116 -BCH_ERR_btree_node_read_err_want_retry, 1122 - c, ca, b, i, 1117 + c, ca, b, i, NULL, 1123 1118 bset_bad_csum, 1124 1119 "%s", 1125 1120 (printbuf_reset(&buf), ··· 1157 1152 1158 1153 btree_err_on(blacklisted && first, 1159 1154 -BCH_ERR_btree_node_read_err_fixable, 1160 - c, ca, b, i, 1155 + c, ca, b, i, NULL, 1161 1156 bset_blacklisted_journal_seq, 1162 1157 "first btree node bset has blacklisted journal seq (%llu)", 1163 1158 le64_to_cpu(i->journal_seq)); 1164 1159 1165 1160 btree_err_on(blacklisted && ptr_written, 1166 1161 -BCH_ERR_btree_node_read_err_fixable, 1167 - c, ca, b, i, 1162 + c, ca, b, i, NULL, 1168 1163 first_bset_blacklisted_journal_seq, 1169 1164 "found blacklisted bset (journal seq %llu) in btree node at offset %u-%u/%u", 1170 1165 le64_to_cpu(i->journal_seq), ··· 1183 1178 if (ptr_written) { 1184 1179 btree_err_on(b->written < ptr_written, 1185 1180 -BCH_ERR_btree_node_read_err_want_retry, 1186 - c, ca, b, NULL, 1181 + c, ca, b, NULL, NULL, 1187 1182 btree_node_data_missing, 1188 1183 "btree node data missing: expected %u sectors, found %u", 1189 1184 ptr_written, b->written); ··· 1196 1191 le64_to_cpu(bne->keys.journal_seq), 1197 1192 true), 1198 1193 -BCH_ERR_btree_node_read_err_want_retry, 1199 - c, ca, b, NULL, 1194 + c, ca, b, NULL, NULL, 1200 1195 btree_node_bset_after_end, 1201 1196 "found bset signature after last bset"); 1202 1197 } ··· 1240 1235 bch2_bkey_val_to_text(&buf, c, u.s_c); 1241 1236 1242 1237 btree_err(-BCH_ERR_btree_node_read_err_fixable, 1243 - c, NULL, b, i, 1238 + c, NULL, b, i, k, 1244 1239 btree_node_bad_bkey, 1245 1240 "%s", buf.buf); 1246 1241 ··· 1476 1471 1477 1472 written2 = btree_node_sectors_written(c, ra->buf[i]); 1478 1473 if (btree_err_on(written2 != written, -BCH_ERR_btree_node_read_err_fixable, 1479 - c, NULL, b, NULL, 1474 + c, NULL, b, NULL, NULL, 1480 1475 btree_node_replicas_sectors_written_mismatch, 1481 1476 "btree node sectors written mismatch: %u != %u", 1482 1477 written, written2) || 1483 1478 btree_err_on(btree_node_has_extra_bsets(c, written2, ra->buf[i]), 1484 1479 -BCH_ERR_btree_node_read_err_fixable, 1485 - c, NULL, b, NULL, 1480 + c, NULL, b, NULL, NULL, 1486 1481 btree_node_bset_after_end, 1487 1482 "found bset signature after last bset") || 1488 1483 btree_err_on(memcmp(ra->buf[best], ra->buf[i], written << 9), 1489 1484 -BCH_ERR_btree_node_read_err_fixable, 1490 - c, NULL, b, NULL, 1485 + c, NULL, b, NULL, NULL, 1491 1486 btree_node_replicas_data_mismatch, 1492 1487 "btree node replicas content mismatch")) 1493 1488 dump_bset_maps = true;
+6 -6
fs/bcachefs/btree_key_cache.c
··· 424 424 goto err; 425 425 } 426 426 427 + ret = bch2_trans_relock(trans); 428 + if (ret) { 429 + kfree(new_k); 430 + goto err; 431 + } 432 + 427 433 if (!bch2_btree_node_relock(trans, ck_path, 0)) { 428 434 kfree(new_k); 429 435 trace_and_count(trans->c, trans_restart_relock_key_cache_fill, trans, _THIS_IP_, ck_path); 430 436 ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_fill); 431 - goto err; 432 - } 433 - 434 - ret = bch2_trans_relock(trans); 435 - if (ret) { 436 - kfree(new_k); 437 437 goto err; 438 438 } 439 439 }
+1 -1
fs/bcachefs/buckets.c
··· 1134 1134 r.e.nr_required = 1; 1135 1135 1136 1136 bkey_for_each_ptr_decode(k.k, ptrs, p, entry) { 1137 - s64 disk_sectors; 1137 + s64 disk_sectors = 0; 1138 1138 ret = bch2_trigger_pointer(trans, btree_id, level, k, p, entry, &disk_sectors, flags); 1139 1139 if (ret < 0) 1140 1140 return ret;
+21
fs/bcachefs/disk_groups_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_DISK_GROUPS_FORMAT_H 3 + #define _BCACHEFS_DISK_GROUPS_FORMAT_H 4 + 5 + #define BCH_SB_LABEL_SIZE 32 6 + 7 + struct bch_disk_group { 8 + __u8 label[BCH_SB_LABEL_SIZE]; 9 + __le64 flags[2]; 10 + } __packed __aligned(8); 11 + 12 + LE64_BITMASK(BCH_GROUP_DELETED, struct bch_disk_group, flags[0], 0, 1) 13 + LE64_BITMASK(BCH_GROUP_DATA_ALLOWED, struct bch_disk_group, flags[0], 1, 6) 14 + LE64_BITMASK(BCH_GROUP_PARENT, struct bch_disk_group, flags[0], 6, 24) 15 + 16 + struct bch_sb_field_disk_groups { 17 + struct bch_sb_field field; 18 + struct bch_disk_group entries[]; 19 + } __packed __aligned(8); 20 + 21 + #endif /* _BCACHEFS_DISK_GROUPS_FORMAT_H */
+1 -1
fs/bcachefs/ec.c
··· 908 908 if (!genradix_ptr_alloc(&c->stripes, idx, gfp)) 909 909 return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc; 910 910 911 - if (c->gc_pos.phase != GC_PHASE_NOT_RUNNING && 911 + if (c->gc_pos.phase != GC_PHASE_not_running && 912 912 !genradix_ptr_alloc(&c->gc_stripes, idx, gfp)) 913 913 return -BCH_ERR_ENOMEM_ec_stripe_mem_alloc; 914 914
+3 -3
fs/bcachefs/fs-io-buffered.c
··· 437 437 */ 438 438 439 439 /* 440 - * PageWriteback is effectively our ref on the inode - fixup i_blocks 441 - * before calling end_page_writeback: 440 + * The writeback flag is effectively our ref on the inode - 441 + * fixup i_blocks before calling folio_end_writeback: 442 442 */ 443 443 bch2_i_sectors_acct(c, io->inode, NULL, io->op.i_sectors_delta); 444 444 ··· 898 898 darray_for_each(fs, fi) { 899 899 f = *fi; 900 900 f_len = min(end, folio_end_pos(f)) - f_pos; 901 - f_copied = copy_page_from_iter_atomic(&f->page, f_offset, f_len, iter); 901 + f_copied = copy_folio_from_iter_atomic(f, f_offset, f_len, iter); 902 902 if (!f_copied) { 903 903 folios_trunc(&fs, fi); 904 904 break;
+3 -1
fs/bcachefs/fs-io-direct.c
··· 609 609 if (unlikely(ret)) 610 610 goto err_put_write_ref; 611 611 612 - if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) 612 + if (unlikely((req->ki_pos|iter->count) & (block_bytes(c) - 1))) { 613 + ret = -EINVAL; 613 614 goto err_put_write_ref; 615 + } 614 616 615 617 inode_dio_begin(&inode->v); 616 618 bch2_pagecache_block_get(inode);
+10 -2
fs/bcachefs/fs.c
··· 1939 1939 1940 1940 if (IS_ERR(sb)) { 1941 1941 ret = PTR_ERR(sb); 1942 - ret = bch2_err_class(ret); 1943 - return ERR_PTR(ret); 1942 + goto err; 1944 1943 } 1945 1944 1946 1945 c = sb->s_fs_info; ··· 2015 2016 err_put_super: 2016 2017 __bch2_fs_stop(c); 2017 2018 deactivate_locked_super(sb); 2019 + err: 2020 + /* 2021 + * On an inconsistency error in recovery we might see an -EROFS derived 2022 + * errorcode (from the journal), but we don't want to return that to 2023 + * userspace as that causes util-linux to retry the mount RO - which is 2024 + * confusing: 2025 + */ 2026 + if (bch2_err_matches(ret, EROFS) && ret != -EROFS) 2027 + ret = -EIO; 2018 2028 return ERR_PTR(bch2_err_class(ret)); 2019 2029 } 2020 2030
+14 -37
fs/bcachefs/fsck.c
··· 77 77 struct bkey_s_c k; 78 78 int ret; 79 79 80 - bch2_trans_iter_init(trans, &iter, BTREE_ID_inodes, 81 - POS(0, inode_nr), 82 - BTREE_ITER_all_snapshots); 83 - k = bch2_btree_iter_peek(&iter); 84 - ret = bkey_err(k); 85 - if (ret) 86 - goto err; 87 - 88 - if (!k.k || !bkey_eq(k.k->p, POS(0, inode_nr))) { 89 - ret = -BCH_ERR_ENOENT_inode; 90 - goto err; 80 + for_each_btree_key_norestart(trans, iter, BTREE_ID_inodes, POS(0, inode_nr), 81 + BTREE_ITER_all_snapshots, k, ret) { 82 + if (k.k->p.offset != inode_nr) 83 + break; 84 + if (!bkey_is_inode(k.k)) 85 + continue; 86 + ret = bch2_inode_unpack(k, inode); 87 + goto found; 91 88 } 92 - 93 - ret = bch2_inode_unpack(k, inode); 94 - err: 89 + ret = -BCH_ERR_ENOENT_inode; 90 + found: 95 91 bch_err_msg(trans->c, ret, "fetching inode %llu", inode_nr); 96 92 bch2_trans_iter_exit(trans, &iter); 97 93 return ret; ··· 766 770 return ret; 767 771 } 768 772 769 - static int check_key_has_snapshot(struct btree_trans *trans, 770 - struct btree_iter *iter, 771 - struct bkey_s_c k) 772 - { 773 - struct bch_fs *c = trans->c; 774 - struct printbuf buf = PRINTBUF; 775 - int ret = 0; 776 - 777 - if (mustfix_fsck_err_on(!bch2_snapshot_equiv(c, k.k->p.snapshot), c, 778 - bkey_in_missing_snapshot, 779 - "key in missing snapshot: %s", 780 - (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) 781 - ret = bch2_btree_delete_at(trans, iter, 782 - BTREE_UPDATE_internal_snapshot_node) ?: 1; 783 - fsck_err: 784 - printbuf_exit(&buf); 785 - return ret; 786 - } 787 - 788 773 static int hash_redo_key(struct btree_trans *trans, 789 774 const struct bch_hash_desc desc, 790 775 struct bch_hash_info *hash_info, ··· 960 983 bool do_update = false; 961 984 int ret; 962 985 963 - ret = check_key_has_snapshot(trans, iter, k); 986 + ret = bch2_check_key_has_snapshot(trans, iter, k); 964 987 if (ret < 0) 965 988 goto err; 966 989 if (ret) ··· 1464 1487 struct printbuf buf = PRINTBUF; 1465 1488 int ret = 0; 1466 1489 1467 - ret = check_key_has_snapshot(trans, iter, k); 1490 + ret = bch2_check_key_has_snapshot(trans, iter, k); 1468 1491 if (ret) { 1469 1492 ret = ret < 0 ? ret : 0; 1470 1493 goto out; ··· 1987 2010 struct printbuf buf = PRINTBUF; 1988 2011 int ret = 0; 1989 2012 1990 - ret = check_key_has_snapshot(trans, iter, k); 2013 + ret = bch2_check_key_has_snapshot(trans, iter, k); 1991 2014 if (ret) { 1992 2015 ret = ret < 0 ? ret : 0; 1993 2016 goto out; ··· 2142 2165 struct inode_walker_entry *i; 2143 2166 int ret; 2144 2167 2145 - ret = check_key_has_snapshot(trans, iter, k); 2168 + ret = bch2_check_key_has_snapshot(trans, iter, k); 2146 2169 if (ret < 0) 2147 2170 return ret; 2148 2171 if (ret)
+15
fs/bcachefs/journal_seq_blacklist_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_JOURNAL_SEQ_BLACKLIST_FORMAT_H 3 + #define _BCACHEFS_JOURNAL_SEQ_BLACKLIST_FORMAT_H 4 + 5 + struct journal_seq_blacklist_entry { 6 + __le64 start; 7 + __le64 end; 8 + }; 9 + 10 + struct bch_sb_field_journal_seq_blacklist { 11 + struct bch_sb_field field; 12 + struct journal_seq_blacklist_entry start[]; 13 + }; 14 + 15 + #endif /* _BCACHEFS_JOURNAL_SEQ_BLACKLIST_FORMAT_H */
+1
fs/bcachefs/mean_and_variance_test.c
··· 217 217 kunit_test_suite(mean_and_variance_test_suite); 218 218 219 219 MODULE_AUTHOR("Daniel B. Hill"); 220 + MODULE_DESCRIPTION("bcachefs filesystem mean and variance unit tests"); 220 221 MODULE_LICENSE("GPL");
+31
fs/bcachefs/replicas_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_REPLICAS_FORMAT_H 3 + #define _BCACHEFS_REPLICAS_FORMAT_H 4 + 5 + struct bch_replicas_entry_v0 { 6 + __u8 data_type; 7 + __u8 nr_devs; 8 + __u8 devs[]; 9 + } __packed; 10 + 11 + struct bch_sb_field_replicas_v0 { 12 + struct bch_sb_field field; 13 + struct bch_replicas_entry_v0 entries[]; 14 + } __packed __aligned(8); 15 + 16 + struct bch_replicas_entry_v1 { 17 + __u8 data_type; 18 + __u8 nr_devs; 19 + __u8 nr_required; 20 + __u8 devs[]; 21 + } __packed; 22 + 23 + struct bch_sb_field_replicas { 24 + struct bch_sb_field field; 25 + struct bch_replicas_entry_v1 entries[]; 26 + } __packed __aligned(8); 27 + 28 + #define replicas_entry_bytes(_i) \ 29 + (offsetof(typeof(*(_i)), devs) + (_i)->nr_devs) 30 + 31 + #endif /* _BCACHEFS_REPLICAS_FORMAT_H */
+10 -3
fs/bcachefs/sb-downgrade.c
··· 146 146 for (const struct bch_sb_field_downgrade_entry *i = e->entries; 147 147 (void *) i < vstruct_end(&e->field); 148 148 i = downgrade_entry_next_c(i)) { 149 + /* 150 + * Careful: sb_field_downgrade_entry is only 2 byte aligned, but 151 + * section sizes are 8 byte aligned - an empty entry spanning 152 + * the end of the section is allowed (and ignored): 153 + */ 154 + if ((void *) &i->errors[0] > vstruct_end(&e->field)) 155 + break; 156 + 149 157 if (flags & BCH_VALIDATE_write && 150 - ((void *) &i->errors[0] > vstruct_end(&e->field) || 151 - (void *) downgrade_entry_next_c(i) > vstruct_end(&e->field))) { 152 - prt_printf(err, "downgrade entry overruns end of superblock section)"); 158 + (void *) downgrade_entry_next_c(i) > vstruct_end(&e->field)) { 159 + prt_printf(err, "downgrade entry overruns end of superblock section"); 153 160 return -BCH_ERR_invalid_sb_downgrade; 154 161 } 155 162
+17
fs/bcachefs/sb-downgrade_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_SB_DOWNGRADE_FORMAT_H 3 + #define _BCACHEFS_SB_DOWNGRADE_FORMAT_H 4 + 5 + struct bch_sb_field_downgrade_entry { 6 + __le16 version; 7 + __le64 recovery_passes[2]; 8 + __le16 nr_errors; 9 + __le16 errors[] __counted_by(nr_errors); 10 + } __packed __aligned(2); 11 + 12 + struct bch_sb_field_downgrade { 13 + struct bch_sb_field field; 14 + struct bch_sb_field_downgrade_entry entries[]; 15 + }; 16 + 17 + #endif /* _BCACHEFS_SB_DOWNGRADE_FORMAT_H */
+296
fs/bcachefs/sb-errors_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_SB_ERRORS_FORMAT_H 3 + #define _BCACHEFS_SB_ERRORS_FORMAT_H 4 + 5 + #define BCH_SB_ERRS() \ 6 + x(clean_but_journal_not_empty, 0) \ 7 + x(dirty_but_no_journal_entries, 1) \ 8 + x(dirty_but_no_journal_entries_post_drop_nonflushes, 2) \ 9 + x(sb_clean_journal_seq_mismatch, 3) \ 10 + x(sb_clean_btree_root_mismatch, 4) \ 11 + x(sb_clean_missing, 5) \ 12 + x(jset_unsupported_version, 6) \ 13 + x(jset_unknown_csum, 7) \ 14 + x(jset_last_seq_newer_than_seq, 8) \ 15 + x(jset_past_bucket_end, 9) \ 16 + x(jset_seq_blacklisted, 10) \ 17 + x(journal_entries_missing, 11) \ 18 + x(journal_entry_replicas_not_marked, 12) \ 19 + x(journal_entry_past_jset_end, 13) \ 20 + x(journal_entry_replicas_data_mismatch, 14) \ 21 + x(journal_entry_bkey_u64s_0, 15) \ 22 + x(journal_entry_bkey_past_end, 16) \ 23 + x(journal_entry_bkey_bad_format, 17) \ 24 + x(journal_entry_bkey_invalid, 18) \ 25 + x(journal_entry_btree_root_bad_size, 19) \ 26 + x(journal_entry_blacklist_bad_size, 20) \ 27 + x(journal_entry_blacklist_v2_bad_size, 21) \ 28 + x(journal_entry_blacklist_v2_start_past_end, 22) \ 29 + x(journal_entry_usage_bad_size, 23) \ 30 + x(journal_entry_data_usage_bad_size, 24) \ 31 + x(journal_entry_clock_bad_size, 25) \ 32 + x(journal_entry_clock_bad_rw, 26) \ 33 + x(journal_entry_dev_usage_bad_size, 27) \ 34 + x(journal_entry_dev_usage_bad_dev, 28) \ 35 + x(journal_entry_dev_usage_bad_pad, 29) \ 36 + x(btree_node_unreadable, 30) \ 37 + x(btree_node_fault_injected, 31) \ 38 + x(btree_node_bad_magic, 32) \ 39 + x(btree_node_bad_seq, 33) \ 40 + x(btree_node_unsupported_version, 34) \ 41 + x(btree_node_bset_older_than_sb_min, 35) \ 42 + x(btree_node_bset_newer_than_sb, 36) \ 43 + x(btree_node_data_missing, 37) \ 44 + x(btree_node_bset_after_end, 38) \ 45 + x(btree_node_replicas_sectors_written_mismatch, 39) \ 46 + x(btree_node_replicas_data_mismatch, 40) \ 47 + x(bset_unknown_csum, 41) \ 48 + x(bset_bad_csum, 42) \ 49 + x(bset_past_end_of_btree_node, 43) \ 50 + x(bset_wrong_sector_offset, 44) \ 51 + x(bset_empty, 45) \ 52 + x(bset_bad_seq, 46) \ 53 + x(bset_blacklisted_journal_seq, 47) \ 54 + x(first_bset_blacklisted_journal_seq, 48) \ 55 + x(btree_node_bad_btree, 49) \ 56 + x(btree_node_bad_level, 50) \ 57 + x(btree_node_bad_min_key, 51) \ 58 + x(btree_node_bad_max_key, 52) \ 59 + x(btree_node_bad_format, 53) \ 60 + x(btree_node_bkey_past_bset_end, 54) \ 61 + x(btree_node_bkey_bad_format, 55) \ 62 + x(btree_node_bad_bkey, 56) \ 63 + x(btree_node_bkey_out_of_order, 57) \ 64 + x(btree_root_bkey_invalid, 58) \ 65 + x(btree_root_read_error, 59) \ 66 + x(btree_root_bad_min_key, 60) \ 67 + x(btree_root_bad_max_key, 61) \ 68 + x(btree_node_read_error, 62) \ 69 + x(btree_node_topology_bad_min_key, 63) \ 70 + x(btree_node_topology_bad_max_key, 64) \ 71 + x(btree_node_topology_overwritten_by_prev_node, 65) \ 72 + x(btree_node_topology_overwritten_by_next_node, 66) \ 73 + x(btree_node_topology_interior_node_empty, 67) \ 74 + x(fs_usage_hidden_wrong, 68) \ 75 + x(fs_usage_btree_wrong, 69) \ 76 + x(fs_usage_data_wrong, 70) \ 77 + x(fs_usage_cached_wrong, 71) \ 78 + x(fs_usage_reserved_wrong, 72) \ 79 + x(fs_usage_persistent_reserved_wrong, 73) \ 80 + x(fs_usage_nr_inodes_wrong, 74) \ 81 + x(fs_usage_replicas_wrong, 75) \ 82 + x(dev_usage_buckets_wrong, 76) \ 83 + x(dev_usage_sectors_wrong, 77) \ 84 + x(dev_usage_fragmented_wrong, 78) \ 85 + x(dev_usage_buckets_ec_wrong, 79) \ 86 + x(bkey_version_in_future, 80) \ 87 + x(bkey_u64s_too_small, 81) \ 88 + x(bkey_invalid_type_for_btree, 82) \ 89 + x(bkey_extent_size_zero, 83) \ 90 + x(bkey_extent_size_greater_than_offset, 84) \ 91 + x(bkey_size_nonzero, 85) \ 92 + x(bkey_snapshot_nonzero, 86) \ 93 + x(bkey_snapshot_zero, 87) \ 94 + x(bkey_at_pos_max, 88) \ 95 + x(bkey_before_start_of_btree_node, 89) \ 96 + x(bkey_after_end_of_btree_node, 90) \ 97 + x(bkey_val_size_nonzero, 91) \ 98 + x(bkey_val_size_too_small, 92) \ 99 + x(alloc_v1_val_size_bad, 93) \ 100 + x(alloc_v2_unpack_error, 94) \ 101 + x(alloc_v3_unpack_error, 95) \ 102 + x(alloc_v4_val_size_bad, 96) \ 103 + x(alloc_v4_backpointers_start_bad, 97) \ 104 + x(alloc_key_data_type_bad, 98) \ 105 + x(alloc_key_empty_but_have_data, 99) \ 106 + x(alloc_key_dirty_sectors_0, 100) \ 107 + x(alloc_key_data_type_inconsistency, 101) \ 108 + x(alloc_key_to_missing_dev_bucket, 102) \ 109 + x(alloc_key_cached_inconsistency, 103) \ 110 + x(alloc_key_cached_but_read_time_zero, 104) \ 111 + x(alloc_key_to_missing_lru_entry, 105) \ 112 + x(alloc_key_data_type_wrong, 106) \ 113 + x(alloc_key_gen_wrong, 107) \ 114 + x(alloc_key_dirty_sectors_wrong, 108) \ 115 + x(alloc_key_cached_sectors_wrong, 109) \ 116 + x(alloc_key_stripe_wrong, 110) \ 117 + x(alloc_key_stripe_redundancy_wrong, 111) \ 118 + x(bucket_sector_count_overflow, 112) \ 119 + x(bucket_metadata_type_mismatch, 113) \ 120 + x(need_discard_key_wrong, 114) \ 121 + x(freespace_key_wrong, 115) \ 122 + x(freespace_hole_missing, 116) \ 123 + x(bucket_gens_val_size_bad, 117) \ 124 + x(bucket_gens_key_wrong, 118) \ 125 + x(bucket_gens_hole_wrong, 119) \ 126 + x(bucket_gens_to_invalid_dev, 120) \ 127 + x(bucket_gens_to_invalid_buckets, 121) \ 128 + x(bucket_gens_nonzero_for_invalid_buckets, 122) \ 129 + x(need_discard_freespace_key_to_invalid_dev_bucket, 123) \ 130 + x(need_discard_freespace_key_bad, 124) \ 131 + x(backpointer_bucket_offset_wrong, 125) \ 132 + x(backpointer_to_missing_device, 126) \ 133 + x(backpointer_to_missing_alloc, 127) \ 134 + x(backpointer_to_missing_ptr, 128) \ 135 + x(lru_entry_at_time_0, 129) \ 136 + x(lru_entry_to_invalid_bucket, 130) \ 137 + x(lru_entry_bad, 131) \ 138 + x(btree_ptr_val_too_big, 132) \ 139 + x(btree_ptr_v2_val_too_big, 133) \ 140 + x(btree_ptr_has_non_ptr, 134) \ 141 + x(extent_ptrs_invalid_entry, 135) \ 142 + x(extent_ptrs_no_ptrs, 136) \ 143 + x(extent_ptrs_too_many_ptrs, 137) \ 144 + x(extent_ptrs_redundant_crc, 138) \ 145 + x(extent_ptrs_redundant_stripe, 139) \ 146 + x(extent_ptrs_unwritten, 140) \ 147 + x(extent_ptrs_written_and_unwritten, 141) \ 148 + x(ptr_to_invalid_device, 142) \ 149 + x(ptr_to_duplicate_device, 143) \ 150 + x(ptr_after_last_bucket, 144) \ 151 + x(ptr_before_first_bucket, 145) \ 152 + x(ptr_spans_multiple_buckets, 146) \ 153 + x(ptr_to_missing_backpointer, 147) \ 154 + x(ptr_to_missing_alloc_key, 148) \ 155 + x(ptr_to_missing_replicas_entry, 149) \ 156 + x(ptr_to_missing_stripe, 150) \ 157 + x(ptr_to_incorrect_stripe, 151) \ 158 + x(ptr_gen_newer_than_bucket_gen, 152) \ 159 + x(ptr_too_stale, 153) \ 160 + x(stale_dirty_ptr, 154) \ 161 + x(ptr_bucket_data_type_mismatch, 155) \ 162 + x(ptr_cached_and_erasure_coded, 156) \ 163 + x(ptr_crc_uncompressed_size_too_small, 157) \ 164 + x(ptr_crc_csum_type_unknown, 158) \ 165 + x(ptr_crc_compression_type_unknown, 159) \ 166 + x(ptr_crc_redundant, 160) \ 167 + x(ptr_crc_uncompressed_size_too_big, 161) \ 168 + x(ptr_crc_nonce_mismatch, 162) \ 169 + x(ptr_stripe_redundant, 163) \ 170 + x(reservation_key_nr_replicas_invalid, 164) \ 171 + x(reflink_v_refcount_wrong, 165) \ 172 + x(reflink_p_to_missing_reflink_v, 166) \ 173 + x(stripe_pos_bad, 167) \ 174 + x(stripe_val_size_bad, 168) \ 175 + x(stripe_sector_count_wrong, 169) \ 176 + x(snapshot_tree_pos_bad, 170) \ 177 + x(snapshot_tree_to_missing_snapshot, 171) \ 178 + x(snapshot_tree_to_missing_subvol, 172) \ 179 + x(snapshot_tree_to_wrong_subvol, 173) \ 180 + x(snapshot_tree_to_snapshot_subvol, 174) \ 181 + x(snapshot_pos_bad, 175) \ 182 + x(snapshot_parent_bad, 176) \ 183 + x(snapshot_children_not_normalized, 177) \ 184 + x(snapshot_child_duplicate, 178) \ 185 + x(snapshot_child_bad, 179) \ 186 + x(snapshot_skiplist_not_normalized, 180) \ 187 + x(snapshot_skiplist_bad, 181) \ 188 + x(snapshot_should_not_have_subvol, 182) \ 189 + x(snapshot_to_bad_snapshot_tree, 183) \ 190 + x(snapshot_bad_depth, 184) \ 191 + x(snapshot_bad_skiplist, 185) \ 192 + x(subvol_pos_bad, 186) \ 193 + x(subvol_not_master_and_not_snapshot, 187) \ 194 + x(subvol_to_missing_root, 188) \ 195 + x(subvol_root_wrong_bi_subvol, 189) \ 196 + x(bkey_in_missing_snapshot, 190) \ 197 + x(inode_pos_inode_nonzero, 191) \ 198 + x(inode_pos_blockdev_range, 192) \ 199 + x(inode_unpack_error, 193) \ 200 + x(inode_str_hash_invalid, 194) \ 201 + x(inode_v3_fields_start_bad, 195) \ 202 + x(inode_snapshot_mismatch, 196) \ 203 + x(inode_unlinked_but_clean, 197) \ 204 + x(inode_unlinked_but_nlink_nonzero, 198) \ 205 + x(inode_checksum_type_invalid, 199) \ 206 + x(inode_compression_type_invalid, 200) \ 207 + x(inode_subvol_root_but_not_dir, 201) \ 208 + x(inode_i_size_dirty_but_clean, 202) \ 209 + x(inode_i_sectors_dirty_but_clean, 203) \ 210 + x(inode_i_sectors_wrong, 204) \ 211 + x(inode_dir_wrong_nlink, 205) \ 212 + x(inode_dir_multiple_links, 206) \ 213 + x(inode_multiple_links_but_nlink_0, 207) \ 214 + x(inode_wrong_backpointer, 208) \ 215 + x(inode_wrong_nlink, 209) \ 216 + x(inode_unreachable, 210) \ 217 + x(deleted_inode_but_clean, 211) \ 218 + x(deleted_inode_missing, 212) \ 219 + x(deleted_inode_is_dir, 213) \ 220 + x(deleted_inode_not_unlinked, 214) \ 221 + x(extent_overlapping, 215) \ 222 + x(extent_in_missing_inode, 216) \ 223 + x(extent_in_non_reg_inode, 217) \ 224 + x(extent_past_end_of_inode, 218) \ 225 + x(dirent_empty_name, 219) \ 226 + x(dirent_val_too_big, 220) \ 227 + x(dirent_name_too_long, 221) \ 228 + x(dirent_name_embedded_nul, 222) \ 229 + x(dirent_name_dot_or_dotdot, 223) \ 230 + x(dirent_name_has_slash, 224) \ 231 + x(dirent_d_type_wrong, 225) \ 232 + x(inode_bi_parent_wrong, 226) \ 233 + x(dirent_in_missing_dir_inode, 227) \ 234 + x(dirent_in_non_dir_inode, 228) \ 235 + x(dirent_to_missing_inode, 229) \ 236 + x(dirent_to_missing_subvol, 230) \ 237 + x(dirent_to_itself, 231) \ 238 + x(quota_type_invalid, 232) \ 239 + x(xattr_val_size_too_small, 233) \ 240 + x(xattr_val_size_too_big, 234) \ 241 + x(xattr_invalid_type, 235) \ 242 + x(xattr_name_invalid_chars, 236) \ 243 + x(xattr_in_missing_inode, 237) \ 244 + x(root_subvol_missing, 238) \ 245 + x(root_dir_missing, 239) \ 246 + x(root_inode_not_dir, 240) \ 247 + x(dir_loop, 241) \ 248 + x(hash_table_key_duplicate, 242) \ 249 + x(hash_table_key_wrong_offset, 243) \ 250 + x(unlinked_inode_not_on_deleted_list, 244) \ 251 + x(reflink_p_front_pad_bad, 245) \ 252 + x(journal_entry_dup_same_device, 246) \ 253 + x(inode_bi_subvol_missing, 247) \ 254 + x(inode_bi_subvol_wrong, 248) \ 255 + x(inode_points_to_missing_dirent, 249) \ 256 + x(inode_points_to_wrong_dirent, 250) \ 257 + x(inode_bi_parent_nonzero, 251) \ 258 + x(dirent_to_missing_parent_subvol, 252) \ 259 + x(dirent_not_visible_in_parent_subvol, 253) \ 260 + x(subvol_fs_path_parent_wrong, 254) \ 261 + x(subvol_root_fs_path_parent_nonzero, 255) \ 262 + x(subvol_children_not_set, 256) \ 263 + x(subvol_children_bad, 257) \ 264 + x(subvol_loop, 258) \ 265 + x(subvol_unreachable, 259) \ 266 + x(btree_node_bkey_bad_u64s, 260) \ 267 + x(btree_node_topology_empty_interior_node, 261) \ 268 + x(btree_ptr_v2_min_key_bad, 262) \ 269 + x(btree_root_unreadable_and_scan_found_nothing, 263) \ 270 + x(snapshot_node_missing, 264) \ 271 + x(dup_backpointer_to_bad_csum_extent, 265) \ 272 + x(btree_bitmap_not_marked, 266) \ 273 + x(sb_clean_entry_overrun, 267) \ 274 + x(btree_ptr_v2_written_0, 268) \ 275 + x(subvol_snapshot_bad, 269) \ 276 + x(subvol_inode_bad, 270) 277 + 278 + enum bch_sb_error_id { 279 + #define x(t, n) BCH_FSCK_ERR_##t = n, 280 + BCH_SB_ERRS() 281 + #undef x 282 + BCH_SB_ERR_MAX 283 + }; 284 + 285 + struct bch_sb_field_errors { 286 + struct bch_sb_field field; 287 + struct bch_sb_field_error_entry { 288 + __le64 v; 289 + __le64 last_error_time; 290 + } entries[]; 291 + }; 292 + 293 + LE64_BITMASK(BCH_SB_ERROR_ENTRY_ID, struct bch_sb_field_error_entry, v, 0, 16); 294 + LE64_BITMASK(BCH_SB_ERROR_ENTRY_NR, struct bch_sb_field_error_entry, v, 16, 64); 295 + 296 + #endif /* _BCACHEFS_SB_ERRORS_FORMAT_H */
-281
fs/bcachefs/sb-errors_types.h
··· 4 4 5 5 #include "darray.h" 6 6 7 - #define BCH_SB_ERRS() \ 8 - x(clean_but_journal_not_empty, 0) \ 9 - x(dirty_but_no_journal_entries, 1) \ 10 - x(dirty_but_no_journal_entries_post_drop_nonflushes, 2) \ 11 - x(sb_clean_journal_seq_mismatch, 3) \ 12 - x(sb_clean_btree_root_mismatch, 4) \ 13 - x(sb_clean_missing, 5) \ 14 - x(jset_unsupported_version, 6) \ 15 - x(jset_unknown_csum, 7) \ 16 - x(jset_last_seq_newer_than_seq, 8) \ 17 - x(jset_past_bucket_end, 9) \ 18 - x(jset_seq_blacklisted, 10) \ 19 - x(journal_entries_missing, 11) \ 20 - x(journal_entry_replicas_not_marked, 12) \ 21 - x(journal_entry_past_jset_end, 13) \ 22 - x(journal_entry_replicas_data_mismatch, 14) \ 23 - x(journal_entry_bkey_u64s_0, 15) \ 24 - x(journal_entry_bkey_past_end, 16) \ 25 - x(journal_entry_bkey_bad_format, 17) \ 26 - x(journal_entry_bkey_invalid, 18) \ 27 - x(journal_entry_btree_root_bad_size, 19) \ 28 - x(journal_entry_blacklist_bad_size, 20) \ 29 - x(journal_entry_blacklist_v2_bad_size, 21) \ 30 - x(journal_entry_blacklist_v2_start_past_end, 22) \ 31 - x(journal_entry_usage_bad_size, 23) \ 32 - x(journal_entry_data_usage_bad_size, 24) \ 33 - x(journal_entry_clock_bad_size, 25) \ 34 - x(journal_entry_clock_bad_rw, 26) \ 35 - x(journal_entry_dev_usage_bad_size, 27) \ 36 - x(journal_entry_dev_usage_bad_dev, 28) \ 37 - x(journal_entry_dev_usage_bad_pad, 29) \ 38 - x(btree_node_unreadable, 30) \ 39 - x(btree_node_fault_injected, 31) \ 40 - x(btree_node_bad_magic, 32) \ 41 - x(btree_node_bad_seq, 33) \ 42 - x(btree_node_unsupported_version, 34) \ 43 - x(btree_node_bset_older_than_sb_min, 35) \ 44 - x(btree_node_bset_newer_than_sb, 36) \ 45 - x(btree_node_data_missing, 37) \ 46 - x(btree_node_bset_after_end, 38) \ 47 - x(btree_node_replicas_sectors_written_mismatch, 39) \ 48 - x(btree_node_replicas_data_mismatch, 40) \ 49 - x(bset_unknown_csum, 41) \ 50 - x(bset_bad_csum, 42) \ 51 - x(bset_past_end_of_btree_node, 43) \ 52 - x(bset_wrong_sector_offset, 44) \ 53 - x(bset_empty, 45) \ 54 - x(bset_bad_seq, 46) \ 55 - x(bset_blacklisted_journal_seq, 47) \ 56 - x(first_bset_blacklisted_journal_seq, 48) \ 57 - x(btree_node_bad_btree, 49) \ 58 - x(btree_node_bad_level, 50) \ 59 - x(btree_node_bad_min_key, 51) \ 60 - x(btree_node_bad_max_key, 52) \ 61 - x(btree_node_bad_format, 53) \ 62 - x(btree_node_bkey_past_bset_end, 54) \ 63 - x(btree_node_bkey_bad_format, 55) \ 64 - x(btree_node_bad_bkey, 56) \ 65 - x(btree_node_bkey_out_of_order, 57) \ 66 - x(btree_root_bkey_invalid, 58) \ 67 - x(btree_root_read_error, 59) \ 68 - x(btree_root_bad_min_key, 60) \ 69 - x(btree_root_bad_max_key, 61) \ 70 - x(btree_node_read_error, 62) \ 71 - x(btree_node_topology_bad_min_key, 63) \ 72 - x(btree_node_topology_bad_max_key, 64) \ 73 - x(btree_node_topology_overwritten_by_prev_node, 65) \ 74 - x(btree_node_topology_overwritten_by_next_node, 66) \ 75 - x(btree_node_topology_interior_node_empty, 67) \ 76 - x(fs_usage_hidden_wrong, 68) \ 77 - x(fs_usage_btree_wrong, 69) \ 78 - x(fs_usage_data_wrong, 70) \ 79 - x(fs_usage_cached_wrong, 71) \ 80 - x(fs_usage_reserved_wrong, 72) \ 81 - x(fs_usage_persistent_reserved_wrong, 73) \ 82 - x(fs_usage_nr_inodes_wrong, 74) \ 83 - x(fs_usage_replicas_wrong, 75) \ 84 - x(dev_usage_buckets_wrong, 76) \ 85 - x(dev_usage_sectors_wrong, 77) \ 86 - x(dev_usage_fragmented_wrong, 78) \ 87 - x(dev_usage_buckets_ec_wrong, 79) \ 88 - x(bkey_version_in_future, 80) \ 89 - x(bkey_u64s_too_small, 81) \ 90 - x(bkey_invalid_type_for_btree, 82) \ 91 - x(bkey_extent_size_zero, 83) \ 92 - x(bkey_extent_size_greater_than_offset, 84) \ 93 - x(bkey_size_nonzero, 85) \ 94 - x(bkey_snapshot_nonzero, 86) \ 95 - x(bkey_snapshot_zero, 87) \ 96 - x(bkey_at_pos_max, 88) \ 97 - x(bkey_before_start_of_btree_node, 89) \ 98 - x(bkey_after_end_of_btree_node, 90) \ 99 - x(bkey_val_size_nonzero, 91) \ 100 - x(bkey_val_size_too_small, 92) \ 101 - x(alloc_v1_val_size_bad, 93) \ 102 - x(alloc_v2_unpack_error, 94) \ 103 - x(alloc_v3_unpack_error, 95) \ 104 - x(alloc_v4_val_size_bad, 96) \ 105 - x(alloc_v4_backpointers_start_bad, 97) \ 106 - x(alloc_key_data_type_bad, 98) \ 107 - x(alloc_key_empty_but_have_data, 99) \ 108 - x(alloc_key_dirty_sectors_0, 100) \ 109 - x(alloc_key_data_type_inconsistency, 101) \ 110 - x(alloc_key_to_missing_dev_bucket, 102) \ 111 - x(alloc_key_cached_inconsistency, 103) \ 112 - x(alloc_key_cached_but_read_time_zero, 104) \ 113 - x(alloc_key_to_missing_lru_entry, 105) \ 114 - x(alloc_key_data_type_wrong, 106) \ 115 - x(alloc_key_gen_wrong, 107) \ 116 - x(alloc_key_dirty_sectors_wrong, 108) \ 117 - x(alloc_key_cached_sectors_wrong, 109) \ 118 - x(alloc_key_stripe_wrong, 110) \ 119 - x(alloc_key_stripe_redundancy_wrong, 111) \ 120 - x(bucket_sector_count_overflow, 112) \ 121 - x(bucket_metadata_type_mismatch, 113) \ 122 - x(need_discard_key_wrong, 114) \ 123 - x(freespace_key_wrong, 115) \ 124 - x(freespace_hole_missing, 116) \ 125 - x(bucket_gens_val_size_bad, 117) \ 126 - x(bucket_gens_key_wrong, 118) \ 127 - x(bucket_gens_hole_wrong, 119) \ 128 - x(bucket_gens_to_invalid_dev, 120) \ 129 - x(bucket_gens_to_invalid_buckets, 121) \ 130 - x(bucket_gens_nonzero_for_invalid_buckets, 122) \ 131 - x(need_discard_freespace_key_to_invalid_dev_bucket, 123) \ 132 - x(need_discard_freespace_key_bad, 124) \ 133 - x(backpointer_bucket_offset_wrong, 125) \ 134 - x(backpointer_to_missing_device, 126) \ 135 - x(backpointer_to_missing_alloc, 127) \ 136 - x(backpointer_to_missing_ptr, 128) \ 137 - x(lru_entry_at_time_0, 129) \ 138 - x(lru_entry_to_invalid_bucket, 130) \ 139 - x(lru_entry_bad, 131) \ 140 - x(btree_ptr_val_too_big, 132) \ 141 - x(btree_ptr_v2_val_too_big, 133) \ 142 - x(btree_ptr_has_non_ptr, 134) \ 143 - x(extent_ptrs_invalid_entry, 135) \ 144 - x(extent_ptrs_no_ptrs, 136) \ 145 - x(extent_ptrs_too_many_ptrs, 137) \ 146 - x(extent_ptrs_redundant_crc, 138) \ 147 - x(extent_ptrs_redundant_stripe, 139) \ 148 - x(extent_ptrs_unwritten, 140) \ 149 - x(extent_ptrs_written_and_unwritten, 141) \ 150 - x(ptr_to_invalid_device, 142) \ 151 - x(ptr_to_duplicate_device, 143) \ 152 - x(ptr_after_last_bucket, 144) \ 153 - x(ptr_before_first_bucket, 145) \ 154 - x(ptr_spans_multiple_buckets, 146) \ 155 - x(ptr_to_missing_backpointer, 147) \ 156 - x(ptr_to_missing_alloc_key, 148) \ 157 - x(ptr_to_missing_replicas_entry, 149) \ 158 - x(ptr_to_missing_stripe, 150) \ 159 - x(ptr_to_incorrect_stripe, 151) \ 160 - x(ptr_gen_newer_than_bucket_gen, 152) \ 161 - x(ptr_too_stale, 153) \ 162 - x(stale_dirty_ptr, 154) \ 163 - x(ptr_bucket_data_type_mismatch, 155) \ 164 - x(ptr_cached_and_erasure_coded, 156) \ 165 - x(ptr_crc_uncompressed_size_too_small, 157) \ 166 - x(ptr_crc_csum_type_unknown, 158) \ 167 - x(ptr_crc_compression_type_unknown, 159) \ 168 - x(ptr_crc_redundant, 160) \ 169 - x(ptr_crc_uncompressed_size_too_big, 161) \ 170 - x(ptr_crc_nonce_mismatch, 162) \ 171 - x(ptr_stripe_redundant, 163) \ 172 - x(reservation_key_nr_replicas_invalid, 164) \ 173 - x(reflink_v_refcount_wrong, 165) \ 174 - x(reflink_p_to_missing_reflink_v, 166) \ 175 - x(stripe_pos_bad, 167) \ 176 - x(stripe_val_size_bad, 168) \ 177 - x(stripe_sector_count_wrong, 169) \ 178 - x(snapshot_tree_pos_bad, 170) \ 179 - x(snapshot_tree_to_missing_snapshot, 171) \ 180 - x(snapshot_tree_to_missing_subvol, 172) \ 181 - x(snapshot_tree_to_wrong_subvol, 173) \ 182 - x(snapshot_tree_to_snapshot_subvol, 174) \ 183 - x(snapshot_pos_bad, 175) \ 184 - x(snapshot_parent_bad, 176) \ 185 - x(snapshot_children_not_normalized, 177) \ 186 - x(snapshot_child_duplicate, 178) \ 187 - x(snapshot_child_bad, 179) \ 188 - x(snapshot_skiplist_not_normalized, 180) \ 189 - x(snapshot_skiplist_bad, 181) \ 190 - x(snapshot_should_not_have_subvol, 182) \ 191 - x(snapshot_to_bad_snapshot_tree, 183) \ 192 - x(snapshot_bad_depth, 184) \ 193 - x(snapshot_bad_skiplist, 185) \ 194 - x(subvol_pos_bad, 186) \ 195 - x(subvol_not_master_and_not_snapshot, 187) \ 196 - x(subvol_to_missing_root, 188) \ 197 - x(subvol_root_wrong_bi_subvol, 189) \ 198 - x(bkey_in_missing_snapshot, 190) \ 199 - x(inode_pos_inode_nonzero, 191) \ 200 - x(inode_pos_blockdev_range, 192) \ 201 - x(inode_unpack_error, 193) \ 202 - x(inode_str_hash_invalid, 194) \ 203 - x(inode_v3_fields_start_bad, 195) \ 204 - x(inode_snapshot_mismatch, 196) \ 205 - x(inode_unlinked_but_clean, 197) \ 206 - x(inode_unlinked_but_nlink_nonzero, 198) \ 207 - x(inode_checksum_type_invalid, 199) \ 208 - x(inode_compression_type_invalid, 200) \ 209 - x(inode_subvol_root_but_not_dir, 201) \ 210 - x(inode_i_size_dirty_but_clean, 202) \ 211 - x(inode_i_sectors_dirty_but_clean, 203) \ 212 - x(inode_i_sectors_wrong, 204) \ 213 - x(inode_dir_wrong_nlink, 205) \ 214 - x(inode_dir_multiple_links, 206) \ 215 - x(inode_multiple_links_but_nlink_0, 207) \ 216 - x(inode_wrong_backpointer, 208) \ 217 - x(inode_wrong_nlink, 209) \ 218 - x(inode_unreachable, 210) \ 219 - x(deleted_inode_but_clean, 211) \ 220 - x(deleted_inode_missing, 212) \ 221 - x(deleted_inode_is_dir, 213) \ 222 - x(deleted_inode_not_unlinked, 214) \ 223 - x(extent_overlapping, 215) \ 224 - x(extent_in_missing_inode, 216) \ 225 - x(extent_in_non_reg_inode, 217) \ 226 - x(extent_past_end_of_inode, 218) \ 227 - x(dirent_empty_name, 219) \ 228 - x(dirent_val_too_big, 220) \ 229 - x(dirent_name_too_long, 221) \ 230 - x(dirent_name_embedded_nul, 222) \ 231 - x(dirent_name_dot_or_dotdot, 223) \ 232 - x(dirent_name_has_slash, 224) \ 233 - x(dirent_d_type_wrong, 225) \ 234 - x(inode_bi_parent_wrong, 226) \ 235 - x(dirent_in_missing_dir_inode, 227) \ 236 - x(dirent_in_non_dir_inode, 228) \ 237 - x(dirent_to_missing_inode, 229) \ 238 - x(dirent_to_missing_subvol, 230) \ 239 - x(dirent_to_itself, 231) \ 240 - x(quota_type_invalid, 232) \ 241 - x(xattr_val_size_too_small, 233) \ 242 - x(xattr_val_size_too_big, 234) \ 243 - x(xattr_invalid_type, 235) \ 244 - x(xattr_name_invalid_chars, 236) \ 245 - x(xattr_in_missing_inode, 237) \ 246 - x(root_subvol_missing, 238) \ 247 - x(root_dir_missing, 239) \ 248 - x(root_inode_not_dir, 240) \ 249 - x(dir_loop, 241) \ 250 - x(hash_table_key_duplicate, 242) \ 251 - x(hash_table_key_wrong_offset, 243) \ 252 - x(unlinked_inode_not_on_deleted_list, 244) \ 253 - x(reflink_p_front_pad_bad, 245) \ 254 - x(journal_entry_dup_same_device, 246) \ 255 - x(inode_bi_subvol_missing, 247) \ 256 - x(inode_bi_subvol_wrong, 248) \ 257 - x(inode_points_to_missing_dirent, 249) \ 258 - x(inode_points_to_wrong_dirent, 250) \ 259 - x(inode_bi_parent_nonzero, 251) \ 260 - x(dirent_to_missing_parent_subvol, 252) \ 261 - x(dirent_not_visible_in_parent_subvol, 253) \ 262 - x(subvol_fs_path_parent_wrong, 254) \ 263 - x(subvol_root_fs_path_parent_nonzero, 255) \ 264 - x(subvol_children_not_set, 256) \ 265 - x(subvol_children_bad, 257) \ 266 - x(subvol_loop, 258) \ 267 - x(subvol_unreachable, 259) \ 268 - x(btree_node_bkey_bad_u64s, 260) \ 269 - x(btree_node_topology_empty_interior_node, 261) \ 270 - x(btree_ptr_v2_min_key_bad, 262) \ 271 - x(btree_root_unreadable_and_scan_found_nothing, 263) \ 272 - x(snapshot_node_missing, 264) \ 273 - x(dup_backpointer_to_bad_csum_extent, 265) \ 274 - x(btree_bitmap_not_marked, 266) \ 275 - x(sb_clean_entry_overrun, 267) \ 276 - x(btree_ptr_v2_written_0, 268) \ 277 - x(subvol_snapshot_bad, 269) \ 278 - x(subvol_inode_bad, 270) 279 - 280 - enum bch_sb_error_id { 281 - #define x(t, n) BCH_FSCK_ERR_##t = n, 282 - BCH_SB_ERRS() 283 - #undef x 284 - BCH_SB_ERR_MAX 285 - }; 286 - 287 7 struct bch_sb_error_entry_cpu { 288 8 u64 id:16, 289 9 nr:48; ··· 13 293 typedef DARRAY(struct bch_sb_error_entry_cpu) bch_sb_errors_cpu; 14 294 15 295 #endif /* _BCACHEFS_SB_ERRORS_TYPES_H */ 16 -
+110
fs/bcachefs/sb-members_format.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef _BCACHEFS_SB_MEMBERS_FORMAT_H 3 + #define _BCACHEFS_SB_MEMBERS_FORMAT_H 4 + 5 + /* 6 + * We refer to members with bitmasks in various places - but we need to get rid 7 + * of this limit: 8 + */ 9 + #define BCH_SB_MEMBERS_MAX 64 10 + 11 + #define BCH_MIN_NR_NBUCKETS (1 << 6) 12 + 13 + #define BCH_IOPS_MEASUREMENTS() \ 14 + x(seqread, 0) \ 15 + x(seqwrite, 1) \ 16 + x(randread, 2) \ 17 + x(randwrite, 3) 18 + 19 + enum bch_iops_measurement { 20 + #define x(t, n) BCH_IOPS_##t = n, 21 + BCH_IOPS_MEASUREMENTS() 22 + #undef x 23 + BCH_IOPS_NR 24 + }; 25 + 26 + #define BCH_MEMBER_ERROR_TYPES() \ 27 + x(read, 0) \ 28 + x(write, 1) \ 29 + x(checksum, 2) 30 + 31 + enum bch_member_error_type { 32 + #define x(t, n) BCH_MEMBER_ERROR_##t = n, 33 + BCH_MEMBER_ERROR_TYPES() 34 + #undef x 35 + BCH_MEMBER_ERROR_NR 36 + }; 37 + 38 + struct bch_member { 39 + __uuid_t uuid; 40 + __le64 nbuckets; /* device size */ 41 + __le16 first_bucket; /* index of first bucket used */ 42 + __le16 bucket_size; /* sectors */ 43 + __u8 btree_bitmap_shift; 44 + __u8 pad[3]; 45 + __le64 last_mount; /* time_t */ 46 + 47 + __le64 flags; 48 + __le32 iops[4]; 49 + __le64 errors[BCH_MEMBER_ERROR_NR]; 50 + __le64 errors_at_reset[BCH_MEMBER_ERROR_NR]; 51 + __le64 errors_reset_time; 52 + __le64 seq; 53 + __le64 btree_allocated_bitmap; 54 + /* 55 + * On recovery from a clean shutdown we don't normally read the journal, 56 + * but we still want to resume writing from where we left off so we 57 + * don't overwrite more than is necessary, for list journal debugging: 58 + */ 59 + __le32 last_journal_bucket; 60 + __le32 last_journal_bucket_offset; 61 + }; 62 + 63 + /* 64 + * This limit comes from the bucket_gens array - it's a single allocation, and 65 + * kernel allocation are limited to INT_MAX 66 + */ 67 + #define BCH_MEMBER_NBUCKETS_MAX (INT_MAX - 64) 68 + 69 + #define BCH_MEMBER_V1_BYTES 56 70 + 71 + LE64_BITMASK(BCH_MEMBER_STATE, struct bch_member, flags, 0, 4) 72 + /* 4-14 unused, was TIER, HAS_(META)DATA, REPLACEMENT */ 73 + LE64_BITMASK(BCH_MEMBER_DISCARD, struct bch_member, flags, 14, 15) 74 + LE64_BITMASK(BCH_MEMBER_DATA_ALLOWED, struct bch_member, flags, 15, 20) 75 + LE64_BITMASK(BCH_MEMBER_GROUP, struct bch_member, flags, 20, 28) 76 + LE64_BITMASK(BCH_MEMBER_DURABILITY, struct bch_member, flags, 28, 30) 77 + LE64_BITMASK(BCH_MEMBER_FREESPACE_INITIALIZED, 78 + struct bch_member, flags, 30, 31) 79 + 80 + #if 0 81 + LE64_BITMASK(BCH_MEMBER_NR_READ_ERRORS, struct bch_member, flags[1], 0, 20); 82 + LE64_BITMASK(BCH_MEMBER_NR_WRITE_ERRORS,struct bch_member, flags[1], 20, 40); 83 + #endif 84 + 85 + #define BCH_MEMBER_STATES() \ 86 + x(rw, 0) \ 87 + x(ro, 1) \ 88 + x(failed, 2) \ 89 + x(spare, 3) 90 + 91 + enum bch_member_state { 92 + #define x(t, n) BCH_MEMBER_STATE_##t = n, 93 + BCH_MEMBER_STATES() 94 + #undef x 95 + BCH_MEMBER_STATE_NR 96 + }; 97 + 98 + struct bch_sb_field_members_v1 { 99 + struct bch_sb_field field; 100 + struct bch_member _members[]; //Members are now variable size 101 + }; 102 + 103 + struct bch_sb_field_members_v2 { 104 + struct bch_sb_field field; 105 + __le16 member_bytes; //size of single member entry 106 + u8 pad[6]; 107 + struct bch_member _members[]; 108 + }; 109 + 110 + #endif /* _BCACHEFS_SB_MEMBERS_FORMAT_H */
+48 -40
fs/bcachefs/snapshot.c
··· 1042 1042 return ret; 1043 1043 } 1044 1044 1045 + int bch2_check_key_has_snapshot(struct btree_trans *trans, 1046 + struct btree_iter *iter, 1047 + struct bkey_s_c k) 1048 + { 1049 + struct bch_fs *c = trans->c; 1050 + struct printbuf buf = PRINTBUF; 1051 + int ret = 0; 1052 + 1053 + if (fsck_err_on(!bch2_snapshot_equiv(c, k.k->p.snapshot), c, 1054 + bkey_in_missing_snapshot, 1055 + "key in missing snapshot %s, delete?", 1056 + (bch2_bkey_val_to_text(&buf, c, k), buf.buf))) 1057 + ret = bch2_btree_delete_at(trans, iter, 1058 + BTREE_UPDATE_internal_snapshot_node) ?: 1; 1059 + fsck_err: 1060 + printbuf_exit(&buf); 1061 + return ret; 1062 + } 1063 + 1045 1064 /* 1046 1065 * Mark a snapshot as deleted, for future cleanup: 1047 1066 */ ··· 1370 1351 * that key to snapshot leaf nodes, where we can mutate it 1371 1352 */ 1372 1353 1373 - static int snapshot_delete_key(struct btree_trans *trans, 1354 + static int delete_dead_snapshots_process_key(struct btree_trans *trans, 1374 1355 struct btree_iter *iter, 1375 1356 struct bkey_s_c k, 1376 1357 snapshot_id_list *deleted, 1377 1358 snapshot_id_list *equiv_seen, 1378 1359 struct bpos *last_pos) 1379 1360 { 1361 + int ret = bch2_check_key_has_snapshot(trans, iter, k); 1362 + if (ret) 1363 + return ret < 0 ? ret : 0; 1364 + 1380 1365 struct bch_fs *c = trans->c; 1381 1366 u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); 1367 + if (!equiv) /* key for invalid snapshot node, but we chose not to delete */ 1368 + return 0; 1382 1369 1383 1370 if (!bkey_eq(k.k->p, *last_pos)) 1384 1371 equiv_seen->nr = 0; 1385 - *last_pos = k.k->p; 1386 1372 1387 - if (snapshot_list_has_id(deleted, k.k->p.snapshot) || 1388 - snapshot_list_has_id(equiv_seen, equiv)) { 1373 + if (snapshot_list_has_id(deleted, k.k->p.snapshot)) 1389 1374 return bch2_btree_delete_at(trans, iter, 1390 1375 BTREE_UPDATE_internal_snapshot_node); 1391 - } else { 1392 - return snapshot_list_add(c, equiv_seen, equiv); 1393 - } 1394 - } 1395 1376 1396 - static int move_key_to_correct_snapshot(struct btree_trans *trans, 1397 - struct btree_iter *iter, 1398 - struct bkey_s_c k) 1399 - { 1400 - struct bch_fs *c = trans->c; 1401 - u32 equiv = bch2_snapshot_equiv(c, k.k->p.snapshot); 1377 + if (!bpos_eq(*last_pos, k.k->p) && 1378 + snapshot_list_has_id(equiv_seen, equiv)) 1379 + return bch2_btree_delete_at(trans, iter, 1380 + BTREE_UPDATE_internal_snapshot_node); 1381 + 1382 + *last_pos = k.k->p; 1383 + 1384 + ret = snapshot_list_add_nodup(c, equiv_seen, equiv); 1385 + if (ret) 1386 + return ret; 1402 1387 1403 1388 /* 1404 1389 * When we have a linear chain of snapshot nodes, we consider ··· 1412 1389 * 1413 1390 * If there are multiple keys in different snapshots at the same 1414 1391 * position, we're only going to keep the one in the newest 1415 - * snapshot - the rest have been overwritten and are redundant, 1416 - * and for the key we're going to keep we need to move it to the 1417 - * equivalance class ID if it's not there already. 1392 + * snapshot (we delete the others above) - the rest have been 1393 + * overwritten and are redundant, and for the key we're going to keep we 1394 + * need to move it to the equivalance class ID if it's not there 1395 + * already. 1418 1396 */ 1419 1397 if (equiv != k.k->p.snapshot) { 1420 1398 struct bkey_i *new = bch2_bkey_make_mut_noupdate(trans, k); 1421 - struct btree_iter new_iter; 1422 - int ret; 1423 - 1424 - ret = PTR_ERR_OR_ZERO(new); 1399 + int ret = PTR_ERR_OR_ZERO(new); 1425 1400 if (ret) 1426 1401 return ret; 1427 1402 1428 1403 new->k.p.snapshot = equiv; 1429 1404 1405 + struct btree_iter new_iter; 1430 1406 bch2_trans_iter_init(trans, &new_iter, iter->btree_id, new->k.p, 1431 1407 BTREE_ITER_all_snapshots| 1432 1408 BTREE_ITER_cached| ··· 1560 1538 struct btree_trans *trans; 1561 1539 snapshot_id_list deleted = { 0 }; 1562 1540 snapshot_id_list deleted_interior = { 0 }; 1563 - u32 id; 1564 1541 int ret = 0; 1565 1542 1566 1543 if (!test_and_clear_bit(BCH_FS_need_delete_dead_snapshots, &c->flags)) ··· 1606 1585 if (ret) 1607 1586 goto err; 1608 1587 1609 - for (id = 0; id < BTREE_ID_NR; id++) { 1588 + for (unsigned btree = 0; btree < BTREE_ID_NR; btree++) { 1610 1589 struct bpos last_pos = POS_MIN; 1611 1590 snapshot_id_list equiv_seen = { 0 }; 1612 1591 struct disk_reservation res = { 0 }; 1613 1592 1614 - if (!btree_type_has_snapshots(id)) 1615 - continue; 1616 - 1617 - /* 1618 - * deleted inodes btree is maintained by a trigger on the inodes 1619 - * btree - no work for us to do here, and it's not safe to scan 1620 - * it because we'll see out of date keys due to the btree write 1621 - * buffer: 1622 - */ 1623 - if (id == BTREE_ID_deleted_inodes) 1593 + if (!btree_type_has_snapshots(btree)) 1624 1594 continue; 1625 1595 1626 1596 ret = for_each_btree_key_commit(trans, iter, 1627 - id, POS_MIN, 1597 + btree, POS_MIN, 1628 1598 BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k, 1629 1599 &res, NULL, BCH_TRANS_COMMIT_no_enospc, 1630 - snapshot_delete_key(trans, &iter, k, &deleted, &equiv_seen, &last_pos)) ?: 1631 - for_each_btree_key_commit(trans, iter, 1632 - id, POS_MIN, 1633 - BTREE_ITER_prefetch|BTREE_ITER_all_snapshots, k, 1634 - &res, NULL, BCH_TRANS_COMMIT_no_enospc, 1635 - move_key_to_correct_snapshot(trans, &iter, k)); 1600 + delete_dead_snapshots_process_key(trans, &iter, k, &deleted, 1601 + &equiv_seen, &last_pos)); 1636 1602 1637 1603 bch2_disk_reservation_put(c, &res); 1638 1604 darray_exit(&equiv_seen);
+1
fs/bcachefs/snapshot.h
··· 242 242 int bch2_check_snapshot_trees(struct bch_fs *); 243 243 int bch2_check_snapshots(struct bch_fs *); 244 244 int bch2_reconstruct_snapshots(struct bch_fs *); 245 + int bch2_check_key_has_snapshot(struct btree_trans *, struct btree_iter *, struct bkey_s_c); 245 246 246 247 int bch2_snapshot_node_set_deleted(struct btree_trans *, u32); 247 248 void bch2_delete_dead_snapshots_work(struct work_struct *);
+3 -9
fs/bcachefs/super-io.c
··· 1132 1132 * c->sb will be checked before we write the superblock, so update it as 1133 1133 * well: 1134 1134 */ 1135 - if (BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb) > bcachefs_metadata_version_current) { 1135 + if (BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb) > bcachefs_metadata_version_current) 1136 1136 SET_BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb, bcachefs_metadata_version_current); 1137 - c->sb.version_upgrade_complete = bcachefs_metadata_version_current; 1138 - } 1139 - if (c->sb.version > bcachefs_metadata_version_current) { 1137 + if (c->sb.version > bcachefs_metadata_version_current) 1140 1138 c->disk_sb.sb->version = cpu_to_le16(bcachefs_metadata_version_current); 1141 - c->sb.version = bcachefs_metadata_version_current; 1142 - } 1143 - if (c->sb.version_min > bcachefs_metadata_version_current) { 1139 + if (c->sb.version_min > bcachefs_metadata_version_current) 1144 1140 c->disk_sb.sb->version_min = cpu_to_le16(bcachefs_metadata_version_current); 1145 - c->sb.version_min = bcachefs_metadata_version_current; 1146 - } 1147 1141 c->disk_sb.sb->compat[0] &= cpu_to_le64((1ULL << BCH_COMPAT_NR) - 1); 1148 1142 return ret; 1149 1143 }
+1 -1
fs/bcachefs/super.c
··· 564 564 BUG_ON(atomic_read(&c->journal_keys.ref)); 565 565 bch2_fs_btree_write_buffer_exit(c); 566 566 percpu_free_rwsem(&c->mark_lock); 567 - EBUG_ON(percpu_u64_get(c->online_reserved)); 567 + EBUG_ON(c->online_reserved && percpu_u64_get(c->online_reserved)); 568 568 free_percpu(c->online_reserved); 569 569 570 570 darray_exit(&c->btree_roots_extra);
+8 -7
fs/dcache.c
··· 2360 2360 * - unhash this dentry and free it. 2361 2361 * 2362 2362 * Usually, we want to just turn this into 2363 - * a negative dentry, but certain workloads can 2364 - * generate a large number of negative dentries. 2365 - * Therefore, it would be better to simply 2366 - * unhash it. 2363 + * a negative dentry, but if anybody else is 2364 + * currently using the dentry or the inode 2365 + * we can't do that and we fall back on removing 2366 + * it from the hash queues and waiting for 2367 + * it to be deleted later when it has no users 2367 2368 */ 2368 2369 2369 2370 /** 2370 2371 * d_delete - delete a dentry 2371 2372 * @dentry: The dentry to delete 2372 2373 * 2373 - * Remove the dentry from the hash queues so it can be deleted later. 2374 + * Turn the dentry into a negative dentry if possible, otherwise 2375 + * remove it from the hash queues so it can be deleted later 2374 2376 */ 2375 2377 2376 2378 void d_delete(struct dentry * dentry) ··· 2381 2379 2382 2380 spin_lock(&inode->i_lock); 2383 2381 spin_lock(&dentry->d_lock); 2384 - __d_drop(dentry); 2385 - 2386 2382 /* 2387 2383 * Are we the only user? 2388 2384 */ ··· 2388 2388 dentry->d_flags &= ~DCACHE_CANT_MOUNT; 2389 2389 dentry_unlink_inode(dentry); 2390 2390 } else { 2391 + __d_drop(dentry); 2391 2392 spin_unlock(&dentry->d_lock); 2392 2393 spin_unlock(&inode->i_lock); 2393 2394 }
+1 -1
fs/iomap/buffered-io.c
··· 898 898 static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i) 899 899 { 900 900 loff_t length = iomap_length(iter); 901 - size_t chunk = PAGE_SIZE << MAX_PAGECACHE_ORDER; 902 901 loff_t pos = iter->pos; 903 902 ssize_t total_written = 0; 904 903 long status = 0; 905 904 struct address_space *mapping = iter->inode->i_mapping; 905 + size_t chunk = mapping_max_folio_size(mapping); 906 906 unsigned int bdp_flags = (iter->flags & IOMAP_NOWAIT) ? BDP_ASYNC : 0; 907 907 908 908 do {
+1 -1
fs/netfs/buffered_write.c
··· 181 181 struct folio *folio, *writethrough = NULL; 182 182 enum netfs_how_to_modify howto; 183 183 enum netfs_folio_trace trace; 184 - unsigned int bdp_flags = (iocb->ki_flags & IOCB_SYNC) ? 0: BDP_ASYNC; 184 + unsigned int bdp_flags = (iocb->ki_flags & IOCB_NOWAIT) ? BDP_ASYNC : 0; 185 185 ssize_t written = 0, ret, ret2; 186 186 loff_t i_size, pos = iocb->ki_pos, from, to; 187 187 size_t max_chunk = PAGE_SIZE << MAX_PAGECACHE_ORDER;
+1 -1
fs/netfs/direct_write.c
··· 12 12 static void netfs_cleanup_dio_write(struct netfs_io_request *wreq) 13 13 { 14 14 struct inode *inode = wreq->inode; 15 - unsigned long long end = wreq->start + wreq->len; 15 + unsigned long long end = wreq->start + wreq->transferred; 16 16 17 17 if (!wreq->error && 18 18 i_size_read(inode) < end) {
+5
fs/netfs/objects.c
··· 72 72 } 73 73 } 74 74 75 + atomic_inc(&ctx->io_count); 75 76 trace_netfs_rreq_ref(rreq->debug_id, 1, netfs_rreq_trace_new); 76 77 netfs_proc_add_rreq(rreq); 77 78 netfs_stat(&netfs_n_rh_rreq); ··· 125 124 { 126 125 struct netfs_io_request *rreq = 127 126 container_of(work, struct netfs_io_request, work); 127 + struct netfs_inode *ictx = netfs_inode(rreq->inode); 128 128 unsigned int i; 129 129 130 130 trace_netfs_rreq(rreq, netfs_rreq_trace_free); ··· 144 142 } 145 143 kvfree(rreq->direct_bv); 146 144 } 145 + 146 + if (atomic_dec_and_test(&ictx->io_count)) 147 + wake_up_var(&ictx->io_count); 147 148 call_rcu(&rreq->rcu, netfs_free_request_rcu); 148 149 } 149 150
+4 -3
fs/netfs/write_collect.c
··· 510 510 * stream has a gap that can be jumped. 511 511 */ 512 512 if (notes & SOME_EMPTY) { 513 - unsigned long long jump_to = wreq->start + wreq->len; 513 + unsigned long long jump_to = wreq->start + READ_ONCE(wreq->submitted); 514 514 515 515 for (s = 0; s < NR_IO_STREAMS; s++) { 516 516 stream = &wreq->io_streams[s]; ··· 690 690 wake_up_bit(&wreq->flags, NETFS_RREQ_IN_PROGRESS); 691 691 692 692 if (wreq->iocb) { 693 - wreq->iocb->ki_pos += wreq->transferred; 693 + size_t written = min(wreq->transferred, wreq->len); 694 + wreq->iocb->ki_pos += written; 694 695 if (wreq->iocb->ki_complete) 695 696 wreq->iocb->ki_complete( 696 - wreq->iocb, wreq->error ? wreq->error : wreq->transferred); 697 + wreq->iocb, wreq->error ? wreq->error : written); 697 698 wreq->iocb = VFS_PTR_POISON; 698 699 } 699 700
+7 -2
fs/netfs/write_issue.c
··· 254 254 stream->construct = NULL; 255 255 256 256 if (subreq->start + subreq->len > wreq->start + wreq->submitted) 257 - wreq->len = wreq->submitted = subreq->start + subreq->len - wreq->start; 257 + WRITE_ONCE(wreq->submitted, subreq->start + subreq->len - wreq->start); 258 258 netfs_do_issue_write(stream, subreq); 259 259 } 260 260 ··· 636 636 637 637 mutex_unlock(&ictx->wb_lock); 638 638 639 - ret = wreq->error; 639 + if (wreq->iocb) { 640 + ret = -EIOCBQUEUED; 641 + } else { 642 + wait_on_bit(&wreq->flags, NETFS_RREQ_IN_PROGRESS, TASK_UNINTERRUPTIBLE); 643 + ret = wreq->error; 644 + } 640 645 netfs_put_request(wreq, false, netfs_rreq_trace_put_return); 641 646 return ret; 642 647 }
+1 -5
fs/signalfd.c
··· 282 282 if (IS_ERR(file)) { 283 283 put_unused_fd(ufd); 284 284 kfree(ctx); 285 - return ufd; 285 + return PTR_ERR(file); 286 286 } 287 287 file->f_mode |= FMODE_NOWAIT; 288 288 289 - /* 290 - * When we call this, the initialization must be complete, since 291 - * anon_inode_getfd() will install the fd. 292 - */ 293 289 fd_install(ufd, file); 294 290 } else { 295 291 struct fd f = fdget(ufd);
+1
fs/smb/client/cifsfs.c
··· 431 431 static void 432 432 cifs_evict_inode(struct inode *inode) 433 433 { 434 + netfs_wait_for_outstanding_io(inode); 434 435 truncate_inode_pages_final(&inode->i_data); 435 436 if (inode->i_state & I_PINNING_NETFS_WB) 436 437 cifs_fscache_unuse_inode_cookie(inode, true);
+1 -1
fs/smb/client/cifspdu.h
··· 2574 2574 2575 2575 2576 2576 struct win_dev { 2577 - unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO*/ 2577 + unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO or LnxSOCK */ 2578 2578 __le64 major; 2579 2579 __le64 minor; 2580 2580 } __attribute__((packed));
+4
fs/smb/client/inode.c
··· 606 606 mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); 607 607 fattr->cf_rdev = MKDEV(mjr, mnr); 608 608 } 609 + } else if (memcmp("LnxSOCK", pbuf, 8) == 0) { 610 + cifs_dbg(FYI, "Socket\n"); 611 + fattr->cf_mode |= S_IFSOCK; 612 + fattr->cf_dtype = DT_SOCK; 609 613 } else if (memcmp("IntxLNK", pbuf, 7) == 0) { 610 614 cifs_dbg(FYI, "Symlink\n"); 611 615 fattr->cf_mode |= S_IFLNK;
+3
fs/smb/client/smb2ops.c
··· 4997 4997 pdev.major = cpu_to_le64(MAJOR(dev)); 4998 4998 pdev.minor = cpu_to_le64(MINOR(dev)); 4999 4999 break; 5000 + case S_IFSOCK: 5001 + strscpy(pdev.type, "LnxSOCK"); 5002 + break; 5000 5003 case S_IFIFO: 5001 5004 strscpy(pdev.type, "LnxFIFO"); 5002 5005 break;
+1
fs/smb/common/cifs_arc4.c
··· 10 10 #include <linux/module.h> 11 11 #include "arc4.h" 12 12 13 + MODULE_DESCRIPTION("ARC4 Cipher Algorithm"); 13 14 MODULE_LICENSE("GPL"); 14 15 15 16 int cifs_arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len)
+1
fs/smb/common/cifs_md4.c
··· 24 24 #include <asm/byteorder.h> 25 25 #include "md4.h" 26 26 27 + MODULE_DESCRIPTION("MD4 Message Digest Algorithm (RFC1320)"); 27 28 MODULE_LICENSE("GPL"); 28 29 29 30 static inline u32 lshift(u32 x, unsigned int s)
+2 -4
fs/xfs/libxfs/xfs_alloc.c
··· 1008 1008 struct xfs_alloc_arg *args, 1009 1009 struct xfs_alloc_cur *acur) 1010 1010 { 1011 - struct xfs_agf __maybe_unused *agf = args->agbp->b_addr; 1012 1011 int error; 1013 1012 1014 1013 ASSERT(acur->cnt && acur->bnolt); 1015 1014 ASSERT(acur->bno >= acur->rec_bno); 1016 1015 ASSERT(acur->bno + acur->len <= acur->rec_bno + acur->rec_len); 1017 - ASSERT(acur->rec_bno + acur->rec_len <= be32_to_cpu(agf->agf_length)); 1016 + ASSERT(xfs_verify_agbext(args->pag, acur->rec_bno, acur->rec_len)); 1018 1017 1019 1018 error = xfs_alloc_fixup_trees(acur->cnt, acur->bnolt, acur->rec_bno, 1020 1019 acur->rec_len, acur->bno, acur->len, 0); ··· 1216 1217 xfs_alloc_ag_vextent_exact( 1217 1218 xfs_alloc_arg_t *args) /* allocation argument structure */ 1218 1219 { 1219 - struct xfs_agf __maybe_unused *agf = args->agbp->b_addr; 1220 1220 struct xfs_btree_cur *bno_cur;/* by block-number btree cursor */ 1221 1221 struct xfs_btree_cur *cnt_cur;/* by count btree cursor */ 1222 1222 int error; ··· 1295 1297 */ 1296 1298 cnt_cur = xfs_cntbt_init_cursor(args->mp, args->tp, args->agbp, 1297 1299 args->pag); 1298 - ASSERT(args->agbno + args->len <= be32_to_cpu(agf->agf_length)); 1300 + ASSERT(xfs_verify_agbext(args->pag, args->agbno, args->len)); 1299 1301 error = xfs_alloc_fixup_trees(cnt_cur, bno_cur, fbno, flen, args->agbno, 1300 1302 args->len, XFSA_FIXUP_BNO_OK); 1301 1303 if (error) {
+18 -20
fs/xfs/libxfs/xfs_attr.c
··· 329 329 return nblks; 330 330 } 331 331 332 - /* Initialize transaction reservation for attr operations */ 333 - void 334 - xfs_init_attr_trans( 335 - struct xfs_da_args *args, 336 - struct xfs_trans_res *tres, 337 - unsigned int *total) 332 + /* Initialize transaction reservation for an xattr set/replace/upsert */ 333 + inline struct xfs_trans_res 334 + xfs_attr_set_resv( 335 + const struct xfs_da_args *args) 338 336 { 339 - struct xfs_mount *mp = args->dp->i_mount; 337 + struct xfs_mount *mp = args->dp->i_mount; 338 + struct xfs_trans_res ret = { 339 + .tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + 340 + M_RES(mp)->tr_attrsetrt.tr_logres * args->total, 341 + .tr_logcount = XFS_ATTRSET_LOG_COUNT, 342 + .tr_logflags = XFS_TRANS_PERM_LOG_RES, 343 + }; 340 344 341 - if (args->value) { 342 - tres->tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + 343 - M_RES(mp)->tr_attrsetrt.tr_logres * 344 - args->total; 345 - tres->tr_logcount = XFS_ATTRSET_LOG_COUNT; 346 - tres->tr_logflags = XFS_TRANS_PERM_LOG_RES; 347 - *total = args->total; 348 - } else { 349 - *tres = M_RES(mp)->tr_attrrm; 350 - *total = XFS_ATTRRM_SPACE_RES(mp); 351 - } 345 + return ret; 352 346 } 353 347 354 348 /* ··· 1000 1006 struct xfs_trans_res tres; 1001 1007 int error, local; 1002 1008 int rmt_blks = 0; 1003 - unsigned int total; 1009 + unsigned int total = 0; 1004 1010 1005 1011 ASSERT(!args->trans); 1006 1012 ··· 1027 1033 1028 1034 if (!local) 1029 1035 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen); 1036 + 1037 + tres = xfs_attr_set_resv(args); 1038 + total = args->total; 1030 1039 break; 1031 1040 case XFS_ATTRUPDATE_REMOVE: 1032 1041 XFS_STATS_INC(mp, xs_attr_remove); 1033 1042 rmt_blks = xfs_attr3_max_rmt_blocks(mp); 1043 + tres = M_RES(mp)->tr_attrrm; 1044 + total = XFS_ATTRRM_SPACE_RES(mp); 1034 1045 break; 1035 1046 } 1036 1047 ··· 1043 1044 * Root fork attributes can use reserved data blocks for this 1044 1045 * operation if necessary 1045 1046 */ 1046 - xfs_init_attr_trans(args, &tres, &total); 1047 1047 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans); 1048 1048 if (error) 1049 1049 return error;
+1 -2
fs/xfs/libxfs/xfs_attr.h
··· 565 565 bool xfs_attr_namecheck(unsigned int attr_flags, const void *name, 566 566 size_t length); 567 567 int xfs_attr_calc_size(struct xfs_da_args *args, int *local); 568 - void xfs_init_attr_trans(struct xfs_da_args *args, struct xfs_trans_res *tres, 569 - unsigned int *total); 568 + struct xfs_trans_res xfs_attr_set_resv(const struct xfs_da_args *args); 570 569 571 570 /* 572 571 * Check to see if the attr should be upgraded from non-existent or shortform to
+1
fs/xfs/libxfs/xfs_bmap.c
··· 6383 6383 error = xfs_defer_finish(tpp); 6384 6384 if (error) 6385 6385 goto out; 6386 + cond_resched(); 6386 6387 } 6387 6388 out: 6388 6389 return error;
+24 -4
fs/xfs/libxfs/xfs_inode_buf.c
··· 374 374 /* 375 375 * For fork types that can contain local data, check that the fork 376 376 * format matches the size of local data contained within the fork. 377 - * 378 - * For all types, check that when the size says the should be in extent 379 - * or btree format, the inode isn't claiming it is in local format. 380 377 */ 381 378 if (whichfork == XFS_DATA_FORK) { 382 - if (S_ISDIR(mode) || S_ISLNK(mode)) { 379 + /* 380 + * A directory small enough to fit in the inode must be stored 381 + * in local format. The directory sf <-> extents conversion 382 + * code updates the directory size accordingly. 383 + */ 384 + if (S_ISDIR(mode)) { 383 385 if (be64_to_cpu(dip->di_size) <= fork_size && 384 386 fork_format != XFS_DINODE_FMT_LOCAL) 385 387 return __this_address; 386 388 } 387 389 390 + /* 391 + * A symlink with a target small enough to fit in the inode can 392 + * be stored in extents format if xattrs were added (thus 393 + * converting the data fork from shortform to remote format) 394 + * and then removed. 395 + */ 396 + if (S_ISLNK(mode)) { 397 + if (be64_to_cpu(dip->di_size) <= fork_size && 398 + fork_format != XFS_DINODE_FMT_EXTENTS && 399 + fork_format != XFS_DINODE_FMT_LOCAL) 400 + return __this_address; 401 + } 402 + 403 + /* 404 + * For all types, check that when the size says the fork should 405 + * be in extent or btree format, the inode isn't claiming to be 406 + * in local format. 407 + */ 388 408 if (be64_to_cpu(dip->di_size) > fork_size && 389 409 fork_format == XFS_DINODE_FMT_LOCAL) 390 410 return __this_address;
+1 -1
fs/xfs/scrub/scrub.c
··· 856 856 if (vec_bytes > PAGE_SIZE) 857 857 return -ENOMEM; 858 858 859 - uvectors = (void __user *)(uintptr_t)head.svh_vectors; 859 + uvectors = u64_to_user_ptr(head.svh_vectors); 860 860 vectors = memdup_user(uvectors, vec_bytes); 861 861 if (IS_ERR(vectors)) 862 862 return PTR_ERR(vectors);
+6 -3
fs/xfs/scrub/xfarray.c
··· 822 822 823 823 /* Grab the first folio that backs this array element. */ 824 824 if (!si->folio) { 825 + struct folio *folio; 825 826 loff_t next_pos; 826 827 827 - si->folio = xfile_get_folio(si->array->xfile, idx_pos, 828 + folio = xfile_get_folio(si->array->xfile, idx_pos, 828 829 si->array->obj_size, XFILE_ALLOC); 829 - if (IS_ERR(si->folio)) 830 - return PTR_ERR(si->folio); 830 + if (IS_ERR(folio)) 831 + return PTR_ERR(folio); 832 + si->folio = folio; 831 833 832 834 si->first_folio_idx = xfarray_idx(si->array, 833 835 folio_pos(si->folio) + si->array->obj_size - 1); ··· 1050 1048 1051 1049 out_free: 1052 1050 trace_xfarray_sort_stats(si, error); 1051 + xfarray_sort_scan_done(si); 1053 1052 kvfree(si); 1054 1053 return error; 1055 1054 }
+15 -2
fs/xfs/xfs_attr_item.c
··· 746 746 struct xfs_attri_log_format *attrp; 747 747 struct xfs_attri_log_nameval *nv = attrip->attri_nameval; 748 748 int error; 749 - int total; 749 + unsigned int total = 0; 750 750 751 751 /* 752 752 * First check the validity of the attr described by the ATTRI. If any ··· 763 763 return PTR_ERR(attr); 764 764 args = attr->xattri_da_args; 765 765 766 - xfs_init_attr_trans(args, &resv, &total); 766 + switch (xfs_attr_intent_op(attr)) { 767 + case XFS_ATTRI_OP_FLAGS_PPTR_SET: 768 + case XFS_ATTRI_OP_FLAGS_PPTR_REPLACE: 769 + case XFS_ATTRI_OP_FLAGS_SET: 770 + case XFS_ATTRI_OP_FLAGS_REPLACE: 771 + resv = xfs_attr_set_resv(args); 772 + total = args->total; 773 + break; 774 + case XFS_ATTRI_OP_FLAGS_PPTR_REMOVE: 775 + case XFS_ATTRI_OP_FLAGS_REMOVE: 776 + resv = M_RES(mp)->tr_attrrm; 777 + total = XFS_ATTRRM_SPACE_RES(mp); 778 + break; 779 + } 767 780 resv = xlog_recover_resv(&resv); 768 781 error = xfs_trans_alloc(mp, &resv, total, 0, XFS_TRANS_RESERVE, &tp); 769 782 if (error)
+1 -6
fs/xfs/xfs_handle.c
··· 773 773 trace_xfs_getparents_expand_lastrec(gpx->ip, gp, &gpx->context, gpr); 774 774 } 775 775 776 - static inline void __user *u64_to_uptr(u64 val) 777 - { 778 - return (void __user *)(uintptr_t)val; 779 - } 780 - 781 776 /* Retrieve the parent pointers for a given inode. */ 782 777 STATIC int 783 778 xfs_getparents( ··· 857 862 ASSERT(gpx->context.firstu <= gpx->gph.gph_request.gp_bufsize); 858 863 859 864 /* Copy the records to userspace. */ 860 - if (copy_to_user(u64_to_uptr(gpx->gph.gph_request.gp_buffer), 865 + if (copy_to_user(u64_to_user_ptr(gpx->gph.gph_request.gp_buffer), 861 866 gpx->krecords, gpx->context.firstu)) 862 867 error = -EFAULT; 863 868
+2 -3
fs/xfs/xfs_iwalk.c
··· 351 351 int *has_more) 352 352 { 353 353 struct xfs_mount *mp = iwag->mp; 354 - struct xfs_inobt_rec_incore *irec; 355 354 xfs_agino_t next_agino; 356 355 int error; 357 356 ··· 360 361 361 362 /* Delete cursor but remember the last record we cached... */ 362 363 xfs_iwalk_del_inobt(iwag->tp, curpp, agi_bpp, 0); 363 - irec = &iwag->recs[iwag->nr_recs - 1]; 364 - ASSERT(next_agino >= irec->ir_startino + XFS_INODES_PER_CHUNK); 364 + ASSERT(next_agino >= iwag->recs[iwag->nr_recs - 1].ir_startino + 365 + XFS_INODES_PER_CHUNK); 365 366 366 367 if (iwag->drop_trans) { 367 368 xfs_trans_cancel(iwag->tp);
+1
fs/xfs/xfs_reflink.c
··· 1387 1387 destoff += imap.br_blockcount; 1388 1388 len -= imap.br_blockcount; 1389 1389 remapped_len += imap.br_blockcount; 1390 + cond_resched(); 1390 1391 } 1391 1392 1392 1393 if (error)
+3 -3
include/drm/drm_buddy.h
··· 56 56 struct list_head tmp_link; 57 57 }; 58 58 59 - /* Order-zero must be at least PAGE_SIZE */ 60 - #define DRM_BUDDY_MAX_ORDER (63 - PAGE_SHIFT) 59 + /* Order-zero must be at least SZ_4K */ 60 + #define DRM_BUDDY_MAX_ORDER (63 - 12) 61 61 62 62 /* 63 63 * Binary Buddy System. ··· 85 85 unsigned int n_roots; 86 86 unsigned int max_order; 87 87 88 - /* Must be at least PAGE_SIZE */ 88 + /* Must be at least SZ_4K */ 89 89 u64 chunk_size; 90 90 u64 size; 91 91 u64 avail;
-10
include/linux/blk-integrity.h
··· 66 66 return q->integrity.profile; 67 67 } 68 68 69 - static inline void blk_queue_max_integrity_segments(struct request_queue *q, 70 - unsigned int segs) 71 - { 72 - q->limits.max_integrity_segments = segs; 73 - } 74 - 75 69 static inline unsigned short 76 70 queue_max_integrity_segments(const struct request_queue *q) 77 71 { ··· 143 149 { 144 150 } 145 151 static inline void blk_integrity_unregister(struct gendisk *d) 146 - { 147 - } 148 - static inline void blk_queue_max_integrity_segments(struct request_queue *q, 149 - unsigned int segs) 150 152 { 151 153 } 152 154 static inline unsigned short
+1
include/linux/blkdev.h
··· 186 186 */ 187 187 unsigned int nr_zones; 188 188 unsigned int zone_capacity; 189 + unsigned int last_zone_capacity; 189 190 unsigned long *conv_zones_bitmap; 190 191 unsigned int zone_wplugs_hash_bits; 191 192 spinlock_t zone_wplugs_lock;
+8
include/linux/etherdevice.h
··· 636 636 } 637 637 } 638 638 639 + static inline struct ethhdr *eth_skb_pull_mac(struct sk_buff *skb) 640 + { 641 + struct ethhdr *eth = (struct ethhdr *)skb->data; 642 + 643 + skb_pull_inline(skb, ETH_HLEN); 644 + return eth; 645 + } 646 + 639 647 /** 640 648 * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame 641 649 * @skb: Buffer to pad
+2 -2
include/linux/mlx5/mlx5_ifc.h
··· 10308 10308 u8 mfrl[0x1]; 10309 10309 u8 regs_39_to_32[0x8]; 10310 10310 10311 - u8 regs_31_to_10[0x16]; 10311 + u8 regs_31_to_11[0x15]; 10312 10312 u8 mtmp[0x1]; 10313 - u8 regs_8_to_0[0x9]; 10313 + u8 regs_9_to_0[0xa]; 10314 10314 }; 10315 10315 10316 10316 struct mlx5_ifc_mcam_access_reg_bits1 {
+18
include/linux/netfs.h
··· 68 68 loff_t remote_i_size; /* Size of the remote file */ 69 69 loff_t zero_point; /* Size after which we assume there's no data 70 70 * on the server */ 71 + atomic_t io_count; /* Number of outstanding reqs */ 71 72 unsigned long flags; 72 73 #define NETFS_ICTX_ODIRECT 0 /* The file has DIO in progress */ 73 74 #define NETFS_ICTX_UNBUFFERED 1 /* I/O should not use the pagecache */ ··· 475 474 ctx->remote_i_size = i_size_read(&ctx->inode); 476 475 ctx->zero_point = LLONG_MAX; 477 476 ctx->flags = 0; 477 + atomic_set(&ctx->io_count, 0); 478 478 #if IS_ENABLED(CONFIG_FSCACHE) 479 479 ctx->cache = NULL; 480 480 #endif ··· 517 515 #else 518 516 return NULL; 519 517 #endif 518 + } 519 + 520 + /** 521 + * netfs_wait_for_outstanding_io - Wait for outstanding I/O to complete 522 + * @ctx: The netfs inode to wait on 523 + * 524 + * Wait for outstanding I/O requests of any type to complete. This is intended 525 + * to be called from inode eviction routines. This makes sure that any 526 + * resources held by those requests are cleaned up before we let the inode get 527 + * cleaned up. 528 + */ 529 + static inline void netfs_wait_for_outstanding_io(struct inode *inode) 530 + { 531 + struct netfs_inode *ictx = netfs_inode(inode); 532 + 533 + wait_var_event(&ictx->io_count, atomic_read(&ictx->io_count) == 0); 520 534 } 521 535 522 536 #endif /* _LINUX_NETFS_H */
+21 -13
include/linux/pagemap.h
··· 346 346 m->gfp_mask = mask; 347 347 } 348 348 349 + /* 350 + * There are some parts of the kernel which assume that PMD entries 351 + * are exactly HPAGE_PMD_ORDER. Those should be fixed, but until then, 352 + * limit the maximum allocation order to PMD size. I'm not aware of any 353 + * assumptions about maximum order if THP are disabled, but 8 seems like 354 + * a good order (that's 1MB if you're using 4kB pages) 355 + */ 356 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE 357 + #define MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER 358 + #else 359 + #define MAX_PAGECACHE_ORDER 8 360 + #endif 361 + 349 362 /** 350 363 * mapping_set_large_folios() - Indicate the file supports large folios. 351 364 * @mapping: The file. ··· 383 370 { 384 371 return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && 385 372 test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); 373 + } 374 + 375 + /* Return the maximum folio size for this pagecache mapping, in bytes. */ 376 + static inline size_t mapping_max_folio_size(struct address_space *mapping) 377 + { 378 + if (mapping_large_folio_support(mapping)) 379 + return PAGE_SIZE << MAX_PAGECACHE_ORDER; 380 + return PAGE_SIZE; 386 381 } 387 382 388 383 static inline int filemap_nr_thps(struct address_space *mapping) ··· 550 529 { 551 530 return folio_detach_private(page_folio(page)); 552 531 } 553 - 554 - /* 555 - * There are some parts of the kernel which assume that PMD entries 556 - * are exactly HPAGE_PMD_ORDER. Those should be fixed, but until then, 557 - * limit the maximum allocation order to PMD size. I'm not aware of any 558 - * assumptions about maximum order if THP are disabled, but 8 seems like 559 - * a good order (that's 1MB if you're using 4kB pages) 560 - */ 561 - #ifdef CONFIG_TRANSPARENT_HUGEPAGE 562 - #define MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER 563 - #else 564 - #define MAX_PAGECACHE_ORDER 8 565 - #endif 566 532 567 533 #ifdef CONFIG_NUMA 568 534 struct folio *filemap_alloc_folio_noprof(gfp_t gfp, unsigned int order);
-17
include/linux/tpm.h
··· 394 394 TPM2_OA_SIGN = BIT(18), 395 395 }; 396 396 397 - /* 398 - * definitions for the canonical template. These are mandated 399 - * by the TCG key template documents 400 - */ 401 - 402 - #define AES_KEY_BYTES AES_KEYSIZE_128 403 - #define AES_KEY_BITS (AES_KEY_BYTES*8) 404 - #define TPM2_OA_TMPL (TPM2_OA_NO_DA | \ 405 - TPM2_OA_FIXED_TPM | \ 406 - TPM2_OA_FIXED_PARENT | \ 407 - TPM2_OA_SENSITIVE_DATA_ORIGIN | \ 408 - TPM2_OA_USER_WITH_AUTH | \ 409 - TPM2_OA_DECRYPT | \ 410 - TPM2_OA_RESTRICTED) 411 - 412 397 enum tpm2_session_attributes { 413 398 TPM2_SA_CONTINUE_SESSION = BIT(0), 414 399 TPM2_SA_AUDIT_EXCLUSIVE = BIT(1), ··· 421 436 u8 tpm_buf_read_u8(struct tpm_buf *buf, off_t *offset); 422 437 u16 tpm_buf_read_u16(struct tpm_buf *buf, off_t *offset); 423 438 u32 tpm_buf_read_u32(struct tpm_buf *buf, off_t *offset); 424 - 425 - u8 *tpm_buf_parameters(struct tpm_buf *buf); 426 439 427 440 /* 428 441 * Check if TPM device is in the firmware upgrade mode.
+1 -1
include/net/dst_ops.h
··· 24 24 void (*destroy)(struct dst_entry *); 25 25 void (*ifdown)(struct dst_entry *, 26 26 struct net_device *dev); 27 - struct dst_entry * (*negative_advice)(struct dst_entry *); 27 + void (*negative_advice)(struct sock *sk, struct dst_entry *); 28 28 void (*link_failure)(struct sk_buff *); 29 29 void (*update_pmtu)(struct dst_entry *dst, struct sock *sk, 30 30 struct sk_buff *skb, u32 mtu,
+3 -2
include/net/page_pool/types.h
··· 45 45 46 46 /** 47 47 * struct page_pool_params - page pool parameters 48 + * @fast: params accessed frequently on hotpath 48 49 * @order: 2^order pages on allocation 49 50 * @pool_size: size of the ptr_ring 50 51 * @nid: NUMA node id to allocate from pages from 51 52 * @dev: device, for DMA pre-mapping purposes 52 - * @netdev: netdev this pool will serve (leave as NULL if none or multiple) 53 53 * @napi: NAPI which is the sole consumer of pages, otherwise NULL 54 54 * @dma_dir: DMA mapping direction 55 55 * @max_len: max DMA sync memory size for PP_FLAG_DMA_SYNC_DEV 56 56 * @offset: DMA sync address offset for PP_FLAG_DMA_SYNC_DEV 57 - * @netdev: corresponding &net_device for Netlink introspection 57 + * @slow: params with slowpath access only (initialization and Netlink) 58 + * @netdev: netdev this pool will serve (leave as NULL if none or multiple) 58 59 * @flags: PP_FLAG_DMA_MAP, PP_FLAG_DMA_SYNC_DEV, PP_FLAG_SYSTEM_POOL 59 60 */ 60 61 struct page_pool_params {
+12
include/net/request_sock.h
··· 285 285 return atomic_read(&queue->young); 286 286 } 287 287 288 + /* RFC 7323 2.3 Using the Window Scale Option 289 + * The window field (SEG.WND) of every outgoing segment, with the 290 + * exception of <SYN> segments, MUST be right-shifted by 291 + * Rcv.Wind.Shift bits. 292 + * 293 + * This means the SEG.WND carried in SYNACK can not exceed 65535. 294 + * We use this property to harden TCP stack while in NEW_SYN_RECV state. 295 + */ 296 + static inline u32 tcp_synack_window(const struct request_sock *req) 297 + { 298 + return min(req->rsk_rcv_wnd, 65535U); 299 + } 288 300 #endif /* _REQUEST_SOCK_H */
+3 -10
include/net/sock.h
··· 2063 2063 2064 2064 static inline void __dst_negative_advice(struct sock *sk) 2065 2065 { 2066 - struct dst_entry *ndst, *dst = __sk_dst_get(sk); 2066 + struct dst_entry *dst = __sk_dst_get(sk); 2067 2067 2068 - if (dst && dst->ops->negative_advice) { 2069 - ndst = dst->ops->negative_advice(dst); 2070 - 2071 - if (ndst != dst) { 2072 - rcu_assign_pointer(sk->sk_dst_cache, ndst); 2073 - sk_tx_queue_clear(sk); 2074 - WRITE_ONCE(sk->sk_dst_pending_confirm, 0); 2075 - } 2076 - } 2068 + if (dst && dst->ops->negative_advice) 2069 + dst->ops->negative_advice(sk, dst); 2077 2070 } 2078 2071 2079 2072 static inline void dst_negative_advice(struct sock *sk)
+1 -1
include/sound/pcm.h
··· 124 124 #define SNDRV_PCM_RATE_768000 (1U<<16) /* 768000Hz */ 125 125 126 126 #define SNDRV_PCM_RATE_CONTINUOUS (1U<<30) /* continuous range */ 127 - #define SNDRV_PCM_RATE_KNOT (1U<<31) /* supports more non-continuos rates */ 127 + #define SNDRV_PCM_RATE_KNOT (1U<<31) /* supports more non-continuous rates */ 128 128 129 129 #define SNDRV_PCM_RATE_8000_44100 (SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\ 130 130 SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\
+1 -2
include/uapi/linux/cn_proc.h
··· 69 69 70 70 static inline enum proc_cn_event valid_event(enum proc_cn_event ev_type) 71 71 { 72 - ev_type &= PROC_EVENT_ALL; 73 - return ev_type; 72 + return (enum proc_cn_event)(ev_type & PROC_EVENT_ALL); 74 73 } 75 74 76 75 /*
+47 -49
include/uapi/linux/kd.h
··· 5 5 #include <linux/compiler.h> 6 6 7 7 /* 0x4B is 'K', to avoid collision with termios and vt */ 8 - #define KD_IOCTL_BASE 'K' 9 8 10 - #define GIO_FONT _IO(KD_IOCTL_BASE, 0x60) /* gets font in expanded form */ 11 - #define PIO_FONT _IO(KD_IOCTL_BASE, 0x61) /* use font in expanded form */ 9 + #define GIO_FONT 0x4B60 /* gets font in expanded form */ 10 + #define PIO_FONT 0x4B61 /* use font in expanded form */ 12 11 13 - #define GIO_FONTX _IO(KD_IOCTL_BASE, 0x6B) /* get font using struct consolefontdesc */ 14 - #define PIO_FONTX _IO(KD_IOCTL_BASE, 0x6C) /* set font using struct consolefontdesc */ 12 + #define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ 13 + #define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ 15 14 struct consolefontdesc { 16 15 unsigned short charcount; /* characters in font (256 or 512) */ 17 16 unsigned short charheight; /* scan lines per character (1-32) */ 18 17 char __user *chardata; /* font data in expanded form */ 19 18 }; 20 19 21 - #define PIO_FONTRESET _IO(KD_IOCTL_BASE, 0x6D) /* reset to default font */ 20 + #define PIO_FONTRESET 0x4B6D /* reset to default font */ 22 21 23 - #define GIO_CMAP _IO(KD_IOCTL_BASE, 0x70) /* gets colour palette on VGA+ */ 24 - #define PIO_CMAP _IO(KD_IOCTL_BASE, 0x71) /* sets colour palette on VGA+ */ 22 + #define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ 23 + #define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ 25 24 26 - #define KIOCSOUND _IO(KD_IOCTL_BASE, 0x2F) /* start sound generation (0 for off) */ 27 - #define KDMKTONE _IO(KD_IOCTL_BASE, 0x30) /* generate tone */ 25 + #define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 26 + #define KDMKTONE 0x4B30 /* generate tone */ 28 27 29 - #define KDGETLED _IO(KD_IOCTL_BASE, 0x31) /* return current led state */ 30 - #define KDSETLED _IO(KD_IOCTL_BASE, 0x32) /* set led state [lights, not flags] */ 28 + #define KDGETLED 0x4B31 /* return current led state */ 29 + #define KDSETLED 0x4B32 /* set led state [lights, not flags] */ 31 30 #define LED_SCR 0x01 /* scroll lock led */ 32 31 #define LED_NUM 0x02 /* num lock led */ 33 32 #define LED_CAP 0x04 /* caps lock led */ 34 33 35 - #define KDGKBTYPE _IO(KD_IOCTL_BASE, 0x33) /* get keyboard type */ 34 + #define KDGKBTYPE 0x4B33 /* get keyboard type */ 36 35 #define KB_84 0x01 37 36 #define KB_101 0x02 /* this is what we always answer */ 38 37 #define KB_OTHER 0x03 39 38 40 - #define KDADDIO _IO(KD_IOCTL_BASE, 0x34) /* add i/o port as valid */ 41 - #define KDDELIO _IO(KD_IOCTL_BASE, 0x35) /* del i/o port as valid */ 42 - #define KDENABIO _IO(KD_IOCTL_BASE, 0x36) /* enable i/o to video board */ 43 - #define KDDISABIO _IO(KD_IOCTL_BASE, 0x37) /* disable i/o to video board */ 39 + #define KDADDIO 0x4B34 /* add i/o port as valid */ 40 + #define KDDELIO 0x4B35 /* del i/o port as valid */ 41 + #define KDENABIO 0x4B36 /* enable i/o to video board */ 42 + #define KDDISABIO 0x4B37 /* disable i/o to video board */ 44 43 45 - #define KDSETMODE _IO(KD_IOCTL_BASE, 0x3A) /* set text/graphics mode */ 44 + #define KDSETMODE 0x4B3A /* set text/graphics mode */ 46 45 #define KD_TEXT 0x00 47 46 #define KD_GRAPHICS 0x01 48 47 #define KD_TEXT0 0x02 /* obsolete */ 49 48 #define KD_TEXT1 0x03 /* obsolete */ 50 - #define KDGETMODE _IO(KD_IOCTL_BASE, 0x3B) /* get current mode */ 49 + #define KDGETMODE 0x4B3B /* get current mode */ 51 50 52 - #define KDMAPDISP _IO(KD_IOCTL_BASE, 0x3C) /* map display into address space */ 53 - #define KDUNMAPDISP _IO(KD_IOCTL_BASE, 0x3D) /* unmap display from address space */ 51 + #define KDMAPDISP 0x4B3C /* map display into address space */ 52 + #define KDUNMAPDISP 0x4B3D /* unmap display from address space */ 54 53 55 54 typedef char scrnmap_t; 56 55 #define E_TABSZ 256 57 - #define GIO_SCRNMAP _IO(KD_IOCTL_BASE, 0x40) /* get screen mapping from kernel */ 58 - #define PIO_SCRNMAP _IO(KD_IOCTL_BASE, 0x41) /* put screen mapping table in kernel */ 59 - #define GIO_UNISCRNMAP _IO(KD_IOCTL_BASE, 0x69) /* get full Unicode screen mapping */ 60 - #define PIO_UNISCRNMAP _IO(KD_IOCTL_BASE, 0x6A) /* set full Unicode screen mapping */ 56 + #define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ 57 + #define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ 58 + #define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ 59 + #define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ 61 60 62 - #define GIO_UNIMAP _IO(KD_IOCTL_BASE, 0x66) /* get unicode-to-font mapping from kernel */ 61 + #define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ 63 62 struct unipair { 64 63 unsigned short unicode; 65 64 unsigned short fontpos; ··· 67 68 unsigned short entry_ct; 68 69 struct unipair __user *entries; 69 70 }; 70 - #define PIO_UNIMAP _IO(KD_IOCTL_BASE, 0x67) /* put unicode-to-font mapping in kernel */ 71 - #define PIO_UNIMAPCLR _IO(KD_IOCTL_BASE, 0x68) /* clear table, possibly advise hash algorithm */ 71 + #define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ 72 + #define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ 72 73 struct unimapinit { 73 74 unsigned short advised_hashsize; /* 0 if no opinion */ 74 75 unsigned short advised_hashstep; /* 0 if no opinion */ ··· 83 84 #define K_MEDIUMRAW 0x02 84 85 #define K_UNICODE 0x03 85 86 #define K_OFF 0x04 86 - #define KDGKBMODE _IO(KD_IOCTL_BASE, 0x44) /* gets current keyboard mode */ 87 - #define KDSKBMODE _IO(KD_IOCTL_BASE, 0x45) /* sets current keyboard mode */ 87 + #define KDGKBMODE 0x4B44 /* gets current keyboard mode */ 88 + #define KDSKBMODE 0x4B45 /* sets current keyboard mode */ 88 89 89 90 #define K_METABIT 0x03 90 91 #define K_ESCPREFIX 0x04 91 - #define KDGKBMETA _IO(KD_IOCTL_BASE, 0x62) /* gets meta key handling mode */ 92 - #define KDSKBMETA _IO(KD_IOCTL_BASE, 0x63) /* sets meta key handling mode */ 92 + #define KDGKBMETA 0x4B62 /* gets meta key handling mode */ 93 + #define KDSKBMETA 0x4B63 /* sets meta key handling mode */ 93 94 94 95 #define K_SCROLLLOCK 0x01 95 96 #define K_NUMLOCK 0x02 96 97 #define K_CAPSLOCK 0x04 97 - #define KDGKBLED _IO(KD_IOCTL_BASE, 0x64) /* get led flags (not lights) */ 98 - #define KDSKBLED _IO(KD_IOCTL_BASE, 0x65) /* set led flags (not lights) */ 98 + #define KDGKBLED 0x4B64 /* get led flags (not lights) */ 99 + #define KDSKBLED 0x4B65 /* set led flags (not lights) */ 99 100 100 101 struct kbentry { 101 102 unsigned char kb_table; ··· 107 108 #define K_ALTTAB 0x02 108 109 #define K_ALTSHIFTTAB 0x03 109 110 110 - #define KDGKBENT _IO(KD_IOCTL_BASE, 0x46) /* gets one entry in translation table */ 111 - #define KDSKBENT _IO(KD_IOCTL_BASE, 0x47) /* sets one entry in translation table */ 111 + #define KDGKBENT 0x4B46 /* gets one entry in translation table */ 112 + #define KDSKBENT 0x4B47 /* sets one entry in translation table */ 112 113 113 114 struct kbsentry { 114 115 unsigned char kb_func; 115 116 unsigned char kb_string[512]; 116 117 }; 117 - #define KDGKBSENT _IO(KD_IOCTL_BASE, 0x48) /* gets one function key string entry */ 118 - #define KDSKBSENT _IO(KD_IOCTL_BASE, 0x49) /* sets one function key string entry */ 118 + #define KDGKBSENT 0x4B48 /* gets one function key string entry */ 119 + #define KDSKBSENT 0x4B49 /* sets one function key string entry */ 119 120 120 121 struct kbdiacr { 121 122 unsigned char diacr, base, result; ··· 124 125 unsigned int kb_cnt; /* number of entries in following array */ 125 126 struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */ 126 127 }; 127 - #define KDGKBDIACR _IO(KD_IOCTL_BASE, 0x4A) /* read kernel accent table */ 128 - #define KDSKBDIACR _IO(KD_IOCTL_BASE, 0x4B) /* write kernel accent table */ 128 + #define KDGKBDIACR 0x4B4A /* read kernel accent table */ 129 + #define KDSKBDIACR 0x4B4B /* write kernel accent table */ 129 130 130 131 struct kbdiacruc { 131 132 unsigned int diacr, base, result; ··· 134 135 unsigned int kb_cnt; /* number of entries in following array */ 135 136 struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */ 136 137 }; 137 - #define KDGKBDIACRUC _IO(KD_IOCTL_BASE, 0xFA) /* read kernel accent table - UCS */ 138 - #define KDSKBDIACRUC _IO(KD_IOCTL_BASE, 0xFB) /* write kernel accent table - UCS */ 138 + #define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */ 139 + #define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */ 139 140 140 141 struct kbkeycode { 141 142 unsigned int scancode, keycode; 142 143 }; 143 - #define KDGETKEYCODE _IO(KD_IOCTL_BASE, 0x4C) /* read kernel keycode table entry */ 144 - #define KDSETKEYCODE _IO(KD_IOCTL_BASE, 0x4D) /* write kernel keycode table entry */ 144 + #define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */ 145 + #define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ 145 146 146 - #define KDSIGACCEPT _IO(KD_IOCTL_BASE, 0x4E) /* accept kbd generated signals */ 147 + #define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ 147 148 148 149 struct kbd_repeat { 149 150 int delay; /* in msec; <= 0: don't change */ ··· 151 152 /* earlier this field was misnamed "rate" */ 152 153 }; 153 154 154 - #define KDKBDREP _IO(KD_IOCTL_BASE, 0x52) /* set keyboard delay/repeat rate; 155 - * actually used values are returned 156 - */ 155 + #define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate; 156 + * actually used values are returned */ 157 157 158 - #define KDFONTOP _IO(KD_IOCTL_BASE, 0x72) /* font operations */ 158 + #define KDFONTOP 0x4B72 /* font operations */ 159 159 160 160 struct console_font_op { 161 161 unsigned int op; /* operation code KD_FONT_OP_* */
+1
include/uapi/linux/netdev.h
··· 148 148 NETDEV_A_QSTATS_RX_ALLOC_FAIL, 149 149 NETDEV_A_QSTATS_RX_HW_DROPS, 150 150 NETDEV_A_QSTATS_RX_HW_DROP_OVERRUNS, 151 + NETDEV_A_QSTATS_RX_CSUM_COMPLETE, 151 152 NETDEV_A_QSTATS_RX_CSUM_UNNECESSARY, 152 153 NETDEV_A_QSTATS_RX_CSUM_NONE, 153 154 NETDEV_A_QSTATS_RX_CSUM_BAD,
+3 -2
io_uring/memmap.c
··· 244 244 struct io_ring_ctx *ctx = file->private_data; 245 245 size_t sz = vma->vm_end - vma->vm_start; 246 246 long offset = vma->vm_pgoff << PAGE_SHIFT; 247 + unsigned int npages; 247 248 void *ptr; 248 249 249 250 ptr = io_uring_validate_mmap_request(file, vma->vm_pgoff, sz); ··· 254 253 switch (offset & IORING_OFF_MMAP_MASK) { 255 254 case IORING_OFF_SQ_RING: 256 255 case IORING_OFF_CQ_RING: 257 - return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, 258 - ctx->n_ring_pages); 256 + npages = min(ctx->n_ring_pages, (sz + PAGE_SIZE - 1) >> PAGE_SHIFT); 257 + return io_uring_mmap_pages(ctx, vma, ctx->ring_pages, npages); 259 258 case IORING_OFF_SQES: 260 259 return io_uring_mmap_pages(ctx, vma, ctx->sqe_pages, 261 260 ctx->n_sqe_pages);
+3 -3
io_uring/net.c
··· 1127 1127 flags |= MSG_DONTWAIT; 1128 1128 1129 1129 retry_multishot: 1130 + kmsg->msg.msg_inq = -1; 1131 + kmsg->msg.msg_flags = 0; 1132 + 1130 1133 if (io_do_buffer_select(req)) { 1131 1134 ret = io_recv_buf_select(req, kmsg, &len, issue_flags); 1132 1135 if (unlikely(ret)) 1133 1136 goto out_free; 1134 1137 sr->buf = NULL; 1135 1138 } 1136 - 1137 - kmsg->msg.msg_inq = -1; 1138 - kmsg->msg.msg_flags = 0; 1139 1139 1140 1140 if (flags & MSG_WAITALL) 1141 1141 min_ret = iov_iter_count(&kmsg->msg.msg_iter);
+5
io_uring/opdef.c
··· 516 516 }, 517 517 [IORING_OP_READ_FIXED] = { 518 518 .name = "READ_FIXED", 519 + .cleanup = io_readv_writev_cleanup, 519 520 .fail = io_rw_fail, 520 521 }, 521 522 [IORING_OP_WRITE_FIXED] = { 522 523 .name = "WRITE_FIXED", 524 + .cleanup = io_readv_writev_cleanup, 523 525 .fail = io_rw_fail, 524 526 }, 525 527 [IORING_OP_POLL_ADD] = { ··· 584 582 }, 585 583 [IORING_OP_READ] = { 586 584 .name = "READ", 585 + .cleanup = io_readv_writev_cleanup, 587 586 .fail = io_rw_fail, 588 587 }, 589 588 [IORING_OP_WRITE] = { 590 589 .name = "WRITE", 590 + .cleanup = io_readv_writev_cleanup, 591 591 .fail = io_rw_fail, 592 592 }, 593 593 [IORING_OP_FADVISE] = { ··· 696 692 }, 697 693 [IORING_OP_READ_MULTISHOT] = { 698 694 .name = "READ_MULTISHOT", 695 + .cleanup = io_readv_writev_cleanup, 699 696 }, 700 697 [IORING_OP_WAITID] = { 701 698 .name = "WAITID",
+7 -3
kernel/bpf/verifier.c
··· 8882 8882 enum bpf_attach_type eatype = env->prog->expected_attach_type; 8883 8883 enum bpf_prog_type type = resolve_prog_type(env->prog); 8884 8884 8885 - if (func_id != BPF_FUNC_map_update_elem) 8885 + if (func_id != BPF_FUNC_map_update_elem && 8886 + func_id != BPF_FUNC_map_delete_elem) 8886 8887 return false; 8887 8888 8888 8889 /* It's not possible to get access to a locked struct sock in these ··· 8892 8891 switch (type) { 8893 8892 case BPF_PROG_TYPE_TRACING: 8894 8893 if (eatype == BPF_TRACE_ITER) 8894 + return true; 8895 + break; 8896 + case BPF_PROG_TYPE_SOCK_OPS: 8897 + /* map_update allowed only via dedicated helpers with event type checks */ 8898 + if (func_id == BPF_FUNC_map_delete_elem) 8895 8899 return true; 8896 8900 break; 8897 8901 case BPF_PROG_TYPE_SOCKET_FILTER: ··· 8994 8988 case BPF_MAP_TYPE_SOCKMAP: 8995 8989 if (func_id != BPF_FUNC_sk_redirect_map && 8996 8990 func_id != BPF_FUNC_sock_map_update && 8997 - func_id != BPF_FUNC_map_delete_elem && 8998 8991 func_id != BPF_FUNC_msg_redirect_map && 8999 8992 func_id != BPF_FUNC_sk_select_reuseport && 9000 8993 func_id != BPF_FUNC_map_lookup_elem && ··· 9003 8998 case BPF_MAP_TYPE_SOCKHASH: 9004 8999 if (func_id != BPF_FUNC_sk_redirect_hash && 9005 9000 func_id != BPF_FUNC_sock_hash_update && 9006 - func_id != BPF_FUNC_map_delete_elem && 9007 9001 func_id != BPF_FUNC_msg_redirect_hash && 9008 9002 func_id != BPF_FUNC_sk_select_reuseport && 9009 9003 func_id != BPF_FUNC_map_lookup_elem &&
+16 -9
kernel/dma/map_benchmark.c
··· 101 101 struct task_struct **tsk; 102 102 int threads = map->bparam.threads; 103 103 int node = map->bparam.node; 104 - const cpumask_t *cpu_mask = cpumask_of_node(node); 105 104 u64 loops; 106 105 int ret = 0; 107 106 int i; ··· 117 118 if (IS_ERR(tsk[i])) { 118 119 pr_err("create dma_map thread failed\n"); 119 120 ret = PTR_ERR(tsk[i]); 121 + while (--i >= 0) 122 + kthread_stop(tsk[i]); 120 123 goto out; 121 124 } 122 125 123 126 if (node != NUMA_NO_NODE) 124 - kthread_bind_mask(tsk[i], cpu_mask); 127 + kthread_bind_mask(tsk[i], cpumask_of_node(node)); 125 128 } 126 129 127 130 /* clear the old value in the previous benchmark */ ··· 140 139 141 140 msleep_interruptible(map->bparam.seconds * 1000); 142 141 143 - /* wait for the completion of benchmark threads */ 142 + /* wait for the completion of all started benchmark threads */ 144 143 for (i = 0; i < threads; i++) { 145 - ret = kthread_stop(tsk[i]); 146 - if (ret) 147 - goto out; 144 + int kthread_ret = kthread_stop_put(tsk[i]); 145 + 146 + if (kthread_ret) 147 + ret = kthread_ret; 148 148 } 149 + 150 + if (ret) 151 + goto out; 149 152 150 153 loops = atomic64_read(&map->loops); 151 154 if (likely(loops > 0)) { ··· 175 170 } 176 171 177 172 out: 178 - for (i = 0; i < threads; i++) 179 - put_task_struct(tsk[i]); 180 173 put_device(map->dev); 181 174 kfree(tsk); 182 175 return ret; ··· 211 208 } 212 209 213 210 if (map->bparam.node != NUMA_NO_NODE && 214 - !node_possible(map->bparam.node)) { 211 + (map->bparam.node < 0 || map->bparam.node >= MAX_NUMNODES || 212 + !node_possible(map->bparam.node))) { 215 213 pr_err("invalid numa node\n"); 216 214 return -EINVAL; 217 215 } ··· 256 252 * dma_mask changed by benchmark 257 253 */ 258 254 dma_set_mask(map->dev, old_dma_mask); 255 + 256 + if (ret) 257 + return ret; 259 258 break; 260 259 default: 261 260 return -EINVAL;
+7 -2
kernel/gen_kheaders.sh
··· 14 14 arch/$SRCARCH/include/ 15 15 " 16 16 17 - type cpio > /dev/null 17 + if ! command -v cpio >/dev/null; then 18 + echo >&2 "***" 19 + echo >&2 "*** 'cpio' could not be found." 20 + echo >&2 "***" 21 + exit 1 22 + fi 18 23 19 24 # Support incremental builds by skipping archive generation 20 25 # if timestamps of files being archived are not changed. ··· 89 84 90 85 # Create archive and try to normalize metadata for reproducibility. 91 86 tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ 92 - --owner=0 --group=0 --sort=name --numeric-owner \ 87 + --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \ 93 88 -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null 94 89 95 90 echo $headers_md5 > kernel/kheaders.md5
+1 -1
kernel/power/swap.c
··· 1595 1595 1596 1596 put: 1597 1597 if (error) 1598 - fput(hib_resume_bdev_file); 1598 + bdev_fput(hib_resume_bdev_file); 1599 1599 else 1600 1600 pr_debug("Image signature found, resuming\n"); 1601 1601 } else {
+4 -6
kernel/trace/bpf_trace.c
··· 3295 3295 struct bpf_run_ctx *old_run_ctx; 3296 3296 int err = 0; 3297 3297 3298 - if (link->task && current != link->task) 3298 + if (link->task && current->mm != link->task->mm) 3299 3299 return 0; 3300 3300 3301 3301 if (sleepable) ··· 3396 3396 upath = u64_to_user_ptr(attr->link_create.uprobe_multi.path); 3397 3397 uoffsets = u64_to_user_ptr(attr->link_create.uprobe_multi.offsets); 3398 3398 cnt = attr->link_create.uprobe_multi.cnt; 3399 + pid = attr->link_create.uprobe_multi.pid; 3399 3400 3400 - if (!upath || !uoffsets || !cnt) 3401 + if (!upath || !uoffsets || !cnt || pid < 0) 3401 3402 return -EINVAL; 3402 3403 if (cnt > MAX_UPROBE_MULTI_CNT) 3403 3404 return -E2BIG; ··· 3422 3421 goto error_path_put; 3423 3422 } 3424 3423 3425 - pid = attr->link_create.uprobe_multi.pid; 3426 3424 if (pid) { 3427 - rcu_read_lock(); 3428 - task = get_pid_task(find_vpid(pid), PIDTYPE_PID); 3429 - rcu_read_unlock(); 3425 + task = get_pid_task(find_vpid(pid), PIDTYPE_TGID); 3430 3426 if (!task) { 3431 3427 err = -ESRCH; 3432 3428 goto error_path_put;
+4
kernel/trace/trace_probe.c
··· 554 554 anon_offs = 0; 555 555 field = btf_find_struct_member(ctx->btf, type, fieldname, 556 556 &anon_offs); 557 + if (IS_ERR(field)) { 558 + trace_probe_log_err(ctx->offset, BAD_BTF_TID); 559 + return PTR_ERR(field); 560 + } 557 561 if (!field) { 558 562 trace_probe_log_err(ctx->offset, NO_BTF_FIELD); 559 563 return -ENOENT;
+9 -5
kernel/trace/trace_uprobe.c
··· 970 970 971 971 static void __uprobe_trace_func(struct trace_uprobe *tu, 972 972 unsigned long func, struct pt_regs *regs, 973 - struct uprobe_cpu_buffer **ucbp, 973 + struct uprobe_cpu_buffer *ucb, 974 974 struct trace_event_file *trace_file) 975 975 { 976 976 struct uprobe_trace_entry_head *entry; 977 977 struct trace_event_buffer fbuffer; 978 - struct uprobe_cpu_buffer *ucb; 979 978 void *data; 980 979 int size, esize; 981 980 struct trace_event_call *call = trace_probe_event_call(&tu->tp); 982 981 983 982 WARN_ON(call != trace_file->event_call); 984 983 985 - ucb = prepare_uprobe_buffer(tu, regs, ucbp); 986 984 if (WARN_ON_ONCE(ucb->dsize > PAGE_SIZE)) 987 985 return; 988 986 ··· 1012 1014 struct uprobe_cpu_buffer **ucbp) 1013 1015 { 1014 1016 struct event_file_link *link; 1017 + struct uprobe_cpu_buffer *ucb; 1015 1018 1016 1019 if (is_ret_probe(tu)) 1017 1020 return 0; 1018 1021 1022 + ucb = prepare_uprobe_buffer(tu, regs, ucbp); 1023 + 1019 1024 rcu_read_lock(); 1020 1025 trace_probe_for_each_link_rcu(link, &tu->tp) 1021 - __uprobe_trace_func(tu, 0, regs, ucbp, link->file); 1026 + __uprobe_trace_func(tu, 0, regs, ucb, link->file); 1022 1027 rcu_read_unlock(); 1023 1028 1024 1029 return 0; ··· 1032 1031 struct uprobe_cpu_buffer **ucbp) 1033 1032 { 1034 1033 struct event_file_link *link; 1034 + struct uprobe_cpu_buffer *ucb; 1035 + 1036 + ucb = prepare_uprobe_buffer(tu, regs, ucbp); 1035 1037 1036 1038 rcu_read_lock(); 1037 1039 trace_probe_for_each_link_rcu(link, &tu->tp) 1038 - __uprobe_trace_func(tu, func, regs, ucbp, link->file); 1040 + __uprobe_trace_func(tu, func, regs, ucb, link->file); 1039 1041 rcu_read_unlock(); 1040 1042 } 1041 1043
-3
lib/fortify_kunit.c
··· 236 236 kfree(p)); \ 237 237 checker(expected_size, __kmalloc(alloc_size, gfp), \ 238 238 kfree(p)); \ 239 - checker(expected_size, \ 240 - __kmalloc_node(alloc_size, gfp, NUMA_NO_NODE), \ 241 - kfree(p)); \ 242 239 \ 243 240 orig = kmalloc(alloc_size, gfp); \ 244 241 KUNIT_EXPECT_TRUE(test, orig != NULL); \
+2
net/9p/client.c
··· 236 236 if (!fc->sdata) 237 237 return -ENOMEM; 238 238 fc->capacity = alloc_msize; 239 + fc->id = 0; 240 + fc->tag = P9_NOTAG; 239 241 return 0; 240 242 } 241 243
+10 -12
net/core/sock_map.c
··· 423 423 struct sock *sk; 424 424 int err = 0; 425 425 426 - if (irqs_disabled()) 427 - return -EOPNOTSUPP; /* locks here are hardirq-unsafe */ 428 - 429 426 spin_lock_bh(&stab->lock); 430 427 sk = *psk; 431 428 if (!sk_test || sk_test == sk) ··· 944 947 struct bpf_shtab_bucket *bucket; 945 948 struct bpf_shtab_elem *elem; 946 949 int ret = -ENOENT; 947 - 948 - if (irqs_disabled()) 949 - return -EOPNOTSUPP; /* locks here are hardirq-unsafe */ 950 950 951 951 hash = sock_hash_bucket_hash(key, key_size); 952 952 bucket = sock_hash_select_bucket(htab, hash); ··· 1674 1680 1675 1681 lock_sock(sk); 1676 1682 rcu_read_lock(); 1677 - psock = sk_psock_get(sk); 1678 - if (unlikely(!psock)) { 1679 - rcu_read_unlock(); 1680 - release_sock(sk); 1681 - saved_close = READ_ONCE(sk->sk_prot)->close; 1682 - } else { 1683 + psock = sk_psock(sk); 1684 + if (likely(psock)) { 1683 1685 saved_close = psock->saved_close; 1684 1686 sock_map_remove_links(sk, psock); 1687 + psock = sk_psock_get(sk); 1688 + if (unlikely(!psock)) 1689 + goto no_psock; 1685 1690 rcu_read_unlock(); 1686 1691 sk_psock_stop(psock); 1687 1692 release_sock(sk); 1688 1693 cancel_delayed_work_sync(&psock->work); 1689 1694 sk_psock_put(sk, psock); 1695 + } else { 1696 + saved_close = READ_ONCE(sk->sk_prot)->close; 1697 + no_psock: 1698 + rcu_read_unlock(); 1699 + release_sock(sk); 1690 1700 } 1691 1701 1692 1702 /* Make sure we do not recurse. This is a bug.
+1 -3
net/ethernet/eth.c
··· 161 161 skb->dev = dev; 162 162 skb_reset_mac_header(skb); 163 163 164 - eth = (struct ethhdr *)skb->data; 165 - skb_pull_inline(skb, ETH_HLEN); 166 - 164 + eth = eth_skb_pull_mac(skb); 167 165 eth_skb_pkt_type(skb, dev); 168 166 169 167 /*
+1 -1
net/ipv4/af_inet.c
··· 1532 1532 } 1533 1533 1534 1534 NAPI_GRO_CB(skb)->flush |= flush; 1535 - NAPI_GRO_CB(skb)->inner_network_offset = off; 1535 + NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark] = off; 1536 1536 1537 1537 /* Note : No need to call skb_gro_postpull_rcsum() here, 1538 1538 * as we already checked checksum over ipv4 header was 0
+4 -3
net/ipv4/devinet.c
··· 1887 1887 goto done; 1888 1888 1889 1889 if (fillargs.ifindex) { 1890 - err = -ENODEV; 1891 1890 dev = dev_get_by_index_rcu(tgt_net, fillargs.ifindex); 1892 - if (!dev) 1891 + if (!dev) { 1892 + err = -ENODEV; 1893 1893 goto done; 1894 + } 1894 1895 in_dev = __in_dev_get_rcu(dev); 1895 1896 if (!in_dev) 1896 1897 goto done; ··· 1903 1902 1904 1903 cb->seq = inet_base_seq(tgt_net); 1905 1904 1906 - for_each_netdev_dump(net, dev, ctx->ifindex) { 1905 + for_each_netdev_dump(tgt_net, dev, ctx->ifindex) { 1907 1906 in_dev = __in_dev_get_rcu(dev); 1908 1907 if (!in_dev) 1909 1908 continue;
+2
net/ipv4/netfilter/nf_tproxy_ipv4.c
··· 58 58 59 59 laddr = 0; 60 60 indev = __in_dev_get_rcu(skb->dev); 61 + if (!indev) 62 + return daddr; 61 63 62 64 in_dev_for_each_ifa_rcu(ifa, indev) { 63 65 if (ifa->ifa_flags & IFA_F_SECONDARY)
+8 -14
net/ipv4/route.c
··· 129 129 static unsigned int ipv4_default_advmss(const struct dst_entry *dst); 130 130 INDIRECT_CALLABLE_SCOPE 131 131 unsigned int ipv4_mtu(const struct dst_entry *dst); 132 - static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); 132 + static void ipv4_negative_advice(struct sock *sk, 133 + struct dst_entry *dst); 133 134 static void ipv4_link_failure(struct sk_buff *skb); 134 135 static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, 135 136 struct sk_buff *skb, u32 mtu, ··· 826 825 __ip_do_redirect(rt, skb, &fl4, true); 827 826 } 828 827 829 - static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) 828 + static void ipv4_negative_advice(struct sock *sk, 829 + struct dst_entry *dst) 830 830 { 831 831 struct rtable *rt = dst_rtable(dst); 832 - struct dst_entry *ret = dst; 833 832 834 - if (rt) { 835 - if (dst->obsolete > 0) { 836 - ip_rt_put(rt); 837 - ret = NULL; 838 - } else if ((rt->rt_flags & RTCF_REDIRECTED) || 839 - rt->dst.expires) { 840 - ip_rt_put(rt); 841 - ret = NULL; 842 - } 843 - } 844 - return ret; 833 + if ((dst->obsolete > 0) || 834 + (rt->rt_flags & RTCF_REDIRECTED) || 835 + rt->dst.expires) 836 + sk_dst_reset(sk); 845 837 } 846 838 847 839 /*
+1 -6
net/ipv4/tcp_ipv4.c
··· 1144 1144 #endif 1145 1145 } 1146 1146 1147 - /* RFC 7323 2.3 1148 - * The window field (SEG.WND) of every outgoing segment, with the 1149 - * exception of <SYN> segments, MUST be right-shifted by 1150 - * Rcv.Wind.Shift bits: 1151 - */ 1152 1147 tcp_v4_send_ack(sk, skb, seq, 1153 1148 tcp_rsk(req)->rcv_nxt, 1154 - req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, 1149 + tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale, 1155 1150 tcp_rsk_tsval(tcp_rsk(req)), 1156 1151 READ_ONCE(req->ts_recent), 1157 1152 0, &key,
+5 -2
net/ipv4/tcp_minisocks.c
··· 783 783 784 784 /* RFC793: "first check sequence number". */ 785 785 786 - if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq, 787 - tcp_rsk(req)->rcv_nxt, tcp_rsk(req)->rcv_nxt + req->rsk_rcv_wnd)) { 786 + if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq, 787 + TCP_SKB_CB(skb)->end_seq, 788 + tcp_rsk(req)->rcv_nxt, 789 + tcp_rsk(req)->rcv_nxt + 790 + tcp_synack_window(req))) { 788 791 /* Out of window: send ACK and drop. */ 789 792 if (!(flg & TCP_FLAG_RST) && 790 793 !tcp_oow_rate_limited(sock_net(sk), skb,
+1 -1
net/ipv6/ip6_offload.c
··· 236 236 if (unlikely(!iph)) 237 237 goto out; 238 238 239 - NAPI_GRO_CB(skb)->inner_network_offset = off; 239 + NAPI_GRO_CB(skb)->network_offsets[NAPI_GRO_CB(skb)->encap_mark] = off; 240 240 241 241 flush += ntohs(iph->payload_len) != skb->len - hlen; 242 242
+15 -14
net/ipv6/route.c
··· 87 87 static unsigned int ip6_default_advmss(const struct dst_entry *dst); 88 88 INDIRECT_CALLABLE_SCOPE 89 89 unsigned int ip6_mtu(const struct dst_entry *dst); 90 - static struct dst_entry *ip6_negative_advice(struct dst_entry *); 90 + static void ip6_negative_advice(struct sock *sk, 91 + struct dst_entry *dst); 91 92 static void ip6_dst_destroy(struct dst_entry *); 92 93 static void ip6_dst_ifdown(struct dst_entry *, 93 94 struct net_device *dev); ··· 2771 2770 } 2772 2771 EXPORT_INDIRECT_CALLABLE(ip6_dst_check); 2773 2772 2774 - static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) 2773 + static void ip6_negative_advice(struct sock *sk, 2774 + struct dst_entry *dst) 2775 2775 { 2776 2776 struct rt6_info *rt = dst_rt6_info(dst); 2777 2777 2778 - if (rt) { 2779 - if (rt->rt6i_flags & RTF_CACHE) { 2780 - rcu_read_lock(); 2781 - if (rt6_check_expired(rt)) { 2782 - rt6_remove_exception_rt(rt); 2783 - dst = NULL; 2784 - } 2785 - rcu_read_unlock(); 2786 - } else { 2787 - dst_release(dst); 2788 - dst = NULL; 2778 + if (rt->rt6i_flags & RTF_CACHE) { 2779 + rcu_read_lock(); 2780 + if (rt6_check_expired(rt)) { 2781 + /* counteract the dst_release() in sk_dst_reset() */ 2782 + dst_hold(dst); 2783 + sk_dst_reset(sk); 2784 + 2785 + rt6_remove_exception_rt(rt); 2789 2786 } 2787 + rcu_read_unlock(); 2788 + return; 2790 2789 } 2791 - return dst; 2790 + sk_dst_reset(sk); 2792 2791 } 2793 2792 2794 2793 static void ip6_link_failure(struct sk_buff *skb)
+1 -6
net/ipv6/tcp_ipv6.c
··· 1272 1272 /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV 1273 1273 * sk->sk_state == TCP_SYN_RECV -> for Fast Open. 1274 1274 */ 1275 - /* RFC 7323 2.3 1276 - * The window field (SEG.WND) of every outgoing segment, with the 1277 - * exception of <SYN> segments, MUST be right-shifted by 1278 - * Rcv.Wind.Shift bits: 1279 - */ 1280 1275 tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ? 1281 1276 tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, 1282 1277 tcp_rsk(req)->rcv_nxt, 1283 - req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale, 1278 + tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale, 1284 1279 tcp_rsk_tsval(tcp_rsk(req)), 1285 1280 READ_ONCE(req->ts_recent), sk->sk_bound_dev_if, 1286 1281 &key, ipv6_get_dsfield(ipv6_hdr(skb)), 0,
+3
net/netfilter/ipset/ip_set_list_set.c
··· 549 549 550 550 if (SET_WITH_TIMEOUT(set)) 551 551 timer_shutdown_sync(&map->gc); 552 + 553 + /* Flush list to drop references to other ipsets */ 554 + list_set_flush(set); 552 555 } 553 556 554 557 static const struct ip_set_type_variant set_variant = {
+3 -5
net/netfilter/nft_fib.c
··· 35 35 switch (priv->result) { 36 36 case NFT_FIB_RESULT_OIF: 37 37 case NFT_FIB_RESULT_OIFNAME: 38 - hooks = (1 << NF_INET_PRE_ROUTING); 39 - if (priv->flags & NFTA_FIB_F_IIF) { 40 - hooks |= (1 << NF_INET_LOCAL_IN) | 41 - (1 << NF_INET_FORWARD); 42 - } 38 + hooks = (1 << NF_INET_PRE_ROUTING) | 39 + (1 << NF_INET_LOCAL_IN) | 40 + (1 << NF_INET_FORWARD); 43 41 break; 44 42 case NFT_FIB_RESULT_ADDRTYPE: 45 43 if (priv->flags & NFTA_FIB_F_IIF)
+72 -23
net/netfilter/nft_payload.c
··· 45 45 int mac_off = skb_mac_header(skb) - skb->data; 46 46 u8 *vlanh, *dst_u8 = (u8 *) d; 47 47 struct vlan_ethhdr veth; 48 - u8 vlan_hlen = 0; 49 - 50 - if ((skb->protocol == htons(ETH_P_8021AD) || 51 - skb->protocol == htons(ETH_P_8021Q)) && 52 - offset >= VLAN_ETH_HLEN && offset < VLAN_ETH_HLEN + VLAN_HLEN) 53 - vlan_hlen += VLAN_HLEN; 54 48 55 49 vlanh = (u8 *) &veth; 56 - if (offset < VLAN_ETH_HLEN + vlan_hlen) { 50 + if (offset < VLAN_ETH_HLEN) { 57 51 u8 ethlen = len; 58 52 59 - if (vlan_hlen && 60 - skb_copy_bits(skb, mac_off, &veth, VLAN_ETH_HLEN) < 0) 61 - return false; 62 - else if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth)) 53 + if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth)) 63 54 return false; 64 55 65 - if (offset + len > VLAN_ETH_HLEN + vlan_hlen) 66 - ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen; 56 + if (offset + len > VLAN_ETH_HLEN) 57 + ethlen -= offset + len - VLAN_ETH_HLEN; 67 58 68 - memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen); 59 + memcpy(dst_u8, vlanh + offset, ethlen); 69 60 70 61 len -= ethlen; 71 62 if (len == 0) 72 63 return true; 73 64 74 65 dst_u8 += ethlen; 75 - offset = ETH_HLEN + vlan_hlen; 66 + offset = ETH_HLEN; 76 67 } else { 77 - offset -= VLAN_HLEN + vlan_hlen; 68 + offset -= VLAN_HLEN; 78 69 } 79 70 80 71 return skb_copy_bits(skb, offset + mac_off, dst_u8, len) == 0; ··· 145 154 return pkt->inneroff; 146 155 } 147 156 148 - static bool nft_payload_need_vlan_copy(const struct nft_payload *priv) 157 + static bool nft_payload_need_vlan_adjust(u32 offset, u32 len) 149 158 { 150 - unsigned int len = priv->offset + priv->len; 159 + unsigned int boundary = offset + len; 151 160 152 161 /* data past ether src/dst requested, copy needed */ 153 - if (len > offsetof(struct ethhdr, h_proto)) 162 + if (boundary > offsetof(struct ethhdr, h_proto)) 154 163 return true; 155 164 156 165 return false; ··· 174 183 goto err; 175 184 176 185 if (skb_vlan_tag_present(skb) && 177 - nft_payload_need_vlan_copy(priv)) { 186 + nft_payload_need_vlan_adjust(priv->offset, priv->len)) { 178 187 if (!nft_payload_copy_vlan(dest, skb, 179 188 priv->offset, priv->len)) 180 189 goto err; ··· 801 810 u8 csum_flags; 802 811 }; 803 812 813 + /* This is not struct vlan_hdr. */ 814 + struct nft_payload_vlan_hdr { 815 + __be16 h_vlan_proto; 816 + __be16 h_vlan_TCI; 817 + }; 818 + 819 + static bool 820 + nft_payload_set_vlan(const u32 *src, struct sk_buff *skb, u8 offset, u8 len, 821 + int *vlan_hlen) 822 + { 823 + struct nft_payload_vlan_hdr *vlanh; 824 + __be16 vlan_proto; 825 + u16 vlan_tci; 826 + 827 + if (offset >= offsetof(struct vlan_ethhdr, h_vlan_encapsulated_proto)) { 828 + *vlan_hlen = VLAN_HLEN; 829 + return true; 830 + } 831 + 832 + switch (offset) { 833 + case offsetof(struct vlan_ethhdr, h_vlan_proto): 834 + if (len == 2) { 835 + vlan_proto = nft_reg_load_be16(src); 836 + skb->vlan_proto = vlan_proto; 837 + } else if (len == 4) { 838 + vlanh = (struct nft_payload_vlan_hdr *)src; 839 + __vlan_hwaccel_put_tag(skb, vlanh->h_vlan_proto, 840 + ntohs(vlanh->h_vlan_TCI)); 841 + } else { 842 + return false; 843 + } 844 + break; 845 + case offsetof(struct vlan_ethhdr, h_vlan_TCI): 846 + if (len != 2) 847 + return false; 848 + 849 + vlan_tci = ntohs(nft_reg_load_be16(src)); 850 + skb->vlan_tci = vlan_tci; 851 + break; 852 + default: 853 + return false; 854 + } 855 + 856 + return true; 857 + } 858 + 804 859 static void nft_payload_set_eval(const struct nft_expr *expr, 805 860 struct nft_regs *regs, 806 861 const struct nft_pktinfo *pkt) 807 862 { 808 863 const struct nft_payload_set *priv = nft_expr_priv(expr); 809 - struct sk_buff *skb = pkt->skb; 810 864 const u32 *src = &regs->data[priv->sreg]; 811 - int offset, csum_offset; 865 + int offset, csum_offset, vlan_hlen = 0; 866 + struct sk_buff *skb = pkt->skb; 812 867 __wsum fsum, tsum; 813 868 814 869 switch (priv->base) { 815 870 case NFT_PAYLOAD_LL_HEADER: 816 871 if (!skb_mac_header_was_set(skb)) 817 872 goto err; 818 - offset = skb_mac_header(skb) - skb->data; 873 + 874 + if (skb_vlan_tag_present(skb) && 875 + nft_payload_need_vlan_adjust(priv->offset, priv->len)) { 876 + if (!nft_payload_set_vlan(src, skb, 877 + priv->offset, priv->len, 878 + &vlan_hlen)) 879 + goto err; 880 + 881 + if (!vlan_hlen) 882 + return; 883 + } 884 + 885 + offset = skb_mac_header(skb) - skb->data - vlan_hlen; 819 886 break; 820 887 case NFT_PAYLOAD_NETWORK_HEADER: 821 888 offset = skb_network_offset(skb);
+8 -6
net/sched/sch_taprio.c
··· 1151 1151 list_for_each_entry(entry, &new->entries, list) 1152 1152 cycle = ktime_add_ns(cycle, entry->interval); 1153 1153 1154 - if (!cycle) { 1155 - NL_SET_ERR_MSG(extack, "'cycle_time' can never be 0"); 1156 - return -EINVAL; 1157 - } 1158 - 1159 1154 if (cycle < 0 || cycle > INT_MAX) { 1160 1155 NL_SET_ERR_MSG(extack, "'cycle_time' is too big"); 1161 1156 return -EINVAL; 1162 1157 } 1163 1158 1164 1159 new->cycle_time = cycle; 1160 + } 1161 + 1162 + if (new->cycle_time < new->num_entries * length_to_duration(q, ETH_ZLEN)) { 1163 + NL_SET_ERR_MSG(extack, "'cycle_time' is too small"); 1164 + return -EINVAL; 1165 1165 } 1166 1166 1167 1167 taprio_calculate_gate_durations(q, new); ··· 1848 1848 } 1849 1849 q->flags = taprio_flags; 1850 1850 1851 + /* Needed for length_to_duration() during netlink attribute parsing */ 1852 + taprio_set_picos_per_byte(dev, q); 1853 + 1851 1854 err = taprio_parse_mqprio_opt(dev, mqprio, extack, q->flags); 1852 1855 if (err < 0) 1853 1856 return err; ··· 1910 1907 if (err < 0) 1911 1908 goto free_sched; 1912 1909 1913 - taprio_set_picos_per_byte(dev, q); 1914 1910 taprio_update_queue_max_sdu(q, new_admin, stab); 1915 1911 1916 1912 if (FULL_OFFLOAD_IS_ENABLED(q->flags))
+12 -7
net/unix/af_unix.c
··· 731 731 if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) 732 732 goto out; /* Only stream/seqpacket sockets accept */ 733 733 err = -EINVAL; 734 - if (!u->addr) 734 + if (!READ_ONCE(u->addr)) 735 735 goto out; /* No listens on an unbound socket */ 736 736 unix_state_lock(sk); 737 737 if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) ··· 1131 1131 1132 1132 static int unix_autobind(struct sock *sk) 1133 1133 { 1134 - unsigned int new_hash, old_hash = sk->sk_hash; 1135 1134 struct unix_sock *u = unix_sk(sk); 1135 + unsigned int new_hash, old_hash; 1136 1136 struct net *net = sock_net(sk); 1137 1137 struct unix_address *addr; 1138 1138 u32 lastnum, ordernum; ··· 1155 1155 addr->name->sun_family = AF_UNIX; 1156 1156 refcount_set(&addr->refcnt, 1); 1157 1157 1158 + old_hash = sk->sk_hash; 1158 1159 ordernum = get_random_u32(); 1159 1160 lastnum = ordernum & 0xFFFFF; 1160 1161 retry: ··· 1196 1195 { 1197 1196 umode_t mode = S_IFSOCK | 1198 1197 (SOCK_INODE(sk->sk_socket)->i_mode & ~current_umask()); 1199 - unsigned int new_hash, old_hash = sk->sk_hash; 1200 1198 struct unix_sock *u = unix_sk(sk); 1199 + unsigned int new_hash, old_hash; 1201 1200 struct net *net = sock_net(sk); 1202 1201 struct mnt_idmap *idmap; 1203 1202 struct unix_address *addr; ··· 1235 1234 if (u->addr) 1236 1235 goto out_unlock; 1237 1236 1237 + old_hash = sk->sk_hash; 1238 1238 new_hash = unix_bsd_hash(d_backing_inode(dentry)); 1239 1239 unix_table_double_lock(net, old_hash, new_hash); 1240 1240 u->path.mnt = mntget(parent.mnt); ··· 1263 1261 static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr, 1264 1262 int addr_len) 1265 1263 { 1266 - unsigned int new_hash, old_hash = sk->sk_hash; 1267 1264 struct unix_sock *u = unix_sk(sk); 1265 + unsigned int new_hash, old_hash; 1268 1266 struct net *net = sock_net(sk); 1269 1267 struct unix_address *addr; 1270 1268 int err; ··· 1282 1280 goto out_mutex; 1283 1281 } 1284 1282 1283 + old_hash = sk->sk_hash; 1285 1284 new_hash = unix_abstract_hash(addr->name, addr->len, sk->sk_type); 1286 1285 unix_table_double_lock(net, old_hash, new_hash); 1287 1286 ··· 1372 1369 1373 1370 if ((test_bit(SOCK_PASSCRED, &sock->flags) || 1374 1371 test_bit(SOCK_PASSPIDFD, &sock->flags)) && 1375 - !unix_sk(sk)->addr) { 1372 + !READ_ONCE(unix_sk(sk)->addr)) { 1376 1373 err = unix_autobind(sk); 1377 1374 if (err) 1378 1375 goto out; ··· 1484 1481 goto out; 1485 1482 1486 1483 if ((test_bit(SOCK_PASSCRED, &sock->flags) || 1487 - test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) { 1484 + test_bit(SOCK_PASSPIDFD, &sock->flags)) && 1485 + !READ_ONCE(u->addr)) { 1488 1486 err = unix_autobind(sk); 1489 1487 if (err) 1490 1488 goto out; ··· 1954 1950 } 1955 1951 1956 1952 if ((test_bit(SOCK_PASSCRED, &sock->flags) || 1957 - test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) { 1953 + test_bit(SOCK_PASSPIDFD, &sock->flags)) && 1954 + !READ_ONCE(u->addr)) { 1958 1955 err = unix_autobind(sk); 1959 1956 if (err) 1960 1957 goto out;
+3 -8
net/xfrm/xfrm_policy.c
··· 3910 3910 /* Impossible. Such dst must be popped before reaches point of failure. */ 3911 3911 } 3912 3912 3913 - static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst) 3913 + static void xfrm_negative_advice(struct sock *sk, struct dst_entry *dst) 3914 3914 { 3915 - if (dst) { 3916 - if (dst->obsolete) { 3917 - dst_release(dst); 3918 - dst = NULL; 3919 - } 3920 - } 3921 - return dst; 3915 + if (dst->obsolete) 3916 + sk_dst_reset(sk); 3922 3917 } 3923 3918 3924 3919 static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr)
+1 -1
scripts/dtc/Makefile
··· 3 3 4 4 # *** Also keep .gitignore in sync when changing *** 5 5 hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay 6 - hostprogs-always-$(CHECK_DT_BINDING) += dtc 6 + hostprogs-always-$(CHECK_DTBS) += dtc 7 7 8 8 dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ 9 9 srcpos.o checks.o util.o
+1 -1
scripts/gdb/linux/Makefile
··· 5 5 symlinks := $(patsubst $(src)/%,%,$(wildcard $(src)/*.py)) 6 6 7 7 quiet_cmd_symlink = SYMLINK $@ 8 - cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@ 8 + cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(src)/%,$@) $@ 9 9 10 10 always-y += $(symlinks) 11 11 $(addprefix $(obj)/, $(symlinks)): FORCE
+1 -1
scripts/kconfig/expr.c
··· 476 476 return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes); 477 477 } 478 478 } 479 - if (sym1->type == S_BOOLEAN && sym1 == sym2) { 479 + if (sym1->type == S_BOOLEAN) { 480 480 if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || 481 481 (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) 482 482 return expr_alloc_symbol(&symbol_yes);
-5
scripts/kconfig/expr.h
··· 302 302 return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); 303 303 } 304 304 305 - static inline int expr_is_no(struct expr *e) 306 - { 307 - return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); 308 - } 309 - 310 305 #ifdef __cplusplus 311 306 } 312 307 #endif
+4 -2
scripts/kconfig/symbol.c
··· 14 14 15 15 struct symbol symbol_yes = { 16 16 .name = "y", 17 + .type = S_TRISTATE, 17 18 .curr = { "y", yes }, 18 19 .menus = LIST_HEAD_INIT(symbol_yes.menus), 19 20 .flags = SYMBOL_CONST|SYMBOL_VALID, ··· 22 21 23 22 struct symbol symbol_mod = { 24 23 .name = "m", 24 + .type = S_TRISTATE, 25 25 .curr = { "m", mod }, 26 26 .menus = LIST_HEAD_INIT(symbol_mod.menus), 27 27 .flags = SYMBOL_CONST|SYMBOL_VALID, ··· 30 28 31 29 struct symbol symbol_no = { 32 30 .name = "n", 31 + .type = S_TRISTATE, 33 32 .curr = { "n", no }, 34 33 .menus = LIST_HEAD_INIT(symbol_no.menus), 35 34 .flags = SYMBOL_CONST|SYMBOL_VALID, ··· 823 820 case no: 824 821 return "n"; 825 822 case mod: 826 - sym_calc_value(modules_sym); 827 - return (modules_sym->curr.tri == no) ? "n" : "m"; 823 + return "m"; 828 824 case yes: 829 825 return "y"; 830 826 }
+1 -2
scripts/make_fit.py
··· 190 190 Args: 191 191 fsw (libfdt.FdtSw): Object to use for writing 192 192 seq (int): Sequence number (1 for first) 193 - fmame (str): Filename containing the DTB 193 + fname (str): Filename containing the DTB 194 194 arch: FIT architecture, e.g. 'arm64' 195 195 compress (str): Compressed algorithm, e.g. 'gzip' 196 196 ··· 211 211 fsw.property_string('type', 'flat_dt') 212 212 fsw.property_string('arch', arch) 213 213 fsw.property_string('compression', compress) 214 - fsw.property('compatible', bytes(compat)) 215 214 216 215 with open(fname, 'rb') as inf: 217 216 compressed = compress_data(inf, compress)
+6 -22
scripts/mksysmap
··· 1 - #!/bin/sh -x 2 - # Based on the vmlinux file create the System.map file 1 + #!/bin/sed -f 2 + # SPDX-License-Identifier: GPL-2.0-only 3 + # 4 + # sed script to filter out symbols that are not needed for System.map, 5 + # or not suitable for kallsyms. The input should be 'nm -n <file>'. 6 + # 3 7 # System.map is used by module-init tools and some debugging 4 8 # tools to retrieve the actual addresses of symbols in the kernel. 5 9 # 6 - # Usage 7 - # mksysmap vmlinux System.map [exclude] 8 - 9 - 10 - ##### 11 - # Generate System.map (actual filename passed as second argument) 12 - # The following refers to the symbol type as per nm(1). 13 - 14 10 # readprofile starts reading symbols when _stext is found, and 15 11 # continue until it finds a symbol which is not either of 'T', 't', 16 12 # 'W' or 'w'. 17 13 # 18 - 19 - ${NM} -n ${1} | sed >${2} -e " 20 14 # --------------------------------------------------------------------------- 21 15 # Ignored symbol types 22 16 # ··· 86 92 # ppc stub 87 93 /\.long_branch\./d 88 94 /\.plt_branch\./d 89 - 90 - # --------------------------------------------------------------------------- 91 - # Ignored kallsyms symbols 92 - # 93 - # If the 3rd parameter exists, symbols from it will be omitted from the output. 94 - # This makes kallsyms have the identical symbol lists in the step 1 and 2. 95 - # Without this, the step2 would get new symbols generated by scripts/kallsyms.c 96 - # when CONFIG_KALLSYMS_ALL is enabled. That might require one more pass. 97 - $(if [ $# -ge 3 ]; then ${NM} ${3} | sed -n '/ U /!s:.* \([^ ]*\)$:/ \1$/d:p'; fi) 98 - "
+11 -2
security/landlock/fs.c
··· 1110 1110 bool allow_parent1, allow_parent2; 1111 1111 access_mask_t access_request_parent1, access_request_parent2; 1112 1112 struct path mnt_dir; 1113 + struct dentry *old_parent; 1113 1114 layer_mask_t layer_masks_parent1[LANDLOCK_NUM_ACCESS_FS] = {}, 1114 1115 layer_masks_parent2[LANDLOCK_NUM_ACCESS_FS] = {}; 1115 1116 ··· 1158 1157 mnt_dir.mnt = new_dir->mnt; 1159 1158 mnt_dir.dentry = new_dir->mnt->mnt_root; 1160 1159 1160 + /* 1161 + * old_dentry may be the root of the common mount point and 1162 + * !IS_ROOT(old_dentry) at the same time (e.g. with open_tree() and 1163 + * OPEN_TREE_CLONE). We do not need to call dget(old_parent) because 1164 + * we keep a reference to old_dentry. 1165 + */ 1166 + old_parent = (old_dentry == mnt_dir.dentry) ? old_dentry : 1167 + old_dentry->d_parent; 1168 + 1161 1169 /* new_dir->dentry is equal to new_dentry->d_parent */ 1162 - allow_parent1 = collect_domain_accesses(dom, mnt_dir.dentry, 1163 - old_dentry->d_parent, 1170 + allow_parent1 = collect_domain_accesses(dom, mnt_dir.dentry, old_parent, 1164 1171 &layer_masks_parent1); 1165 1172 allow_parent2 = collect_domain_accesses( 1166 1173 dom, mnt_dir.dentry, new_dir->dentry, &layer_masks_parent2);
+5 -4
sound/core/init.c
··· 537 537 synchronize_irq(card->sync_irq); 538 538 539 539 snd_info_card_disconnect(card); 540 + #ifdef CONFIG_SND_DEBUG 541 + debugfs_remove(card->debugfs_root); 542 + card->debugfs_root = NULL; 543 + #endif 544 + 540 545 if (card->registered) { 541 546 device_del(&card->card_dev); 542 547 card->registered = false; ··· 591 586 dev_warn(card->dev, "unable to free card info\n"); 592 587 /* Not fatal error */ 593 588 } 594 - #ifdef CONFIG_SND_DEBUG 595 - debugfs_remove(card->debugfs_root); 596 - card->debugfs_root = NULL; 597 - #endif 598 589 if (card->release_completion) 599 590 complete(card->release_completion); 600 591 if (!card->managed)
+14 -7
sound/core/jack.c
··· 37 37 }; 38 38 #endif /* CONFIG_SND_JACK_INPUT_DEV */ 39 39 40 + static void snd_jack_remove_debugfs(struct snd_jack *jack); 41 + 40 42 static int snd_jack_dev_disconnect(struct snd_device *device) 41 43 { 42 - #ifdef CONFIG_SND_JACK_INPUT_DEV 43 44 struct snd_jack *jack = device->device_data; 44 45 46 + snd_jack_remove_debugfs(jack); 47 + 48 + #ifdef CONFIG_SND_JACK_INPUT_DEV 45 49 guard(mutex)(&jack->input_dev_lock); 46 50 if (!jack->input_dev) 47 51 return 0; ··· 385 381 return 0; 386 382 } 387 383 388 - static void snd_jack_debugfs_clear_inject_node(struct snd_jack_kctl *jack_kctl) 384 + static void snd_jack_remove_debugfs(struct snd_jack *jack) 389 385 { 390 - debugfs_remove(jack_kctl->jack_debugfs_root); 391 - jack_kctl->jack_debugfs_root = NULL; 386 + struct snd_jack_kctl *jack_kctl; 387 + 388 + list_for_each_entry(jack_kctl, &jack->kctl_list, list) { 389 + debugfs_remove(jack_kctl->jack_debugfs_root); 390 + jack_kctl->jack_debugfs_root = NULL; 391 + } 392 392 } 393 393 #else /* CONFIG_SND_JACK_INJECTION_DEBUG */ 394 394 static int snd_jack_debugfs_add_inject_node(struct snd_jack *jack, ··· 401 393 return 0; 402 394 } 403 395 404 - static void snd_jack_debugfs_clear_inject_node(struct snd_jack_kctl *jack_kctl) 396 + static void snd_jack_remove_debugfs(struct snd_jack *jack) 405 397 { 406 398 } 407 399 #endif /* CONFIG_SND_JACK_INJECTION_DEBUG */ ··· 412 404 413 405 jack_kctl = kctl->private_data; 414 406 if (jack_kctl) { 415 - snd_jack_debugfs_clear_inject_node(jack_kctl); 416 407 list_del(&jack_kctl->list); 417 408 kfree(jack_kctl); 418 409 } ··· 504 497 .dev_free = snd_jack_dev_free, 505 498 #ifdef CONFIG_SND_JACK_INPUT_DEV 506 499 .dev_register = snd_jack_dev_register, 507 - .dev_disconnect = snd_jack_dev_disconnect, 508 500 #endif /* CONFIG_SND_JACK_INPUT_DEV */ 501 + .dev_disconnect = snd_jack_dev_disconnect, 509 502 }; 510 503 511 504 if (initial_kctl) {
+44 -4
sound/core/seq/seq_ump_convert.c
··· 157 157 static void ump_system_to_songpos_ev(const union snd_ump_midi1_msg *val, 158 158 struct snd_seq_event *ev) 159 159 { 160 - ev->data.control.value = (val->system.parm1 << 7) | val->system.parm2; 160 + ev->data.control.value = (val->system.parm2 << 7) | val->system.parm1; 161 161 } 162 162 163 163 /* Encoders for 0xf0 - 0xff */ ··· 368 368 struct snd_seq_ump_event ev_cvt; 369 369 const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump; 370 370 union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump; 371 + struct snd_seq_ump_midi2_bank *cc; 371 372 372 373 ev_cvt = *event; 373 374 memset(&ev_cvt.ump, 0, sizeof(ev_cvt.ump)); ··· 388 387 midi2->paf.data = upscale_7_to_32bit(midi1->paf.data); 389 388 break; 390 389 case UMP_MSG_STATUS_CC: 390 + cc = &dest_port->midi2_bank[midi1->note.channel]; 391 + switch (midi1->cc.index) { 392 + case UMP_CC_BANK_SELECT: 393 + cc->bank_set = 1; 394 + cc->cc_bank_msb = midi1->cc.data; 395 + return 0; // skip 396 + case UMP_CC_BANK_SELECT_LSB: 397 + cc->bank_set = 1; 398 + cc->cc_bank_lsb = midi1->cc.data; 399 + return 0; // skip 400 + } 391 401 midi2->cc.index = midi1->cc.index; 392 402 midi2->cc.data = upscale_7_to_32bit(midi1->cc.data); 393 403 break; 394 404 case UMP_MSG_STATUS_PROGRAM: 395 405 midi2->pg.program = midi1->pg.program; 406 + cc = &dest_port->midi2_bank[midi1->note.channel]; 407 + if (cc->bank_set) { 408 + midi2->pg.bank_valid = 1; 409 + midi2->pg.bank_msb = cc->cc_bank_msb; 410 + midi2->pg.bank_lsb = cc->cc_bank_lsb; 411 + cc->bank_set = 0; 412 + } 396 413 break; 397 414 case UMP_MSG_STATUS_CHANNEL_PRESSURE: 398 415 midi2->caf.data = upscale_7_to_32bit(midi1->caf.data); ··· 438 419 struct snd_seq_ump_event ev_cvt; 439 420 union snd_ump_midi1_msg *midi1 = (union snd_ump_midi1_msg *)ev_cvt.ump; 440 421 const union snd_ump_midi2_msg *midi2 = (const union snd_ump_midi2_msg *)event->ump; 422 + int err; 441 423 u16 v; 442 424 443 425 ev_cvt = *event; ··· 463 443 midi1->cc.data = downscale_32_to_7bit(midi2->cc.data); 464 444 break; 465 445 case UMP_MSG_STATUS_PROGRAM: 446 + if (midi2->pg.bank_valid) { 447 + midi1->cc.status = UMP_MSG_STATUS_CC; 448 + midi1->cc.index = UMP_CC_BANK_SELECT; 449 + midi1->cc.data = midi2->pg.bank_msb; 450 + err = __snd_seq_deliver_single_event(dest, dest_port, 451 + (struct snd_seq_event *)&ev_cvt, 452 + atomic, hop); 453 + if (err < 0) 454 + return err; 455 + midi1->cc.index = UMP_CC_BANK_SELECT_LSB; 456 + midi1->cc.data = midi2->pg.bank_lsb; 457 + err = __snd_seq_deliver_single_event(dest, dest_port, 458 + (struct snd_seq_event *)&ev_cvt, 459 + atomic, hop); 460 + if (err < 0) 461 + return err; 462 + midi1->note.status = midi2->note.status; 463 + } 466 464 midi1->pg.program = midi2->pg.program; 467 465 break; 468 466 case UMP_MSG_STATUS_CHANNEL_PRESSURE: ··· 729 691 union snd_ump_midi1_msg *data, 730 692 unsigned char status) 731 693 { 694 + data->system.type = UMP_MSG_TYPE_SYSTEM; // override 732 695 data->system.status = status; 733 696 return 1; 734 697 } ··· 740 701 union snd_ump_midi1_msg *data, 741 702 unsigned char status) 742 703 { 704 + data->system.type = UMP_MSG_TYPE_SYSTEM; // override 743 705 data->system.status = status; 744 706 data->system.parm1 = event->data.control.value & 0x7f; 745 707 return 1; ··· 752 712 union snd_ump_midi1_msg *data, 753 713 unsigned char status) 754 714 { 715 + data->system.type = UMP_MSG_TYPE_SYSTEM; // override 755 716 data->system.status = status; 756 - data->system.parm1 = (event->data.control.value >> 7) & 0x7f; 757 - data->system.parm2 = event->data.control.value & 0x7f; 717 + data->system.parm1 = event->data.control.value & 0x7f; 718 + data->system.parm2 = (event->data.control.value >> 7) & 0x7f; 758 719 return 1; 759 720 } 760 721 ··· 895 854 data->pg.bank_msb = cc->cc_bank_msb; 896 855 data->pg.bank_lsb = cc->cc_bank_lsb; 897 856 cc->bank_set = 0; 898 - cc->cc_bank_msb = cc->cc_bank_lsb = 0; 899 857 } 900 858 return 1; 901 859 }
+15
sound/core/ump.c
··· 685 685 */ 686 686 int snd_ump_switch_protocol(struct snd_ump_endpoint *ump, unsigned int protocol) 687 687 { 688 + unsigned int type; 689 + 688 690 protocol &= ump->info.protocol_caps; 689 691 if (protocol == ump->info.protocol) 692 + return 0; 693 + 694 + type = protocol & SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK; 695 + if (type != SNDRV_UMP_EP_INFO_PROTO_MIDI1 && 696 + type != SNDRV_UMP_EP_INFO_PROTO_MIDI2) 690 697 return 0; 691 698 692 699 ump->info.protocol = protocol; ··· 966 959 UMP_STREAM_MSG_STATUS_STREAM_CFG); 967 960 if (err < 0) 968 961 ump_dbg(ump, "Unable to get UMP EP stream config\n"); 962 + 963 + /* If no protocol is set by some reason, assume the valid one */ 964 + if (!(ump->info.protocol & SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK)) { 965 + if (ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI2) 966 + ump->info.protocol |= SNDRV_UMP_EP_INFO_PROTO_MIDI2; 967 + else if (ump->info.protocol_caps & SNDRV_UMP_EP_INFO_PROTO_MIDI1) 968 + ump->info.protocol |= SNDRV_UMP_EP_INFO_PROTO_MIDI1; 969 + } 969 970 970 971 /* Query and create blocks from Function Blocks */ 971 972 for (blk = 0; blk < ump->info.num_blocks; blk++) {
-1
sound/core/ump_convert.c
··· 404 404 midi2->pg.bank_msb = cc->cc_bank_msb; 405 405 midi2->pg.bank_lsb = cc->cc_bank_lsb; 406 406 cc->bank_set = 0; 407 - cc->cc_bank_msb = cc->cc_bank_lsb = 0; 408 407 } 409 408 break; 410 409 case UMP_MSG_STATUS_CHANNEL_PRESSURE:
+4 -4
sound/hda/intel-dsp-config.c
··· 668 668 return SND_INTEL_DSP_DRIVER_LEGACY; 669 669 } 670 670 671 - dev_info(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); 671 + dev_dbg(&pci->dev, "DSP detected with PCI class/subclass/prog-if info 0x%06x\n", pci->class); 672 672 673 673 /* find the configuration for the specific device */ 674 674 cfg = snd_intel_dsp_find_config(pci, config_table, ARRAY_SIZE(config_table)); ··· 678 678 if (cfg->flags & FLAG_SOF) { 679 679 if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE && 680 680 snd_intel_dsp_check_soundwire(pci) > 0) { 681 - dev_info(&pci->dev, "SoundWire enabled on CannonLake+ platform, using SOF driver\n"); 681 + dev_info_once(&pci->dev, "SoundWire enabled on CannonLake+ platform, using SOF driver\n"); 682 682 return SND_INTEL_DSP_DRIVER_SOF; 683 683 } 684 684 if (cfg->flags & FLAG_SOF_ONLY_IF_DMIC && 685 685 snd_intel_dsp_check_dmic(pci)) { 686 - dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SOF driver\n"); 686 + dev_info_once(&pci->dev, "Digital mics found on Skylake+ platform, using SOF driver\n"); 687 687 return SND_INTEL_DSP_DRIVER_SOF; 688 688 } 689 689 if (!(cfg->flags & FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE)) ··· 694 694 if (cfg->flags & FLAG_SST) { 695 695 if (cfg->flags & FLAG_SST_ONLY_IF_DMIC) { 696 696 if (snd_intel_dsp_check_dmic(pci)) { 697 - dev_info(&pci->dev, "Digital mics found on Skylake+ platform, using SST driver\n"); 697 + dev_info_once(&pci->dev, "Digital mics found on Skylake+ platform, using SST driver\n"); 698 698 return SND_INTEL_DSP_DRIVER_SST; 699 699 } 700 700 } else {
+1 -1
sound/pci/hda/patch_realtek.c
··· 10310 10310 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 10311 10311 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2), 10312 10312 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2), 10313 - SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC245_FIXUP_CS35L41_SPI_2), 10313 + SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10314 10314 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2), 10315 10315 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10316 10316 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+3 -2
sound/soc/codecs/cs42l43.c
··· 310 310 struct snd_soc_component *component = dai->component; 311 311 struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); 312 312 struct cs42l43 *cs42l43 = priv->core; 313 - int provider = !!regmap_test_bits(cs42l43->regmap, CS42L43_ASP_CLK_CONFIG2, 314 - CS42L43_ASP_MASTER_MODE_MASK); 313 + int provider = !dai->id || !!regmap_test_bits(cs42l43->regmap, 314 + CS42L43_ASP_CLK_CONFIG2, 315 + CS42L43_ASP_MASTER_MODE_MASK); 315 316 316 317 if (provider) 317 318 priv->constraint.mask = CS42L43_PROVIDER_RATE_MASK;
+1
sound/soc/codecs/wm_adsp.c
··· 2085 2085 .watchdog_expired = wm_adsp_fatal_error, 2086 2086 }; 2087 2087 2088 + MODULE_DESCRIPTION("Cirrus Logic ASoC DSP Support"); 2088 2089 MODULE_LICENSE("GPL v2"); 2089 2090 MODULE_IMPORT_NS(FW_CS_DSP);
+1 -1
sound/soc/intel/boards/Kconfig
··· 652 652 653 653 config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH 654 654 tristate "SoundWire generic machine driver" 655 - depends on I2C && ACPI 655 + depends on I2C && SPI_MASTER && ACPI 656 656 depends on MFD_INTEL_LPSS || COMPILE_TEST 657 657 depends on SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES || COMPILE_TEST 658 658 depends on SOUNDWIRE
+2 -2
sound/soc/sof/amd/acp-common.c
··· 258 258 }; 259 259 EXPORT_SYMBOL_NS(sof_acp_common_ops, SND_SOC_SOF_AMD_COMMON); 260 260 261 + MODULE_LICENSE("Dual BSD/GPL"); 262 + MODULE_DESCRIPTION("ACP SOF COMMON Driver"); 261 263 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 262 264 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 263 265 MODULE_IMPORT_NS(SOUNDWIRE_AMD_INIT); 264 - MODULE_DESCRIPTION("ACP SOF COMMON Driver"); 265 - MODULE_LICENSE("Dual BSD/GPL");
+1 -1
sound/soc/sof/amd/acp.c
··· 801 801 } 802 802 EXPORT_SYMBOL_NS(amd_sof_acp_remove, SND_SOC_SOF_AMD_COMMON); 803 803 804 + MODULE_LICENSE("Dual BSD/GPL"); 804 805 MODULE_DESCRIPTION("AMD ACP sof driver"); 805 806 MODULE_IMPORT_NS(SOUNDWIRE_AMD_INIT); 806 807 MODULE_IMPORT_NS(SND_AMD_SOUNDWIRE_ACPI); 807 - MODULE_LICENSE("Dual BSD/GPL");
-4
sound/soc/sof/amd/acp63.c
··· 140 140 141 141 return 0; 142 142 } 143 - 144 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 145 - MODULE_DESCRIPTION("ACP63 SOF Driver"); 146 - MODULE_LICENSE("Dual BSD/GPL");
+1
sound/soc/sof/amd/pci-acp63.c
··· 109 109 module_pci_driver(snd_sof_pci_amd_acp63_driver); 110 110 111 111 MODULE_LICENSE("Dual BSD/GPL"); 112 + MODULE_DESCRIPTION("ACP63 SOF Driver"); 112 113 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 113 114 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/amd/pci-rmb.c
··· 99 99 module_pci_driver(snd_sof_pci_amd_rmb_driver); 100 100 101 101 MODULE_LICENSE("Dual BSD/GPL"); 102 + MODULE_DESCRIPTION("REMBRANDT SOF Driver"); 102 103 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 103 104 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/amd/pci-rn.c
··· 103 103 module_pci_driver(snd_sof_pci_amd_rn_driver); 104 104 105 105 MODULE_LICENSE("Dual BSD/GPL"); 106 + MODULE_DESCRIPTION("RENOIR SOF Driver"); 106 107 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 107 108 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/amd/pci-vangogh.c
··· 101 101 module_pci_driver(snd_sof_pci_amd_vgh_driver); 102 102 103 103 MODULE_LICENSE("Dual BSD/GPL"); 104 + MODULE_DESCRIPTION("VANGOGH SOF Driver"); 104 105 MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 105 106 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
-4
sound/soc/sof/amd/rembrandt.c
··· 140 140 141 141 return 0; 142 142 } 143 - 144 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 145 - MODULE_DESCRIPTION("REMBRANDT SOF Driver"); 146 - MODULE_LICENSE("Dual BSD/GPL");
-4
sound/soc/sof/amd/renoir.c
··· 115 115 116 116 return 0; 117 117 } 118 - 119 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 120 - MODULE_DESCRIPTION("RENOIR SOF Driver"); 121 - MODULE_LICENSE("Dual BSD/GPL");
-4
sound/soc/sof/amd/vangogh.c
··· 161 161 162 162 return 0; 163 163 } 164 - 165 - MODULE_IMPORT_NS(SND_SOC_SOF_AMD_COMMON); 166 - MODULE_DESCRIPTION("VANGOGH SOF Driver"); 167 - MODULE_LICENSE("Dual BSD/GPL");
+1 -1
sound/soc/sof/core.c
··· 769 769 EXPORT_SYMBOL(sof_machine_unregister); 770 770 771 771 MODULE_AUTHOR("Liam Girdwood"); 772 - MODULE_DESCRIPTION("Sound Open Firmware (SOF) Core"); 773 772 MODULE_LICENSE("Dual BSD/GPL"); 773 + MODULE_DESCRIPTION("Sound Open Firmware (SOF) Core"); 774 774 MODULE_ALIAS("platform:sof-audio"); 775 775 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1
sound/soc/sof/imx/imx-common.c
··· 75 75 EXPORT_SYMBOL(imx8_dump); 76 76 77 77 MODULE_LICENSE("Dual BSD/GPL"); 78 + MODULE_DESCRIPTION("SOF helpers for IMX platforms");
+2 -1
sound/soc/sof/imx/imx8.c
··· 667 667 }; 668 668 module_platform_driver(snd_sof_of_imx8_driver); 669 669 670 - MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 671 670 MODULE_LICENSE("Dual BSD/GPL"); 671 + MODULE_DESCRIPTION("SOF support for IMX8 platforms"); 672 + MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+2 -1
sound/soc/sof/imx/imx8m.c
··· 514 514 }; 515 515 module_platform_driver(snd_sof_of_imx8m_driver); 516 516 517 - MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 518 517 MODULE_LICENSE("Dual BSD/GPL"); 518 + MODULE_DESCRIPTION("SOF support for IMX8M platforms"); 519 + MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+2 -1
sound/soc/sof/imx/imx8ulp.c
··· 516 516 }; 517 517 module_platform_driver(snd_sof_of_imx8ulp_driver); 518 518 519 - MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 520 519 MODULE_LICENSE("Dual BSD/GPL"); 520 + MODULE_DESCRIPTION("SOF support for IMX8ULP platforms"); 521 + MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
+1
sound/soc/sof/intel/atom.c
··· 418 418 EXPORT_SYMBOL_NS(atom_set_mach_params, SND_SOC_SOF_INTEL_ATOM_HIFI_EP); 419 419 420 420 MODULE_LICENSE("Dual BSD/GPL"); 421 + MODULE_DESCRIPTION("SOF support for Atom platforms");
+1
sound/soc/sof/intel/bdw.c
··· 694 694 module_platform_driver(snd_sof_acpi_intel_bdw_driver); 695 695 696 696 MODULE_LICENSE("Dual BSD/GPL"); 697 + MODULE_DESCRIPTION("SOF support for Broadwell platforms"); 697 698 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC); 698 699 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 699 700 MODULE_IMPORT_NS(SND_SOC_SOF_ACPI_DEV);
+1
sound/soc/sof/intel/byt.c
··· 475 475 module_platform_driver(snd_sof_acpi_intel_byt_driver); 476 476 477 477 MODULE_LICENSE("Dual BSD/GPL"); 478 + MODULE_DESCRIPTION("SOF support for Baytrail/Cherrytrail"); 478 479 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC); 479 480 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 480 481 MODULE_IMPORT_NS(SND_SOC_SOF_ACPI_DEV);
+1
sound/soc/sof/intel/hda-codec.c
··· 457 457 #endif 458 458 459 459 MODULE_LICENSE("Dual BSD/GPL"); 460 + MODULE_DESCRIPTION("SOF support for HDaudio codecs");
+1
sound/soc/sof/intel/hda-ctrl.c
··· 328 328 } 329 329 330 330 MODULE_LICENSE("Dual BSD/GPL"); 331 + MODULE_DESCRIPTION("SOF helpers for HDaudio platforms"); 331 332 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK); 332 333 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC); 333 334 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
+1
sound/soc/sof/intel/hda-mlink.c
··· 972 972 #endif 973 973 974 974 MODULE_LICENSE("Dual BSD/GPL"); 975 + MODULE_DESCRIPTION("SOF support for HDaudio multi-link");
+1
sound/soc/sof/intel/hda.c
··· 1522 1522 } 1523 1523 1524 1524 MODULE_LICENSE("Dual BSD/GPL"); 1525 + MODULE_DESCRIPTION("SOF support for HDaudio platforms"); 1525 1526 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV); 1526 1527 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC); 1527 1528 MODULE_IMPORT_NS(SND_SOC_SOF_HDA_AUDIO_CODEC_I915);
+1
sound/soc/sof/intel/pci-apl.c
··· 105 105 module_pci_driver(snd_sof_pci_intel_apl_driver); 106 106 107 107 MODULE_LICENSE("Dual BSD/GPL"); 108 + MODULE_DESCRIPTION("SOF support for ApolloLake platforms"); 108 109 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 109 110 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 110 111 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-cnl.c
··· 143 143 module_pci_driver(snd_sof_pci_intel_cnl_driver); 144 144 145 145 MODULE_LICENSE("Dual BSD/GPL"); 146 + MODULE_DESCRIPTION("SOF support for CannonLake platforms"); 146 147 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 147 148 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 148 149 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-icl.c
··· 108 108 module_pci_driver(snd_sof_pci_intel_icl_driver); 109 109 110 110 MODULE_LICENSE("Dual BSD/GPL"); 111 + MODULE_DESCRIPTION("SOF support for IceLake platforms"); 111 112 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 112 113 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 113 114 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_CNL);
+1
sound/soc/sof/intel/pci-lnl.c
··· 70 70 module_pci_driver(snd_sof_pci_intel_lnl_driver); 71 71 72 72 MODULE_LICENSE("Dual BSD/GPL"); 73 + MODULE_DESCRIPTION("SOF support for LunarLake platforms"); 73 74 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 74 75 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 75 76 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_MTL);
+1
sound/soc/sof/intel/pci-mtl.c
··· 133 133 module_pci_driver(snd_sof_pci_intel_mtl_driver); 134 134 135 135 MODULE_LICENSE("Dual BSD/GPL"); 136 + MODULE_DESCRIPTION("SOF support for MeteorLake platforms"); 136 137 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 137 138 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 138 139 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-skl.c
··· 89 89 module_pci_driver(snd_sof_pci_intel_skl_driver); 90 90 91 91 MODULE_LICENSE("Dual BSD/GPL"); 92 + MODULE_DESCRIPTION("SOF support for SkyLake platforms"); 92 93 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 93 94 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 94 95 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+1
sound/soc/sof/intel/pci-tgl.c
··· 317 317 module_pci_driver(snd_sof_pci_intel_tgl_driver); 318 318 319 319 MODULE_LICENSE("Dual BSD/GPL"); 320 + MODULE_DESCRIPTION("SOF support for TigerLake platforms"); 320 321 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC); 321 322 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON); 322 323 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_CNL);
+1
sound/soc/sof/intel/pci-tng.c
··· 244 244 module_pci_driver(snd_sof_pci_intel_tng_driver); 245 245 246 246 MODULE_LICENSE("Dual BSD/GPL"); 247 + MODULE_DESCRIPTION("SOF support for Tangier platforms"); 247 248 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC); 248 249 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 249 250 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
+6 -6
sound/soc/sof/ipc4-pcm.c
··· 650 650 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 651 651 struct sof_ipc4_audio_format *ipc4_fmt; 652 652 struct sof_ipc4_copier *ipc4_copier; 653 - bool single_fmt = false; 653 + bool single_bitdepth = false; 654 654 u32 valid_bits = 0; 655 655 int dir, ret; 656 656 ··· 682 682 return 0; 683 683 684 684 if (dir == SNDRV_PCM_STREAM_PLAYBACK) { 685 - if (sof_ipc4_copier_is_single_format(sdev, 685 + if (sof_ipc4_copier_is_single_bitdepth(sdev, 686 686 available_fmt->output_pin_fmts, 687 687 available_fmt->num_output_formats)) { 688 688 ipc4_fmt = &available_fmt->output_pin_fmts->audio_fmt; 689 - single_fmt = true; 689 + single_bitdepth = true; 690 690 } 691 691 } else { 692 - if (sof_ipc4_copier_is_single_format(sdev, 692 + if (sof_ipc4_copier_is_single_bitdepth(sdev, 693 693 available_fmt->input_pin_fmts, 694 694 available_fmt->num_input_formats)) { 695 695 ipc4_fmt = &available_fmt->input_pin_fmts->audio_fmt; 696 - single_fmt = true; 696 + single_bitdepth = true; 697 697 } 698 698 } 699 699 } ··· 703 703 if (ret) 704 704 return ret; 705 705 706 - if (single_fmt) { 706 + if (single_bitdepth) { 707 707 snd_mask_none(fmt); 708 708 valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(ipc4_fmt->fmt_cfg); 709 709 dev_dbg(component->dev, "Set %s to %d bit format\n", dai->name, valid_bits);
+93 -47
sound/soc/sof/ipc4-topology.c
··· 195 195 for (i = 0; i < num_formats; i++) { 196 196 struct sof_ipc4_audio_format *fmt = &pin_fmt[i].audio_fmt; 197 197 dev_dbg(dev, 198 - "Pin index #%d: %uHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n", 199 - pin_fmt[i].pin_index, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map, 200 - fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg, 198 + "Pin index #%d: %uHz, %ubit, %luch (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n", 199 + pin_fmt[i].pin_index, fmt->sampling_frequency, fmt->bit_depth, 200 + SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg), 201 + fmt->ch_map, fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg, 201 202 pin_fmt[i].buffer_size); 202 203 } 203 204 } ··· 218 217 } 219 218 220 219 process = swidget->private; 220 + 221 + /* 222 + * For process modules without base config extension, base module config 223 + * format is used for all input pins 224 + */ 225 + if (process->init_config != SOF_IPC4_MODULE_INIT_CONFIG_TYPE_BASE_CFG_WITH_EXT) 226 + return &process->base_config.audio_fmt; 227 + 221 228 base_cfg_ext = process->base_config_ext; 222 229 223 230 /* ··· 1431 1422 1432 1423 static int 1433 1424 snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, 1434 - bool single_format, 1425 + bool single_bitdepth, 1435 1426 struct snd_pcm_hw_params *params, u32 dai_index, 1436 1427 u32 linktype, u8 dir, u32 **dst, u32 *len) 1437 1428 { ··· 1454 1445 * Look for 32-bit blob first instead of 16-bit if copier 1455 1446 * supports multiple formats 1456 1447 */ 1457 - if (bit_depth == 16 && !single_format) { 1448 + if (bit_depth == 16 && !single_bitdepth) { 1458 1449 dev_dbg(sdev->dev, "Looking for 32-bit blob first for DMIC\n"); 1459 1450 format_change = true; 1460 1451 bit_depth = 32; ··· 1502 1493 bit_depth = params_width(params); 1503 1494 format_change = false; 1504 1495 get_new_blob = true; 1505 - } else if (linktype == SOF_DAI_INTEL_DMIC && !single_format) { 1496 + } else if (linktype == SOF_DAI_INTEL_DMIC && !single_bitdepth) { 1506 1497 /* 1507 1498 * The requested 32-bit blob (no format change for the 1508 1499 * blob request) was not found in NHLT table, try to ··· 1558 1549 #else 1559 1550 static int 1560 1551 snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, 1561 - bool single_format, 1552 + bool single_bitdepth, 1562 1553 struct snd_pcm_hw_params *params, u32 dai_index, 1563 1554 u32 linktype, u8 dir, u32 **dst, u32 *len) 1564 1555 { ··· 1566 1557 } 1567 1558 #endif 1568 1559 1569 - bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev, 1570 - struct sof_ipc4_pin_format *pin_fmts, 1571 - u32 pin_fmts_size) 1560 + bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev, 1561 + struct sof_ipc4_pin_format *pin_fmts, 1562 + u32 pin_fmts_size) 1572 1563 { 1573 1564 struct sof_ipc4_audio_format *fmt; 1574 1565 u32 valid_bits; ··· 1592 1583 } 1593 1584 1594 1585 static int 1586 + sof_ipc4_adjust_params_to_dai_format(struct snd_sof_dev *sdev, 1587 + struct snd_pcm_hw_params *params, 1588 + struct sof_ipc4_pin_format *pin_fmts, 1589 + u32 pin_fmts_size) 1590 + { 1591 + u32 params_mask = BIT(SNDRV_PCM_HW_PARAM_RATE) | 1592 + BIT(SNDRV_PCM_HW_PARAM_CHANNELS) | 1593 + BIT(SNDRV_PCM_HW_PARAM_FORMAT); 1594 + struct sof_ipc4_audio_format *fmt; 1595 + u32 rate, channels, valid_bits; 1596 + int i; 1597 + 1598 + fmt = &pin_fmts[0].audio_fmt; 1599 + rate = fmt->sampling_frequency; 1600 + channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg); 1601 + valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg); 1602 + 1603 + /* check if parameters in topology defined formats are the same */ 1604 + for (i = 1; i < pin_fmts_size; i++) { 1605 + u32 val; 1606 + 1607 + fmt = &pin_fmts[i].audio_fmt; 1608 + 1609 + if (params_mask & BIT(SNDRV_PCM_HW_PARAM_RATE)) { 1610 + val = fmt->sampling_frequency; 1611 + if (val != rate) 1612 + params_mask &= ~BIT(SNDRV_PCM_HW_PARAM_RATE); 1613 + } 1614 + if (params_mask & BIT(SNDRV_PCM_HW_PARAM_CHANNELS)) { 1615 + val = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg); 1616 + if (val != channels) 1617 + params_mask &= ~BIT(SNDRV_PCM_HW_PARAM_CHANNELS); 1618 + } 1619 + if (params_mask & BIT(SNDRV_PCM_HW_PARAM_FORMAT)) { 1620 + val = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg); 1621 + if (val != valid_bits) 1622 + params_mask &= ~BIT(SNDRV_PCM_HW_PARAM_FORMAT); 1623 + } 1624 + } 1625 + 1626 + if (params_mask) 1627 + return sof_ipc4_update_hw_params(sdev, params, 1628 + &pin_fmts[0].audio_fmt, 1629 + params_mask); 1630 + 1631 + return 0; 1632 + } 1633 + 1634 + static int 1595 1635 sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai, 1596 1636 struct snd_pcm_hw_params *params, int dir) 1597 1637 { 1598 1638 struct sof_ipc4_available_audio_format *available_fmt; 1599 1639 struct snd_pcm_hw_params dai_params = *params; 1600 1640 struct sof_ipc4_copier_data *copier_data; 1641 + struct sof_ipc4_pin_format *pin_fmts; 1601 1642 struct sof_ipc4_copier *ipc4_copier; 1602 - bool single_format; 1643 + bool single_bitdepth; 1644 + u32 num_pin_fmts; 1603 1645 int ret; 1604 1646 1605 1647 ipc4_copier = dai->private; ··· 1658 1598 available_fmt = &ipc4_copier->available_fmt; 1659 1599 1660 1600 /* 1661 - * If the copier on the DAI side supports only single bit depth then 1662 - * this depth (format) should be used to look for the NHLT blob (if 1663 - * needed) and in case of capture this should be used for the input 1664 - * format lookup 1601 + * Fixup the params based on the format parameters of the DAI. If any 1602 + * of the RATE, CHANNELS, bit depth is static among the formats then 1603 + * narrow the params to only allow that specific parameter value. 1665 1604 */ 1666 1605 if (dir == SNDRV_PCM_STREAM_PLAYBACK) { 1667 - single_format = sof_ipc4_copier_is_single_format(sdev, 1668 - available_fmt->output_pin_fmts, 1669 - available_fmt->num_output_formats); 1670 - 1671 - /* Update the dai_params with the only supported format */ 1672 - if (single_format) { 1673 - ret = sof_ipc4_update_hw_params(sdev, &dai_params, 1674 - &available_fmt->output_pin_fmts[0].audio_fmt, 1675 - BIT(SNDRV_PCM_HW_PARAM_FORMAT)); 1676 - if (ret) 1677 - return ret; 1678 - } 1606 + pin_fmts = available_fmt->output_pin_fmts; 1607 + num_pin_fmts = available_fmt->num_output_formats; 1679 1608 } else { 1680 - single_format = sof_ipc4_copier_is_single_format(sdev, 1681 - available_fmt->input_pin_fmts, 1682 - available_fmt->num_input_formats); 1683 - 1684 - /* Update the dai_params with the only supported format */ 1685 - if (single_format) { 1686 - ret = sof_ipc4_update_hw_params(sdev, &dai_params, 1687 - &available_fmt->input_pin_fmts[0].audio_fmt, 1688 - BIT(SNDRV_PCM_HW_PARAM_FORMAT)); 1689 - if (ret) 1690 - return ret; 1691 - } 1609 + pin_fmts = available_fmt->input_pin_fmts; 1610 + num_pin_fmts = available_fmt->num_input_formats; 1692 1611 } 1693 1612 1694 - ret = snd_sof_get_nhlt_endpoint_data(sdev, dai, single_format, 1613 + ret = sof_ipc4_adjust_params_to_dai_format(sdev, &dai_params, pin_fmts, 1614 + num_pin_fmts); 1615 + if (ret) 1616 + return ret; 1617 + 1618 + single_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev, pin_fmts, 1619 + num_pin_fmts); 1620 + ret = snd_sof_get_nhlt_endpoint_data(sdev, dai, single_bitdepth, 1695 1621 &dai_params, 1696 1622 ipc4_copier->dai_index, 1697 1623 ipc4_copier->dai_type, dir, ··· 1712 1666 u32 out_ref_rate, out_ref_channels; 1713 1667 u32 deep_buffer_dma_ms = 0; 1714 1668 int output_fmt_index; 1715 - bool single_output_format; 1669 + bool single_output_bitdepth; 1716 1670 int i; 1717 1671 1718 1672 dev_dbg(sdev->dev, "copier %s, type %d", swidget->widget->name, swidget->id); ··· 1849 1803 return ret; 1850 1804 1851 1805 /* set the reference params for output format selection */ 1852 - single_output_format = sof_ipc4_copier_is_single_format(sdev, 1853 - available_fmt->output_pin_fmts, 1854 - available_fmt->num_output_formats); 1806 + single_output_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev, 1807 + available_fmt->output_pin_fmts, 1808 + available_fmt->num_output_formats); 1855 1809 switch (swidget->id) { 1856 1810 case snd_soc_dapm_aif_in: 1857 1811 case snd_soc_dapm_dai_out: ··· 1863 1817 out_ref_rate = in_fmt->sampling_frequency; 1864 1818 out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(in_fmt->fmt_cfg); 1865 1819 1866 - if (!single_output_format) 1820 + if (!single_output_bitdepth) 1867 1821 out_ref_valid_bits = 1868 1822 SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(in_fmt->fmt_cfg); 1869 1823 break; ··· 1872 1826 case snd_soc_dapm_dai_in: 1873 1827 out_ref_rate = params_rate(fe_params); 1874 1828 out_ref_channels = params_channels(fe_params); 1875 - if (!single_output_format) { 1829 + if (!single_output_bitdepth) { 1876 1830 out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params); 1877 1831 if (out_ref_valid_bits < 0) 1878 1832 return out_ref_valid_bits; ··· 1890 1844 * if the output format is the same across all available output formats, choose 1891 1845 * that as the reference. 1892 1846 */ 1893 - if (single_output_format) { 1847 + if (single_output_bitdepth) { 1894 1848 struct sof_ipc4_audio_format *out_fmt; 1895 1849 1896 1850 out_fmt = &available_fmt->output_pin_fmts[0].audio_fmt;
+3 -3
sound/soc/sof/ipc4-topology.h
··· 476 476 u32 init_config; 477 477 }; 478 478 479 - bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev, 480 - struct sof_ipc4_pin_format *pin_fmts, 481 - u32 pin_fmts_size); 479 + bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev, 480 + struct sof_ipc4_pin_format *pin_fmts, 481 + u32 pin_fmts_size); 482 482 #endif
+2 -1
sound/soc/sof/mediatek/mt8186/mt8186.c
··· 666 666 }; 667 667 module_platform_driver(snd_sof_of_mt8186_driver); 668 668 669 + MODULE_LICENSE("Dual BSD/GPL"); 670 + MODULE_DESCRIPTION("SOF support for MT8186/MT8188 platforms"); 669 671 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 670 672 MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); 671 - MODULE_LICENSE("Dual BSD/GPL");
+2 -1
sound/soc/sof/mediatek/mt8195/mt8195.c
··· 619 619 }; 620 620 module_platform_driver(snd_sof_of_mt8195_driver); 621 621 622 + MODULE_LICENSE("Dual BSD/GPL"); 623 + MODULE_DESCRIPTION("SOF support for MTL 8195 platforms"); 622 624 MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); 623 625 MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); 624 - MODULE_LICENSE("Dual BSD/GPL");
+1
sound/soc/sof/mediatek/mtk-adsp-common.c
··· 82 82 EXPORT_SYMBOL(mtk_adsp_dump); 83 83 84 84 MODULE_LICENSE("Dual BSD/GPL"); 85 + MODULE_DESCRIPTION("SOF helpers for MTK ADSP platforms");
+1 -1
sound/soc/sof/nocodec.c
··· 110 110 }; 111 111 module_platform_driver(sof_nocodec_audio) 112 112 113 + MODULE_LICENSE("Dual BSD/GPL"); 113 114 MODULE_DESCRIPTION("ASoC sof nocodec"); 114 115 MODULE_AUTHOR("Liam Girdwood"); 115 - MODULE_LICENSE("Dual BSD/GPL"); 116 116 MODULE_ALIAS("platform:sof-nocodec");
+1
sound/soc/sof/sof-acpi-dev.c
··· 100 100 EXPORT_SYMBOL_NS(sof_acpi_remove, SND_SOC_SOF_ACPI_DEV); 101 101 102 102 MODULE_LICENSE("Dual BSD/GPL"); 103 + MODULE_DESCRIPTION("SOF support for ACPI platforms");
+1 -1
sound/soc/sof/sof-client-ipc-flood-test.c
··· 394 394 395 395 module_auxiliary_driver(sof_ipc_flood_client_drv); 396 396 397 - MODULE_DESCRIPTION("SOF IPC Flood Test Client Driver"); 398 397 MODULE_LICENSE("GPL"); 398 + MODULE_DESCRIPTION("SOF IPC Flood Test Client Driver"); 399 399 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1 -1
sound/soc/sof/sof-client-ipc-kernel-injector.c
··· 157 157 158 158 module_auxiliary_driver(sof_msg_inject_client_drv); 159 159 160 - MODULE_DESCRIPTION("SOF IPC Kernel Injector Client Driver"); 161 160 MODULE_LICENSE("GPL"); 161 + MODULE_DESCRIPTION("SOF IPC Kernel Injector Client Driver"); 162 162 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1 -1
sound/soc/sof/sof-client-ipc-msg-injector.c
··· 335 335 336 336 module_auxiliary_driver(sof_msg_inject_client_drv); 337 337 338 - MODULE_DESCRIPTION("SOF IPC Message Injector Client Driver"); 339 338 MODULE_LICENSE("GPL"); 339 + MODULE_DESCRIPTION("SOF IPC Message Injector Client Driver"); 340 340 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1 -1
sound/soc/sof/sof-client-probes.c
··· 540 540 541 541 module_auxiliary_driver(sof_probes_client_drv); 542 542 543 - MODULE_DESCRIPTION("SOF Probes Client Driver"); 544 543 MODULE_LICENSE("GPL v2"); 544 + MODULE_DESCRIPTION("SOF Probes Client Driver"); 545 545 MODULE_IMPORT_NS(SND_SOC_SOF_CLIENT);
+1
sound/soc/sof/sof-of-dev.c
··· 93 93 EXPORT_SYMBOL(sof_of_shutdown); 94 94 95 95 MODULE_LICENSE("Dual BSD/GPL"); 96 + MODULE_DESCRIPTION("SOF support for OF/DT platforms");
+1
sound/soc/sof/sof-pci-dev.c
··· 304 304 EXPORT_SYMBOL_NS(sof_pci_shutdown, SND_SOC_SOF_PCI_DEV); 305 305 306 306 MODULE_LICENSE("Dual BSD/GPL"); 307 + MODULE_DESCRIPTION("SOF support for PCI platforms");
+1
sound/soc/sof/sof-utils.c
··· 73 73 EXPORT_SYMBOL(snd_sof_create_page_table); 74 74 75 75 MODULE_LICENSE("Dual BSD/GPL"); 76 + MODULE_DESCRIPTION("SOF utils");
-2
sound/soc/sof/stream-ipc.c
··· 125 125 return 0; 126 126 } 127 127 EXPORT_SYMBOL(sof_stream_pcm_close); 128 - 129 - MODULE_LICENSE("Dual BSD/GPL");
+1 -1
sound/soc/sof/xtensa/core.c
··· 151 151 }; 152 152 EXPORT_SYMBOL_NS(sof_xtensa_arch_ops, SND_SOC_SOF_XTENSA); 153 153 154 - MODULE_DESCRIPTION("SOF Xtensa DSP support"); 155 154 MODULE_LICENSE("Dual BSD/GPL"); 155 + MODULE_DESCRIPTION("SOF Xtensa DSP support");
+1 -1
tools/bpf/resolve_btfids/main.c
··· 728 728 729 729 static int symbols_patch(struct object *obj) 730 730 { 731 - int err; 731 + off_t err; 732 732 733 733 if (__symbols_patch(obj, &obj->structs) || 734 734 __symbols_patch(obj, &obj->unions) ||
+1
tools/include/uapi/linux/netdev.h
··· 148 148 NETDEV_A_QSTATS_RX_ALLOC_FAIL, 149 149 NETDEV_A_QSTATS_RX_HW_DROPS, 150 150 NETDEV_A_QSTATS_RX_HW_DROP_OVERRUNS, 151 + NETDEV_A_QSTATS_RX_CSUM_COMPLETE, 151 152 NETDEV_A_QSTATS_RX_CSUM_UNNECESSARY, 152 153 NETDEV_A_QSTATS_RX_CSUM_NONE, 153 154 NETDEV_A_QSTATS_RX_CSUM_BAD,
+30 -1
tools/lib/bpf/features.c
··· 392 392 link_fd = bpf_link_create(prog_fd, -1, BPF_TRACE_UPROBE_MULTI, &link_opts); 393 393 err = -errno; /* close() can clobber errno */ 394 394 395 + if (link_fd >= 0 || err != -EBADF) { 396 + close(link_fd); 397 + close(prog_fd); 398 + return 0; 399 + } 400 + 401 + /* Initial multi-uprobe support in kernel didn't handle PID filtering 402 + * correctly (it was doing thread filtering, not process filtering). 403 + * So now we'll detect if PID filtering logic was fixed, and, if not, 404 + * we'll pretend multi-uprobes are not supported, if not. 405 + * Multi-uprobes are used in USDT attachment logic, and we need to be 406 + * conservative here, because multi-uprobe selection happens early at 407 + * load time, while the use of PID filtering is known late at 408 + * attachment time, at which point it's too late to undo multi-uprobe 409 + * selection. 410 + * 411 + * Creating uprobe with pid == -1 for (invalid) '/' binary will fail 412 + * early with -EINVAL on kernels with fixed PID filtering logic; 413 + * otherwise -ESRCH would be returned if passed correct binary path 414 + * (but we'll just get -BADF, of course). 415 + */ 416 + link_opts.uprobe_multi.pid = -1; /* invalid PID */ 417 + link_opts.uprobe_multi.path = "/"; /* invalid path */ 418 + link_opts.uprobe_multi.offsets = &offset; 419 + link_opts.uprobe_multi.cnt = 1; 420 + 421 + link_fd = bpf_link_create(prog_fd, -1, BPF_TRACE_UPROBE_MULTI, &link_opts); 422 + err = -errno; /* close() can clobber errno */ 423 + 395 424 if (link_fd >= 0) 396 425 close(link_fd); 397 426 close(prog_fd); 398 427 399 - return link_fd < 0 && err == -EBADF; 428 + return link_fd < 0 && err == -EINVAL; 400 429 } 401 430 402 431 static int probe_kern_bpf_cookie(int token_fd)
+94
tools/testing/selftests/bpf/prog_tests/tc_netkit.c
··· 73 73 "up primary"); 74 74 ASSERT_OK(system("ip addr add dev " netkit_name " 10.0.0.1/24"), 75 75 "addr primary"); 76 + 77 + if (mode == NETKIT_L3) { 78 + ASSERT_EQ(system("ip link set dev " netkit_name 79 + " addr ee:ff:bb:cc:aa:dd 2> /dev/null"), 512, 80 + "set hwaddress"); 81 + } else { 82 + ASSERT_OK(system("ip link set dev " netkit_name 83 + " addr ee:ff:bb:cc:aa:dd"), 84 + "set hwaddress"); 85 + } 76 86 if (same_netns) { 77 87 ASSERT_OK(system("ip link set dev " netkit_peer " up"), 78 88 "up peer"); ··· 97 87 netkit_peer " 10.0.0.2/24"), "addr peer"); 98 88 } 99 89 return err; 90 + } 91 + 92 + static void move_netkit(void) 93 + { 94 + ASSERT_OK(system("ip link set " netkit_peer " netns foo"), 95 + "move peer"); 96 + ASSERT_OK(system("ip netns exec foo ip link set dev " 97 + netkit_peer " up"), "up peer"); 98 + ASSERT_OK(system("ip netns exec foo ip addr add dev " 99 + netkit_peer " 10.0.0.2/24"), "addr peer"); 100 100 } 101 101 102 102 static void destroy_netkit(void) ··· 704 684 { 705 685 serial_test_tc_netkit_neigh_links_target(NETKIT_L2, BPF_NETKIT_PRIMARY); 706 686 serial_test_tc_netkit_neigh_links_target(NETKIT_L3, BPF_NETKIT_PRIMARY); 687 + } 688 + 689 + static void serial_test_tc_netkit_pkt_type_mode(int mode) 690 + { 691 + LIBBPF_OPTS(bpf_netkit_opts, optl_nk); 692 + LIBBPF_OPTS(bpf_tcx_opts, optl_tcx); 693 + int err, ifindex, ifindex2; 694 + struct test_tc_link *skel; 695 + struct bpf_link *link; 696 + 697 + err = create_netkit(mode, NETKIT_PASS, NETKIT_PASS, 698 + &ifindex, true); 699 + if (err) 700 + return; 701 + 702 + ifindex2 = if_nametoindex(netkit_peer); 703 + ASSERT_NEQ(ifindex, ifindex2, "ifindex_1_2"); 704 + 705 + skel = test_tc_link__open(); 706 + if (!ASSERT_OK_PTR(skel, "skel_open")) 707 + goto cleanup; 708 + 709 + ASSERT_EQ(bpf_program__set_expected_attach_type(skel->progs.tc1, 710 + BPF_NETKIT_PRIMARY), 0, "tc1_attach_type"); 711 + ASSERT_EQ(bpf_program__set_expected_attach_type(skel->progs.tc7, 712 + BPF_TCX_INGRESS), 0, "tc7_attach_type"); 713 + 714 + err = test_tc_link__load(skel); 715 + if (!ASSERT_OK(err, "skel_load")) 716 + goto cleanup; 717 + 718 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 0); 719 + assert_mprog_count_ifindex(ifindex2, BPF_TCX_INGRESS, 0); 720 + 721 + link = bpf_program__attach_netkit(skel->progs.tc1, ifindex, &optl_nk); 722 + if (!ASSERT_OK_PTR(link, "link_attach")) 723 + goto cleanup; 724 + 725 + skel->links.tc1 = link; 726 + 727 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 1); 728 + assert_mprog_count_ifindex(ifindex2, BPF_TCX_INGRESS, 0); 729 + 730 + link = bpf_program__attach_tcx(skel->progs.tc7, ifindex2, &optl_tcx); 731 + if (!ASSERT_OK_PTR(link, "link_attach")) 732 + goto cleanup; 733 + 734 + skel->links.tc7 = link; 735 + 736 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 1); 737 + assert_mprog_count_ifindex(ifindex2, BPF_TCX_INGRESS, 1); 738 + 739 + move_netkit(); 740 + 741 + tc_skel_reset_all_seen(skel); 742 + skel->bss->set_type = true; 743 + ASSERT_EQ(send_icmp(), 0, "icmp_pkt"); 744 + 745 + ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 746 + ASSERT_EQ(skel->bss->seen_tc7, true, "seen_tc7"); 747 + 748 + ASSERT_EQ(skel->bss->seen_host, true, "seen_host"); 749 + ASSERT_EQ(skel->bss->seen_mcast, true, "seen_mcast"); 750 + cleanup: 751 + test_tc_link__destroy(skel); 752 + 753 + assert_mprog_count_ifindex(ifindex, BPF_NETKIT_PRIMARY, 0); 754 + destroy_netkit(); 755 + } 756 + 757 + void serial_test_tc_netkit_pkt_type(void) 758 + { 759 + serial_test_tc_netkit_pkt_type_mode(NETKIT_L2); 760 + serial_test_tc_netkit_pkt_type_mode(NETKIT_L3); 707 761 }
+126 -8
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 3 #include <unistd.h> 4 + #include <pthread.h> 4 5 #include <test_progs.h> 5 6 #include "uprobe_multi.skel.h" 6 7 #include "uprobe_multi_bench.skel.h" 7 8 #include "uprobe_multi_usdt.skel.h" 8 9 #include "bpf/libbpf_internal.h" 9 10 #include "testing_helpers.h" 11 + #include "../sdt.h" 10 12 11 13 static char test_data[] = "test_data"; 12 14 ··· 27 25 asm volatile (""); 28 26 } 29 27 28 + noinline void usdt_trigger(void) 29 + { 30 + STAP_PROBE(test, pid_filter_usdt); 31 + } 32 + 30 33 struct child { 31 34 int go[2]; 35 + int c2p[2]; /* child -> parent channel */ 32 36 int pid; 37 + int tid; 38 + pthread_t thread; 33 39 }; 34 40 35 41 static void release_child(struct child *child) ··· 48 38 return; 49 39 close(child->go[1]); 50 40 close(child->go[0]); 41 + if (child->thread) 42 + pthread_join(child->thread, NULL); 43 + close(child->c2p[0]); 44 + close(child->c2p[1]); 51 45 if (child->pid > 0) 52 46 waitpid(child->pid, &child_status, 0); 53 47 } ··· 77 63 if (pipe(child.go)) 78 64 return NULL; 79 65 80 - child.pid = fork(); 66 + child.pid = child.tid = fork(); 81 67 if (child.pid < 0) { 82 68 release_child(&child); 83 69 errno = EINVAL; ··· 96 82 uprobe_multi_func_1(); 97 83 uprobe_multi_func_2(); 98 84 uprobe_multi_func_3(); 85 + usdt_trigger(); 99 86 100 87 exit(errno); 101 88 } 89 + 90 + return &child; 91 + } 92 + 93 + static void *child_thread(void *ctx) 94 + { 95 + struct child *child = ctx; 96 + int c = 0, err; 97 + 98 + child->tid = syscall(SYS_gettid); 99 + 100 + /* let parent know we are ready */ 101 + err = write(child->c2p[1], &c, 1); 102 + if (err != 1) 103 + pthread_exit(&err); 104 + 105 + /* wait for parent's kick */ 106 + err = read(child->go[0], &c, 1); 107 + if (err != 1) 108 + pthread_exit(&err); 109 + 110 + uprobe_multi_func_1(); 111 + uprobe_multi_func_2(); 112 + uprobe_multi_func_3(); 113 + usdt_trigger(); 114 + 115 + err = 0; 116 + pthread_exit(&err); 117 + } 118 + 119 + static struct child *spawn_thread(void) 120 + { 121 + static struct child child; 122 + int c, err; 123 + 124 + /* pipe to notify child to execute the trigger functions */ 125 + if (pipe(child.go)) 126 + return NULL; 127 + /* pipe to notify parent that child thread is ready */ 128 + if (pipe(child.c2p)) { 129 + close(child.go[0]); 130 + close(child.go[1]); 131 + return NULL; 132 + } 133 + 134 + child.pid = getpid(); 135 + 136 + err = pthread_create(&child.thread, NULL, child_thread, &child); 137 + if (err) { 138 + err = -errno; 139 + close(child.go[0]); 140 + close(child.go[1]); 141 + close(child.c2p[0]); 142 + close(child.c2p[1]); 143 + errno = -err; 144 + return NULL; 145 + } 146 + 147 + err = read(child.c2p[0], &c, 1); 148 + if (!ASSERT_EQ(err, 1, "child_thread_ready")) 149 + return NULL; 102 150 103 151 return &child; 104 152 } ··· 179 103 * passed at the probe attach. 180 104 */ 181 105 skel->bss->pid = child ? 0 : getpid(); 106 + skel->bss->expect_pid = child ? child->pid : 0; 107 + 108 + /* trigger all probes, if we are testing child *process*, just to make 109 + * sure that PID filtering doesn't let through activations from wrong 110 + * PIDs; when we test child *thread*, we don't want to do this to 111 + * avoid double counting number of triggering events 112 + */ 113 + if (!child || !child->thread) { 114 + uprobe_multi_func_1(); 115 + uprobe_multi_func_2(); 116 + uprobe_multi_func_3(); 117 + usdt_trigger(); 118 + } 182 119 183 120 if (child) 184 121 kick_child(child); 185 - 186 - /* trigger all probes */ 187 - uprobe_multi_func_1(); 188 - uprobe_multi_func_2(); 189 - uprobe_multi_func_3(); 190 122 191 123 /* 192 124 * There are 2 entry and 2 exit probe called for each uprobe_multi_func_[123] ··· 210 126 211 127 ASSERT_EQ(skel->bss->uprobe_multi_sleep_result, 6, "uprobe_multi_sleep_result"); 212 128 213 - if (child) 129 + ASSERT_FALSE(skel->bss->bad_pid_seen, "bad_pid_seen"); 130 + 131 + if (child) { 214 132 ASSERT_EQ(skel->bss->child_pid, child->pid, "uprobe_multi_child_pid"); 133 + ASSERT_EQ(skel->bss->child_tid, child->tid, "uprobe_multi_child_tid"); 134 + } 215 135 } 216 136 217 137 static void test_skel_api(void) ··· 278 190 if (!ASSERT_OK_PTR(skel->links.uprobe_extra, "bpf_program__attach_uprobe_multi")) 279 191 goto cleanup; 280 192 193 + /* Attach (uprobe-backed) USDTs */ 194 + skel->links.usdt_pid = bpf_program__attach_usdt(skel->progs.usdt_pid, pid, binary, 195 + "test", "pid_filter_usdt", NULL); 196 + if (!ASSERT_OK_PTR(skel->links.usdt_pid, "attach_usdt_pid")) 197 + goto cleanup; 198 + 199 + skel->links.usdt_extra = bpf_program__attach_usdt(skel->progs.usdt_extra, -1, binary, 200 + "test", "pid_filter_usdt", NULL); 201 + if (!ASSERT_OK_PTR(skel->links.usdt_extra, "attach_usdt_extra")) 202 + goto cleanup; 203 + 281 204 uprobe_multi_test_run(skel, child); 282 205 206 + ASSERT_FALSE(skel->bss->bad_pid_seen_usdt, "bad_pid_seen_usdt"); 207 + if (child) { 208 + ASSERT_EQ(skel->bss->child_pid_usdt, child->pid, "usdt_multi_child_pid"); 209 + ASSERT_EQ(skel->bss->child_tid_usdt, child->tid, "usdt_multi_child_tid"); 210 + } 283 211 cleanup: 284 212 uprobe_multi__destroy(skel); 285 213 } ··· 311 207 /* pid filter */ 312 208 child = spawn_child(); 313 209 if (!ASSERT_OK_PTR(child, "spawn_child")) 210 + return; 211 + 212 + __test_attach_api(binary, pattern, opts, child); 213 + 214 + /* pid filter (thread) */ 215 + child = spawn_thread(); 216 + if (!ASSERT_OK_PTR(child, "spawn_thread")) 314 217 return; 315 218 316 219 __test_attach_api(binary, pattern, opts, child); ··· 508 397 link_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts); 509 398 if (!ASSERT_ERR(link_fd, "link_fd")) 510 399 goto cleanup; 511 - ASSERT_EQ(link_fd, -ESRCH, "pid_is_wrong"); 400 + ASSERT_EQ(link_fd, -EINVAL, "pid_is_wrong"); 512 401 513 402 cleanup: 514 403 if (link_fd >= 0) ··· 603 492 /* pid filter */ 604 493 child = spawn_child(); 605 494 if (!ASSERT_OK_PTR(child, "spawn_child")) 495 + return; 496 + 497 + __test_link_api(child); 498 + 499 + /* pid filter (thread) */ 500 + child = spawn_thread(); 501 + if (!ASSERT_OK_PTR(child, "spawn_thread")) 606 502 return; 607 503 608 504 __test_link_api(child);
+2
tools/testing/selftests/bpf/prog_tests/verifier.c
··· 67 67 #include "verifier_search_pruning.skel.h" 68 68 #include "verifier_sock.skel.h" 69 69 #include "verifier_sock_addr.skel.h" 70 + #include "verifier_sockmap_mutate.skel.h" 70 71 #include "verifier_spill_fill.skel.h" 71 72 #include "verifier_spin_lock.skel.h" 72 73 #include "verifier_stack_ptr.skel.h" ··· 184 183 void test_verifier_search_pruning(void) { RUN(verifier_search_pruning); } 185 184 void test_verifier_sock(void) { RUN(verifier_sock); } 186 185 void test_verifier_sock_addr(void) { RUN(verifier_sock_addr); } 186 + void test_verifier_sockmap_mutate(void) { RUN(verifier_sockmap_mutate); } 187 187 void test_verifier_spill_fill(void) { RUN(verifier_spill_fill); } 188 188 void test_verifier_spin_lock(void) { RUN(verifier_spin_lock); } 189 189 void test_verifier_stack_ptr(void) { RUN(verifier_stack_ptr); }
+34 -1
tools/testing/selftests/bpf/progs/test_tc_link.c
··· 4 4 5 5 #include <linux/bpf.h> 6 6 #include <linux/if_ether.h> 7 - 7 + #include <linux/stddef.h> 8 + #include <linux/if_packet.h> 8 9 #include <bpf/bpf_endian.h> 9 10 #include <bpf/bpf_helpers.h> 10 11 ··· 17 16 bool seen_tc4; 18 17 bool seen_tc5; 19 18 bool seen_tc6; 19 + bool seen_tc7; 20 + 21 + bool set_type; 22 + 20 23 bool seen_eth; 24 + bool seen_host; 25 + bool seen_mcast; 21 26 22 27 SEC("tc/ingress") 23 28 int tc1(struct __sk_buff *skb) ··· 35 28 if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth))) 36 29 goto out; 37 30 seen_eth = eth.h_proto == bpf_htons(ETH_P_IP); 31 + seen_host = skb->pkt_type == PACKET_HOST; 32 + if (seen_host && set_type) { 33 + eth.h_dest[0] = 4; 34 + if (bpf_skb_store_bytes(skb, 0, &eth, sizeof(eth), 0)) 35 + goto fail; 36 + bpf_skb_change_type(skb, PACKET_MULTICAST); 37 + } 38 38 out: 39 39 seen_tc1 = true; 40 + fail: 40 41 return TCX_NEXT; 41 42 } 42 43 ··· 80 65 int tc6(struct __sk_buff *skb) 81 66 { 82 67 seen_tc6 = true; 68 + return TCX_PASS; 69 + } 70 + 71 + SEC("tc/ingress") 72 + int tc7(struct __sk_buff *skb) 73 + { 74 + struct ethhdr eth = {}; 75 + 76 + if (skb->protocol != __bpf_constant_htons(ETH_P_IP)) 77 + goto out; 78 + if (bpf_skb_load_bytes(skb, 0, &eth, sizeof(eth))) 79 + goto out; 80 + if (eth.h_dest[0] == 4 && set_type) { 81 + seen_mcast = skb->pkt_type == PACKET_MULTICAST; 82 + bpf_skb_change_type(skb, PACKET_HOST); 83 + } 84 + out: 85 + seen_tc7 = true; 83 86 return TCX_PASS; 84 87 }
+46 -4
tools/testing/selftests/bpf/progs/uprobe_multi.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/bpf.h> 2 + #include "vmlinux.h" 3 3 #include <bpf/bpf_helpers.h> 4 4 #include <bpf/bpf_tracing.h> 5 - #include <stdbool.h> 5 + #include <bpf/usdt.bpf.h> 6 6 7 7 char _license[] SEC("license") = "GPL"; 8 8 ··· 22 22 23 23 int pid = 0; 24 24 int child_pid = 0; 25 + int child_tid = 0; 26 + int child_pid_usdt = 0; 27 + int child_tid_usdt = 0; 28 + 29 + int expect_pid = 0; 30 + bool bad_pid_seen = false; 31 + bool bad_pid_seen_usdt = false; 25 32 26 33 bool test_cookie = false; 27 34 void *user_ptr = 0; ··· 43 36 44 37 static void uprobe_multi_check(void *ctx, bool is_return, bool is_sleep) 45 38 { 46 - child_pid = bpf_get_current_pid_tgid() >> 32; 39 + __u64 cur_pid_tgid = bpf_get_current_pid_tgid(); 40 + __u32 cur_pid; 47 41 48 - if (pid && child_pid != pid) 42 + cur_pid = cur_pid_tgid >> 32; 43 + if (pid && cur_pid != pid) 49 44 return; 45 + 46 + if (expect_pid && cur_pid != expect_pid) 47 + bad_pid_seen = true; 48 + 49 + child_pid = cur_pid_tgid >> 32; 50 + child_tid = (__u32)cur_pid_tgid; 50 51 51 52 __u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; 52 53 __u64 addr = bpf_get_func_ip(ctx); ··· 112 97 SEC("uprobe.multi//proc/self/exe:uprobe_multi_func_*") 113 98 int uprobe_extra(struct pt_regs *ctx) 114 99 { 100 + /* we need this one just to mix PID-filtered and global uprobes */ 101 + return 0; 102 + } 103 + 104 + SEC("usdt") 105 + int usdt_pid(struct pt_regs *ctx) 106 + { 107 + __u64 cur_pid_tgid = bpf_get_current_pid_tgid(); 108 + __u32 cur_pid; 109 + 110 + cur_pid = cur_pid_tgid >> 32; 111 + if (pid && cur_pid != pid) 112 + return 0; 113 + 114 + if (expect_pid && cur_pid != expect_pid) 115 + bad_pid_seen_usdt = true; 116 + 117 + child_pid_usdt = cur_pid_tgid >> 32; 118 + child_tid_usdt = (__u32)cur_pid_tgid; 119 + 120 + return 0; 121 + } 122 + 123 + SEC("usdt") 124 + int usdt_extra(struct pt_regs *ctx) 125 + { 126 + /* we need this one just to mix PID-filtered and global USDT probes */ 115 127 return 0; 116 128 }
+187
tools/testing/selftests/bpf/progs/verifier_sockmap_mutate.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/bpf.h> 4 + #include <bpf/bpf_helpers.h> 5 + #include <bpf/bpf_tracing.h> 6 + 7 + #include "bpf_misc.h" 8 + 9 + #define __always_unused __attribute__((unused)) 10 + 11 + char _license[] SEC("license") = "GPL"; 12 + 13 + struct sock { 14 + } __attribute__((preserve_access_index)); 15 + 16 + struct bpf_iter__sockmap { 17 + union { 18 + struct sock *sk; 19 + }; 20 + } __attribute__((preserve_access_index)); 21 + 22 + struct { 23 + __uint(type, BPF_MAP_TYPE_SOCKHASH); 24 + __uint(max_entries, 1); 25 + __type(key, int); 26 + __type(value, int); 27 + } sockhash SEC(".maps"); 28 + 29 + struct { 30 + __uint(type, BPF_MAP_TYPE_SOCKMAP); 31 + __uint(max_entries, 1); 32 + __type(key, int); 33 + __type(value, int); 34 + } sockmap SEC(".maps"); 35 + 36 + enum { CG_OK = 1 }; 37 + 38 + int zero = 0; 39 + 40 + static __always_inline void test_sockmap_delete(void) 41 + { 42 + bpf_map_delete_elem(&sockmap, &zero); 43 + bpf_map_delete_elem(&sockhash, &zero); 44 + } 45 + 46 + static __always_inline void test_sockmap_update(void *sk) 47 + { 48 + if (sk) { 49 + bpf_map_update_elem(&sockmap, &zero, sk, BPF_ANY); 50 + bpf_map_update_elem(&sockhash, &zero, sk, BPF_ANY); 51 + } 52 + } 53 + 54 + static __always_inline void test_sockmap_lookup_and_update(void) 55 + { 56 + struct bpf_sock *sk = bpf_map_lookup_elem(&sockmap, &zero); 57 + 58 + if (sk) { 59 + test_sockmap_update(sk); 60 + bpf_sk_release(sk); 61 + } 62 + } 63 + 64 + static __always_inline void test_sockmap_mutate(void *sk) 65 + { 66 + test_sockmap_delete(); 67 + test_sockmap_update(sk); 68 + } 69 + 70 + static __always_inline void test_sockmap_lookup_and_mutate(void) 71 + { 72 + test_sockmap_delete(); 73 + test_sockmap_lookup_and_update(); 74 + } 75 + 76 + SEC("action") 77 + __success 78 + int test_sched_act(struct __sk_buff *skb) 79 + { 80 + test_sockmap_mutate(skb->sk); 81 + return 0; 82 + } 83 + 84 + SEC("classifier") 85 + __success 86 + int test_sched_cls(struct __sk_buff *skb) 87 + { 88 + test_sockmap_mutate(skb->sk); 89 + return 0; 90 + } 91 + 92 + SEC("flow_dissector") 93 + __success 94 + int test_flow_dissector_delete(struct __sk_buff *skb __always_unused) 95 + { 96 + test_sockmap_delete(); 97 + return 0; 98 + } 99 + 100 + SEC("flow_dissector") 101 + __failure __msg("program of this type cannot use helper bpf_sk_release") 102 + int test_flow_dissector_update(struct __sk_buff *skb __always_unused) 103 + { 104 + test_sockmap_lookup_and_update(); /* no access to skb->sk */ 105 + return 0; 106 + } 107 + 108 + SEC("iter/sockmap") 109 + __success 110 + int test_trace_iter(struct bpf_iter__sockmap *ctx) 111 + { 112 + test_sockmap_mutate(ctx->sk); 113 + return 0; 114 + } 115 + 116 + SEC("raw_tp/kfree") 117 + __failure __msg("cannot update sockmap in this context") 118 + int test_raw_tp_delete(const void *ctx __always_unused) 119 + { 120 + test_sockmap_delete(); 121 + return 0; 122 + } 123 + 124 + SEC("raw_tp/kfree") 125 + __failure __msg("cannot update sockmap in this context") 126 + int test_raw_tp_update(const void *ctx __always_unused) 127 + { 128 + test_sockmap_lookup_and_update(); 129 + return 0; 130 + } 131 + 132 + SEC("sk_lookup") 133 + __success 134 + int test_sk_lookup(struct bpf_sk_lookup *ctx) 135 + { 136 + test_sockmap_mutate(ctx->sk); 137 + return 0; 138 + } 139 + 140 + SEC("sk_reuseport") 141 + __success 142 + int test_sk_reuseport(struct sk_reuseport_md *ctx) 143 + { 144 + test_sockmap_mutate(ctx->sk); 145 + return 0; 146 + } 147 + 148 + SEC("socket") 149 + __success 150 + int test_socket_filter(struct __sk_buff *skb) 151 + { 152 + test_sockmap_mutate(skb->sk); 153 + return 0; 154 + } 155 + 156 + SEC("sockops") 157 + __success 158 + int test_sockops_delete(struct bpf_sock_ops *ctx __always_unused) 159 + { 160 + test_sockmap_delete(); 161 + return CG_OK; 162 + } 163 + 164 + SEC("sockops") 165 + __failure __msg("cannot update sockmap in this context") 166 + int test_sockops_update(struct bpf_sock_ops *ctx) 167 + { 168 + test_sockmap_update(ctx->sk); 169 + return CG_OK; 170 + } 171 + 172 + SEC("sockops") 173 + __success 174 + int test_sockops_update_dedicated(struct bpf_sock_ops *ctx) 175 + { 176 + bpf_sock_map_update(ctx, &sockmap, &zero, BPF_ANY); 177 + bpf_sock_hash_update(ctx, &sockhash, &zero, BPF_ANY); 178 + return CG_OK; 179 + } 180 + 181 + SEC("xdp") 182 + __success 183 + int test_xdp(struct xdp_md *ctx __always_unused) 184 + { 185 + test_sockmap_lookup_and_mutate(); 186 + return XDP_PASS; 187 + }
+45
tools/testing/selftests/landlock/fs_test.c
··· 35 35 * See https://sourceware.org/glibc/wiki/Synchronizing_Headers. 36 36 */ 37 37 #include <linux/fs.h> 38 + #include <linux/mount.h> 38 39 39 40 #include "common.h" 40 41 ··· 45 44 { 46 45 return syscall(__NR_renameat2, olddirfd, oldpath, newdirfd, newpath, 47 46 flags); 47 + } 48 + #endif 49 + 50 + #ifndef open_tree 51 + int open_tree(int dfd, const char *filename, unsigned int flags) 52 + { 53 + return syscall(__NR_open_tree, dfd, filename, flags); 48 54 } 49 55 #endif 50 56 ··· 2406 2398 { 2407 2399 refer_denied_by_default(_metadata, layer_dir_s2d1_execute, EXDEV, 2408 2400 layer_dir_s1d1_refer); 2401 + } 2402 + 2403 + /* 2404 + * Tests walking through a denied root mount. 2405 + */ 2406 + TEST_F_FORK(layout1, refer_mount_root_deny) 2407 + { 2408 + const struct landlock_ruleset_attr ruleset_attr = { 2409 + .handled_access_fs = LANDLOCK_ACCESS_FS_MAKE_DIR, 2410 + }; 2411 + int root_fd, ruleset_fd; 2412 + 2413 + /* Creates a mount object from a non-mount point. */ 2414 + set_cap(_metadata, CAP_SYS_ADMIN); 2415 + root_fd = 2416 + open_tree(AT_FDCWD, dir_s1d1, 2417 + AT_EMPTY_PATH | OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC); 2418 + clear_cap(_metadata, CAP_SYS_ADMIN); 2419 + ASSERT_LE(0, root_fd); 2420 + 2421 + ruleset_fd = 2422 + landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0); 2423 + ASSERT_LE(0, ruleset_fd); 2424 + 2425 + ASSERT_EQ(0, prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)); 2426 + ASSERT_EQ(0, landlock_restrict_self(ruleset_fd, 0)); 2427 + EXPECT_EQ(0, close(ruleset_fd)); 2428 + 2429 + /* Link denied by Landlock: EACCES. */ 2430 + EXPECT_EQ(-1, linkat(root_fd, ".", root_fd, "does_not_exist", 0)); 2431 + EXPECT_EQ(EACCES, errno); 2432 + 2433 + /* renameat2() always returns EBUSY. */ 2434 + EXPECT_EQ(-1, renameat2(root_fd, ".", root_fd, "does_not_exist", 0)); 2435 + EXPECT_EQ(EBUSY, errno); 2436 + 2437 + EXPECT_EQ(0, close(root_fd)); 2409 2438 } 2410 2439 2411 2440 TEST_F_FORK(layout1, reparent_link)
+2
tools/testing/selftests/net/hsr/hsr_ping.sh
··· 174 174 setup_hsr_interfaces 0 175 175 do_complete_ping_test 176 176 177 + setup_ns ns1 ns2 ns3 178 + 177 179 setup_hsr_interfaces 1 178 180 do_complete_ping_test 179 181
+9 -1
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 261 261 262 262 TEST_NAME="${1}" 263 263 264 + MPTCP_LIB_SUBTEST_FLAKY=0 # reset if modified 265 + 264 266 if skip_test; then 265 267 MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) 266 268 last_test_ignored=1 ··· 450 448 # $1: err msg 451 449 fail_test() 452 450 { 453 - ret=${KSFT_FAIL} 451 + if ! mptcp_lib_subtest_is_flaky; then 452 + ret=${KSFT_FAIL} 453 + fi 454 454 455 455 if [ ${#} -gt 0 ]; then 456 456 print_fail "${@}" ··· 3073 3069 fastclose_tests() 3074 3070 { 3075 3071 if reset_check_counter "fastclose test" "MPTcpExtMPFastcloseTx"; then 3072 + MPTCP_LIB_SUBTEST_FLAKY=1 3076 3073 test_linkfail=1024 fastclose=client \ 3077 3074 run_tests $ns1 $ns2 10.0.1.1 3078 3075 chk_join_nr 0 0 0 ··· 3082 3077 fi 3083 3078 3084 3079 if reset_check_counter "fastclose server test" "MPTcpExtMPFastcloseRx"; then 3080 + MPTCP_LIB_SUBTEST_FLAKY=1 3085 3081 test_linkfail=1024 fastclose=server \ 3086 3082 run_tests $ns1 $ns2 10.0.1.1 3087 3083 chk_join_nr 0 0 0 0 0 0 1 ··· 3101 3095 { 3102 3096 # single subflow 3103 3097 if reset_with_fail "Infinite map" 1; then 3098 + MPTCP_LIB_SUBTEST_FLAKY=1 3104 3099 test_linkfail=128 \ 3105 3100 run_tests $ns1 $ns2 10.0.1.1 3106 3101 chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)" ··· 3110 3103 3111 3104 # multiple subflows 3112 3105 if reset_with_fail "MP_FAIL MP_RST" 2; then 3106 + MPTCP_LIB_SUBTEST_FLAKY=1 3113 3107 tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms 3114 3108 pm_nl_set_limits $ns1 0 1 3115 3109 pm_nl_set_limits $ns2 0 1
+28 -2
tools/testing/selftests/net/mptcp/mptcp_lib.sh
··· 21 21 22 22 MPTCP_LIB_SUBTESTS=() 23 23 MPTCP_LIB_SUBTESTS_DUPLICATED=0 24 + MPTCP_LIB_SUBTEST_FLAKY=0 24 25 MPTCP_LIB_TEST_COUNTER=0 25 26 MPTCP_LIB_TEST_FORMAT="%02u %-50s" 26 27 MPTCP_LIB_IP_MPTCP=0 ··· 41 40 readonly MPTCP_LIB_COLOR_BLUE= 42 41 readonly MPTCP_LIB_COLOR_RESET= 43 42 fi 43 + 44 + # SELFTESTS_MPTCP_LIB_OVERRIDE_FLAKY env var can be set not to ignore errors 45 + # from subtests marked as flaky 46 + mptcp_lib_override_flaky() { 47 + [ "${SELFTESTS_MPTCP_LIB_OVERRIDE_FLAKY:-}" = 1 ] 48 + } 49 + 50 + mptcp_lib_subtest_is_flaky() { 51 + [ "${MPTCP_LIB_SUBTEST_FLAKY}" = 1 ] && ! mptcp_lib_override_flaky 52 + } 44 53 45 54 # $1: color, $2: text 46 55 mptcp_lib_print_color() { ··· 83 72 } 84 73 85 74 mptcp_lib_pr_fail() { 86 - mptcp_lib_print_err "[FAIL]${1:+ ${*}}" 75 + local title cmt 76 + 77 + if mptcp_lib_subtest_is_flaky; then 78 + title="IGNO" 79 + cmt=" (flaky)" 80 + else 81 + title="FAIL" 82 + fi 83 + 84 + mptcp_lib_print_err "[${title}]${cmt}${1:+ ${*}}" 87 85 } 88 86 89 87 mptcp_lib_pr_info() { ··· 228 208 229 209 # $1: test name 230 210 mptcp_lib_result_fail() { 231 - __mptcp_lib_result_add "not ok" "${1}" 211 + if mptcp_lib_subtest_is_flaky; then 212 + # It might sound better to use 'not ok # TODO' or 'ok # SKIP', 213 + # but some CIs don't understand 'TODO' and treat SKIP as errors. 214 + __mptcp_lib_result_add "ok" "${1} # IGNORE Flaky" 215 + else 216 + __mptcp_lib_result_add "not ok" "${1}" 217 + fi 232 218 } 233 219 234 220 # $1: test name
+3 -3
tools/testing/selftests/net/mptcp/simult_flows.sh
··· 244 244 do_transfer $small $large $time 245 245 lret=$? 246 246 mptcp_lib_result_code "${lret}" "${msg}" 247 - if [ $lret -ne 0 ]; then 247 + if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then 248 248 ret=$lret 249 249 [ $bail -eq 0 ] || exit $ret 250 250 fi ··· 254 254 do_transfer $large $small $time 255 255 lret=$? 256 256 mptcp_lib_result_code "${lret}" "${msg}" 257 - if [ $lret -ne 0 ]; then 257 + if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then 258 258 ret=$lret 259 259 [ $bail -eq 0 ] || exit $ret 260 260 fi ··· 290 290 run_test 10 10 1 25 "balanced bwidth with unbalanced delay" 291 291 292 292 # we still need some additional infrastructure to pass the following test-cases 293 - run_test 10 3 0 0 "unbalanced bwidth" 293 + MPTCP_LIB_SUBTEST_FLAKY=1 run_test 10 3 0 0 "unbalanced bwidth" 294 294 run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay" 295 295 run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay" 296 296
+44
tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
··· 133 133 ] 134 134 }, 135 135 { 136 + "id": "6f62", 137 + "name": "Add taprio Qdisc with too short interval", 138 + "category": [ 139 + "qdisc", 140 + "taprio" 141 + ], 142 + "plugins": { 143 + "requires": "nsPlugin" 144 + }, 145 + "setup": [ 146 + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device" 147 + ], 148 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 300 sched-entry S 02 1700 clockid CLOCK_TAI", 149 + "expExitCode": "2", 150 + "verifyCmd": "$TC qdisc show dev $ETH", 151 + "matchPattern": "qdisc taprio 1: root refcnt", 152 + "matchCount": "0", 153 + "teardown": [ 154 + "echo \"1\" > /sys/bus/netdevsim/del_device" 155 + ] 156 + }, 157 + { 158 + "id": "831f", 159 + "name": "Add taprio Qdisc with too short cycle-time", 160 + "category": [ 161 + "qdisc", 162 + "taprio" 163 + ], 164 + "plugins": { 165 + "requires": "nsPlugin" 166 + }, 167 + "setup": [ 168 + "echo \"1 1 8\" > /sys/bus/netdevsim/new_device" 169 + ], 170 + "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 200000 sched-entry S 02 200000 cycle-time 100 clockid CLOCK_TAI", 171 + "expExitCode": "2", 172 + "verifyCmd": "$TC qdisc show dev $ETH", 173 + "matchPattern": "qdisc taprio 1: root refcnt", 174 + "matchCount": "0", 175 + "teardown": [ 176 + "echo \"1\" > /sys/bus/netdevsim/del_device" 177 + ] 178 + }, 179 + { 136 180 "id": "3e1e", 137 181 "name": "Add taprio Qdisc with an invalid cycle-time", 138 182 "category": [