Skip to contentSkip to conversation

6.0.9-rc1 review

PATCH In review Greg Kroah-Hartman 17 participants 207 messages Nov 14, 2022 – Nov 16, 2022 Page 2 of 2

Subsystems (3)
lore
Share & tools
lore
author maintainer
#170 lore raw

PATCH 167/190 KVM: x86: use a separate asm-offsets.c file

In reply to Greg Kroah-Hartman

From: Paolo Bonzini <[email protected]>

commit debc5a1ec0d195ffea70d11efeffb713de9fdbc7 upstream.

This already removes an ugly #include "" from asm-offsets.c, but especially it avoids a future error when trying to define asm-offsets for KVM's svm/svm.h header.

This would not work for kernel/asm-offsets.c, because svm/svm.h includes kvm_cache_regs.h which is not in the include path when compiling asm-offsets.c. The problem is not there if the .c file is in arch/x86/kvm.

---
 arch/x86/kernel/asm-offsets.c  |    6 ------
 arch/x86/kvm/.gitignore        |    2 ++
 arch/x86/kvm/Makefile          |    9 +++++++++
 arch/x86/kvm/kvm-asm-offsets.c |   18 ++++++++++++++++++
 arch/x86/kvm/vmx/vmenter.S     |    2 +-
 5 files changed, 30 insertions(+), 7 deletions(-)
 create mode 100644 arch/x86/kvm/.gitignore
 create mode 100644 arch/x86/kvm/kvm-asm-offsets.c
arch/x86/kernel/asm-offsets.c +0 -6
@@ -19,7 +19,6 @@
 #include <asm/suspend.h>
 #include <asm/tlbflush.h>
 #include <asm/tdx.h>
-#include "../kvm/vmx/vmx.h"
 
 #ifdef CONFIG_XEN
 #include <xen/interface/xen.h>
@@ -108,9 +107,4 @@ static void __used common(void)
 	OFFSET(TSS_sp0, tss_struct, x86_tss.sp0);
 	OFFSET(TSS_sp1, tss_struct, x86_tss.sp1);
 	OFFSET(TSS_sp2, tss_struct, x86_tss.sp2);
-
-	if (IS_ENABLED(CONFIG_KVM_INTEL)) {
-		BLANK();
-		OFFSET(VMX_spec_ctrl, vcpu_vmx, spec_ctrl);
-	}
 }
arch/x86/kvm/.gitignore new file +2 -0
@@ -0,0 +1,2 @@
+/kvm-asm-offsets.s
+/kvm-asm-offsets.h
arch/x86/kvm/Makefile +9 -0
@@ -34,3 +34,12 @@ endif
 obj-$(CONFIG_KVM)	+= kvm.o
 obj-$(CONFIG_KVM_INTEL)	+= kvm-intel.o
 obj-$(CONFIG_KVM_AMD)	+= kvm-amd.o
+
+AFLAGS_vmx/vmenter.o    := -iquote $(obj)
+$(obj)/vmx/vmenter.o: $(obj)/kvm-asm-offsets.h
+
+$(obj)/kvm-asm-offsets.h: $(obj)/kvm-asm-offsets.s FORCE
+	$(call filechk,offsets,__KVM_ASM_OFFSETS_H__)
+
+targets += kvm-asm-offsets.s
+clean-files += kvm-asm-offsets.h
arch/x86/kvm/kvm-asm-offsets.c new file +18 -0
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Generate definitions needed by assembly language modules.
+ * This code generates raw asm output which is post-processed to extract
+ * and format the required data.
+ */
+#define COMPILE_OFFSETS
+
+#include <linux/kbuild.h>
+#include "vmx/vmx.h"
+
+static void __used common(void)
+{
+	if (IS_ENABLED(CONFIG_KVM_INTEL)) {
+		BLANK();
+		OFFSET(VMX_spec_ctrl, vcpu_vmx, spec_ctrl);
+	}
+}
arch/x86/kvm/vmx/vmenter.S +1 -1
@@ -1,12 +1,12 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/linkage.h>
 #include <asm/asm.h>
-#include <asm/asm-offsets.h>
 #include <asm/bitsperlong.h>
 #include <asm/kvm_vcpu_regs.h>
 #include <asm/nospec-branch.h>
 #include <asm/percpu.h>
 #include <asm/segment.h>
+#include "kvm-asm-offsets.h"
 #include "run_flags.h"
 
 #define WORD_SIZE (BITS_PER_LONG / 8)
author maintainer
#143 lore raw

PATCH 140/190 drm/amdgpu: workaround for TLB seq race

In reply to Greg Kroah-Hartman

From: Christian König <[email protected]>

commit 77c092e054262b594614bad5e5f47e57c5d29639 upstream.

It can happen that we query the sequence value before the callback had a chance to run.

Workaround that by grabbing the fence lock and releasing it again. Should be replaced by hw handling soon.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +15 -0
@@ -485,6 +485,21 @@ void amdgpu_debugfs_vm_bo_info(struct am
  */
 static inline uint64_t amdgpu_vm_tlb_seq(struct amdgpu_vm *vm)
 {
+	unsigned long flags;
+	spinlock_t *lock;
+
+	/*
+	 * Workaround to stop racing between the fence signaling and handling
+	 * the cb. The lock is static after initially setting it up, just make
+	 * sure that the dma_fence structure isn't freed up.
+	 */
+	rcu_read_lock();
+	lock = vm->last_tlb_flush->lock;
+	rcu_read_unlock();
+
+	spin_lock_irqsave(lock, flags);
+	spin_unlock_irqrestore(lock, flags);
+
 	return atomic64_read(&vm->tlb_seq);
 }
 
author maintainer
#144 lore raw

PATCH 141/190 drm/amdgpu: disable BACO on special BEIGE_GOBY card

In reply to Greg Kroah-Hartman

From: Guchun Chen <[email protected]>

commit 0c85c067c9d9d7a1b2cc2e01a236d5d0d4a872b5 upstream.

Still avoid intermittent failure.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +3 -1
@@ -376,7 +376,9 @@ static void sienna_cichlid_check_bxco_su
 		if (((adev->pdev->device == 0x73A1) &&
 		    (adev->pdev->revision == 0x00)) ||
 		    ((adev->pdev->device == 0x73BF) &&
-		    (adev->pdev->revision == 0xCF)))
+		    (adev->pdev->revision == 0xCF)) ||
+		    ((adev->pdev->device == 0x7422) &&
+		    (adev->pdev->revision == 0x00)))
 			smu_baco->platform_support = false;
 
 	}
author maintainer
#145 lore raw

PATCH 142/190 drm/amdkfd: Fix error handling in criu_checkpoint

In reply to Greg Kroah-Hartman

From: Felix Kuehling <[email protected]>

commit b91c23e099f0b65d62159da13458c5eefa76083f upstream.

Checkpoint BOs last. That way we don't need to close dmabuf FDs if something else fails later. This avoids problematic access to user mode memory in the error handling code path.

criu_checkpoint_bos has its own error handling and cleanup that does not depend on access to user memory.

In the private data, keep BOs before the remaining objects. This is necessary to restore things in the correct order as restoring events depends on the events-page BO being restored first.

Fixes be072b06c739 ("drm/amdkfd: CRIU export BOs as prime dmabuf objects")
CC Rajneesh Bhardwaj <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c |   34 +++++++++++++------------------
 1 file changed, 15 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +15 -19
