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

Merge branch 'for-linus' into for-next

+1759 -1225
+1 -1
Documentation/ABI/stable/sysfs-block
··· 731 731 Description: 732 732 [RW] If the device is registered for writeback throttling, then 733 733 this file shows the target minimum read latency. If this latency 734 - is exceeded in a given window of time (see wb_window_usec), then 734 + is exceeded in a given window of time (see curr_win_nsec), then 735 735 the writeback throttling will start scaling back writes. Writing 736 736 a value of '0' to this file disables the feature. Writing a 737 737 value of '-1' to this file resets the value to the default
+1 -1
Documentation/admin-guide/blockdev/zoned_loop.rst
··· 79 79 the zone size. Default: zone size. 80 80 conv_zones Total number of conventioanl zones starting from sector 0. 81 81 Default: 8. 82 - base_dir Path to the base directoy where to create the directory 82 + base_dir Path to the base directory where to create the directory 83 83 containing the zone files of the device. 84 84 Default=/var/local/zloop. 85 85 The device directory containing the zone files is always
+1 -1
Documentation/admin-guide/hw-vuln/attack_vector_controls.rst
··· 214 214 Spectre_v2 X X 215 215 Spectre_v2_user X X * (Note 1) 216 216 SRBDS X X X X 217 - SRSO X X 217 + SRSO X X X X 218 218 SSB (Note 4) 219 219 TAA X X X X * (Note 2) 220 220 TSA X X X X
+4 -2
Documentation/devicetree/bindings/net/thead,th1520-gmac.yaml
··· 62 62 items: 63 63 - description: GMAC main clock 64 64 - description: Peripheral registers interface clock 65 + - description: APB glue registers interface clock 65 66 66 67 clock-names: 67 68 items: 68 69 - const: stmmaceth 69 70 - const: pclk 71 + - const: apb 70 72 71 73 interrupts: 72 74 items: ··· 90 88 compatible = "thead,th1520-gmac", "snps,dwmac-3.70a"; 91 89 reg = <0xe7070000 0x2000>, <0xec003000 0x1000>; 92 90 reg-names = "dwmac", "apb"; 93 - clocks = <&clk 1>, <&clk 2>; 94 - clock-names = "stmmaceth", "pclk"; 91 + clocks = <&clk 1>, <&clk 2>, <&clk 3>; 92 + clock-names = "stmmaceth", "pclk", "apb"; 95 93 interrupts = <66>; 96 94 interrupt-names = "macirq"; 97 95 phy-mode = "rgmii-id";
+1 -1
Documentation/networking/ip-sysctl.rst
··· 1420 1420 A negative value means the networking namespace does not own its 1421 1421 hash buckets and shares the initial networking namespace's one. 1422 1422 1423 - udp_child_ehash_entries - INTEGER 1423 + udp_child_hash_entries - INTEGER 1424 1424 Control the number of hash buckets for UDP sockets in the child 1425 1425 networking namespace, which must be set before clone() or unshare(). 1426 1426
+4 -6
MAINTAINERS
··· 11438 11438 HUNG TASK DETECTOR 11439 11439 M: Andrew Morton <akpm@linux-foundation.org> 11440 11440 R: Lance Yang <lance.yang@linux.dev> 11441 + R: Masami Hiramatsu <mhiramat@kernel.org> 11441 11442 L: linux-kernel@vger.kernel.org 11442 11443 S: Maintained 11443 11444 F: include/linux/hung_task.h ··· 12584 12583 F: drivers/cpufreq/intel_pstate.c 12585 12584 12586 12585 INTEL PTP DFL ToD DRIVER 12587 - M: Tianfei Zhang <tianfei.zhang@intel.com> 12588 12586 L: linux-fpga@vger.kernel.org 12589 12587 L: netdev@vger.kernel.org 12590 - S: Maintained 12588 + S: Orphan 12591 12589 F: drivers/ptp/ptp_dfl_tod.c 12592 12590 12593 12591 INTEL QUADRATURE ENCODER PERIPHERAL DRIVER ··· 12724 12724 F: drivers/platform/x86/intel/wmi/thunderbolt.c 12725 12725 12726 12726 INTEL WWAN IOSM DRIVER 12727 - M: M Chetan Kumar <m.chetan.kumar@intel.com> 12728 12727 L: netdev@vger.kernel.org 12729 - S: Maintained 12728 + S: Orphan 12730 12729 F: drivers/net/wwan/iosm/ 12731 12730 12732 12731 INTEL(R) FLEXIBLE RETURN AND EVENT DELIVERY ··· 13685 13686 13686 13687 KPROBES 13687 13688 M: Naveen N Rao <naveen@kernel.org> 13688 - M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 13689 13689 M: "David S. Miller" <davem@davemloft.net> 13690 13690 M: Masami Hiramatsu <mhiramat@kernel.org> 13691 13691 L: linux-kernel@vger.kernel.org ··· 15672 15674 M: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com> 15673 15675 R: Chiranjeevi Rapolu <chiranjeevi.rapolu@linux.intel.com> 15674 15676 R: Liu Haijun <haijun.liu@mediatek.com> 15675 - R: M Chetan Kumar <m.chetan.kumar@linux.intel.com> 15676 15677 R: Ricardo Martinez <ricardo.martinez@linux.intel.com> 15677 15678 L: netdev@vger.kernel.org 15678 15679 S: Supported ··· 17448 17451 NETFILTER 17449 17452 M: Pablo Neira Ayuso <pablo@netfilter.org> 17450 17453 M: Jozsef Kadlecsik <kadlec@netfilter.org> 17454 + M: Florian Westphal <fw@strlen.de> 17451 17455 L: netfilter-devel@vger.kernel.org 17452 17456 L: coreteam@netfilter.org 17453 17457 S: Maintained
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 17 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc1 5 + EXTRAVERSION = -rc2 6 6 NAME = Baby Opossum Posse 7 7 8 8 # *DOCUMENTATION*
+6 -4
arch/riscv/boot/dts/thead/th1520.dtsi
··· 297 297 reg-names = "dwmac", "apb"; 298 298 interrupts = <67 IRQ_TYPE_LEVEL_HIGH>; 299 299 interrupt-names = "macirq"; 300 - clocks = <&clk CLK_GMAC_AXI>, <&clk CLK_GMAC1>; 301 - clock-names = "stmmaceth", "pclk"; 300 + clocks = <&clk CLK_GMAC_AXI>, <&clk CLK_GMAC1>, 301 + <&clk CLK_PERISYS_APB4_HCLK>; 302 + clock-names = "stmmaceth", "pclk", "apb"; 302 303 snps,pbl = <32>; 303 304 snps,fixed-burst; 304 305 snps,multicast-filter-bins = <64>; ··· 320 319 reg-names = "dwmac", "apb"; 321 320 interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; 322 321 interrupt-names = "macirq"; 323 - clocks = <&clk CLK_GMAC_AXI>, <&clk CLK_GMAC0>; 324 - clock-names = "stmmaceth", "pclk"; 322 + clocks = <&clk CLK_GMAC_AXI>, <&clk CLK_GMAC0>, 323 + <&clk CLK_PERISYS_APB4_HCLK>; 324 + clock-names = "stmmaceth", "pclk", "apb"; 325 325 snps,pbl = <32>; 326 326 snps,fixed-burst; 327 327 snps,multicast-filter-bins = <64>;
+13
arch/x86/boot/cpuflags.c
··· 106 106 cpuid(0x80000001, &ignored, &ignored, &cpu.flags[6], 107 107 &cpu.flags[1]); 108 108 } 109 + 110 + if (max_amd_level >= 0x8000001f) { 111 + u32 ebx; 112 + 113 + /* 114 + * The X86_FEATURE_COHERENCY_SFW_NO feature bit is in 115 + * the virtualization flags entry (word 8) and set by 116 + * scattered.c, so the bit needs to be explicitly set. 117 + */ 118 + cpuid(0x8000001f, &ignored, &ebx, &ignored, &ignored); 119 + if (ebx & BIT(31)) 120 + set_bit(X86_FEATURE_COHERENCY_SFW_NO, cpu.flags); 121 + } 109 122 } 110 123 }
+8
arch/x86/boot/startup/sev-shared.c
··· 785 785 pc->entry[0].page_size = RMP_PG_SIZE_4K; 786 786 pc->entry[0].action = validate; 787 787 pc->entry[0].ignore_cf = 0; 788 + pc->entry[0].rsvd = 0; 788 789 pc->entry[0].pfn = paddr >> PAGE_SHIFT; 789 790 790 791 /* Protocol 0, Call ID 1 */ ··· 811 810 if (ret) 812 811 sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_PVALIDATE); 813 812 } 813 + 814 + /* 815 + * If validating memory (making it private) and affected by the 816 + * cache-coherency vulnerability, perform the cache eviction mitigation. 817 + */ 818 + if (validate && !has_cpuflag(X86_FEATURE_COHERENCY_SFW_NO)) 819 + sev_evict_cache((void *)vaddr, 1); 814 820 } 815 821 816 822 /*
+23
arch/x86/coco/sev/core.c
··· 227 227 pe->page_size = RMP_PG_SIZE_4K; 228 228 pe->action = action; 229 229 pe->ignore_cf = 0; 230 + pe->rsvd = 0; 230 231 pe->pfn = pfn; 231 232 232 233 pe++; ··· 258 257 pe->page_size = e->pagesize ? RMP_PG_SIZE_2M : RMP_PG_SIZE_4K; 259 258 pe->action = e->operation == SNP_PAGE_STATE_PRIVATE; 260 259 pe->ignore_cf = 0; 260 + pe->rsvd = 0; 261 261 pe->pfn = e->gfn; 262 262 263 263 pe++; ··· 360 358 361 359 static void pvalidate_pages(struct snp_psc_desc *desc) 362 360 { 361 + struct psc_entry *e; 362 + unsigned int i; 363 + 363 364 if (snp_vmpl) 364 365 svsm_pval_pages(desc); 365 366 else 366 367 pval_pages(desc); 368 + 369 + /* 370 + * If not affected by the cache-coherency vulnerability there is no need 371 + * to perform the cache eviction mitigation. 372 + */ 373 + if (cpu_feature_enabled(X86_FEATURE_COHERENCY_SFW_NO)) 374 + return; 375 + 376 + for (i = 0; i <= desc->hdr.end_entry; i++) { 377 + e = &desc->entries[i]; 378 + 379 + /* 380 + * If validating memory (making it private) perform the cache 381 + * eviction mitigation. 382 + */ 383 + if (e->operation == SNP_PAGE_STATE_PRIVATE) 384 + sev_evict_cache(pfn_to_kaddr(e->gfn), e->pagesize ? 512 : 1); 385 + } 367 386 } 368 387 369 388 static int vmgexit_psc(struct ghcb *ghcb, struct snp_psc_desc *desc)
+17 -16
arch/x86/coco/sev/vc-handle.c
··· 371 371 * executing with Secure TSC enabled, so special handling is required for 372 372 * accesses of MSR_IA32_TSC and MSR_AMD64_GUEST_TSC_FREQ. 373 373 */ 374 - static enum es_result __vc_handle_secure_tsc_msrs(struct pt_regs *regs, bool write) 374 + static enum es_result __vc_handle_secure_tsc_msrs(struct es_em_ctxt *ctxt, bool write) 375 375 { 376 + struct pt_regs *regs = ctxt->regs; 376 377 u64 tsc; 377 378 378 379 /* 379 - * GUEST_TSC_FREQ should not be intercepted when Secure TSC is enabled. 380 - * Terminate the SNP guest when the interception is enabled. 380 + * Writing to MSR_IA32_TSC can cause subsequent reads of the TSC to 381 + * return undefined values, and GUEST_TSC_FREQ is read-only. Generate 382 + * a #GP on all writes. 383 + */ 384 + if (write) { 385 + ctxt->fi.vector = X86_TRAP_GP; 386 + ctxt->fi.error_code = 0; 387 + return ES_EXCEPTION; 388 + } 389 + 390 + /* 391 + * GUEST_TSC_FREQ read should not be intercepted when Secure TSC is 392 + * enabled. Terminate the guest if a read is attempted. 381 393 */ 382 394 if (regs->cx == MSR_AMD64_GUEST_TSC_FREQ) 383 395 return ES_VMM_ERROR; 384 396 385 - /* 386 - * Writes: Writing to MSR_IA32_TSC can cause subsequent reads of the TSC 387 - * to return undefined values, so ignore all writes. 388 - * 389 - * Reads: Reads of MSR_IA32_TSC should return the current TSC value, use 390 - * the value returned by rdtsc_ordered(). 391 - */ 392 - if (write) { 393 - WARN_ONCE(1, "TSC MSR writes are verboten!\n"); 394 - return ES_OK; 395 - } 396 - 397 + /* Reads of MSR_IA32_TSC should return the current TSC value. */ 397 398 tsc = rdtsc_ordered(); 398 399 regs->ax = lower_32_bits(tsc); 399 400 regs->dx = upper_32_bits(tsc); ··· 417 416 case MSR_IA32_TSC: 418 417 case MSR_AMD64_GUEST_TSC_FREQ: 419 418 if (sev_status & MSR_AMD64_SNP_SECURE_TSC) 420 - return __vc_handle_secure_tsc_msrs(regs, write); 419 + return __vc_handle_secure_tsc_msrs(ctxt, write); 421 420 break; 422 421 default: 423 422 break;
+1
arch/x86/include/asm/cpufeatures.h
··· 218 218 #define X86_FEATURE_FLEXPRIORITY ( 8*32+ 1) /* "flexpriority" Intel FlexPriority */ 219 219 #define X86_FEATURE_EPT ( 8*32+ 2) /* "ept" Intel Extended Page Table */ 220 220 #define X86_FEATURE_VPID ( 8*32+ 3) /* "vpid" Intel Virtual Processor ID */ 221 + #define X86_FEATURE_COHERENCY_SFW_NO ( 8*32+ 4) /* SNP cache coherency software work around not needed */ 221 222 222 223 #define X86_FEATURE_VMMCALL ( 8*32+15) /* "vmmcall" Prefer VMMCALL to VMCALL */ 223 224 #define X86_FEATURE_XENPV ( 8*32+16) /* Xen paravirtual guest */
-8
arch/x86/include/asm/cpuid.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - #ifndef _ASM_X86_CPUID_H 4 - #define _ASM_X86_CPUID_H 5 - 6 - #include <asm/cpuid/api.h> 7 - 8 - #endif /* _ASM_X86_CPUID_H */
+19
arch/x86/include/asm/sev.h
··· 619 619 void snp_leak_pages(u64 pfn, unsigned int npages); 620 620 void kdump_sev_callback(void); 621 621 void snp_fixup_e820_tables(void); 622 + 623 + static inline void sev_evict_cache(void *va, int npages) 624 + { 625 + volatile u8 val __always_unused; 626 + u8 *bytes = va; 627 + int page_idx; 628 + 629 + /* 630 + * For SEV guests, a read from the first/last cache-lines of a 4K page 631 + * using the guest key is sufficient to cause a flush of all cache-lines 632 + * associated with that 4K page without incurring all the overhead of a 633 + * full CLFLUSH sequence. 634 + */ 635 + for (page_idx = 0; page_idx < npages; page_idx++) { 636 + val = bytes[page_idx * PAGE_SIZE]; 637 + val = bytes[page_idx * PAGE_SIZE + PAGE_SIZE - 1]; 638 + } 639 + } 622 640 #else 623 641 static inline bool snp_probe_rmptable_info(void) { return false; } 624 642 static inline int snp_rmptable_init(void) { return -ENOSYS; } ··· 652 634 static inline void snp_leak_pages(u64 pfn, unsigned int npages) {} 653 635 static inline void kdump_sev_callback(void) { } 654 636 static inline void snp_fixup_e820_tables(void) {} 637 + static inline void sev_evict_cache(void *va, int npages) {} 655 638 #endif 656 639 657 640 #endif
+11 -2
arch/x86/kernel/cpu/bugs.c
··· 386 386 387 387 case X86_BUG_SPECTRE_V2: 388 388 case X86_BUG_RETBLEED: 389 - case X86_BUG_SRSO: 390 389 case X86_BUG_L1TF: 391 390 case X86_BUG_ITS: 392 391 return cpu_attack_vector_mitigated(CPU_MITIGATE_USER_KERNEL) || ··· 3183 3184 } 3184 3185 3185 3186 if (srso_mitigation == SRSO_MITIGATION_AUTO) { 3186 - if (should_mitigate_vuln(X86_BUG_SRSO)) { 3187 + /* 3188 + * Use safe-RET if user->kernel or guest->host protection is 3189 + * required. Otherwise the 'microcode' mitigation is sufficient 3190 + * to protect the user->user and guest->guest vectors. 3191 + */ 3192 + if (cpu_attack_vector_mitigated(CPU_MITIGATE_GUEST_HOST) || 3193 + (cpu_attack_vector_mitigated(CPU_MITIGATE_USER_KERNEL) && 3194 + !boot_cpu_has(X86_FEATURE_SRSO_USER_KERNEL_NO))) { 3187 3195 srso_mitigation = SRSO_MITIGATION_SAFE_RET; 3196 + } else if (cpu_attack_vector_mitigated(CPU_MITIGATE_USER_USER) || 3197 + cpu_attack_vector_mitigated(CPU_MITIGATE_GUEST_GUEST)) { 3198 + srso_mitigation = SRSO_MITIGATION_MICROCODE; 3188 3199 } else { 3189 3200 srso_mitigation = SRSO_MITIGATION_NONE; 3190 3201 return;
+1
arch/x86/kernel/cpu/scattered.c
··· 48 48 { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 }, 49 49 { X86_FEATURE_AMD_FAST_CPPC, CPUID_EDX, 15, 0x80000007, 0 }, 50 50 { X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 }, 51 + { X86_FEATURE_COHERENCY_SFW_NO, CPUID_EBX, 31, 0x8000001f, 0 }, 51 52 { X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 }, 52 53 { X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 }, 53 54 { X86_FEATURE_TSA_SQ_NO, CPUID_ECX, 1, 0x80000021, 0 },
+10 -9
arch/x86/kernel/fpu/xstate.c
··· 1881 1881 #ifdef CONFIG_PROC_PID_ARCH_STATUS 1882 1882 /* 1883 1883 * Report the amount of time elapsed in millisecond since last AVX512 1884 - * use in the task. 1884 + * use in the task. Report -1 if no AVX-512 usage. 1885 1885 */ 1886 1886 static void avx512_status(struct seq_file *m, struct task_struct *task) 1887 1887 { 1888 - unsigned long timestamp = READ_ONCE(x86_task_fpu(task)->avx512_timestamp); 1889 - long delta; 1888 + unsigned long timestamp; 1889 + long delta = -1; 1890 1890 1891 - if (!timestamp) { 1892 - /* 1893 - * Report -1 if no AVX512 usage 1894 - */ 1895 - delta = -1; 1896 - } else { 1891 + /* AVX-512 usage is not tracked for kernel threads. Don't report anything. */ 1892 + if (task->flags & (PF_KTHREAD | PF_USER_WORKER)) 1893 + return; 1894 + 1895 + timestamp = READ_ONCE(x86_task_fpu(task)->avx512_timestamp); 1896 + 1897 + if (timestamp) { 1897 1898 delta = (long)(jiffies - timestamp); 1898 1899 /* 1899 1900 * Cap to LONG_MAX if time difference > LONG_MAX
+1 -2
block/bfq-iosched.c
··· 5847 5847 goto out; 5848 5848 } 5849 5849 5850 - bfqq = kmem_cache_alloc_node(bfq_pool, 5851 - GFP_NOWAIT | __GFP_ZERO | __GFP_NOWARN, 5850 + bfqq = kmem_cache_alloc_node(bfq_pool, GFP_NOWAIT | __GFP_ZERO, 5852 5851 bfqd->queue->node); 5853 5852 5854 5853 if (bfqq) {
+3 -3
block/blk-cgroup.c
··· 394 394 395 395 /* allocate */ 396 396 if (!new_blkg) { 397 - new_blkg = blkg_alloc(blkcg, disk, GFP_NOWAIT | __GFP_NOWARN); 397 + new_blkg = blkg_alloc(blkcg, disk, GFP_NOWAIT); 398 398 if (unlikely(!new_blkg)) { 399 399 ret = -ENOMEM; 400 400 goto err_put_css; ··· 1467 1467 1468 1468 spin_lock_init(&blkcg->lock); 1469 1469 refcount_set(&blkcg->online_pin, 1); 1470 - INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT | __GFP_NOWARN); 1470 + INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT); 1471 1471 INIT_HLIST_HEAD(&blkcg->blkg_list); 1472 1472 #ifdef CONFIG_CGROUP_WRITEBACK 1473 1473 INIT_LIST_HEAD(&blkcg->cgwb_list); ··· 1630 1630 pd_prealloc = NULL; 1631 1631 } else { 1632 1632 pd = pol->pd_alloc_fn(disk, blkg->blkcg, 1633 - GFP_NOWAIT | __GFP_NOWARN); 1633 + GFP_NOWAIT); 1634 1634 } 1635 1635 1636 1636 if (!pd) {
+6 -8
block/blk-sysfs.c
··· 847 847 /* nothing to do here, all data is associated with the parent gendisk */ 848 848 } 849 849 850 - static const struct kobj_type blk_queue_ktype = { 850 + const struct kobj_type blk_queue_ktype = { 851 851 .default_groups = blk_queue_attr_groups, 852 852 .sysfs_ops = &queue_sysfs_ops, 853 853 .release = blk_queue_release, ··· 875 875 struct request_queue *q = disk->queue; 876 876 int ret; 877 877 878 - kobject_init(&disk->queue_kobj, &blk_queue_ktype); 879 878 ret = kobject_add(&disk->queue_kobj, &disk_to_dev(disk)->kobj, "queue"); 880 879 if (ret < 0) 881 - goto out_put_queue_kobj; 880 + return ret; 882 881 883 882 if (queue_is_mq(q)) { 884 883 ret = blk_mq_sysfs_register(disk); 885 884 if (ret) 886 - goto out_put_queue_kobj; 885 + goto out_del_queue_kobj; 887 886 } 888 887 mutex_lock(&q->sysfs_lock); 889 888 ··· 902 903 903 904 if (queue_is_mq(q)) 904 905 elevator_set_default(q); 905 - wbt_enable_default(disk); 906 906 907 907 blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q); 908 + wbt_enable_default(disk); 908 909 909 910 /* Now everything is ready and send out KOBJ_ADD uevent */ 910 911 kobject_uevent(&disk->queue_kobj, KOBJ_ADD); ··· 933 934 mutex_unlock(&q->sysfs_lock); 934 935 if (queue_is_mq(q)) 935 936 blk_mq_sysfs_unregister(disk); 936 - out_put_queue_kobj: 937 - kobject_put(&disk->queue_kobj); 937 + out_del_queue_kobj: 938 + kobject_del(&disk->queue_kobj); 938 939 return ret; 939 940 } 940 941 ··· 985 986 elevator_set_none(q); 986 987 987 988 blk_debugfs_remove(disk); 988 - kobject_put(&disk->queue_kobj); 989 989 }
+8 -7
block/blk-wbt.c
··· 85 85 u64 sync_issue; 86 86 void *sync_cookie; 87 87 88 - unsigned long last_issue; /* last non-throttled issue */ 89 - unsigned long last_comp; /* last non-throttled comp */ 88 + unsigned long last_issue; /* issue time of last read rq */ 89 + unsigned long last_comp; /* completion time of last read rq */ 90 90 unsigned long min_lat_nsec; 91 91 struct rq_qos rqos; 92 92 struct rq_wait rq_wait[WBT_NUM_RWQ]; ··· 248 248 struct rq_wb *rwb = RQWB(rqos); 249 249 250 250 if (!wbt_is_tracked(rq)) { 251 - if (rwb->sync_cookie == rq) { 252 - rwb->sync_issue = 0; 253 - rwb->sync_cookie = NULL; 254 - } 251 + if (wbt_is_read(rq)) { 252 + if (rwb->sync_cookie == rq) { 253 + rwb->sync_issue = 0; 254 + rwb->sync_cookie = NULL; 255 + } 255 256 256 - if (wbt_is_read(rq)) 257 257 wb_timestamp(rwb, &rwb->last_comp); 258 + } 258 259 } else { 259 260 WARN_ON_ONCE(rq == rwb->sync_cookie); 260 261 __wbt_done(rqos, wbt_flags(rq));
+1
block/blk.h
··· 29 29 /* Max future timer expiry for timeouts */ 30 30 #define BLK_MAX_TIMEOUT (5 * HZ) 31 31 32 + extern const struct kobj_type blk_queue_ktype; 32 33 extern struct dentry *blk_debugfs_root; 33 34 34 35 struct blk_flush_queue {
+2
block/genhd.c
··· 1303 1303 disk_free_zone_resources(disk); 1304 1304 xa_destroy(&disk->part_tbl); 1305 1305 1306 + kobject_put(&disk->queue_kobj); 1306 1307 disk->queue->disk = NULL; 1307 1308 blk_put_queue(disk->queue); 1308 1309 ··· 1487 1486 INIT_LIST_HEAD(&disk->slave_bdevs); 1488 1487 #endif 1489 1488 mutex_init(&disk->rqos_state_mutex); 1489 + kobject_init(&disk->queue_kobj, &blk_queue_ktype); 1490 1490 return disk; 1491 1491 1492 1492 out_erase_part0:
+7 -16
drivers/accel/habanalabs/common/memory.c
··· 1829 1829 struct hl_dmabuf_priv *hl_dmabuf = dmabuf->priv; 1830 1830 struct hl_ctx *ctx; 1831 1831 1832 - if (!hl_dmabuf) 1833 - return; 1834 - 1835 1832 ctx = hl_dmabuf->ctx; 1836 1833 1837 1834 if (hl_dmabuf->memhash_hnode) ··· 1856 1859 { 1857 1860 DEFINE_DMA_BUF_EXPORT_INFO(exp_info); 1858 1861 struct hl_device *hdev = ctx->hdev; 1859 - int rc, fd; 1862 + CLASS(get_unused_fd, fd)(flags); 1863 + 1864 + if (fd < 0) { 1865 + dev_err(hdev->dev, "failed to get a file descriptor for a dma-buf, %d\n", fd); 1866 + return fd; 1867 + } 1860 1868 1861 1869 exp_info.ops = &habanalabs_dmabuf_ops; 1862 1870 exp_info.size = total_size; ··· 1872 1870 if (IS_ERR(hl_dmabuf->dmabuf)) { 1873 1871 dev_err(hdev->dev, "failed to export dma-buf\n"); 1874 1872 return PTR_ERR(hl_dmabuf->dmabuf); 1875 - } 1876 - 1877 - fd = dma_buf_fd(hl_dmabuf->dmabuf, flags); 1878 - if (fd < 0) { 1879 - dev_err(hdev->dev, "failed to get a file descriptor for a dma-buf, %d\n", fd); 1880 - rc = fd; 1881 - goto err_dma_buf_put; 1882 1873 } 1883 1874 1884 1875 hl_dmabuf->ctx = ctx; ··· 1885 1890 get_file(ctx->hpriv->file_priv->filp); 1886 1891 1887 1892 *dmabuf_fd = fd; 1893 + fd_install(take_fd(fd), hl_dmabuf->dmabuf->file); 1888 1894 1889 1895 return 0; 1890 - 1891 - err_dma_buf_put: 1892 - hl_dmabuf->dmabuf->priv = NULL; 1893 - dma_buf_put(hl_dmabuf->dmabuf); 1894 - return rc; 1895 1896 } 1896 1897 1897 1898 static int validate_export_params_common(struct hl_device *hdev, u64 addr, u64 size, u64 offset)
+7 -3
drivers/acpi/ec.c
··· 2033 2033 goto out; 2034 2034 } 2035 2035 2036 - if (!strstarts(ecdt_ptr->id, "\\")) { 2036 + if (!strlen(ecdt_ptr->id)) { 2037 2037 /* 2038 2038 * The ECDT table on some MSI notebooks contains invalid data, together 2039 2039 * with an empty ID string (""). ··· 2042 2042 * a "fully qualified reference to the (...) embedded controller device", 2043 2043 * so this string always has to start with a backslash. 2044 2044 * 2045 - * By verifying this we can avoid such faulty ECDT tables in a safe way. 2045 + * However some ThinkBook machines have a ECDT table with a valid EC 2046 + * description but an invalid ID string ("_SB.PC00.LPCB.EC0"). 2047 + * 2048 + * Because of this we only check if the ID string is empty in order to 2049 + * avoid the obvious cases. 2046 2050 */ 2047 - pr_err(FW_BUG "Ignoring ECDT due to invalid ID string \"%s\"\n", ecdt_ptr->id); 2051 + pr_err(FW_BUG "Ignoring ECDT due to empty ID string\n"); 2048 2052 goto out; 2049 2053 } 2050 2054
+4 -1
drivers/acpi/processor_perflib.c
··· 180 180 struct acpi_processor *pr = per_cpu(processors, cpu); 181 181 int ret; 182 182 183 - if (!pr || !pr->performance) 183 + if (!pr) 184 184 continue; 185 185 186 186 /* ··· 196 196 if (ret < 0) 197 197 pr_err("Failed to add freq constraint for CPU%d (%d)\n", 198 198 cpu, ret); 199 + 200 + if (!pr->performance) 201 + continue; 199 202 200 203 ret = acpi_processor_get_platform_limit(pr); 201 204 if (ret)
+7 -2
drivers/ata/libata-eh.c
··· 2075 2075 * Check if a link is established. This is a relaxed version of 2076 2076 * ata_phys_link_online() which accounts for the fact that this is potentially 2077 2077 * called after changing the link power management policy, which may not be 2078 - * reflected immediately in the SSTAUS register (e.g., we may still be seeing 2078 + * reflected immediately in the SStatus register (e.g., we may still be seeing 2079 2079 * the PHY in partial, slumber or devsleep Partial power management state. 2080 2080 * So check that: 2081 2081 * - A device is still present, that is, DET is 1h (Device presence detected ··· 2089 2089 u32 sstatus; 2090 2090 u8 det, ipm; 2091 2091 2092 + /* 2093 + * For old IDE/PATA adapters that do not have a valid scr_read method, 2094 + * or if reading the SStatus register fails, assume that the device is 2095 + * present. Device probe will determine if that is really the case. 2096 + */ 2092 2097 if (sata_scr_read(link, SCR_STATUS, &sstatus)) 2093 - return false; 2098 + return true; 2094 2099 2095 2100 det = sstatus & 0x0f; 2096 2101 ipm = (sstatus >> 8) & 0x0f;
+3 -8
drivers/ata/libata-scsi.c
··· 3904 3904 /* Check cdl_ctrl */ 3905 3905 switch (buf[0] & 0x03) { 3906 3906 case 0: 3907 - /* Disable CDL if it is enabled */ 3908 - if (!(dev->flags & ATA_DFLAG_CDL_ENABLED)) 3909 - return 0; 3907 + /* Disable CDL */ 3910 3908 ata_dev_dbg(dev, "Disabling CDL\n"); 3911 3909 cdl_action = 0; 3912 3910 dev->flags &= ~ATA_DFLAG_CDL_ENABLED; 3913 3911 break; 3914 3912 case 0x02: 3915 3913 /* 3916 - * Enable CDL if not already enabled. Since this is mutually 3917 - * exclusive with NCQ priority, allow this only if NCQ priority 3918 - * is disabled. 3914 + * Enable CDL. Since CDL is mutually exclusive with NCQ 3915 + * priority, allow this only if NCQ priority is disabled. 3919 3916 */ 3920 - if (dev->flags & ATA_DFLAG_CDL_ENABLED) 3921 - return 0; 3922 3917 if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) { 3923 3918 ata_dev_err(dev, 3924 3919 "NCQ priority must be disabled to enable CDL\n");
+6 -33
drivers/block/drbd/drbd_int.h
··· 380 380 /* this is/was a write request */ 381 381 __EE_WRITE, 382 382 383 + /* hand back using mempool_free(e, drbd_buffer_page_pool) */ 384 + __EE_RELEASE_TO_MEMPOOL, 385 + 383 386 /* this is/was a write same request */ 384 387 __EE_WRITE_SAME, 385 388 ··· 405 402 #define EE_IN_INTERVAL_TREE (1<<__EE_IN_INTERVAL_TREE) 406 403 #define EE_SUBMITTED (1<<__EE_SUBMITTED) 407 404 #define EE_WRITE (1<<__EE_WRITE) 405 + #define EE_RELEASE_TO_MEMPOOL (1<<__EE_RELEASE_TO_MEMPOOL) 408 406 #define EE_WRITE_SAME (1<<__EE_WRITE_SAME) 409 407 #define EE_APPLICATION (1<<__EE_APPLICATION) 410 408 #define EE_RS_THIN_REQ (1<<__EE_RS_THIN_REQ) ··· 862 858 struct list_head sync_ee; /* IO in progress (P_RS_DATA_REPLY gets written to disk) */ 863 859 struct list_head done_ee; /* need to send P_WRITE_ACK */ 864 860 struct list_head read_ee; /* [RS]P_DATA_REQUEST being read */ 865 - struct list_head net_ee; /* zero-copy network send in progress */ 866 861 867 862 struct list_head resync_reads; 868 863 atomic_t pp_in_use; /* allocated from page pool */ ··· 1332 1329 extern mempool_t drbd_request_mempool; 1333 1330 extern mempool_t drbd_ee_mempool; 1334 1331 1335 - /* drbd's page pool, used to buffer data received from the peer, 1336 - * or data requested by the peer. 1337 - * 1338 - * This does not have an emergency reserve. 1339 - * 1340 - * When allocating from this pool, it first takes pages from the pool. 1341 - * Only if the pool is depleted will try to allocate from the system. 1342 - * 1343 - * The assumption is that pages taken from this pool will be processed, 1344 - * and given back, "quickly", and then can be recycled, so we can avoid 1345 - * frequent calls to alloc_page(), and still will be able to make progress even 1346 - * under memory pressure. 1347 - */ 1348 - extern struct page *drbd_pp_pool; 1349 - extern spinlock_t drbd_pp_lock; 1350 - extern int drbd_pp_vacant; 1351 - extern wait_queue_head_t drbd_pp_wait; 1352 - 1353 1332 /* We also need a standard (emergency-reserve backed) page pool 1354 1333 * for meta data IO (activity log, bitmap). 1355 1334 * We can keep it global, as long as it is used as "N pages at a time". ··· 1339 1354 */ 1340 1355 #define DRBD_MIN_POOL_PAGES 128 1341 1356 extern mempool_t drbd_md_io_page_pool; 1357 + extern mempool_t drbd_buffer_page_pool; 1342 1358 1343 1359 /* We also need to make sure we get a bio 1344 1360 * when we need it for housekeeping purposes */ ··· 1474 1488 sector_t, unsigned int, 1475 1489 unsigned int, 1476 1490 gfp_t) __must_hold(local); 1477 - extern void __drbd_free_peer_req(struct drbd_device *, struct drbd_peer_request *, 1478 - int); 1479 - #define drbd_free_peer_req(m,e) __drbd_free_peer_req(m, e, 0) 1480 - #define drbd_free_net_peer_req(m,e) __drbd_free_peer_req(m, e, 1) 1491 + extern void drbd_free_peer_req(struct drbd_device *device, struct drbd_peer_request *req); 1481 1492 extern struct page *drbd_alloc_pages(struct drbd_peer_device *, unsigned int, bool); 1482 1493 extern void _drbd_clear_done_ee(struct drbd_device *device, struct list_head *to_be_freed); 1483 1494 extern int drbd_connected(struct drbd_peer_device *); ··· 1592 1609 #define page_chain_for_each_safe(page, n) \ 1593 1610 for (; page && ({ n = page_chain_next(page); 1; }); page = n) 1594 1611 1595 - 1596 - static inline int drbd_peer_req_has_active_page(struct drbd_peer_request *peer_req) 1597 - { 1598 - struct page *page = peer_req->pages; 1599 - page_chain_for_each(page) { 1600 - if (page_count(page) > 1) 1601 - return 1; 1602 - } 1603 - return 0; 1604 - } 1605 1612 1606 1613 static inline union drbd_state drbd_read_state(struct drbd_device *device) 1607 1614 {
+15 -44
drivers/block/drbd/drbd_main.c
··· 114 114 mempool_t drbd_request_mempool; 115 115 mempool_t drbd_ee_mempool; 116 116 mempool_t drbd_md_io_page_pool; 117 + mempool_t drbd_buffer_page_pool; 117 118 struct bio_set drbd_md_io_bio_set; 118 119 struct bio_set drbd_io_bio_set; 119 - 120 - /* I do not use a standard mempool, because: 121 - 1) I want to hand out the pre-allocated objects first. 122 - 2) I want to be able to interrupt sleeping allocation with a signal. 123 - Note: This is a single linked list, the next pointer is the private 124 - member of struct page. 125 - */ 126 - struct page *drbd_pp_pool; 127 - DEFINE_SPINLOCK(drbd_pp_lock); 128 - int drbd_pp_vacant; 129 - wait_queue_head_t drbd_pp_wait; 130 120 131 121 DEFINE_RATELIMIT_STATE(drbd_ratelimit_state, 5 * HZ, 5); 132 122 ··· 1601 1611 static int _drbd_send_zc_ee(struct drbd_peer_device *peer_device, 1602 1612 struct drbd_peer_request *peer_req) 1603 1613 { 1614 + bool use_sendpage = !(peer_req->flags & EE_RELEASE_TO_MEMPOOL); 1604 1615 struct page *page = peer_req->pages; 1605 1616 unsigned len = peer_req->i.size; 1606 1617 int err; ··· 1610 1619 page_chain_for_each(page) { 1611 1620 unsigned l = min_t(unsigned, len, PAGE_SIZE); 1612 1621 1613 - err = _drbd_send_page(peer_device, page, 0, l, 1614 - page_chain_next(page) ? MSG_MORE : 0); 1622 + if (likely(use_sendpage)) 1623 + err = _drbd_send_page(peer_device, page, 0, l, 1624 + page_chain_next(page) ? MSG_MORE : 0); 1625 + else 1626 + err = _drbd_no_send_page(peer_device, page, 0, l, 1627 + page_chain_next(page) ? MSG_MORE : 0); 1628 + 1615 1629 if (err) 1616 1630 return err; 1617 1631 len -= l; ··· 1958 1962 INIT_LIST_HEAD(&device->sync_ee); 1959 1963 INIT_LIST_HEAD(&device->done_ee); 1960 1964 INIT_LIST_HEAD(&device->read_ee); 1961 - INIT_LIST_HEAD(&device->net_ee); 1962 1965 INIT_LIST_HEAD(&device->resync_reads); 1963 1966 INIT_LIST_HEAD(&device->resync_work.list); 1964 1967 INIT_LIST_HEAD(&device->unplug_work.list); ··· 2038 2043 D_ASSERT(device, list_empty(&device->sync_ee)); 2039 2044 D_ASSERT(device, list_empty(&device->done_ee)); 2040 2045 D_ASSERT(device, list_empty(&device->read_ee)); 2041 - D_ASSERT(device, list_empty(&device->net_ee)); 2042 2046 D_ASSERT(device, list_empty(&device->resync_reads)); 2043 2047 D_ASSERT(device, list_empty(&first_peer_device(device)->connection->sender_work.q)); 2044 2048 D_ASSERT(device, list_empty(&device->resync_work.list)); ··· 2049 2055 2050 2056 static void drbd_destroy_mempools(void) 2051 2057 { 2052 - struct page *page; 2053 - 2054 - while (drbd_pp_pool) { 2055 - page = drbd_pp_pool; 2056 - drbd_pp_pool = (struct page *)page_private(page); 2057 - __free_page(page); 2058 - drbd_pp_vacant--; 2059 - } 2060 - 2061 2058 /* D_ASSERT(device, atomic_read(&drbd_pp_vacant)==0); */ 2062 2059 2063 2060 bioset_exit(&drbd_io_bio_set); 2064 2061 bioset_exit(&drbd_md_io_bio_set); 2062 + mempool_exit(&drbd_buffer_page_pool); 2065 2063 mempool_exit(&drbd_md_io_page_pool); 2066 2064 mempool_exit(&drbd_ee_mempool); 2067 2065 mempool_exit(&drbd_request_mempool); ··· 2072 2086 2073 2087 static int drbd_create_mempools(void) 2074 2088 { 2075 - struct page *page; 2076 2089 const int number = (DRBD_MAX_BIO_SIZE/PAGE_SIZE) * drbd_minor_count; 2077 - int i, ret; 2090 + int ret; 2078 2091 2079 2092 /* caches */ 2080 2093 drbd_request_cache = kmem_cache_create( ··· 2110 2125 if (ret) 2111 2126 goto Enomem; 2112 2127 2128 + ret = mempool_init_page_pool(&drbd_buffer_page_pool, number, 0); 2129 + if (ret) 2130 + goto Enomem; 2131 + 2113 2132 ret = mempool_init_slab_pool(&drbd_request_mempool, number, 2114 2133 drbd_request_cache); 2115 2134 if (ret) ··· 2122 2133 ret = mempool_init_slab_pool(&drbd_ee_mempool, number, drbd_ee_cache); 2123 2134 if (ret) 2124 2135 goto Enomem; 2125 - 2126 - for (i = 0; i < number; i++) { 2127 - page = alloc_page(GFP_HIGHUSER); 2128 - if (!page) 2129 - goto Enomem; 2130 - set_page_private(page, (unsigned long)drbd_pp_pool); 2131 - drbd_pp_pool = page; 2132 - } 2133 - drbd_pp_vacant = number; 2134 2136 2135 2137 return 0; 2136 2138 ··· 2149 2169 rr = drbd_free_peer_reqs(device, &device->done_ee); 2150 2170 if (rr) 2151 2171 drbd_err(device, "%d EEs in done list found!\n", rr); 2152 - 2153 - rr = drbd_free_peer_reqs(device, &device->net_ee); 2154 - if (rr) 2155 - drbd_err(device, "%d EEs in net list found!\n", rr); 2156 2172 } 2157 2173 2158 2174 /* caution. no locking. */ ··· 2838 2862 DRBD_MAJOR); 2839 2863 return err; 2840 2864 } 2841 - 2842 - /* 2843 - * allocate all necessary structs 2844 - */ 2845 - init_waitqueue_head(&drbd_pp_wait); 2846 2865 2847 2866 drbd_proc = NULL; /* play safe for drbd_cleanup */ 2848 2867 idr_init(&drbd_devices);
+31 -231
drivers/block/drbd/drbd_receiver.c
··· 33 33 #include <linux/string.h> 34 34 #include <linux/scatterlist.h> 35 35 #include <linux/part_stat.h> 36 + #include <linux/mempool.h> 36 37 #include "drbd_int.h" 37 38 #include "drbd_protocol.h" 38 39 #include "drbd_req.h" ··· 64 63 65 64 #define GFP_TRY (__GFP_HIGHMEM | __GFP_NOWARN) 66 65 67 - /* 68 - * some helper functions to deal with single linked page lists, 69 - * page->private being our "next" pointer. 70 - */ 71 - 72 - /* If at least n pages are linked at head, get n pages off. 73 - * Otherwise, don't modify head, and return NULL. 74 - * Locking is the responsibility of the caller. 75 - */ 76 - static struct page *page_chain_del(struct page **head, int n) 77 - { 78 - struct page *page; 79 - struct page *tmp; 80 - 81 - BUG_ON(!n); 82 - BUG_ON(!head); 83 - 84 - page = *head; 85 - 86 - if (!page) 87 - return NULL; 88 - 89 - while (page) { 90 - tmp = page_chain_next(page); 91 - if (--n == 0) 92 - break; /* found sufficient pages */ 93 - if (tmp == NULL) 94 - /* insufficient pages, don't use any of them. */ 95 - return NULL; 96 - page = tmp; 97 - } 98 - 99 - /* add end of list marker for the returned list */ 100 - set_page_private(page, 0); 101 - /* actual return value, and adjustment of head */ 102 - page = *head; 103 - *head = tmp; 104 - return page; 105 - } 106 - 107 - /* may be used outside of locks to find the tail of a (usually short) 108 - * "private" page chain, before adding it back to a global chain head 109 - * with page_chain_add() under a spinlock. */ 110 - static struct page *page_chain_tail(struct page *page, int *len) 111 - { 112 - struct page *tmp; 113 - int i = 1; 114 - while ((tmp = page_chain_next(page))) { 115 - ++i; 116 - page = tmp; 117 - } 118 - if (len) 119 - *len = i; 120 - return page; 121 - } 122 - 123 - static int page_chain_free(struct page *page) 124 - { 125 - struct page *tmp; 126 - int i = 0; 127 - page_chain_for_each_safe(page, tmp) { 128 - put_page(page); 129 - ++i; 130 - } 131 - return i; 132 - } 133 - 134 - static void page_chain_add(struct page **head, 135 - struct page *chain_first, struct page *chain_last) 136 - { 137 - #if 1 138 - struct page *tmp; 139 - tmp = page_chain_tail(chain_first, NULL); 140 - BUG_ON(tmp != chain_last); 141 - #endif 142 - 143 - /* add chain to head */ 144 - set_page_private(chain_last, (unsigned long)*head); 145 - *head = chain_first; 146 - } 147 - 148 - static struct page *__drbd_alloc_pages(struct drbd_device *device, 149 - unsigned int number) 66 + static struct page *__drbd_alloc_pages(unsigned int number) 150 67 { 151 68 struct page *page = NULL; 152 69 struct page *tmp = NULL; 153 70 unsigned int i = 0; 154 71 155 - /* Yes, testing drbd_pp_vacant outside the lock is racy. 156 - * So what. It saves a spin_lock. */ 157 - if (drbd_pp_vacant >= number) { 158 - spin_lock(&drbd_pp_lock); 159 - page = page_chain_del(&drbd_pp_pool, number); 160 - if (page) 161 - drbd_pp_vacant -= number; 162 - spin_unlock(&drbd_pp_lock); 163 - if (page) 164 - return page; 165 - } 166 - 167 72 /* GFP_TRY, because we must not cause arbitrary write-out: in a DRBD 168 73 * "criss-cross" setup, that might cause write-out on some other DRBD, 169 74 * which in turn might block on the other node at this very place. */ 170 75 for (i = 0; i < number; i++) { 171 - tmp = alloc_page(GFP_TRY); 76 + tmp = mempool_alloc(&drbd_buffer_page_pool, GFP_TRY); 172 77 if (!tmp) 173 - break; 78 + goto fail; 174 79 set_page_private(tmp, (unsigned long)page); 175 80 page = tmp; 176 81 } 177 - 178 - if (i == number) 179 - return page; 180 - 181 - /* Not enough pages immediately available this time. 182 - * No need to jump around here, drbd_alloc_pages will retry this 183 - * function "soon". */ 184 - if (page) { 185 - tmp = page_chain_tail(page, NULL); 186 - spin_lock(&drbd_pp_lock); 187 - page_chain_add(&drbd_pp_pool, page, tmp); 188 - drbd_pp_vacant += i; 189 - spin_unlock(&drbd_pp_lock); 82 + return page; 83 + fail: 84 + page_chain_for_each_safe(page, tmp) { 85 + set_page_private(page, 0); 86 + mempool_free(page, &drbd_buffer_page_pool); 190 87 } 191 88 return NULL; 192 - } 193 - 194 - static void reclaim_finished_net_peer_reqs(struct drbd_device *device, 195 - struct list_head *to_be_freed) 196 - { 197 - struct drbd_peer_request *peer_req, *tmp; 198 - 199 - /* The EEs are always appended to the end of the list. Since 200 - they are sent in order over the wire, they have to finish 201 - in order. As soon as we see the first not finished we can 202 - stop to examine the list... */ 203 - 204 - list_for_each_entry_safe(peer_req, tmp, &device->net_ee, w.list) { 205 - if (drbd_peer_req_has_active_page(peer_req)) 206 - break; 207 - list_move(&peer_req->w.list, to_be_freed); 208 - } 209 - } 210 - 211 - static void drbd_reclaim_net_peer_reqs(struct drbd_device *device) 212 - { 213 - LIST_HEAD(reclaimed); 214 - struct drbd_peer_request *peer_req, *t; 215 - 216 - spin_lock_irq(&device->resource->req_lock); 217 - reclaim_finished_net_peer_reqs(device, &reclaimed); 218 - spin_unlock_irq(&device->resource->req_lock); 219 - list_for_each_entry_safe(peer_req, t, &reclaimed, w.list) 220 - drbd_free_net_peer_req(device, peer_req); 221 - } 222 - 223 - static void conn_reclaim_net_peer_reqs(struct drbd_connection *connection) 224 - { 225 - struct drbd_peer_device *peer_device; 226 - int vnr; 227 - 228 - rcu_read_lock(); 229 - idr_for_each_entry(&connection->peer_devices, peer_device, vnr) { 230 - struct drbd_device *device = peer_device->device; 231 - if (!atomic_read(&device->pp_in_use_by_net)) 232 - continue; 233 - 234 - kref_get(&device->kref); 235 - rcu_read_unlock(); 236 - drbd_reclaim_net_peer_reqs(device); 237 - kref_put(&device->kref, drbd_destroy_device); 238 - rcu_read_lock(); 239 - } 240 - rcu_read_unlock(); 241 89 } 242 90 243 91 /** ··· 113 263 bool retry) 114 264 { 115 265 struct drbd_device *device = peer_device->device; 116 - struct page *page = NULL; 266 + struct page *page; 117 267 struct net_conf *nc; 118 - DEFINE_WAIT(wait); 119 268 unsigned int mxb; 120 269 121 270 rcu_read_lock(); ··· 122 273 mxb = nc ? nc->max_buffers : 1000000; 123 274 rcu_read_unlock(); 124 275 125 - if (atomic_read(&device->pp_in_use) < mxb) 126 - page = __drbd_alloc_pages(device, number); 127 - 128 - /* Try to keep the fast path fast, but occasionally we need 129 - * to reclaim the pages we lended to the network stack. */ 130 - if (page && atomic_read(&device->pp_in_use_by_net) > 512) 131 - drbd_reclaim_net_peer_reqs(device); 132 - 133 - while (page == NULL) { 134 - prepare_to_wait(&drbd_pp_wait, &wait, TASK_INTERRUPTIBLE); 135 - 136 - drbd_reclaim_net_peer_reqs(device); 137 - 138 - if (atomic_read(&device->pp_in_use) < mxb) { 139 - page = __drbd_alloc_pages(device, number); 140 - if (page) 141 - break; 142 - } 143 - 144 - if (!retry) 145 - break; 146 - 147 - if (signal_pending(current)) { 148 - drbd_warn(device, "drbd_alloc_pages interrupted!\n"); 149 - break; 150 - } 151 - 152 - if (schedule_timeout(HZ/10) == 0) 153 - mxb = UINT_MAX; 154 - } 155 - finish_wait(&drbd_pp_wait, &wait); 276 + if (atomic_read(&device->pp_in_use) >= mxb) 277 + schedule_timeout_interruptible(HZ / 10); 278 + page = __drbd_alloc_pages(number); 156 279 157 280 if (page) 158 281 atomic_add(number, &device->pp_in_use); ··· 135 314 * Is also used from inside an other spin_lock_irq(&resource->req_lock); 136 315 * Either links the page chain back to the global pool, 137 316 * or returns all pages to the system. */ 138 - static void drbd_free_pages(struct drbd_device *device, struct page *page, int is_net) 317 + static void drbd_free_pages(struct drbd_device *device, struct page *page) 139 318 { 140 - atomic_t *a = is_net ? &device->pp_in_use_by_net : &device->pp_in_use; 141 - int i; 319 + struct page *tmp; 320 + int i = 0; 142 321 143 322 if (page == NULL) 144 323 return; 145 324 146 - if (drbd_pp_vacant > (DRBD_MAX_BIO_SIZE/PAGE_SIZE) * drbd_minor_count) 147 - i = page_chain_free(page); 148 - else { 149 - struct page *tmp; 150 - tmp = page_chain_tail(page, &i); 151 - spin_lock(&drbd_pp_lock); 152 - page_chain_add(&drbd_pp_pool, page, tmp); 153 - drbd_pp_vacant += i; 154 - spin_unlock(&drbd_pp_lock); 325 + page_chain_for_each_safe(page, tmp) { 326 + set_page_private(page, 0); 327 + if (page_count(page) == 1) 328 + mempool_free(page, &drbd_buffer_page_pool); 329 + else 330 + put_page(page); 331 + i++; 155 332 } 156 - i = atomic_sub_return(i, a); 333 + i = atomic_sub_return(i, &device->pp_in_use); 157 334 if (i < 0) 158 - drbd_warn(device, "ASSERTION FAILED: %s: %d < 0\n", 159 - is_net ? "pp_in_use_by_net" : "pp_in_use", i); 160 - wake_up(&drbd_pp_wait); 335 + drbd_warn(device, "ASSERTION FAILED: pp_in_use: %d < 0\n", i); 161 336 } 162 337 163 338 /* ··· 197 380 gfpflags_allow_blocking(gfp_mask)); 198 381 if (!page) 199 382 goto fail; 383 + if (!mempool_is_saturated(&drbd_buffer_page_pool)) 384 + peer_req->flags |= EE_RELEASE_TO_MEMPOOL; 200 385 } 201 386 202 387 memset(peer_req, 0, sizeof(*peer_req)); ··· 222 403 return NULL; 223 404 } 224 405 225 - void __drbd_free_peer_req(struct drbd_device *device, struct drbd_peer_request *peer_req, 226 - int is_net) 406 + void drbd_free_peer_req(struct drbd_device *device, struct drbd_peer_request *peer_req) 227 407 { 228 408 might_sleep(); 229 409 if (peer_req->flags & EE_HAS_DIGEST) 230 410 kfree(peer_req->digest); 231 - drbd_free_pages(device, peer_req->pages, is_net); 411 + drbd_free_pages(device, peer_req->pages); 232 412 D_ASSERT(device, atomic_read(&peer_req->pending_bios) == 0); 233 413 D_ASSERT(device, drbd_interval_empty(&peer_req->i)); 234 414 if (!expect(device, !(peer_req->flags & EE_CALL_AL_COMPLETE_IO))) { ··· 242 424 LIST_HEAD(work_list); 243 425 struct drbd_peer_request *peer_req, *t; 244 426 int count = 0; 245 - int is_net = list == &device->net_ee; 246 427 247 428 spin_lock_irq(&device->resource->req_lock); 248 429 list_splice_init(list, &work_list); 249 430 spin_unlock_irq(&device->resource->req_lock); 250 431 251 432 list_for_each_entry_safe(peer_req, t, &work_list, w.list) { 252 - __drbd_free_peer_req(device, peer_req, is_net); 433 + drbd_free_peer_req(device, peer_req); 253 434 count++; 254 435 } 255 436 return count; ··· 260 443 static int drbd_finish_peer_reqs(struct drbd_device *device) 261 444 { 262 445 LIST_HEAD(work_list); 263 - LIST_HEAD(reclaimed); 264 446 struct drbd_peer_request *peer_req, *t; 265 447 int err = 0; 266 448 267 449 spin_lock_irq(&device->resource->req_lock); 268 - reclaim_finished_net_peer_reqs(device, &reclaimed); 269 450 list_splice_init(&device->done_ee, &work_list); 270 451 spin_unlock_irq(&device->resource->req_lock); 271 - 272 - list_for_each_entry_safe(peer_req, t, &reclaimed, w.list) 273 - drbd_free_net_peer_req(device, peer_req); 274 452 275 453 /* possible callbacks here: 276 454 * e_end_block, and e_end_resync_block, e_send_superseded. ··· 1787 1975 data_size -= len; 1788 1976 } 1789 1977 kunmap(page); 1790 - drbd_free_pages(peer_device->device, page, 0); 1978 + drbd_free_pages(peer_device->device, page); 1791 1979 return err; 1792 1980 } 1793 1981 ··· 5036 5224 put_ldev(device); 5037 5225 } 5038 5226 5039 - /* tcp_close and release of sendpage pages can be deferred. I don't 5040 - * want to use SO_LINGER, because apparently it can be deferred for 5041 - * more than 20 seconds (longest time I checked). 5042 - * 5043 - * Actually we don't care for exactly when the network stack does its 5044 - * put_page(), but release our reference on these pages right here. 5045 - */ 5046 - i = drbd_free_peer_reqs(device, &device->net_ee); 5047 - if (i) 5048 - drbd_info(device, "net_ee not empty, killed %u entries\n", i); 5049 5227 i = atomic_read(&device->pp_in_use_by_net); 5050 5228 if (i) 5051 5229 drbd_info(device, "pp_in_use_by_net = %d, expected 0\n", i); ··· 5781 5979 5782 5980 while (get_t_state(thi) == RUNNING) { 5783 5981 drbd_thread_current_set_cpu(thi); 5784 - 5785 - conn_reclaim_net_peer_reqs(connection); 5786 5982 5787 5983 if (test_and_clear_bit(SEND_PING, &connection->flags)) { 5788 5984 if (drbd_send_ping(connection)) {
+18 -38
drivers/block/drbd/drbd_worker.c
··· 1030 1030 return 1; 1031 1031 } 1032 1032 1033 - /* helper */ 1034 - static void move_to_net_ee_or_free(struct drbd_device *device, struct drbd_peer_request *peer_req) 1035 - { 1036 - if (drbd_peer_req_has_active_page(peer_req)) { 1037 - /* This might happen if sendpage() has not finished */ 1038 - int i = PFN_UP(peer_req->i.size); 1039 - atomic_add(i, &device->pp_in_use_by_net); 1040 - atomic_sub(i, &device->pp_in_use); 1041 - spin_lock_irq(&device->resource->req_lock); 1042 - list_add_tail(&peer_req->w.list, &device->net_ee); 1043 - spin_unlock_irq(&device->resource->req_lock); 1044 - wake_up(&drbd_pp_wait); 1045 - } else 1046 - drbd_free_peer_req(device, peer_req); 1047 - } 1048 - 1049 1033 /** 1050 1034 * w_e_end_data_req() - Worker callback, to send a P_DATA_REPLY packet in response to a P_DATA_REQUEST 1051 1035 * @w: work object. ··· 1043 1059 int err; 1044 1060 1045 1061 if (unlikely(cancel)) { 1046 - drbd_free_peer_req(device, peer_req); 1047 - dec_unacked(device); 1048 - return 0; 1062 + err = 0; 1063 + goto out; 1049 1064 } 1050 1065 1051 1066 if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { ··· 1057 1074 err = drbd_send_ack(peer_device, P_NEG_DREPLY, peer_req); 1058 1075 } 1059 1076 1060 - dec_unacked(device); 1061 - 1062 - move_to_net_ee_or_free(device, peer_req); 1063 - 1064 1077 if (unlikely(err)) 1065 1078 drbd_err(device, "drbd_send_block() failed\n"); 1079 + out: 1080 + dec_unacked(device); 1081 + drbd_free_peer_req(device, peer_req); 1082 + 1066 1083 return err; 1067 1084 } 1068 1085 ··· 1103 1120 int err; 1104 1121 1105 1122 if (unlikely(cancel)) { 1106 - drbd_free_peer_req(device, peer_req); 1107 - dec_unacked(device); 1108 - return 0; 1123 + err = 0; 1124 + goto out; 1109 1125 } 1110 1126 1111 1127 if (get_ldev_if_state(device, D_FAILED)) { ··· 1137 1155 /* update resync data with failure */ 1138 1156 drbd_rs_failed_io(peer_device, peer_req->i.sector, peer_req->i.size); 1139 1157 } 1140 - 1141 - dec_unacked(device); 1142 - 1143 - move_to_net_ee_or_free(device, peer_req); 1144 - 1145 1158 if (unlikely(err)) 1146 1159 drbd_err(device, "drbd_send_block() failed\n"); 1160 + out: 1161 + dec_unacked(device); 1162 + drbd_free_peer_req(device, peer_req); 1163 + 1147 1164 return err; 1148 1165 } 1149 1166 ··· 1157 1176 int err, eq = 0; 1158 1177 1159 1178 if (unlikely(cancel)) { 1160 - drbd_free_peer_req(device, peer_req); 1161 - dec_unacked(device); 1162 - return 0; 1179 + err = 0; 1180 + goto out; 1163 1181 } 1164 1182 1165 1183 if (get_ldev(device)) { ··· 1200 1220 if (drbd_ratelimit()) 1201 1221 drbd_err(device, "Sending NegDReply. I guess it gets messy.\n"); 1202 1222 } 1203 - 1204 - dec_unacked(device); 1205 - move_to_net_ee_or_free(device, peer_req); 1206 - 1207 1223 if (unlikely(err)) 1208 1224 drbd_err(device, "drbd_send_block/ack() failed\n"); 1225 + out: 1226 + dec_unacked(device); 1227 + drbd_free_peer_req(device, peer_req); 1228 + 1209 1229 return err; 1210 1230 } 1211 1231
+12 -16
drivers/block/ublk_drv.c
··· 235 235 236 236 struct completion completion; 237 237 unsigned int nr_queues_ready; 238 - unsigned int nr_privileged_daemon; 238 + bool unprivileged_daemons; 239 239 struct mutex cancel_mutex; 240 240 bool canceling; 241 241 pid_t ublksrv_tgid; ··· 1389 1389 { 1390 1390 blk_status_t res; 1391 1391 1392 - if (unlikely(ubq->fail_io)) 1392 + if (unlikely(READ_ONCE(ubq->fail_io))) 1393 1393 return BLK_STS_TARGET; 1394 1394 1395 1395 /* With recovery feature enabled, force_abort is set in ··· 1401 1401 * Note: force_abort is guaranteed to be seen because it is set 1402 1402 * before request queue is unqiuesced. 1403 1403 */ 1404 - if (ublk_nosrv_should_queue_io(ubq) && unlikely(ubq->force_abort)) 1404 + if (ublk_nosrv_should_queue_io(ubq) && 1405 + unlikely(READ_ONCE(ubq->force_abort))) 1405 1406 return BLK_STS_IOERR; 1406 1407 1407 1408 if (check_cancel && unlikely(ubq->canceling)) ··· 1551 1550 /* set to NULL, otherwise new tasks cannot mmap io_cmd_buf */ 1552 1551 ub->mm = NULL; 1553 1552 ub->nr_queues_ready = 0; 1554 - ub->nr_privileged_daemon = 0; 1553 + ub->unprivileged_daemons = false; 1555 1554 ub->ublksrv_tgid = -1; 1556 1555 } 1557 1556 ··· 1645 1644 * Transition the device to the nosrv state. What exactly this 1646 1645 * means depends on the recovery flags 1647 1646 */ 1648 - blk_mq_quiesce_queue(disk->queue); 1649 1647 if (ublk_nosrv_should_stop_dev(ub)) { 1650 1648 /* 1651 1649 * Allow any pending/future I/O to pass through quickly ··· 1652 1652 * waits for all pending I/O to complete 1653 1653 */ 1654 1654 for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 1655 - ublk_get_queue(ub, i)->force_abort = true; 1656 - blk_mq_unquiesce_queue(disk->queue); 1655 + WRITE_ONCE(ublk_get_queue(ub, i)->force_abort, true); 1657 1656 1658 1657 ublk_stop_dev_unlocked(ub); 1659 1658 } else { ··· 1662 1663 } else { 1663 1664 ub->dev_info.state = UBLK_S_DEV_FAIL_IO; 1664 1665 for (i = 0; i < ub->dev_info.nr_hw_queues; i++) 1665 - ublk_get_queue(ub, i)->fail_io = true; 1666 + WRITE_ONCE(ublk_get_queue(ub, i)->fail_io, true); 1666 1667 } 1667 - blk_mq_unquiesce_queue(disk->queue); 1668 1668 } 1669 1669 unlock: 1670 1670 mutex_unlock(&ub->mutex); ··· 1978 1980 __must_hold(&ub->mutex) 1979 1981 { 1980 1982 ubq->nr_io_ready++; 1981 - if (ublk_queue_ready(ubq)) { 1983 + if (ublk_queue_ready(ubq)) 1982 1984 ub->nr_queues_ready++; 1983 - 1984 - if (capable(CAP_SYS_ADMIN)) 1985 - ub->nr_privileged_daemon++; 1986 - } 1985 + if (!ub->unprivileged_daemons && !capable(CAP_SYS_ADMIN)) 1986 + ub->unprivileged_daemons = true; 1987 1987 1988 1988 if (ub->nr_queues_ready == ub->dev_info.nr_hw_queues) { 1989 1989 /* now we are ready for handling ublk io request */ ··· 2876 2880 2877 2881 ublk_apply_params(ub); 2878 2882 2879 - /* don't probe partitions if any one ubq daemon is un-trusted */ 2880 - if (ub->nr_privileged_daemon != ub->nr_queues_ready) 2883 + /* don't probe partitions if any daemon task is un-trusted */ 2884 + if (ub->unprivileged_daemons) 2881 2885 set_bit(GD_SUPPRESS_PART_SCAN, &disk->state); 2882 2886 2883 2887 ublk_get_device(ub);
+1
drivers/cpufreq/intel_pstate.c
··· 2793 2793 X86_MATCH(INTEL_GRANITERAPIDS_X, core_funcs), 2794 2794 X86_MATCH(INTEL_ATOM_CRESTMONT, core_funcs), 2795 2795 X86_MATCH(INTEL_ATOM_CRESTMONT_X, core_funcs), 2796 + X86_MATCH(INTEL_ATOM_DARKMONT_X, core_funcs), 2796 2797 {} 2797 2798 }; 2798 2799 #endif
+17 -4
drivers/cpuidle/governors/menu.c
··· 97 97 98 98 static DEFINE_PER_CPU(struct menu_device, menu_devices); 99 99 100 + static void menu_update_intervals(struct menu_device *data, unsigned int interval_us) 101 + { 102 + /* Update the repeating-pattern data. */ 103 + data->intervals[data->interval_ptr++] = interval_us; 104 + if (data->interval_ptr >= INTERVALS) 105 + data->interval_ptr = 0; 106 + } 107 + 100 108 static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev); 101 109 102 110 /* ··· 230 222 if (data->needs_update) { 231 223 menu_update(drv, dev); 232 224 data->needs_update = 0; 225 + } else if (!dev->last_residency_ns) { 226 + /* 227 + * This happens when the driver rejects the previously selected 228 + * idle state and returns an error, so update the recent 229 + * intervals table to prevent invalid information from being 230 + * used going forward. 231 + */ 232 + menu_update_intervals(data, UINT_MAX); 233 233 } 234 234 235 235 /* Find the shortest expected idle interval. */ ··· 498 482 499 483 data->correction_factor[data->bucket] = new_factor; 500 484 501 - /* update the repeating-pattern data */ 502 - data->intervals[data->interval_ptr++] = ktime_to_us(measured_ns); 503 - if (data->interval_ptr >= INTERVALS) 504 - data->interval_ptr = 0; 485 + menu_update_intervals(data, ktime_to_us(measured_ns)); 505 486 } 506 487 507 488 /**
+81 -10
drivers/firewire/core-transaction.c
··· 550 550 { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, }; 551 551 #endif /* 0 */ 552 552 553 + static void complete_address_handler(struct kref *kref) 554 + { 555 + struct fw_address_handler *handler = container_of(kref, struct fw_address_handler, kref); 556 + 557 + complete(&handler->done); 558 + } 559 + 560 + static void get_address_handler(struct fw_address_handler *handler) 561 + { 562 + kref_get(&handler->kref); 563 + } 564 + 565 + static int put_address_handler(struct fw_address_handler *handler) 566 + { 567 + return kref_put(&handler->kref, complete_address_handler); 568 + } 569 + 553 570 /** 554 571 * fw_core_add_address_handler() - register for incoming requests 555 572 * @handler: callback ··· 613 596 if (other != NULL) { 614 597 handler->offset += other->length; 615 598 } else { 599 + init_completion(&handler->done); 600 + kref_init(&handler->kref); 616 601 list_add_tail_rcu(&handler->link, &address_handler_list); 617 602 ret = 0; 618 603 break; ··· 640 621 list_del_rcu(&handler->link); 641 622 642 623 synchronize_rcu(); 624 + 625 + if (!put_address_handler(handler)) 626 + wait_for_completion(&handler->done); 643 627 } 644 628 EXPORT_SYMBOL(fw_core_remove_address_handler); 645 629 ··· 936 914 handler = lookup_enclosing_address_handler(&address_handler_list, offset, 937 915 request->length); 938 916 if (handler) 939 - handler->address_callback(card, request, tcode, destination, source, 940 - p->generation, offset, request->data, 941 - request->length, handler->callback_data); 917 + get_address_handler(handler); 942 918 } 943 919 944 - if (!handler) 920 + if (!handler) { 945 921 fw_send_response(card, request, RCODE_ADDRESS_ERROR); 922 + return; 923 + } 924 + 925 + // Outside the RCU read-side critical section. Without spinlock. With reference count. 926 + handler->address_callback(card, request, tcode, destination, source, p->generation, offset, 927 + request->data, request->length, handler->callback_data); 928 + put_address_handler(handler); 946 929 } 930 + 931 + // To use kmalloc allocator efficiently, this should be power of two. 932 + #define BUFFER_ON_KERNEL_STACK_SIZE 4 947 933 948 934 static void handle_fcp_region_request(struct fw_card *card, 949 935 struct fw_packet *p, 950 936 struct fw_request *request, 951 937 unsigned long long offset) 952 938 { 953 - struct fw_address_handler *handler; 954 - int tcode, destination, source; 939 + struct fw_address_handler *buffer_on_kernel_stack[BUFFER_ON_KERNEL_STACK_SIZE]; 940 + struct fw_address_handler *handler, **handlers; 941 + int tcode, destination, source, i, count, buffer_size; 955 942 956 943 if ((offset != (CSR_REGISTER_BASE | CSR_FCP_COMMAND) && 957 944 offset != (CSR_REGISTER_BASE | CSR_FCP_RESPONSE)) || ··· 981 950 return; 982 951 } 983 952 953 + count = 0; 954 + handlers = buffer_on_kernel_stack; 955 + buffer_size = ARRAY_SIZE(buffer_on_kernel_stack); 984 956 scoped_guard(rcu) { 985 957 list_for_each_entry_rcu(handler, &address_handler_list, link) { 986 - if (is_enclosing_handler(handler, offset, request->length)) 987 - handler->address_callback(card, request, tcode, destination, source, 988 - p->generation, offset, request->data, 989 - request->length, handler->callback_data); 958 + if (is_enclosing_handler(handler, offset, request->length)) { 959 + if (count >= buffer_size) { 960 + int next_size = buffer_size * 2; 961 + struct fw_address_handler **buffer_on_kernel_heap; 962 + 963 + if (handlers == buffer_on_kernel_stack) 964 + buffer_on_kernel_heap = NULL; 965 + else 966 + buffer_on_kernel_heap = handlers; 967 + 968 + buffer_on_kernel_heap = 969 + krealloc_array(buffer_on_kernel_heap, next_size, 970 + sizeof(*buffer_on_kernel_heap), GFP_ATOMIC); 971 + // FCP is used for purposes unrelated to significant system 972 + // resources (e.g. storage or networking), so allocation 973 + // failures are not considered so critical. 974 + if (!buffer_on_kernel_heap) 975 + break; 976 + 977 + if (handlers == buffer_on_kernel_stack) { 978 + memcpy(buffer_on_kernel_heap, buffer_on_kernel_stack, 979 + sizeof(buffer_on_kernel_stack)); 980 + } 981 + 982 + handlers = buffer_on_kernel_heap; 983 + buffer_size = next_size; 984 + } 985 + get_address_handler(handler); 986 + handlers[count++] = handler; 987 + } 990 988 } 991 989 } 990 + 991 + for (i = 0; i < count; ++i) { 992 + handler = handlers[i]; 993 + handler->address_callback(card, request, tcode, destination, source, 994 + p->generation, offset, request->data, 995 + request->length, handler->callback_data); 996 + put_address_handler(handler); 997 + } 998 + 999 + if (handlers != buffer_on_kernel_stack) 1000 + kfree(handlers); 992 1001 993 1002 fw_send_response(card, request, RCODE_COMPLETE); 994 1003 }
+18 -34
drivers/gpio/gpio-mlxbf3.c
··· 190 190 struct mlxbf3_gpio_context *gs; 191 191 struct gpio_irq_chip *girq; 192 192 struct gpio_chip *gc; 193 - char *colon_ptr; 194 193 int ret, irq; 195 - long num; 196 194 197 195 gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL); 198 196 if (!gs) ··· 227 229 gc->owner = THIS_MODULE; 228 230 gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges; 229 231 230 - colon_ptr = strchr(dev_name(dev), ':'); 231 - if (!colon_ptr) { 232 - dev_err(dev, "invalid device name format\n"); 233 - return -EINVAL; 234 - } 232 + irq = platform_get_irq_optional(pdev, 0); 233 + if (irq >= 0) { 234 + girq = &gs->gc.irq; 235 + gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); 236 + girq->default_type = IRQ_TYPE_NONE; 237 + /* This will let us handle the parent IRQ in the driver */ 238 + girq->num_parents = 0; 239 + girq->parents = NULL; 240 + girq->parent_handler = NULL; 241 + girq->handler = handle_bad_irq; 235 242 236 - ret = kstrtol(++colon_ptr, 16, &num); 237 - if (ret) { 238 - dev_err(dev, "invalid device instance\n"); 239 - return ret; 240 - } 241 - 242 - if (!num) { 243 - irq = platform_get_irq(pdev, 0); 244 - if (irq >= 0) { 245 - girq = &gs->gc.irq; 246 - gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip); 247 - girq->default_type = IRQ_TYPE_NONE; 248 - /* This will let us handle the parent IRQ in the driver */ 249 - girq->num_parents = 0; 250 - girq->parents = NULL; 251 - girq->parent_handler = NULL; 252 - girq->handler = handle_bad_irq; 253 - 254 - /* 255 - * Directly request the irq here instead of passing 256 - * a flow-handler because the irq is shared. 257 - */ 258 - ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler, 259 - IRQF_SHARED, dev_name(dev), gs); 260 - if (ret) 261 - return dev_err_probe(dev, ret, "failed to request IRQ"); 262 - } 243 + /* 244 + * Directly request the irq here instead of passing 245 + * a flow-handler because the irq is shared. 246 + */ 247 + ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler, 248 + IRQF_SHARED, dev_name(dev), gs); 249 + if (ret) 250 + return dev_err_probe(dev, ret, "failed to request IRQ"); 263 251 } 264 252 265 253 platform_set_drvdata(pdev, gs);
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 1139 1139 } 1140 1140 } 1141 1141 1142 + if (!amdgpu_vm_ready(vm)) 1143 + return -EINVAL; 1144 + 1142 1145 r = amdgpu_vm_clear_freed(adev, vm, NULL); 1143 1146 if (r) 1144 1147 return r;
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
··· 88 88 } 89 89 90 90 r = amdgpu_vm_bo_map(adev, *bo_va, csa_addr, 0, size, 91 - AMDGPU_PTE_READABLE | AMDGPU_PTE_WRITEABLE | 92 - AMDGPU_PTE_EXECUTABLE); 91 + AMDGPU_VM_PAGE_READABLE | AMDGPU_VM_PAGE_WRITEABLE | 92 + AMDGPU_VM_PAGE_EXECUTABLE); 93 93 94 94 if (r) { 95 95 DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r);
+16 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 1039 1039 { 1040 1040 int ret; 1041 1041 uint64_t reserv_addr, reserv_addr_ext; 1042 - uint32_t reserv_size, reserv_size_ext; 1042 + uint32_t reserv_size, reserv_size_ext, mp0_ip_ver; 1043 1043 struct amdgpu_device *adev = psp->adev; 1044 + 1045 + mp0_ip_ver = amdgpu_ip_version(adev, MP0_HWIP, 0); 1044 1046 1045 1047 if (amdgpu_sriov_vf(psp->adev)) 1046 1048 return 0; 1047 1049 1048 - if ((amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(14, 0, 2)) && 1049 - (amdgpu_ip_version(adev, MP0_HWIP, 0) != IP_VERSION(14, 0, 3))) 1050 + switch (mp0_ip_ver) { 1051 + case IP_VERSION(14, 0, 2): 1052 + if (adev->psp.sos.fw_version < 0x3b0e0d) 1053 + return 0; 1054 + break; 1055 + 1056 + case IP_VERSION(14, 0, 3): 1057 + if (adev->psp.sos.fw_version < 0x3a0e14) 1058 + return 0; 1059 + break; 1060 + 1061 + default: 1050 1062 return 0; 1063 + } 1051 1064 1052 1065 ret = psp_get_fw_reservation_info(psp, GFX_CMD_ID_FB_FW_RESERV_ADDR, &reserv_addr, &reserv_size); 1053 1066 if (ret)
+11 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 654 654 * Check if all VM PDs/PTs are ready for updates 655 655 * 656 656 * Returns: 657 - * True if VM is not evicting. 657 + * True if VM is not evicting and all VM entities are not stopped 658 658 */ 659 659 bool amdgpu_vm_ready(struct amdgpu_vm *vm) 660 660 { 661 - bool empty; 662 661 bool ret; 663 662 664 663 amdgpu_vm_eviction_lock(vm); ··· 665 666 amdgpu_vm_eviction_unlock(vm); 666 667 667 668 spin_lock(&vm->status_lock); 668 - empty = list_empty(&vm->evicted); 669 + ret &= list_empty(&vm->evicted); 669 670 spin_unlock(&vm->status_lock); 670 671 671 - return ret && empty; 672 + spin_lock(&vm->immediate.lock); 673 + ret &= !vm->immediate.stopped; 674 + spin_unlock(&vm->immediate.lock); 675 + 676 + spin_lock(&vm->delayed.lock); 677 + ret &= !vm->delayed.stopped; 678 + spin_unlock(&vm->delayed.lock); 679 + 680 + return ret; 672 681 } 673 682 674 683 /**
+1 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
··· 648 648 list_for_each_entry(block, &vres->blocks, link) 649 649 vis_usage += amdgpu_vram_mgr_vis_size(adev, block); 650 650 651 - amdgpu_vram_mgr_do_reserve(man); 652 - 653 651 drm_buddy_free_list(mm, &vres->blocks, vres->flags); 652 + amdgpu_vram_mgr_do_reserve(man); 654 653 mutex_unlock(&mgr->lock); 655 654 656 655 atomic64_sub(vis_usage, &mgr->vis_usage);
+2
drivers/gpu/drm/bridge/aux-bridge.c
··· 18 18 { 19 19 struct auxiliary_device *adev = to_auxiliary_dev(dev); 20 20 21 + of_node_put(dev->of_node); 21 22 ida_free(&drm_aux_bridge_ida, adev->id); 22 23 23 24 kfree(adev); ··· 66 65 67 66 ret = auxiliary_device_init(adev); 68 67 if (ret) { 68 + of_node_put(adev->dev.of_node); 69 69 ida_free(&drm_aux_bridge_ida, adev->id); 70 70 kfree(adev); 71 71 return ret;
+1
drivers/gpu/drm/drm_bridge.c
··· 1227 1227 /** 1228 1228 * drm_bridge_detect - check if anything is attached to the bridge output 1229 1229 * @bridge: bridge control structure 1230 + * @connector: attached connector 1230 1231 * 1231 1232 * If the bridge supports output detection, as reported by the 1232 1233 * DRM_BRIDGE_OP_DETECT bridge ops flag, call &drm_bridge_funcs.detect for the
+4 -4
drivers/gpu/drm/i915/display/intel_fbc.c
··· 552 552 if (dpfc_ctl & DPFC_CTL_EN) { 553 553 dpfc_ctl &= ~DPFC_CTL_EN; 554 554 intel_de_write(display, ILK_DPFC_CONTROL(fbc->id), dpfc_ctl); 555 - 556 - /* wa_18038517565 Enable DPFC clock gating after FBC disable */ 557 - if (display->platform.dg2 || DISPLAY_VER(display) >= 14) 558 - fbc_compressor_clkgate_disable_wa(fbc, false); 559 555 } 560 556 } 561 557 ··· 1705 1709 intel_fbc_invalidate_dirty_rect(fbc); 1706 1710 1707 1711 __intel_fbc_cleanup_cfb(fbc); 1712 + 1713 + /* wa_18038517565 Enable DPFC clock gating after FBC disable */ 1714 + if (display->platform.dg2 || DISPLAY_VER(display) >= 14) 1715 + fbc_compressor_clkgate_disable_wa(fbc, false); 1708 1716 1709 1717 fbc->state.plane = NULL; 1710 1718 fbc->flip_pending = false;
+9 -5
drivers/gpu/drm/i915/display/intel_psr.c
··· 3275 3275 3276 3276 static void _psr_invalidate_handle(struct intel_dp *intel_dp) 3277 3277 { 3278 - if (intel_dp->psr.psr2_sel_fetch_enabled) { 3278 + struct intel_display *display = to_intel_display(intel_dp); 3279 + 3280 + if (DISPLAY_VER(display) < 20 && intel_dp->psr.psr2_sel_fetch_enabled) { 3279 3281 if (!intel_dp->psr.psr2_sel_fetch_cff_enabled) { 3280 3282 intel_dp->psr.psr2_sel_fetch_cff_enabled = true; 3281 3283 intel_psr_configure_full_frame_update(intel_dp); ··· 3363 3361 { 3364 3362 struct intel_display *display = to_intel_display(intel_dp); 3365 3363 3366 - if (intel_dp->psr.psr2_sel_fetch_enabled) { 3364 + if (DISPLAY_VER(display) < 20 && intel_dp->psr.psr2_sel_fetch_enabled) { 3367 3365 if (intel_dp->psr.psr2_sel_fetch_cff_enabled) { 3368 3366 /* can we turn CFF off? */ 3369 3367 if (intel_dp->psr.busy_frontbuffer_bits == 0) ··· 3380 3378 * existing SU configuration 3381 3379 */ 3382 3380 intel_psr_configure_full_frame_update(intel_dp); 3381 + 3382 + intel_psr_force_update(intel_dp); 3383 + } else { 3384 + intel_psr_exit(intel_dp); 3383 3385 } 3384 3386 3385 - intel_psr_force_update(intel_dp); 3386 - 3387 - if (!intel_dp->psr.psr2_sel_fetch_enabled && !intel_dp->psr.active && 3387 + if ((!intel_dp->psr.psr2_sel_fetch_enabled || DISPLAY_VER(display) >= 20) && 3388 3388 !intel_dp->psr.busy_frontbuffer_bits) 3389 3389 queue_work(display->wq.unordered, &intel_dp->psr.work); 3390 3390 }
+3 -6
drivers/gpu/drm/nouveau/nouveau_display.c
··· 253 253 254 254 int 255 255 nouveau_framebuffer_new(struct drm_device *dev, 256 + const struct drm_format_info *info, 256 257 const struct drm_mode_fb_cmd2 *mode_cmd, 257 258 struct drm_gem_object *gem, 258 259 struct drm_framebuffer **pfb) ··· 261 260 struct nouveau_drm *drm = nouveau_drm(dev); 262 261 struct nouveau_bo *nvbo = nouveau_gem_object(gem); 263 262 struct drm_framebuffer *fb; 264 - const struct drm_format_info *info; 265 263 unsigned int height, i; 266 264 uint32_t tile_mode; 267 265 uint8_t kind; ··· 295 295 kind = nvbo->kind; 296 296 } 297 297 298 - info = drm_get_format_info(dev, mode_cmd->pixel_format, 299 - mode_cmd->modifier[0]); 300 - 301 298 for (i = 0; i < info->num_planes; i++) { 302 299 height = drm_format_info_plane_height(info, 303 300 mode_cmd->height, ··· 318 321 if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL))) 319 322 return -ENOMEM; 320 323 321 - drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd); 324 + drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd); 322 325 fb->obj[0] = gem; 323 326 324 327 ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs); ··· 341 344 if (!gem) 342 345 return ERR_PTR(-ENOENT); 343 346 344 - ret = nouveau_framebuffer_new(dev, mode_cmd, gem, &fb); 347 + ret = nouveau_framebuffer_new(dev, info, mode_cmd, gem, &fb); 345 348 if (ret == 0) 346 349 return fb; 347 350
+3
drivers/gpu/drm/nouveau/nouveau_display.h
··· 8 8 9 9 #include <drm/drm_framebuffer.h> 10 10 11 + struct drm_format_info; 12 + 11 13 int 12 14 nouveau_framebuffer_new(struct drm_device *dev, 15 + const struct drm_format_info *info, 13 16 const struct drm_mode_fb_cmd2 *mode_cmd, 14 17 struct drm_gem_object *gem, 15 18 struct drm_framebuffer **pfb);
+10 -13
drivers/gpu/drm/omapdrm/omap_fb.c
··· 351 351 } 352 352 } 353 353 354 - fb = omap_framebuffer_init(dev, mode_cmd, bos); 354 + fb = omap_framebuffer_init(dev, info, mode_cmd, bos); 355 355 if (IS_ERR(fb)) 356 356 goto error; 357 357 ··· 365 365 } 366 366 367 367 struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, 368 + const struct drm_format_info *info, 368 369 const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos) 369 370 { 370 - const struct drm_format_info *format = NULL; 371 371 struct omap_framebuffer *omap_fb = NULL; 372 372 struct drm_framebuffer *fb = NULL; 373 373 unsigned int pitch = mode_cmd->pitches[0]; ··· 377 377 dev, mode_cmd, mode_cmd->width, mode_cmd->height, 378 378 (char *)&mode_cmd->pixel_format); 379 379 380 - format = drm_get_format_info(dev, mode_cmd->pixel_format, 381 - mode_cmd->modifier[0]); 382 - 383 380 for (i = 0; i < ARRAY_SIZE(formats); i++) { 384 381 if (formats[i] == mode_cmd->pixel_format) 385 382 break; 386 383 } 387 384 388 - if (!format || i == ARRAY_SIZE(formats)) { 385 + if (i == ARRAY_SIZE(formats)) { 389 386 dev_dbg(dev->dev, "unsupported pixel format: %4.4s\n", 390 387 (char *)&mode_cmd->pixel_format); 391 388 ret = -EINVAL; ··· 396 399 } 397 400 398 401 fb = &omap_fb->base; 399 - omap_fb->format = format; 402 + omap_fb->format = info; 400 403 mutex_init(&omap_fb->lock); 401 404 402 405 /* ··· 404 407 * that the two planes of multiplane formats need the same number of 405 408 * bytes per pixel. 406 409 */ 407 - if (format->num_planes == 2 && pitch != mode_cmd->pitches[1]) { 410 + if (info->num_planes == 2 && pitch != mode_cmd->pitches[1]) { 408 411 dev_dbg(dev->dev, "pitches differ between planes 0 and 1\n"); 409 412 ret = -EINVAL; 410 413 goto fail; 411 414 } 412 415 413 - if (pitch % format->cpp[0]) { 416 + if (pitch % info->cpp[0]) { 414 417 dev_dbg(dev->dev, 415 418 "buffer pitch (%u bytes) is not a multiple of pixel size (%u bytes)\n", 416 - pitch, format->cpp[0]); 419 + pitch, info->cpp[0]); 417 420 ret = -EINVAL; 418 421 goto fail; 419 422 } 420 423 421 - for (i = 0; i < format->num_planes; i++) { 424 + for (i = 0; i < info->num_planes; i++) { 422 425 struct plane *plane = &omap_fb->planes[i]; 423 - unsigned int vsub = i == 0 ? 1 : format->vsub; 426 + unsigned int vsub = i == 0 ? 1 : info->vsub; 424 427 unsigned int size; 425 428 426 429 size = pitch * mode_cmd->height / vsub; ··· 437 440 plane->dma_addr = 0; 438 441 } 439 442 440 - drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd); 443 + drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd); 441 444 442 445 ret = drm_framebuffer_init(dev, fb, &omap_framebuffer_funcs); 443 446 if (ret) {
+2
drivers/gpu/drm/omapdrm/omap_fb.h
··· 13 13 struct drm_device; 14 14 struct drm_file; 15 15 struct drm_framebuffer; 16 + struct drm_format_info; 16 17 struct drm_gem_object; 17 18 struct drm_mode_fb_cmd2; 18 19 struct drm_plane_state; ··· 24 23 struct drm_file *file, const struct drm_format_info *info, 25 24 const struct drm_mode_fb_cmd2 *mode_cmd); 26 25 struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, 26 + const struct drm_format_info *info, 27 27 const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos); 28 28 int omap_framebuffer_pin(struct drm_framebuffer *fb); 29 29 void omap_framebuffer_unpin(struct drm_framebuffer *fb);
+4 -1
drivers/gpu/drm/omapdrm/omap_fbdev.c
··· 197 197 goto fail; 198 198 } 199 199 200 - fb = omap_framebuffer_init(dev, &mode_cmd, &bo); 200 + fb = omap_framebuffer_init(dev, 201 + drm_get_format_info(dev, mode_cmd.pixel_format, 202 + mode_cmd.modifier[0]), 203 + &mode_cmd, &bo); 201 204 if (IS_ERR(fb)) { 202 205 dev_err(dev->dev, "failed to allocate fb\n"); 203 206 /* note: if fb creation failed, we can't rely on fb destroy
+1 -1
drivers/gpu/drm/panfrost/panfrost_gem.c
··· 432 432 if (!refcount) 433 433 return; 434 434 435 - resident_size = bo->base.pages ? bo->base.base.size : 0; 435 + resident_size = panfrost_gem_rss(&bo->base.base); 436 436 437 437 snprintf(creator_info, sizeof(creator_info), 438 438 "%s/%d", bo->debugfs.creator.process_name, bo->debugfs.creator.tgid);
+3 -2
drivers/gpu/drm/radeon/radeon_display.c
··· 1297 1297 int 1298 1298 radeon_framebuffer_init(struct drm_device *dev, 1299 1299 struct drm_framebuffer *fb, 1300 + const struct drm_format_info *info, 1300 1301 const struct drm_mode_fb_cmd2 *mode_cmd, 1301 1302 struct drm_gem_object *obj) 1302 1303 { 1303 1304 int ret; 1304 1305 fb->obj[0] = obj; 1305 - drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd); 1306 + drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd); 1306 1307 ret = drm_framebuffer_init(dev, fb, &radeon_fb_funcs); 1307 1308 if (ret) { 1308 1309 fb->obj[0] = NULL; ··· 1342 1341 return ERR_PTR(-ENOMEM); 1343 1342 } 1344 1343 1345 - ret = radeon_framebuffer_init(dev, fb, mode_cmd, obj); 1344 + ret = radeon_framebuffer_init(dev, fb, info, mode_cmd, obj); 1346 1345 if (ret) { 1347 1346 kfree(fb); 1348 1347 drm_gem_object_put(obj);
+6 -5
drivers/gpu/drm/radeon/radeon_fbdev.c
··· 53 53 } 54 54 55 55 static int radeon_fbdev_create_pinned_object(struct drm_fb_helper *fb_helper, 56 + const struct drm_format_info *info, 56 57 struct drm_mode_fb_cmd2 *mode_cmd, 57 58 struct drm_gem_object **gobj_p) 58 59 { 59 - const struct drm_format_info *info; 60 60 struct radeon_device *rdev = fb_helper->dev->dev_private; 61 61 struct drm_gem_object *gobj = NULL; 62 62 struct radeon_bo *rbo = NULL; ··· 67 67 int height = mode_cmd->height; 68 68 u32 cpp; 69 69 70 - info = drm_get_format_info(rdev_to_drm(rdev), mode_cmd->pixel_format, 71 - mode_cmd->modifier[0]); 72 70 cpp = info->cpp[0]; 73 71 74 72 /* need to align pitch with crtc limits */ ··· 204 206 struct drm_fb_helper_surface_size *sizes) 205 207 { 206 208 struct radeon_device *rdev = fb_helper->dev->dev_private; 209 + const struct drm_format_info *format_info; 207 210 struct drm_mode_fb_cmd2 mode_cmd = { }; 208 211 struct fb_info *info; 209 212 struct drm_gem_object *gobj; ··· 223 224 mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, 224 225 sizes->surface_depth); 225 226 226 - ret = radeon_fbdev_create_pinned_object(fb_helper, &mode_cmd, &gobj); 227 + format_info = drm_get_format_info(rdev_to_drm(rdev), mode_cmd.pixel_format, 228 + mode_cmd.modifier[0]); 229 + ret = radeon_fbdev_create_pinned_object(fb_helper, format_info, &mode_cmd, &gobj); 227 230 if (ret) { 228 231 DRM_ERROR("failed to create fbcon object %d\n", ret); 229 232 return ret; ··· 237 236 ret = -ENOMEM; 238 237 goto err_radeon_fbdev_destroy_pinned_object; 239 238 } 240 - ret = radeon_framebuffer_init(rdev_to_drm(rdev), fb, &mode_cmd, gobj); 239 + ret = radeon_framebuffer_init(rdev_to_drm(rdev), fb, format_info, &mode_cmd, gobj); 241 240 if (ret) { 242 241 DRM_ERROR("failed to initialize framebuffer %d\n", ret); 243 242 goto err_kfree;
+2
drivers/gpu/drm/radeon/radeon_mode.h
··· 40 40 41 41 struct drm_fb_helper; 42 42 struct drm_fb_helper_surface_size; 43 + struct drm_format_info; 43 44 44 45 struct edid; 45 46 struct drm_edid; ··· 891 890 radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on); 892 891 int radeon_framebuffer_init(struct drm_device *dev, 893 892 struct drm_framebuffer *rfb, 893 + const struct drm_format_info *info, 894 894 const struct drm_mode_fb_cmd2 *mode_cmd, 895 895 struct drm_gem_object *obj); 896 896
+1
drivers/gpu/drm/xe/regs/xe_bars.h
··· 7 7 8 8 #define GTTMMADR_BAR 0 /* MMIO + GTT */ 9 9 #define LMEM_BAR 2 /* VRAM */ 10 + #define VF_LMEM_BAR 9 /* VF VRAM */ 10 11 11 12 #endif
+29
drivers/gpu/drm/xe/xe_hwmon.c
··· 332 332 int ret = 0; 333 333 u32 reg_val, max; 334 334 struct xe_reg rapl_limit; 335 + u64 max_supp_power_limit = 0; 335 336 336 337 mutex_lock(&hwmon->hwmon_lock); 337 338 ··· 355 354 ret = -EOPNOTSUPP; 356 355 } 357 356 goto unlock; 357 + } 358 + 359 + /* 360 + * If the sysfs value exceeds the maximum pcode supported power limit value, clamp it to 361 + * the supported maximum (U12.3 format). 362 + * This is to avoid truncation during reg_val calculation below and ensure the valid 363 + * power limit is sent for pcode which would clamp it to card-supported value. 364 + */ 365 + max_supp_power_limit = ((PWR_LIM_VAL) >> hwmon->scl_shift_power) * SF_POWER; 366 + if (value > max_supp_power_limit) { 367 + value = max_supp_power_limit; 368 + drm_info(&hwmon->xe->drm, 369 + "Power limit clamped as selected %s exceeds channel %d limit\n", 370 + PWR_ATTR_TO_STR(attr), channel); 358 371 } 359 372 360 373 /* Computation in 64-bits to avoid overflow. Round to nearest. */ ··· 754 739 { 755 740 int ret; 756 741 u32 uval; 742 + u64 max_crit_power_curr = 0; 757 743 758 744 mutex_lock(&hwmon->hwmon_lock); 759 745 746 + /* 747 + * If the sysfs value exceeds the pcode mailbox cmd POWER_SETUP_SUBCOMMAND_WRITE_I1 748 + * max supported value, clamp it to the command's max (U10.6 format). 749 + * This is to avoid truncation during uval calculation below and ensure the valid power 750 + * limit is sent for pcode which would clamp it to card-supported value. 751 + */ 752 + max_crit_power_curr = (POWER_SETUP_I1_DATA_MASK >> POWER_SETUP_I1_SHIFT) * scale_factor; 753 + if (value > max_crit_power_curr) { 754 + value = max_crit_power_curr; 755 + drm_info(&hwmon->xe->drm, 756 + "Power limit clamped as selected exceeds channel %d limit\n", 757 + channel); 758 + } 760 759 uval = DIV_ROUND_CLOSEST_ULL(value << POWER_SETUP_I1_SHIFT, scale_factor); 761 760 ret = xe_hwmon_pcode_write_i1(hwmon, uval); 762 761
+27 -15
drivers/gpu/drm/xe/xe_migrate.c
··· 1820 1820 if (!IS_ALIGNED(len, XE_CACHELINE_BYTES) || 1821 1821 !IS_ALIGNED((unsigned long)buf + offset, XE_CACHELINE_BYTES)) { 1822 1822 int buf_offset = 0; 1823 + void *bounce; 1824 + int err; 1825 + 1826 + BUILD_BUG_ON(!is_power_of_2(XE_CACHELINE_BYTES)); 1827 + bounce = kmalloc(XE_CACHELINE_BYTES, GFP_KERNEL); 1828 + if (!bounce) 1829 + return -ENOMEM; 1823 1830 1824 1831 /* 1825 1832 * Less than ideal for large unaligned access but this should be 1826 1833 * fairly rare, can fixup if this becomes common. 1827 1834 */ 1828 1835 do { 1829 - u8 bounce[XE_CACHELINE_BYTES]; 1830 - void *ptr = (void *)bounce; 1831 - int err; 1832 1836 int copy_bytes = min_t(int, bytes_left, 1833 1837 XE_CACHELINE_BYTES - 1834 1838 (offset & XE_CACHELINE_MASK)); ··· 1841 1837 err = xe_migrate_access_memory(m, bo, 1842 1838 offset & 1843 1839 ~XE_CACHELINE_MASK, 1844 - (void *)ptr, 1845 - sizeof(bounce), 0); 1840 + bounce, 1841 + XE_CACHELINE_BYTES, 0); 1846 1842 if (err) 1847 - return err; 1843 + break; 1848 1844 1849 1845 if (write) { 1850 - memcpy(ptr + ptr_offset, buf + buf_offset, copy_bytes); 1846 + memcpy(bounce + ptr_offset, buf + buf_offset, copy_bytes); 1851 1847 1852 1848 err = xe_migrate_access_memory(m, bo, 1853 1849 offset & ~XE_CACHELINE_MASK, 1854 - (void *)ptr, 1855 - sizeof(bounce), write); 1850 + bounce, 1851 + XE_CACHELINE_BYTES, write); 1856 1852 if (err) 1857 - return err; 1853 + break; 1858 1854 } else { 1859 - memcpy(buf + buf_offset, ptr + ptr_offset, 1855 + memcpy(buf + buf_offset, bounce + ptr_offset, 1860 1856 copy_bytes); 1861 1857 } 1862 1858 ··· 1865 1861 offset += copy_bytes; 1866 1862 } while (bytes_left); 1867 1863 1868 - return 0; 1864 + kfree(bounce); 1865 + return err; 1869 1866 } 1870 1867 1871 1868 dma_addr = xe_migrate_dma_map(xe, buf, len + page_offset, write); ··· 1887 1882 else 1888 1883 current_bytes = min_t(int, bytes_left, cursor.size); 1889 1884 1890 - if (fence) 1891 - dma_fence_put(fence); 1885 + if (current_bytes & ~PAGE_MASK) { 1886 + int pitch = 4; 1887 + 1888 + current_bytes = min_t(int, current_bytes, S16_MAX * pitch); 1889 + } 1892 1890 1893 1891 __fence = xe_migrate_vram(m, current_bytes, 1894 1892 (unsigned long)buf & ~PAGE_MASK, ··· 1900 1892 XE_MIGRATE_COPY_TO_VRAM : 1901 1893 XE_MIGRATE_COPY_TO_SRAM); 1902 1894 if (IS_ERR(__fence)) { 1903 - if (fence) 1895 + if (fence) { 1904 1896 dma_fence_wait(fence, false); 1897 + dma_fence_put(fence); 1898 + } 1905 1899 fence = __fence; 1906 1900 goto out_err; 1907 1901 } 1902 + 1903 + dma_fence_put(fence); 1908 1904 fence = __fence; 1909 1905 1910 1906 buf += current_bytes;
+22
drivers/gpu/drm/xe/xe_pci_sriov.c
··· 3 3 * Copyright © 2023-2024 Intel Corporation 4 4 */ 5 5 6 + #include <linux/bitops.h> 7 + #include <linux/pci.h> 8 + 9 + #include "regs/xe_bars.h" 6 10 #include "xe_assert.h" 7 11 #include "xe_device.h" 8 12 #include "xe_gt_sriov_pf_config.h" ··· 132 128 } 133 129 } 134 130 131 + static int resize_vf_vram_bar(struct xe_device *xe, int num_vfs) 132 + { 133 + struct pci_dev *pdev = to_pci_dev(xe->drm.dev); 134 + u32 sizes; 135 + 136 + sizes = pci_iov_vf_bar_get_sizes(pdev, VF_LMEM_BAR, num_vfs); 137 + if (!sizes) 138 + return 0; 139 + 140 + return pci_iov_vf_bar_set_size(pdev, VF_LMEM_BAR, __fls(sizes)); 141 + } 142 + 135 143 static int pf_enable_vfs(struct xe_device *xe, int num_vfs) 136 144 { 137 145 struct pci_dev *pdev = to_pci_dev(xe->drm.dev); ··· 173 157 err = pf_provision_vfs(xe, num_vfs); 174 158 if (err < 0) 175 159 goto failed; 160 + 161 + if (IS_DGFX(xe)) { 162 + err = resize_vf_vram_bar(xe, num_vfs); 163 + if (err) 164 + xe_sriov_info(xe, "Failed to set VF LMEM BAR size: %d\n", err); 165 + } 176 166 177 167 err = pci_enable_sriov(pdev, num_vfs); 178 168 if (err < 0)
+47 -4
drivers/gpu/drm/xe/xe_shrinker.c
··· 54 54 write_unlock(&shrinker->lock); 55 55 } 56 56 57 - static s64 xe_shrinker_walk(struct xe_device *xe, 58 - struct ttm_operation_ctx *ctx, 59 - const struct xe_bo_shrink_flags flags, 60 - unsigned long to_scan, unsigned long *scanned) 57 + static s64 __xe_shrinker_walk(struct xe_device *xe, 58 + struct ttm_operation_ctx *ctx, 59 + const struct xe_bo_shrink_flags flags, 60 + unsigned long to_scan, unsigned long *scanned) 61 61 { 62 62 unsigned int mem_type; 63 63 s64 freed = 0, lret; ··· 88 88 } 89 89 /* Trylocks should never error, just fail. */ 90 90 xe_assert(xe, !IS_ERR(ttm_bo)); 91 + } 92 + 93 + return freed; 94 + } 95 + 96 + /* 97 + * Try shrinking idle objects without writeback first, then if not sufficient, 98 + * try also non-idle objects and finally if that's not sufficient either, 99 + * add writeback. This avoids stalls and explicit writebacks with light or 100 + * moderate memory pressure. 101 + */ 102 + static s64 xe_shrinker_walk(struct xe_device *xe, 103 + struct ttm_operation_ctx *ctx, 104 + const struct xe_bo_shrink_flags flags, 105 + unsigned long to_scan, unsigned long *scanned) 106 + { 107 + bool no_wait_gpu = true; 108 + struct xe_bo_shrink_flags save_flags = flags; 109 + s64 lret, freed; 110 + 111 + swap(no_wait_gpu, ctx->no_wait_gpu); 112 + save_flags.writeback = false; 113 + lret = __xe_shrinker_walk(xe, ctx, save_flags, to_scan, scanned); 114 + swap(no_wait_gpu, ctx->no_wait_gpu); 115 + if (lret < 0 || *scanned >= to_scan) 116 + return lret; 117 + 118 + freed = lret; 119 + if (!ctx->no_wait_gpu) { 120 + lret = __xe_shrinker_walk(xe, ctx, save_flags, to_scan, scanned); 121 + if (lret < 0) 122 + return lret; 123 + freed += lret; 124 + if (*scanned >= to_scan) 125 + return freed; 126 + } 127 + 128 + if (flags.writeback) { 129 + lret = __xe_shrinker_walk(xe, ctx, flags, to_scan, scanned); 130 + if (lret < 0) 131 + return lret; 132 + freed += lret; 91 133 } 92 134 93 135 return freed; ··· 241 199 runtime_pm = xe_shrinker_runtime_pm_get(shrinker, true, 0, can_backup); 242 200 243 201 shrink_flags.purge = false; 202 + 244 203 lret = xe_shrinker_walk(shrinker->xe, &ctx, shrink_flags, 245 204 nr_to_scan, &nr_scanned); 246 205 if (lret >= 0)
+1 -1
drivers/idle/intel_idle.c
··· 1679 1679 }; 1680 1680 1681 1681 static const struct x86_cpu_id intel_mwait_ids[] __initconst = { 1682 - X86_MATCH_VENDOR_FAM_FEATURE(INTEL, 6, X86_FEATURE_MWAIT, NULL), 1682 + X86_MATCH_VENDOR_FAM_FEATURE(INTEL, X86_FAMILY_ANY, X86_FEATURE_MWAIT, NULL), 1683 1683 {} 1684 1684 }; 1685 1685
+11 -9
drivers/net/dsa/microchip/ksz8.c
··· 36 36 37 37 static void ksz_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set) 38 38 { 39 - regmap_update_bits(ksz_regmap_8(dev), addr, bits, set ? bits : 0); 39 + ksz_rmw8(dev, addr, bits, set ? bits : 0); 40 40 } 41 41 42 42 static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits, 43 43 bool set) 44 44 { 45 - regmap_update_bits(ksz_regmap_8(dev), 46 - dev->dev_ops->get_port_addr(port, offset), 47 - bits, set ? bits : 0); 45 + ksz_rmw8(dev, dev->dev_ops->get_port_addr(port, offset), bits, 46 + set ? bits : 0); 48 47 } 49 48 50 49 /** ··· 1954 1955 ksz_cfg(dev, S_LINK_AGING_CTRL, SW_LINK_AUTO_AGING, true); 1955 1956 1956 1957 /* Enable aggressive back off algorithm in half duplex mode. */ 1957 - regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_1, 1958 - SW_AGGR_BACKOFF, SW_AGGR_BACKOFF); 1958 + ret = ksz_rmw8(dev, REG_SW_CTRL_1, SW_AGGR_BACKOFF, SW_AGGR_BACKOFF); 1959 + if (ret) 1960 + return ret; 1959 1961 1960 1962 /* 1961 1963 * Make sure unicast VLAN boundary is set as default and 1962 1964 * enable no excessive collision drop. 1963 1965 */ 1964 - regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_2, 1965 - UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP, 1966 - UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP); 1966 + ret = ksz_rmw8(dev, REG_SW_CTRL_2, 1967 + UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP, 1968 + UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP); 1969 + if (ret) 1970 + return ret; 1967 1971 1968 1972 ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_REPLACE_VID, false); 1969 1973
+1
drivers/net/dsa/microchip/ksz_common.c
··· 1447 1447 regmap_reg_range(0x3f, 0x3f), 1448 1448 1449 1449 /* advanced control registers */ 1450 + regmap_reg_range(0x43, 0x43), 1450 1451 regmap_reg_range(0x60, 0x6f), 1451 1452 regmap_reg_range(0x70, 0x75), 1452 1453 regmap_reg_range(0x76, 0x78),
+17 -4
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 926 926 927 927 static netmem_ref __bnxt_alloc_rx_netmem(struct bnxt *bp, dma_addr_t *mapping, 928 928 struct bnxt_rx_ring_info *rxr, 929 + unsigned int *offset, 929 930 gfp_t gfp) 930 931 { 931 932 netmem_ref netmem; 932 933 933 - netmem = page_pool_alloc_netmems(rxr->page_pool, gfp); 934 + if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) { 935 + netmem = page_pool_alloc_frag_netmem(rxr->page_pool, offset, BNXT_RX_PAGE_SIZE, gfp); 936 + } else { 937 + netmem = page_pool_alloc_netmems(rxr->page_pool, gfp); 938 + *offset = 0; 939 + } 934 940 if (!netmem) 935 941 return 0; 936 942 937 - *mapping = page_pool_get_dma_addr_netmem(netmem); 943 + *mapping = page_pool_get_dma_addr_netmem(netmem) + *offset; 938 944 return netmem; 939 945 } 940 946 ··· 1035 1029 dma_addr_t mapping; 1036 1030 netmem_ref netmem; 1037 1031 1038 - netmem = __bnxt_alloc_rx_netmem(bp, &mapping, rxr, gfp); 1032 + netmem = __bnxt_alloc_rx_netmem(bp, &mapping, rxr, &offset, gfp); 1039 1033 if (!netmem) 1040 1034 return -ENOMEM; 1041 1035 ··· 3825 3819 if (BNXT_RX_PAGE_MODE(bp)) 3826 3820 pp.pool_size += bp->rx_ring_size / rx_size_fac; 3827 3821 pp.nid = numa_node; 3828 - pp.napi = &rxr->bnapi->napi; 3829 3822 pp.netdev = bp->dev; 3830 3823 pp.dev = &bp->pdev->dev; 3831 3824 pp.dma_dir = bp->rx_dir; ··· 3854 3849 page_pool_destroy(rxr->page_pool); 3855 3850 rxr->page_pool = NULL; 3856 3851 return PTR_ERR(pool); 3852 + } 3853 + 3854 + static void bnxt_enable_rx_page_pool(struct bnxt_rx_ring_info *rxr) 3855 + { 3856 + page_pool_enable_direct_recycling(rxr->head_pool, &rxr->bnapi->napi); 3857 + page_pool_enable_direct_recycling(rxr->page_pool, &rxr->bnapi->napi); 3857 3858 } 3858 3859 3859 3860 static int bnxt_alloc_rx_agg_bmap(struct bnxt *bp, struct bnxt_rx_ring_info *rxr) ··· 3900 3889 rc = bnxt_alloc_rx_page_pool(bp, rxr, cpu_node); 3901 3890 if (rc) 3902 3891 return rc; 3892 + bnxt_enable_rx_page_pool(rxr); 3903 3893 3904 3894 rc = xdp_rxq_info_reg(&rxr->xdp_rxq, bp->dev, i, 0); 3905 3895 if (rc < 0) ··· 16043 16031 goto err_reset; 16044 16032 } 16045 16033 16034 + bnxt_enable_rx_page_pool(rxr); 16046 16035 napi_enable_locked(&bnapi->napi); 16047 16036 bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons); 16048 16037
+5 -9
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
··· 53 53 { 54 54 int ret; 55 55 56 - ASSERT_RTNL(); 56 + if (test_and_set_bit(HBG_NIC_STATE_RESETTING, &priv->state)) 57 + return -EBUSY; 57 58 58 59 if (netif_running(priv->netdev)) { 60 + clear_bit(HBG_NIC_STATE_RESETTING, &priv->state); 59 61 dev_warn(&priv->pdev->dev, 60 62 "failed to reset because port is up\n"); 61 63 return -EBUSY; ··· 66 64 netif_device_detach(priv->netdev); 67 65 68 66 priv->reset_type = type; 69 - set_bit(HBG_NIC_STATE_RESETTING, &priv->state); 70 67 clear_bit(HBG_NIC_STATE_RESET_FAIL, &priv->state); 71 68 ret = hbg_hw_event_notify(priv, HBG_HW_EVENT_RESET); 72 69 if (ret) { ··· 85 84 type != priv->reset_type) 86 85 return 0; 87 86 88 - ASSERT_RTNL(); 89 - 90 - clear_bit(HBG_NIC_STATE_RESETTING, &priv->state); 91 87 ret = hbg_rebuild(priv); 92 88 if (ret) { 93 89 priv->stats.reset_fail_cnt++; 94 90 set_bit(HBG_NIC_STATE_RESET_FAIL, &priv->state); 91 + clear_bit(HBG_NIC_STATE_RESETTING, &priv->state); 95 92 dev_err(&priv->pdev->dev, "failed to rebuild after reset\n"); 96 93 return ret; 97 94 } 98 95 99 96 netif_device_attach(priv->netdev); 97 + clear_bit(HBG_NIC_STATE_RESETTING, &priv->state); 100 98 101 99 dev_info(&priv->pdev->dev, "reset done\n"); 102 100 return ret; 103 101 } 104 102 105 - /* must be protected by rtnl lock */ 106 103 int hbg_reset(struct hbg_priv *priv) 107 104 { 108 105 int ret; 109 106 110 - ASSERT_RTNL(); 111 107 ret = hbg_reset_prepare(priv, HBG_RESET_TYPE_FUNCTION); 112 108 if (ret) 113 109 return ret; ··· 169 171 struct net_device *netdev = pci_get_drvdata(pdev); 170 172 struct hbg_priv *priv = netdev_priv(netdev); 171 173 172 - rtnl_lock(); 173 174 hbg_reset_prepare(priv, HBG_RESET_TYPE_FLR); 174 175 } 175 176 ··· 178 181 struct hbg_priv *priv = netdev_priv(netdev); 179 182 180 183 hbg_reset_done(priv, HBG_RESET_TYPE_FLR); 181 - rtnl_unlock(); 182 184 } 183 185 184 186 static const struct pci_error_handlers hbg_pci_err_handler = {
+13 -2
drivers/net/ethernet/hisilicon/hibmcge/hbg_hw.c
··· 12 12 13 13 #define HBG_HW_EVENT_WAIT_TIMEOUT_US (2 * 1000 * 1000) 14 14 #define HBG_HW_EVENT_WAIT_INTERVAL_US (10 * 1000) 15 + #define HBG_MAC_LINK_WAIT_TIMEOUT_US (500 * 1000) 16 + #define HBG_MAC_LINK_WAIT_INTERVAL_US (5 * 1000) 15 17 /* little endian or big endian. 16 18 * ctrl means packet description, data means skb packet data 17 19 */ ··· 230 228 231 229 void hbg_hw_adjust_link(struct hbg_priv *priv, u32 speed, u32 duplex) 232 230 { 231 + u32 link_status; 232 + int ret; 233 + 233 234 hbg_hw_mac_enable(priv, HBG_STATUS_DISABLE); 234 235 235 236 hbg_reg_write_field(priv, HBG_REG_PORT_MODE_ADDR, ··· 244 239 245 240 hbg_hw_mac_enable(priv, HBG_STATUS_ENABLE); 246 241 247 - if (!hbg_reg_read_field(priv, HBG_REG_AN_NEG_STATE_ADDR, 248 - HBG_REG_AN_NEG_STATE_NP_LINK_OK_B)) 242 + /* wait MAC link up */ 243 + ret = readl_poll_timeout(priv->io_base + HBG_REG_AN_NEG_STATE_ADDR, 244 + link_status, 245 + FIELD_GET(HBG_REG_AN_NEG_STATE_NP_LINK_OK_B, 246 + link_status), 247 + HBG_MAC_LINK_WAIT_INTERVAL_US, 248 + HBG_MAC_LINK_WAIT_TIMEOUT_US); 249 + if (ret) 249 250 hbg_np_link_fail_task_schedule(priv); 250 251 } 251 252
+6 -1
drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.h
··· 29 29 30 30 static inline u32 hbg_get_queue_used_num(struct hbg_ring *ring) 31 31 { 32 - return (ring->ntu + ring->len - ring->ntc) % ring->len; 32 + u32 len = READ_ONCE(ring->len); 33 + 34 + if (!len) 35 + return 0; 36 + 37 + return (READ_ONCE(ring->ntu) + len - READ_ONCE(ring->ntc)) % len; 33 38 } 34 39 35 40 netdev_tx_t hbg_net_start_xmit(struct sk_buff *skb, struct net_device *netdev);
+1
drivers/net/ethernet/intel/ixgbe/devlink/devlink.c
··· 543 543 544 544 attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; 545 545 attrs.phys.port_number = adapter->hw.bus.func; 546 + attrs.no_phys_port_name = 1; 546 547 ixgbe_devlink_set_switch_id(adapter, &attrs.switch_id); 547 548 548 549 devlink_port_attrs_set(devlink_port, &attrs);
+2 -11
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
··· 330 330 if (IS_ERR(plat_dat)) 331 331 return PTR_ERR(plat_dat); 332 332 333 - ret = devm_clk_bulk_get_all(&pdev->dev, &plat_dat->clks); 333 + ret = devm_clk_bulk_get_all_enabled(&pdev->dev, &plat_dat->clks); 334 334 if (ret < 0) 335 - return dev_err_probe(&pdev->dev, ret, "Failed to retrieve all required clocks\n"); 335 + return dev_err_probe(&pdev->dev, ret, "Failed to retrieve and enable all required clocks\n"); 336 336 plat_dat->num_clks = ret; 337 - 338 - ret = clk_bulk_prepare_enable(plat_dat->num_clks, plat_dat->clks); 339 - if (ret) 340 - return dev_err_probe(&pdev->dev, ret, "Failed to enable clocks\n"); 341 337 342 338 plat_dat->stmmac_clk = stmmac_pltfr_find_clk(plat_dat, 343 339 data->stmmac_clk_name); ··· 342 346 ret = data->probe(pdev, plat_dat, &stmmac_res); 343 347 if (ret < 0) { 344 348 dev_err_probe(&pdev->dev, ret, "failed to probe subdriver\n"); 345 - clk_bulk_disable_unprepare(plat_dat->num_clks, plat_dat->clks); 346 349 return ret; 347 350 } 348 351 ··· 365 370 static void dwc_eth_dwmac_remove(struct platform_device *pdev) 366 371 { 367 372 const struct dwc_eth_dwmac_data *data = device_get_match_data(&pdev->dev); 368 - struct plat_stmmacenet_data *plat_dat = dev_get_platdata(&pdev->dev); 369 373 370 374 stmmac_dvr_remove(&pdev->dev); 371 375 372 376 if (data->remove) 373 377 data->remove(pdev); 374 - 375 - if (plat_dat) 376 - clk_bulk_disable_unprepare(plat_dat->num_clks, plat_dat->clks); 377 378 } 378 379 379 380 static const struct of_device_id dwc_eth_dwmac_match[] = {
+5 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
··· 1765 1765 1766 1766 static void rk_gmac_remove(struct platform_device *pdev) 1767 1767 { 1768 - struct rk_priv_data *bsp_priv = get_stmmac_bsp_priv(&pdev->dev); 1768 + struct stmmac_priv *priv = netdev_priv(platform_get_drvdata(pdev)); 1769 + struct rk_priv_data *bsp_priv = priv->plat->bsp_priv; 1769 1770 1770 1771 stmmac_dvr_remove(&pdev->dev); 1771 1772 1772 1773 rk_gmac_powerdown(bsp_priv); 1774 + 1775 + if (priv->plat->phy_node && bsp_priv->integrated_phy) 1776 + clk_put(bsp_priv->clk_phy); 1773 1777 } 1774 1778 1775 1779 #ifdef CONFIG_PM_SLEEP
+14
drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c
··· 211 211 struct stmmac_resources stmmac_res; 212 212 struct plat_stmmacenet_data *plat; 213 213 struct thead_dwmac *dwmac; 214 + struct clk *apb_clk; 214 215 void __iomem *apb; 215 216 int ret; 216 217 ··· 224 223 if (IS_ERR(plat)) 225 224 return dev_err_probe(&pdev->dev, PTR_ERR(plat), 226 225 "dt configuration failed\n"); 226 + 227 + /* 228 + * The APB clock is essential for accessing glue registers. However, 229 + * old devicetrees don't describe it correctly. We continue to probe 230 + * and emit a warning if it isn't present. 231 + */ 232 + apb_clk = devm_clk_get_enabled(&pdev->dev, "apb"); 233 + if (PTR_ERR(apb_clk) == -ENOENT) 234 + dev_warn(&pdev->dev, 235 + "cannot get apb clock, link may break after speed changes\n"); 236 + else if (IS_ERR(apb_clk)) 237 + return dev_err_probe(&pdev->dev, PTR_ERR(apb_clk), 238 + "failed to get apb clock\n"); 227 239 228 240 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); 229 241 if (!dwmac)
+2 -1
drivers/net/ethernet/ti/icssg/icss_iep.c
··· 621 621 622 622 static int icss_iep_extts_enable(struct icss_iep *iep, u32 index, int on) 623 623 { 624 - u32 val, cap, ret = 0; 624 + u32 val, cap; 625 + int ret = 0; 625 626 626 627 mutex_lock(&iep->ptp_clk_mutex); 627 628
+6
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 50 50 /* CTRLMMR_ICSSG_RGMII_CTRL register bits */ 51 51 #define ICSSG_CTRL_RGMII_ID_MODE BIT(24) 52 52 53 + static void emac_adjust_link(struct net_device *ndev); 54 + 53 55 static int emac_get_tx_ts(struct prueth_emac *emac, 54 56 struct emac_tx_ts_response *rsp) 55 57 { ··· 231 229 ret = icssg_config(prueth, emac, slice); 232 230 if (ret) 233 231 goto disable_class; 232 + 233 + mutex_lock(&emac->ndev->phydev->lock); 234 + emac_adjust_link(emac->ndev); 235 + mutex_unlock(&emac->ndev->phydev->lock); 234 236 } 235 237 236 238 ret = prueth_emac_start(prueth);
+1 -1
drivers/net/hamradio/bpqether.c
··· 138 138 139 139 static inline int dev_is_ethdev(struct net_device *dev) 140 140 { 141 - return dev->type == ARPHRD_ETHER && strncmp(dev->name, "dummy", 5); 141 + return dev->type == ARPHRD_ETHER && !netdev_need_ops_lock(dev); 142 142 } 143 143 144 144 /* ------------------------------------------------------------------------ */
+3
drivers/net/hyperv/hyperv_net.h
··· 1061 1061 struct net_device __rcu *vf_netdev; 1062 1062 struct netvsc_vf_pcpu_stats __percpu *vf_stats; 1063 1063 struct delayed_work vf_takeover; 1064 + struct delayed_work vfns_work; 1064 1065 1065 1066 /* 1: allocated, serial number is valid. 0: not allocated */ 1066 1067 u32 vf_alloc; ··· 1075 1074 /* Used to temporarily save the config info across hibernation */ 1076 1075 struct netvsc_device_info *saved_netvsc_dev_info; 1077 1076 }; 1077 + 1078 + void netvsc_vfns_work(struct work_struct *w); 1078 1079 1079 1080 /* Azure hosts don't support non-TCP port numbers in hashing for fragmented 1080 1081 * packets. We can use ethtool to change UDP hash level when necessary.
+28 -1
drivers/net/hyperv/netvsc_drv.c
··· 2522 2522 spin_lock_init(&net_device_ctx->lock); 2523 2523 INIT_LIST_HEAD(&net_device_ctx->reconfig_events); 2524 2524 INIT_DELAYED_WORK(&net_device_ctx->vf_takeover, netvsc_vf_setup); 2525 + INIT_DELAYED_WORK(&net_device_ctx->vfns_work, netvsc_vfns_work); 2525 2526 2526 2527 net_device_ctx->vf_stats 2527 2528 = netdev_alloc_pcpu_stats(struct netvsc_vf_pcpu_stats); ··· 2667 2666 cancel_delayed_work_sync(&ndev_ctx->dwork); 2668 2667 2669 2668 rtnl_lock(); 2669 + cancel_delayed_work_sync(&ndev_ctx->vfns_work); 2670 + 2670 2671 nvdev = rtnl_dereference(ndev_ctx->nvdev); 2671 2672 if (nvdev) { 2672 2673 cancel_work_sync(&nvdev->subchan_work); ··· 2710 2707 cancel_delayed_work_sync(&ndev_ctx->dwork); 2711 2708 2712 2709 rtnl_lock(); 2710 + cancel_delayed_work_sync(&ndev_ctx->vfns_work); 2713 2711 2714 2712 nvdev = rtnl_dereference(ndev_ctx->nvdev); 2715 2713 if (nvdev == NULL) { ··· 2804 2800 } 2805 2801 } 2806 2802 2803 + void netvsc_vfns_work(struct work_struct *w) 2804 + { 2805 + struct net_device_context *ndev_ctx = 2806 + container_of(w, struct net_device_context, vfns_work.work); 2807 + struct net_device *ndev; 2808 + 2809 + if (!rtnl_trylock()) { 2810 + schedule_delayed_work(&ndev_ctx->vfns_work, 1); 2811 + return; 2812 + } 2813 + 2814 + ndev = hv_get_drvdata(ndev_ctx->device_ctx); 2815 + if (!ndev) 2816 + goto out; 2817 + 2818 + netvsc_event_set_vf_ns(ndev); 2819 + 2820 + out: 2821 + rtnl_unlock(); 2822 + } 2823 + 2807 2824 /* 2808 2825 * On Hyper-V, every VF interface is matched with a corresponding 2809 2826 * synthetic interface. The synthetic interface is presented first ··· 2835 2810 unsigned long event, void *ptr) 2836 2811 { 2837 2812 struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); 2813 + struct net_device_context *ndev_ctx; 2838 2814 int ret = 0; 2839 2815 2840 2816 if (event_dev->netdev_ops == &device_ops && event == NETDEV_REGISTER) { 2841 - netvsc_event_set_vf_ns(event_dev); 2817 + ndev_ctx = netdev_priv(event_dev); 2818 + schedule_delayed_work(&ndev_ctx->vfns_work, 0); 2842 2819 return NOTIFY_DONE; 2843 2820 } 2844 2821
+7 -3
drivers/net/netdevsim/netdev.c
··· 710 710 static void nsim_queue_free(struct net_device *dev, struct nsim_rq *rq) 711 711 { 712 712 hrtimer_cancel(&rq->napi_timer); 713 - local_bh_disable(); 714 - dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen); 715 - local_bh_enable(); 713 + 714 + if (rq->skb_queue.qlen) { 715 + local_bh_disable(); 716 + dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen); 717 + local_bh_enable(); 718 + } 719 + 716 720 skb_queue_purge_reason(&rq->skb_queue, SKB_DROP_REASON_QUEUE_PURGE); 717 721 kfree(rq); 718 722 }
+1
drivers/net/phy/mdio_bus.c
··· 91 91 if (mdiodev->bus->mdio_map[mdiodev->addr] != mdiodev) 92 92 return -EINVAL; 93 93 94 + gpiod_put(mdiodev->reset_gpio); 94 95 reset_control_put(mdiodev->reset_ctrl); 95 96 96 97 mdiodev->bus->mdio_map[mdiodev->addr] = NULL;
-3
drivers/net/phy/mdio_bus_provider.c
··· 443 443 if (!mdiodev) 444 444 continue; 445 445 446 - if (mdiodev->reset_gpio) 447 - gpiod_put(mdiodev->reset_gpio); 448 - 449 446 mdiodev->device_remove(mdiodev); 450 447 mdiodev->device_free(mdiodev); 451 448 }
+13 -10
drivers/net/phy/nxp-c45-tja11xx.c
··· 1965 1965 return macsec_ability; 1966 1966 } 1967 1967 1968 + static bool tja11xx_phy_id_compare(struct phy_device *phydev, 1969 + const struct phy_driver *phydrv) 1970 + { 1971 + u32 id = phydev->is_c45 ? phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] : 1972 + phydev->phy_id; 1973 + 1974 + return phy_id_compare(id, phydrv->phy_id, phydrv->phy_id_mask); 1975 + } 1976 + 1968 1977 static int tja11xx_no_macsec_match_phy_device(struct phy_device *phydev, 1969 1978 const struct phy_driver *phydrv) 1970 1979 { 1971 - if (!phy_id_compare(phydev->phy_id, phydrv->phy_id, 1972 - phydrv->phy_id_mask)) 1973 - return 0; 1974 - 1975 - return !nxp_c45_macsec_ability(phydev); 1980 + return tja11xx_phy_id_compare(phydev, phydrv) && 1981 + !nxp_c45_macsec_ability(phydev); 1976 1982 } 1977 1983 1978 1984 static int tja11xx_macsec_match_phy_device(struct phy_device *phydev, 1979 1985 const struct phy_driver *phydrv) 1980 1986 { 1981 - if (!phy_id_compare(phydev->phy_id, phydrv->phy_id, 1982 - phydrv->phy_id_mask)) 1983 - return 0; 1984 - 1985 - return nxp_c45_macsec_ability(phydev); 1987 + return tja11xx_phy_id_compare(phydev, phydrv) && 1988 + nxp_c45_macsec_ability(phydev); 1986 1989 } 1987 1990 1988 1991 static const struct nxp_c45_regmap tja1120_regmap = {
+1
drivers/net/usb/asix_devices.c
··· 676 676 priv->mdio->read = &asix_mdio_bus_read; 677 677 priv->mdio->write = &asix_mdio_bus_write; 678 678 priv->mdio->name = "Asix MDIO Bus"; 679 + priv->mdio->phy_mask = ~(BIT(priv->phy_addr) | BIT(AX_EMBD_PHY_ADDR)); 679 680 /* mii bus name is usb-<usb bus number>-<usb device number> */ 680 681 snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d", 681 682 dev->udev->bus->busnum, dev->udev->devnum);
+1
drivers/net/usb/qmi_wwan.c
··· 1361 1361 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1057, 2)}, /* Telit FN980 */ 1362 1362 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */ 1363 1363 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1070, 2)}, /* Telit FN990A */ 1364 + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1077, 2)}, /* Telit FN990A w/audio */ 1364 1365 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1080, 2)}, /* Telit FE990A */ 1365 1366 {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a0, 0)}, /* Telit FN920C04 */ 1366 1367 {QMI_QUIRK_SET_DTR(0x1bc7, 0x10a4, 0)}, /* Telit FN920C04 */
+1 -1
drivers/net/wan/lapbether.c
··· 81 81 82 82 static __inline__ int dev_is_ethdev(struct net_device *dev) 83 83 { 84 - return dev->type == ARPHRD_ETHER && strncmp(dev->name, "dummy", 5); 84 + return dev->type == ARPHRD_ETHER && !netdev_need_ops_lock(dev); 85 85 } 86 86 87 87 /* ------------------------------------------------------------------------ */
+5
drivers/ptp/ptp_private.h
··· 24 24 #define PTP_DEFAULT_MAX_VCLOCKS 20 25 25 #define PTP_MAX_CHANNELS 2048 26 26 27 + enum { 28 + PTP_LOCK_PHYSICAL = 0, 29 + PTP_LOCK_VIRTUAL, 30 + }; 31 + 27 32 struct timestamp_event_queue { 28 33 struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS]; 29 34 int head;
+7
drivers/ptp/ptp_vclock.c
··· 154 154 return PTP_VCLOCK_REFRESH_INTERVAL; 155 155 } 156 156 157 + static void ptp_vclock_set_subclass(struct ptp_clock *ptp) 158 + { 159 + lockdep_set_subclass(&ptp->clock.rwsem, PTP_LOCK_VIRTUAL); 160 + } 161 + 157 162 static const struct ptp_clock_info ptp_vclock_info = { 158 163 .owner = THIS_MODULE, 159 164 .name = "ptp virtual clock", ··· 217 212 kfree(vclock); 218 213 return NULL; 219 214 } 215 + 216 + ptp_vclock_set_subclass(vclock->clock); 220 217 221 218 timecounter_init(&vclock->tc, &vclock->cc, 0); 222 219 ptp_schedule_worker(vclock->clock, PTP_VCLOCK_REFRESH_INTERVAL);
-1
drivers/scsi/lpfc/lpfc_debugfs.c
··· 6280 6280 } 6281 6281 phba->nvmeio_trc_on = 1; 6282 6282 phba->nvmeio_trc_output_idx = 0; 6283 - phba->nvmeio_trc = NULL; 6284 6283 } else { 6285 6284 nvmeio_off: 6286 6285 phba->nvmeio_trc_size = 0;
+1 -1
drivers/scsi/lpfc/lpfc_vport.c
··· 666 666 * Take early refcount for outstanding I/O requests we schedule during 667 667 * delete processing for unreg_vpi. Always keep this before 668 668 * scsi_remove_host() as we can no longer obtain a reference through 669 - * scsi_host_get() after scsi_host_remove as shost is set to SHOST_DEL. 669 + * scsi_host_get() after scsi_remove_host as shost is set to SHOST_DEL. 670 670 */ 671 671 if (!scsi_host_get(shost)) 672 672 return VPORT_INVAL;
+57 -34
drivers/scsi/scsi_debug.c
··· 2674 2674 2675 2675 static int resp_err_recov_pg(unsigned char *p, int pcontrol, int target) 2676 2676 { /* Read-Write Error Recovery page for mode_sense */ 2677 - unsigned char err_recov_pg[] = {0x1, 0xa, 0xc0, 11, 240, 0, 0, 0, 2678 - 5, 0, 0xff, 0xff}; 2677 + static const unsigned char err_recov_pg[] = { 2678 + 0x1, 0xa, 0xc0, 11, 240, 0, 0, 0, 2679 + 5, 0, 0xff, 0xff 2680 + }; 2679 2681 2680 2682 memcpy(p, err_recov_pg, sizeof(err_recov_pg)); 2681 2683 if (1 == pcontrol) ··· 2687 2685 2688 2686 static int resp_disconnect_pg(unsigned char *p, int pcontrol, int target) 2689 2687 { /* Disconnect-Reconnect page for mode_sense */ 2690 - unsigned char disconnect_pg[] = {0x2, 0xe, 128, 128, 0, 10, 0, 0, 2691 - 0, 0, 0, 0, 0, 0, 0, 0}; 2688 + static const unsigned char disconnect_pg[] = { 2689 + 0x2, 0xe, 128, 128, 0, 10, 0, 0, 2690 + 0, 0, 0, 0, 0, 0, 0, 0 2691 + }; 2692 2692 2693 2693 memcpy(p, disconnect_pg, sizeof(disconnect_pg)); 2694 2694 if (1 == pcontrol) ··· 2700 2696 2701 2697 static int resp_format_pg(unsigned char *p, int pcontrol, int target) 2702 2698 { /* Format device page for mode_sense */ 2703 - unsigned char format_pg[] = {0x3, 0x16, 0, 0, 0, 0, 0, 0, 2704 - 0, 0, 0, 0, 0, 0, 0, 0, 2705 - 0, 0, 0, 0, 0x40, 0, 0, 0}; 2699 + static const unsigned char format_pg[] = { 2700 + 0x3, 0x16, 0, 0, 0, 0, 0, 0, 2701 + 0, 0, 0, 0, 0, 0, 0, 0, 2702 + 0, 0, 0, 0, 0x40, 0, 0, 0 2703 + }; 2706 2704 2707 2705 memcpy(p, format_pg, sizeof(format_pg)); 2708 2706 put_unaligned_be16(sdebug_sectors_per, p + 10); ··· 2722 2716 2723 2717 static int resp_caching_pg(unsigned char *p, int pcontrol, int target) 2724 2718 { /* Caching page for mode_sense */ 2725 - unsigned char ch_caching_pg[] = {/* 0x8, 18, */ 0x4, 0, 0, 0, 0, 0, 2726 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 2727 - unsigned char d_caching_pg[] = {0x8, 18, 0x14, 0, 0xff, 0xff, 0, 0, 2728 - 0xff, 0xff, 0xff, 0xff, 0x80, 0x14, 0, 0, 0, 0, 0, 0}; 2719 + static const unsigned char ch_caching_pg[] = { 2720 + /* 0x8, 18, */ 0x4, 0, 0, 0, 0, 0, 2721 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 2722 + }; 2723 + static const unsigned char d_caching_pg[] = { 2724 + 0x8, 18, 0x14, 0, 0xff, 0xff, 0, 0, 2725 + 0xff, 0xff, 0xff, 0xff, 0x80, 0x14, 0, 0, 0, 0, 0, 0 2726 + }; 2729 2727 2730 2728 if (SDEBUG_OPT_N_WCE & sdebug_opts) 2731 2729 caching_pg[2] &= ~0x4; /* set WCE=0 (default WCE=1) */ ··· 2748 2738 { /* Control mode page for mode_sense */ 2749 2739 unsigned char ch_ctrl_m_pg[] = {/* 0xa, 10, */ 0x6, 0, 0, 0, 0, 0, 2750 2740 0, 0, 0, 0}; 2751 - unsigned char d_ctrl_m_pg[] = {0xa, 10, 2, 0, 0, 0, 0, 0, 2752 - 0, 0, 0x2, 0x4b}; 2741 + static const unsigned char d_ctrl_m_pg[] = { 2742 + 0xa, 10, 2, 0, 0, 0, 0, 0, 2743 + 0, 0, 0x2, 0x4b 2744 + }; 2753 2745 2754 2746 if (sdebug_dsense) 2755 2747 ctrl_m_pg[2] |= 0x4; ··· 2806 2794 2807 2795 static int resp_iec_m_pg(unsigned char *p, int pcontrol, int target) 2808 2796 { /* Informational Exceptions control mode page for mode_sense */ 2809 - unsigned char ch_iec_m_pg[] = {/* 0x1c, 0xa, */ 0x4, 0xf, 0, 0, 0, 0, 2810 - 0, 0, 0x0, 0x0}; 2811 - unsigned char d_iec_m_pg[] = {0x1c, 0xa, 0x08, 0, 0, 0, 0, 0, 2812 - 0, 0, 0x0, 0x0}; 2797 + static const unsigned char ch_iec_m_pg[] = { 2798 + /* 0x1c, 0xa, */ 0x4, 0xf, 0, 0, 0, 0, 2799 + 0, 0, 0x0, 0x0 2800 + }; 2801 + static const unsigned char d_iec_m_pg[] = { 2802 + 0x1c, 0xa, 0x08, 0, 0, 0, 0, 0, 2803 + 0, 0, 0x0, 0x0 2804 + }; 2813 2805 2814 2806 memcpy(p, iec_m_pg, sizeof(iec_m_pg)); 2815 2807 if (1 == pcontrol) ··· 2825 2809 2826 2810 static int resp_sas_sf_m_pg(unsigned char *p, int pcontrol, int target) 2827 2811 { /* SAS SSP mode page - short format for mode_sense */ 2828 - unsigned char sas_sf_m_pg[] = {0x19, 0x6, 2829 - 0x6, 0x0, 0x7, 0xd0, 0x0, 0x0}; 2812 + static const unsigned char sas_sf_m_pg[] = { 2813 + 0x19, 0x6, 0x6, 0x0, 0x7, 0xd0, 0x0, 0x0 2814 + }; 2830 2815 2831 2816 memcpy(p, sas_sf_m_pg, sizeof(sas_sf_m_pg)); 2832 2817 if (1 == pcontrol) ··· 2871 2854 2872 2855 static int resp_sas_sha_m_spg(unsigned char *p, int pcontrol) 2873 2856 { /* SAS SSP shared protocol specific port mode subpage */ 2874 - unsigned char sas_sha_m_pg[] = {0x59, 0x2, 0, 0xc, 0, 0x6, 0x10, 0, 2875 - 0, 0, 0, 0, 0, 0, 0, 0, 2876 - }; 2857 + static const unsigned char sas_sha_m_pg[] = { 2858 + 0x59, 0x2, 0, 0xc, 0, 0x6, 0x10, 0, 2859 + 0, 0, 0, 0, 0, 0, 0, 0, 2860 + }; 2877 2861 2878 2862 memcpy(p, sas_sha_m_pg, sizeof(sas_sha_m_pg)); 2879 2863 if (1 == pcontrol) ··· 2941 2923 static int resp_compression_m_pg(unsigned char *p, int pcontrol, int target, 2942 2924 unsigned char dce) 2943 2925 { /* Compression page for mode_sense (tape) */ 2944 - unsigned char compression_pg[] = {0x0f, 14, 0x40, 0, 0, 0, 0, 0, 2945 - 0, 0, 0, 0, 00, 00}; 2926 + static const unsigned char compression_pg[] = { 2927 + 0x0f, 14, 0x40, 0, 0, 0, 0, 0, 2928 + 0, 0, 0, 0, 0, 0 2929 + }; 2946 2930 2947 2931 memcpy(p, compression_pg, sizeof(compression_pg)); 2948 2932 if (dce) ··· 3302 3282 3303 3283 static int resp_temp_l_pg(unsigned char *arr) 3304 3284 { 3305 - unsigned char temp_l_pg[] = {0x0, 0x0, 0x3, 0x2, 0x0, 38, 3306 - 0x0, 0x1, 0x3, 0x2, 0x0, 65, 3307 - }; 3285 + static const unsigned char temp_l_pg[] = { 3286 + 0x0, 0x0, 0x3, 0x2, 0x0, 38, 3287 + 0x0, 0x1, 0x3, 0x2, 0x0, 65, 3288 + }; 3308 3289 3309 3290 memcpy(arr, temp_l_pg, sizeof(temp_l_pg)); 3310 3291 return sizeof(temp_l_pg); ··· 3313 3292 3314 3293 static int resp_ie_l_pg(unsigned char *arr) 3315 3294 { 3316 - unsigned char ie_l_pg[] = {0x0, 0x0, 0x3, 0x3, 0x0, 0x0, 38, 3317 - }; 3295 + static const unsigned char ie_l_pg[] = { 3296 + 0x0, 0x0, 0x3, 0x3, 0x0, 0x0, 38, 3297 + }; 3318 3298 3319 3299 memcpy(arr, ie_l_pg, sizeof(ie_l_pg)); 3320 3300 if (iec_m_pg[2] & 0x4) { /* TEST bit set */ ··· 3327 3305 3328 3306 static int resp_env_rep_l_spg(unsigned char *arr) 3329 3307 { 3330 - unsigned char env_rep_l_spg[] = {0x0, 0x0, 0x23, 0x8, 3331 - 0x0, 40, 72, 0xff, 45, 18, 0, 0, 3332 - 0x1, 0x0, 0x23, 0x8, 3333 - 0x0, 55, 72, 35, 55, 45, 0, 0, 3334 - }; 3308 + static const unsigned char env_rep_l_spg[] = { 3309 + 0x0, 0x0, 0x23, 0x8, 3310 + 0x0, 40, 72, 0xff, 45, 18, 0, 0, 3311 + 0x1, 0x0, 0x23, 0x8, 3312 + 0x0, 55, 72, 35, 55, 45, 0, 0, 3313 + }; 3335 3314 3336 3315 memcpy(arr, env_rep_l_spg, sizeof(env_rep_l_spg)); 3337 3316 return sizeof(env_rep_l_spg);
+2 -2
drivers/scsi/scsi_sysfs.c
··· 265 265 return show_shost_mode(supported_mode, buf); 266 266 } 267 267 268 - static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); 268 + static DEVICE_ATTR(supported_mode, S_IRUGO, show_shost_supported_mode, NULL); 269 269 270 270 static ssize_t 271 271 show_shost_active_mode(struct device *dev, ··· 279 279 return show_shost_mode(shost->active_mode, buf); 280 280 } 281 281 282 - static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); 282 + static DEVICE_ATTR(active_mode, S_IRUGO, show_shost_active_mode, NULL); 283 283 284 284 static int check_reset_type(const char *str) 285 285 {
+29 -22
drivers/soc/tegra/pmc.c
··· 1232 1232 } 1233 1233 1234 1234 static int tegra_powergate_of_get_resets(struct tegra_powergate *pg, 1235 - struct device_node *np, bool off) 1235 + struct device_node *np) 1236 1236 { 1237 1237 struct device *dev = pg->pmc->dev; 1238 1238 int err; ··· 1247 1247 err = reset_control_acquire(pg->reset); 1248 1248 if (err < 0) { 1249 1249 pr_err("failed to acquire resets: %d\n", err); 1250 - goto out; 1251 - } 1252 - 1253 - if (off) { 1254 - err = reset_control_assert(pg->reset); 1255 - } else { 1256 - err = reset_control_deassert(pg->reset); 1257 - if (err < 0) 1258 - goto out; 1259 - 1260 - reset_control_release(pg->reset); 1261 - } 1262 - 1263 - out: 1264 - if (err) { 1265 - reset_control_release(pg->reset); 1266 1250 reset_control_put(pg->reset); 1267 1251 } 1268 1252 ··· 1292 1308 goto set_available; 1293 1309 } 1294 1310 1295 - err = tegra_powergate_of_get_resets(pg, np, off); 1311 + err = tegra_powergate_of_get_resets(pg, np); 1296 1312 if (err < 0) { 1297 1313 dev_err(dev, "failed to get resets for %pOFn: %d\n", np, err); 1298 1314 goto remove_clks; 1299 1315 } 1300 1316 1301 - if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) { 1302 - if (off) 1303 - WARN_ON(tegra_powergate_power_up(pg, true)); 1317 + /* 1318 + * If the power-domain is off, then ensure the resets are asserted. 1319 + * If the power-domain is on, then power down to ensure that when is 1320 + * it turned on the power-domain, clocks and resets are all in the 1321 + * expected state. 1322 + */ 1323 + if (off) { 1324 + err = reset_control_assert(pg->reset); 1325 + if (err) { 1326 + pr_err("failed to assert resets: %d\n", err); 1327 + goto remove_resets; 1328 + } 1329 + } else { 1330 + err = tegra_powergate_power_down(pg); 1331 + if (err) { 1332 + dev_err(dev, "failed to turn off PM domain %s: %d\n", 1333 + pg->genpd.name, err); 1334 + goto remove_resets; 1335 + } 1336 + } 1304 1337 1338 + /* 1339 + * If PM_GENERIC_DOMAINS is not enabled, power-on 1340 + * the domain and skip the genpd registration. 1341 + */ 1342 + if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) { 1343 + WARN_ON(tegra_powergate_power_up(pg, true)); 1305 1344 goto remove_resets; 1306 1345 } 1307 1346 1308 - err = pm_genpd_init(&pg->genpd, NULL, off); 1347 + err = pm_genpd_init(&pg->genpd, NULL, true); 1309 1348 if (err < 0) { 1310 1349 dev_err(dev, "failed to initialise PM domain %pOFn: %d\n", np, 1311 1350 err);
+8 -4
drivers/ufs/core/ufshcd.c
··· 7138 7138 static irqreturn_t ufshcd_intr(int irq, void *__hba) 7139 7139 { 7140 7140 struct ufs_hba *hba = __hba; 7141 + u32 intr_status, enabled_intr_status; 7141 7142 7142 7143 /* Move interrupt handling to thread when MCQ & ESI are not enabled */ 7143 7144 if (!hba->mcq_enabled || !hba->mcq_esi_enabled) 7144 7145 return IRQ_WAKE_THREAD; 7145 7146 7147 + intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); 7148 + enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); 7149 + 7150 + ufshcd_writel(hba, intr_status, REG_INTERRUPT_STATUS); 7151 + 7146 7152 /* Directly handle interrupts since MCQ ESI handlers does the hard job */ 7147 - return ufshcd_sl_intr(hba, ufshcd_readl(hba, REG_INTERRUPT_STATUS) & 7148 - ufshcd_readl(hba, REG_INTERRUPT_ENABLE)); 7153 + return ufshcd_sl_intr(hba, enabled_intr_status); 7149 7154 } 7150 7155 7151 7156 static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag) ··· 10521 10516 err = devm_add_action_or_reset(dev, ufshcd_devres_release, 10522 10517 host); 10523 10518 if (err) 10524 - return dev_err_probe(dev, err, 10525 - "failed to add ufshcd dealloc action\n"); 10519 + return err; 10526 10520 10527 10521 host->nr_maps = HCTX_TYPE_POLL + 1; 10528 10522 hba = shost_priv(host);
+1 -1
drivers/ufs/host/ufs-mediatek.c
··· 818 818 unsigned int q_index; 819 819 820 820 q_index = map->mq_map[cpu]; 821 - if (q_index > nr) { 821 + if (q_index >= nr) { 822 822 dev_err(hba->dev, "hwq index %d exceed %d\n", 823 823 q_index, nr); 824 824 return MTK_MCQ_INVALID_IRQ;
+12 -15
drivers/virt/coco/sev-guest/sev-guest.c
··· 116 116 117 117 static int get_derived_key(struct snp_guest_dev *snp_dev, struct snp_guest_request_ioctl *arg) 118 118 { 119 + struct snp_derived_key_resp *derived_key_resp __free(kfree) = NULL; 119 120 struct snp_derived_key_req *derived_key_req __free(kfree) = NULL; 120 - struct snp_derived_key_resp derived_key_resp = {0}; 121 121 struct snp_msg_desc *mdesc = snp_dev->msg_desc; 122 122 struct snp_guest_req req = {}; 123 123 int rc, resp_len; 124 - /* Response data is 64 bytes and max authsize for GCM is 16 bytes. */ 125 - u8 buf[64 + 16]; 126 124 127 125 if (!arg->req_data || !arg->resp_data) 128 126 return -EINVAL; ··· 130 132 * response payload. Make sure that it has enough space to cover the 131 133 * authtag. 132 134 */ 133 - resp_len = sizeof(derived_key_resp.data) + mdesc->ctx->authsize; 134 - if (sizeof(buf) < resp_len) 135 + resp_len = sizeof(derived_key_resp->data) + mdesc->ctx->authsize; 136 + derived_key_resp = kzalloc(resp_len, GFP_KERNEL_ACCOUNT); 137 + if (!derived_key_resp) 135 138 return -ENOMEM; 136 139 137 140 derived_key_req = kzalloc(sizeof(*derived_key_req), GFP_KERNEL_ACCOUNT); ··· 148 149 req.vmpck_id = mdesc->vmpck_id; 149 150 req.req_buf = derived_key_req; 150 151 req.req_sz = sizeof(*derived_key_req); 151 - req.resp_buf = buf; 152 + req.resp_buf = derived_key_resp; 152 153 req.resp_sz = resp_len; 153 154 req.exit_code = SVM_VMGEXIT_GUEST_REQUEST; 154 155 155 156 rc = snp_send_guest_request(mdesc, &req); 156 157 arg->exitinfo2 = req.exitinfo2; 157 - if (rc) 158 - return rc; 159 - 160 - memcpy(derived_key_resp.data, buf, sizeof(derived_key_resp.data)); 161 - if (copy_to_user((void __user *)arg->resp_data, &derived_key_resp, 162 - sizeof(derived_key_resp))) 163 - rc = -EFAULT; 158 + if (!rc) { 159 + if (copy_to_user((void __user *)arg->resp_data, derived_key_resp, 160 + sizeof(derived_key_resp->data))) 161 + rc = -EFAULT; 162 + } 164 163 165 164 /* The response buffer contains the sensitive data, explicitly clear it. */ 166 - memzero_explicit(buf, sizeof(buf)); 167 - memzero_explicit(&derived_key_resp, sizeof(derived_key_resp)); 165 + memzero_explicit(derived_key_resp, sizeof(*derived_key_resp)); 166 + 168 167 return rc; 169 168 } 170 169
+6 -5
fs/btrfs/extent_io.c
··· 4331 4331 unsigned long end = index + (PAGE_SIZE >> fs_info->nodesize_bits) - 1; 4332 4332 int ret; 4333 4333 4334 - xa_lock_irq(&fs_info->buffer_tree); 4334 + rcu_read_lock(); 4335 4335 xa_for_each_range(&fs_info->buffer_tree, index, eb, start, end) { 4336 4336 /* 4337 4337 * The same as try_release_extent_buffer(), to ensure the eb 4338 4338 * won't disappear out from under us. 4339 4339 */ 4340 4340 spin_lock(&eb->refs_lock); 4341 + rcu_read_unlock(); 4342 + 4341 4343 if (refcount_read(&eb->refs) != 1 || extent_buffer_under_io(eb)) { 4342 4344 spin_unlock(&eb->refs_lock); 4345 + rcu_read_lock(); 4343 4346 continue; 4344 4347 } 4345 4348 ··· 4361 4358 * check the folio private at the end. And 4362 4359 * release_extent_buffer() will release the refs_lock. 4363 4360 */ 4364 - xa_unlock_irq(&fs_info->buffer_tree); 4365 4361 release_extent_buffer(eb); 4366 - xa_lock_irq(&fs_info->buffer_tree); 4362 + rcu_read_lock(); 4367 4363 } 4368 - xa_unlock_irq(&fs_info->buffer_tree); 4364 + rcu_read_unlock(); 4369 4365 4370 4366 /* 4371 4367 * Finally to check if we have cleared folio private, as if we have ··· 4377 4375 ret = 0; 4378 4376 spin_unlock(&folio->mapping->i_private_lock); 4379 4377 return ret; 4380 - 4381 4378 } 4382 4379 4383 4380 int try_release_extent_buffer(struct folio *folio)
+5 -3
fs/btrfs/inode.c
··· 401 401 402 402 while (index <= end_index) { 403 403 folio = filemap_get_folio(inode->vfs_inode.i_mapping, index); 404 - index++; 405 - if (IS_ERR(folio)) 404 + if (IS_ERR(folio)) { 405 + index++; 406 406 continue; 407 + } 407 408 409 + index = folio_end(folio) >> PAGE_SHIFT; 408 410 /* 409 411 * Here we just clear all Ordered bits for every page in the 410 412 * range, then btrfs_mark_ordered_io_finished() will handle ··· 2015 2013 * cleaered by the caller. 2016 2014 */ 2017 2015 if (ret < 0) 2018 - btrfs_cleanup_ordered_extents(inode, file_pos, end); 2016 + btrfs_cleanup_ordered_extents(inode, file_pos, len); 2019 2017 return ret; 2020 2018 } 2021 2019
+1 -2
fs/btrfs/qgroup.c
··· 1453 1453 struct btrfs_qgroup *src, int sign) 1454 1454 { 1455 1455 struct btrfs_qgroup *qgroup; 1456 - struct btrfs_qgroup *cur; 1457 1456 LIST_HEAD(qgroup_list); 1458 1457 u64 num_bytes = src->excl; 1459 1458 int ret = 0; ··· 1462 1463 goto out; 1463 1464 1464 1465 qgroup_iterator_add(&qgroup_list, qgroup); 1465 - list_for_each_entry(cur, &qgroup_list, iterator) { 1466 + list_for_each_entry(qgroup, &qgroup_list, iterator) { 1466 1467 struct btrfs_qgroup_list *glist; 1467 1468 1468 1469 qgroup->rfer += sign * num_bytes;
+19
fs/btrfs/relocation.c
··· 602 602 if (btrfs_root_id(root) == objectid) { 603 603 u64 commit_root_gen; 604 604 605 + /* 606 + * Relocation will wait for cleaner thread, and any half-dropped 607 + * subvolume will be fully cleaned up at mount time. 608 + * So here we shouldn't hit a subvolume with non-zero drop_progress. 609 + * 610 + * If this isn't the case, error out since it can make us attempt to 611 + * drop references for extents that were already dropped before. 612 + */ 613 + if (unlikely(btrfs_disk_key_objectid(&root->root_item.drop_progress))) { 614 + struct btrfs_key cpu_key; 615 + 616 + btrfs_disk_key_to_cpu(&cpu_key, &root->root_item.drop_progress); 617 + btrfs_err(fs_info, 618 + "cannot relocate partially dropped subvolume %llu, drop progress key (%llu %u %llu)", 619 + objectid, cpu_key.objectid, cpu_key.type, cpu_key.offset); 620 + ret = -EUCLEAN; 621 + goto fail; 622 + } 623 + 605 624 /* called by btrfs_init_reloc_root */ 606 625 ret = btrfs_copy_root(trans, root, root->commit_root, &eb, 607 626 BTRFS_TREE_RELOC_OBJECTID);
+7 -12
fs/btrfs/tree-log.c
··· 2605 2605 /* 2606 2606 * Correctly adjust the reserved bytes occupied by a log tree extent buffer 2607 2607 */ 2608 - static void unaccount_log_buffer(struct btrfs_fs_info *fs_info, u64 start) 2608 + static int unaccount_log_buffer(struct btrfs_fs_info *fs_info, u64 start) 2609 2609 { 2610 2610 struct btrfs_block_group *cache; 2611 2611 2612 2612 cache = btrfs_lookup_block_group(fs_info, start); 2613 2613 if (!cache) { 2614 2614 btrfs_err(fs_info, "unable to find block group for %llu", start); 2615 - return; 2615 + return -ENOENT; 2616 2616 } 2617 2617 2618 2618 spin_lock(&cache->space_info->lock); ··· 2623 2623 spin_unlock(&cache->space_info->lock); 2624 2624 2625 2625 btrfs_put_block_group(cache); 2626 + 2627 + return 0; 2626 2628 } 2627 2629 2628 2630 static int clean_log_buffer(struct btrfs_trans_handle *trans, 2629 2631 struct extent_buffer *eb) 2630 2632 { 2631 - int ret; 2632 - 2633 2633 btrfs_tree_lock(eb); 2634 2634 btrfs_clear_buffer_dirty(trans, eb); 2635 2635 wait_on_extent_buffer_writeback(eb); 2636 2636 btrfs_tree_unlock(eb); 2637 2637 2638 - if (trans) { 2639 - ret = btrfs_pin_reserved_extent(trans, eb); 2640 - if (ret) 2641 - return ret; 2642 - } else { 2643 - unaccount_log_buffer(eb->fs_info, eb->start); 2644 - } 2638 + if (trans) 2639 + return btrfs_pin_reserved_extent(trans, eb); 2645 2640 2646 - return 0; 2641 + return unaccount_log_buffer(eb->fs_info, eb->start); 2647 2642 } 2648 2643 2649 2644 static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
+1 -1
fs/btrfs/zoned.c
··· 2650 2650 2651 2651 spin_lock(&block_group->lock); 2652 2652 if (block_group->reserved || block_group->alloc_offset == 0 || 2653 - (block_group->flags & BTRFS_BLOCK_GROUP_SYSTEM) || 2653 + !(block_group->flags & BTRFS_BLOCK_GROUP_DATA) || 2654 2654 test_bit(BLOCK_GROUP_FLAG_ZONED_DATA_RELOC, &block_group->runtime_flags)) { 2655 2655 spin_unlock(&block_group->lock); 2656 2656 continue;
+3
fs/dax.c
··· 1743 1743 loff_t done = 0; 1744 1744 int ret; 1745 1745 1746 + if (WARN_ON_ONCE(iocb->ki_flags & IOCB_ATOMIC)) 1747 + return -EIO; 1748 + 1746 1749 if (!iomi.len) 1747 1750 return 0; 1748 1751
+10 -10
fs/erofs/Kconfig
··· 3 3 config EROFS_FS 4 4 tristate "EROFS filesystem support" 5 5 depends on BLOCK 6 + select CACHEFILES if EROFS_FS_ONDEMAND 6 7 select CRC32 8 + select CRYPTO if EROFS_FS_ZIP_ACCEL 9 + select CRYPTO_DEFLATE if EROFS_FS_ZIP_ACCEL 7 10 select FS_IOMAP 11 + select LZ4_DECOMPRESS if EROFS_FS_ZIP 12 + select NETFS_SUPPORT if EROFS_FS_ONDEMAND 13 + select XXHASH if EROFS_FS_XATTR 14 + select XZ_DEC if EROFS_FS_ZIP_LZMA 15 + select XZ_DEC_MICROLZMA if EROFS_FS_ZIP_LZMA 16 + select ZLIB_INFLATE if EROFS_FS_ZIP_DEFLATE 17 + select ZSTD_DECOMPRESS if EROFS_FS_ZIP_ZSTD 8 18 help 9 19 EROFS (Enhanced Read-Only File System) is a lightweight read-only 10 20 file system with modern designs (e.g. no buffer heads, inline ··· 48 38 config EROFS_FS_XATTR 49 39 bool "EROFS extended attributes" 50 40 depends on EROFS_FS 51 - select XXHASH 52 41 default y 53 42 help 54 43 Extended attributes are name:value pairs associated with inodes by ··· 103 94 config EROFS_FS_ZIP 104 95 bool "EROFS Data Compression Support" 105 96 depends on EROFS_FS 106 - select LZ4_DECOMPRESS 107 97 default y 108 98 help 109 99 Enable transparent compression support for EROFS file systems. ··· 112 104 config EROFS_FS_ZIP_LZMA 113 105 bool "EROFS LZMA compressed data support" 114 106 depends on EROFS_FS_ZIP 115 - select XZ_DEC 116 - select XZ_DEC_MICROLZMA 117 107 help 118 108 Saying Y here includes support for reading EROFS file systems 119 109 containing LZMA compressed data, specifically called microLZMA. It ··· 123 117 config EROFS_FS_ZIP_DEFLATE 124 118 bool "EROFS DEFLATE compressed data support" 125 119 depends on EROFS_FS_ZIP 126 - select ZLIB_INFLATE 127 120 help 128 121 Saying Y here includes support for reading EROFS file systems 129 122 containing DEFLATE compressed data. It gives better compression ··· 137 132 config EROFS_FS_ZIP_ZSTD 138 133 bool "EROFS Zstandard compressed data support" 139 134 depends on EROFS_FS_ZIP 140 - select ZSTD_DECOMPRESS 141 135 help 142 136 Saying Y here includes support for reading EROFS file systems 143 137 containing Zstandard compressed data. It gives better compression ··· 151 147 config EROFS_FS_ZIP_ACCEL 152 148 bool "EROFS hardware decompression support" 153 149 depends on EROFS_FS_ZIP 154 - select CRYPTO 155 - select CRYPTO_DEFLATE 156 150 help 157 151 Saying Y here includes hardware accelerator support for reading 158 152 EROFS file systems containing compressed data. It gives better ··· 165 163 config EROFS_FS_ONDEMAND 166 164 bool "EROFS fscache-based on-demand read support (deprecated)" 167 165 depends on EROFS_FS 168 - select NETFS_SUPPORT 169 166 select FSCACHE 170 - select CACHEFILES 171 167 select CACHEFILES_ONDEMAND 172 168 help 173 169 This permits EROFS to use fscache-backed data blobs with on-demand
+16 -12
fs/erofs/super.c
··· 174 174 if (!erofs_is_fileio_mode(sbi)) { 175 175 dif->dax_dev = fs_dax_get_by_bdev(file_bdev(file), 176 176 &dif->dax_part_off, NULL, NULL); 177 + if (!dif->dax_dev && test_opt(&sbi->opt, DAX_ALWAYS)) { 178 + erofs_info(sb, "DAX unsupported by %s. Turning off DAX.", 179 + dif->path); 180 + clear_opt(&sbi->opt, DAX_ALWAYS); 181 + } 177 182 } else if (!S_ISREG(file_inode(file)->i_mode)) { 178 183 fput(file); 179 184 return -EINVAL; ··· 215 210 ondisk_extradevs, sbi->devs->extra_devices); 216 211 return -EINVAL; 217 212 } 218 - if (!ondisk_extradevs) 213 + if (!ondisk_extradevs) { 214 + if (test_opt(&sbi->opt, DAX_ALWAYS) && !sbi->dif0.dax_dev) { 215 + erofs_info(sb, "DAX unsupported by block device. Turning off DAX."); 216 + clear_opt(&sbi->opt, DAX_ALWAYS); 217 + } 219 218 return 0; 219 + } 220 220 221 221 if (!sbi->devs->extra_devices && !erofs_is_fscache_mode(sb)) 222 222 sbi->devs->flatdev = true; ··· 323 313 sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact)); 324 314 if (erofs_sb_has_48bit(sbi) && dsb->rootnid_8b) { 325 315 sbi->root_nid = le64_to_cpu(dsb->rootnid_8b); 326 - sbi->dif0.blocks = (sbi->dif0.blocks << 32) | 327 - le16_to_cpu(dsb->rb.blocks_hi); 316 + sbi->dif0.blocks = sbi->dif0.blocks | 317 + ((u64)le16_to_cpu(dsb->rb.blocks_hi) << 32); 328 318 } else { 329 319 sbi->root_nid = le16_to_cpu(dsb->rb.rootnid_2b); 330 320 } ··· 348 338 if (ret < 0) 349 339 goto out; 350 340 351 - /* handle multiple devices */ 352 341 ret = erofs_scan_devices(sb, dsb); 353 342 354 343 if (erofs_sb_has_48bit(sbi)) ··· 680 671 return invalfc(fc, "cannot use fsoffset in fscache mode"); 681 672 } 682 673 683 - if (test_opt(&sbi->opt, DAX_ALWAYS)) { 684 - if (!sbi->dif0.dax_dev) { 685 - errorfc(fc, "DAX unsupported by block device. Turning off DAX."); 686 - clear_opt(&sbi->opt, DAX_ALWAYS); 687 - } else if (sbi->blkszbits != PAGE_SHIFT) { 688 - errorfc(fc, "unsupported blocksize for DAX"); 689 - clear_opt(&sbi->opt, DAX_ALWAYS); 690 - } 674 + if (test_opt(&sbi->opt, DAX_ALWAYS) && sbi->blkszbits != PAGE_SHIFT) { 675 + erofs_info(sb, "unsupported blocksize for DAX"); 676 + clear_opt(&sbi->opt, DAX_ALWAYS); 691 677 } 692 678 693 679 sb->s_time_gran = 1;
+11 -2
fs/erofs/zdata.c
··· 1432 1432 } 1433 1433 #endif 1434 1434 1435 + /* Use (kthread_)work in atomic contexts to minimize scheduling overhead */ 1436 + static inline bool z_erofs_in_atomic(void) 1437 + { 1438 + if (IS_ENABLED(CONFIG_PREEMPTION) && rcu_preempt_depth()) 1439 + return true; 1440 + if (!IS_ENABLED(CONFIG_PREEMPT_COUNT)) 1441 + return true; 1442 + return !preemptible(); 1443 + } 1444 + 1435 1445 static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, 1436 1446 int bios) 1437 1447 { ··· 1456 1446 1457 1447 if (atomic_add_return(bios, &io->pending_bios)) 1458 1448 return; 1459 - /* Use (kthread_)work and sync decompression for atomic contexts only */ 1460 - if (!in_task() || irqs_disabled() || rcu_read_lock_any_held()) { 1449 + if (z_erofs_in_atomic()) { 1461 1450 #ifdef CONFIG_EROFS_FS_PCPU_KTHREAD 1462 1451 struct kthread_worker *worker; 1463 1452
+3 -2
fs/nfsd/localio.c
··· 103 103 if (nfsd_file_get(new) == NULL) 104 104 goto again; 105 105 /* 106 - * Drop the ref we were going to install and the 107 - * one we were going to return. 106 + * Drop the ref we were going to install (both file and 107 + * net) and the one we were going to return (only file). 108 108 */ 109 109 nfsd_file_put(localio); 110 + nfsd_net_put(net); 110 111 nfsd_file_put(localio); 111 112 localio = new; 112 113 }
+9 -1
fs/nfsd/vfs.c
··· 470 470 if (!iap->ia_valid) 471 471 return 0; 472 472 473 - iap->ia_valid |= ATTR_CTIME; 473 + /* 474 + * If ATTR_DELEG is set, then this is an update from a client that 475 + * holds a delegation. If this is an update for only the atime, the 476 + * ctime should not be changed. If the update contains the mtime 477 + * too, then ATTR_CTIME should already be set. 478 + */ 479 + if (!(iap->ia_valid & ATTR_DELEG)) 480 + iap->ia_valid |= ATTR_CTIME; 481 + 474 482 return notify_change(&nop_mnt_idmap, dentry, iap, NULL); 475 483 } 476 484
+18 -6
fs/proc/task_mmu.c
··· 340 340 341 341 priv->inode = inode; 342 342 priv->mm = proc_mem_open(inode, PTRACE_MODE_READ); 343 - if (IS_ERR_OR_NULL(priv->mm)) { 344 - int err = priv->mm ? PTR_ERR(priv->mm) : -ESRCH; 343 + if (IS_ERR(priv->mm)) { 344 + int err = PTR_ERR(priv->mm); 345 345 346 346 seq_release_private(inode, file); 347 347 return err; ··· 1148 1148 { 1149 1149 struct mem_size_stats *mss = walk->private; 1150 1150 struct vm_area_struct *vma = walk->vma; 1151 - pte_t ptent = huge_ptep_get(walk->mm, addr, pte); 1152 1151 struct folio *folio = NULL; 1153 1152 bool present = false; 1153 + spinlock_t *ptl; 1154 + pte_t ptent; 1154 1155 1156 + ptl = huge_pte_lock(hstate_vma(vma), walk->mm, pte); 1157 + ptent = huge_ptep_get(walk->mm, addr, pte); 1155 1158 if (pte_present(ptent)) { 1156 1159 folio = page_folio(pte_page(ptent)); 1157 1160 present = true; ··· 1173 1170 else 1174 1171 mss->private_hugetlb += huge_page_size(hstate_vma(vma)); 1175 1172 } 1173 + spin_unlock(ptl); 1176 1174 return 0; 1177 1175 } 1178 1176 #else ··· 2021 2017 struct pagemapread *pm = walk->private; 2022 2018 struct vm_area_struct *vma = walk->vma; 2023 2019 u64 flags = 0, frame = 0; 2020 + spinlock_t *ptl; 2024 2021 int err = 0; 2025 2022 pte_t pte; 2026 2023 2027 2024 if (vma->vm_flags & VM_SOFTDIRTY) 2028 2025 flags |= PM_SOFT_DIRTY; 2029 2026 2027 + ptl = huge_pte_lock(hstate_vma(vma), walk->mm, ptep); 2030 2028 pte = huge_ptep_get(walk->mm, addr, ptep); 2031 2029 if (pte_present(pte)) { 2032 2030 struct folio *folio = page_folio(pte_page(pte)); ··· 2056 2050 2057 2051 err = add_to_pagemap(&pme, pm); 2058 2052 if (err) 2059 - return err; 2053 + break; 2060 2054 if (pm->show_pfn && (flags & PM_PRESENT)) 2061 2055 frame++; 2062 2056 } 2063 2057 2058 + spin_unlock(ptl); 2064 2059 cond_resched(); 2065 2060 2066 2061 return err; ··· 3135 3128 static int gather_hugetlb_stats(pte_t *pte, unsigned long hmask, 3136 3129 unsigned long addr, unsigned long end, struct mm_walk *walk) 3137 3130 { 3138 - pte_t huge_pte = huge_ptep_get(walk->mm, addr, pte); 3131 + pte_t huge_pte; 3139 3132 struct numa_maps *md; 3140 3133 struct page *page; 3134 + spinlock_t *ptl; 3141 3135 3136 + ptl = huge_pte_lock(hstate_vma(walk->vma), walk->mm, pte); 3137 + huge_pte = huge_ptep_get(walk->mm, addr, pte); 3142 3138 if (!pte_present(huge_pte)) 3143 - return 0; 3139 + goto out; 3144 3140 3145 3141 page = pte_page(huge_pte); 3146 3142 3147 3143 md = walk->private; 3148 3144 gather_stats(page, md, pte_dirty(huge_pte), 1); 3145 + out: 3146 + spin_unlock(ptl); 3149 3147 return 0; 3150 3148 } 3151 3149
+18 -29
fs/smb/client/cifs_spnego.c
··· 124 124 dp = description; 125 125 /* start with version and hostname portion of UNC string */ 126 126 spnego_key = ERR_PTR(-EINVAL); 127 - sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, 128 - hostname); 129 - dp = description + strlen(description); 127 + dp += sprintf(dp, "ver=0x%x;host=%s;", CIFS_SPNEGO_UPCALL_VERSION, 128 + hostname); 130 129 131 130 /* add the server address */ 132 131 if (server->dstaddr.ss_family == AF_INET) 133 - sprintf(dp, "ip4=%pI4", &sa->sin_addr); 132 + dp += sprintf(dp, "ip4=%pI4", &sa->sin_addr); 134 133 else if (server->dstaddr.ss_family == AF_INET6) 135 - sprintf(dp, "ip6=%pI6", &sa6->sin6_addr); 134 + dp += sprintf(dp, "ip6=%pI6", &sa6->sin6_addr); 136 135 else 137 136 goto out; 138 137 139 - dp = description + strlen(description); 140 - 141 138 /* for now, only sec=krb5 and sec=mskrb5 and iakerb are valid */ 142 139 if (server->sec_kerberos) 143 - sprintf(dp, ";sec=krb5"); 140 + dp += sprintf(dp, ";sec=krb5"); 144 141 else if (server->sec_mskerberos) 145 - sprintf(dp, ";sec=mskrb5"); 142 + dp += sprintf(dp, ";sec=mskrb5"); 146 143 else if (server->sec_iakerb) 147 - sprintf(dp, ";sec=iakerb"); 144 + dp += sprintf(dp, ";sec=iakerb"); 148 145 else { 149 146 cifs_dbg(VFS, "unknown or missing server auth type, use krb5\n"); 150 - sprintf(dp, ";sec=krb5"); 147 + dp += sprintf(dp, ";sec=krb5"); 151 148 } 152 149 153 - dp = description + strlen(description); 154 - sprintf(dp, ";uid=0x%x", 155 - from_kuid_munged(&init_user_ns, sesInfo->linux_uid)); 150 + dp += sprintf(dp, ";uid=0x%x", 151 + from_kuid_munged(&init_user_ns, sesInfo->linux_uid)); 156 152 157 - dp = description + strlen(description); 158 - sprintf(dp, ";creduid=0x%x", 153 + dp += sprintf(dp, ";creduid=0x%x", 159 154 from_kuid_munged(&init_user_ns, sesInfo->cred_uid)); 160 155 161 - if (sesInfo->user_name) { 162 - dp = description + strlen(description); 163 - sprintf(dp, ";user=%s", sesInfo->user_name); 164 - } 156 + if (sesInfo->user_name) 157 + dp += sprintf(dp, ";user=%s", sesInfo->user_name); 165 158 166 - dp = description + strlen(description); 167 - sprintf(dp, ";pid=0x%x", current->pid); 159 + dp += sprintf(dp, ";pid=0x%x", current->pid); 168 160 169 - if (sesInfo->upcall_target == UPTARGET_MOUNT) { 170 - dp = description + strlen(description); 171 - sprintf(dp, ";upcall_target=mount"); 172 - } else { 173 - dp = description + strlen(description); 174 - sprintf(dp, ";upcall_target=app"); 175 - } 161 + if (sesInfo->upcall_target == UPTARGET_MOUNT) 162 + dp += sprintf(dp, ";upcall_target=mount"); 163 + else 164 + dp += sprintf(dp, ";upcall_target=app"); 176 165 177 166 cifs_dbg(FYI, "key description = %s\n", description); 178 167 saved_cred = override_creds(spnego_cred);
+2 -2
fs/smb/client/cifsfs.h
··· 145 145 #endif /* CONFIG_CIFS_NFSD_EXPORT */ 146 146 147 147 /* when changing internal version - update following two lines at same time */ 148 - #define SMB3_PRODUCT_BUILD 55 149 - #define CIFS_VERSION "2.55" 148 + #define SMB3_PRODUCT_BUILD 56 149 + #define CIFS_VERSION "2.56" 150 150 #endif /* _CIFSFS_H */
+21
fs/smb/client/cifsglob.h
··· 1732 1732 int mid_rc; /* rc for MID_RC */ 1733 1733 __le16 command; /* smb command code */ 1734 1734 unsigned int optype; /* operation type */ 1735 + spinlock_t mid_lock; 1735 1736 bool wait_cancelled:1; /* Cancelled while waiting for response */ 1736 1737 bool deleted_from_q:1; /* Whether Mid has been dequeued frem pending_mid_q */ 1737 1738 bool large_buf:1; /* if valid response, is pointer to large buf */ ··· 2037 2036 * cifsFileInfo->file_info_lock cifsFileInfo->count cifs_new_fileinfo 2038 2037 * ->invalidHandle initiate_cifs_search 2039 2038 * ->oplock_break_cancelled 2039 + * mid_q_entry->mid_lock mid_q_entry->callback alloc_mid 2040 + * smb2_mid_entry_alloc 2041 + * (Any fields of mid_q_entry that will need protection) 2040 2042 ****************************************************************************/ 2041 2043 2042 2044 #ifdef DECLARE_GLOBALS_HERE ··· 2377 2373 } 2378 2374 } 2379 2375 return ret; 2376 + } 2377 + 2378 + /* 2379 + * Execute mid callback atomically - ensures callback runs exactly once 2380 + * and prevents sleeping in atomic context. 2381 + */ 2382 + static inline void mid_execute_callback(struct mid_q_entry *mid) 2383 + { 2384 + void (*callback)(struct mid_q_entry *mid); 2385 + 2386 + spin_lock(&mid->mid_lock); 2387 + callback = mid->callback; 2388 + mid->callback = NULL; /* Mark as executed, */ 2389 + spin_unlock(&mid->mid_lock); 2390 + 2391 + if (callback) 2392 + callback(mid); 2380 2393 } 2381 2394 2382 2395 #define CIFS_REPARSE_SUPPORT(tcon) \
+9 -10
fs/smb/client/cifstransport.c
··· 46 46 temp = mempool_alloc(cifs_mid_poolp, GFP_NOFS); 47 47 memset(temp, 0, sizeof(struct mid_q_entry)); 48 48 kref_init(&temp->refcount); 49 + spin_lock_init(&temp->mid_lock); 49 50 temp->mid = get_mid(smb_buffer); 50 51 temp->pid = current->pid; 51 52 temp->command = cpu_to_le16(smb_buffer->Command); ··· 346 345 rc = wait_for_response(server, midQ); 347 346 if (rc != 0) { 348 347 send_cancel(server, &rqst, midQ); 349 - spin_lock(&server->mid_queue_lock); 350 - if (midQ->mid_state == MID_REQUEST_SUBMITTED || 351 - midQ->mid_state == MID_RESPONSE_RECEIVED) { 348 + spin_lock(&midQ->mid_lock); 349 + if (midQ->callback) { 352 350 /* no longer considered to be "in-flight" */ 353 351 midQ->callback = release_mid; 354 - spin_unlock(&server->mid_queue_lock); 352 + spin_unlock(&midQ->mid_lock); 355 353 add_credits(server, &credits, 0); 356 354 return rc; 357 355 } 358 - spin_unlock(&server->mid_queue_lock); 356 + spin_unlock(&midQ->mid_lock); 359 357 } 360 358 361 359 rc = cifs_sync_mid_result(midQ, server); ··· 527 527 rc = wait_for_response(server, midQ); 528 528 if (rc) { 529 529 send_cancel(server, &rqst, midQ); 530 - spin_lock(&server->mid_queue_lock); 531 - if (midQ->mid_state == MID_REQUEST_SUBMITTED || 532 - midQ->mid_state == MID_RESPONSE_RECEIVED) { 530 + spin_lock(&midQ->mid_lock); 531 + if (midQ->callback) { 533 532 /* no longer considered to be "in-flight" */ 534 533 midQ->callback = release_mid; 535 - spin_unlock(&server->mid_queue_lock); 534 + spin_unlock(&midQ->mid_lock); 536 535 return rc; 537 536 } 538 - spin_unlock(&server->mid_queue_lock); 537 + spin_unlock(&midQ->mid_lock); 539 538 } 540 539 541 540 /* We got the response - restart system call. */
+16 -45
fs/smb/client/compress.c
··· 155 155 } 156 156 157 157 /* 158 - * TODO: 159 - * Support other iter types, if required. 160 - * Only ITER_XARRAY is supported for now. 158 + * Collect some 2K samples with 2K gaps between. 161 159 */ 162 - static int collect_sample(const struct iov_iter *iter, ssize_t max, u8 *sample) 160 + static int collect_sample(const struct iov_iter *source, ssize_t max, u8 *sample) 163 161 { 164 - struct folio *folios[16], *folio; 165 - unsigned int nr, i, j, npages; 166 - loff_t start = iter->xarray_start + iter->iov_offset; 167 - pgoff_t last, index = start / PAGE_SIZE; 168 - size_t len, off, foff; 169 - void *p; 170 - int s = 0; 162 + struct iov_iter iter = *source; 163 + size_t s = 0; 171 164 172 - last = (start + max - 1) / PAGE_SIZE; 173 - do { 174 - nr = xa_extract(iter->xarray, (void **)folios, index, last, ARRAY_SIZE(folios), 175 - XA_PRESENT); 176 - if (nr == 0) 177 - return -EIO; 165 + while (iov_iter_count(&iter) >= SZ_2K) { 166 + size_t part = umin(umin(iov_iter_count(&iter), SZ_2K), max); 167 + size_t n; 178 168 179 - for (i = 0; i < nr; i++) { 180 - folio = folios[i]; 181 - npages = folio_nr_pages(folio); 182 - foff = start - folio_pos(folio); 183 - off = foff % PAGE_SIZE; 169 + n = copy_from_iter(sample + s, part, &iter); 170 + if (n != part) 171 + return -EFAULT; 184 172 185 - for (j = foff / PAGE_SIZE; j < npages; j++) { 186 - size_t len2; 173 + s += n; 174 + max -= n; 187 175 188 - len = min_t(size_t, max, PAGE_SIZE - off); 189 - len2 = min_t(size_t, len, SZ_2K); 176 + if (iov_iter_count(&iter) < PAGE_SIZE - SZ_2K) 177 + break; 190 178 191 - p = kmap_local_page(folio_page(folio, j)); 192 - memcpy(&sample[s], p, len2); 193 - kunmap_local(p); 194 - 195 - s += len2; 196 - 197 - if (len2 < SZ_2K || s >= max - SZ_2K) 198 - return s; 199 - 200 - max -= len; 201 - if (max <= 0) 202 - return s; 203 - 204 - start += len; 205 - off = 0; 206 - index++; 207 - } 208 - } 209 - } while (nr == ARRAY_SIZE(folios)); 179 + iov_iter_advance(&iter, SZ_2K); 180 + } 210 181 211 182 return s; 212 183 }
+4 -5
fs/smb/client/connect.c
··· 335 335 cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__); 336 336 list_for_each_entry_safe(mid, nmid, &retry_list, qhead) { 337 337 list_del_init(&mid->qhead); 338 - mid->callback(mid); 338 + mid_execute_callback(mid); 339 339 release_mid(mid); 340 340 } 341 341 ··· 919 919 list_del_init(&mid->qhead); 920 920 mid->mid_rc = mid_rc; 921 921 mid->mid_state = MID_RC; 922 - mid->callback(mid); 922 + mid_execute_callback(mid); 923 923 release_mid(mid); 924 924 } 925 925 ··· 1117 1117 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 1118 1118 cifs_dbg(FYI, "Callback mid %llu\n", mid_entry->mid); 1119 1119 list_del_init(&mid_entry->qhead); 1120 - mid_entry->callback(mid_entry); 1120 + mid_execute_callback(mid_entry); 1121 1121 release_mid(mid_entry); 1122 1122 } 1123 1123 /* 1/8th of sec is more than enough time for them to exit */ ··· 1394 1394 } 1395 1395 1396 1396 if (!mids[i]->multiRsp || mids[i]->multiEnd) 1397 - mids[i]->callback(mids[i]); 1397 + mid_execute_callback(mids[i]); 1398 1398 1399 1399 release_mid(mids[i]); 1400 1400 } else if (server->ops->is_oplock_break && ··· 4205 4205 return 0; 4206 4206 } 4207 4207 4208 - server->lstrp = jiffies; 4209 4208 server->tcpStatus = CifsInNegotiate; 4210 4209 server->neg_start = jiffies; 4211 4210 spin_unlock(&server->srv_lock);
+32 -2
fs/smb/client/inode.c
··· 1943 1943 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 1944 1944 struct tcon_link *tlink; 1945 1945 struct cifs_tcon *tcon; 1946 + __u32 dosattr = 0, origattr = 0; 1946 1947 struct TCP_Server_Info *server; 1947 1948 struct iattr *attrs = NULL; 1948 - __u32 dosattr = 0, origattr = 0; 1949 + bool rehash = false; 1949 1950 1950 1951 cifs_dbg(FYI, "cifs_unlink, dir=0x%p, dentry=0x%p\n", dir, dentry); 1951 1952 1952 1953 if (unlikely(cifs_forced_shutdown(cifs_sb))) 1953 1954 return -EIO; 1955 + 1956 + /* Unhash dentry in advance to prevent any concurrent opens */ 1957 + spin_lock(&dentry->d_lock); 1958 + if (!d_unhashed(dentry)) { 1959 + __d_drop(dentry); 1960 + rehash = true; 1961 + } 1962 + spin_unlock(&dentry->d_lock); 1954 1963 1955 1964 tlink = cifs_sb_tlink(cifs_sb); 1956 1965 if (IS_ERR(tlink)) ··· 2012 2003 cifs_drop_nlink(inode); 2013 2004 } 2014 2005 } else if (rc == -ENOENT) { 2015 - d_drop(dentry); 2006 + if (simple_positive(dentry)) 2007 + d_delete(dentry); 2016 2008 } else if (rc == -EBUSY) { 2017 2009 if (server->ops->rename_pending_delete) { 2018 2010 rc = server->ops->rename_pending_delete(full_path, ··· 2066 2056 kfree(attrs); 2067 2057 free_xid(xid); 2068 2058 cifs_put_tlink(tlink); 2059 + if (rehash) 2060 + d_rehash(dentry); 2069 2061 return rc; 2070 2062 } 2071 2063 ··· 2474 2462 struct cifs_sb_info *cifs_sb; 2475 2463 struct tcon_link *tlink; 2476 2464 struct cifs_tcon *tcon; 2465 + bool rehash = false; 2477 2466 unsigned int xid; 2478 2467 int rc, tmprc; 2479 2468 int retry_count = 0; ··· 2489 2476 cifs_sb = CIFS_SB(source_dir->i_sb); 2490 2477 if (unlikely(cifs_forced_shutdown(cifs_sb))) 2491 2478 return -EIO; 2479 + 2480 + /* 2481 + * Prevent any concurrent opens on the target by unhashing the dentry. 2482 + * VFS already unhashes the target when renaming directories. 2483 + */ 2484 + if (d_is_positive(target_dentry) && !d_is_dir(target_dentry)) { 2485 + if (!d_unhashed(target_dentry)) { 2486 + d_drop(target_dentry); 2487 + rehash = true; 2488 + } 2489 + } 2492 2490 2493 2491 tlink = cifs_sb_tlink(cifs_sb); 2494 2492 if (IS_ERR(tlink)) ··· 2542 2518 } 2543 2519 } 2544 2520 2521 + if (!rc) 2522 + rehash = false; 2545 2523 /* 2546 2524 * No-replace is the natural behavior for CIFS, so skip unlink hacks. 2547 2525 */ ··· 2602 2576 goto cifs_rename_exit; 2603 2577 rc = cifs_do_rename(xid, source_dentry, from_name, 2604 2578 target_dentry, to_name); 2579 + if (!rc) 2580 + rehash = false; 2605 2581 } 2606 2582 2607 2583 /* force revalidate to go get info when needed */ 2608 2584 CIFS_I(source_dir)->time = CIFS_I(target_dir)->time = 0; 2609 2585 2610 2586 cifs_rename_exit: 2587 + if (rehash) 2588 + d_rehash(target_dentry); 2611 2589 kfree(info_buf_source); 2612 2590 free_dentry_path(page2); 2613 2591 free_dentry_path(page1);
+12 -3
fs/smb/client/smb2ops.c
··· 772 772 bytes_left -= sizeof(*p); 773 773 break; 774 774 } 775 + /* Validate that Next doesn't point beyond the buffer */ 776 + if (next > bytes_left) { 777 + cifs_dbg(VFS, "%s: invalid Next pointer %zu > %zd\n", 778 + __func__, next, bytes_left); 779 + rc = -EINVAL; 780 + goto out; 781 + } 775 782 p = (struct network_interface_info_ioctl_rsp *)((u8 *)p+next); 776 783 bytes_left -= next; 777 784 } ··· 790 783 } 791 784 792 785 /* Azure rounds the buffer size up 8, to a 16 byte boundary */ 793 - if ((bytes_left > 8) || p->Next) 786 + if ((bytes_left > 8) || 787 + (bytes_left >= offsetof(struct network_interface_info_ioctl_rsp, Next) 788 + + sizeof(p->Next) && p->Next)) 794 789 cifs_dbg(VFS, "%s: incomplete interface info\n", __func__); 795 790 796 791 ses->iface_last_update = jiffies; ··· 4814 4805 dw->server->ops->is_network_name_deleted(dw->buf, 4815 4806 dw->server); 4816 4807 4817 - mid->callback(mid); 4808 + mid_execute_callback(mid); 4818 4809 } else { 4819 4810 spin_lock(&dw->server->srv_lock); 4820 4811 if (dw->server->tcpStatus == CifsNeedReconnect) { ··· 4822 4813 mid->mid_state = MID_RETRY_NEEDED; 4823 4814 spin_unlock(&dw->server->mid_queue_lock); 4824 4815 spin_unlock(&dw->server->srv_lock); 4825 - mid->callback(mid); 4816 + mid_execute_callback(mid); 4826 4817 } else { 4827 4818 spin_lock(&dw->server->mid_queue_lock); 4828 4819 mid->mid_state = MID_REQUEST_SUBMITTED;
+1
fs/smb/client/smb2transport.c
··· 771 771 temp = mempool_alloc(cifs_mid_poolp, GFP_NOFS); 772 772 memset(temp, 0, sizeof(struct mid_q_entry)); 773 773 kref_init(&temp->refcount); 774 + spin_lock_init(&temp->mid_lock); 774 775 temp->mid = le64_to_cpu(shdr->MessageId); 775 776 temp->credits = credits > 0 ? credits : 1; 776 777 temp->pid = current->pid;
+5 -5
fs/smb/client/smbdirect.c
··· 1337 1337 log_rdma_event(INFO, "cancelling idle timer\n"); 1338 1338 cancel_delayed_work_sync(&info->idle_timer_work); 1339 1339 1340 - log_rdma_event(INFO, "wait for all send posted to IB to finish\n"); 1341 - wait_event(info->wait_send_pending, 1342 - atomic_read(&info->send_pending) == 0); 1343 - 1344 1340 /* It's not possible for upper layer to get to reassembly */ 1345 1341 log_rdma_event(INFO, "drain the reassembly queue\n"); 1346 1342 do { ··· 1982 1986 */ 1983 1987 1984 1988 wait_event(info->wait_send_pending, 1985 - atomic_read(&info->send_pending) == 0); 1989 + atomic_read(&info->send_pending) == 0 || 1990 + sc->status != SMBDIRECT_SOCKET_CONNECTED); 1991 + 1992 + if (sc->status != SMBDIRECT_SOCKET_CONNECTED && rc == 0) 1993 + rc = -EAGAIN; 1986 1994 1987 1995 return rc; 1988 1996 }
+3 -4
fs/smb/client/transport.c
··· 1005 1005 cifs_server_dbg(FYI, "Cancelling wait for mid %llu cmd: %d\n", 1006 1006 midQ[i]->mid, le16_to_cpu(midQ[i]->command)); 1007 1007 send_cancel(server, &rqst[i], midQ[i]); 1008 - spin_lock(&server->mid_queue_lock); 1008 + spin_lock(&midQ[i]->mid_lock); 1009 1009 midQ[i]->wait_cancelled = true; 1010 - if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED || 1011 - midQ[i]->mid_state == MID_RESPONSE_RECEIVED) { 1010 + if (midQ[i]->callback) { 1012 1011 midQ[i]->callback = cifs_cancelled_callback; 1013 1012 cancelled_mid[i] = true; 1014 1013 credits[i].value = 0; 1015 1014 } 1016 - spin_unlock(&server->mid_queue_lock); 1015 + spin_unlock(&midQ[i]->mid_lock); 1017 1016 } 1018 1017 } 1019 1018
+1 -1
fs/xfs/scrub/trace.h
··· 479 479 __field(xfs_exntst_t, state) 480 480 ), 481 481 TP_fast_assign( 482 - __entry->dev = cursor->sc->ip->i_mount->m_super->s_dev; 482 + __entry->dev = cursor->sc->mp->m_super->s_dev; 483 483 __entry->dqtype = cursor->dqtype; 484 484 __entry->ino = cursor->quota_ip->i_ino; 485 485 __entry->cur_id = cursor->id;
+3 -3
fs/xfs/xfs_file.c
··· 1101 1101 if (xfs_is_shutdown(ip->i_mount)) 1102 1102 return -EIO; 1103 1103 1104 - if (IS_DAX(inode)) 1105 - return xfs_file_dax_write(iocb, from); 1106 - 1107 1104 if (iocb->ki_flags & IOCB_ATOMIC) { 1108 1105 if (ocount < xfs_get_atomic_write_min(ip)) 1109 1106 return -EINVAL; ··· 1112 1115 if (ret) 1113 1116 return ret; 1114 1117 } 1118 + 1119 + if (IS_DAX(inode)) 1120 + return xfs_file_dax_write(iocb, from); 1115 1121 1116 1122 if (iocb->ki_flags & IOCB_DIRECT) { 1117 1123 /*
+11
fs/xfs/xfs_inode.h
··· 358 358 359 359 static inline bool xfs_inode_can_hw_atomic_write(const struct xfs_inode *ip) 360 360 { 361 + if (IS_DAX(VFS_IC(ip))) 362 + return false; 363 + 361 364 return xfs_inode_buftarg(ip)->bt_awu_max > 0; 365 + } 366 + 367 + static inline bool xfs_inode_can_sw_atomic_write(const struct xfs_inode *ip) 368 + { 369 + if (IS_DAX(VFS_IC(ip))) 370 + return false; 371 + 372 + return xfs_can_sw_atomic_write(ip->i_mount); 362 373 } 363 374 364 375 /*
+1 -1
fs/xfs/xfs_ioctl.c
··· 219 219 else if (XFS_INO_TO_AGNO(mp, breq->startino) < hdr->agno) 220 220 return -EINVAL; 221 221 222 - breq->flags |= XFS_IBULK_SAME_AG; 222 + breq->iwalk_flags |= XFS_IWALK_SAME_AG; 223 223 224 224 /* Asking for an inode past the end of the AG? We're done! */ 225 225 if (XFS_INO_TO_AGNO(mp, breq->startino) > hdr->agno)
+3 -2
fs/xfs/xfs_iops.c
··· 616 616 * write of exactly one single fsblock if the bdev will make that 617 617 * guarantee for us. 618 618 */ 619 - if (xfs_inode_can_hw_atomic_write(ip) || xfs_can_sw_atomic_write(mp)) 619 + if (xfs_inode_can_hw_atomic_write(ip) || 620 + xfs_inode_can_sw_atomic_write(ip)) 620 621 return mp->m_sb.sb_blocksize; 621 622 622 623 return 0; ··· 634 633 * write of exactly one single fsblock if the bdev will make that 635 634 * guarantee for us. 636 635 */ 637 - if (!xfs_can_sw_atomic_write(mp)) { 636 + if (!xfs_inode_can_sw_atomic_write(ip)) { 638 637 if (xfs_inode_can_hw_atomic_write(ip)) 639 638 return mp->m_sb.sb_blocksize; 640 639 return 0;
+2 -6
fs/xfs/xfs_itable.c
··· 307 307 .breq = breq, 308 308 }; 309 309 struct xfs_trans *tp; 310 - unsigned int iwalk_flags = 0; 311 310 int error; 312 311 313 312 if (breq->idmap != &nop_mnt_idmap) { ··· 327 328 * locking abilities to detect cycles in the inobt without deadlocking. 328 329 */ 329 330 tp = xfs_trans_alloc_empty(breq->mp); 330 - if (breq->flags & XFS_IBULK_SAME_AG) 331 - iwalk_flags |= XFS_IWALK_SAME_AG; 332 - 333 - error = xfs_iwalk(breq->mp, tp, breq->startino, iwalk_flags, 331 + error = xfs_iwalk(breq->mp, tp, breq->startino, breq->iwalk_flags, 334 332 xfs_bulkstat_iwalk, breq->icount, &bc); 335 333 xfs_trans_cancel(tp); 336 334 kfree(bc.buf); ··· 453 457 * locking abilities to detect cycles in the inobt without deadlocking. 454 458 */ 455 459 tp = xfs_trans_alloc_empty(breq->mp); 456 - error = xfs_inobt_walk(breq->mp, tp, breq->startino, breq->flags, 460 + error = xfs_inobt_walk(breq->mp, tp, breq->startino, breq->iwalk_flags, 457 461 xfs_inumbers_walk, breq->icount, &ic); 458 462 xfs_trans_cancel(tp); 459 463
+4 -6
fs/xfs/xfs_itable.h
··· 13 13 xfs_ino_t startino; /* start with this inode */ 14 14 unsigned int icount; /* number of elements in ubuffer */ 15 15 unsigned int ocount; /* number of records returned */ 16 - unsigned int flags; /* see XFS_IBULK_FLAG_* */ 16 + unsigned int flags; /* XFS_IBULK_FLAG_* */ 17 + unsigned int iwalk_flags; /* XFS_IWALK_FLAG_* */ 17 18 }; 18 19 19 - /* Only iterate within the same AG as startino */ 20 - #define XFS_IBULK_SAME_AG (1U << 0) 21 - 22 20 /* Fill out the bs_extents64 field if set. */ 23 - #define XFS_IBULK_NREXT64 (1U << 1) 21 + #define XFS_IBULK_NREXT64 (1U << 0) 24 22 25 23 /* Signal that we can return metadata directories. */ 26 - #define XFS_IBULK_METADIR (1U << 2) 24 + #define XFS_IBULK_METADIR (1U << 1) 27 25 28 26 /* 29 27 * Advance the user buffer pointer by one record of the given size. If the
+19
fs/xfs/xfs_mount.c
··· 779 779 return -EINVAL; 780 780 } 781 781 782 + if (xfs_has_reflink(mp)) 783 + goto set_limit; 784 + 785 + if (new_max_fsbs == 1) { 786 + if (mp->m_ddev_targp->bt_awu_max || 787 + (mp->m_rtdev_targp && mp->m_rtdev_targp->bt_awu_max)) { 788 + } else { 789 + xfs_warn(mp, 790 + "cannot support atomic writes of size %lluk with no reflink or HW support", 791 + new_max_bytes >> 10); 792 + return -EINVAL; 793 + } 794 + } else { 795 + xfs_warn(mp, 796 + "cannot support atomic writes of size %lluk with no reflink support", 797 + new_max_bytes >> 10); 798 + return -EINVAL; 799 + } 800 + 782 801 set_limit: 783 802 error = xfs_calc_atomic_write_reservation(mp, new_max_fsbs); 784 803 if (error) {
+1
fs/xfs/xfs_trace.h
··· 455 455 xfs_extlen_t len), \ 456 456 TP_ARGS(oz, rgbno, len)) 457 457 DEFINE_ZONE_ALLOC_EVENT(xfs_zone_record_blocks); 458 + DEFINE_ZONE_ALLOC_EVENT(xfs_zone_skip_blocks); 458 459 DEFINE_ZONE_ALLOC_EVENT(xfs_zone_alloc_blocks); 459 460 460 461 TRACE_EVENT(xfs_zone_gc_select_victim,
+1 -1
fs/xfs/xfs_trans.c
··· 253 253 * by doing GFP_KERNEL allocations inside sb_start_intwrite(). 254 254 */ 255 255 retry: 256 - WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE); 257 256 tp = __xfs_trans_alloc(mp, flags); 257 + WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE); 258 258 error = xfs_trans_reserve(tp, resp, blocks, rtextents); 259 259 if (error == -ENOSPC && want_retry) { 260 260 xfs_trans_cancel(tp);
+29 -13
fs/xfs/xfs_zone_alloc.c
··· 166 166 static void 167 167 xfs_zone_record_blocks( 168 168 struct xfs_trans *tp, 169 - xfs_fsblock_t fsbno, 170 - xfs_filblks_t len, 171 169 struct xfs_open_zone *oz, 172 - bool used) 170 + xfs_fsblock_t fsbno, 171 + xfs_filblks_t len) 173 172 { 174 173 struct xfs_mount *mp = tp->t_mountp; 175 174 struct xfs_rtgroup *rtg = oz->oz_rtg; ··· 178 179 179 180 xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP); 180 181 xfs_rtgroup_trans_join(tp, rtg, XFS_RTGLOCK_RMAP); 181 - if (used) { 182 - rmapip->i_used_blocks += len; 183 - ASSERT(rmapip->i_used_blocks <= rtg_blocks(rtg)); 184 - } else { 185 - xfs_add_frextents(mp, len); 186 - } 182 + rmapip->i_used_blocks += len; 183 + ASSERT(rmapip->i_used_blocks <= rtg_blocks(rtg)); 187 184 oz->oz_written += len; 188 185 if (oz->oz_written == rtg_blocks(rtg)) 189 186 xfs_open_zone_mark_full(oz); 190 187 xfs_trans_log_inode(tp, rmapip, XFS_ILOG_CORE); 188 + } 189 + 190 + /* 191 + * Called for blocks that have been written to disk, but not actually linked to 192 + * an inode, which can happen when garbage collection races with user data 193 + * writes to a file. 194 + */ 195 + static void 196 + xfs_zone_skip_blocks( 197 + struct xfs_open_zone *oz, 198 + xfs_filblks_t len) 199 + { 200 + struct xfs_rtgroup *rtg = oz->oz_rtg; 201 + 202 + trace_xfs_zone_skip_blocks(oz, 0, len); 203 + 204 + xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP); 205 + oz->oz_written += len; 206 + if (oz->oz_written == rtg_blocks(rtg)) 207 + xfs_open_zone_mark_full(oz); 208 + xfs_rtgroup_unlock(rtg, XFS_RTGLOCK_RMAP); 209 + 210 + xfs_add_frextents(rtg_mount(rtg), len); 191 211 } 192 212 193 213 static int ··· 268 250 } 269 251 } 270 252 271 - xfs_zone_record_blocks(tp, new->br_startblock, new->br_blockcount, oz, 272 - true); 253 + xfs_zone_record_blocks(tp, oz, new->br_startblock, new->br_blockcount); 273 254 274 255 /* Map the new blocks into the data fork. */ 275 256 xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, new); ··· 276 259 277 260 skip: 278 261 trace_xfs_reflink_cow_remap_skip(ip, new); 279 - xfs_zone_record_blocks(tp, new->br_startblock, new->br_blockcount, oz, 280 - false); 262 + xfs_zone_skip_blocks(oz, new->br_blockcount); 281 263 return 0; 282 264 } 283 265
+48
include/drm/drm_bridge.h
··· 866 866 struct drm_connector *connector, 867 867 bool enable, int direction); 868 868 869 + /** 870 + * @hdmi_cec_init: 871 + * 872 + * Initialize CEC part of the bridge. 873 + * 874 + * This callback is optional, it can be implemented by bridges that 875 + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their 876 + * &drm_bridge->ops. 877 + * 878 + * Returns: 879 + * 0 on success, a negative error code otherwise 880 + */ 869 881 int (*hdmi_cec_init)(struct drm_bridge *bridge, 870 882 struct drm_connector *connector); 871 883 884 + /** 885 + * @hdmi_cec_enable: 886 + * 887 + * Enable or disable the CEC adapter inside the bridge. 888 + * 889 + * This callback is optional, it can be implemented by bridges that 890 + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their 891 + * &drm_bridge->ops. 892 + * 893 + * Returns: 894 + * 0 on success, a negative error code otherwise 895 + */ 872 896 int (*hdmi_cec_enable)(struct drm_bridge *bridge, bool enable); 873 897 898 + /** 899 + * @hdmi_cec_log_addr: 900 + * 901 + * Set the logical address of the CEC adapter inside the bridge. 902 + * 903 + * This callback is optional, it can be implemented by bridges that 904 + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their 905 + * &drm_bridge->ops. 906 + * 907 + * Returns: 908 + * 0 on success, a negative error code otherwise 909 + */ 874 910 int (*hdmi_cec_log_addr)(struct drm_bridge *bridge, u8 logical_addr); 875 911 912 + /** 913 + * @hdmi_cec_transmit: 914 + * 915 + * Transmit the message using the CEC adapter inside the bridge. 916 + * 917 + * This callback is optional, it can be implemented by bridges that 918 + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their 919 + * &drm_bridge->ops. 920 + * 921 + * Returns: 922 + * 0 on success, a negative error code otherwise 923 + */ 876 924 int (*hdmi_cec_transmit)(struct drm_bridge *bridge, u8 attempts, 877 925 u32 signal_free_time, struct cec_msg *msg); 878 926
+4
include/linux/firewire.h
··· 341 341 u64 length; 342 342 fw_address_callback_t address_callback; 343 343 void *callback_data; 344 + 345 + // Only for core functions. 344 346 struct list_head link; 347 + struct kref kref; 348 + struct completion done; 345 349 }; 346 350 347 351 struct fw_address_region {
+4 -1
include/linux/netdevice.h
··· 2071 2071 * @max_pacing_offload_horizon: max EDT offload horizon in nsec. 2072 2072 * @napi_config: An array of napi_config structures containing per-NAPI 2073 2073 * settings. 2074 + * @num_napi_configs: number of allocated NAPI config structs, 2075 + * always >= max(num_rx_queues, num_tx_queues). 2074 2076 * @gro_flush_timeout: timeout for GRO layer in NAPI 2075 2077 * @napi_defer_hard_irqs: If not zero, provides a counter that would 2076 2078 * allow to avoid NIC hard IRQ, on busy queues. ··· 2484 2482 2485 2483 u64 max_pacing_offload_horizon; 2486 2484 struct napi_config *napi_config; 2487 - unsigned long gro_flush_timeout; 2485 + u32 num_napi_configs; 2488 2486 u32 napi_defer_hard_irqs; 2487 + unsigned long gro_flush_timeout; 2489 2488 2490 2489 /** 2491 2490 * @up: copy of @state's IFF_UP, but safe to read with just @lock.
+17 -12
include/linux/sched.h
··· 2152 2152 2153 2153 static inline void __set_task_blocked_on(struct task_struct *p, struct mutex *m) 2154 2154 { 2155 + struct mutex *blocked_on = READ_ONCE(p->blocked_on); 2156 + 2155 2157 WARN_ON_ONCE(!m); 2156 2158 /* The task should only be setting itself as blocked */ 2157 2159 WARN_ON_ONCE(p != current); ··· 2164 2162 * with a different mutex. Note, setting it to the same 2165 2163 * lock repeatedly is ok. 2166 2164 */ 2167 - WARN_ON_ONCE(p->blocked_on && p->blocked_on != m); 2168 - p->blocked_on = m; 2165 + WARN_ON_ONCE(blocked_on && blocked_on != m); 2166 + WRITE_ONCE(p->blocked_on, m); 2169 2167 } 2170 2168 2171 2169 static inline void set_task_blocked_on(struct task_struct *p, struct mutex *m) ··· 2176 2174 2177 2175 static inline void __clear_task_blocked_on(struct task_struct *p, struct mutex *m) 2178 2176 { 2179 - WARN_ON_ONCE(!m); 2180 - /* Currently we serialize blocked_on under the mutex::wait_lock */ 2181 - lockdep_assert_held_once(&m->wait_lock); 2182 - /* 2183 - * There may be cases where we re-clear already cleared 2184 - * blocked_on relationships, but make sure we are not 2185 - * clearing the relationship with a different lock. 2186 - */ 2187 - WARN_ON_ONCE(m && p->blocked_on && p->blocked_on != m); 2188 - p->blocked_on = NULL; 2177 + if (m) { 2178 + struct mutex *blocked_on = READ_ONCE(p->blocked_on); 2179 + 2180 + /* Currently we serialize blocked_on under the mutex::wait_lock */ 2181 + lockdep_assert_held_once(&m->wait_lock); 2182 + /* 2183 + * There may be cases where we re-clear already cleared 2184 + * blocked_on relationships, but make sure we are not 2185 + * clearing the relationship with a different lock. 2186 + */ 2187 + WARN_ON_ONCE(blocked_on && blocked_on != m); 2188 + } 2189 + WRITE_ONCE(p->blocked_on, NULL); 2189 2190 } 2190 2191 2191 2192 static inline void clear_task_blocked_on(struct task_struct *p, struct mutex *m)
+5 -1
include/net/devlink.h
··· 78 78 * @flavour: flavour of the port 79 79 * @split: indicates if this is split port 80 80 * @splittable: indicates if the port can be split. 81 + * @no_phys_port_name: skip automatic phys_port_name generation; for 82 + * compatibility only, newly added driver/port instance 83 + * should never set this. 81 84 * @lanes: maximum number of lanes the port supports. 0 value is not passed to netlink. 82 85 * @switch_id: if the port is part of switch, this is buffer with ID, otherwise this is NULL 83 86 * @phys: physical port attributes ··· 90 87 */ 91 88 struct devlink_port_attrs { 92 89 u8 split:1, 93 - splittable:1; 90 + splittable:1, 91 + no_phys_port_name:1; 94 92 u32 lanes; 95 93 enum devlink_port_flavour flavour; 96 94 struct netdev_phys_item_id switch_id;
+13
include/net/ip_vs.h
··· 1163 1163 return housekeeping_cpumask(HK_TYPE_KTHREAD); 1164 1164 } 1165 1165 1166 + static inline const struct cpumask *sysctl_est_preferred_cpulist(struct netns_ipvs *ipvs) 1167 + { 1168 + if (ipvs->est_cpulist_valid) 1169 + return ipvs->sysctl_est_cpulist; 1170 + else 1171 + return NULL; 1172 + } 1173 + 1166 1174 static inline int sysctl_est_nice(struct netns_ipvs *ipvs) 1167 1175 { 1168 1176 return ipvs->sysctl_est_nice; ··· 1276 1268 static inline const struct cpumask *sysctl_est_cpulist(struct netns_ipvs *ipvs) 1277 1269 { 1278 1270 return housekeeping_cpumask(HK_TYPE_KTHREAD); 1271 + } 1272 + 1273 + static inline const struct cpumask *sysctl_est_preferred_cpulist(struct netns_ipvs *ipvs) 1274 + { 1275 + return NULL; 1279 1276 } 1280 1277 1281 1278 static inline int sysctl_est_nice(struct netns_ipvs *ipvs)
-1
include/net/kcm.h
··· 71 71 struct list_head wait_psock_list; 72 72 struct sk_buff *seq_skb; 73 73 struct mutex tx_mutex; 74 - u32 tx_stopped : 1; 75 74 76 75 /* Don't use bit fields here, these are set under different locks */ 77 76 bool tx_wait;
+2
include/net/page_pool/types.h
··· 265 265 struct xdp_mem_info; 266 266 267 267 #ifdef CONFIG_PAGE_POOL 268 + void page_pool_enable_direct_recycling(struct page_pool *pool, 269 + struct napi_struct *napi); 268 270 void page_pool_disable_direct_recycling(struct page_pool *pool); 269 271 void page_pool_destroy(struct page_pool *pool); 270 272 void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *),
+3 -2
include/sound/cs35l56.h
··· 107 107 #define CS35L56_DSP1_PMEM_5114 0x3804FE8 108 108 109 109 #define CS35L63_DSP1_FW_VER CS35L56_DSP1_FW_VER 110 - #define CS35L63_DSP1_HALO_STATE 0x280396C 111 - #define CS35L63_DSP1_PM_CUR_STATE 0x28042C8 110 + #define CS35L63_DSP1_HALO_STATE 0x2803C04 111 + #define CS35L63_DSP1_PM_CUR_STATE 0x2804518 112 112 #define CS35L63_PROTECTION_STATUS 0x340009C 113 113 #define CS35L63_TRANSDUCER_ACTUAL_PS 0x34000F4 114 114 #define CS35L63_MAIN_RENDER_USER_MUTE 0x3400020 ··· 306 306 struct gpio_desc *reset_gpio; 307 307 struct cs35l56_spi_payload *spi_payload_buf; 308 308 const struct cs35l56_fw_reg *fw_reg; 309 + const struct cirrus_amp_cal_controls *calibration_controls; 309 310 }; 310 311 311 312 static inline bool cs35l56_is_otp_register(unsigned int reg)
+3 -3
include/sound/tas2781-tlv.h
··· 2 2 // 3 3 // ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier 4 4 // 5 - // Copyright (C) 2022 - 2024 Texas Instruments Incorporated 5 + // Copyright (C) 2022 - 2025 Texas Instruments Incorporated 6 6 // https://www.ti.com 7 7 // 8 8 // The TAS2781 driver implements a flexible and configurable ··· 15 15 #ifndef __TAS2781_TLV_H__ 16 16 #define __TAS2781_TLV_H__ 17 17 18 - static const __maybe_unused DECLARE_TLV_DB_SCALE(dvc_tlv, -10000, 50, 0); 19 - static const __maybe_unused DECLARE_TLV_DB_SCALE(amp_vol_tlv, 1100, 50, 0); 18 + static const __maybe_unused DECLARE_TLV_DB_SCALE(tas2781_dvc_tlv, -10000, 50, 0); 19 + static const __maybe_unused DECLARE_TLV_DB_SCALE(tas2781_amp_tlv, 1100, 50, 0); 20 20 21 21 #endif
+8
io_uring/io-wq.c
··· 357 357 worker = container_of(cb, struct io_worker, create_work); 358 358 wq = worker->wq; 359 359 acct = worker->acct; 360 + 361 + rcu_read_lock(); 362 + do_create = !io_acct_activate_free_worker(acct); 363 + rcu_read_unlock(); 364 + if (!do_create) 365 + goto no_need_create; 366 + 360 367 raw_spin_lock(&acct->workers_lock); 361 368 362 369 if (acct->nr_workers < acct->max_workers) { ··· 374 367 if (do_create) { 375 368 create_io_worker(wq, acct); 376 369 } else { 370 + no_need_create: 377 371 atomic_dec(&acct->nr_running); 378 372 io_worker_ref_put(wq); 379 373 }
+15 -12
io_uring/net.c
··· 494 494 return nbufs; 495 495 } 496 496 497 + static int io_net_kbuf_recyle(struct io_kiocb *req, 498 + struct io_async_msghdr *kmsg, int len) 499 + { 500 + req->flags |= REQ_F_BL_NO_RECYCLE; 501 + if (req->flags & REQ_F_BUFFERS_COMMIT) 502 + io_kbuf_commit(req, req->buf_list, len, io_bundle_nbufs(kmsg, len)); 503 + return IOU_RETRY; 504 + } 505 + 497 506 static inline bool io_send_finish(struct io_kiocb *req, int *ret, 498 507 struct io_async_msghdr *kmsg, 499 508 unsigned issue_flags) ··· 571 562 kmsg->msg.msg_controllen = 0; 572 563 kmsg->msg.msg_control = NULL; 573 564 sr->done_io += ret; 574 - req->flags |= REQ_F_BL_NO_RECYCLE; 575 - return -EAGAIN; 565 + return io_net_kbuf_recyle(req, kmsg, ret); 576 566 } 577 567 if (ret == -ERESTARTSYS) 578 568 ret = -EINTR; ··· 682 674 sr->len -= ret; 683 675 sr->buf += ret; 684 676 sr->done_io += ret; 685 - req->flags |= REQ_F_BL_NO_RECYCLE; 686 - return -EAGAIN; 677 + return io_net_kbuf_recyle(req, kmsg, ret); 687 678 } 688 679 if (ret == -ERESTARTSYS) 689 680 ret = -EINTR; ··· 1078 1071 } 1079 1072 if (ret > 0 && io_net_retry(sock, flags)) { 1080 1073 sr->done_io += ret; 1081 - req->flags |= REQ_F_BL_NO_RECYCLE; 1082 - return IOU_RETRY; 1074 + return io_net_kbuf_recyle(req, kmsg, ret); 1083 1075 } 1084 1076 if (ret == -ERESTARTSYS) 1085 1077 ret = -EINTR; ··· 1224 1218 sr->len -= ret; 1225 1219 sr->buf += ret; 1226 1220 sr->done_io += ret; 1227 - req->flags |= REQ_F_BL_NO_RECYCLE; 1228 - return -EAGAIN; 1221 + return io_net_kbuf_recyle(req, kmsg, ret); 1229 1222 } 1230 1223 if (ret == -ERESTARTSYS) 1231 1224 ret = -EINTR; ··· 1505 1500 zc->len -= ret; 1506 1501 zc->buf += ret; 1507 1502 zc->done_io += ret; 1508 - req->flags |= REQ_F_BL_NO_RECYCLE; 1509 - return -EAGAIN; 1503 + return io_net_kbuf_recyle(req, kmsg, ret); 1510 1504 } 1511 1505 if (ret == -ERESTARTSYS) 1512 1506 ret = -EINTR; ··· 1575 1571 1576 1572 if (ret > 0 && io_net_retry(sock, flags)) { 1577 1573 sr->done_io += ret; 1578 - req->flags |= REQ_F_BL_NO_RECYCLE; 1579 - return -EAGAIN; 1574 + return io_net_kbuf_recyle(req, kmsg, ret); 1580 1575 } 1581 1576 if (ret == -ERESTARTSYS) 1582 1577 ret = -EINTR;
+3 -3
kernel/futex/futex.h
··· 319 319 { 320 320 if (can_do_masked_user_access()) 321 321 to = masked_user_access_begin(to); 322 - else if (!user_read_access_begin(to, sizeof(*to))) 322 + else if (!user_write_access_begin(to, sizeof(*to))) 323 323 return -EFAULT; 324 324 unsafe_put_user(val, to, Efault); 325 - user_read_access_end(); 325 + user_write_access_end(); 326 326 return 0; 327 327 Efault: 328 - user_read_access_end(); 328 + user_write_access_end(); 329 329 return -EFAULT; 330 330 } 331 331
+1
kernel/kthread.c
··· 893 893 894 894 return ret; 895 895 } 896 + EXPORT_SYMBOL_GPL(kthread_affine_preferred); 896 897 897 898 /* 898 899 * Re-affine kthreads according to their preferences
+5 -1
kernel/locking/ww_mutex.h
··· 342 342 * When waking up the task to wound, be sure to clear the 343 343 * blocked_on pointer. Otherwise we can see circular 344 344 * blocked_on relationships that can't resolve. 345 + * 346 + * NOTE: We pass NULL here instead of lock, because we 347 + * are waking the mutex owner, who may be currently 348 + * blocked on a different mutex. 345 349 */ 346 - __clear_task_blocked_on(owner, lock); 350 + __clear_task_blocked_on(owner, NULL); 347 351 wake_q_add(wake_q, owner); 348 352 } 349 353 return true;
+2
kernel/rcu/tree.c
··· 4262 4262 rdp->rcu_iw_gp_seq = rdp->gp_seq - 1; 4263 4263 trace_rcu_grace_period(rcu_state.name, rdp->gp_seq, TPS("cpuonl")); 4264 4264 raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 4265 + 4266 + rcu_preempt_deferred_qs_init(rdp); 4265 4267 rcu_spawn_rnp_kthreads(rnp); 4266 4268 rcu_spawn_cpu_nocb_kthread(cpu); 4267 4269 ASSERT_EXCLUSIVE_WRITER(rcu_state.n_online_cpus);
+1
kernel/rcu/tree.h
··· 488 488 static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp); 489 489 static void rcu_flavor_sched_clock_irq(int user); 490 490 static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck); 491 + static void rcu_preempt_deferred_qs_init(struct rcu_data *rdp); 491 492 static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags); 492 493 static void rcu_preempt_boost_start_gp(struct rcu_node *rnp); 493 494 static bool rcu_is_callbacks_kthread(struct rcu_data *rdp);
+6 -2
kernel/rcu/tree_plugin.h
··· 763 763 cpu_online(rdp->cpu)) { 764 764 // Get scheduler to re-evaluate and call hooks. 765 765 // If !IRQ_WORK, FQS scan will eventually IPI. 766 - rdp->defer_qs_iw = 767 - IRQ_WORK_INIT_HARD(rcu_preempt_deferred_qs_handler); 768 766 rdp->defer_qs_iw_pending = DEFER_QS_PENDING; 769 767 irq_work_queue_on(&rdp->defer_qs_iw, rdp->cpu); 770 768 } ··· 902 904 } 903 905 } 904 906 907 + static void rcu_preempt_deferred_qs_init(struct rcu_data *rdp) 908 + { 909 + rdp->defer_qs_iw = IRQ_WORK_INIT_HARD(rcu_preempt_deferred_qs_handler); 910 + } 905 911 #else /* #ifdef CONFIG_PREEMPT_RCU */ 906 912 907 913 /* ··· 1104 1102 { 1105 1103 WARN_ON_ONCE(!list_empty(&rnp->blkd_tasks)); 1106 1104 } 1105 + 1106 + static void rcu_preempt_deferred_qs_init(struct rcu_data *rdp) { } 1107 1107 1108 1108 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */ 1109 1109
+1 -1
lib/ref_tracker.c
··· 434 434 if (dentry && !xa_is_err(dentry)) 435 435 return; 436 436 437 - ret = snprintf(name, sizeof(name), "%s@%px", dir->class, dir); 437 + ret = snprintf(name, sizeof(name), "%s@%p", dir->class, dir); 438 438 name[sizeof(name) - 1] = '\0'; 439 439 440 440 if (ret < sizeof(name)) {
+1 -1
mm/kasan/kasan_test_c.c
··· 47 47 * Some tests use these global variables to store return values from function 48 48 * calls that could otherwise be eliminated by the compiler as dead code. 49 49 */ 50 - static volatile void *kasan_ptr_result; 50 + static void *volatile kasan_ptr_result; 51 51 static volatile int kasan_int_result; 52 52 53 53 /* Probe for console output: obtains test_status lines of interest. */
+1 -1
mm/khugepaged.c
··· 1172 1172 if (result != SCAN_SUCCEED) 1173 1173 goto out_up_write; 1174 1174 /* check if the pmd is still valid */ 1175 + vma_start_write(vma); 1175 1176 result = check_pmd_still_valid(mm, address, pmd); 1176 1177 if (result != SCAN_SUCCEED) 1177 1178 goto out_up_write; 1178 1179 1179 - vma_start_write(vma); 1180 1180 anon_vma_lock_write(vma->anon_vma); 1181 1181 1182 1182 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, address,
+9 -1
mm/kmemleak.c
··· 470 470 { 471 471 unsigned long flags; 472 472 struct kmemleak_object *object; 473 + bool warn = false; 473 474 474 475 /* try the slab allocator first */ 475 476 if (object_cache) { ··· 489 488 else if (mem_pool_free_count) 490 489 object = &mem_pool[--mem_pool_free_count]; 491 490 else 492 - pr_warn_once("Memory pool empty, consider increasing CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE\n"); 491 + warn = true; 493 492 raw_spin_unlock_irqrestore(&kmemleak_lock, flags); 493 + if (warn) 494 + pr_warn_once("Memory pool empty, consider increasing CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE\n"); 494 495 495 496 return object; 496 497 } ··· 2184 2181 static void __kmemleak_do_cleanup(void) 2185 2182 { 2186 2183 struct kmemleak_object *object, *tmp; 2184 + unsigned int cnt = 0; 2187 2185 2188 2186 /* 2189 2187 * Kmemleak has already been disabled, no need for RCU list traversal ··· 2193 2189 list_for_each_entry_safe(object, tmp, &object_list, object_list) { 2194 2190 __remove_object(object); 2195 2191 __delete_object(object); 2192 + 2193 + /* Call cond_resched() once per 64 iterations to avoid soft lockup */ 2194 + if (!(++cnt & 0x3f)) 2195 + cond_resched(); 2196 2196 } 2197 2197 } 2198 2198
+10 -13
mm/mprotect.c
··· 120 120 121 121 static bool prot_numa_skip(struct vm_area_struct *vma, unsigned long addr, 122 122 pte_t oldpte, pte_t *pte, int target_node, 123 - struct folio **foliop) 123 + struct folio *folio) 124 124 { 125 - struct folio *folio = NULL; 126 125 bool ret = true; 127 126 bool toptier; 128 127 int nid; ··· 130 131 if (pte_protnone(oldpte)) 131 132 goto skip; 132 133 133 - folio = vm_normal_folio(vma, addr, oldpte); 134 134 if (!folio) 135 135 goto skip; 136 136 ··· 171 173 folio_xchg_access_time(folio, jiffies_to_msecs(jiffies)); 172 174 173 175 skip: 174 - *foliop = folio; 175 176 return ret; 176 177 } 177 178 ··· 228 231 * retrieve sub-batches. 229 232 */ 230 233 static void commit_anon_folio_batch(struct vm_area_struct *vma, 231 - struct folio *folio, unsigned long addr, pte_t *ptep, 234 + struct folio *folio, struct page *first_page, unsigned long addr, pte_t *ptep, 232 235 pte_t oldpte, pte_t ptent, int nr_ptes, struct mmu_gather *tlb) 233 236 { 234 - struct page *first_page = folio_page(folio, 0); 235 237 bool expected_anon_exclusive; 236 238 int sub_batch_idx = 0; 237 239 int len; ··· 247 251 } 248 252 249 253 static void set_write_prot_commit_flush_ptes(struct vm_area_struct *vma, 250 - struct folio *folio, unsigned long addr, pte_t *ptep, 254 + struct folio *folio, struct page *page, unsigned long addr, pte_t *ptep, 251 255 pte_t oldpte, pte_t ptent, int nr_ptes, struct mmu_gather *tlb) 252 256 { 253 257 bool set_write; ··· 266 270 /* idx = */ 0, set_write, tlb); 267 271 return; 268 272 } 269 - commit_anon_folio_batch(vma, folio, addr, ptep, oldpte, ptent, nr_ptes, tlb); 273 + commit_anon_folio_batch(vma, folio, page, addr, ptep, oldpte, ptent, nr_ptes, tlb); 270 274 } 271 275 272 276 static long change_pte_range(struct mmu_gather *tlb, ··· 301 305 const fpb_t flags = FPB_RESPECT_SOFT_DIRTY | FPB_RESPECT_WRITE; 302 306 int max_nr_ptes = (end - addr) >> PAGE_SHIFT; 303 307 struct folio *folio = NULL; 308 + struct page *page; 304 309 pte_t ptent; 305 310 311 + page = vm_normal_page(vma, addr, oldpte); 312 + if (page) 313 + folio = page_folio(page); 306 314 /* 307 315 * Avoid trapping faults against the zero or KSM 308 316 * pages. See similar comment in change_huge_pmd. 309 317 */ 310 318 if (prot_numa) { 311 319 int ret = prot_numa_skip(vma, addr, oldpte, pte, 312 - target_node, &folio); 320 + target_node, folio); 313 321 if (ret) { 314 322 315 323 /* determine batch to skip */ ··· 322 322 continue; 323 323 } 324 324 } 325 - 326 - if (!folio) 327 - folio = vm_normal_folio(vma, addr, oldpte); 328 325 329 326 nr_ptes = mprotect_folio_pte_batch(folio, pte, oldpte, max_nr_ptes, flags); 330 327 ··· 348 351 */ 349 352 if ((cp_flags & MM_CP_TRY_CHANGE_WRITABLE) && 350 353 !pte_write(ptent)) 351 - set_write_prot_commit_flush_ptes(vma, folio, 354 + set_write_prot_commit_flush_ptes(vma, folio, page, 352 355 addr, pte, oldpte, ptent, nr_ptes, tlb); 353 356 else 354 357 prot_commit_flush_ptes(vma, addr, pte, oldpte, ptent,
+4
mm/mremap.c
··· 179 179 if (max_nr == 1) 180 180 return 1; 181 181 182 + /* Avoid expensive folio lookup if we stand no chance of benefit. */ 183 + if (pte_batch_hint(ptep, pte) == 1) 184 + return 1; 185 + 182 186 folio = vm_normal_folio(vma, addr, pte); 183 187 if (!folio || !folio_test_large(folio)) 184 188 return 1;
+9 -6
mm/userfaultfd.c
··· 1821 1821 /* Check if we can move the pmd without splitting it. */ 1822 1822 if (move_splits_huge_pmd(dst_addr, src_addr, src_start + len) || 1823 1823 !pmd_none(dst_pmdval)) { 1824 - struct folio *folio = pmd_folio(*src_pmd); 1824 + /* Can be a migration entry */ 1825 + if (pmd_present(*src_pmd)) { 1826 + struct folio *folio = pmd_folio(*src_pmd); 1825 1827 1826 - if (!folio || (!is_huge_zero_folio(folio) && 1827 - !PageAnonExclusive(&folio->page))) { 1828 - spin_unlock(ptl); 1829 - err = -EBUSY; 1830 - break; 1828 + if (!is_huge_zero_folio(folio) && 1829 + !PageAnonExclusive(&folio->page)) { 1830 + spin_unlock(ptl); 1831 + err = -EBUSY; 1832 + break; 1833 + } 1831 1834 } 1832 1835 1833 1836 spin_unlock(ptl);
+1
net/bridge/netfilter/Kconfig
··· 43 43 config BRIDGE_NF_EBTABLES_LEGACY 44 44 tristate "Legacy EBTABLES support" 45 45 depends on BRIDGE && NETFILTER_XTABLES_LEGACY 46 + depends on NETFILTER_XTABLES 46 47 default n 47 48 help 48 49 Legacy ebtables packet/frame classifier.
+9 -3
net/core/dev.c
··· 6999 6999 enum netdev_napi_threaded threaded) 7000 7000 { 7001 7001 struct napi_struct *napi; 7002 - int err = 0; 7002 + int i, err = 0; 7003 7003 7004 7004 netdev_assert_locked_or_invisible(dev); 7005 7005 ··· 7020 7020 /* The error should not occur as the kthreads are already created. */ 7021 7021 list_for_each_entry(napi, &dev->napi_list, dev_list) 7022 7022 WARN_ON_ONCE(napi_set_threaded(napi, threaded)); 7023 + 7024 + /* Override the config for all NAPIs even if currently not listed */ 7025 + for (i = 0; i < dev->num_napi_configs; i++) 7026 + dev->napi_config[i].threaded = threaded; 7023 7027 7024 7028 return err; 7025 7029 } ··· 7357 7353 * Clear dev->threaded if kthread creation failed so that 7358 7354 * threaded mode will not be enabled in napi_enable(). 7359 7355 */ 7360 - if (dev->threaded && napi_kthread_create(napi)) 7361 - dev->threaded = NETDEV_NAPI_THREADED_DISABLED; 7356 + if (napi_get_threaded_config(dev, napi)) 7357 + if (napi_kthread_create(napi)) 7358 + dev->threaded = NETDEV_NAPI_THREADED_DISABLED; 7362 7359 netif_napi_set_irq_locked(napi, -1); 7363 7360 } 7364 7361 EXPORT_SYMBOL(netif_napi_add_weight_locked); ··· 11878 11873 goto free_all; 11879 11874 dev->cfg_pending = dev->cfg; 11880 11875 11876 + dev->num_napi_configs = maxqs; 11881 11877 napi_config_sz = array_size(maxqs, sizeof(*dev->napi_config)); 11882 11878 dev->napi_config = kvzalloc(napi_config_sz, GFP_KERNEL_ACCOUNT); 11883 11879 if (!dev->napi_config)
+8
net/core/dev.h
··· 323 323 return NETDEV_NAPI_THREADED_DISABLED; 324 324 } 325 325 326 + static inline enum netdev_napi_threaded 327 + napi_get_threaded_config(struct net_device *dev, struct napi_struct *n) 328 + { 329 + if (n->config) 330 + return n->config->threaded; 331 + return dev->threaded; 332 + } 333 + 326 334 int napi_set_threaded(struct napi_struct *n, 327 335 enum netdev_napi_threaded threaded); 328 336
+29
net/core/page_pool.c
··· 1201 1201 pool->xdp_mem_id = mem->id; 1202 1202 } 1203 1203 1204 + /** 1205 + * page_pool_enable_direct_recycling() - mark page pool as owned by NAPI 1206 + * @pool: page pool to modify 1207 + * @napi: NAPI instance to associate the page pool with 1208 + * 1209 + * Associate a page pool with a NAPI instance for lockless page recycling. 1210 + * This is useful when a new page pool has to be added to a NAPI instance 1211 + * without disabling that NAPI instance, to mark the point at which control 1212 + * path "hands over" the page pool to the NAPI instance. In most cases driver 1213 + * can simply set the @napi field in struct page_pool_params, and does not 1214 + * have to call this helper. 1215 + * 1216 + * The function is idempotent, but does not implement any refcounting. 1217 + * Single page_pool_disable_direct_recycling() will disable recycling, 1218 + * no matter how many times enable was called. 1219 + */ 1220 + void page_pool_enable_direct_recycling(struct page_pool *pool, 1221 + struct napi_struct *napi) 1222 + { 1223 + if (READ_ONCE(pool->p.napi) == napi) 1224 + return; 1225 + WARN_ON(!napi || pool->p.napi); 1226 + 1227 + mutex_lock(&page_pools_lock); 1228 + WRITE_ONCE(pool->p.napi, napi); 1229 + mutex_unlock(&page_pools_lock); 1230 + } 1231 + EXPORT_SYMBOL(page_pool_enable_direct_recycling); 1232 + 1204 1233 void page_pool_disable_direct_recycling(struct page_pool *pool) 1205 1234 { 1206 1235 /* Disable direct recycling based on pool->cpuid.
+1 -1
net/devlink/port.c
··· 1519 1519 struct devlink_port_attrs *attrs = &devlink_port->attrs; 1520 1520 int n = 0; 1521 1521 1522 - if (!devlink_port->attrs_set) 1522 + if (!devlink_port->attrs_set || devlink_port->attrs.no_phys_port_name) 1523 1523 return -EOPNOTSUPP; 1524 1524 1525 1525 switch (attrs->flavour) {
+3
net/ipv4/netfilter/Kconfig
··· 14 14 config IP_NF_IPTABLES_LEGACY 15 15 tristate "Legacy IP tables support" 16 16 depends on NETFILTER_XTABLES_LEGACY 17 + depends on NETFILTER_XTABLES 17 18 default m if NETFILTER_XTABLES_LEGACY 18 19 help 19 20 iptables is a legacy packet classifier. ··· 327 326 config IP_NF_ARPTABLES 328 327 tristate "Legacy ARPTABLES support" 329 328 depends on NETFILTER_XTABLES_LEGACY 329 + depends on NETFILTER_XTABLES 330 330 default n 331 331 help 332 332 arptables is a legacy packet classifier. ··· 345 343 select IP_NF_ARPTABLES 346 344 select NETFILTER_FAMILY_ARP 347 345 depends on NETFILTER_XTABLES_LEGACY 346 + depends on NETFILTER_XTABLES 348 347 help 349 348 ARP packet filtering defines a table `filter', which has a series of 350 349 rules for simple ARP packet filtering at local input and
+1 -1
net/ipv4/udp_offload.c
··· 217 217 remcsum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TUNNEL_REMCSUM); 218 218 skb->remcsum_offload = remcsum; 219 219 220 - need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb)); 220 + need_ipsec = (skb_dst(skb) && dst_xfrm(skb_dst(skb))) || skb_sec_path(skb); 221 221 /* Try to offload checksum if possible */ 222 222 offload_csum = !!(need_csum && 223 223 !need_ipsec &&
+1
net/ipv6/netfilter/Kconfig
··· 10 10 config IP6_NF_IPTABLES_LEGACY 11 11 tristate "Legacy IP6 tables support" 12 12 depends on INET && IPV6 && NETFILTER_XTABLES_LEGACY 13 + depends on NETFILTER_XTABLES 13 14 default m if NETFILTER_XTABLES_LEGACY 14 15 help 15 16 ip6tables is a legacy packet classifier.
+1 -1
net/ipv6/xfrm6_tunnel.c
··· 334 334 struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); 335 335 unsigned int i; 336 336 337 - xfrm_state_flush(net, IPSEC_PROTO_ANY, false); 337 + xfrm_state_flush(net, 0, false); 338 338 xfrm_flush_gc(); 339 339 340 340 for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
+2 -8
net/kcm/kcmsock.c
··· 430 430 431 431 /* Check if the socket is reserved so someone is waiting for sending. */ 432 432 kcm = psock->tx_kcm; 433 - if (kcm && !unlikely(kcm->tx_stopped)) 433 + if (kcm) 434 434 queue_work(kcm_wq, &kcm->tx_work); 435 435 436 436 spin_unlock_bh(&mux->lock); ··· 1693 1693 */ 1694 1694 __skb_queue_purge(&sk->sk_write_queue); 1695 1695 1696 - /* Set tx_stopped. This is checked when psock is bound to a kcm and we 1697 - * get a writespace callback. This prevents further work being queued 1698 - * from the callback (unbinding the psock occurs after canceling work. 1699 - */ 1700 - kcm->tx_stopped = 1; 1701 - 1702 1696 release_sock(sk); 1703 1697 1704 1698 spin_lock_bh(&mux->lock); ··· 1708 1714 /* Cancel work. After this point there should be no outside references 1709 1715 * to the kcm socket. 1710 1716 */ 1711 - cancel_work_sync(&kcm->tx_work); 1717 + disable_work_sync(&kcm->tx_work); 1712 1718 1713 1719 lock_sock(sk); 1714 1720 psock = kcm->tx_psock;
-1
net/mctp/test/route-test.c
··· 1586 1586 1587 1587 cleanup: 1588 1588 kfree_skb(skb_sock); 1589 - kfree_skb(skb_pkt); 1590 1589 1591 1590 /* Drop all binds */ 1592 1591 for (size_t i = 0; i < ARRAY_SIZE(lookup_binds); i++)
+2 -1
net/netfilter/ipvs/ip_vs_est.c
··· 265 265 } 266 266 267 267 set_user_nice(kd->task, sysctl_est_nice(ipvs)); 268 - set_cpus_allowed_ptr(kd->task, sysctl_est_cpulist(ipvs)); 268 + if (sysctl_est_preferred_cpulist(ipvs)) 269 + kthread_affine_preferred(kd->task, sysctl_est_preferred_cpulist(ipvs)); 269 270 270 271 pr_info("starting estimator thread %d...\n", kd->id); 271 272 wake_up_process(kd->task);
+30 -35
net/netfilter/nf_conntrack_netlink.c
··· 884 884 885 885 static int ctnetlink_done(struct netlink_callback *cb) 886 886 { 887 - if (cb->args[1]) 888 - nf_ct_put((struct nf_conn *)cb->args[1]); 889 887 kfree(cb->data); 890 888 return 0; 891 889 } ··· 1206 1208 return 0; 1207 1209 } 1208 1210 1211 + static unsigned long ctnetlink_get_id(const struct nf_conn *ct) 1212 + { 1213 + unsigned long id = nf_ct_get_id(ct); 1214 + 1215 + return id ? id : 1; 1216 + } 1217 + 1209 1218 static int 1210 1219 ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) 1211 1220 { 1212 1221 unsigned int flags = cb->data ? NLM_F_DUMP_FILTERED : 0; 1213 1222 struct net *net = sock_net(skb->sk); 1214 - struct nf_conn *ct, *last; 1223 + unsigned long last_id = cb->args[1]; 1215 1224 struct nf_conntrack_tuple_hash *h; 1216 1225 struct hlist_nulls_node *n; 1217 1226 struct nf_conn *nf_ct_evict[8]; 1227 + struct nf_conn *ct; 1218 1228 int res, i; 1219 1229 spinlock_t *lockp; 1220 1230 1221 - last = (struct nf_conn *)cb->args[1]; 1222 1231 i = 0; 1223 1232 1224 1233 local_bh_disable(); ··· 1262 1257 continue; 1263 1258 1264 1259 if (cb->args[1]) { 1265 - if (ct != last) 1260 + if (ctnetlink_get_id(ct) != last_id) 1266 1261 continue; 1267 1262 cb->args[1] = 0; 1268 1263 } ··· 1275 1270 NFNL_MSG_TYPE(cb->nlh->nlmsg_type), 1276 1271 ct, true, flags); 1277 1272 if (res < 0) { 1278 - nf_conntrack_get(&ct->ct_general); 1279 - cb->args[1] = (unsigned long)ct; 1273 + cb->args[1] = ctnetlink_get_id(ct); 1280 1274 spin_unlock(lockp); 1281 1275 goto out; 1282 1276 } ··· 1288 1284 } 1289 1285 out: 1290 1286 local_bh_enable(); 1291 - if (last) { 1287 + if (last_id) { 1292 1288 /* nf ct hash resize happened, now clear the leftover. */ 1293 - if ((struct nf_conn *)cb->args[1] == last) 1289 + if (cb->args[1] == last_id) 1294 1290 cb->args[1] = 0; 1295 - 1296 - nf_ct_put(last); 1297 1291 } 1298 1292 1299 1293 while (i) { ··· 3170 3168 return 0; 3171 3169 } 3172 3170 #endif 3173 - static int ctnetlink_exp_done(struct netlink_callback *cb) 3171 + 3172 + static unsigned long ctnetlink_exp_id(const struct nf_conntrack_expect *exp) 3174 3173 { 3175 - if (cb->args[1]) 3176 - nf_ct_expect_put((struct nf_conntrack_expect *)cb->args[1]); 3177 - return 0; 3174 + unsigned long id = (unsigned long)exp; 3175 + 3176 + id += nf_ct_get_id(exp->master); 3177 + id += exp->class; 3178 + 3179 + return id ? id : 1; 3178 3180 } 3179 3181 3180 3182 static int 3181 3183 ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) 3182 3184 { 3183 3185 struct net *net = sock_net(skb->sk); 3184 - struct nf_conntrack_expect *exp, *last; 3185 3186 struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); 3186 3187 u_int8_t l3proto = nfmsg->nfgen_family; 3188 + unsigned long last_id = cb->args[1]; 3189 + struct nf_conntrack_expect *exp; 3187 3190 3188 3191 rcu_read_lock(); 3189 - last = (struct nf_conntrack_expect *)cb->args[1]; 3190 3192 for (; cb->args[0] < nf_ct_expect_hsize; cb->args[0]++) { 3191 3193 restart: 3192 3194 hlist_for_each_entry_rcu(exp, &nf_ct_expect_hash[cb->args[0]], ··· 3202 3196 continue; 3203 3197 3204 3198 if (cb->args[1]) { 3205 - if (exp != last) 3199 + if (ctnetlink_exp_id(exp) != last_id) 3206 3200 continue; 3207 3201 cb->args[1] = 0; 3208 3202 } ··· 3211 3205 cb->nlh->nlmsg_seq, 3212 3206 IPCTNL_MSG_EXP_NEW, 3213 3207 exp) < 0) { 3214 - if (!refcount_inc_not_zero(&exp->use)) 3215 - continue; 3216 - cb->args[1] = (unsigned long)exp; 3208 + cb->args[1] = ctnetlink_exp_id(exp); 3217 3209 goto out; 3218 3210 } 3219 3211 } ··· 3222 3218 } 3223 3219 out: 3224 3220 rcu_read_unlock(); 3225 - if (last) 3226 - nf_ct_expect_put(last); 3227 - 3228 3221 return skb->len; 3229 3222 } 3230 3223 3231 3224 static int 3232 3225 ctnetlink_exp_ct_dump_table(struct sk_buff *skb, struct netlink_callback *cb) 3233 3226 { 3234 - struct nf_conntrack_expect *exp, *last; 3235 3227 struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); 3236 3228 struct nf_conn *ct = cb->data; 3237 3229 struct nf_conn_help *help = nfct_help(ct); 3238 3230 u_int8_t l3proto = nfmsg->nfgen_family; 3231 + unsigned long last_id = cb->args[1]; 3232 + struct nf_conntrack_expect *exp; 3239 3233 3240 3234 if (cb->args[0]) 3241 3235 return 0; 3242 3236 3243 3237 rcu_read_lock(); 3244 - last = (struct nf_conntrack_expect *)cb->args[1]; 3238 + 3245 3239 restart: 3246 3240 hlist_for_each_entry_rcu(exp, &help->expectations, lnode) { 3247 3241 if (l3proto && exp->tuple.src.l3num != l3proto) 3248 3242 continue; 3249 3243 if (cb->args[1]) { 3250 - if (exp != last) 3244 + if (ctnetlink_exp_id(exp) != last_id) 3251 3245 continue; 3252 3246 cb->args[1] = 0; 3253 3247 } ··· 3253 3251 cb->nlh->nlmsg_seq, 3254 3252 IPCTNL_MSG_EXP_NEW, 3255 3253 exp) < 0) { 3256 - if (!refcount_inc_not_zero(&exp->use)) 3257 - continue; 3258 - cb->args[1] = (unsigned long)exp; 3254 + cb->args[1] = ctnetlink_exp_id(exp); 3259 3255 goto out; 3260 3256 } 3261 3257 } ··· 3264 3264 cb->args[0] = 1; 3265 3265 out: 3266 3266 rcu_read_unlock(); 3267 - if (last) 3268 - nf_ct_expect_put(last); 3269 - 3270 3267 return skb->len; 3271 3268 } 3272 3269 ··· 3282 3285 struct nf_conntrack_zone zone; 3283 3286 struct netlink_dump_control c = { 3284 3287 .dump = ctnetlink_exp_ct_dump_table, 3285 - .done = ctnetlink_exp_done, 3286 3288 }; 3287 3289 3288 3290 err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_MASTER, ··· 3331 3335 else { 3332 3336 struct netlink_dump_control c = { 3333 3337 .dump = ctnetlink_exp_dump_table, 3334 - .done = ctnetlink_exp_done, 3335 3338 }; 3336 3339 return netlink_dump_start(info->sk, skb, info->nlh, &c); 3337 3340 }
+3 -3
net/netfilter/nf_conntrack_standalone.c
··· 567 567 return ret; 568 568 569 569 if (*(u8 *)table->data == 0) 570 - return ret; 570 + return 0; 571 571 572 572 /* Load nf_log_syslog only if no logger is currently registered */ 573 573 for (i = 0; i < NFPROTO_NUMPROTO; i++) { 574 574 if (nf_log_is_registered(i)) 575 - return ret; 575 + return 0; 576 576 } 577 577 request_module("%s", "nf_log_syslog"); 578 578 579 - return ret; 579 + return 0; 580 580 } 581 581 582 582 static struct ctl_table_header *nf_ct_netfilter_header;
+30
net/netfilter/nf_tables_api.c
··· 2803 2803 struct nft_chain *chain = ctx->chain; 2804 2804 struct nft_chain_hook hook = {}; 2805 2805 struct nft_stats __percpu *stats = NULL; 2806 + struct nftables_pernet *nft_net; 2806 2807 struct nft_hook *h, *next; 2807 2808 struct nf_hook_ops *ops; 2808 2809 struct nft_trans *trans; ··· 2846 2845 if (nft_hook_list_find(&basechain->hook_list, h)) { 2847 2846 list_del(&h->list); 2848 2847 nft_netdev_hook_free(h); 2848 + continue; 2849 + } 2850 + 2851 + nft_net = nft_pernet(ctx->net); 2852 + list_for_each_entry(trans, &nft_net->commit_list, list) { 2853 + if (trans->msg_type != NFT_MSG_NEWCHAIN || 2854 + trans->table != ctx->table || 2855 + !nft_trans_chain_update(trans)) 2856 + continue; 2857 + 2858 + if (nft_hook_list_find(&nft_trans_chain_hooks(trans), h)) { 2859 + nft_chain_release_hook(&hook); 2860 + return -EEXIST; 2861 + } 2849 2862 } 2850 2863 } 2851 2864 } else { ··· 9075 9060 { 9076 9061 const struct nlattr * const *nla = ctx->nla; 9077 9062 struct nft_flowtable_hook flowtable_hook; 9063 + struct nftables_pernet *nft_net; 9078 9064 struct nft_hook *hook, *next; 9079 9065 struct nf_hook_ops *ops; 9080 9066 struct nft_trans *trans; ··· 9092 9076 if (nft_hook_list_find(&flowtable->hook_list, hook)) { 9093 9077 list_del(&hook->list); 9094 9078 nft_netdev_hook_free(hook); 9079 + continue; 9080 + } 9081 + 9082 + nft_net = nft_pernet(ctx->net); 9083 + list_for_each_entry(trans, &nft_net->commit_list, list) { 9084 + if (trans->msg_type != NFT_MSG_NEWFLOWTABLE || 9085 + trans->table != ctx->table || 9086 + !nft_trans_flowtable_update(trans)) 9087 + continue; 9088 + 9089 + if (nft_hook_list_find(&nft_trans_flowtable_hooks(trans), hook)) { 9090 + err = -EEXIST; 9091 + goto err_flowtable_update_hook; 9092 + } 9095 9093 } 9096 9094 } 9097 9095
+2 -3
net/netfilter/nft_set_pipapo.c
··· 426 426 427 427 local_bh_disable(); 428 428 429 - if (unlikely(!raw_cpu_ptr(m->scratch))) 430 - goto out; 431 - 432 429 scratch = *raw_cpu_ptr(m->scratch); 430 + if (unlikely(!scratch)) 431 + goto out; 433 432 434 433 map_index = scratch->map_index; 435 434
+7 -7
net/netfilter/nft_set_pipapo_avx2.c
··· 1150 1150 const u32 *key) 1151 1151 { 1152 1152 struct nft_pipapo *priv = nft_set_priv(set); 1153 + const struct nft_set_ext *ext = NULL; 1153 1154 struct nft_pipapo_scratch *scratch; 1154 1155 u8 genmask = nft_genmask_cur(net); 1155 1156 const struct nft_pipapo_match *m; 1156 1157 const struct nft_pipapo_field *f; 1157 1158 const u8 *rp = (const u8 *)key; 1158 - const struct nft_set_ext *ext; 1159 1159 unsigned long *res, *fill; 1160 1160 bool map_index; 1161 1161 int i; ··· 1246 1246 goto out; 1247 1247 1248 1248 if (last) { 1249 - ext = &f->mt[ret].e->ext; 1250 - if (unlikely(nft_set_elem_expired(ext) || 1251 - !nft_set_elem_active(ext, genmask))) { 1252 - ext = NULL; 1253 - goto next_match; 1254 - } 1249 + const struct nft_set_ext *e = &f->mt[ret].e->ext; 1255 1250 1251 + if (unlikely(nft_set_elem_expired(e) || 1252 + !nft_set_elem_active(e, genmask))) 1253 + goto next_match; 1254 + 1255 + ext = e; 1256 1256 goto out; 1257 1257 } 1258 1258
+1 -1
net/netfilter/nft_socket.c
··· 217 217 218 218 level += err; 219 219 /* Implies a giant cgroup tree */ 220 - if (WARN_ON_ONCE(level > 255)) 220 + if (level > 255) 221 221 return -EOPNOTSUPP; 222 222 223 223 priv->level = level;
+6 -5
net/sched/sch_ets.c
··· 651 651 652 652 sch_tree_lock(sch); 653 653 654 + for (i = nbands; i < oldbands; i++) { 655 + if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) 656 + list_del_init(&q->classes[i].alist); 657 + qdisc_purge_queue(q->classes[i].qdisc); 658 + } 659 + 654 660 WRITE_ONCE(q->nbands, nbands); 655 661 for (i = nstrict; i < q->nstrict; i++) { 656 662 if (q->classes[i].qdisc->q.qlen) { 657 663 list_add_tail(&q->classes[i].alist, &q->active); 658 664 q->classes[i].deficit = quanta[i]; 659 665 } 660 - } 661 - for (i = q->nbands; i < oldbands; i++) { 662 - if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) 663 - list_del_init(&q->classes[i].alist); 664 - qdisc_purge_queue(q->classes[i].qdisc); 665 666 } 666 667 WRITE_ONCE(q->nstrict, nstrict); 667 668 memcpy(q->prio2band, priomap, sizeof(priomap));
+1 -1
net/sctp/input.c
··· 117 117 * it's better to just linearize it otherwise crc computing 118 118 * takes longer. 119 119 */ 120 - if ((!is_gso && skb_linearize(skb)) || 120 + if (((!is_gso || skb_cloned(skb)) && skb_linearize(skb)) || 121 121 !pskb_may_pull(skb, sizeof(struct sctphdr))) 122 122 goto discard_it; 123 123
+35 -8
net/sunrpc/svcsock.c
··· 257 257 } 258 258 259 259 static int 260 - svc_tcp_sock_recv_cmsg(struct svc_sock *svsk, struct msghdr *msg) 260 + svc_tcp_sock_recv_cmsg(struct socket *sock, unsigned int *msg_flags) 261 261 { 262 262 union { 263 263 struct cmsghdr cmsg; 264 264 u8 buf[CMSG_SPACE(sizeof(u8))]; 265 265 } u; 266 - struct socket *sock = svsk->sk_sock; 266 + u8 alert[2]; 267 + struct kvec alert_kvec = { 268 + .iov_base = alert, 269 + .iov_len = sizeof(alert), 270 + }; 271 + struct msghdr msg = { 272 + .msg_flags = *msg_flags, 273 + .msg_control = &u, 274 + .msg_controllen = sizeof(u), 275 + }; 267 276 int ret; 268 277 269 - msg->msg_control = &u; 270 - msg->msg_controllen = sizeof(u); 278 + iov_iter_kvec(&msg.msg_iter, ITER_DEST, &alert_kvec, 1, 279 + alert_kvec.iov_len); 280 + ret = sock_recvmsg(sock, &msg, MSG_DONTWAIT); 281 + if (ret > 0 && 282 + tls_get_record_type(sock->sk, &u.cmsg) == TLS_RECORD_TYPE_ALERT) { 283 + iov_iter_revert(&msg.msg_iter, ret); 284 + ret = svc_tcp_sock_process_cmsg(sock, &msg, &u.cmsg, -EAGAIN); 285 + } 286 + return ret; 287 + } 288 + 289 + static int 290 + svc_tcp_sock_recvmsg(struct svc_sock *svsk, struct msghdr *msg) 291 + { 292 + int ret; 293 + struct socket *sock = svsk->sk_sock; 294 + 271 295 ret = sock_recvmsg(sock, msg, MSG_DONTWAIT); 272 - if (unlikely(msg->msg_controllen != sizeof(u))) 273 - ret = svc_tcp_sock_process_cmsg(sock, msg, &u.cmsg, ret); 296 + if (msg->msg_flags & MSG_CTRUNC) { 297 + msg->msg_flags &= ~(MSG_CTRUNC | MSG_EOR); 298 + if (ret == 0 || ret == -EIO) 299 + ret = svc_tcp_sock_recv_cmsg(sock, &msg->msg_flags); 300 + } 274 301 return ret; 275 302 } 276 303 ··· 348 321 iov_iter_advance(&msg.msg_iter, seek); 349 322 buflen -= seek; 350 323 } 351 - len = svc_tcp_sock_recv_cmsg(svsk, &msg); 324 + len = svc_tcp_sock_recvmsg(svsk, &msg); 352 325 if (len > 0) 353 326 svc_flush_bvec(bvec, len, seek); 354 327 ··· 1045 1018 iov.iov_base = ((char *)&svsk->sk_marker) + svsk->sk_tcplen; 1046 1019 iov.iov_len = want; 1047 1020 iov_iter_kvec(&msg.msg_iter, ITER_DEST, &iov, 1, want); 1048 - len = svc_tcp_sock_recv_cmsg(svsk, &msg); 1021 + len = svc_tcp_sock_recvmsg(svsk, &msg); 1049 1022 if (len < 0) 1050 1023 return len; 1051 1024 svsk->sk_tcplen += len;
+1 -1
net/tls/tls.h
··· 196 196 int tls_rx_msg_size(struct tls_strparser *strp, struct sk_buff *skb); 197 197 void tls_rx_msg_ready(struct tls_strparser *strp); 198 198 199 - void tls_strp_msg_load(struct tls_strparser *strp, bool force_refresh); 199 + bool tls_strp_msg_load(struct tls_strparser *strp, bool force_refresh); 200 200 int tls_strp_msg_cow(struct tls_sw_context_rx *ctx); 201 201 struct sk_buff *tls_strp_msg_detach(struct tls_sw_context_rx *ctx); 202 202 int tls_strp_msg_hold(struct tls_strparser *strp, struct sk_buff_head *dst);
+8 -3
net/tls/tls_strp.c
··· 475 475 strp->stm.offset = offset; 476 476 } 477 477 478 - void tls_strp_msg_load(struct tls_strparser *strp, bool force_refresh) 478 + bool tls_strp_msg_load(struct tls_strparser *strp, bool force_refresh) 479 479 { 480 480 struct strp_msg *rxm; 481 481 struct tls_msg *tlm; ··· 484 484 DEBUG_NET_WARN_ON_ONCE(!strp->stm.full_len); 485 485 486 486 if (!strp->copy_mode && force_refresh) { 487 - if (WARN_ON(tcp_inq(strp->sk) < strp->stm.full_len)) 488 - return; 487 + if (unlikely(tcp_inq(strp->sk) < strp->stm.full_len)) { 488 + WRITE_ONCE(strp->msg_ready, 0); 489 + memset(&strp->stm, 0, sizeof(strp->stm)); 490 + return false; 491 + } 489 492 490 493 tls_strp_load_anchor_with_queue(strp, strp->stm.full_len); 491 494 } ··· 498 495 rxm->offset = strp->stm.offset; 499 496 tlm = tls_msg(strp->anchor); 500 497 tlm->control = strp->mark; 498 + 499 + return true; 501 500 } 502 501 503 502 /* Called with lock held on lower socket */
+2 -1
net/tls/tls_sw.c
··· 1384 1384 return sock_intr_errno(timeo); 1385 1385 } 1386 1386 1387 - tls_strp_msg_load(&ctx->strp, released); 1387 + if (unlikely(!tls_strp_msg_load(&ctx->strp, released))) 1388 + return tls_rx_rec_wait(sk, psock, nonblock, false); 1388 1389 1389 1390 return 1; 1390 1391 }
+2 -1
net/vmw_vsock/af_vsock.c
··· 689 689 unsigned int i; 690 690 691 691 for (i = 0; i < MAX_PORT_RETRIES; i++) { 692 - if (port <= LAST_RESERVED_PORT) 692 + if (port == VMADDR_PORT_ANY || 693 + port <= LAST_RESERVED_PORT) 693 694 port = LAST_RESERVED_PORT + 1; 694 695 695 696 new_addr.svm_port = port++;
+9 -3
net/xfrm/xfrm_device.c
··· 155 155 return skb; 156 156 } 157 157 158 - if (skb_is_gso(skb) && unlikely(xmit_xfrm_check_overflow(skb))) { 158 + if (skb_is_gso(skb) && (unlikely(x->xso.dev != dev) || 159 + unlikely(xmit_xfrm_check_overflow(skb)))) { 159 160 struct sk_buff *segs; 160 161 161 162 /* Packet got rerouted, fixup features and segment it. */ ··· 416 415 struct net_device *dev = x->xso.dev; 417 416 bool check_tunnel_size; 418 417 419 - if (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED) 418 + if (!x->type_offload || 419 + (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap)) 420 420 return false; 421 421 422 - if ((dev == xfrm_dst_path(dst)->dev) && !xdst->child->xfrm) { 422 + if ((!dev || dev == xfrm_dst_path(dst)->dev) && 423 + !xdst->child->xfrm) { 423 424 mtu = xfrm_state_mtu(x, xdst->child_mtu_cached); 424 425 if (skb->len <= mtu) 425 426 goto ok; ··· 433 430 return false; 434 431 435 432 ok: 433 + if (!dev) 434 + return true; 435 + 436 436 check_tunnel_size = x->xso.type == XFRM_DEV_OFFLOAD_PACKET && 437 437 x->props.mode == XFRM_MODE_TUNNEL; 438 438 switch (x->props.family) {
+1 -1
net/xfrm/xfrm_state.c
··· 3297 3297 unsigned int sz; 3298 3298 3299 3299 flush_work(&net->xfrm.state_hash_work); 3300 - xfrm_state_flush(net, IPSEC_PROTO_ANY, false); 3300 + xfrm_state_flush(net, 0, false); 3301 3301 flush_work(&xfrm_state_gc_work); 3302 3302 3303 3303 WARN_ON(!list_empty(&net->xfrm.state_all));
+13 -3
rust/Makefile
··· 65 65 66 66 core-edition := $(if $(call rustc-min-version,108700),2024,2021) 67 67 68 + # `rustdoc` did not save the target modifiers, thus workaround for 69 + # the time being (https://github.com/rust-lang/rust/issues/144521). 70 + rustdoc_modifiers_workaround := $(if $(call rustc-min-version,108800),-Cunsafe-allow-abi-mismatch=fixed-x18) 71 + 68 72 # `rustc` recognizes `--remap-path-prefix` since 1.26.0, but `rustdoc` only 69 73 # since Rust 1.81.0. Moreover, `rustdoc` ICEs on out-of-tree builds since Rust 70 74 # 1.82.0 (https://github.com/rust-lang/rust/issues/138520). Thus workaround both ··· 81 77 -Zunstable-options --generate-link-to-definition \ 82 78 --output $(rustdoc_output) \ 83 79 --crate-name $(subst rustdoc-,,$@) \ 80 + $(rustdoc_modifiers_workaround) \ 84 81 $(if $(rustdoc_host),,--sysroot=/dev/null) \ 85 82 @$(objtree)/include/generated/rustc_cfg $< 86 83 ··· 111 106 rustdoc-macros: private rustdoc_host = yes 112 107 rustdoc-macros: private rustc_target_flags = --crate-type proc-macro \ 113 108 --extern proc_macro 114 - rustdoc-macros: $(src)/macros/lib.rs FORCE 109 + rustdoc-macros: $(src)/macros/lib.rs rustdoc-clean FORCE 115 110 +$(call if_changed,rustdoc) 116 111 117 112 # Starting with Rust 1.82.0, skipping `-Wrustdoc::unescaped_backticks` should 118 113 # not be needed -- see https://github.com/rust-lang/rust/pull/128307. 119 114 rustdoc-core: private skip_flags = --edition=2021 -Wrustdoc::unescaped_backticks 120 115 rustdoc-core: private rustc_target_flags = --edition=$(core-edition) $(core-cfgs) 121 - rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs FORCE 116 + rustdoc-core: $(RUST_LIB_SRC)/core/src/lib.rs rustdoc-clean FORCE 122 117 +$(call if_changed,rustdoc) 123 118 124 119 rustdoc-compiler_builtins: $(src)/compiler_builtins.rs rustdoc-core FORCE ··· 130 125 rustdoc-pin_init_internal: private rustdoc_host = yes 131 126 rustdoc-pin_init_internal: private rustc_target_flags = --cfg kernel \ 132 127 --extern proc_macro --crate-type proc-macro 133 - rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs FORCE 128 + rustdoc-pin_init_internal: $(src)/pin-init/internal/src/lib.rs \ 129 + rustdoc-clean FORCE 134 130 +$(call if_changed,rustdoc) 135 131 136 132 rustdoc-pin_init: private rustdoc_host = yes ··· 148 142 rustdoc-pin_init rustdoc-compiler_builtins $(obj)/$(libmacros_name) \ 149 143 $(obj)/bindings.o FORCE 150 144 +$(call if_changed,rustdoc) 145 + 146 + rustdoc-clean: FORCE 147 + $(Q)rm -rf $(rustdoc_output) 151 148 152 149 quiet_cmd_rustc_test_library = $(RUSTC_OR_CLIPPY_QUIET) TL $< 153 150 cmd_rustc_test_library = \ ··· 224 215 --extern bindings --extern uapi \ 225 216 --no-run --crate-name kernel -Zunstable-options \ 226 217 --sysroot=/dev/null \ 218 + $(rustdoc_modifiers_workaround) \ 227 219 --test-builder $(objtree)/scripts/rustdoc_test_builder \ 228 220 $< $(rustdoc_test_kernel_quiet); \ 229 221 $(objtree)/scripts/rustdoc_test_gen
+2 -2
sound/core/timer.c
··· 2139 2139 goto err_take_id; 2140 2140 } 2141 2141 2142 + utimer->id = utimer_id; 2143 + 2142 2144 utimer->name = kasprintf(GFP_KERNEL, "snd-utimer%d", utimer_id); 2143 2145 if (!utimer->name) { 2144 2146 err = -ENOMEM; 2145 2147 goto err_get_name; 2146 2148 } 2147 - 2148 - utimer->id = utimer_id; 2149 2149 2150 2150 tid.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION; 2151 2151 tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL;
+23 -9
sound/hda/codecs/realtek/alc269.c
··· 510 510 hp_pin = 0x21; 511 511 512 512 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 513 + 514 + /* 3k pull low control for Headset jack. */ 515 + /* NOTE: call this before clearing the pin, otherwise codec stalls */ 516 + /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly 517 + * when booting with headset plugged. So skip setting it for the codec alc257 518 + */ 519 + if (spec->en_3kpull_low) 520 + alc_update_coef_idx(codec, 0x46, 0, 3 << 12); 521 + 513 522 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); 514 523 515 524 if (hp_pin_sense) { ··· 528 519 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 529 520 530 521 msleep(75); 531 - 532 - /* 3k pull low control for Headset jack. */ 533 - /* NOTE: call this before clearing the pin, otherwise codec stalls */ 534 - /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly 535 - * when booting with headset plugged. So skip setting it for the codec alc257 536 - */ 537 - if (spec->en_3kpull_low) 538 - alc_update_coef_idx(codec, 0x46, 0, 3 << 12); 539 522 540 523 if (!spec->no_shutup_pins) 541 524 snd_hda_codec_write(codec, hp_pin, 0, ··· 3580 3579 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE, 3581 3580 ALC294_FIXUP_ASUS_MIC, 3582 3581 ALC294_FIXUP_ASUS_HEADSET_MIC, 3582 + ALC294_FIXUP_ASUS_I2C_HEADSET_MIC, 3583 3583 ALC294_FIXUP_ASUS_SPK, 3584 3584 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE, 3585 3585 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE, ··· 4890 4888 }, 4891 4889 .chained = true, 4892 4890 .chain_id = ALC269_FIXUP_HEADSET_MIC 4891 + }, 4892 + [ALC294_FIXUP_ASUS_I2C_HEADSET_MIC] = { 4893 + .type = HDA_FIXUP_PINS, 4894 + .v.pins = (const struct hda_pintbl[]) { 4895 + { 0x19, 0x03a19020 }, /* use as headset mic */ 4896 + { } 4897 + }, 4898 + .chained = true, 4899 + .chain_id = ALC287_FIXUP_CS35L41_I2C_2 4893 4900 }, 4894 4901 [ALC294_FIXUP_ASUS_SPK] = { 4895 4902 .type = HDA_FIXUP_VERBS, ··· 6379 6368 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), 6380 6369 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), 6381 6370 SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), 6371 + SND_PCI_QUIRK(0x103c, 0x8548, "HP EliteBook x360 830 G6", ALC285_FIXUP_HP_GPIO_LED), 6372 + SND_PCI_QUIRK(0x103c, 0x854a, "HP EliteBook 830 G6", ALC285_FIXUP_HP_GPIO_LED), 6382 6373 SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11), 6383 6374 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360), 6384 6375 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT), ··· 6741 6728 SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC), 6742 6729 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2), 6743 6730 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 6744 - SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2), 6731 + SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC294_FIXUP_ASUS_I2C_HEADSET_MIC), 6745 6732 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 6746 6733 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2), 6747 6734 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2), ··· 7153 7140 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), 7154 7141 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC), 7155 7142 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC), 7143 + SND_PCI_QUIRK(0x1ee7, 0x2078, "HONOR BRB-X M1010", ALC2XX_FIXUP_HEADSET_MIC), 7156 7144 SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2), 7157 7145 SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 7158 7146 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+3 -3
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
··· 267 267 }; 268 268 269 269 static const struct snd_kcontrol_new tas2781_snd_controls[] = { 270 - ACARD_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL, 270 + ACARD_SINGLE_RANGE_EXT_TLV("Speaker Analog Volume", TAS2781_AMP_LEVEL, 271 271 1, 0, 20, 0, tas2781_amp_getvol, 272 - tas2781_amp_putvol, amp_vol_tlv), 272 + tas2781_amp_putvol, tas2781_amp_tlv), 273 273 ACARD_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0, 274 274 tas2781_force_fwload_get, tas2781_force_fwload_put), 275 275 }; ··· 318 318 efi_char16_t efi_name[TAS2563_CAL_VAR_NAME_MAX]; 319 319 unsigned long max_size = TAS2563_CAL_DATA_SIZE; 320 320 unsigned char var8[TAS2563_CAL_VAR_NAME_MAX]; 321 - struct tasdevice_priv *p = h->hda_priv; 321 + struct tasdevice_priv *p = h->priv; 322 322 struct calidata *cd = &p->cali_data; 323 323 struct cali_reg *r = &cd->cali_reg_array; 324 324 unsigned int offset = 0;
+4 -2
sound/hda/codecs/side-codecs/tas2781_hda_spi.c
··· 494 494 495 495 static struct snd_kcontrol_new tas2781_snd_ctls[] = { 496 496 ACARD_SINGLE_RANGE_EXT_TLV(NULL, TAS2781_AMP_LEVEL, 1, 0, 20, 0, 497 - tas2781_amp_getvol, tas2781_amp_putvol, amp_vol_tlv), 497 + tas2781_amp_getvol, tas2781_amp_putvol, 498 + tas2781_amp_tlv), 498 499 ACARD_SINGLE_RANGE_EXT_TLV(NULL, TAS2781_DVC_LVL, 0, 0, 200, 1, 499 - tas2781_digital_getvol, tas2781_digital_putvol, dvc_tlv), 500 + tas2781_digital_getvol, tas2781_digital_putvol, 501 + tas2781_dvc_tlv), 500 502 ACARD_SINGLE_BOOL_EXT(NULL, 0, tas2781_force_fwload_get, 501 503 tas2781_force_fwload_put), 502 504 };
-1
sound/hda/controllers/intel.c
··· 2077 2077 { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1043, 0x874f) }, /* ASUS ROG Zenith II / Strix */ 2078 2078 { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb59) }, /* MSI TRX40 Creator */ 2079 2079 { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb60) }, /* MSI TRX40 */ 2080 - { PCI_DEVICE_SUB(0x1022, 0x15e3, 0x1022, 0xd601) }, /* ASRock X670E Taichi */ 2081 2080 {} 2082 2081 }; 2083 2082
+4 -4
sound/pci/azt3328.c
··· 412 412 outl(value, chip->ctrl_io + reg); 413 413 } 414 414 415 - static inline void 415 + static inline void __maybe_unused 416 416 snd_azf3328_game_outb(const struct snd_azf3328 *chip, unsigned reg, u8 value) 417 417 { 418 418 outb(value, chip->game_io + reg); 419 419 } 420 420 421 - static inline void 421 + static inline void __maybe_unused 422 422 snd_azf3328_game_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value) 423 423 { 424 424 outw(value, chip->game_io + reg); 425 425 } 426 426 427 - static inline u8 427 + static inline u8 __maybe_unused 428 428 snd_azf3328_game_inb(const struct snd_azf3328 *chip, unsigned reg) 429 429 { 430 430 return inb(chip->game_io + reg); 431 431 } 432 432 433 - static inline u16 433 + static inline u16 __maybe_unused 434 434 snd_azf3328_game_inw(const struct snd_azf3328 *chip, unsigned reg) 435 435 { 436 436 return inw(chip->game_io + reg);
+3 -1
sound/soc/Kconfig
··· 111 111 source "sound/soc/cirrus/Kconfig" 112 112 source "sound/soc/dwc/Kconfig" 113 113 source "sound/soc/fsl/Kconfig" 114 - source "sound/soc/generic/Kconfig" 115 114 source "sound/soc/google/Kconfig" 116 115 source "sound/soc/hisilicon/Kconfig" 117 116 source "sound/soc/jz4740/Kconfig" ··· 147 148 source "sound/soc/codecs/Kconfig" 148 149 149 150 source "sound/soc/sdw_utils/Kconfig" 151 + 152 + # generic frame-work 153 + source "sound/soc/generic/Kconfig" 150 154 151 155 endif # SND_SOC 152 156
+3 -5
sound/soc/codecs/aw87390.c
··· 177 177 { 178 178 struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); 179 179 struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); 180 - char *prof_name, *name; 180 + char *prof_name; 181 181 int count, ret; 182 182 183 183 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; ··· 194 194 if (uinfo->value.enumerated.item >= count) 195 195 uinfo->value.enumerated.item = count - 1; 196 196 197 - name = uinfo->value.enumerated.name; 198 197 count = uinfo->value.enumerated.item; 199 198 200 199 ret = aw87390_dev_get_prof_name(aw87390->aw_pa, count, &prof_name); 201 200 if (ret) { 202 - strscpy(uinfo->value.enumerated.name, "null", 203 - strlen("null") + 1); 201 + strscpy(uinfo->value.enumerated.name, "null"); 204 202 return 0; 205 203 } 206 204 207 - strscpy(name, prof_name, sizeof(uinfo->value.enumerated.name)); 205 + strscpy(uinfo->value.enumerated.name, prof_name); 208 206 209 207 return 0; 210 208 }
+2 -3
sound/soc/codecs/aw88081.c
··· 914 914 915 915 ret = aw88081_dev_get_prof_name(aw88081->aw_pa, count, &prof_name); 916 916 if (ret) { 917 - strscpy(uinfo->value.enumerated.name, "null", 918 - sizeof(uinfo->value.enumerated.name)); 917 + strscpy(uinfo->value.enumerated.name, "null"); 919 918 return 0; 920 919 } 921 920 922 - strscpy(uinfo->value.enumerated.name, prof_name, sizeof(uinfo->value.enumerated.name)); 921 + strscpy(uinfo->value.enumerated.name, prof_name); 923 922 924 923 return 0; 925 924 }
+3 -5
sound/soc/codecs/aw88166.c
··· 1478 1478 { 1479 1479 struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); 1480 1480 struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); 1481 - char *prof_name, *name; 1481 + char *prof_name; 1482 1482 int count, ret; 1483 1483 1484 1484 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; ··· 1495 1495 if (uinfo->value.enumerated.item >= count) 1496 1496 uinfo->value.enumerated.item = count - 1; 1497 1497 1498 - name = uinfo->value.enumerated.name; 1499 1498 count = uinfo->value.enumerated.item; 1500 1499 1501 1500 ret = aw88166_dev_get_prof_name(aw88166->aw_pa, count, &prof_name); 1502 1501 if (ret) { 1503 - strscpy(uinfo->value.enumerated.name, "null", 1504 - strlen("null") + 1); 1502 + strscpy(uinfo->value.enumerated.name, "null"); 1505 1503 return 0; 1506 1504 } 1507 1505 1508 - strscpy(name, prof_name, sizeof(uinfo->value.enumerated.name)); 1506 + strscpy(uinfo->value.enumerated.name, prof_name); 1509 1507 1510 1508 return 0; 1511 1509 }
+3 -5
sound/soc/codecs/aw88261.c
··· 819 819 { 820 820 struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); 821 821 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); 822 - char *prof_name, *name; 822 + char *prof_name; 823 823 int count, ret; 824 824 825 825 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; ··· 836 836 if (uinfo->value.enumerated.item >= count) 837 837 uinfo->value.enumerated.item = count - 1; 838 838 839 - name = uinfo->value.enumerated.name; 840 839 count = uinfo->value.enumerated.item; 841 840 842 841 ret = aw88261_dev_get_prof_name(aw88261->aw_pa, count, &prof_name); 843 842 if (ret) { 844 - strscpy(uinfo->value.enumerated.name, "null", 845 - strlen("null") + 1); 843 + strscpy(uinfo->value.enumerated.name, "null"); 846 844 return 0; 847 845 } 848 846 849 - strscpy(name, prof_name, sizeof(uinfo->value.enumerated.name)); 847 + strscpy(uinfo->value.enumerated.name, prof_name); 850 848 851 849 return 0; 852 850 }
+3 -5
sound/soc/codecs/aw88395/aw88395.c
··· 175 175 { 176 176 struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); 177 177 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); 178 - char *prof_name, *name; 178 + char *prof_name; 179 179 int count, ret; 180 180 181 181 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; ··· 192 192 if (uinfo->value.enumerated.item >= count) 193 193 uinfo->value.enumerated.item = count - 1; 194 194 195 - name = uinfo->value.enumerated.name; 196 195 count = uinfo->value.enumerated.item; 197 196 198 197 ret = aw88395_dev_get_prof_name(aw88395->aw_pa, count, &prof_name); 199 198 if (ret) { 200 - strscpy(uinfo->value.enumerated.name, "null", 201 - strlen("null") + 1); 199 + strscpy(uinfo->value.enumerated.name, "null"); 202 200 return 0; 203 201 } 204 202 205 - strscpy(name, prof_name, sizeof(uinfo->value.enumerated.name)); 203 + strscpy(uinfo->value.enumerated.name, prof_name); 206 204 207 205 return 0; 208 206 }
+3 -5
sound/soc/codecs/aw88399.c
··· 1831 1831 { 1832 1832 struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); 1833 1833 struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); 1834 - char *prof_name, *name; 1834 + char *prof_name; 1835 1835 int count, ret; 1836 1836 1837 1837 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; ··· 1848 1848 if (uinfo->value.enumerated.item >= count) 1849 1849 uinfo->value.enumerated.item = count - 1; 1850 1850 1851 - name = uinfo->value.enumerated.name; 1852 1851 count = uinfo->value.enumerated.item; 1853 1852 1854 1853 ret = aw88399_dev_get_prof_name(aw88399->aw_pa, count, &prof_name); 1855 1854 if (ret) { 1856 - strscpy(uinfo->value.enumerated.name, "null", 1857 - strlen("null") + 1); 1855 + strscpy(uinfo->value.enumerated.name, "null"); 1858 1856 return 0; 1859 1857 } 1860 1858 1861 - strscpy(name, prof_name, sizeof(uinfo->value.enumerated.name)); 1859 + strscpy(uinfo->value.enumerated.name, prof_name); 1862 1860 1863 1861 return 0; 1864 1862 }
-69
sound/soc/codecs/cs35l56-sdw.c
··· 393 393 return 0; 394 394 } 395 395 396 - static int cs35l63_sdw_kick_divider(struct cs35l56_private *cs35l56, 397 - struct sdw_slave *peripheral) 398 - { 399 - unsigned int curr_scale_reg, next_scale_reg; 400 - int curr_scale, next_scale, ret; 401 - 402 - if (!cs35l56->base.init_done) 403 - return 0; 404 - 405 - if (peripheral->bus->params.curr_bank) { 406 - curr_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B1; 407 - next_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B0; 408 - } else { 409 - curr_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B0; 410 - next_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B1; 411 - } 412 - 413 - /* 414 - * Current clock scale value must be different to new value. 415 - * Modify current to guarantee this. If next still has the dummy 416 - * value we wrote when it was current, the core code has not set 417 - * a new scale so restore its original good value 418 - */ 419 - curr_scale = sdw_read_no_pm(peripheral, curr_scale_reg); 420 - if (curr_scale < 0) { 421 - dev_err(cs35l56->base.dev, "Failed to read current clock scale: %d\n", curr_scale); 422 - return curr_scale; 423 - } 424 - 425 - next_scale = sdw_read_no_pm(peripheral, next_scale_reg); 426 - if (next_scale < 0) { 427 - dev_err(cs35l56->base.dev, "Failed to read next clock scale: %d\n", next_scale); 428 - return next_scale; 429 - } 430 - 431 - if (next_scale == CS35L56_SDW_INVALID_BUS_SCALE) { 432 - next_scale = cs35l56->old_sdw_clock_scale; 433 - ret = sdw_write_no_pm(peripheral, next_scale_reg, next_scale); 434 - if (ret < 0) { 435 - dev_err(cs35l56->base.dev, "Failed to modify current clock scale: %d\n", 436 - ret); 437 - return ret; 438 - } 439 - } 440 - 441 - cs35l56->old_sdw_clock_scale = curr_scale; 442 - ret = sdw_write_no_pm(peripheral, curr_scale_reg, CS35L56_SDW_INVALID_BUS_SCALE); 443 - if (ret < 0) { 444 - dev_err(cs35l56->base.dev, "Failed to modify current clock scale: %d\n", ret); 445 - return ret; 446 - } 447 - 448 - dev_dbg(cs35l56->base.dev, "Next bus scale: %#x\n", next_scale); 449 - 450 - return 0; 451 - } 452 - 453 - static int cs35l56_sdw_bus_config(struct sdw_slave *peripheral, 454 - struct sdw_bus_params *params) 455 - { 456 - struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); 457 - 458 - if ((cs35l56->base.type == 0x63) && (cs35l56->base.rev < 0xa1)) 459 - return cs35l63_sdw_kick_divider(cs35l56, peripheral); 460 - 461 - return 0; 462 - } 463 - 464 396 static int __maybe_unused cs35l56_sdw_clk_stop(struct sdw_slave *peripheral, 465 397 enum sdw_clk_stop_mode mode, 466 398 enum sdw_clk_stop_type type) ··· 408 476 .read_prop = cs35l56_sdw_read_prop, 409 477 .interrupt_callback = cs35l56_sdw_interrupt, 410 478 .update_status = cs35l56_sdw_update_status, 411 - .bus_config = cs35l56_sdw_bus_config, 412 479 #ifdef DEBUG 413 480 .clk_stop = cs35l56_sdw_clk_stop, 414 481 #endif
+26 -3
sound/soc/codecs/cs35l56-shared.c
··· 838 838 }; 839 839 EXPORT_SYMBOL_NS_GPL(cs35l56_calibration_controls, "SND_SOC_CS35L56_SHARED"); 840 840 841 + static const struct cirrus_amp_cal_controls cs35l63_calibration_controls = { 842 + .alg_id = 0xbf210, 843 + .mem_region = WMFW_ADSP2_YM, 844 + .ambient = "CAL_AMBIENT", 845 + .calr = "CAL_R", 846 + .status = "CAL_STATUS", 847 + .checksum = "CAL_CHECKSUM", 848 + }; 849 + 841 850 int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base) 842 851 { 843 852 u64 silicon_uid = 0; ··· 921 912 void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp) 922 913 { 923 914 __be32 pid, sid, tid; 915 + unsigned int alg_id; 924 916 int ret; 917 + 918 + switch (cs35l56_base->type) { 919 + case 0x54: 920 + case 0x56: 921 + case 0x57: 922 + alg_id = 0x9f212; 923 + break; 924 + default: 925 + alg_id = 0xbf212; 926 + break; 927 + } 925 928 926 929 scoped_guard(mutex, &cs_dsp->pwr_lock) { 927 930 ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_PRJCT_ID", 928 - WMFW_ADSP2_XM, 0x9f212), 931 + WMFW_ADSP2_XM, alg_id), 929 932 0, &pid, sizeof(pid)); 930 933 if (!ret) 931 934 ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_CHNNL_ID", 932 - WMFW_ADSP2_XM, 0x9f212), 935 + WMFW_ADSP2_XM, alg_id), 933 936 0, &sid, sizeof(sid)); 934 937 if (!ret) 935 938 ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_SNPSHT_ID", 936 - WMFW_ADSP2_XM, 0x9f212), 939 + WMFW_ADSP2_XM, alg_id), 937 940 0, &tid, sizeof(tid)); 938 941 } 939 942 ··· 995 974 case 0x35A54: 996 975 case 0x35A56: 997 976 case 0x35A57: 977 + cs35l56_base->calibration_controls = &cs35l56_calibration_controls; 998 978 break; 999 979 case 0x35A630: 980 + cs35l56_base->calibration_controls = &cs35l63_calibration_controls; 1000 981 devid = devid >> 4; 1001 982 break; 1002 983 default:
+1 -1
sound/soc/codecs/cs35l56.c
··· 695 695 return ret; 696 696 697 697 ret = cs_amp_write_cal_coeffs(&cs35l56->dsp.cs_dsp, 698 - &cs35l56_calibration_controls, 698 + cs35l56->base.calibration_controls, 699 699 &cs35l56->base.cal_data); 700 700 701 701 wm_adsp_stop(&cs35l56->dsp);
-3
sound/soc/codecs/cs35l56.h
··· 20 20 #define CS35L56_SDW_GEN_INT_MASK_1 0xc1 21 21 #define CS35L56_SDW_INT_MASK_CODEC_IRQ BIT(0) 22 22 23 - #define CS35L56_SDW_INVALID_BUS_SCALE 0xf 24 - 25 23 #define CS35L56_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) 26 24 #define CS35L56_TX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE \ 27 25 | SNDRV_PCM_FMTBIT_S32_LE) ··· 50 52 u8 asp_slot_count; 51 53 bool tdm_mode; 52 54 bool sysclk_set; 53 - u8 old_sdw_clock_scale; 54 55 u8 sdw_link_num; 55 56 u8 sdw_unique_id; 56 57 };
+1 -1
sound/soc/codecs/es8389.c
··· 636 636 regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0x59); 637 637 regmap_write(es8389->regmap, ES8389_ADC_EN, 0x00); 638 638 regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0x00); 639 - regmap_write(es8389->regmap, ES8389_RESET, 0x7E); 639 + regmap_write(es8389->regmap, ES8389_RESET, 0x3E); 640 640 regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x80); 641 641 usleep_range(8000, 8500); 642 642 regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x00);
+1 -1
sound/soc/codecs/lpass-tx-macro.c
··· 2229 2229 } 2230 2230 2231 2231 static const struct snd_soc_component_driver tx_macro_component_drv = { 2232 - .name = "RX-MACRO", 2232 + .name = "TX-MACRO", 2233 2233 .probe = tx_macro_component_probe, 2234 2234 .controls = tx_macro_snd_controls, 2235 2235 .num_controls = ARRAY_SIZE(tx_macro_snd_controls),
+2 -1
sound/soc/codecs/rt1320-sdw.c
··· 109 109 { 0x0000d540, 0x01 }, 110 110 { 0xd172, 0x2a }, 111 111 { 0xc5d6, 0x01 }, 112 + { 0xd478, 0xff }, 112 113 }; 113 114 114 115 static const struct reg_sequence rt1320_vc_blind_write[] = { ··· 160 159 { 0xd471, 0x3a }, 161 160 { 0xd474, 0x11 }, 162 161 { 0xd475, 0x32 }, 163 - { 0xd478, 0x64 }, 162 + { 0xd478, 0xff }, 164 163 { 0xd479, 0x20 }, 165 164 { 0xd47a, 0x10 }, 166 165 { 0xd47c, 0xff },
+2
sound/soc/codecs/rt721-sdca.c
··· 278 278 RT721_ENT_FLOAT_CTL1, 0x4040); 279 279 rt_sdca_index_write(rt721->mbq_regmap, RT721_HDA_SDCA_FLOAT, 280 280 RT721_ENT_FLOAT_CTL4, 0x1201); 281 + rt_sdca_index_write(rt721->mbq_regmap, RT721_BOOST_CTRL, 282 + RT721_BST_4CH_TOP_GATING_CTRL1, 0x002a); 281 283 regmap_write(rt721->regmap, 0x2f58, 0x07); 282 284 } 283 285
+4
sound/soc/codecs/rt721-sdca.h
··· 56 56 #define RT721_CBJ_CTRL 0x0a 57 57 #define RT721_CAP_PORT_CTRL 0x0c 58 58 #define RT721_CLASD_AMP_CTRL 0x0d 59 + #define RT721_BOOST_CTRL 0x0f 59 60 #define RT721_VENDOR_REG 0x20 60 61 #define RT721_RC_CALIB_CTRL 0x40 61 62 #define RT721_VENDOR_EQ_L 0x53 ··· 93 92 94 93 /* Index (NID:0dh) */ 95 94 #define RT721_CLASD_AMP_2CH_CAL 0x14 95 + 96 + /* Index (NID:0fh) */ 97 + #define RT721_BST_4CH_TOP_GATING_CTRL1 0x05 96 98 97 99 /* Index (NID:20h) */ 98 100 #define RT721_JD_PRODUCT_NUM 0x00
+1 -1
sound/soc/codecs/sma1307.c
··· 1749 1749 sma1307->set.header_size * sizeof(int)); 1750 1750 1751 1751 if ((sma1307->set.checksum >> 8) != SMA1307_SETTING_CHECKSUM) { 1752 - dev_err(sma1307->dev, "%s: failed by dismatch \"%s\"\n", 1752 + dev_err(sma1307->dev, "%s: checksum failed \"%s\"\n", 1753 1753 __func__, setting_file); 1754 1754 sma1307->set.status = false; 1755 1755 return;
+5 -5
sound/soc/codecs/tas2781-i2c.c
··· 908 908 }; 909 909 910 910 static const struct snd_kcontrol_new tas2781_snd_controls[] = { 911 - SOC_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL, 911 + SOC_SINGLE_RANGE_EXT_TLV("Speaker Analog Volume", TAS2781_AMP_LEVEL, 912 912 1, 0, 20, 0, tas2781_amp_getvol, 913 - tas2781_amp_putvol, amp_vol_tlv), 914 - SOC_SINGLE_RANGE_EXT_TLV("Speaker Digital Gain", TAS2781_DVC_LVL, 913 + tas2781_amp_putvol, tas2781_amp_tlv), 914 + SOC_SINGLE_RANGE_EXT_TLV("Speaker Digital Volume", TAS2781_DVC_LVL, 915 915 0, 0, 200, 1, tas2781_digital_getvol, 916 - tas2781_digital_putvol, dvc_tlv), 916 + tas2781_digital_putvol, tas2781_dvc_tlv), 917 917 }; 918 918 919 919 static const struct snd_kcontrol_new tas2781_cali_controls[] = { ··· 1480 1480 return PTR_ERR(src); 1481 1481 1482 1482 if (src[0] > max_pkg_len && src[0] != count) { 1483 - dev_err(priv->dev, "pkg(%u), max(%u), count(%u) dismatch.\n", 1483 + dev_err(priv->dev, "pkg(%u), max(%u), count(%u) mismatch.\n", 1484 1484 src[0], max_pkg_len, (unsigned int)count); 1485 1485 ret = 0; 1486 1486 goto exit;
+10 -10
sound/soc/fsl/fsl_sai.c
··· 809 809 * are running concurrently. 810 810 */ 811 811 /* Software Reset */ 812 - regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR); 812 + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR, FSL_SAI_CSR_SR); 813 813 /* Clear SR bit to finish the reset */ 814 - regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), 0); 814 + regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR, 0); 815 815 } 816 816 817 817 static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd, ··· 930 930 unsigned int ofs = sai->soc_data->reg_offset; 931 931 932 932 /* Software Reset for both Tx and Rx */ 933 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR); 934 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR); 933 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR, FSL_SAI_CSR_SR); 934 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR, FSL_SAI_CSR_SR); 935 935 /* Clear SR bit to finish the reset */ 936 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), 0); 937 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0); 936 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR, 0); 937 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR, 0); 938 938 939 939 regmap_update_bits(sai->regmap, FSL_SAI_TCR1(ofs), 940 940 FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), ··· 1824 1824 1825 1825 regcache_cache_only(sai->regmap, false); 1826 1826 regcache_mark_dirty(sai->regmap); 1827 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR); 1828 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR); 1827 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR, FSL_SAI_CSR_SR); 1828 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR, FSL_SAI_CSR_SR); 1829 1829 usleep_range(1000, 2000); 1830 - regmap_write(sai->regmap, FSL_SAI_TCSR(ofs), 0); 1831 - regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0); 1830 + regmap_update_bits(sai->regmap, FSL_SAI_TCSR(ofs), FSL_SAI_CSR_SR, 0); 1831 + regmap_update_bits(sai->regmap, FSL_SAI_RCSR(ofs), FSL_SAI_CSR_SR, 0); 1832 1832 1833 1833 ret = regcache_sync(sai->regmap); 1834 1834 if (ret)
+2 -5
sound/soc/stm/stm32_i2s.c
··· 469 469 int ret; 470 470 471 471 ret = stm32_i2s_calc_clk_div(i2s, req->best_parent_rate, req->rate); 472 - if (ret) { 473 - req->rate = ret; 474 - 475 - return 0; 476 - } 472 + if (ret) 473 + return ret; 477 474 478 475 mclk->freq = req->best_parent_rate / i2s->divider; 479 476
+22 -3
sound/usb/stream.c
··· 341 341 342 342 len = le16_to_cpu(cluster->wLength); 343 343 c = 0; 344 - p += sizeof(struct uac3_cluster_header_descriptor); 344 + p += sizeof(*cluster); 345 + len -= sizeof(*cluster); 345 346 346 - while (((p - (void *)cluster) < len) && (c < channels)) { 347 + while (len > 0 && (c < channels)) { 347 348 struct uac3_cluster_segment_descriptor *cs_desc = p; 348 349 u16 cs_len; 349 350 u8 cs_type; 350 351 352 + if (len < sizeof(*cs_desc)) 353 + break; 351 354 cs_len = le16_to_cpu(cs_desc->wLength); 355 + if (len < cs_len) 356 + break; 352 357 cs_type = cs_desc->bSegmentType; 353 358 354 359 if (cs_type == UAC3_CHANNEL_INFORMATION) { 355 360 struct uac3_cluster_information_segment_descriptor *is = p; 356 361 unsigned char map; 362 + 363 + if (cs_len < sizeof(*is)) 364 + break; 357 365 358 366 /* 359 367 * TODO: this conversion is not complete, update it ··· 464 456 chmap->map[c++] = map; 465 457 } 466 458 p += cs_len; 459 + len -= cs_len; 467 460 } 468 461 469 462 if (channels < c) ··· 890 881 u64 badd_formats = 0; 891 882 unsigned int num_channels; 892 883 struct audioformat *fp; 893 - u16 cluster_id, wLength; 884 + u16 cluster_id, wLength, cluster_wLength; 894 885 int clock = 0; 895 886 int err; 896 887 ··· 1015 1006 } else if (err != wLength) { 1016 1007 dev_err(&dev->dev, 1017 1008 "%u:%d : can't get Cluster Descriptor\n", 1009 + iface_no, altno); 1010 + kfree(cluster); 1011 + return ERR_PTR(-EIO); 1012 + } 1013 + 1014 + cluster_wLength = le16_to_cpu(cluster->wLength); 1015 + if (cluster_wLength < sizeof(*cluster) || 1016 + cluster_wLength > wLength) { 1017 + dev_err(&dev->dev, 1018 + "%u:%d : invalid Cluster Descriptor size\n", 1018 1019 iface_no, altno); 1019 1020 kfree(cluster); 1020 1021 return ERR_PTR(-EIO);
+13 -1
sound/usb/validate.c
··· 221 221 return d->bLength >= sizeof(*d) + 4 + 2; 222 222 } 223 223 224 + static bool validate_uac3_power_domain_unit(const void *p, 225 + const struct usb_desc_validator *v) 226 + { 227 + const struct uac3_power_domain_descriptor *d = p; 228 + 229 + if (d->bLength < sizeof(*d)) 230 + return false; 231 + /* baEntities[] + wPDomainDescrStr */ 232 + return d->bLength >= sizeof(*d) + d->bNrEntities + 2; 233 + } 234 + 224 235 static bool validate_midi_out_jack(const void *p, 225 236 const struct usb_desc_validator *v) 226 237 { ··· 285 274 /* UAC_VERSION_3, UAC3_EXTENDED_TERMINAL: not implemented yet */ 286 275 FUNC(UAC_VERSION_3, UAC3_MIXER_UNIT, validate_mixer_unit), 287 276 FUNC(UAC_VERSION_3, UAC3_SELECTOR_UNIT, validate_selector_unit), 288 - FUNC(UAC_VERSION_3, UAC_FEATURE_UNIT, validate_uac3_feature_unit), 277 + FUNC(UAC_VERSION_3, UAC3_FEATURE_UNIT, validate_uac3_feature_unit), 289 278 /* UAC_VERSION_3, UAC3_EFFECT_UNIT: not implemented yet */ 290 279 FUNC(UAC_VERSION_3, UAC3_PROCESSING_UNIT, validate_processing_unit), 291 280 FUNC(UAC_VERSION_3, UAC3_EXTENSION_UNIT, validate_processing_unit), ··· 296 285 struct uac3_clock_multiplier_descriptor), 297 286 /* UAC_VERSION_3, UAC3_SAMPLE_RATE_CONVERTER: not implemented yet */ 298 287 /* UAC_VERSION_3, UAC3_CONNECTORS: not implemented yet */ 288 + FUNC(UAC_VERSION_3, UAC3_POWER_DOMAIN, validate_uac3_power_domain_unit), 299 289 { } /* terminator */ 300 290 }; 301 291
+6 -4
tools/testing/selftests/drivers/net/napi_threaded.py
··· 35 35 threaded = cmd(f"cat /sys/class/net/{cfg.ifname}/threaded").stdout 36 36 defer(_set_threaded_state, cfg, threaded) 37 37 38 + return combined 39 + 38 40 39 41 def enable_dev_threaded_disable_napi_threaded(cfg, nl) -> None: 40 42 """ ··· 51 49 napi0_id = napis[0]['id'] 52 50 napi1_id = napis[1]['id'] 53 51 54 - _setup_deferred_cleanup(cfg) 52 + qcnt = _setup_deferred_cleanup(cfg) 55 53 56 54 # set threaded 57 55 _set_threaded_state(cfg, 1) ··· 64 62 nl.napi_set({'id': napi1_id, 'threaded': 'disabled'}) 65 63 66 64 cmd(f"ethtool -L {cfg.ifname} combined 1") 67 - cmd(f"ethtool -L {cfg.ifname} combined 2") 65 + cmd(f"ethtool -L {cfg.ifname} combined {qcnt}") 68 66 _assert_napi_threaded_enabled(nl, napi0_id) 69 67 _assert_napi_threaded_disabled(nl, napi1_id) 70 68 ··· 82 80 napi0_id = napis[0]['id'] 83 81 napi1_id = napis[1]['id'] 84 82 85 - _setup_deferred_cleanup(cfg) 83 + qcnt = _setup_deferred_cleanup(cfg) 86 84 87 85 # set threaded 88 86 _set_threaded_state(cfg, 1) ··· 92 90 _assert_napi_threaded_enabled(nl, napi1_id) 93 91 94 92 cmd(f"ethtool -L {cfg.ifname} combined 1") 95 - cmd(f"ethtool -L {cfg.ifname} combined 2") 93 + cmd(f"ethtool -L {cfg.ifname} combined {qcnt}") 96 94 97 95 # check napi threaded is set for both napis 98 96 _assert_napi_threaded_enabled(nl, napi0_id)
+1
tools/testing/selftests/net/forwarding/sch_ets.sh
··· 11 11 ets_test_strict 12 12 ets_test_mixed 13 13 ets_test_dwrr 14 + ets_test_plug 14 15 classifier_mode 15 16 ets_test_strict 16 17 ets_test_mixed
+8
tools/testing/selftests/net/forwarding/sch_ets_tests.sh
··· 224 224 ets_set_dwrr_two_bands 225 225 xfail_on_slow ets_dwrr_test_01 226 226 } 227 + 228 + ets_test_plug() 229 + { 230 + ets_change_qdisc $put 2 "3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3" "1514 1514" 231 + tc qdisc add dev $put handle 20: parent 10:4 plug 232 + start_traffic_pktsize 100 $h1.10 192.0.2.1 192.0.2.2 00:c1:a0:c1:a0:00 "-c 1" 233 + ets_qdisc_setup $put 2 234 + }
+63
tools/testing/selftests/net/tls.c
··· 2708 2708 close(cfd); 2709 2709 } 2710 2710 2711 + TEST(data_steal) { 2712 + struct tls_crypto_info_keys tls; 2713 + char buf[20000], buf2[20000]; 2714 + struct sockaddr_in addr; 2715 + int sfd, cfd, ret, fd; 2716 + int pid, status; 2717 + socklen_t len; 2718 + 2719 + len = sizeof(addr); 2720 + memrnd(buf, sizeof(buf)); 2721 + 2722 + tls_crypto_info_init(TLS_1_2_VERSION, TLS_CIPHER_AES_GCM_256, &tls, 0); 2723 + 2724 + addr.sin_family = AF_INET; 2725 + addr.sin_addr.s_addr = htonl(INADDR_ANY); 2726 + addr.sin_port = 0; 2727 + 2728 + fd = socket(AF_INET, SOCK_STREAM, 0); 2729 + sfd = socket(AF_INET, SOCK_STREAM, 0); 2730 + 2731 + ASSERT_EQ(bind(sfd, &addr, sizeof(addr)), 0); 2732 + ASSERT_EQ(listen(sfd, 10), 0); 2733 + ASSERT_EQ(getsockname(sfd, &addr, &len), 0); 2734 + ASSERT_EQ(connect(fd, &addr, sizeof(addr)), 0); 2735 + ASSERT_GE(cfd = accept(sfd, &addr, &len), 0); 2736 + close(sfd); 2737 + 2738 + ret = setsockopt(fd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")); 2739 + if (ret) { 2740 + ASSERT_EQ(errno, ENOENT); 2741 + SKIP(return, "no TLS support"); 2742 + } 2743 + ASSERT_EQ(setsockopt(cfd, IPPROTO_TCP, TCP_ULP, "tls", sizeof("tls")), 0); 2744 + 2745 + /* Spawn a child and get it into the read wait path of the underlying 2746 + * TCP socket. 2747 + */ 2748 + pid = fork(); 2749 + ASSERT_GE(pid, 0); 2750 + if (!pid) { 2751 + EXPECT_EQ(recv(cfd, buf, sizeof(buf), MSG_WAITALL), 2752 + sizeof(buf)); 2753 + exit(!__test_passed(_metadata)); 2754 + } 2755 + 2756 + usleep(2000); 2757 + ASSERT_EQ(setsockopt(fd, SOL_TLS, TLS_TX, &tls, tls.len), 0); 2758 + ASSERT_EQ(setsockopt(cfd, SOL_TLS, TLS_RX, &tls, tls.len), 0); 2759 + 2760 + EXPECT_EQ(send(fd, buf, sizeof(buf), 0), sizeof(buf)); 2761 + usleep(2000); 2762 + EXPECT_EQ(recv(cfd, buf2, sizeof(buf2), MSG_DONTWAIT), -1); 2763 + /* Don't check errno, the error will be different depending 2764 + * on what random bytes TLS interpreted as the record length. 2765 + */ 2766 + 2767 + close(fd); 2768 + close(cfd); 2769 + 2770 + EXPECT_EQ(wait(&status), pid); 2771 + EXPECT_EQ(status, 0); 2772 + } 2773 + 2711 2774 static void __attribute__((constructor)) fips_check(void) { 2712 2775 int res; 2713 2776 FILE *f;
+3 -3
tools/testing/selftests/proc/proc-maps-race.c
··· 202 202 int offs = end - text; 203 203 204 204 text[offs] = '\0'; 205 - printf(text); 205 + printf("%s", text); 206 206 text[offs] = '\n'; 207 207 printf("\n"); 208 208 } else { 209 - printf(text); 209 + printf("%s", text); 210 210 } 211 211 } 212 212 ··· 221 221 nr--; 222 222 start--; 223 223 } 224 - printf(start); 224 + printf("%s", start); 225 225 } 226 226 227 227 static void print_boundaries(const char *title, FIXTURE_DATA(proc_maps_race) *self)