5.16.12-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 145/164 RDMA/cma: Do not change route.addr.src_addr outside state checks
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
commit 22e9f71072fa605cbf033158db58e0790101928d upstream.
If the state is not idle then resolve_prepare_src() should immediately fail and no change to global state should happen. However, it unconditionally overwrites the src_addr trying to build a temporary any address.
For instance if the state is already RDMA_CM_LISTEN then this will corrupt the src_addr and would cause the test in cma_cancel_operation():
if (cma_any_addr(cma_src_addr(id_priv)) && !id_priv->cma_dev)
Which would manifest as this trace from syzkaller:
BUG: KASAN: use-after-free in __list_add_valid+0x93/0xa0 lib/list_debug.c:26 Read of size 8 at addr ffff8881546491e0 by task syz-executor.1/32204 CPU: 1 PID: 32204 Comm: syz-executor.1 Not tainted 5.12.0-rc8-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:232 __kasan_report mm/kasan/report.c:399 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416 __list_add_valid+0x93/0xa0 lib/list_debug.c:26 __list_add include/linux/list.h:67 [inline] list_add_tail include/linux/list.h:100 [inline] cma_listen_on_all drivers/infiniband/core/cma.c:2557 [inline] rdma_listen+0x787/0xe00 drivers/infiniband/core/cma.c:3751 ucma_listen+0x16a/0x210 drivers/infiniband/core/ucma.c:1102 ucma_write+0x259/0x350 drivers/infiniband/core/ucma.c:1732 vfs_write+0x28e/0xa30 fs/read_write.c:603 ksys_write+0x1ee/0x250 fs/read_write.c:658 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae
This is indicating that an rdma_id_private was destroyed without doing cma_cancel_listens().
Instead of trying to re-use the src_addr memory to indirectly create an any address derived from the dst build one explicitly on the stack and bind to that as any other normal flow would do. rdma_bind_addr() will copy it over the src_addr once it knows the state is valid.
This is similar to commit bc0bdc5afaa7 ("RDMA/cma: Do not change route.addr.src_addr.ss_family")
--- drivers/infiniband/core/cma.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-)
drivers/infiniband/core/cma.c +23 -15
@@ -3370,22 +3370,30 @@ err:static int cma_bind_addr (struct rdma_cm_id *id,struct sockaddr *src_addr,const struct sockaddr *dst_addr) { -if (!src_addr || !src_addr->sa_family) { - src_addr = (struct sockaddr *) &id->route.addr.src_addr; - src_addr->sa_family = dst_addr->sa_family; -if (IS_ENABLED (CONFIG_IPV6 ) && - dst_addr->sa_family ==AF_INET6 ) { -struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *) src_addr; -struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *) dst_addr; - src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id; -if (ipv6_addr_type (&dst_addr6->sin6_addr) &IPV6_ADDR_LINKLOCAL ) - id->route.addr.dev_addr.bound_dev_if = dst_addr6->sin6_scope_id; - }else if (dst_addr->sa_family ==AF_IB ) { - ((struct sockaddr_ib *) src_addr)->sib_pkey = - ((struct sockaddr_ib *) dst_addr)->sib_pkey; - } +struct sockaddr_storage zero_sock = {}; + +if (src_addr && src_addr->sa_family) +return rdma_bind_addr (id, src_addr); + +/* +* When the src_addr is not specified, automatically supply an any addr +*/ + zero_sock.ss_family = dst_addr->sa_family; +if (IS_ENABLED (CONFIG_IPV6 ) && dst_addr->sa_family ==AF_INET6 ) { +struct sockaddr_in6 *src_addr6 = + (struct sockaddr_in6 *)&zero_sock; +struct sockaddr_in6 *dst_addr6 = + (struct sockaddr_in6 *)dst_addr; + + src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id; +if (ipv6_addr_type (&dst_addr6->sin6_addr) &IPV6_ADDR_LINKLOCAL ) + id->route.addr.dev_addr.bound_dev_if = + dst_addr6->sin6_scope_id; + }else if (dst_addr->sa_family ==AF_IB ) { + ((struct sockaddr_ib *)&zero_sock)->sib_pkey = + ((struct sockaddr_ib *)dst_addr)->sib_pkey; } -return rdma_bind_addr (id, src_addr); +return rdma_bind_addr (id, (struct sockaddr *)&zero_sock); }/*
Greg Kroah-Hartman
maintainerPATCH 153/164 hugetlbfs: fix a truncation issue in hugepages parameter
In reply to Greg Kroah-HartmanFrom: Liu Yuntao <[email protected]>
commit e79ce9832316e09529b212a21278d68240ccbf1f upstream.
When we specify a large number for node in hugepages parameter, it may be parsed to another number due to truncation in this statement:
node = tmp;
For example, add following parameter in command line:
hugepagesz=1G hugepages=4294967297:5
and kernel will allocate 5 hugepages for node 1 instead of ignoring it.
I move the validation check earlier to fix this issue, and slightly simplifies the condition here.
--- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -2
@@ -4159,10 +4159,10 @@ static int __init hugepages_setup(char *s)pr_warn ("HugeTLB: architecture can't support node specific alloc, ignoring!\n" );return 0 ; } +if (tmp >= nr_online_nodes) + goto invalid; node = tmp; p += count +1 ; -if (node <0 || node >= nr_online_nodes) - goto invalid;/* Parse hugepages */ if (sscanf (p,"%lu%n" , &tmp, &count) !=1 ) goto invalid;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/164 RDMA/rtrs-clt: Fix possible double free in error case
In reply to Greg Kroah-HartmanFrom: Md Haris Iqbal <[email protected]>
[ Upstream commit 8700af2cc18c919b2a83e74e0479038fd113c15d ]
Callback function rtrs_clt_dev_release() for put_device() calls kfree(clt) to free memory. We shouldn't call kfree(clt) again, and we can't use the clt after kfree too.
Replace device_register() with device_initialize() and device_add() so that dev_set_name can() be used appropriately.
Move mutex_destroy() to the release function so it can be called in the alloc_clt err path.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 37 ++++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +20 -17
@@ -2664,6 +2664,8 @@ static void rtrs_clt_dev_release(struct device *dev) { struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); +mutex_destroy (&clt->paths_ev_mutex); +mutex_destroy (&clt->paths_mutex);kfree (clt); }
@@ -2693,6 +2695,8 @@ static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num,return ERR_PTR (-ENOMEM ); } + clt->dev.class = rtrs_clt_dev_class; + clt->dev.release = rtrs_clt_dev_release;uuid_gen (&clt->paths_uuid);INIT_LIST_HEAD_RCU (&clt->paths_list); clt->paths_num = paths_num;
@@ -2709,43 +2713,41 @@ static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num,init_waitqueue_head (&clt->permits_wait);mutex_init (&clt->paths_ev_mutex);mutex_init (&clt->paths_mutex); +device_initialize (&clt->dev); - clt->dev.class = rtrs_clt_dev_class; - clt->dev.release = rtrs_clt_dev_release; err =dev_set_name (&clt->dev,"%s" , sessname);if (err) - goto err; + goto err_put; +/* * Suppress user space notification until * sysfs files are created */ dev_set_uevent_suppress (&clt->dev, true); - err =device_register (&clt->dev); -if (err) { -put_device (&clt->dev); - goto err; - } + err =device_add (&clt->dev); +if (err) + goto err_put; clt->kobj_paths =kobject_create_and_add ("paths" , &clt->dev.kobj);if (!clt->kobj_paths) { err = -ENOMEM ; - goto err_dev; + goto err_del; } err =rtrs_clt_create_sysfs_root_files (clt);if (err) {kobject_del (clt->kobj_paths);kobject_put (clt->kobj_paths); - goto err_dev; + goto err_del; }dev_set_uevent_suppress (&clt->dev, false);kobject_uevent (&clt->dev.kobj,KOBJ_ADD );return clt; -err_dev: -device_unregister (&clt->dev); -err: +err_del: +device_del (&clt->dev); +err_put:free_percpu (clt->pcpu_path); -kfree (clt); +put_device (&clt->dev);return ERR_PTR (err); }
@@ -2753,9 +2755,10 @@ static void free_clt(struct rtrs_clt *clt) {free_permits (clt);free_percpu (clt->pcpu_path); -mutex_destroy (&clt->paths_ev_mutex); -mutex_destroy (&clt->paths_mutex); -/* release callback will free clt in last put */ + +/* +* release callback will free clt and destroy mutexes in last put +*/ device_unregister (&clt->dev); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 132/164 usb: dwc3: gadget: Let the interrupt handler disable bottom halves.
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
commit 84918a89d6efaff075de570b55642b6f4ceeac6d upstream.
The interrupt service routine registered for the gadget is a primary handler which mask the interrupt source and a threaded handler which handles the source of the interrupt. Since the threaded handler is voluntary threaded, the IRQ-core does not disable bottom halves before invoke the handler like it does for the forced-threaded handler.
Due to changes in networking it became visible that a network gadget's completions handler may schedule a softirq which remains unprocessed. The gadget's completion handler is usually invoked either in hard-IRQ or soft-IRQ context. In this context it is enough to just raise the softirq because the softirq itself will be handled once that context is left. In the case of the voluntary threaded handler, there is nothing that will process pending softirqs. Which means it remain queued until another random interrupt (on this CPU) fires and handles it on its exit path or another thread locks and unlocks a lock with the bh suffix. Worst case is that the CPU goes idle and the NOHZ complains about unhandled softirqs.
Disable bottom halves before acquiring the lock (and disabling interrupts) and enable them after dropping the lock. This ensures that any pending softirqs will handled right away.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -4131,9 +4131,11 @@ static irqreturn_t dwc3_thread_interruptunsigned long flags;irqreturn_t ret =IRQ_NONE ; +local_bh_disable ();spin_lock_irqsave (&dwc->lock, flags); ret =dwc3_process_event_buf (evt);spin_unlock_irqrestore (&dwc->lock, flags); +local_bh_enable ();return ret; }
Greg Kroah-Hartman
maintainerPATCH 135/164 nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios property
In reply to Greg Kroah-HartmanFrom: Christophe Kerello <[email protected]>
commit f6c052afe6f802d87c74153b7a57c43b2e9faf07 upstream.
Wp-gpios property can be used on NVMEM nodes and the same property can be also used on MTD NAND nodes. In case of the wp-gpios property is defined at NAND level node, the GPIO management is done at NAND driver level. Write protect is disabled when the driver is probed or resumed and is enabled when the driver is released or suspended.
When no partitions are defined in the NAND DT node, then the NAND DT node will be passed to NVMEM framework. If wp-gpios property is defined in this node, the GPIO resource is taken twice and the NAND controller driver fails to probe.
It would be possible to set config->wp_gpio at MTD level before calling nvmem_register function but NVMEM framework will toggle this GPIO on each write when this GPIO should only be controlled at NAND level driver to ensure that the Write Protect has not been enabled.
A way to fix this conflict is to add a new boolean flag in nvmem_config named ignore_wp. In case ignore_wp is set, the GPIO resource will be managed by the provider.
--- drivers/nvmem/core.c | 2 +- include/linux/nvmem-provider.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/nvmem/core.c +1 -1
@@ -771,7 +771,7 @@ struct nvmem_device *nvmem_register(consif (config->wp_gpio) nvmem->wp_gpio = config->wp_gpio; -else +else if (!config->ignore_wp) nvmem->wp_gpio =gpiod_get_optional (config->dev,"wp" ,GPIOD_OUT_HIGH );if (IS_ERR (nvmem->wp_gpio)) {
include/linux/nvmem-provider.h +3 -1
@@ -70,7 +70,8 @@ struct nvmem_keepout {* @word_size: Minimum read/write access granularity. * @stride: Minimum read/write access stride. * @priv: User context passed to read/write callbacks. -* @wp-gpio: Write protect pin +* @wp-gpio: Write protect pin +* @ignore_wp: Write Protect pin is managed by the provider. * * Note: A default "nvmem<id>" name will be assigned to the device if * no name is specified in its configuration. In such case "<id>" is
@@ -92,6 +93,7 @@ struct nvmem_config {enum nvmem_type type;bool read_only;bool root_only; +bool ignore_wp;struct device_node *of_node;bool no_of_node;nvmem_reg_read_t reg_read;
Greg Kroah-Hartman
maintainerPATCH 139/164 btrfs: defrag: dont defrag extents which are already at max capacity
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit 979b25c300dbcbcb750e88715018e04e854de6c6 upstream.
[BUG]
For compressed extents, defrag ioctl will always try to defrag any compressed extents, wasting not only IO but also CPU time to compress/decompress:
mkfs.btrfs -f $DEV
mount -o compress $DEV $MNT
xfs_io -f -c "pwrite -S 0xab 0 128K" $MNT/foobar sync
xfs_io -f -c "pwrite -S 0xcd 128K 128K" $MNT/foobar sync
echo "=== before ==="
xfs_io -c "fiemap -v" $MNT/foobar
btrfs filesystem defrag $MNT/foobar
sync
echo "=== after ==="
xfs_io -c "fiemap -v" $MNT/foobar
Then it shows the 2 128K extents just get COW for no extra benefit, with extra IO/CPU spent:
=== before ===
/mnt/btrfs/file1:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..255]: 26624..26879 256 0x8
1: [256..511]: 26632..26887 256 0x9
=== after ===
/mnt/btrfs/file1:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..255]: 26640..26895 256 0x8
1: [256..511]: 26648..26903 256 0x9This affects not only v5.16 (after the defrag rework), but also v5.15 (before the defrag rework).
[CAUSE]
Quoted 1 line
From the very beginning, btrfs defrag never checks if one extent is
already at its max capacity (128K for compressed extents, 128M otherwise).
And the default extent size threshold is 256K, which is already beyond the compressed extent max size.
This means, by default btrfs defrag ioctl will mark all compressed extent which is not adjacent to a hole/preallocated range for defrag.
[FIX]
Introduce a helper to grab the maximum extent size, and then in defrag_collect_targets() and defrag_check_next_extent(), reject extents which are already at their max capacity.
--- fs/btrfs/ioctl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
fs/btrfs/ioctl.c +20 -0
@@ -1020,6 +1020,13 @@ static struct extent_map *defrag_lookup_return em; } +static u32 get_extent_max_capacity (const struct extent_map *em) +{ +if (test_bit (EXTENT_FLAG_COMPRESSED , &em->flags)) +return BTRFS_MAX_COMPRESSED ; +return BTRFS_MAX_EXTENT_SIZE ; +} +static bool defrag_check_next_extent (struct inode *inode,struct extent_map *em,bool locked) {
@@ -1036,6 +1043,12 @@ static bool defrag_check_next_extent(str goto out;if (test_bit (EXTENT_FLAG_PREALLOC , &next->flags)) goto out; +/* +* If the next extent is at its max capacity, defragging current extent +* makes no sense, as the total number of extents won't change. +*/ +if (next->len >=get_extent_max_capacity (em)) + goto out;/* Physically adjacent and large enough */ if ((em->block_start + em->block_len == next->block_start) && (em->block_len >SZ_128K && next->block_len >SZ_128K ))
@@ -1233,6 +1246,13 @@ static int defrag_collect_targets(structif (range_len >= extent_thresh) goto next; +/* +* Skip extents already at its max capacity, this is mostly for +* compressed extents, which max cap is only 128K. +*/ +if (em->len >=get_extent_max_capacity (em)) + goto next; + next_mergeable =defrag_check_next_extent (&inode->vfs_inode, em, locked);if (!next_mergeable) {
Greg Kroah-Hartman
maintainerPATCH 131/164 usb: dwc3: pci: Fix Bay Trail phy GPIO mappings
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 62e3f0afe246720f7646eb1b034a6897dac34405 upstream.
When the Bay Trail phy GPIO mappings where added cs and reset were swapped, this did not cause any issues sofar, because sofar they were always driven high/low at the same time.
Note the new mapping has been verified both in /sys/kernel/debug/gpio output on Android factory images on multiple devices, as well as in the schematics for some devices.
--- drivers/usb/dwc3/dwc3-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/dwc3/dwc3-pci.c +2 -2
@@ -85,8 +85,8 @@ static const struct acpi_gpio_mapping acstatic struct gpiod_lookup_table platform_bytcr_gpios = { .dev_id ="0000:00:16.0" , .table = { -GPIO_LOOKUP ("INT33FC:00" ,54 ,"reset" ,GPIO_ACTIVE_HIGH ), -GPIO_LOOKUP ("INT33FC:02" ,14 ,"cs" ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP ("INT33FC:00" ,54 ,"cs" ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP ("INT33FC:02" ,14 ,"reset" ,GPIO_ACTIVE_HIGH ), {} }, };
Greg Kroah-Hartman
maintainerPATCH 133/164 xhci: re-initialize the HC during resume if HCE was set
In reply to Greg Kroah-HartmanFrom: Puma Hsu <[email protected]>
commit 8b328f8002bcf29ef517ee4bf234e09aabec4d2e upstream.
When HCE(Host Controller Error) is set, it means an internal error condition has been detected. Software needs to re-initialize the HC, so add this check in xhci resume.
--- drivers/usb/host/xhci.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/usb/host/xhci.c +13 -6
@@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bint retval =0 ;bool comp_timer_running = false;bool pending_portevent = false; +bool reinit_xhc = false;if (!hcd->state)return 0 ;
@@ -1107,10 +1108,11 @@ int xhci_resume(struct xhci_hcd *xhci, bset_bit (HCD_FLAG_HW_ACCESSIBLE , &xhci->shared_hcd->flags);spin_lock_irq (&xhci->lock); -if ((xhci->quirks &XHCI_RESET_ON_RESUME ) || xhci->broken_suspend) - hibernated = true; -if (!hibernated) { +if (hibernated || xhci->quirks &XHCI_RESET_ON_RESUME || xhci->broken_suspend) + reinit_xhc = true; + +if (!reinit_xhc) {/* * Some controllers might lose power during suspend, so wait * for controller not ready bit to clear, just as in xHC init.
@@ -1143,12 +1145,17 @@ int xhci_resume(struct xhci_hcd *xhci, bspin_unlock_irq (&xhci->lock);return -ETIMEDOUT ; } - temp =readl (&xhci->op_regs->status); } -/* If restore operation fails, re-initialize the HC during resume */ -if ((temp &STS_SRE ) || hibernated) { + temp =readl (&xhci->op_regs->status); + +/* re-initialize the HC on Restore Error, or Host Controller Error */ +if (temp & (STS_SRE |STS_HCE )) { + reinit_xhc = true; +xhci_warn (xhci,"xHC error in resume, USBSTS 0x%x, Reinit\n" , temp); + } +if (reinit_xhc) {if ((xhci->quirks &XHCI_COMP_MODE_QUIRK ) && !(xhci_all_ports_seen_u0 (xhci))) {del_timer_sync (&xhci->comp_mode_recovery_timer);
RE: [PATCH 5.16 022/164] drm/amdgpu: check vm ready by amdgpu_vm->evicting flag
In reply to Greg Kroah-Hartman[Public]
Quoted 47 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, February 28, 2022 12:23 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Paul Menzel <[email protected]>; Koenig, Christian <[email protected]>; Yu, Qiang <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH 5.16 022/164] drm/amdgpu: check vm ready byamdgpu_vm->evictingflagFrom: Qiang Yu <[email protected]>
commit
c1a66c3bc425ff93774fb2f6eefa67b83170dd7eupstream.Workstation application ANSA/META v21.1.4 get this error dmesg when running CI test suite provided by ANSA/META:
[drm:amdgpu_gem_va_ioctl [amdgpu]] *ERROR* Couldn't updateBO_VA(-
16)This is caused by:
1. create a 256MB buffer in invisible VRAM 2. CPU map the buffer and access it causesvm_faultand try to move
it to visible VRAM
3. force visible VRAM space and traverse all VRAM bos to check if evicting this bo is valuable
4. when checking a VM bo (in invisible VRAM),amdgpu_vm_evictable()will setamdgpu_vm->evicting, but latter due to not in visible VRAM, won't really evict it so not add it toamdgpu_vm->evicted5. before
next CS to clear theamdgpu_vm->evicting, user VM ops
ioctl will passamdgpu_vm_ready()(checkamdgpu_vm->evicted) but fail inamdgpu_vm_bo_update_mapping()(checkamdgpu_vm->evicting) and get this error logThis error won't affect functionality as next CS will finish the waiting VM ops. But we'd better clear the error log by checking the
amdgpu_vm->evictingflag inamdgpu_vm_ready()to stop callingamdgpu_vm_bo_update_mapping()later.Another reason is
amdgpu_vm->evictedlist holds all BOs (both user buffer and page table), but only page table BOs' eviction prevent VM ops.amdgpu_vm->evictingflag is set only for page table BOs, so we should use evicting flag instead of evicted list inamdgpu_vm_ready().The side effect of this change is: previously blocked VM op (user buffer in "evicted" list but no page table in it) gets done immediately.
Quoted 8 lines
v2: update commit comments.
Acked-by Paul Menzel <[email protected]>Reviewed-by Christian König <[email protected]>Signed-off-by Qiang Yu <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
A regression was reported against this patch in 5.17. Please drop for now.
Thanks,
Alex
Quoted 25 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7
-2@@ -768,11 +768,16 @@ int amdgpu_vm_validate_pt_bos(struct amd* Check if all VM PDs/PTs are ready for updates * * Returns: -* True if eviction list is empty. +* True if VM is not evicting. */ bool amdgpu_vm_ready (struct amdgpu_vm *vm) { -return list_empty (&vm->evicted); +bool ret; + +amdgpu_vm_eviction_lock (vm); + ret = !vm->evicting; +amdgpu_vm_eviction_unlock (vm); +return ret; }/**
Greg Kroah-Hartman
maintainerRe: [PATCH 5.16 022/164] drm/amdgpu: check vm ready by amdgpu_vm->evicting flag
Quoted 51 lines · Alexander
[Public]
Quoted 49 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, February 28, 2022 12:23 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Paul Menzel <[email protected]>; Koenig, Christian <[email protected]>; Yu, Qiang <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH 5.16 022/164] drm/amdgpu: check vm ready byamdgpu_vm->evictingflagFrom: Qiang Yu <[email protected]>
commit
c1a66c3bc425ff93774fb2f6eefa67b83170dd7eupstream.Workstation application ANSA/META v21.1.4 get this error dmesg when running CI test suite provided by ANSA/META:
[drm:amdgpu_gem_va_ioctl [amdgpu]] *ERROR* Couldn't updateBO_VA(-
16)This is caused by:
1. create a 256MB buffer in invisible VRAM 2. CPU map the buffer and access it causesvm_faultand try to move
it to visible VRAM
3. force visible VRAM space and traverse all VRAM bos to check if evicting this bo is valuable
4. when checking a VM bo (in invisible VRAM),amdgpu_vm_evictable()will setamdgpu_vm->evicting, but latter due to not in visible VRAM, won't really evict it so not add it toamdgpu_vm->evicted5. before
next CS to clear theamdgpu_vm->evicting, user VM ops
ioctl will passamdgpu_vm_ready()(checkamdgpu_vm->evicted) but fail inamdgpu_vm_bo_update_mapping()(checkamdgpu_vm->evicting) and get this error logThis error won't affect functionality as next CS will finish the waiting VM ops. But we'd better clear the error log by checking the
amdgpu_vm->evictingflag inamdgpu_vm_ready()to stop callingamdgpu_vm_bo_update_mapping()later.Another reason is
amdgpu_vm->evictedlist holds all BOs (both user buffer and page table), but only page table BOs' eviction prevent VM ops.amdgpu_vm->evictingflag is set only for page table BOs, so we should use evicting flag instead of evicted list inamdgpu_vm_ready().The side effect of this change is: previously blocked VM op (user buffer in "evicted" list but no page table in it) gets done immediately.
v2: update commit comments.
Quoted 8 lines
Quoted 6 lines
Acked-by Paul Menzel <[email protected]>Reviewed-by Christian König <[email protected]>Signed-off-by Qiang Yu <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>A regression was reported against this patch in 5.17. Please drop for now.
Dropped from 5.10.y, 5.15.y, and 5.16.y. Please feel free to send it to [email protected] when it is now working correctly.
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.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.440 [sec]
# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes
Total time: 6.990 [sec]
6.990131 usecs/op
143058 ops/secThanks
-Zan
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTb using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.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: 5.16.12-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-5.16.y
* git commit: dc69c736a4039f3f7c3d26910013103cdb517bce
* git describe: v5.16.11-165-gdc69c736a403
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.16.y/build/v5.16.11-165-gdc69c736a403
## Test Regressions (compared to v5.16.10-228-ga75faa1f1534) No test regressions found.
## Metric Regressions (compared to v5.16.10-228-ga75faa1f1534) No metric regressions found.
## Test Fixes (compared to v5.16.10-228-ga75faa1f1534) No test fixes found.
## Metric Fixes (compared to v5.16.10-228-ga75faa1f1534) No metric fixes found.
## Test result summary
total: 105073, pass: 89294, fail: 1663, skip: 13057, xfail: 1059
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 141 total, 138 passed, 3 failed
* arm64: 47 total, 44 passed, 3 failed
* dragonboard-410c: 2 total, 2 passed, 0 failed
* hi6220-hikey: 2 total, 2 passed, 0 failed
* i386: 46 total, 42 passed, 4 failed
* juno-r2: 2 total, 2 passed, 0 failed
* mips: 41 total, 38 passed, 3 failed
* parisc: 14 total, 14 passed, 0 failed
* powerpc: 65 total, 50 passed, 15 failed
* riscv: 32 total, 27 passed, 5 failed
* s390: 26 total, 23 passed, 3 failed
* sh: 26 total, 24 passed, 2 failed
* sparc: 14 total, 14 passed, 0 failed
* x15: 2 total, 2 passed, 0 failed
* x86: 2 total, 2 passed, 0 failed
* x86_64: 47 total, 47 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.16:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
122 tests: 122 pass, 0 failLinux version: 5.16.12-rc1-gdc69c736a403
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-a04Jon
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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 11.2.0).
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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.
Hi Greg,
5.16.12-rc1 tested.
Run tested on:
- Allwinner H6 (Tanix TX6)
- Intel Tiger Lake x86_64 (nuc11 i7-1165G7)
In addition - build tested on:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- NXP iMX6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos
--
Rudi
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +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/v5.x/stable-review/patch-5.16.12-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.16.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.
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 488 pass: 488 fail: 0
Guenter
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.16.12 release. There are 164 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, 02 Mar 2022 17:20:16 +0000. Anything received after that time might be too late.
5.16.12-rc1 compiled and booted with no errors or regressions on my x86_64 test system.
Cheers,
Slade