@@ -1928,7 +1928,7 @@ static int criu_checkpoint(struct file *
 {
 	int ret;
 	uint32_t num_devices, num_bos, num_objects;
-	uint64_t priv_size, priv_offset = 0;
+	uint64_t priv_size, priv_offset = 0, bo_priv_offset;
 
 	if (!args->devices || !args->bos || !args->priv_data)
 		return -EINVAL;
@@ -1972,38 +1972,34 @@ static int criu_checkpoint(struct file *
 	if (ret)
 		goto exit_unlock;
 
-	ret = criu_checkpoint_bos(p, num_bos, (uint8_t __user *)args->bos,
-			    (uint8_t __user *)args->priv_data, &priv_offset);
-	if (ret)
-		goto exit_unlock;
+	/* Leave room for BOs in the private data. They need to be restored
+	 * before events, but we checkpoint them last to simplify the error
+	 * handling.
+	 */
+	bo_priv_offset = priv_offset;
+	priv_offset += num_bos * sizeof(struct kfd_criu_bo_priv_data);
 
 	if (num_objects) {
 		ret = kfd_criu_checkpoint_queues(p, (uint8_t __user *)args->priv_data,
 						 &priv_offset);
 		if (ret)
-			goto close_bo_fds;
+			goto exit_unlock;
 
 		ret = kfd_criu_checkpoint_events(p, (uint8_t __user *)args->priv_data,
 						 &priv_offset);
 		if (ret)
-			goto close_bo_fds;
+			goto exit_unlock;
 
 		ret = kfd_criu_checkpoint_svm(p, (uint8_t __user *)args->priv_data, &priv_offset);
 		if (ret)
-			goto close_bo_fds;
+			goto exit_unlock;
 	}
 
-close_bo_fds:
-	if (ret) {
-		/* If IOCTL returns err, user assumes all FDs opened in criu_dump_bos are closed */
-		uint32_t i;
-		struct kfd_criu_bo_bucket *bo_buckets = (struct kfd_criu_bo_bucket *) args->bos;
-
-		for (i = 0; i < num_bos; i++) {
-			if (bo_buckets[i].alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
-				close_fd(bo_buckets[i].dmabuf_fd);
-		}
-	}
+	/* This must be the last thing in this function that can fail.
+	 * Otherwise we leak dmabuf file descriptors.
+	 */
+	ret = criu_checkpoint_bos(p, num_bos, (uint8_t __user *)args->bos,
+			   (uint8_t __user *)args->priv_data, &bo_priv_offset);
 
 exit_unlock:
 	mutex_unlock(&p->mutex);
author maintainer
#146 lore raw

PATCH 143/190 drm/amdkfd: Fix error handling in kfd_criu_restore_events

In reply to Greg Kroah-Hartman

From: Felix Kuehling <[email protected]>

commit 66f7903779fbbc620bf1040017e4833ef6a0b541 upstream.

mutex_unlock before the exit label because all the error code paths that jump there didn't take that lock. This fixes unbalanced locking errors in case of restore errors.

Fixes 40e8a766a761 ("drm/amdkfd: CRIU checkpoint and restore events")
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +1 -2
@@ -506,6 +506,7 @@ int kfd_criu_restore_event(struct file *
 		ret = create_other_event(p, ev, &ev_priv->event_id);
 		break;
 	}
+	mutex_unlock(&p->event_mutex);
 
 exit:
 	if (ret)
@@ -513,8 +514,6 @@ exit:
 
 	kfree(ev_priv);
 
-	mutex_unlock(&p->event_mutex);
-
 	return ret;
 }
 
author maintainer
#147 lore raw

PATCH 144/190 platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi

In reply to Greg Kroah-Hartman

From: Jorge Lopez <[email protected]>

commit 1598bfa8e1faa932de42e1ee7628a1c4c4263f0a upstream.

After upgrading BIOS to U82 01.02.01 Rev.A, the console is flooded strange char "^@" which printed out every second and makes login nearly impossible. Also the below messages were shown both in console and journal/dmesg every second:

usb 1-3: Device not responding to setup address. usb 1-3: device not accepting address 4, error -71 usb 1-3: device descriptor read/all, error -71 usb usb1-port3: unable to enumerate USB device

Wifi is soft blocked by checking rfkill. When unblocked manually, after few seconds it would be soft blocked again. So I was suspecting something triggered rfkill to soft block wifi. At the end it was fixed by removing hp_wmi module.

The root cause is the way hp-wmi driver handles command 1B on post-2009 BIOS. In pre-2009 BIOS, command 1Bh return 0x4 to indicate that BIOS no longer controls the power for the wireless devices.

---
 drivers/platform/x86/hp-wmi.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +10 -2
@@ -1298,8 +1298,16 @@ static int __init hp_wmi_bios_setup(stru
 	wwan_rfkill = NULL;
 	rfkill2_count = 0;
 
-	if (hp_wmi_rfkill_setup(device))
-		hp_wmi_rfkill2_setup(device);
+	/*
+	 * In pre-2009 BIOS, command 1Bh return 0x4 to indicate that
+	 * BIOS no longer controls the power for the wireless
+	 * devices. All features supported by this command will no
+	 * longer be supported.
+	 */
+	if (!hp_wmi_bios_2009_later()) {
+		if (hp_wmi_rfkill_setup(device))
+			hp_wmi_rfkill2_setup(device);
+	}
 
 	err = hp_wmi_hwmon_init();
 
author maintainer
#148 lore raw

PATCH 145/190 wifi: ath11k: avoid deadlock during regulatory update in ath11k_regd_update()

In reply to Greg Kroah-Hartman

From: Wen Gong <[email protected]>

commit f45cb6b29cd36514e13f7519770873d8c0457008 upstream.

(cherry picked from commit d99884ad9e3673a12879bc2830f6e5a66cccbd78 in ath-next as users are seeing this bug more now, also cc stable)

Running this test in a loop it is easy to reproduce an rtnl deadlock:

iw reg set FI
ifconfig wlan0 down

What happens is that thread A (workqueue) tries to update the regulatory:

    try to acquire the rtnl_lock of ar->regd_update_work

    rtnl_lock+0x17/0x20
    ath11k_regd_update+0x15a/0x260 [ath11k]
    ath11k_regd_update_work+0x15/0x20 [ath11k]
    process_one_work+0x228/0x670
    worker_thread+0x4d/0x440
    kthread+0x16d/0x1b0
    ret_from_fork+0x22/0x30

And thread B (ifconfig) tries to stop the interface:

    try to cancel_work_sync(&ar->regd_update_work) in ath11k_mac_op_stop().
    ifconfig  3109 [003]  2414.232506: probe:

    ath11k_mac_op_stop: (ffffffffc14187a0)
    drv_stop+0x30 ([mac80211])
    ieee80211_do_stop+0x5d2 ([mac80211])
    ieee80211_stop+0x3e ([mac80211])
    __dev_close_many+0x9e ([kernel.kallsyms])
    __dev_change_flags+0xbe ([kernel.kallsyms])
    dev_change_flags+0x23 ([kernel.kallsyms])
    devinet_ioctl+0x5e3 ([kernel.kallsyms])
    inet_ioctl+0x197 ([kernel.kallsyms])
    sock_do_ioctl+0x4d ([kernel.kallsyms])
    sock_ioctl+0x264 ([kernel.kallsyms])
    __x64_sys_ioctl+0x92 ([kernel.kallsyms])
    do_syscall_64+0x3a ([kernel.kallsyms])
    entry_SYSCALL_64_after_hwframe+0x63 ([kernel.kallsyms])
    __GI___ioctl+0x7 (/lib/x86_64-linux-gnu/libc-2.23.so)

The sequence of deadlock is:

1. Thread B calls rtnl_lock().

2. Thread A starts to run and calls rtnl_lock() from within ath11k_regd_update_work(), then enters wait state because the lock is owned by thread B.

3. Thread B continues to run and tries to call cancel_work_sync(&ar->regd_update_work), but thread A is in ath11k_regd_update_work() waiting for rtnl_lock(). So cancel_work_sync() forever waits for ath11k_regd_update_work() to finish and we have a deadlock.

Fix this by switching from using regulatory_set_wiphy_regd_sync() to regulatory_set_wiphy_regd(). Now cfg80211 will schedule another workqueue which handles the locking on it's own. So the ath11k workqueue can simply exit without taking any locks, avoiding the deadlock.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3

---
 drivers/net/wireless/ath/ath11k/reg.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/reg.c +1 -5
@@ -287,11 +287,7 @@ int ath11k_regd_update(struct ath11k *ar
 		goto err;
 	}
 
-	rtnl_lock();
-	wiphy_lock(ar->hw->wiphy);
-	ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy);
-	wiphy_unlock(ar->hw->wiphy);
-	rtnl_unlock();
+	ret = regulatory_set_wiphy_regd(ar->hw->wiphy, regd_copy);
 
 	kfree(regd_copy);
 
author maintainer
#139 lore raw

PATCH 136/190 drm/i915/dmabuf: fix sg_table handling in map_dma_buf

In reply to Greg Kroah-Hartman

From: Matthew Auld <[email protected]>

commit f90daa975911961b65070ec72bd7dd8d448f9ef7 upstream.

We need to iterate over the original entries here for the sg_table, pulling out the struct page for each one, to be remapped. However currently this incorrectly iterates over the final dma mapped entries, which is likely just one gigantic sg entry if the iommu is enabled, leading to us only mapping the first struct page (and any physically contiguous pages following it), even if there is potentially lots more data to follow.

Fixes 1286ff739773 ("i915: add dmabuf/prime buffer sharing support.")
Cc Lionel Landwerlin <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Michael J. Ruhl <[email protected]>
Cc <[email protected]> # v3.5+
(cherry picked from commit 28d52f99bbca7227008cf580c9194c9b3516968e)
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +2 -2
@@ -40,13 +40,13 @@ static struct sg_table *i915_gem_map_dma
 		goto err;
 	}
 
-	ret = sg_alloc_table(st, obj->mm.pages->nents, GFP_KERNEL);
+	ret = sg_alloc_table(st, obj->mm.pages->orig_nents, GFP_KERNEL);
 	if (ret)
 		goto err_free;
 
 	src = obj->mm.pages->sgl;
 	dst = st->sgl;
-	for (i = 0; i < obj->mm.pages->nents; i++) {
+	for (i = 0; i < obj->mm.pages->orig_nents; i++) {
 		sg_set_page(dst, sg_page(src), src->length, 0);
 		dst = sg_next(dst);
 		src = sg_next(src);
author maintainer
#172 lore raw

PATCH 169/190 KVM: SVM: adjust register allocation for __svm_vcpu_run()

In reply to Greg Kroah-Hartman

From: Paolo Bonzini <[email protected]>

commit f7ef280132f9bf6f82acf5aa5c3c837206eef501 upstream.

32-bit ABI uses RAX/RCX/RDX as its argument registers, so they are in the way of instructions that hardcode their operands such as RDMSR/WRMSR or VMLOAD/VMRUN/VMSAVE.

In preparation for moving vmload/vmsave to __svm_vcpu_run(), keep the pointer to the struct vcpu_svm in %rdi. In particular, it is now possible to load svm->vmcb01.pa in %rax without clobbering the struct vcpu_svm pointer.

No functional change intended.

Fixes a149180fbcf3 ("x86: Add magic AMD return-thunk")
---
 arch/x86/kvm/svm/vmenter.S |   38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
arch/x86/kvm/svm/vmenter.S +19 -19
@@ -54,29 +54,29 @@ SYM_FUNC_START(__svm_vcpu_run)
 	/* Save @vmcb. */
 	push %_ASM_ARG1
 
-	/* Move @svm to RAX. */
-	mov %_ASM_ARG2, %_ASM_AX
+	/* Move @svm to RDI. */
+	mov %_ASM_ARG2, %_ASM_DI
+
+	/* "POP" @vmcb to RAX. */
+	pop %_ASM_AX
 
 	/* Load guest registers. */
-	mov VCPU_RCX(%_ASM_AX), %_ASM_CX
-	mov VCPU_RDX(%_ASM_AX), %_ASM_DX
-	mov VCPU_RBX(%_ASM_AX), %_ASM_BX
-	mov VCPU_RBP(%_ASM_AX), %_ASM_BP
-	mov VCPU_RSI(%_ASM_AX), %_ASM_SI
-	mov VCPU_RDI(%_ASM_AX), %_ASM_DI
+	mov VCPU_RCX(%_ASM_DI), %_ASM_CX
+	mov VCPU_RDX(%_ASM_DI), %_ASM_DX
+	mov VCPU_RBX(%_ASM_DI), %_ASM_BX
+	mov VCPU_RBP(%_ASM_DI), %_ASM_BP
+	mov VCPU_RSI(%_ASM_DI), %_ASM_SI
 #ifdef CONFIG_X86_64
-	mov VCPU_R8 (%_ASM_AX),  %r8
-	mov VCPU_R9 (%_ASM_AX),  %r9
-	mov VCPU_R10(%_ASM_AX), %r10
-	mov VCPU_R11(%_ASM_AX), %r11
-	mov VCPU_R12(%_ASM_AX), %r12
-	mov VCPU_R13(%_ASM_AX), %r13
-	mov VCPU_R14(%_ASM_AX), %r14
-	mov VCPU_R15(%_ASM_AX), %r15
+	mov VCPU_R8 (%_ASM_DI),  %r8
+	mov VCPU_R9 (%_ASM_DI),  %r9
+	mov VCPU_R10(%_ASM_DI), %r10
+	mov VCPU_R11(%_ASM_DI), %r11
+	mov VCPU_R12(%_ASM_DI), %r12
+	mov VCPU_R13(%_ASM_DI), %r13
+	mov VCPU_R14(%_ASM_DI), %r14
+	mov VCPU_R15(%_ASM_DI), %r15
 #endif
-
-	/* "POP" @vmcb to RAX. */
-	pop %_ASM_AX
+	mov VCPU_RDI(%_ASM_DI), %_ASM_DI
 
 	/* Enter guest mode */
 	sti
author maintainer
#181 lore raw

PATCH 178/190 dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit f645f85ae1104f8bd882f962ac0a69a1070076dd upstream.

The method was wrong because it violated the dmaengine API. For aborted transfers the complete callback should not be called. Fix the behavior and do not call the complete callback on device_terminate_all.

---
 drivers/dma/at_hdmac.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/dma/at_hdmac.c +2 -9
@@ -1437,11 +1437,8 @@ static int atc_terminate_all(struct dma_
 	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
 	struct at_dma		*atdma = to_at_dma(chan->device);
 	int			chan_id = atchan->chan_common.chan_id;
-	struct at_desc		*desc, *_desc;
 	unsigned long		flags;
 
-	LIST_HEAD(list);
-
 	dev_vdbg(chan2dev(chan), "%s\n", __func__);
 
 	/*
@@ -1460,15 +1457,11 @@ static int atc_terminate_all(struct dma_
 		cpu_relax();
 
 	/* active_list entries will end up before queued entries */
-	list_splice_init(&atchan->queue, &list);
-	list_splice_init(&atchan->active_list, &list);
+	list_splice_tail_init(&atchan->queue, &atchan->free_list);
+	list_splice_tail_init(&atchan->active_list, &atchan->free_list);
 
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
-	/* Flush all pending and queued descriptors */
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
-
 	clear_bit(ATC_IS_PAUSED, &atchan->status);
 	/* if channel dedicated to cyclic operations, free it */
 	clear_bit(ATC_IS_CYCLIC, &atchan->status);
author maintainer
#182 lore raw

PATCH 179/190 dmaengine: at_hdmac: Protect atchan->status with the channel lock

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 6e5ad28d16f082efeae3d0bd2e31f24bed218019 upstream.

Now that the complete callback call was removed from device_terminate_all(), we can protect the atchan->status with the channel lock. The atomic bitops on atchan->status do not substitute proper locking on the status, as one could still modify the status after the lock was dropped in atc_terminate_all() but before the atomic bitops were executed.

---
 drivers/dma/at_hdmac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/at_hdmac.c +2 -2
@@ -1460,12 +1460,12 @@ static int atc_terminate_all(struct dma_
 	list_splice_tail_init(&atchan->queue, &atchan->free_list);
 	list_splice_tail_init(&atchan->active_list, &atchan->free_list);
 
-	spin_unlock_irqrestore(&atchan->lock, flags);
-
 	clear_bit(ATC_IS_PAUSED, &atchan->status);
 	/* if channel dedicated to cyclic operations, free it */
 	clear_bit(ATC_IS_CYCLIC, &atchan->status);
 
+	spin_unlock_irqrestore(&atchan->lock, flags);
+
 	return 0;
 }
 
author maintainer
#183 lore raw

PATCH 180/190 dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all()

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit c6babed879fbe82796a601bf097649e07382db46 upstream.

atc_complete_all() had concurrency bugs, thus remove it:
1/ atc_complete_all() in its entirety was buggy, as when the atchan->queue list (the one that contains descriptors that are not yet issued to the hardware) contained descriptors, it fired just the first from the atchan->queue, but moved all the desc from atchan->queue to atchan->active_list and considered them all as fired. This could result in calling the completion of a descriptor that was not yet issued to the hardware.
2/ when in tasklet at atc_advance_work() time, atchan->active_list was queried without holding the lock of the chan. This can result in atchan->active_list concurrency problems between the tasklet and issue_pending().

---
 drivers/dma/at_hdmac.c |   49 ++++---------------------------------------------
 1 file changed, 4 insertions(+), 45 deletions(-)
drivers/dma/at_hdmac.c +4 -45
@@ -486,67 +486,26 @@ atc_chain_complete(struct at_dma_chan *a
 }
 
 /**
- * atc_complete_all - finish work for all transactions
- * @atchan: channel to complete transactions for
- *
- * Eventually submit queued descriptors if any
- *
- * Assume channel is idle while calling this function
- * Called with atchan->lock held and bh disabled
- */
-static void atc_complete_all(struct at_dma_chan *atchan)
-{
-	struct at_desc *desc, *_desc;
-	LIST_HEAD(list);
-	unsigned long flags;
-
-	dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n");
-
-	spin_lock_irqsave(&atchan->lock, flags);
-
-	/*
-	 * Submit queued descriptors ASAP, i.e. before we go through
-	 * the completed ones.
-	 */
-	if (!list_empty(&atchan->queue))
-		atc_dostart(atchan, atc_first_queued(atchan));
-	/* empty active_list now it is completed */
-	list_splice_init(&atchan->active_list, &list);
-	/* empty queue list by moving descriptors (if any) to active_list */
-	list_splice_init(&atchan->queue, &atchan->active_list);
-
-	spin_unlock_irqrestore(&atchan->lock, flags);
-
-	list_for_each_entry_safe(desc, _desc, &list, desc_node)
-		atc_chain_complete(atchan, desc);
-}
-
-/**
  * atc_advance_work - at the end of a transaction, move forward
  * @atchan: channel where the transaction ended
  */
 static void atc_advance_work(struct at_dma_chan *atchan)
 {
 	unsigned long flags;
-	int ret;
 
 	dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");
 
 	spin_lock_irqsave(&atchan->lock, flags);
-	ret = atc_chan_is_enabled(atchan);
+	if (atc_chan_is_enabled(atchan) || list_empty(&atchan->active_list))
+		return spin_unlock_irqrestore(&atchan->lock, flags);
 	spin_unlock_irqrestore(&atchan->lock, flags);
-	if (ret)
-		return;
-
-	if (list_empty(&atchan->active_list) ||
-	    list_is_singular(&atchan->active_list))
-		return atc_complete_all(atchan);
 
 	atc_chain_complete(atchan, atc_first_active(atchan));
 
 	/* advance work */
 	spin_lock_irqsave(&atchan->lock, flags);
-	atc_dostart(atchan, atc_first_active(atchan));
+	if (!list_empty(&atchan->active_list))
+		atc_dostart(atchan, atc_first_active(atchan));
 	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
author maintainer
#184 lore raw

PATCH 181/190 dmaengine: at_hdmac: Fix concurrency over descriptor

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 06988949df8c3007ad82036d3606d8ae72ed9000 upstream.

The descriptor was added to the free_list before calling the callback, which could result in reissuing of the same descriptor and calling of a single callback for both. Move the decriptor to the free list after the callback is invoked.

---
 drivers/dma/at_hdmac.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/dma/at_hdmac.c +9 -5
@@ -469,11 +469,8 @@ atc_chain_complete(struct at_dma_chan *a
 		desc->memset_buffer = false;
 	}
 
-	/* move children to free_list */
-	list_splice_init(&desc->tx_list, &atchan->free_list);
-	/* move myself to free_list */
-	list_move(&desc->desc_node, &atchan->free_list);
-
+	/* Remove transfer node from the active list. */
+	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
 	dma_descriptor_unmap(txd);
@@ -483,6 +480,13 @@ atc_chain_complete(struct at_dma_chan *a
 		dmaengine_desc_get_callback_invoke(txd, NULL);
 
 	dma_run_dependencies(txd);
+
+	spin_lock_irqsave(&atchan->lock, flags);
+	/* move children to free_list */
+	list_splice_init(&desc->tx_list, &atchan->free_list);
+	/* add myself to free_list */
+	list_add(&desc->desc_node, &atchan->free_list);
+	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
 /**
author maintainer
#185 lore raw

PATCH 182/190 dmaengine: at_hdmac: Free the memset buf without holding the chan lock

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 6ba826cbb57d675f447b59323204d1473bbd5593 upstream.

There's no need to hold the channel lock when freeing the memset buf, as the operation has already completed. Free the memset buf without holding the channel lock.

---
 drivers/dma/at_hdmac.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/dma/at_hdmac.c +7 -7
@@ -462,13 +462,6 @@ atc_chain_complete(struct at_dma_chan *a
 	if (!atc_chan_is_cyclic(atchan))
 		dma_cookie_complete(txd);
 
-	/* If the transfer was a memset, free our temporary buffer */
-	if (desc->memset_buffer) {
-		dma_pool_free(atdma->memset_pool, desc->memset_vaddr,
-			      desc->memset_paddr);
-		desc->memset_buffer = false;
-	}
-
 	/* Remove transfer node from the active list. */
 	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
@@ -487,6 +480,13 @@ atc_chain_complete(struct at_dma_chan *a
 	/* add myself to free_list */
 	list_add(&desc->desc_node, &atchan->free_list);
 	spin_unlock_irqrestore(&atchan->lock, flags);
+
+	/* If the transfer was a memset, free our temporary buffer */
+	if (desc->memset_buffer) {
+		dma_pool_free(atdma->memset_pool, desc->memset_vaddr,
+			      desc->memset_paddr);
+		desc->memset_buffer = false;
+	}
 }
 
 /**
author maintainer
#186 lore raw

PATCH 183/190 dmaengine: at_hdmac: Fix concurrency over the active list

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 03ed9ba357cc78116164b90b87f45eacab60b561 upstream.

The tasklet (atc_advance_work()) did not held the channel lock when retrieving the first active descriptor, causing concurrency problems if issue_pending() was called in between. If issue_pending() was called exactly after the lock was released in the tasklet (atc_advance_work()), atc_chain_complete() could complete a descriptor for which the controller has not yet raised an interrupt.

---
 drivers/dma/at_hdmac.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/dma/at_hdmac.c +6 -4
@@ -462,8 +462,6 @@ atc_chain_complete(struct at_dma_chan *a
 	if (!atc_chan_is_cyclic(atchan))
 		dma_cookie_complete(txd);
 
-	/* Remove transfer node from the active list. */
-	list_del_init(&desc->desc_node);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
 	dma_descriptor_unmap(txd);
@@ -495,6 +493,7 @@ atc_chain_complete(struct at_dma_chan *a
  */
 static void atc_advance_work(struct at_dma_chan *atchan)
 {
+	struct at_desc *desc;
 	unsigned long flags;
 
 	dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n");
@@ -502,9 +501,12 @@ static void atc_advance_work(struct at_d
 	spin_lock_irqsave(&atchan->lock, flags);
 	if (atc_chan_is_enabled(atchan) || list_empty(&atchan->active_list))
 		return spin_unlock_irqrestore(&atchan->lock, flags);
-	spin_unlock_irqrestore(&atchan->lock, flags);
 
-	atc_chain_complete(atchan, atc_first_active(atchan));
+	desc = atc_first_active(atchan);
+	/* Remove the transfer node from the active list. */
+	list_del_init(&desc->desc_node);
+	spin_unlock_irqrestore(&atchan->lock, flags);
+	atc_chain_complete(atchan, desc);
 
 	/* advance work */
 	spin_lock_irqsave(&atchan->lock, flags);
author maintainer
#187 lore raw

PATCH 184/190 dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit ba2423633ba646e1df20e30cb3cf35495c16f173 upstream.

As it was before, the descriptor was issued to the hardware without adding it to the active (issued) list. This could result in a completion of other descriptor, or/and in the descriptor never being completed.

---
 drivers/dma/at_hdmac.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/dma/at_hdmac.c +11 -4
@@ -510,8 +510,11 @@ static void atc_advance_work(struct at_d
 
 	/* advance work */
 	spin_lock_irqsave(&atchan->lock, flags);
-	if (!list_empty(&atchan->active_list))
-		atc_dostart(atchan, atc_first_active(atchan));
+	if (!list_empty(&atchan->active_list)) {
+		desc = atc_first_queued(atchan);
+		list_move_tail(&desc->desc_node, &atchan->active_list);
+		atc_dostart(atchan, desc);
+	}
 	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
@@ -523,6 +526,7 @@ static void atc_advance_work(struct at_d
 static void atc_handle_error(struct at_dma_chan *atchan)
 {
 	struct at_desc *bad_desc;
+	struct at_desc *desc;
 	struct at_desc *child;
 	unsigned long flags;
 
@@ -540,8 +544,11 @@ static void atc_handle_error(struct at_d
 	list_splice_init(&atchan->queue, atchan->active_list.prev);
 
 	/* Try to restart the controller */
-	if (!list_empty(&atchan->active_list))
-		atc_dostart(atchan, atc_first_active(atchan));
+	if (!list_empty(&atchan->active_list)) {
+		desc = atc_first_queued(atchan);
+		list_move_tail(&desc->desc_node, &atchan->active_list);
+		atc_dostart(atchan, desc);
+	}
 
 	/*
 	 * KERN_CRITICAL may seem harsh, but since this only happens
author maintainer
#188 lore raw

PATCH 185/190 dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit ef2cb4f0ce479f77607b04c4b0414bf32f863ee8 upstream.

In case the controller detected an error, the code took the chance to move all the queued (submitted) descriptors to the active (issued) list. This was wrong as if there were any descriptors in the submitted list they were moved to the issued list without actually issuing them to the controller, thus a completion could be raised without even fireing the descriptor.

---
 drivers/dma/at_hdmac.c |    4 ----
 1 file changed, 4 deletions(-)
drivers/dma/at_hdmac.c +0 -4
@@ -539,10 +539,6 @@ static void atc_handle_error(struct at_d
 	bad_desc = atc_first_active(atchan);
 	list_del_init(&bad_desc->desc_node);
 
-	/* As we are stopped, take advantage to push queued descriptors
-	 * in active_list */
-	list_splice_init(&atchan->queue, atchan->active_list.prev);
-
 	/* Try to restart the controller */
 	if (!list_empty(&atchan->active_list)) {
 		desc = atc_first_queued(atchan);
author maintainer
#189 lore raw

PATCH 186/190 dmaengine: at_hdmac: Dont allow CPU to reorder channel enable

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 580ee84405c27d6ed419abe4d2b3de1968abdafd upstream.

at_hdmac uses __raw_writel for register writes. In the absence of a barrier, the CPU may reorder the register operations. Introduce a write memory barrier so that the CPU does not reorder the channel enable, thus the start of the transfer, without making sure that all the pre-required register fields are already written.

---
 drivers/dma/at_hdmac.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/dma/at_hdmac.c +2 -0
@@ -256,6 +256,8 @@ static void atc_dostart(struct at_dma_ch
 		       ATC_SPIP_BOUNDARY(first->boundary));
 	channel_writel(atchan, DPIP, ATC_DPIP_HOLE(first->dst_hole) |
 		       ATC_DPIP_BOUNDARY(first->boundary));
+	/* Don't allow CPU to reorder channel enable. */
+	wmb();
 	dma_writel(atdma, CHER, atchan->mask);
 
 	vdbg_dump_regs(atchan);
author maintainer
#190 lore raw

PATCH 187/190 dmaengine: at_hdmac: Fix impossible condition

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 28cbe5a0a46a6637adbda52337d7b2777fc04027 upstream.

The iterator can not be greater than ATC_MAX_DSCR_TRIALS, as the for loop will stop when i == ATC_MAX_DSCR_TRIALS. While here, use the common "i" name for the iterator.

---
 drivers/dma/at_hdmac.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/dma/at_hdmac.c +4 -3
@@ -318,7 +318,8 @@ static int atc_get_bytes_left(struct dma
 	struct at_desc *desc_first = atc_first_active(atchan);
 	struct at_desc *desc;
 	int ret;
-	u32 ctrla, dscr, trials;
+	u32 ctrla, dscr;
+	unsigned int i;
 
 	/*
 	 * If the cookie doesn't match to the currently running transfer then
@@ -388,7 +389,7 @@ static int atc_get_bytes_left(struct dma
 		dscr = channel_readl(atchan, DSCR);
 		rmb(); /* ensure DSCR is read before CTRLA */
 		ctrla = channel_readl(atchan, CTRLA);
-		for (trials = 0; trials < ATC_MAX_DSCR_TRIALS; ++trials) {
+		for (i = 0; i < ATC_MAX_DSCR_TRIALS; ++i) {
 			u32 new_dscr;
 
 			rmb(); /* ensure DSCR is read after CTRLA */
@@ -414,7 +415,7 @@ static int atc_get_bytes_left(struct dma
 			rmb(); /* ensure DSCR is read before CTRLA */
 			ctrla = channel_readl(atchan, CTRLA);
 		}
-		if (unlikely(trials >= ATC_MAX_DSCR_TRIALS))
+		if (unlikely(i == ATC_MAX_DSCR_TRIALS))
 			return -ETIMEDOUT;
 
 		/* for the first descriptor we can be more accurate */
author maintainer
#173 lore raw

PATCH 170/190 KVM: SVM: Only dump VMSA to klog at KERN_DEBUG level

In reply to Greg Kroah-Hartman

From: Peter Gonda <[email protected]>

commit 0bd8bd2f7a789fe1dcb21ad148199d2f62d79873 upstream.

Explicitly print the VMSA dump at KERN_DEBUG log level, KERN_CONT uses KERNEL_DEFAULT if the previous log line has a newline, i.e. if there's nothing to continuing, and as a result the VMSA gets dumped when it shouldn't.

The KERN_CONT documentation says it defaults back to KERNL_DEFAULT if the previous log line has a newline. So switch from KERN_CONT to print_hex_dump_debug().

Jarkko pointed this out in reference to the original patch. See:
https://lore.kernel.org/all/[email protected]/
print_hex_dump(KERN_DEBUG, ...) was pointed out there, but print_hex_dump_debug() should similar.

Fixes 6fac42f127b8 ("KVM: SVM: Dump Virtual Machine Save Area (VMSA) to klog")
Cc Jarkko Sakkinen <[email protected]>
Cc Harald Hoyer <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>

Message-Id: <[email protected]>

---
 arch/x86/kvm/svm/sev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/sev.c +1 -1
@@ -605,7 +605,7 @@ static int sev_es_sync_vmsa(struct vcpu_
 	save->dr6  = svm->vcpu.arch.dr6;
 
 	pr_debug("Virtual Machine Save Area (VMSA):\n");
-	print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
+	print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, save, sizeof(*save), false);
 
 	return 0;
 }
author maintainer
#191 lore raw

PATCH 188/190 dmaengine: at_hdmac: Check return code of dma_async_device_register

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit c47e6403fa099f200868d6b106701cb42d181d2b upstream.

dma_async_device_register() can fail, check the return code and display an error.

---
 drivers/dma/at_hdmac.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/dma/at_hdmac.c +6 -1
@@ -1928,7 +1928,11 @@ static int __init at_dma_probe(struct pl
 	  dma_has_cap(DMA_SLAVE, atdma->dma_common.cap_mask)  ? "slave " : "",
 	  plat_dat->nr_channels);
 
-	dma_async_device_register(&atdma->dma_common);
+	err = dma_async_device_register(&atdma->dma_common);
+	if (err) {
+		dev_err(&pdev->dev, "Unable to register: %d.\n", err);
+		goto err_dma_async_device_register;
+	}
 
 	/*
 	 * Do not return an error if the dmac node is not present in order to
@@ -1948,6 +1952,7 @@ static int __init at_dma_probe(struct pl
 
 err_of_dma_controller_register:
 	dma_async_device_unregister(&atdma->dma_common);
+err_dma_async_device_register:
 	dma_pool_destroy(atdma->memset_pool);
 err_memset_pool_create:
 	dma_pool_destroy(atdma->dma_desc_pool);
author maintainer
#192 lore raw

PATCH 189/190 drm/amdkfd: Migrate in CPU page fault use current mm

In reply to Greg Kroah-Hartman

From: Philip Yang <[email protected]>

commit 3a876060892ba52dd67d197c78b955e62657d906 upstream.

migrate_vma_setup shows below warning because we don't hold another process mm mmap_lock. We should use current vmf->vma->vm_mm instead, the caller already hold current mmap lock inside CPU page fault handler.

 WARNING: CPU: 10 PID: 3054 at include/linux/mmap_lock.h:155 find_vma
 Call Trace:
  walk_page_range+0x76/0x150
  migrate_vma_setup+0x18a/0x640
  svm_migrate_vram_to_ram+0x245/0xa10 [amdgpu]
  svm_migrate_to_ram+0x36f/0x470 [amdgpu]
  do_swap_page+0xcfe/0xec0
  __handle_mm_fault+0x96b/0x15e0
  handle_mm_fault+0x13f/0x3e0
  do_user_addr_fault+0x1e7/0x690
Fixes e1f84eef313f ("drm/amdkfd: handle CPU fault on COW mapping")
---
 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +2 -1
@@ -951,7 +951,8 @@ static vm_fault_t svm_migrate_to_ram(str
 		goto out_unlock_prange;
 	}
 
-	r = svm_migrate_vram_to_ram(prange, mm, KFD_MIGRATE_TRIGGER_PAGEFAULT_CPU);
+	r = svm_migrate_vram_to_ram(prange, vmf->vma->vm_mm,
+				    KFD_MIGRATE_TRIGGER_PAGEFAULT_CPU);
 	if (r)
 		pr_debug("failed %d migrate svms 0x%p range 0x%p [0x%lx 0x%lx]\n",
 			 r, prange->svms, prange, prange->start, prange->last);
author maintainer
#193 lore raw

PATCH 190/190 ALSA: memalloc: Try dma_alloc_noncontiguous() at first

In reply to Greg Kroah-Hartman

From: Takashi Iwai <[email protected]>

commit 9d8e536d36e75e76614fe09ffab9a1df95b8b666 upstream.

The latest fix for the non-contiguous memalloc helper changed the allocation method for a non-IOMMU system to use only the fallback allocator. This should have worked, but it caused a problem sometimes when too many non-contiguous pages are allocated that can't be treated by HD-audio controller.

As a quirk workaround, go back to the original strategy: use dma_alloc_noncontiguous() at first, and apply the fallback only when it fails, but only for non-IOMMU case.

We'll need a better fix in the fallback code as well, but this workaround should paper over most cases.

---
 sound/core/memalloc.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/core/memalloc.c +3 -4
@@ -527,8 +527,10 @@ static void *snd_dma_noncontig_alloc(str
 	struct sg_table *sgt;
 	void *p;
 
+	sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
+				      DEFAULT_GFP, 0);
 #ifdef CONFIG_SND_DMA_SGBUF
-	if (!get_dma_ops(dmab->dev.dev)) {
+	if (!sgt && !get_dma_ops(dmab->dev.dev)) {
 		if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
 			dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
 		else
@@ -536,9 +538,6 @@ static void *snd_dma_noncontig_alloc(str
 		return snd_dma_sg_fallback_alloc(dmab, size);
 	}
 #endif
-
-	sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
-				      DEFAULT_GFP, 0);
 	if (!sgt)
 		return NULL;
 
author maintainer
#174 lore raw

PATCH 171/190 KVM: SVM: retrieve VMCB from assembly

In reply to Greg Kroah-Hartman

From: Paolo Bonzini <[email protected]>

commit f6d58266d731fd7e63163790aad21e0dbb1d5264 upstream.

Continue moving accesses to struct vcpu_svm to vmenter.S. Reducing the number of arguments limits the chance of mistakes due to different registers used for argument passing in 32- and 64-bit ABIs; pushing the VMCB argument and almost immediately popping it into a different register looks pretty weird.

32-bit ABI is not a concern for __svm_sev_es_vcpu_run() which is 64-bit only; however, it will soon need @svm to save/restore SPEC_CTRL so stay consistent with __svm_vcpu_run() and let them share the same prototype.

No functional change intended.

Fixes a149180fbcf3 ("x86: Add magic AMD return-thunk")
---
 arch/x86/kvm/kvm-asm-offsets.c |    2 ++
 arch/x86/kvm/svm/svm.c         |    5 ++---
 arch/x86/kvm/svm/svm.h         |    4 ++--
 arch/x86/kvm/svm/vmenter.S     |   20 ++++++++++----------
 4 files changed, 16 insertions(+), 15 deletions(-)
arch/x86/kvm/kvm-asm-offsets.c +2 -0
@@ -15,6 +15,8 @@ static void __used common(void)
 	if (IS_ENABLED(CONFIG_KVM_AMD)) {
 		BLANK();
 		OFFSET(SVM_vcpu_arch_regs, vcpu_svm, vcpu.arch.regs);
+		OFFSET(SVM_current_vmcb, vcpu_svm, current_vmcb);
+		OFFSET(KVM_VMCB_pa, kvm_vmcb_info, pa);
 	}
 
 	if (IS_ENABLED(CONFIG_KVM_INTEL)) {
arch/x86/kvm/svm/svm.c +2 -3
@@ -3915,12 +3915,11 @@ static fastpath_t svm_exit_handlers_fast
 static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
-	unsigned long vmcb_pa = svm->current_vmcb->pa;
 
 	guest_state_enter_irqoff();
 
 	if (sev_es_guest(vcpu->kvm)) {
-		__svm_sev_es_vcpu_run(vmcb_pa);
+		__svm_sev_es_vcpu_run(svm);
 	} else {
 		struct svm_cpu_data *sd = per_cpu(svm_data, vcpu->cpu);
 
@@ -3931,7 +3930,7 @@ static noinstr void svm_vcpu_enter_exit(
 		 * vmcb02 when switching vmcbs for nested virtualization.
 		 */
 		vmload(svm->vmcb01.pa);
-		__svm_vcpu_run(vmcb_pa, svm);
+		__svm_vcpu_run(svm);
 		vmsave(svm->vmcb01.pa);
 
 		vmload(__sme_page_pa(sd->save_area));
arch/x86/kvm/svm/svm.h +2 -2
@@ -683,7 +683,7 @@ void sev_es_unmap_ghcb(struct vcpu_svm *
 
 /* vmenter.S */
 
-void __svm_sev_es_vcpu_run(unsigned long vmcb_pa);
-void __svm_vcpu_run(unsigned long vmcb_pa, struct vcpu_svm *svm);
+void __svm_sev_es_vcpu_run(struct vcpu_svm *svm);
+void __svm_vcpu_run(struct vcpu_svm *svm);
 
 #endif
arch/x86/kvm/svm/vmenter.S +10 -10
@@ -32,7 +32,6 @@
 
 /**
  * __svm_vcpu_run - Run a vCPU via a transition to SVM guest mode
- * @vmcb_pa:	unsigned long
  * @svm:	struct vcpu_svm *
  */
 SYM_FUNC_START(__svm_vcpu_run)
@@ -49,16 +48,16 @@ SYM_FUNC_START(__svm_vcpu_run)
 	push %_ASM_BX
 
 	/* Save @svm. */
-	push %_ASM_ARG2
-
-	/* Save @vmcb. */
 	push %_ASM_ARG1
 
+.ifnc _ASM_ARG1, _ASM_DI
 	/* Move @svm to RDI. */
-	mov %_ASM_ARG2, %_ASM_DI
+	mov %_ASM_ARG1, %_ASM_DI
+.endif
 
-	/* "POP" @vmcb to RAX. */
-	pop %_ASM_AX
+	/* Get svm->current_vmcb->pa into RAX. */
+	mov SVM_current_vmcb(%_ASM_DI), %_ASM_AX
+	mov KVM_VMCB_pa(%_ASM_AX), %_ASM_AX
 
 	/* Load guest registers. */
 	mov VCPU_RCX(%_ASM_DI), %_ASM_CX
@@ -170,7 +169,7 @@ SYM_FUNC_END(__svm_vcpu_run)
 
 /**
  * __svm_sev_es_vcpu_run - Run a SEV-ES vCPU via a transition to SVM guest mode
- * @vmcb_pa:	unsigned long
+ * @svm:	struct vcpu_svm *
  */
 SYM_FUNC_START(__svm_sev_es_vcpu_run)
 	push %_ASM_BP
@@ -185,8 +184,9 @@ SYM_FUNC_START(__svm_sev_es_vcpu_run)
 #endif
 	push %_ASM_BX
 
-	/* Move @vmcb to RAX. */
-	mov %_ASM_ARG1, %_ASM_AX
+	/* Get svm->current_vmcb->pa into RAX. */
+	mov SVM_current_vmcb(%_ASM_ARG1), %_ASM_AX
+	mov KVM_VMCB_pa(%_ASM_AX), %_ASM_AX
 
 	/* Enter guest mode */
 	sti
author maintainer
#175 lore raw

PATCH 172/190 KVM: SVM: move guest vmsave/vmload back to assembly

In reply to Greg Kroah-Hartman

From: Paolo Bonzini <[email protected]>

commit e61ab42de874c5af8c5d98b327c77a374d9e7da1 upstream.

It is error-prone that code after vmexit cannot access percpu data because GSBASE has not been restored yet. It forces MSR_IA32_SPEC_CTRL save/restore to happen very late, after the predictor untraining sequence, and it gets in the way of return stack depth tracking (a retbleed mitigation that is in linux-next as of 2022-11-09).

As a first step towards fixing that, move the VMCB VMSAVE/VMLOAD to assembly, essentially undoing commit fb0c4a4fee5a ("KVM: SVM: move VMLOAD/VMSAVE to C code", 2021-03-15). The reason for that commit was that it made it simpler to use a different VMCB for VMLOAD/VMSAVE versus VMRUN; but that is not a big hassle anymore thanks to the kvm-asm-offsets machinery and other related cleanups.

The idea on how to number the exception tables is stolen from a prototype patch by Peter Zijlstra.

---
 arch/x86/kvm/kvm-asm-offsets.c |    1 
 arch/x86/kvm/svm/svm.c         |    9 -------
 arch/x86/kvm/svm/vmenter.S     |   49 +++++++++++++++++++++++++++++++----------
 3 files changed, 39 insertions(+), 20 deletions(-)
arch/x86/kvm/kvm-asm-offsets.c +1 -0
@@ -16,6 +16,7 @@ static void __used common(void)
 		BLANK();
 		OFFSET(SVM_vcpu_arch_regs, vcpu_svm, vcpu.arch.regs);
 		OFFSET(SVM_current_vmcb, vcpu_svm, current_vmcb);
+		OFFSET(SVM_vmcb01, vcpu_svm, vmcb01);
 		OFFSET(KVM_VMCB_pa, kvm_vmcb_info, pa);
 	}
 
arch/x86/kvm/svm/svm.c +0 -9
@@ -3923,16 +3923,7 @@ static noinstr void svm_vcpu_enter_exit(
 	} else {
 		struct svm_cpu_data *sd = per_cpu(svm_data, vcpu->cpu);
 
-		/*
-		 * Use a single vmcb (vmcb01 because it's always valid) for
-		 * context switching guest state via VMLOAD/VMSAVE, that way
-		 * the state doesn't need to be copied between vmcb01 and
-		 * vmcb02 when switching vmcbs for nested virtualization.
-		 */
-		vmload(svm->vmcb01.pa);
 		__svm_vcpu_run(svm);
-		vmsave(svm->vmcb01.pa);
-
 		vmload(__sme_page_pa(sd->save_area));
 	}
 
arch/x86/kvm/svm/vmenter.S +38 -11

83 lines not on this page · raw message

author maintainer
#176 lore raw

PATCH 173/190 can: dev: fix skb drop check

In reply to Greg Kroah-Hartman

From: Oliver Hartkopp <[email protected]>

commit ae64438be1923e3c1102d90fd41db7afcfaf54cc upstream.

In commit a6d190f8c767 ("can: skb: drop tx skb if in listen only mode") the priv->ctrlmode element is read even on virtual CAN interfaces that do not create the struct can_priv at startup. This out-of-bounds read may lead to CAN frame drops for virtual CAN interfaces like vcan and vxcan.

This patch mainly reverts the original commit and adds a new helper for CAN interface drivers that provide the required information in struct can_priv.

Fixes a6d190f8c767 ("can: skb: drop tx skb if in listen only mode")
Cc Vincent Mailhol <[email protected]>
Cc Max Staudt <[email protected]>
[mkl: patch pch_can, too]
---
 drivers/net/can/at91_can.c                       |    2 +-
 drivers/net/can/c_can/c_can_main.c               |    2 +-
 drivers/net/can/can327.c                         |    2 +-
 drivers/net/can/cc770/cc770.c                    |    2 +-
 drivers/net/can/ctucanfd/ctucanfd_base.c         |    2 +-
 drivers/net/can/dev/skb.c                        |    9 +--------
 drivers/net/can/flexcan/flexcan-core.c           |    2 +-
 drivers/net/can/grcan.c                          |    2 +-
 drivers/net/can/ifi_canfd/ifi_canfd.c            |    2 +-
 drivers/net/can/janz-ican3.c                     |    2 +-
 drivers/net/can/kvaser_pciefd.c                  |    2 +-
 drivers/net/can/m_can/m_can.c                    |    2 +-
 drivers/net/can/mscan/mscan.c                    |    2 +-
 drivers/net/can/pch_can.c                        |    2 +-
 drivers/net/can/peak_canfd/peak_canfd.c          |    2 +-
 drivers/net/can/rcar/rcar_can.c                  |    2 +-
 drivers/net/can/rcar/rcar_canfd.c                |    2 +-
 drivers/net/can/sja1000/sja1000.c                |    2 +-
 drivers/net/can/slcan/slcan-core.c               |    2 +-
 drivers/net/can/softing/softing_main.c           |    2 +-
 drivers/net/can/spi/hi311x.c                     |    2 +-
 drivers/net/can/spi/mcp251x.c                    |    2 +-
 drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c     |    2 +-
 drivers/net/can/sun4i_can.c                      |    2 +-
 drivers/net/can/ti_hecc.c                        |    2 +-
 drivers/net/can/usb/ems_usb.c                    |    2 +-
 drivers/net/can/usb/esd_usb.c                    |    2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c      |    2 +-
 drivers/net/can/usb/gs_usb.c                     |    2 +-
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c |    2 +-
 drivers/net/can/usb/mcba_usb.c                   |    2 +-
 drivers/net/can/usb/peak_usb/pcan_usb_core.c     |    2 +-
 drivers/net/can/usb/ucan.c                       |    2 +-
 drivers/net/can/usb/usb_8dev.c                   |    2 +-
 drivers/net/can/xilinx_can.c                     |    2 +-
 include/linux/can/dev.h                          |   16 ++++++++++++++++
 36 files changed, 51 insertions(+), 42 deletions(-)
drivers/net/can/at91_can.c +1 -1
@@ -452,7 +452,7 @@ static netdev_tx_t at91_start_xmit(struc
 	unsigned int mb, prio;
 	u32 reg_mid, reg_mcr;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	mb = get_tx_next_mb(priv);
drivers/net/can/c_can/c_can_main.c +1 -1
@@ -457,7 +457,7 @@ static netdev_tx_t c_can_start_xmit(stru
 	struct c_can_tx_ring *tx_ring = &priv->tx;
 	u32 idx, obj, cmd = IF_COMM_TX;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	if (c_can_tx_busy(priv, tx_ring))
drivers/net/can/can327.c +1 -1
@@ -813,7 +813,7 @@ static netdev_tx_t can327_netdev_start_x
 	struct can327 *elm = netdev_priv(dev);
 	struct can_frame *frame = (struct can_frame *)skb->data;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	/* We shouldn't get here after a hardware fault:
drivers/net/can/cc770/cc770.c +1 -1
@@ -429,7 +429,7 @@ static netdev_tx_t cc770_start_xmit(stru
 	struct cc770_priv *priv = netdev_priv(dev);
 	unsigned int mo = obj2msgobj(CC770_OBJ_TX);
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	netif_stop_queue(dev);
drivers/net/can/ctucanfd/ctucanfd_base.c +1 -1
@@ -600,7 +600,7 @@ static netdev_tx_t ctucan_start_xmit(str
 	bool ok;
 	unsigned long flags;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	if (unlikely(!CTU_CAN_FD_TXTNF(priv))) {
drivers/net/can/dev/skb.c +1 -8
@@ -5,7 +5,6 @@
  */
 
 #include <linux/can/dev.h>
-#include <linux/can/netlink.h>
 #include <linux/module.h>
 
 #define MOD_DESC "CAN device driver interface"
@@ -300,7 +299,6 @@ static bool can_skb_headroom_valid(struc
 bool can_dropped_invalid_skb(struct net_device *dev, struct sk_buff *skb)
 {
 	const struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
-	struct can_priv *priv = netdev_priv(dev);
 
 	if (skb->protocol == htons(ETH_P_CAN)) {
 		if (unlikely(skb->len != CAN_MTU ||
@@ -314,13 +312,8 @@ bool can_dropped_invalid_skb(struct net_
 		goto inval_skb;
 	}
 
-	if (!can_skb_headroom_valid(dev, skb)) {
-		goto inval_skb;
-	} else if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) {
-		netdev_info_once(dev,
-				 "interface in listen only mode, dropping skb\n");
+	if (!can_skb_headroom_valid(dev, skb))
 		goto inval_skb;
-	}
 
 	return false;
 
drivers/net/can/flexcan/flexcan-core.c +1 -1
@@ -742,7 +742,7 @@ static netdev_tx_t flexcan_start_xmit(st
 	u32 ctrl = FLEXCAN_MB_CODE_TX_DATA | ((can_fd_len2dlc(cfd->len)) << 16);
 	int i;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	netif_stop_queue(dev);
drivers/net/can/grcan.c +1 -1
@@ -1345,7 +1345,7 @@ static netdev_tx_t grcan_start_xmit(stru
 	unsigned long flags;
 	u32 oneshotmode = priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	/* Trying to transmit in silent mode will generate error interrupts, but
drivers/net/can/ifi_canfd/ifi_canfd.c +1 -1
@@ -860,7 +860,7 @@ static netdev_tx_t ifi_canfd_start_xmit(
 	u32 txst, txid, txdlc;
 	int i;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	/* Check if the TX buffer is full */
drivers/net/can/janz-ican3.c +1 -1
@@ -1693,7 +1693,7 @@ static netdev_tx_t ican3_xmit(struct sk_
 	void __iomem *desc_addr;
 	unsigned long flags;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	spin_lock_irqsave(&mod->lock, flags);
drivers/net/can/kvaser_pciefd.c +1 -1
@@ -775,7 +775,7 @@ static netdev_tx_t kvaser_pciefd_start_x
 	int nwords;
 	u8 count;
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	nwords = kvaser_pciefd_prepare_tx_packet(&packet, can, skb);
drivers/net/can/m_can/m_can.c +1 -1
@@ -1722,7 +1722,7 @@ static netdev_tx_t m_can_start_xmit(stru
 {
 	struct m_can_classdev *cdev = netdev_priv(dev);
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	if (cdev->is_peripheral) {
drivers/net/can/mscan/mscan.c +1 -1
@@ -191,7 +191,7 @@ static netdev_tx_t mscan_start_xmit(stru
 	int i, rtr, buf_id;
 	u32 can_id;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	out_8(&regs->cantier, 0);
drivers/net/can/pch_can.c +1 -1
@@ -882,7 +882,7 @@ static netdev_tx_t pch_xmit(struct sk_bu
 	int i;
 	u32 id2;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	tx_obj_no = priv->tx_obj;
drivers/net/can/peak_canfd/peak_canfd.c +1 -1
@@ -651,7 +651,7 @@ static netdev_tx_t peak_canfd_start_xmit
 	int room_left;
 	u8 len;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	msg_size = ALIGN(sizeof(*msg) + cf->len, 4);
drivers/net/can/rcar/rcar_can.c +1 -1
@@ -590,7 +590,7 @@ static netdev_tx_t rcar_can_start_xmit(s
 	struct can_frame *cf = (struct can_frame *)skb->data;
 	u32 data, i;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	if (cf->can_id & CAN_EFF_FLAG)	/* Extended frame format */
drivers/net/can/rcar/rcar_canfd.c +1 -1
@@ -1476,7 +1476,7 @@ static netdev_tx_t rcar_canfd_start_xmit
 	unsigned long flags;
 	u32 ch = priv->channel;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	if (cf->can_id & CAN_EFF_FLAG) {
drivers/net/can/sja1000/sja1000.c +1 -1
@@ -291,7 +291,7 @@ static netdev_tx_t sja1000_start_xmit(st
 	u8 cmd_reg_val = 0x00;
 	int i;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	netif_stop_queue(dev);
drivers/net/can/slcan/slcan-core.c +1 -1
@@ -594,7 +594,7 @@ static netdev_tx_t slcan_netdev_xmit(str
 {
 	struct slcan *sl = netdev_priv(dev);
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	spin_lock(&sl->lock);
drivers/net/can/softing/softing_main.c +1 -1
@@ -60,7 +60,7 @@ static netdev_tx_t softing_netdev_start_
 	struct can_frame *cf = (struct can_frame *)skb->data;
 	uint8_t buf[DPRAM_TX_SIZE];
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	spin_lock(&card->spin);
drivers/net/can/spi/hi311x.c +1 -1
@@ -373,7 +373,7 @@ static netdev_tx_t hi3110_hard_start_xmi
 		return NETDEV_TX_BUSY;
 	}
 
-	if (can_dropped_invalid_skb(net, skb))
+	if (can_dev_dropped_skb(net, skb))
 		return NETDEV_TX_OK;
 
 	netif_stop_queue(net);
drivers/net/can/spi/mcp251x.c +1 -1
@@ -789,7 +789,7 @@ static netdev_tx_t mcp251x_hard_start_xm
 		return NETDEV_TX_BUSY;
 	}
 
-	if (can_dropped_invalid_skb(net, skb))
+	if (can_dev_dropped_skb(net, skb))
 		return NETDEV_TX_OK;
 
 	netif_stop_queue(net);
drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c +1 -1
@@ -172,7 +172,7 @@ netdev_tx_t mcp251xfd_start_xmit(struct
 	u8 tx_head;
 	int err;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	if (mcp251xfd_tx_busy(priv, tx_ring))
drivers/net/can/sun4i_can.c +1 -1
@@ -429,7 +429,7 @@ static netdev_tx_t sun4ican_start_xmit(s
 	canid_t id;
 	int i;
 
-	if (can_dropped_invalid_skb(dev, skb))
+	if (can_dev_dropped_skb(dev, skb))
 		return NETDEV_TX_OK;
 
 	netif_stop_queue(dev);
drivers/net/can/ti_hecc.c +1 -1
@@ -470,7 +470,7 @@ static netdev_tx_t ti_hecc_xmit(struct s
 	u32 mbxno, mbx_mask, data;
 	unsigned long flags;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	mbxno = get_tx_head_mb(priv);
drivers/net/can/usb/ems_usb.c +1 -1
@@ -747,7 +747,7 @@ static netdev_tx_t ems_usb_start_xmit(st
 	size_t size = CPC_HEADER_SIZE + CPC_MSG_HEADER_LEN
 			+ sizeof(struct cpc_can_msg);
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	/* create a URB, and a buffer for it, and copy the data to the URB */
drivers/net/can/usb/esd_usb.c +1 -1
@@ -725,7 +725,7 @@ static netdev_tx_t esd_usb_start_xmit(st
 	int ret = NETDEV_TX_OK;
 	size_t size = sizeof(struct esd_usb_msg);
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	/* create a URB, and a buffer for it, and copy the data to the URB */
drivers/net/can/usb/etas_es58x/es58x_core.c +1 -1
@@ -1913,7 +1913,7 @@ static netdev_tx_t es58x_start_xmit(stru
 	unsigned int frame_len;
 	int ret;
 
-	if (can_dropped_invalid_skb(netdev, skb)) {
+	if (can_dev_dropped_skb(netdev, skb)) {
 		if (priv->tx_urb)
 			goto xmit_commit;
 		return NETDEV_TX_OK;
drivers/net/can/usb/gs_usb.c +1 -1
@@ -605,7 +605,7 @@ static netdev_tx_t gs_can_start_xmit(str
 	unsigned int idx;
 	struct gs_tx_context *txc;
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	/* find an empty context to keep track of transmission */
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -1
@@ -570,7 +570,7 @@ static netdev_tx_t kvaser_usb_start_xmit
 	unsigned int i;
 	unsigned long flags;
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	urb = usb_alloc_urb(0, GFP_ATOMIC);
drivers/net/can/usb/mcba_usb.c +1 -1
@@ -311,7 +311,7 @@ static netdev_tx_t mcba_usb_start_xmit(s
 		.cmd_id = MBCA_CMD_TRANSMIT_MESSAGE_EV
 	};
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	ctx = mcba_usb_get_free_ctx(priv, cf);
drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 -1
@@ -351,7 +351,7 @@ static netdev_tx_t peak_usb_ndo_start_xm
 	int i, err;
 	size_t size = dev->adapter->tx_buffer_size;
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	for (i = 0; i < PCAN_USB_MAX_TX_URBS; i++)
drivers/net/can/usb/ucan.c +1 -1
@@ -1120,7 +1120,7 @@ static netdev_tx_t ucan_start_xmit(struc
 	struct can_frame *cf = (struct can_frame *)skb->data;
 
 	/* check skb */
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	/* allocate a context and slow down tx path, if fifo state is low */
drivers/net/can/usb/usb_8dev.c +1 -1
@@ -602,7 +602,7 @@ static netdev_tx_t usb_8dev_start_xmit(s
 	int i, err;
 	size_t size = sizeof(struct usb_8dev_tx_msg);
 
-	if (can_dropped_invalid_skb(netdev, skb))
+	if (can_dev_dropped_skb(netdev, skb))
 		return NETDEV_TX_OK;
 
 	/* create a URB, and a buffer for it, and copy the data to the URB */
drivers/net/can/xilinx_can.c +1 -1
@@ -743,7 +743,7 @@ static netdev_tx_t xcan_start_xmit(struc
 	struct xcan_priv *priv = netdev_priv(ndev);
 	int ret;
 
-	if (can_dropped_invalid_skb(ndev, skb))
+	if (can_dev_dropped_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
 	if (priv->devtype.flags & XCAN_FLAG_TX_MAILBOXES)
include/linux/can/dev.h +16 -0
@@ -147,6 +147,22 @@ static inline u32 can_get_static_ctrlmod
 	return priv->ctrlmode & ~priv->ctrlmode_supported;
 }
 
+/* drop skb if it does not contain a valid CAN frame for sending */
+static inline bool can_dev_dropped_skb(struct net_device *dev, struct sk_buff *skb)
+{
+	struct can_priv *priv = netdev_priv(dev);
+
+	if (priv->ctrlmode & CAN_CTRLMODE_LISTENONLY) {
+		netdev_info_once(dev,
+				 "interface in listen only mode, dropping skb\n");
+		kfree_skb(skb);
+		dev->stats.tx_dropped++;
+		return true;
+	}
+
+	return can_dropped_invalid_skb(dev, skb);
+}
+
 void can_setup(struct net_device *dev);
 
 struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
author maintainer
#177 lore raw

PATCH 174/190 dmaengine: at_hdmac: Fix at_lli struct definition

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit f1171bbdd2ba2a50ee64bb198a78c268a5baf5f1 upstream.

Those hardware registers are all of 32 bits, while dma_addr_t ca be of type u64 or u32 depending on CONFIG_ARCH_DMA_ADDR_T_64BIT. Force u32 to comply with what the hardware expects.

---
 drivers/dma/at_hdmac_regs.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/dma/at_hdmac_regs.h +5 -5
@@ -186,13 +186,13 @@
 /* LLI == Linked List Item; aka DMA buffer descriptor */
 struct at_lli {
 	/* values that are not changed by hardware */
-	dma_addr_t	saddr;
-	dma_addr_t	daddr;
+	u32 saddr;
+	u32 daddr;
 	/* value that may get written back: */
-	u32		ctrla;
+	u32 ctrla;
 	/* more values that are not changed by hardware */
-	u32		ctrlb;
-	dma_addr_t	dscr;	/* chain to next lli */
+	u32 ctrlb;
+	u32 dscr;	/* chain to next lli */
 };
 
 /**
author maintainer
#178 lore raw

PATCH 175/190 dmaengine: at_hdmac: Dont start transactions at tx_submit level

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 7176a6a8982d311e50a7c1168868d26e65bbba19 upstream.

tx_submit is supposed to push the current transaction descriptor to a pending queue, waiting for issue_pending() to be called. issue_pending() must start the transfer, not tx_submit(), thus remove atc_dostart() from atc_tx_submit(). Clients of at_xdmac that assume that tx_submit() starts the transfer must be updated and call dma_async_issue_pending() if they miss to call it.
The vdbg print was moved to after the lock is released. It is desirable to do the prints without the lock held if possible, and because the if statement disappears there's no reason why to do the print while holding the lock.

---
 drivers/dma/at_hdmac.c |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/dma/at_hdmac.c +3 -11
@@ -691,19 +691,11 @@ static dma_cookie_t atc_tx_submit(struct
 	spin_lock_irqsave(&atchan->lock, flags);
 	cookie = dma_cookie_assign(tx);
 
-	if (list_empty(&atchan->active_list)) {
-		dev_vdbg(chan2dev(tx->chan), "tx_submit: started %u\n",
-				desc->txd.cookie);
-		atc_dostart(atchan, desc);
-		list_add_tail(&desc->desc_node, &atchan->active_list);
-	} else {
-		dev_vdbg(chan2dev(tx->chan), "tx_submit: queued %u\n",
-				desc->txd.cookie);
-		list_add_tail(&desc->desc_node, &atchan->queue);
-	}
-
+	list_add_tail(&desc->desc_node, &atchan->queue);
 	spin_unlock_irqrestore(&atchan->lock, flags);
 
+	dev_vdbg(chan2dev(tx->chan), "tx_submit: queued %u\n",
+		 desc->txd.cookie);
 	return cookie;
 }
 
author maintainer
#179 lore raw

PATCH 176/190 dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit 8a47221fc28417ff8a32a4f92d4448a56c3cf7e1 upstream.

Cyclic channels must too call issue_pending in order to start a transfer. Start the transfer in issue_pending regardless of the type of channel. This wrongly worked before, because in the past the transfer was started at tx_submit level when only a desc in the transfer list.

---
 drivers/dma/at_hdmac.c |    4 ----
 1 file changed, 4 deletions(-)
drivers/dma/at_hdmac.c +0 -4
@@ -1536,10 +1536,6 @@ static void atc_issue_pending(struct dma
 
 	dev_vdbg(chan2dev(chan), "issue_pending\n");
 
-	/* Not needed for cyclic transfers */
-	if (atc_chan_is_cyclic(atchan))
-		return;
-
 	atc_advance_work(atchan);
 }
 
author maintainer
#180 lore raw

PATCH 177/190 dmaengine: at_hdmac: Fix premature completion of desc in issue_pending

In reply to Greg Kroah-Hartman

From: Tudor Ambarus <[email protected]>

commit fcd37565efdaffeac179d0f0ce980ac79bfdf569 upstream.

Multiple calls to atc_issue_pending() could result in a premature completion of a descriptor from the atchan->active list, as the method always completed the first active descriptor from the list. Instead, issue_pending() should just take the first transaction descriptor from the pending queue, move it to active_list and start the transfer.

---
 drivers/dma/at_hdmac.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/dma/at_hdmac.c +13 -3
@@ -1527,16 +1527,26 @@ atc_tx_status(struct dma_chan *chan,
 }
 
 /**
- * atc_issue_pending - try to finish work
+ * atc_issue_pending - takes the first transaction descriptor in the pending
+ * queue and starts the transfer.
  * @chan: target DMA channel
  */
 static void atc_issue_pending(struct dma_chan *chan)
 {
-	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
+	struct at_dma_chan *atchan = to_at_dma_chan(chan);
+	struct at_desc *desc;
+	unsigned long flags;
 
 	dev_vdbg(chan2dev(chan), "issue_pending\n");
 
-	atc_advance_work(atchan);
+	spin_lock_irqsave(&atchan->lock, flags);
+	if (atc_chan_is_enabled(atchan) || list_empty(&atchan->queue))
+		return spin_unlock_irqrestore(&atchan->lock, flags);
+
+	desc = atc_first_queued(atchan);
+	list_move_tail(&desc->desc_node, &atchan->active_list);
+	atc_dostart(atchan, desc);
+	spin_unlock_irqrestore(&atchan->lock, flags);
 }
 
 /**
author maintainer
#171 lore raw

PATCH 168/190 KVM: SVM: replace regs argument of __svm_vcpu_run() with vcpu_svm

In reply to Greg Kroah-Hartman

From: Paolo Bonzini <[email protected]>

commit 16fdc1de169ee0a4e59a8c02244414ec7acd55c3 upstream.

Since registers are reachable through vcpu_svm, and we will need to access more fields of that struct, pass it instead of the regs[] array.

No functional change intended.

Fixes a149180fbcf3 ("x86: Add magic AMD return-thunk")
---
 arch/x86/kvm/Makefile          |    3 +++
 arch/x86/kvm/kvm-asm-offsets.c |    6 ++++++
 arch/x86/kvm/svm/svm.c         |    2 +-
 arch/x86/kvm/svm/svm.h         |    2 +-
 arch/x86/kvm/svm/vmenter.S     |   37 +++++++++++++++++++------------------
 5 files changed, 30 insertions(+), 20 deletions(-)
arch/x86/kvm/Makefile +3 -0
@@ -35,6 +35,9 @@ obj-$(CONFIG_KVM)	+= kvm.o
 obj-$(CONFIG_KVM_INTEL)	+= kvm-intel.o
 obj-$(CONFIG_KVM_AMD)	+= kvm-amd.o
 
+AFLAGS_svm/vmenter.o    := -iquote $(obj)
+$(obj)/svm/vmenter.o: $(obj)/kvm-asm-offsets.h
+
 AFLAGS_vmx/vmenter.o    := -iquote $(obj)
 $(obj)/vmx/vmenter.o: $(obj)/kvm-asm-offsets.h
 
arch/x86/kvm/kvm-asm-offsets.c +6 -0
@@ -8,9 +8,15 @@
 
 #include <linux/kbuild.h>
 #include "vmx/vmx.h"
+#include "svm/svm.h"
 
 static void __used common(void)
 {
+	if (IS_ENABLED(CONFIG_KVM_AMD)) {
+		BLANK();
+		OFFSET(SVM_vcpu_arch_regs, vcpu_svm, vcpu.arch.regs);
+	}
+
 	if (IS_ENABLED(CONFIG_KVM_INTEL)) {
 		BLANK();
 		OFFSET(VMX_spec_ctrl, vcpu_vmx, spec_ctrl);
arch/x86/kvm/svm/svm.c +1 -1
@@ -3931,7 +3931,7 @@ static noinstr void svm_vcpu_enter_exit(
 		 * vmcb02 when switching vmcbs for nested virtualization.
 		 */
 		vmload(svm->vmcb01.pa);
-		__svm_vcpu_run(vmcb_pa, (unsigned long *)&vcpu->arch.regs);
+		__svm_vcpu_run(vmcb_pa, svm);
 		vmsave(svm->vmcb01.pa);
 
 		vmload(__sme_page_pa(sd->save_area));
arch/x86/kvm/svm/svm.h +1 -1
@@ -684,6 +684,6 @@ void sev_es_unmap_ghcb(struct vcpu_svm *
 /* vmenter.S */
 
 void __svm_sev_es_vcpu_run(unsigned long vmcb_pa);
-void __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
+void __svm_vcpu_run(unsigned long vmcb_pa, struct vcpu_svm *svm);
 
 #endif
arch/x86/kvm/svm/vmenter.S +19 -18
@@ -4,27 +4,28 @@
 #include <asm/bitsperlong.h>
 #include <asm/kvm_vcpu_regs.h>
 #include <asm/nospec-branch.h>
+#include "kvm-asm-offsets.h"
 
 #define WORD_SIZE (BITS_PER_LONG / 8)
 
 /* Intentionally omit RAX as it's context switched by hardware */
-#define VCPU_RCX	__VCPU_REGS_RCX * WORD_SIZE
-#define VCPU_RDX	__VCPU_REGS_RDX * WORD_SIZE
-#define VCPU_RBX	__VCPU_REGS_RBX * WORD_SIZE
+#define VCPU_RCX	(SVM_vcpu_arch_regs + __VCPU_REGS_RCX * WORD_SIZE)
+#define VCPU_RDX	(SVM_vcpu_arch_regs + __VCPU_REGS_RDX * WORD_SIZE)
+#define VCPU_RBX	(SVM_vcpu_arch_regs + __VCPU_REGS_RBX * WORD_SIZE)
 /* Intentionally omit RSP as it's context switched by hardware */
-#define VCPU_RBP	__VCPU_REGS_RBP * WORD_SIZE
-#define VCPU_RSI	__VCPU_REGS_RSI * WORD_SIZE
-#define VCPU_RDI	__VCPU_REGS_RDI * WORD_SIZE
+#define VCPU_RBP	(SVM_vcpu_arch_regs + __VCPU_REGS_RBP * WORD_SIZE)
+#define VCPU_RSI	(SVM_vcpu_arch_regs + __VCPU_REGS_RSI * WORD_SIZE)
+#define VCPU_RDI	(SVM_vcpu_arch_regs + __VCPU_REGS_RDI * WORD_SIZE)
 
 #ifdef CONFIG_X86_64
-#define VCPU_R8		__VCPU_REGS_R8  * WORD_SIZE
-#define VCPU_R9		__VCPU_REGS_R9  * WORD_SIZE
-#define VCPU_R10	__VCPU_REGS_R10 * WORD_SIZE
-#define VCPU_R11	__VCPU_REGS_R11 * WORD_SIZE
-#define VCPU_R12	__VCPU_REGS_R12 * WORD_SIZE
-#define VCPU_R13	__VCPU_REGS_R13 * WORD_SIZE
-#define VCPU_R14	__VCPU_REGS_R14 * WORD_SIZE
-#define VCPU_R15	__VCPU_REGS_R15 * WORD_SIZE
+#define VCPU_R8		(SVM_vcpu_arch_regs + __VCPU_REGS_R8  * WORD_SIZE)
+#define VCPU_R9		(SVM_vcpu_arch_regs + __VCPU_REGS_R9  * WORD_SIZE)
+#define VCPU_R10	(SVM_vcpu_arch_regs + __VCPU_REGS_R10 * WORD_SIZE)
+#define VCPU_R11	(SVM_vcpu_arch_regs + __VCPU_REGS_R11 * WORD_SIZE)
+#define VCPU_R12	(SVM_vcpu_arch_regs + __VCPU_REGS_R12 * WORD_SIZE)
+#define VCPU_R13	(SVM_vcpu_arch_regs + __VCPU_REGS_R13 * WORD_SIZE)
+#define VCPU_R14	(SVM_vcpu_arch_regs + __VCPU_REGS_R14 * WORD_SIZE)
+#define VCPU_R15	(SVM_vcpu_arch_regs + __VCPU_REGS_R15 * WORD_SIZE)
 #endif
 
 .section .noinstr.text, "ax"
@@ -32,7 +33,7 @@
 /**
  * __svm_vcpu_run - Run a vCPU via a transition to SVM guest mode
  * @vmcb_pa:	unsigned long
- * @regs:	unsigned long * (to guest registers)
+ * @svm:	struct vcpu_svm *
  */
 SYM_FUNC_START(__svm_vcpu_run)
 	push %_ASM_BP
@@ -47,13 +48,13 @@ SYM_FUNC_START(__svm_vcpu_run)
 #endif
 	push %_ASM_BX
 
-	/* Save @regs. */
+	/* Save @svm. */
 	push %_ASM_ARG2
 
 	/* Save @vmcb. */
 	push %_ASM_ARG1
 
-	/* Move @regs to RAX. */
+	/* Move @svm to RAX. */
 	mov %_ASM_ARG2, %_ASM_AX
 
 	/* Load guest registers. */
@@ -89,7 +90,7 @@ SYM_FUNC_START(__svm_vcpu_run)
 	FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
 #endif
 
-	/* "POP" @regs to RAX. */
+	/* "POP" @svm to RAX. */
 	pop %_ASM_AX
 
 	/* Save all guest registers.  */
#194 lore raw
In reply to Greg Kroah-Hartman

Works fine on my Arch Linux server with Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz

Tested by: Luna Jernberg <[email protected]>

Quoted 833 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

        https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 6.0.9-rc1

Takashi Iwai <[email protected]>
ALSA: memalloc: Try dma_alloc_noncontiguous() at first

Philip Yang <[email protected]>
drm/amdkfd: Migrate in CPU page fault use current mm

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Check return code of dma_async_device_register

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix impossible condition

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Don't allow CPU to reorder channel enable

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix completion of unissued descriptor in case of errors

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix descriptor handling when issuing it to hardware

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix concurrency over the active list

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Free the memset buf without holding the chan lock

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix concurrency over descriptor

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix concurrency problems by removing atc_complete_all()

Tudor Ambarus <[email protected]>

    dmaengine: at_hdmac: Protect atchan->status with the channel lock

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Do not call the complete callback on device_terminate_all

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix premature completion of desc in issue_pending

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Start transfer for cyclic channels in issue_pending

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Don't start transactions at tx_submit level

Tudor Ambarus <[email protected]>
dmaengine: at_hdmac: Fix at_lli struct definition

Oliver Hartkopp <[email protected]>
can: dev: fix skb drop check

Paolo Bonzini <[email protected]>
KVM: SVM: move guest vmsave/vmload back to assembly

Paolo Bonzini <[email protected]>
KVM: SVM: retrieve VMCB from assembly

Peter Gonda <[email protected]>
KVM: SVM: Only dump VMSA to klog at KERN_DEBUG level

Paolo Bonzini <[email protected]>
KVM: SVM: adjust register allocation for __svm_vcpu_run()

Paolo Bonzini <[email protected]>
KVM: SVM: replace regs argument of __svm_vcpu_run() with vcpu_svm

Paolo Bonzini <[email protected]>
KVM: x86: use a separate asm-offsets.c file

Like Xu <[email protected]>
KVM: x86/pmu: Do not speculatively query Intel GP PMCs that don't exist yet

Sean Christopherson <[email protected]>
KVM: x86/mmu: Block all page faults during kvm_zap_gfn_range()

Geert Uytterhoeven <[email protected]>
can: rcar_canfd: Add missing ECC error checks for channels 2-7

Oliver Hartkopp <[email protected]>
can: isotp: fix tx state handling for echo tx processing

Oliver Hartkopp <[email protected]>
can: j1939: j1939_send_one(): fix missing CAN header initialization

Peter Xu <[email protected]>
mm/shmem: use page_mapping() to detect page cache for uffd continue

Pankaj Gupta <[email protected]>
mm/memremap.c: map FS_DAX device memory as decrypted

SeongJae Park <[email protected]>
mm/damon/dbgfs: check if rm_contexts input is for a real context

Fenghua Yu <[email protected]>
dmaengine: idxd: Do not enable user type Work Queue without Shared Virtual Addressing

Vasily Gorbik <[email protected]>
mm: hugetlb_vmemmap: include missing linux/moduleparam.h

Naoya Horiguchi <[email protected]>
arch/x86/mm/hugetlbpage.c: pud_huge() returns 0 when using 2-level paging

Mika Westerberg <[email protected]>
spi: intel: Use correct mask for flash and protected regions

ZhangPeng <[email protected]>
udf: Fix a slab-out-of-bounds write bug in udf_find_entry()

Brian Norris <[email protected]>
mms: sdhci-esdhc-imx: Fix SDHCI_RESET_ALL for CQHCI

Roger Quadros <[email protected]>
net: ethernet: ti: am65-cpsw: Fix segmentation fault at module unload

Johan Hovold <[email protected]>
phy: qcom-qmp-combo: fix NULL-deref on runtime resume

Jens Axboe <[email protected]>
io_uring: check for rollover of buffer ID when providing buffers

Johannes Thumshirn <[email protected]>
btrfs: zoned: initialize device's zone info for seeding

Johannes Thumshirn <[email protected]>
btrfs: zoned: clone zoned device info when cloning a device

Zhang Xiaoxu <[email protected]>
btrfs: selftests: fix wrong error check in btrfs_free_dummy_root()

Liu Shixin <[email protected]>
btrfs: fix match incorrectly in dev_args_match_device

Wen Gong <[email protected]>
wifi: ath11k: avoid deadlock during regulatory update in ath11k_regd_update()

Jorge Lopez <[email protected]>
platform/x86: hp_wmi: Fix rfkill causing soft blocked wifi

Felix Kuehling <[email protected]>
drm/amdkfd: Fix error handling in kfd_criu_restore_events

Felix Kuehling <[email protected]>
drm/amdkfd: Fix error handling in criu_checkpoint

Guchun Chen <[email protected]>
drm/amdgpu: disable BACO on special BEIGE_GOBY card

Christian König <[email protected]>
drm/amdgpu: workaround for TLB seq race

Nicholas Kazlauskas <[email protected]>
drm/amd/display: Update SR watermarks for DCN314

Tim Huang <[email protected]>
drm/amd/pm: update SMU IP v13.0.4 msg interface header

Nicholas Kazlauskas <[email protected]>
drm/amd/display: Fix reg timeout in enc314_enable_fifo

Matthew Auld <[email protected]>
drm/i915/dmabuf: fix sg_table handling in map_dma_buf

Ryusuke Konishi <[email protected]>
nilfs2: fix use-after-free bug of ns_writer on remount

Ryusuke Konishi <[email protected]>
nilfs2: fix deadlock in nilfs_count_free_blocks()

Shin'ichiro Kawasaki <[email protected]>
ata: libata-scsi: fix SYNCHRONIZE CACHE (16) command failure

Nathan Chancellor <[email protected]>
vmlinux.lds.h: Fix placement of '.data..decrypted' section

Jussi Laako <[email protected]>
ALSA: usb-audio: Add DSD support for Accuphase DAC-60

Takashi Iwai <[email protected]>
ALSA: usb-audio: Add quirk entry for M-Audio Micro

Takashi Iwai <[email protected]>
ALSA: usb-audio: Yet more regression for for the delayed card registration

Edson Juliano Drosdeck <[email protected]>
ALSA: hda/realtek: Add Positivo C6300 model quirk

Stefan Binding <[email protected]>
ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41

Ye Bin <[email protected]>
ALSA: hda: fix potential memleak in 'add_widget_node'

Xian Wang <[email protected]>
ALSA: hda/ca0132: add quirk for EVGA Z390 DARK

Evan Quan <[email protected]>
ALSA: hda/hdmi - enable runtime pm for more AMD display audio

Haibo Chen <[email protected]>
mmc: sdhci-esdhc-imx: use the correct host caps for MMC_CAP_8_BIT_DATA

Brian Norris <[email protected]>
mmc: sdhci-tegra: Fix SDHCI_RESET_ALL for CQHCI

Brian Norris <[email protected]>
mmc: sdhci_am654: Fix SDHCI_RESET_ALL for CQHCI

Brian Norris <[email protected]>
mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI

Brian Norris <[email protected]>
mmc: sdhci-of-arasan: Fix SDHCI_RESET_ALL for CQHCI

Brian Norris <[email protected]>
mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI

Ma Jun <[email protected]>
drm/amdgpu: Fix the lpfn checking condition in drm buddy

Jiaxun Yang <[email protected]>
MIPS: jump_label: Fix compat branch range check

Ard Biesheuvel <[email protected]>
arm64: efi: Fix handling of misaligned runtime regions and drop warning

Wei Yongjun <[email protected]>
eth: sp7021: drop free_netdev() from spl2sw_init_netdev()

Conor Dooley <[email protected]>
riscv: fix reserved memory setup

Jisheng Zhang <[email protected]>
riscv: vdso: fix build with llvm

Jisheng Zhang <[email protected]>
riscv: process: fix kernel info leakage

Chuang Wang <[email protected]>
net: macvlan: fix memory leaks of macvlan_common_newlink

Zhengchao Shao <[email protected]>
ethernet: tundra: free irq when alloc ring failed in tsi108_open()

Takashi Iwai <[email protected]>
ALSA: memalloc: Don't fall back for SG-buffer with IOMMU

Zhengchao Shao <[email protected]>
net: mv643xx_eth: disable napi when init rxq or txq failed in mv643xx_eth_open()

Zhengchao Shao <[email protected]>
ethernet: s2io: disable napi when start nic failed in s2io_card_up()

Antoine Tenart <[email protected]>
net: atlantic: macsec: clear encryption keys from the stack

Antoine Tenart <[email protected]>
net: phy: mscc: macsec: clear encryption keys when freeing a flow

Yang Yingliang <[email protected]>
stmmac: dwmac-loongson: fix missing of_node_put() while module exiting

Yang Yingliang <[email protected]>
stmmac: dwmac-loongson: fix missing pci_disable_device() in loongson_dwmac_probe()

Yang Yingliang <[email protected]>
stmmac: dwmac-loongson: fix missing pci_disable_msi() while module exiting

Zhengchao Shao <[email protected]>
cxgb4vf: shut down the adapter when t4vf_update_port_info() failed in cxgb4vf_open()

Wei Yongjun <[email protected]>
mctp: Fix an error handling path in mctp_init()

Tan, Tee Min <[email protected]>
stmmac: intel: Update PCH PTP clock rate from 200MHz to 204.8MHz

Zhengchao Shao <[email protected]>
net: cxgb3_main: disable napi when bind qsets failed in cxgb_up()

Zhengchao Shao <[email protected]>
net: cpsw: disable napi in cpsw_ndo_open()

Michal Jaron <[email protected]>
iavf: Fix VF driver counting VLAN 0 filters

Norbert Zulinski <[email protected]>
ice: Fix spurious interrupt during removal of trusted VF

Roi Dayan <[email protected]>
net/mlx5e: E-Switch, Fix comparing termination table instance

Jianbo Liu <[email protected]>
net/mlx5e: TC, Fix wrong rejection of packet-per-second policing

Roi Dayan <[email protected]>
net/mlx5e: Fix tc acts array not to be dependent on enum order

Maxim Mikityanskiy <[email protected]>
net/mlx5e: Add missing sanity checks for max TX WQE size

Shay Drory <[email protected]>
net/mlx5: fw_reset: Don't try to load device in case PCI isn't working

Chris Mi <[email protected]>
net/mlx5: E-switch, Set to legacy mode if failed to change switchdev mode

Roy Novich <[email protected]>
net/mlx5: Allow async trigger completion execution on single CPU systems

Vlad Buslov <[email protected]>
net/mlx5: Bridge, verify LAG state when adding bond to bridge

M Chetan Kumar <[email protected]>
net: wwan: iosm: fix invalid mux header type

M Chetan Kumar <[email protected]>
net: wwan: iosm: fix memory leak in ipc_pcie_read_bios_cfg

Zhengchao Shao <[email protected]>
net: nixge: disable napi when enable interrupts failed in nixge_open()

Eric Dumazet <[email protected]>
net: tun: call napi_schedule_prep() to ensure we own a napi

Zhengchao Shao <[email protected]>
net: marvell: prestera: fix memory leak in prestera_rxtx_switch_init()

Shigeru Yoshida <[email protected]>

    netfilter: Cleanup nft_net->module_list from nf_tables_exit_net()

Ziyang Xuan <[email protected]>
netfilter: nfnetlink: fix potential dead lock in nfnetlink_rcv_msg()

Donglin Peng <[email protected]>
perf tools: Add the include/perf/ directory to .gitignore

James Clark <[email protected]>
perf test: Fix skipping branch stack sampling test

Athira Rajeev <[email protected]>

    perf stat: Fix printing os->prefix in CSV metrics output

Namhyung Kim <[email protected]>
perf stat: Fix crash with --per-node --metric-only in CSV mode

Zhengchao Shao <[email protected]>
drivers: net: xgene: disable napi when register irq failed in xgene_enet_open()

Ratheesh Kannoth <[email protected]>
octeontx2-pf: Fix SQE threshold checking

Zhengchao Shao <[email protected]>
net: ethernet: mtk-star-emac: disable napi when connect and start PHY failed in mtk_star_enable()

Zhengchao Shao <[email protected]>
net: lapbether: fix issue of invalid opcode in lapbeth_open()

Amelie Delaunay <[email protected]>
dmaengine: stm32-dma: fix potential race between pause and resume

Yang Yingliang <[email protected]>
dmaengine: ti: k3-udma-glue: fix memory leak when register device fail

Christophe JAILLET <[email protected]>
dmaengine: mv_xor_v2: Fix a resource leak in mv_xor_v2_remove()

Martin Povišer <[email protected]>
dmaengine: apple-admac: Fix grabbing of channels in of_xlate

Fengqian Gao <[email protected]>
dmaengine: idxd: fix RO device state error after been disabled/reset

Xiaochen Shen <[email protected]>
dmaengine: idxd: Fix max batch size for Intel IAA

Dave Jiang <[email protected]>
dmanegine: idxd: reformat opcap output to match bitmap_parse() input

Doug Brown <[email protected]>
dmaengine: pxa_dma: use platform_get_irq_optional

Xin Long <[email protected]>

    tipc: fix the msg->req tlv len check in tipc_nl_compat_name_table_dump_header

YueHaibing <[email protected]>
net: broadcom: Fix BCMGENET Kconfig

Miquel Raynal <[email protected]>
dt-bindings: net: tsnep: Fix typo on generic nvmem property

Rasmus Villemoes <[email protected]>
net: stmmac: dwmac-meson8b: fix meson8b_devm_clk_prepare_enable()

Niranjana Vishwanathapura <[email protected]>
drm/i915: Do not set cache_dirty for DGFX

Jouni Högander <[email protected]>
drm/i915/psr: Send update also on invalidate

Zhengchao Shao <[email protected]>
can: af_can: fix NULL pointer dereference in can_rx_register()

Alexander Potapenko <[email protected]>
ipv6: addrlabel: fix infoleak when sending struct ifaddrlblmsg to network

Andy Shevchenko <[email protected]>
platform/x86: p2sb: Don't fail if unknown CPU is found

Lu Wei <[email protected]>
tcp: prohibit TCP_REPAIR_OPTIONS if data was already sent

Yuan Can <[email protected]>
drm/vc4: Fix missing platform_unregister_drivers() call in vc4_drm_register()

HW He <[email protected]>
net: wwan: mhi: fix memory leak in mhi_mbim_dellink

HW He <[email protected]>
net: wwan: iosm: fix memory leak in ipc_wwan_dellink

Zhengchao Shao <[email protected]>
hamradio: fix issue of dev reference count leakage in bpq_device_event()

Zhengchao Shao <[email protected]>
net: lapbether: fix issue of dev reference count leakage in lapbeth_device_event()

Rafael Mendonca <[email protected]>
KVM: s390: pci: Fix allocation size of aift kzdev elements

Nico Boehr <[email protected]>
KVM: s390: pv: don't allow userspace to set the clock under PV

John Thomson <[email protected]>
phy: ralink: mt7621-pci: add sentinel to quirks table

Gaosheng Cui <[email protected]>
capabilities: fix undefined behavior in bit shift for CAP_TO_MASK

Sean Anderson <[email protected]>
net: fman: Unregister ethernet device on removal

Alex Barba <[email protected]>
bnxt_en: fix potentially incorrect return value for ndo_rx_flow_steer

Michael Chan <[email protected]>
bnxt_en: Fix possible crash in bnxt_hwrm_set_coal()

Wang Yufen <[email protected]>
net: tun: Fix memory leaks of napi_get_frags

Ratheesh Kannoth <[email protected]>
octeontx2-pf: NIX TX overwrites SQ_CTX_HW_S[SQ_INT]

Sabrina Dubroca <[email protected]>
macsec: clear encryption keys from the stack after setting up offload

Sabrina Dubroca <[email protected]>
macsec: fix detection of RXSCs when toggling offloading

Sabrina Dubroca <[email protected]>

    macsec: fix secy->n_rx_sc accounting

Sabrina Dubroca <[email protected]>
macsec: delete new rxsc when offload fails

Jiri Benc <[email protected]>
net: gso: fix panic on frag_list with mixed head alloc types

Youlin Li <[email protected]>
bpf: Fix wrong reg type conversion in release_reference()

Kumar Kartikeya Dwivedi <[email protected]>
bpf: Add helper macro bpf_for_each_reg_in_vstate

Dexuan Cui <[email protected]>
PCI: hv: Fix the definition of vector in hv_compose_msi_msg()

Cong Wang <[email protected]>
bpf, sock_map: Move cancel_work_sync() out of sock lock

[email protected] <[email protected]>
drm/vc4: hdmi: Fix HSM clock too low on Pi4

Yang Yingliang <[email protected]>
HID: hyperv: fix possible memory leak in mousevsc_probe()

Pu Lehui <[email protected]>
bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE

Howard Hsu <[email protected]>
wifi: mac80211: Set TWT Information Frame Disabled bit as 1

Zhengchao Shao <[email protected]>
wifi: mac80211: fix general-protection-fault in ieee80211_subif_start_xmit()

Wang Yufen <[email protected]>

    bpf, sockmap: Fix the sk->sk_forward_alloc warning of sk_stream_kill_queues

Kees Cook <[email protected]>
bpf, verifier: Fix memory leak in array reallocation for stack state

zhichao.liu <[email protected]>
spi: mediatek: Fix package division error

Yang Yingliang <[email protected]>
ALSA: arm: pxa: pxa2xx-ac97-lib: fix return value check of platform_get_irq()

Srinivas Kandagatla <[email protected]>
soundwire: qcom: check for outanding writes before doing a read

Srinivas Kandagatla <[email protected]>
soundwire: qcom: reinit broadcast completion

Arend van Spriel <[email protected]>
wifi: cfg80211: fix memory leak in query_regdb_file()

Johannes Berg <[email protected]>
wifi: cfg80211: silence a sparse RCU warning

Dan Carpenter <[email protected]>
phy: stm32: fix an error code in probe

Krzysztof Kozlowski <[email protected]>
hwspinlock: qcom: correct MMIO max register for newer SoCs

Jason Gerecke <[email protected]>
HID: wacom: Fix logic used for 3rd barrel switch emulation

Dan Williams <[email protected]>
cxl/region: Recycle region ids

Yang Li <[email protected]>
drm/amdkfd: Fix NULL pointer dereference in svm_migrate_to_ram()

Philip Yang <[email protected]>
drm/amdkfd: handle CPU fault on COW mapping

Dillon Varone <[email protected]>
drm/amd/display: Set memclk levels to be at least 1 for dcn32

Jun Lei <[email protected]>
drm/amd/display: Limit dcn32 to 1950Mhz display clock

Dillon Varone <[email protected]>
drm/amd/display: Acquire FCLK DPM levels on DCN32

Ville Syrjälä <[email protected]>
drm/i915/sdvo: Grab mode_config.mutex during LVDS init to avoid WARNs

Ville Syrjälä <[email protected]>
drm/i915: Simplify intel_panel_add_edid_alt_fixed_modes()

Ville Syrjälä <[email protected]>
drm/i915: Allow more varied alternate fixed modes for panels

Hou Wenlong <[email protected]>
KVM: debugfs: Return retval of simple_attr_open() if it fails

Jason A. Donenfeld <[email protected]>
m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED

Jason Gunthorpe <[email protected]>
drm/i915/gvt: Add missing vfio_unregister_group_dev() call

Sanjay R Mehta <[email protected]>
thunderbolt: Add DP OUT resource when DP tunnel is discovered

-------------

Diffstat:

 .../devicetree/bindings/net/engleder,tsnep.yaml    |   2 +-
 Documentation/virt/kvm/devices/vm.rst              |   3 +
 Makefile                                           |   4 +-
 arch/arm64/kernel/efi.c                            |  52 ++++---
 arch/m68k/include/uapi/asm/bootinfo-virt.h         |   9 +-
 arch/m68k/include/uapi/asm/bootinfo.h              |   7 +
 arch/m68k/kernel/setup_mm.c                        |  12 ++
 arch/m68k/virt/config.c                            |  11 --
 arch/mips/kernel/jump_label.c                      |   2 +-
 arch/riscv/kernel/process.c                        |   2 +
 arch/riscv/kernel/setup.c                          |   1 +
 arch/riscv/kernel/vdso/Makefile                    |   2 +-
 arch/riscv/mm/init.c                               |   1 -
 arch/s390/kvm/kvm-s390.c                           |  26 ++--
 arch/s390/kvm/kvm-s390.h                           |   1 -
 arch/s390/kvm/pci.c                                |   2 +-
 arch/x86/kernel/asm-offsets.c                      |   6 -
 arch/x86/kvm/.gitignore                            |   2 +
 arch/x86/kvm/Makefile                              |  12 ++
 arch/x86/kvm/kvm-asm-offsets.c                     |  27 ++++
 arch/x86/kvm/mmu/mmu.c                             |   4 +-
 arch/x86/kvm/svm/sev.c                             |   2 +-
 arch/x86/kvm/svm/svm.c                             |  14 +-
 arch/x86/kvm/svm/svm.h                             |   4 +-
 arch/x86/kvm/svm/vmenter.S                         | 134 +++++++++++-------
 arch/x86/kvm/vmx/vmenter.S                         |   2 +-
 arch/x86/kvm/x86.c                                 |  14 +-
 arch/x86/mm/hugetlbpage.c                          |   4 +
 drivers/ata/libata-scsi.c                          |   3 +
 drivers/cxl/core/region.c                          |  20 +++
 drivers/dma/apple-admac.c                          |   2 +-
 drivers/dma/at_hdmac.c                             | 153 ++++++++-------------
 drivers/dma/at_hdmac_regs.h                        |  10 +-
 drivers/dma/idxd/cdev.c                            |  18 +++
 drivers/dma/idxd/device.c                          |  26 ++--
 drivers/dma/idxd/idxd.h                            |  34 +++++
 drivers/dma/idxd/init.c                            |  24 +++-
 drivers/dma/idxd/registers.h                       |   2 +
 drivers/dma/idxd/sysfs.c                           |  11 +-
 drivers/dma/mv_xor_v2.c                            |   1 +
 drivers/dma/pxa_dma.c                              |   4 +-
 drivers/dma/stm32-dma.c                            |  14 +-
 drivers/dma/ti/k3-udma-glue.c                      |   3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h             |  15 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c       |   2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c           |  34 ++---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c            |   3 +-
 drivers/gpu/drm/amd/amdkfd/kfd_migrate.c           |  49 ++++---
 .../amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c |  32 ++---
 .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c   |  52 ++++---
 .../display/dc/dcn314/dcn314_dio_stream_encoder.c  |  24 +++-
 .../gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c |   4 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h    |  15 +-
 .../amd/pm/swsmu/inc/pmfw_if/smu_v13_0_4_ppsmc.h   |  15 +-
 .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c    |   4 +-
 drivers/gpu/drm/i915/display/intel_dp.c            |   2 +-
 drivers/gpu/drm/i915/display/intel_lvds.c          |   3 +-
 drivers/gpu/drm/i915/display/intel_panel.c         |  29 ++--
 drivers/gpu/drm/i915/display/intel_panel.h         |   2 +-
 drivers/gpu/drm/i915/display/intel_psr.c           |   5 +-
 drivers/gpu/drm/i915/display/intel_sdvo.c          |   6 +-
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c         |   4 +-
 drivers/gpu/drm/i915/gem/i915_gem_shmem.c          |   4 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c                   |   3 +
 drivers/gpu/drm/vc4/vc4_drv.c                      |   7 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c                     |  21 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.h                     |   1 +
 drivers/hid/hid-hyperv.c                           |   2 +-
 drivers/hid/wacom_wac.c                            |  11 +-
 drivers/hwspinlock/qcom_hwspinlock.c               |   2 +-
 drivers/mmc/host/sdhci-brcmstb.c                   |   3 +-
 drivers/mmc/host/sdhci-cqhci.h                     |  24 ++++
 drivers/mmc/host/sdhci-esdhc-imx.c                 |   7 +-
 drivers/mmc/host/sdhci-of-arasan.c                 |   3 +-
 drivers/mmc/host/sdhci-tegra.c                     |   3 +-
 drivers/mmc/host/sdhci_am654.c                     |   7 +-
 drivers/net/can/at91_can.c                         |   2 +-
 drivers/net/can/c_can/c_can_main.c                 |   2 +-
 drivers/net/can/can327.c                           |   2 +-
 drivers/net/can/cc770/cc770.c                      |   2 +-
 drivers/net/can/ctucanfd/ctucanfd_base.c           |   2 +-
 drivers/net/can/dev/skb.c                          |   9 +-
 drivers/net/can/flexcan/flexcan-core.c             |   2 +-
 drivers/net/can/grcan.c                            |   2 +-
 drivers/net/can/ifi_canfd/ifi_canfd.c              |   2 +-
 drivers/net/can/janz-ican3.c                       |   2 +-
 drivers/net/can/kvaser_pciefd.c                    |   2 +-
 drivers/net/can/m_can/m_can.c                      |   2 +-
 drivers/net/can/mscan/mscan.c                      |   2 +-
 drivers/net/can/pch_can.c                          |   2 +-
 drivers/net/can/peak_canfd/peak_canfd.c            |   2 +-
 drivers/net/can/rcar/rcar_can.c                    |   2 +-
 drivers/net/can/rcar/rcar_canfd.c                  |  15 +-
 drivers/net/can/sja1000/sja1000.c                  |   2 +-
 drivers/net/can/slcan/slcan-core.c                 |   2 +-
 drivers/net/can/softing/softing_main.c             |   2 +-
 drivers/net/can/spi/hi311x.c                       |   2 +-
 drivers/net/can/spi/mcp251x.c                      |   2 +-
 drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c       |   2 +-
 drivers/net/can/sun4i_can.c                        |   2 +-
 drivers/net/can/ti_hecc.c                          |   2 +-
 drivers/net/can/usb/ems_usb.c                      |   2 +-
 drivers/net/can/usb/esd_usb.c                      |   2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c        |   2 +-
 drivers/net/can/usb/gs_usb.c                       |   2 +-
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c   |   2 +-
 drivers/net/can/usb/mcba_usb.c                     |   2 +-
 drivers/net/can/usb/peak_usb/pcan_usb_core.c       |   2 +-
 drivers/net/can/usb/ucan.c                         |   2 +-
 drivers/net/can/usb/usb_8dev.c                     |   2 +-
 drivers/net/can/xilinx_can.c                       |   2 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c   |   4 +-
 drivers/net/ethernet/aquantia/atlantic/aq_macsec.c |   2 +
 .../ethernet/aquantia/atlantic/macsec/macsec_api.c |  18 ++-
 drivers/net/ethernet/broadcom/Kconfig              |   2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt.c          |   2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c  |   2 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c    |   1 +
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c    |   2 +-
 drivers/net/ethernet/freescale/fman/mac.c          |   9 ++
 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c    |   2 +
 drivers/net/ethernet/intel/ice/ice_base.c          |   2 +-
 drivers/net/ethernet/intel/ice/ice_lib.c           |  25 ++++
 drivers/net/ethernet/intel/ice/ice_lib.h           |   1 +
 drivers/net/ethernet/intel/ice/ice_vf_lib.c        |   5 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c         |   1 +
 .../ethernet/marvell/octeontx2/nic/otx2_common.c   |   1 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   | 135 ++++++++++++++----
 .../ethernet/marvell/octeontx2/nic/otx2_struct.h   |  57 ++++++++
 .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c |  32 +++--
 .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.h |   1 +
 .../net/ethernet/marvell/prestera/prestera_rxtx.c  |   7 +-
 drivers/net/ethernet/mediatek/mtk_star_emac.c      |   2 +
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c      |  11 +-
 .../ethernet/mellanox/mlx5/core/en/rep/bridge.c    |  31 +++++
 .../ethernet/mellanox/mlx5/core/en/tc/act/act.c    |  92 +++++--------
 drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h  |  24 +++-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |   7 +
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |   6 -
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |   5 +
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c  |  14 +-
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |  18 +--
 .../mellanox/mlx5/core/eswitch_offloads_termtbl.c  |  14 +-
 drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c |   3 +-
 drivers/net/ethernet/neterion/s2io.c               |  29 ++--
 drivers/net/ethernet/ni/nixge.c                    |   1 +
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c  |  11 +-
 .../net/ethernet/stmicro/stmmac/dwmac-loongson.c   |  39 ++++--
 .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c    |   8 +-
 drivers/net/ethernet/sunplus/spl2sw_driver.c       |   1 -
 drivers/net/ethernet/ti/am65-cpsw-nuss.c           |   2 +-
 drivers/net/ethernet/ti/cpsw.c                     |   2 +
 drivers/net/ethernet/tundra/tsi108_eth.c           |   5 +-
 drivers/net/hamradio/bpqether.c                    |   2 +-
 drivers/net/macsec.c                               |  23 ++--
 drivers/net/macvlan.c                              |   4 +-
 drivers/net/phy/mscc/mscc_macsec.c                 |   1 +
 drivers/net/tun.c                                  |  18 ++-
 drivers/net/wan/lapbether.c                        |   3 +-
 drivers/net/wireless/ath/ath11k/reg.c              |   6 +-
 drivers/net/wwan/iosm/iosm_ipc_imem_ops.c          |   8 ++
 drivers/net/wwan/iosm/iosm_ipc_mux.h               |   1 +
 drivers/net/wwan/iosm/iosm_ipc_pcie.c              |  11 +-
 drivers/net/wwan/iosm/iosm_ipc_wwan.c              |   1 +
 drivers/net/wwan/mhi_wwan_mbim.c                   |   1 +
 drivers/pci/controller/pci-hyperv.c                |  22 ++-
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c          |   2 +-
 drivers/phy/ralink/phy-mt7621-pci.c                |   3 +-
 drivers/phy/st/phy-stm32-usbphyc.c                 |   2 +
 drivers/platform/x86/hp-wmi.c                      |  12 +-
 drivers/platform/x86/p2sb.c                        |  15 +-
 drivers/soundwire/qcom.c                           |   9 ++
 drivers/spi/spi-intel.c                            |   8 +-
 drivers/spi/spi-mt65xx.c                           |  23 ++--
 drivers/thunderbolt/tb.c                           |  28 ++++
 fs/btrfs/disk-io.c                                 |   4 +-
 fs/btrfs/tests/btrfs-tests.c                       |   2 +-
 fs/btrfs/volumes.c                                 |  39 ++++--
 fs/btrfs/volumes.h                                 |   2 +-
 fs/btrfs/zoned.c                                   |  40 ++++++
 fs/btrfs/zoned.h                                   |  11 ++
 fs/nilfs2/segment.c                                |  15 +-
 fs/nilfs2/super.c                                  |   2 -
 fs/nilfs2/the_nilfs.c                              |   2 -
 fs/udf/namei.c                                     |   2 +-
 include/asm-generic/vmlinux.lds.h                  |   2 +-
 include/linux/bpf_verifier.h                       |  21 +++
 include/linux/can/dev.h                            |  16 +++
 include/linux/skmsg.h                              |   2 +-
 include/uapi/linux/capability.h                    |   2 +-
 include/uapi/linux/idxd.h                          |   1 +
 io_uring/kbuf.c                                    |   2 +
 kernel/bpf/verifier.c                              | 148 ++++++--------------
 mm/damon/dbgfs.c                                   |   7 +
 mm/hugetlb_vmemmap.c                               |   1 +
 mm/memremap.c                                      |   1 +
 mm/userfaultfd.c                                   |   2 +-
 net/can/af_can.c                                   |   2 +-
 net/can/isotp.c                                    |  71 +++++-----
 net/can/j1939/main.c                               |   3 +
 net/core/skbuff.c                                  |  36 ++---
 net/core/skmsg.c                                   |   7 +-
 net/core/sock_map.c                                |   7 +-
 net/ipv4/tcp.c                                     |   2 +-
 net/ipv4/tcp_bpf.c                                 |   8 +-
 net/ipv6/addrlabel.c                               |   1 +
 net/mac80211/s1g.c                                 |   3 +
 net/mac80211/tx.c                                  |   5 +
 net/mctp/af_mctp.c                                 |   4 +-
 net/mctp/route.c                                   |   2 +-
 net/netfilter/nf_tables_api.c                      |   3 +-
 net/netfilter/nfnetlink.c                          |   1 +
 net/tipc/netlink_compat.c                          |   2 +-
 net/wireless/reg.c                                 |  12 +-
 net/wireless/scan.c                                |   4 +-
 sound/arm/pxa2xx-ac97-lib.c                        |   4 +-
 sound/core/memalloc.c                              |  15 +-
 sound/hda/hdac_sysfs.c                             |   4 +-
 sound/pci/hda/hda_intel.c                          |   3 +
 sound/pci/hda/patch_ca0132.c                       |   1 +
 sound/pci/hda/patch_realtek.c                      |   2 +
 sound/usb/card.c                                   |  29 ++--
 sound/usb/quirks-table.h                           |   4 +
 sound/usb/quirks.c                                 |   1 +
 tools/bpf/bpftool/common.c                         |   3 +
 tools/perf/.gitignore                              |   1 +
 tools/perf/tests/shell/test_brstack.sh             |   5 +-
 tools/perf/util/parse-branch-options.c             |   4 +-
 tools/perf/util/stat-display.c                     |   6 +-
 virt/kvm/kvm_main.c                                |  13 +-
 230 files changed, 1662 insertions(+), 944 deletions(-)
maintainer Tested-by on the v1 series
#195 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

All tests passing for Tegra ...

Test results for stable-v6.0:

    11 builds:	11 pass, 0 fail
    28 boots:	28 pass, 0 fail
    130 tests:	130 pass, 0 fail

Linux version: 6.0.9-rc1-gf8896c3ebbcf
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,

                tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
                tegra20-ventana, tegra210-p2371-2180,
                tegra210-p3450-0000, tegra30-cardhu-a04

Jon

Tested-by on the v1 series
#196 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

Tested-by on the v1 series
#197 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:

Signature · 1 line
Florian
Tested-by on the v1 series
#198 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

Built and booted successfully on RISC-V RV64 (HiFive Unmatched).

Tested-by on the v1 series
#199 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

Build results:

	total: 152 pass: 152 fail: 0
Qemu test results:
	total: 500 pass: 500 fail: 0

Guenter

Tested-by on the v1 series
#200 lore raw
In reply to Greg Kroah-Hartman
Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
        https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

Hi Greg,

Compiled and booted on my test system Lenovo P50s: Intel Core i7 No emergency and critical messages in the dmesg

./perf bench sched all
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run

     Total time: 0.816 [sec]

# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes

     Total time: 9.507 [sec]

       9.507659 usecs/op
         105178 ops/sec

Thanks
-Zan

Tested-by Linux Kernel Functional Testing on the v1 series
#201 lore raw
In reply to Greg Kroah-Hartman
Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
        https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

Results from Linaro's test farm.
No regressions on arm64, arm, x86_64, and i386.

## Build
* kernel: 6.0.9-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.0.y
* git commit: f8896c3ebbcfcc053d9c27413bea3af94c01fd71
* git describe: v6.0.8-191-gf8896c3ebbcf
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.0.y/build/v6.0.8-191-gf8896c3ebbcf

## Test Regressions (compared to v6.0.8)

## Metric Regressions (compared to v6.0.8)

## Test Fixes (compared to v6.0.8)

## Metric Fixes (compared to v6.0.8)

## Test result summary
total: 70795, pass: 60088, fail: 2510, skip: 7975, xfail: 222

## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 289 total, 283 passed, 6 failed
* arm64: 80 total, 80 passed, 0 failed
* i386: 71 total, 69 passed, 2 failed
* mips: 54 total, 52 passed, 2 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 68 total, 60 passed, 8 failed
* riscv: 24 total, 24 passed, 0 failed
* s390: 24 total, 24 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 76 total, 76 passed, 0 failed

## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-arm64/arm64.btitest.bti_c_func
* kselftest-arm64/arm64.btitest.bti_j_func
* kselftest-arm64/arm64.btitest.bti_jc_func
* kselftest-arm64/arm64.btitest.bti_none_func
* kselftest-arm64/arm64.btitest.nohint_func
* kselftest-arm64/arm64.btitest.paciasp_func
* kselftest-arm64/arm64.nobtitest.bti_c_func
* kselftest-arm64/arm64.nobtitest.bti_j_func
* kselftest-arm64/arm64.nobtitest.bti_jc_func
* kselftest-arm64/arm64.nobtitest.bti_none_func
* kselftest-arm64/arm64.nobtitest.nohint_func
* kselftest-arm64/arm64.nobtitest.paciasp_func
* kselftest-breakpoints
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-kvm
* kselftest-lib
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-openat2
* kselftest-seccomp
* kselftest-timens
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-
* ltp-at
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-etlb
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-math++
* ltp-mm
* ltp-nptl
* ltp-open-posix-tests
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* packetdrill
* perf
* perf/Zstd-perf.data-compression
* rcutorture
* v4l2-compliance
* vdso

--
Linaro LKFT
https://lkft.linaro.org

Tested-by on the v1 series
#202 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Successfully cross-compiled for arm64 (bcm2711_defconfig, GCC 10.2.0) and powerpc (ps3_defconfig, GCC 12.2.0).

Signature · 1 line
An old man doll... just what I always wanted! - Clara
Tested-by on the v1 series
#203 lore raw
In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

Hi Greg,

6.0.9-rc1 tested.

Run tested on:
- Intel Alder Lake x86_64 (nuc12 i7-1260P)
- SolidRun Cubox-i Dual/Quad - NXP iMX6 (Cubox-i4Pro)

In addition - build tested for:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- Allwinner H6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos

--
Rudi

Tested-by on the v1 series
#204 lore raw
In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

Build test (gcc version 12.2.1 20221016):
mips: 52 configs -> no failure
arm: 100 configs -> no failure
arm64: 3 configs -> no failure
x86_64: 4 configs -> no failure alpha allmodconfig -> no failure csky allmodconfig -> no failure powerpc allmodconfig -> no failure riscv allmodconfig -> no failure s390 allmodconfig -> no failure xtensa allmodconfig -> no failure

Boot test:
x86_64: Booted on my test laptop. No regression.
x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]

[1]. https://openqa.qa.codethink.co.uk/tests/2159
[2]. https://openqa.qa.codethink.co.uk/tests/2165

Signature · 2 lines
Regards
Sudip
Tested-by on the v1 series
#205 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
	https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

thanks,

greg k-h

Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.

Tested-by on the v1 series
#206 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines

This is the start of the stable review cycle for the 6.0.9 release. There are 190 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Quoted 9 lines

Responses should be made by Wed, 16 Nov 2022 12:44:21 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

        https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.0.9-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.0.y
and the diffstat can be found below.

Compiled and booted on my x86_64 and ARM64 test systems. No errors or regressions.

Thanks.

#136 lore raw

Re: [PATCH 6.0 134/190] nilfs2: fix deadlock in nilfs_count_free_blocks()

In reply to Greg Kroah-Hartman

Hi!

Quoted 3 lines

From: Ryusuke Konishi <[email protected]>

commit 8ac932a4921a96ca52f61935dbba64ea87bbd5dc upstream.

...

Quoted 6 lines

However, there is actually no need to take rwsem A in nilfs_count_free_blocks() because it, within the lock section, only reads a single integer data on a shared struct with nilfs_sufile_get_ncleansegs(). This has been the case after commit aa474a220180 ("nilfs2: add local variable to cache the number of clean segments"), that is, even before this bug was introduced.

Ok, but these days we have checkers that don't like reading variables unlocked, and compiler theoretically could do something funny.

So this should have READ/WRITE_ONCE annotations... this is incomplete, but should illustrate what is needed. Likely some helper for updating ncleansegs should be introduced.

Best regards,
Pavel

fs/nilfs2/sufile.c +4 -2
index 63722475e17e..58dddc0b1d88 100644
@@ -122,7 +122,7 @@ static void nilfs_sufile_mod_counter(struct buffer_head *header_bh,
  */
 unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile)
 {
-	return NILFS_SUI(sufile)->ncleansegs;
+	return READ_ONCE(NILFS_SUI(sufile)->ncleansegs);
 }
 
 /**
@@ -418,7 +418,9 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
 	kunmap_atomic(kaddr);
 
 	nilfs_sufile_mod_counter(header_bh, -1, 1);
-	NILFS_SUI(sufile)->ncleansegs--;
+	/* nilfs_sufile_get_ncleansegs() leads this without taking lock */
+	WRITE_ONCE(NILFS_SUI(sufile)->ncleansegs,
+		   READ_ONCE(NILFS_SUI(sufile)->ncleansegs) - 1);
 
 	mark_buffer_dirty(su_bh);
 	nilfs_mdt_mark_dirty(sufile);
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#137 lore raw

Re: [PATCH 6.0 134/190] nilfs2: fix deadlock in nilfs_count_free_blocks()

Hi,

Quoted 14 lines · Pavel Machek

Hi!

Quoted 3 lines

From: Ryusuke Konishi <[email protected]>

commit 8ac932a4921a96ca52f61935dbba64ea87bbd5dc upstream.

...

Quoted 6 lines

However, there is actually no need to take rwsem A in nilfs_count_free_blocks() because it, within the lock section, only reads a single integer data on a shared struct with nilfs_sufile_get_ncleansegs(). This has been the case after commit aa474a220180 ("nilfs2: add local variable to cache the number of clean segments"), that is, even before this bug was introduced.

Quoted 6 lines

Ok, but these days we have checkers that don't like reading variables unlocked, and compiler theoretically could do something funny.

So this should have READ/WRITE_ONCE annotations... this is incomplete, but should illustrate what is needed. Likely some helper for updating ncleansegs should be introduced.

If the compiler omits an update in the middle, it's okay for nilfs_count_free_blocks() and other read-only callers.

In fact if I introduce such helper function like nilfs_sufile_set_ncleansegs() with WRITE_ONCE, I use nilfs_sufile_get_ncleansegs() first and nilfs_sufile_set_ncleansegs() last within functions that update the counter, rather than each time they increment or decrement it. But, I didn't see any point in using WRITE_ONCE/READ_ONCE like this.

Just be sure, the functions that update the counter are already exclusive with another semaphore (sufile->mi_sem), so updating it without the intermediate result won't break the counter.

If there's a real problem with some kind of checkers giving warnings as you mentioned, that's probably the real reason to apply those annotations.
I would like to deal with it for the mainline in that case.

Thanks,
Ryusuke Konishi

Quoted 32 lines

Best regards,
Pavel

fs/nilfs2/sufile.c +4 -3
index 63722475e17e..58dddc0b1d88 100644
@@ -122,7 +122,7 @@ static void nilfs_sufile_mod_counter(struct buffer_head *header_bh,
  */
 unsigned long nilfs_sufile_get_ncleansegs(struct inode *sufile)
 {
-       return NILFS_SUI(sufile)->ncleansegs;
+       return READ_ONCE(NILFS_SUI(sufile)->ncleansegs);
 }
 
 /**
@@ -418,7 +418,9 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
        kunmap_atomic(kaddr);
 
        nilfs_sufile_mod_counter(header_bh, -1, 1);
-       NILFS_SUI(sufile)->ncleansegs--;
+       /* nilfs_sufile_get_ncleansegs() leads this without taking lock */
+       WRITE_ONCE(NILFS_SUI(sufile)->ncleansegs,
+                  READ_ONCE(NILFS_SUI(sufile)->ncleansegs) - 1);
 
        mark_buffer_dirty(su_bh);
        nilfs_mdt_mark_dirty(sufile);
 
--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany