6.4.4-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 757/800 btrfs: delete unused BGs while reclaiming BGs
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit 3ed01616bad6c7e3de196676b542ae3df8058592 upstream.
The reclaiming process only starts after the filesystem volumes are allocated to a certain level (75% by default). Thus, the list of reclaiming target block groups can build up so huge at the time the reclaim process kicks in. On a test run, there were over 1000 BGs in the reclaim list.
As the reclaim involves rewriting the data, it takes really long time to reclaim the BGs. While the reclaim is running, btrfs_delete_unused_bgs() won't proceed because the reclaim side is holding fs_info->reclaim_bgs_lock. As a result, we will have a large number of unused BGs kept in the unused list. On my test run, I got 1057 unused BGs.
Since deleting a block group is relatively easy and fast work, we can call btrfs_delete_unused_bgs() while it reclaims BGs, to avoid building up unused BGs.
--- fs/btrfs/block-group.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/block-group.c +14 -0
@@ -1831,10 +1831,24 @@ void btrfs_reclaim_bgs_work(struct work_ next:btrfs_put_block_group (bg); + +mutex_unlock (&fs_info->reclaim_bgs_lock); +/* +* Reclaiming all the block groups in the list can take really +* long. Prioritize cleaning up unused block groups. +*/ +btrfs_delete_unused_bgs (fs_info); +/* +* If we are interrupted by a balance, we can just bail out. The +* cleaner thread restart again if necessary. +*/ +if (!mutex_trylock (&fs_info->reclaim_bgs_lock)) + goto end;spin_lock (&fs_info->unused_bgs_lock); }spin_unlock (&fs_info->unused_bgs_lock);mutex_unlock (&fs_info->reclaim_bgs_lock); +end:btrfs_exclop_finish (fs_info);sb_end_write (fs_info->sb); }
Greg Kroah-Hartman
maintainerPATCH 784/800 ovl: let helper ovl_i_path_real() return the realinode
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit b2dd05f107b11966e26fe52a313b418364cf497b upstream.
Let helper ovl_i_path_real() return the realinode to prepare for checking non-null realinode in RCU walking path.
[msz] Use d_inode_rcu() since we are depending on the consitency between dentry and inode being non-NULL in an RCU setting.
--- fs/overlayfs/overlayfs.h | 2 +- fs/overlayfs/util.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-)
fs/overlayfs/overlayfs.h +1 -1
@@ -384,7 +384,7 @@ enum ovl_path_type ovl_path_type(structvoid ovl_path_upper (struct dentry *dentry,struct path *path);void ovl_path_lower (struct dentry *dentry,struct path *path);void ovl_path_lowerdata (struct dentry *dentry,struct path *path); -void ovl_i_path_real (struct inode *inode,struct path *path); +struct inode *ovl_i_path_real (struct inode *inode,struct path *path);enum ovl_path_type ovl_path_real (struct dentry *dentry,struct path *path);enum ovl_path_type ovl_path_realdata (struct dentry *dentry,struct path *path);struct dentry *ovl_dentry_upper (struct dentry *dentry);
fs/overlayfs/util.c +4 -3
@@ -266,7 +266,7 @@ struct dentry *ovl_i_dentry_upper(structreturn ovl_upperdentry_dereference (OVL_I (inode)); } -void ovl_i_path_real (struct inode *inode,struct path *path) +struct inode *ovl_i_path_real (struct inode *inode,struct path *path) { path->dentry =ovl_i_dentry_upper (inode);if (!path->dentry) {
@@ -275,6 +275,8 @@ void ovl_i_path_real(struct inode *inode }else { path->mnt =ovl_upper_mnt (OVL_FS (inode->i_sb)); } + +return path->dentry ?d_inode_rcu (path->dentry) :NULL ; }struct inode *ovl_inode_upper (struct inode *inode)
@@ -1121,8 +1123,7 @@ void ovl_copyattr(struct inode *inode)vfsuid_t vfsuid;vfsgid_t vfsgid; -ovl_i_path_real (inode, &realpath); - realinode =d_inode (realpath.dentry); + realinode =ovl_i_path_real (inode, &realpath); real_idmap =mnt_idmap (realpath.mnt); vfsuid =i_uid_into_vfsuid (real_idmap, realinode);
Greg Kroah-Hartman
maintainerPATCH 785/800 ovl: fix null pointer dereference in ovl_get_acl_rcu()
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit f4e19e595cc2e76a8a58413eb19d3d9c51328b53 upstream.
Following process:
P1 P2
path_openat
link_path_walk
may_lookup
inode_permission(rcu)
ovl_permission
acl_permission_check
check_acl
get_cached_acl_rcu
ovl_get_inode_acl
realinode = ovl_inode_real(ovl_inode)
drop_cache
__dentry_kill(ovl_dentry)
iput(ovl_inode)
ovl_destroy_inode(ovl_inode)
dput(oi->__upperdentry)
dentry_kill(upperdentry)
dentry_unlink_inode
upperdentry->d_inode = NULL
ovl_inode_upper
upperdentry = ovl_i_dentry_upper(ovl_inode) d_inode(upperdentry) // returns NULL
IS_POSIXACL(realinode) // NULL pointer dereference
, will trigger an null pointer dereference at realinode:
[ 205.472797] BUG: kernel NULL pointer dereference, address:
0000000000000028
[ 205.476701] CPU: 2 PID: 2713 Comm: ls Not tainted
6.3.0-12064-g2edfa098e750-dirty #1216
[ 205.478754] RIP: 0010:do_ovl_get_acl+0x5d/0x300
[ 205.489584] Call Trace:
[ 205.489812] <TASK>
[ 205.490014] ovl_get_inode_acl+0x26/0x30
[ 205.490466] get_cached_acl_rcu+0x61/0xa0
[ 205.490908] generic_permission+0x1bf/0x4e0
[ 205.491447] ovl_permission+0x79/0x1b0
[ 205.491917] inode_permission+0x15e/0x2c0
[ 205.492425] link_path_walk+0x115/0x550
[ 205.493311] path_lookupat.isra.0+0xb2/0x200
[ 205.493803] filename_lookup+0xda/0x240
[ 205.495747] vfs_fstatat+0x7b/0xb0Fetch a reproducer in [Link].
Use the helper ovl_i_path_realinode() to get realinode and then do non-nullptr checking.
--- fs/overlayfs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/overlayfs/inode.c +6 -6
@@ -558,20 +558,20 @@ struct posix_acl *do_ovl_get_acl(struct struct inode *inode, int type, bool rcu, bool noperm) { - struct inode *realinode = ovl_inode_real(inode); + struct inode *realinode;struct posix_acl *acl;struct path realpath; -if (!IS_POSIXACL (realinode)) -return NULL ; -/* Careful in RCU walk mode */ -ovl_i_path_real (inode, &realpath); -if (!realpath.dentry) { + realinode =ovl_i_path_real (inode, &realpath); +if (!realinode) {WARN_ON (!rcu);return ERR_PTR (-ECHILD ); } +if (!IS_POSIXACL (realinode)) +return NULL ; +if (rcu) {/* * If the layer is idmapped drop out of RCU path walk
Greg Kroah-Hartman
maintainerPATCH 758/800 btrfs: bail out reclaim process if filesystem is read-only
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit 93463ff7b54626f8276c0bd3d3f968fbf8d5d380 upstream.
When a filesystem is read-only, we cannot reclaim a block group as it cannot rewrite the data. Just bail out in that case.
Note that it can drop block groups in this case. As we did sb_start_write(), read-only filesystem means we got a fatal error and forced read-only. There is no chance to reclaim them again.
--- fs/btrfs/block-group.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/btrfs/block-group.c +9 -2
@@ -1798,8 +1798,15 @@ void btrfs_reclaim_bgs_work(struct work_ }spin_unlock (&bg->lock); -/* Get out fast, in case we're unmounting the filesystem */ -if (btrfs_fs_closing (fs_info)) { +/* +* Get out fast, in case we're read-only or unmounting the +* filesystem. It is OK to drop block groups from the list even +* for the read-only case. As we did sb_start_write(), +* "mount -o remount,ro" won't happen and read-only filesystem +* means it is forced read-only due to a fatal error. So, it +* never gets back to read-write to let us reclaim again. +*/ +if (btrfs_need_cleaner_sleep (fs_info)) {up_write (&space_info->groups_sem); goto next; }
Greg Kroah-Hartman
maintainerPATCH 759/800 btrfs: add block-group tree to lockdep classes
In reply to Greg Kroah-HartmanFrom: David Sterba <[email protected]>
commit 1a1b0e729d227f9f758f7b5f1c997e874e94156e upstream.
The block group tree was not present among the lockdep classes. We could get potentially lockdep warnings but so far none has been seen, also because block-group-tree is a relatively new feature.
--- fs/btrfs/locking.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/locking.c +3 -2
@@ -57,8 +57,8 @@static struct btrfs_lockdep_keyset {u64 id;/* root objectid */ -/* Longest entry: btrfs-free-space-00 */ -char names[BTRFS_MAX_LEVEL ][20 ]; +/* Longest entry: btrfs-block-group-00 */ +char names[BTRFS_MAX_LEVEL ][24 ];struct lock_class_key keys[BTRFS_MAX_LEVEL ]; } btrfs_lockdep_keysets[] = { { .id =BTRFS_ROOT_TREE_OBJECTID ,DEFINE_NAME ("root" ) },
@@ -72,6 +72,7 @@ static struct btrfs_lockdep_keyset { { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, DEFINE_NAME("dreloc") }, { .id = BTRFS_UUID_TREE_OBJECTID, DEFINE_NAME("uuid") }, { .id = BTRFS_FREE_SPACE_TREE_OBJECTID, DEFINE_NAME("free-space") }, + { .id = BTRFS_BLOCK_GROUP_TREE_OBJECTID, DEFINE_NAME("block-group") }, { .id = 0, DEFINE_NAME("tree") }, };
Greg Kroah-Hartman
maintainerPATCH 760/800 btrfs: reinsert BGs failed to reclaim
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit 7e27180994383b7c741ad87749db01e4989a02ba upstream.
The reclaim process can temporarily fail. For example, if the space is getting tight, it fails to make the block group read-only. If there are no further writes on that block group, the block group will never get back to the reclaim list, and the BG never gets reclaimed. In a certain workload, we can leave many such block groups never reclaimed.
So, let's get it back to the list and give it a chance to be reclaimed.
--- fs/btrfs/block-group.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/block-group.c +2 -0
@@ -1837,6 +1837,8 @@ void btrfs_reclaim_bgs_work(struct work_ } next: +if (ret) +btrfs_mark_bg_to_reclaim (bg);btrfs_put_block_group (bg);mutex_unlock (&fs_info->reclaim_bgs_lock);
Greg Kroah-Hartman
maintainerPATCH 761/800 btrfs: move out now unused BG from the reclaim list
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit a9f189716cf15913c453299d72f69c51a9b0f86b upstream.
An unused block group is easy to remove to free up space and should be reclaimed fast. Such block group can often already be a target of the reclaim process. As we check list_empty(&bg->bg_list), we keep it in the reclaim list. That block group is never reclaimed until the file system is filled e.g. up to 75%.
Instead, we can move unused block group to the unused list and delete it fast.
--- fs/btrfs/block-group.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/btrfs/block-group.c +4 -1
@@ -1640,11 +1640,14 @@ void btrfs_mark_bg_unused(struct btrfs_b {struct btrfs_fs_info *fs_info = bg->fs_info; +trace_btrfs_add_unused_block_group (bg);spin_lock (&fs_info->unused_bgs_lock);if (list_empty (&bg->bg_list)) {btrfs_get_block_group (bg); -trace_btrfs_add_unused_block_group (bg);list_add_tail (&bg->bg_list, &fs_info->unused_bgs); + }else { +/* Pull out the block group from the reclaim_bgs list. */ +list_move_tail (&bg->bg_list, &fs_info->unused_bgs); }spin_unlock (&fs_info->unused_bgs_lock); }
Greg Kroah-Hartman
maintainerPATCH 762/800 btrfs: fix race when deleting quota root from the dirty cow roots list
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit b31cb5a6eb7a48b0a7bfdf06832b1fd5088d8c79 upstream.
When disabling quotas we are deleting the quota root from the list fs_info->dirty_cowonly_roots without taking the lock that protects it, which is struct btrfs_fs_info::trans_lock. This unsynchronized list manipulation may cause chaos if there's another concurrent manipulation of this list, such as when adding a root to it with ctree.c:add_root_to_dirty_list().
This can result in all sorts of weird failures caused by a race, such as the following crash:
[337571.278245] general protection fault, probably for non-canonical address 0xdead000000000108: 0000 [#1] PREEMPT SMP PTI [337571.278933] CPU: 1 PID: 115447 Comm: btrfs Tainted: G W 6.4.0-rc6-btrfs-next-134+ #1 [337571.279153] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [337571.279572] RIP: 0010:commit_cowonly_roots+0x11f/0x250 [btrfs] [337571.279928] Code: 85 38 06 00 (...) [337571.280363] RSP: 0018:ffff9f63446efba0 EFLAGS: 00010206 [337571.280582] RAX: ffff942d98ec2638 RBX: ffff9430b82b4c30 RCX: 0000000449e1c000 [337571.280798] RDX: dead000000000100 RSI: ffff9430021e4900 RDI: 0000000000036070 [337571.281015] RBP: ffff942d98ec2000 R08: ffff942d98ec2000 R09: 000000000000015b [337571.281254] R10: 0000000000000009 R11: 0000000000000001 R12: ffff942fe8fbf600 [337571.281476] R13: ffff942dabe23040 R14: ffff942dabe20800 R15: ffff942d92cf3b48 [337571.281723] FS: 00007f478adb7340(0000) GS:ffff94349fa40000(0000) knlGS:0000000000000000 [337571.281950] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [337571.282184] CR2: 00007f478ab9a3d5 CR3: 000000001e02c001 CR4: 0000000000370ee0 [337571.282416] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [337571.282647] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [337571.282874] Call Trace: [337571.283101] <TASK> [337571.283327] ? __die_body+0x1b/0x60 [337571.283570] ? die_addr+0x39/0x60 [337571.283796] ? exc_general_protection+0x22e/0x430 [337571.284022] ? asm_exc_general_protection+0x22/0x30 [337571.284251] ? commit_cowonly_roots+0x11f/0x250 [btrfs] [337571.284531] btrfs_commit_transaction+0x42e/0xf90 [btrfs] [337571.284803] ? _raw_spin_unlock+0x15/0x30 [337571.285031] ? release_extent_buffer+0x103/0x130 [btrfs] [337571.285305] reset_balance_state+0x152/0x1b0 [btrfs] [337571.285578] btrfs_balance+0xa50/0x11e0 [btrfs] [337571.285864] ? __kmem_cache_alloc_node+0x14a/0x410 [337571.286086] btrfs_ioctl+0x249a/0x3320 [btrfs] [337571.286358] ? mod_objcg_state+0xd2/0x360 [337571.286577] ? refill_obj_stock+0xb0/0x160 [337571.286798] ? seq_release+0x25/0x30 [337571.287016] ? __rseq_handle_notify_resume+0x3ba/0x4b0 [337571.287235] ? percpu_counter_add_batch+0x2e/0xa0 [337571.287455] ? __x64_sys_ioctl+0x88/0xc0 [337571.287675] __x64_sys_ioctl+0x88/0xc0 [337571.287901] do_syscall_64+0x38/0x90 [337571.288126] entry_SYSCALL_64_after_hwframe+0x72/0xdc [337571.288352] RIP: 0033:0x7f478aaffe9b
So fix this by locking struct btrfs_fs_info::trans_lock before deleting the quota root from that list.
--- fs/btrfs/qgroup.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/qgroup.c +2 -0
@@ -1301,7 +1301,9 @@ int btrfs_quota_disable(struct btrfs_fs_ goto out; } +spin_lock (&fs_info->trans_lock);list_del ("a_root->dirty_list); +spin_unlock (&fs_info->trans_lock);btrfs_tree_lock (quota_root->node);btrfs_clear_buffer_dirty (trans, quota_root->node);
Greg Kroah-Hartman
maintainerPATCH 763/800 btrfs: add missing error handling when logging operation while COWing extent buffer
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit d09c51521f22f9cbdfb1cf63e5c456077c622c84 upstream.
When COWing an extent buffer that is not the root node, we need to log in the tree mod log that we replaced a pointer in the parent node, otherwise a tree mod log user doing a search on the b+tree can return incorrect results (that miss something). We are doing the call to btrfs_tree_mod_log_insert_key() but we totally ignore its return value.
So fix this by adding the missing error handling, resulting in a transaction abort and freeing the COWed extent buffer.
--- fs/btrfs/ctree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/ctree.c +8 -2
@@ -594,8 +594,14 @@ static noinline int __btrfs_cow_block(stadd_root_to_dirty_list (root); }else {WARN_ON (trans->transid !=btrfs_header_generation (parent)); -btrfs_tree_mod_log_insert_key (parent, parent_slot, -BTRFS_MOD_LOG_KEY_REPLACE ); + ret =btrfs_tree_mod_log_insert_key (parent, parent_slot, +BTRFS_MOD_LOG_KEY_REPLACE ); +if (ret) { +btrfs_tree_unlock (cow); +free_extent_buffer (cow); +btrfs_abort_transaction (trans, ret); +return ret; + }btrfs_set_node_blockptr (parent, parent_slot, cow->start); btrfs_set_node_ptr_generation(parent, parent_slot,
Greg Kroah-Hartman
maintainerPATCH 754/800 btrfs: fix dirty_metadata_bytes for redirtied buffers
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
commit f18cc97845aa4ae0e795c088c979fe1642b3b8e5 upstream.
dirty_metadata_bytes is decremented in both places that clear the dirty bit in a buffer, but only incremented in btrfs_mark_buffer_dirty, which means that a buffer that is redirtied using btrfs_redirty_list_add won't be added to dirty_metadata_bytes, but it will be subtracted when written out, leading an inconsistency in the counter.
Move the dirty_metadata_bytes from btrfs_mark_buffer_dirty into set_extent_buffer_dirty to also account for the redirty case, and remove the now unused set_extent_buffer_dirty return value.
--- fs/btrfs/disk-io.c | 7 +------ fs/btrfs/extent_io.c | 7 ++++--- fs/btrfs/extent_io.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-)
fs/btrfs/disk-io.c +1 -6
@@ -4683,7 +4683,6 @@ void btrfs_mark_buffer_dirty(struct exte {struct btrfs_fs_info *fs_info = buf->fs_info;u64 transid =btrfs_header_generation (buf); -int was_dirty;#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS /*
@@ -4698,11 +4697,7 @@ void btrfs_mark_buffer_dirty(struct exteif (transid != fs_info->generation)WARN (1 ,KERN_CRIT "btrfs transid mismatch buffer %llu, found %llu running %llu\n" , buf->start, transid, fs_info->generation); - was_dirty =set_extent_buffer_dirty (buf); -if (!was_dirty) -percpu_counter_add_batch (&fs_info->dirty_metadata_bytes, - buf->len, - fs_info->dirty_metadata_batch); +set_extent_buffer_dirty (buf);#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY /* * Since btrfs_mark_buffer_dirty() can be called with item pointer set
fs/btrfs/extent_io.c +4 -3
@@ -4064,7 +4064,7 @@ void btrfs_clear_buffer_dirty(struct btrWARN_ON (atomic_read (&eb->refs) ==0 ); } -bool set_extent_buffer_dirty (struct extent_buffer *eb) +void set_extent_buffer_dirty (struct extent_buffer *eb) {int i;int num_pages;
@@ -4099,13 +4099,14 @@ bool set_extent_buffer_dirty(struct exte eb->start, eb->len);if (subpage)unlock_page (eb->pages[0 ]); +percpu_counter_add_batch (&eb->fs_info->dirty_metadata_bytes, + eb->len, + eb->fs_info->dirty_metadata_batch); }#ifdef CONFIG_BTRFS_DEBUG for (i =0 ; i < num_pages; i++)ASSERT (PageDirty (eb->pages[i]));#endif - -return was_dirty; }void clear_extent_buffer_uptodate (struct extent_buffer *eb)
fs/btrfs/extent_io.h +1 -1
@@ -263,7 +263,7 @@ void extent_buffer_bitmap_set(const struvoid extent_buffer_bitmap_clear (const struct extent_buffer *eb,unsigned long start,unsigned long pos,unsigned long len); -bool set_extent_buffer_dirty (struct extent_buffer *eb); +void set_extent_buffer_dirty (struct extent_buffer *eb);void set_extent_buffer_uptodate (struct extent_buffer *eb);void clear_extent_buffer_uptodate (struct extent_buffer *eb);int extent_buffer_under_io (const struct extent_buffer *eb);
Greg Kroah-Hartman
maintainerPATCH 787/800 drm/amdgpu: make sure BOs are locked in amdgpu_vm_get_memory
In reply to Greg Kroah-HartmanFrom: Christian K�nig <[email protected]>
commit e2ad8e2df432498b1cee2af04df605723f4d75e6 upstream.
We need to grab the lock of the BO or otherwise can run into a crash when we try to inspect the current location.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 69 ++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +39 -30
@@ -920,42 +920,51 @@ error_unlock:return r; } +static void amdgpu_vm_bo_get_memory (struct amdgpu_bo_va *bo_va, +struct amdgpu_mem_stats *stats) +{ +struct amdgpu_vm *vm = bo_va->base.vm; +struct amdgpu_bo *bo = bo_va->base.bo; + +if (!bo) +return ; + +/* +* For now ignore BOs which are currently locked and potentially +* changing their location. +*/ +if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv && + !dma_resv_trylock (bo->tbo.base.resv)) +return ; + +amdgpu_bo_get_memory (bo, stats); +if (bo->tbo.base.resv != vm->root.bo->tbo.base.resv) +dma_resv_unlock (bo->tbo.base.resv); +} +void amdgpu_vm_get_memory (struct amdgpu_vm *vm,struct amdgpu_mem_stats *stats) {struct amdgpu_bo_va *bo_va, *tmp;spin_lock (&vm->status_lock); -list_for_each_entry_safe (bo_va, tmp, &vm->idle, base.vm_status) { -if (!bo_va->base.bo) -continue ; -amdgpu_bo_get_memory (bo_va->base.bo, stats); - } -list_for_each_entry_safe (bo_va, tmp, &vm->evicted, base.vm_status) { -if (!bo_va->base.bo) -continue ; -amdgpu_bo_get_memory (bo_va->base.bo, stats); - } -list_for_each_entry_safe (bo_va, tmp, &vm->relocated, base.vm_status) { -if (!bo_va->base.bo) -continue ; -amdgpu_bo_get_memory (bo_va->base.bo, stats); - } -list_for_each_entry_safe (bo_va, tmp, &vm->moved, base.vm_status) { -if (!bo_va->base.bo) -continue ; -amdgpu_bo_get_memory (bo_va->base.bo, stats); - } -list_for_each_entry_safe (bo_va, tmp, &vm->invalidated, base.vm_status) { -if (!bo_va->base.bo) -continue ; -amdgpu_bo_get_memory (bo_va->base.bo, stats); - } -list_for_each_entry_safe (bo_va, tmp, &vm->done, base.vm_status) { -if (!bo_va->base.bo) -continue ; -amdgpu_bo_get_memory (bo_va->base.bo, stats); - } +list_for_each_entry_safe (bo_va, tmp, &vm->idle, base.vm_status) +amdgpu_vm_bo_get_memory (bo_va, stats); + +list_for_each_entry_safe (bo_va, tmp, &vm->evicted, base.vm_status) +amdgpu_vm_bo_get_memory (bo_va, stats); + +list_for_each_entry_safe (bo_va, tmp, &vm->relocated, base.vm_status) +amdgpu_vm_bo_get_memory (bo_va, stats); + +list_for_each_entry_safe (bo_va, tmp, &vm->moved, base.vm_status) +amdgpu_vm_bo_get_memory (bo_va, stats); + +list_for_each_entry_safe (bo_va, tmp, &vm->invalidated, base.vm_status) +amdgpu_vm_bo_get_memory (bo_va, stats); + +list_for_each_entry_safe (bo_va, tmp, &vm->done, base.vm_status) +amdgpu_vm_bo_get_memory (bo_va, stats);spin_unlock (&vm->status_lock); }
Greg Kroah-Hartman
maintainerPATCH 796/800 netfilter: nf_tables: prevent OOB access in nft_byteorder_eval
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit caf3ef7468f7534771b5c44cd8dbd6f7f87c2cbd upstream.
When evaluating byteorder expressions with size 2, a union with 32-bit and 16-bit members is used. Since the 16-bit members are aligned to 32-bit, the array accesses will be out-of-bounds.
It may lead to a stack-out-of-bounds access like the one below:
[ 23.095215] ================================================================== [ 23.095625] BUG: KASAN: stack-out-of-bounds in nft_byteorder_eval+0x13c/0x320 [ 23.096020] Read of size 2 at addr ffffc90000007948 by task ping/115 [ 23.096358] [ 23.096456] CPU: 0 PID: 115 Comm: ping Not tainted 6.4.0+ #413 [ 23.096770] Call Trace: [ 23.096910] <IRQ> [ 23.097030] dump_stack_lvl+0x60/0xc0 [ 23.097218] print_report+0xcf/0x630 [ 23.097388] ? nft_byteorder_eval+0x13c/0x320 [ 23.097577] ? kasan_addr_to_slab+0xd/0xc0 [ 23.097760] ? nft_byteorder_eval+0x13c/0x320 [ 23.097949] kasan_report+0xc9/0x110 [ 23.098106] ? nft_byteorder_eval+0x13c/0x320 [ 23.098298] __asan_load2+0x83/0xd0 [ 23.098453] nft_byteorder_eval+0x13c/0x320 [ 23.098659] nft_do_chain+0x1c8/0xc50 [ 23.098852] ? __pfx_nft_do_chain+0x10/0x10 [ 23.099078] ? __kasan_check_read+0x11/0x20 [ 23.099295] ? __pfx___lock_acquire+0x10/0x10 [ 23.099535] ? __pfx___lock_acquire+0x10/0x10 [ 23.099745] ? __kasan_check_read+0x11/0x20 [ 23.099929] nft_do_chain_ipv4+0xfe/0x140 [ 23.100105] ? __pfx_nft_do_chain_ipv4+0x10/0x10 [ 23.100327] ? lock_release+0x204/0x400 [ 23.100515] ? nf_hook.constprop.0+0x340/0x550 [ 23.100779] nf_hook_slow+0x6c/0x100 [ 23.100977] ? __pfx_nft_do_chain_ipv4+0x10/0x10 [ 23.101223] nf_hook.constprop.0+0x334/0x550 [ 23.101443] ? __pfx_ip_local_deliver_finish+0x10/0x10 [ 23.101677] ? __pfx_nf_hook.constprop.0+0x10/0x10 [ 23.101882] ? __pfx_ip_rcv_finish+0x10/0x10 [ 23.102071] ? __pfx_ip_local_deliver_finish+0x10/0x10 [ 23.102291] ? rcu_read_lock_held+0x4b/0x70 [ 23.102481] ip_local_deliver+0xbb/0x110 [ 23.102665] ? __pfx_ip_rcv+0x10/0x10 [ 23.102839] ip_rcv+0x199/0x2a0 [ 23.102980] ? __pfx_ip_rcv+0x10/0x10 [ 23.103140] __netif_receive_skb_one_core+0x13e/0x150 [ 23.103362] ? __pfx___netif_receive_skb_one_core+0x10/0x10 [ 23.103647] ? mark_held_locks+0x48/0xa0 [ 23.103819] ? process_backlog+0x36c/0x380 [ 23.103999] __netif_receive_skb+0x23/0xc0 [ 23.104179] process_backlog+0x91/0x380 [ 23.104350] __napi_poll.constprop.0+0x66/0x360 [ 23.104589] ? net_rx_action+0x1cb/0x610 [ 23.104811] net_rx_action+0x33e/0x610 [ 23.105024] ? _raw_spin_unlock+0x23/0x50 [ 23.105257] ? __pfx_net_rx_action+0x10/0x10 [ 23.105485] ? mark_held_locks+0x48/0xa0 [ 23.105741] __do_softirq+0xfa/0x5ab [ 23.105956] ? __dev_queue_xmit+0x765/0x1c00 [ 23.106193] do_softirq.part.0+0x49/0xc0 [ 23.106423] </IRQ> [ 23.106547] <TASK> [ 23.106670] __local_bh_enable_ip+0xf5/0x120 [ 23.106903] __dev_queue_xmit+0x789/0x1c00 [ 23.107131] ? __pfx___dev_queue_xmit+0x10/0x10 [ 23.107381] ? find_held_lock+0x8e/0xb0 [ 23.107585] ? lock_release+0x204/0x400 [ 23.107798] ? neigh_resolve_output+0x185/0x350 [ 23.108049] ? mark_held_locks+0x48/0xa0 [ 23.108265] ? neigh_resolve_output+0x185/0x350 [ 23.108514] neigh_resolve_output+0x246/0x350 [ 23.108753] ? neigh_resolve_output+0x246/0x350 [ 23.109003] ip_finish_output2+0x3c3/0x10b0 [ 23.109250] ? __pfx_ip_finish_output2+0x10/0x10 [ 23.109510] ? __pfx_nf_hook+0x10/0x10 [ 23.109732] __ip_finish_output+0x217/0x390 [ 23.109978] ip_finish_output+0x2f/0x130 [ 23.110207] ip_output+0xc9/0x170 [ 23.110404] ip_push_pending_frames+0x1a0/0x240 [ 23.110652] raw_sendmsg+0x102e/0x19e0 [ 23.110871] ? __pfx_raw_sendmsg+0x10/0x10 [ 23.111093] ? lock_release+0x204/0x400 [ 23.111304] ? __mod_lruvec_page_state+0x148/0x330 [ 23.111567] ? find_held_lock+0x8e/0xb0 [ 23.111777] ? find_held_lock+0x8e/0xb0 [ 23.111993] ? __rcu_read_unlock+0x7c/0x2f0 [ 23.112225] ? aa_sk_perm+0x18a/0x550 [ 23.112431] ? filemap_map_pages+0x4f1/0x900 [ 23.112665] ? __pfx_aa_sk_perm+0x10/0x10 [ 23.112880] ? find_held_lock+0x8e/0xb0 [ 23.113098] inet_sendmsg+0xa0/0xb0 [ 23.113297] ? inet_sendmsg+0xa0/0xb0 [ 23.113500] ? __pfx_inet_sendmsg+0x10/0x10 [ 23.113727] sock_sendmsg+0xf4/0x100 [ 23.113924] ? move_addr_to_kernel.part.0+0x4f/0xa0 [ 23.114190] __sys_sendto+0x1d4/0x290 [ 23.114391] ? __pfx___sys_sendto+0x10/0x10 [ 23.114621] ? __pfx_mark_lock.part.0+0x10/0x10 [ 23.114869] ? lock_release+0x204/0x400 [ 23.115076] ? find_held_lock+0x8e/0xb0 [ 23.115287] ? rcu_is_watching+0x23/0x60 [ 23.115503] ? __rseq_handle_notify_resume+0x6e2/0x860 [ 23.115778] ? __kasan_check_write+0x14/0x30 [ 23.116008] ? blkcg_maybe_throttle_current+0x8d/0x770 [ 23.116285] ? mark_held_locks+0x28/0xa0 [ 23.116503] ? do_syscall_64+0x37/0x90 [ 23.116713] __x64_sys_sendto+0x7f/0xb0 [ 23.116924] do_syscall_64+0x59/0x90 [ 23.117123] ? irqentry_exit_to_user_mode+0x25/0x30 [ 23.117387] ? irqentry_exit+0x77/0xb0 [ 23.117593] ? exc_page_fault+0x92/0x140 [ 23.117806] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 [ 23.118081] RIP: 0033:0x7f744aee2bba [ 23.118282] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89 [ 23.119237] RSP: 002b:00007ffd04a7c9f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c [ 23.119644] RAX: ffffffffffffffda RBX: 00007ffd04a7e0a0 RCX: 00007f744aee2bba [ 23.120023] RDX: 0000000000000040 RSI: 000056488e9e6300 RDI: 0000000000000003 [ 23.120413] RBP: 000056488e9e6300 R08: 00007ffd04a80320 R09: 0000000000000010 [ 23.120809] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000040 [ 23.121219] R13: 00007ffd04a7dc38 R14: 00007ffd04a7ca00 R15: 00007ffd04a7e0a0 [ 23.121617] </TASK> [ 23.121749] [ 23.121845] The buggy address belongs to the virtual mapping at [ 23.121845] [ffffc90000000000, ffffc90000009000) created by: [ 23.121845] irq_init_percpu_irqstack+0x1cf/0x270 [ 23.122707] [ 23.122803] The buggy address belongs to the physical page: [ 23.123104] page:0000000072ac19f0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24a09 [ 23.123609] flags: 0xfffffc0001000(reserved|node=0|zone=1|lastcpupid=0x1fffff) [ 23.123998] page_type: 0xffffffff() [ 23.124194] raw: 000fffffc0001000 ffffea0000928248 ffffea0000928248 0000000000000000 [ 23.124610] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 23.125023] page dumped because: kasan: bad access detected [ 23.125326] [ 23.125421] Memory state around the buggy address: [ 23.125682] ffffc90000007800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 23.126072] ffffc90000007880: 00 00 00 00 00 f1 f1 f1 f1 f1 f1 00 00 f2 f2 00 [ 23.126455] >ffffc90000007900: 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 [ 23.126840] ^ [ 23.127138] ffffc90000007980: 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 [ 23.127522] ffffc90000007a00: f3 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 [ 23.127906] ================================================================== [ 23.128324] Disabling lock debugging due to kernel taint
Using simple s16 pointers for the 16-bit accesses fixes the problem. For the 32-bit accesses, src and dst can be used directly.
--- net/netfilter/nft_byteorder.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/netfilter/nft_byteorder.c +7 -7
@@ -30,11 +30,11 @@ void nft_byteorder_eval(const struct nftconst struct nft_byteorder *priv =nft_expr_priv (expr);u32 *src = ®s->data[priv->sreg];u32 *dst = ®s->data[priv->dreg]; -union {u32 u32;u16 u16; } *s, *d; +u16 *s16, *d16;unsigned int i; - s = (void *)src; - d = (void *)dst; + s16 = (void *)src; + d16 = (void *)dst;switch (priv->size) {case 8 : {
@@ -62,11 +62,11 @@ void nft_byteorder_eval(const struct nftswitch (priv->op) {case NFT_BYTEORDER_NTOH :for (i =0 ; i < priv->len /4 ; i++) - d[i].u32 =ntohl ((__force __be32 )s[i].u32); + dst[i] =ntohl ((__force __be32 )src[i]);break ;case NFT_BYTEORDER_HTON :for (i =0 ; i < priv->len /4 ; i++) - d[i].u32 = (__force __u32 )htonl (s[i].u32); + dst[i] = (__force __u32 )htonl (src[i]);break ; }break ;
@@ -74,11 +74,11 @@ void nft_byteorder_eval(const struct nftswitch (priv->op) {case NFT_BYTEORDER_NTOH :for (i =0 ; i < priv->len /2 ; i++) - d[i].u16 =ntohs ((__force __be16 )s[i].u16); + d16[i] =ntohs ((__force __be16 )s16[i]);break ;case NFT_BYTEORDER_HTON :for (i =0 ; i < priv->len /2 ; i++) - d[i].u16 = (__force __u16 )htons (s[i].u16); + d16[i] = (__force __u16 )htons (s16[i]);break ; }break ;
Greg Kroah-Hartman
maintainerPATCH 797/800 wireguard: queueing: use saner cpu selection wrapping
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit 7387943fa35516f6f8017a3b0e9ce48a3bef9faa upstream.
Using % nr_cpumask_bits is slow and complicated, and not totally robust toward dynamic changes to CPU topologies. Rather than storing the next CPU in the round-robin, just store the last one, and also return that value. This simplifies the loop drastically into a much more common pattern.
--- drivers/net/wireguard/queueing.c | 1 + drivers/net/wireguard/queueing.h | 25 +++++++++++-------------- drivers/net/wireguard/receive.c | 2 +- drivers/net/wireguard/send.c | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-)
drivers/net/wireguard/queueing.c +1 -0
@@ -28,6 +28,7 @@ int wg_packet_queue_init(struct crypt_quint ret;memset (queue,0 ,sizeof (*queue)); + queue->last_cpu =-1 ; ret =ptr_ring_init (&queue->ring, len,GFP_KERNEL );if (ret)return ret;
drivers/net/wireguard/queueing.h +11 -14
@@ -117,20 +117,17 @@ static inline int wg_cpumask_choose_onlireturn cpu; } -/* This function is racy, in the sense that next is unlocked, so it could return -* the same CPU twice. A race-free version of this would be to instead store an -* atomic sequence number, do an increment-and-return, and then iterate through -* every possible CPU until we get to that index -- choose_cpu. However that's -* a bit slower, and it doesn't seem like this potential race actually -* introduces any performance loss, so we live with it. +/* This function is racy, in the sense that it's called while last_cpu is +* unlocked, so it could return the same CPU twice. Adding locking or using +* atomic sequence numbers is slower though, and the consequences of racing are +* harmless, so live with it. */ -static inline int wg_cpumask_next_online (int *next) +static inline int wg_cpumask_next_online (int *last_cpu) { -int cpu = *next; - -while (unlikely (!cpumask_test_cpu (cpu, cpu_online_mask))) - cpu =cpumask_next (cpu, cpu_online_mask) % nr_cpumask_bits; - *next =cpumask_next (cpu, cpu_online_mask) % nr_cpumask_bits; +int cpu =cpumask_next (*last_cpu, cpu_online_mask); +if (cpu >= nr_cpu_ids) + cpu =cpumask_first (cpu_online_mask); + *last_cpu = cpu;return cpu; }
@@ -159,7 +156,7 @@ static inline void wg_prev_queue_drop_pestatic inline int wg_queue_enqueue_per_device_and_peer (struct crypt_queue *device_queue,struct prev_queue *peer_queue, -struct sk_buff *skb,struct workqueue_struct *wq,int *next_cpu) +struct sk_buff *skb,struct workqueue_struct *wq) {int cpu;
@@ -173,7 +170,7 @@ static inline int wg_queue_enqueue_per_d/* Then we queue it up in the device queue, which consumes the * packet as soon as it can. */ - cpu =wg_cpumask_next_online (next_cpu); + cpu =wg_cpumask_next_online (&device_queue->last_cpu);if (unlikely (ptr_ring_produce_bh (&device_queue->ring, skb)))return -EPIPE ;queue_work_on (cpu, wq, &per_cpu_ptr (device_queue->worker, cpu)->work);
drivers/net/wireguard/receive.c +1 -1
@@ -524,7 +524,7 @@ static void wg_packet_consume_data(struc goto err; ret =wg_queue_enqueue_per_device_and_peer (&wg->decrypt_queue, &peer->rx_queue, skb, - wg->packet_crypt_wq, &wg->decrypt_queue.last_cpu); + wg->packet_crypt_wq);if (unlikely (ret == -EPIPE ))wg_queue_enqueue_per_peer_rx (skb,PACKET_STATE_DEAD );if (likely (!ret || ret == -EPIPE )) {
drivers/net/wireguard/send.c +1 -1
@@ -318,7 +318,7 @@ static void wg_packet_create_data(struct goto err; ret =wg_queue_enqueue_per_device_and_peer (&wg->encrypt_queue, &peer->tx_queue, first, - wg->packet_crypt_wq, &wg->encrypt_queue.last_cpu); + wg->packet_crypt_wq);if (unlikely (ret == -EPIPE ))wg_queue_enqueue_per_peer_tx (first,PACKET_STATE_DEAD ); err:
Greg Kroah-Hartman
maintainerPATCH 798/800 wireguard: netlink: send staged packets when setting initial private key
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit f58d0a9b4c6a7a5199c3af967e43cc8b654604d4 upstream.
Packets bound for peers can queue up prior to the device private key being set. For example, if persistent keepalive is set, a packet is queued up to be sent as soon as the device comes up. However, if the private key hasn't been set yet, the handshake message never sends, and no timer is armed to retry, since that would be pointless.
But, if a user later sets a private key, the expectation is that those queued packets, such as a persistent keepalive, are actually sent. So adjust the configuration logic to account for this edge case, and add a test case to make sure this works.
Maxim noticed this with a wg-quick(8) config to the tune of:
[Interface]
PostUp = wg set %i private-key somefile
[Peer]
PublicKey = ...
Endpoint = ...
PersistentKeepalive = 25Here, the private key gets set after the device comes up using a PostUp script, triggering the bug.
--- drivers/net/wireguard/netlink.c | 14 ++++++++----- tools/testing/selftests/wireguard/netns.sh | 30 +++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 9 deletions(-)
drivers/net/wireguard/netlink.c +9 -5
@@ -546,6 +546,7 @@ static int wg_set_device(struct sk_buffu8 *private_key =nla_data (info->attrs[WGDEVICE_A_PRIVATE_KEY ]);u8 public_key[NOISE_PUBLIC_KEY_LEN ];struct wg_peer *peer, *temp; +bool send_staged_packets;if (!crypto_memneq (wg->static_identity.static_private, private_key,NOISE_PUBLIC_KEY_LEN ))
@@ -564,14 +565,17 @@ static int wg_set_device(struct sk_buff }down_write (&wg->static_identity.lock); -wg_noise_set_static_identity_private_key (&wg->static_identity, - private_key); -list_for_each_entry_safe (peer, temp, &wg->peer_list, - peer_list) { + send_staged_packets = !wg->static_identity.has_identity &&netif_running (wg->dev); +wg_noise_set_static_identity_private_key (&wg->static_identity, private_key); + send_staged_packets = send_staged_packets && wg->static_identity.has_identity; + +wg_cookie_checker_precompute_device_keys (&wg->cookie_checker); +list_for_each_entry_safe (peer, temp, &wg->peer_list, peer_list) {wg_noise_precompute_static_static (peer);wg_noise_expire_current_peer_keypairs (peer); +if (send_staged_packets) +wg_packet_send_staged_packets (peer); } -wg_cookie_checker_precompute_device_keys (&wg->cookie_checker);up_write (&wg->static_identity.lock); } skip_set_private_key:
tools/testing/selftests/wireguard/netns.sh +26 -4
@@ -514,10 +514,32 @@ n2 bash -c 'printf 0 > /proc/sys/net/ipv n1 ping -W 1 -c 1 192.168.241.2 [[ $(n2 wg show wg0 endpoints) == "$pub1 10.0.0.3:1" ]] -ip1 link del veth1 -ip1 link del veth3 -ip1 link del wg0 -ip2 link del wg0 +ip1 link del dev veth3 +ip1 link del dev wg0 +ip2 link del dev wg0 + +# Make sure persistent keep alives are sent when an adapter comes up +ip1 link add dev wg0 type wireguard +n1 wg set wg0 private-key <(echo "$key1") peer "$pub2" endpoint 10.0.0.1:1 persistent-keepalive 1 +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -eq 0 ]] +ip1 link set dev wg0 up +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -gt 0 ]] +ip1 link del dev wg0 +# This should also happen even if the private key is set later +ip1 link add dev wg0 type wireguard +n1 wg set wg0 peer "$pub2" endpoint 10.0.0.1:1 persistent-keepalive 1 +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -eq 0 ]] +ip1 link set dev wg0 up +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -eq 0 ]] +n1 wg set wg0 private-key <(echo "$key1") +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -gt 0 ]] +ip1 link del dev veth1 +ip1 link del dev wg0 # We test that Netlink/IPC is working properly by doing things that usually cause split responses ip0 link add dev wg0 type wireguard
Greg Kroah-Hartman
maintainerPATCH 799/800 tty: serial: fsl_lpuart: add earlycon for imx8ulp platform
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
commit e0edfdc15863ec80a1d9ac6e174dbccc00206dd0 upstream.
Add earlycon support for imx8ulp platform.
--- drivers/tty/serial/fsl_lpuart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/fsl_lpuart.c +1 -0
@@ -2676,6 +2676,7 @@ OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lOF_EARLYCON_DECLARE (lpuart32,"fsl,ls1021a-lpuart" , lpuart32_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,ls1028a-lpuart" , ls1028a_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,imx7ulp-lpuart" , lpuart32_imx_early_console_setup); +OF_EARLYCON_DECLARE (lpuart32,"fsl,imx8ulp-lpuart" , lpuart32_imx_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,imx8qxp-lpuart" , lpuart32_imx_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,imxrt1050-lpuart" , lpuart32_imx_early_console_setup);EARLYCON_DECLARE (lpuart, lpuart_early_console_setup);
Greg Kroah-Hartman
maintainerPATCH 800/800 io_uring: Use io_schedule* in cqring wait
In reply to Greg Kroah-HartmanFrom: Andres Freund <[email protected]>
commit 8a796565cec3601071cbbd27d6304e202019d014 upstream.
I observed poor performance of io_uring compared to synchronous IO. That turns out to be caused by deeper CPU idle states entered with io_uring, due to io_uring using plain schedule(), whereas synchronous IO uses io_schedule().
The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0 /mnt/t2/fio/write.0.0
This is repeatable with different filesystems, using raw block devices and using different block devices.
Use io_schedule_prepare() / io_schedule_finish() in io_cqring_wait_schedule() to address the difference.
After that using io_uring is on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).
There are other calls to schedule() in io_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible that mutex_lock_io() should be used, but it's not clear if there are cases where that matters.
--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
io_uring/io_uring.c +13 -2
@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))
@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/*
Greg Kroah-Hartman
maintainerPATCH 788/800 drm/amdgpu: make sure that BOs have a backing store
In reply to Greg Kroah-HartmanFrom: Christian K�nig <[email protected]>
commit ca0b954a4315ca2228001c439ae1062561c81989 upstream
It's perfectly possible that the BO is about to be destroyed and doesn't have a backing store associated with it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -1
@@ -1266,8 +1266,12 @@ void amdgpu_bo_move_notify(struct ttm_buvoid amdgpu_bo_get_memory (struct amdgpu_bo *bo,struct amdgpu_mem_stats *stats) { -unsigned int domain;uint64_t size =amdgpu_bo_size (bo); +unsigned int domain; + +/* Abort if the BO doesn't currently have a backing store */ +if (!bo->tbo.resource) +return ; domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type);switch (domain) {
Greg Kroah-Hartman
maintainerPATCH 789/800 drm/amdgpu: Skip mark offset for high priority rings
In reply to Greg Kroah-HartmanFrom: Jiadong Zhu <[email protected]>
commit ef3c36a6e025e9b16ca3321479ba016841fa17a0 upstream
Only low priority rings are using chunks to save the offset. Bypass the mark offset callings from high priority rings.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c +3 -0
@@ -423,6 +423,9 @@ void amdgpu_sw_ring_ib_mark_offset(strucstruct amdgpu_ring_mux *mux = &adev->gfx.muxer;unsigned offset; +if (ring->hw_prio >AMDGPU_RING_PRIO_DEFAULT ) +return ; + offset = ring->wptr & ring->buf_mask;amdgpu_ring_mux_ib_mark_offset (mux, ring, offset, type);
Greg Kroah-Hartman
maintainerPATCH 790/800 drm/amd/pm: revise the ASPM settings for thunderbolt attached scenario
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit fd21987274463a439c074b8f3c93d3b132e4c031 upstream
Also, correct the comment for NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT as 0x0000000E stands for 400ms instead of 4ms.
--- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +7 -4
@@ -346,7 +346,7 @@ static void nbio_v2_3_init_registers(str#define NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT 0x00000000 // off by default, no gains over L1#define NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT 0x00000009 // 1=1us, 9=1ms -#define NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT 0x0000000E // 4ms +#define NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT 0x0000000E // 400msstatic void nbio_v2_3_enable_aspm (struct amdgpu_device *adev,bool enable)
@@ -479,9 +479,12 @@ static void nbio_v2_3_program_aspm(strucWREG32_SOC15 (NBIO ,0 , mmRCC_BIF_STRAP5, data); def = data =RREG32_PCIE (smnPCIE_LC_CNTL); - data &= ~PCIE_LC_CNTL__LC_L0S_INACTIVITY_MASK ; - data |=0x9 <<PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT ; - data |=0x1 <<PCIE_LC_CNTL__LC_PMI_TO_L1_DIS__SHIFT ; + data |=NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT <<PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT ; +if (pci_is_thunderbolt_attached (adev->pdev)) + data |=NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT <<PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT ; +else + data |=NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT <<PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT ; + data &= ~PCIE_LC_CNTL__LC_PMI_TO_L1_DIS_MASK ;if (def != data)WREG32_PCIE (smnPCIE_LC_CNTL, data);
Greg Kroah-Hartman
maintainerPATCH 791/800 drm/amdgpu/sdma4: set align mask to 255
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit e5df16d9428f5c6d2d0b1eff244d6c330ba9ef3a upstream
The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
@@ -2306,7 +2306,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_fstatic const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .secure_submission_supported = true,
@@ -2338,7 +2338,7 @@ static const struct amdgpu_ring_funcs sdstatic const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .secure_submission_supported = true,
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
@@ -1740,7 +1740,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ipstatic const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .get_rptr = sdma_v4_4_2_ring_get_rptr,
@@ -1771,7 +1771,7 @@ static const struct amdgpu_ring_funcs sdstatic const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .get_rptr = sdma_v4_4_2_ring_get_rptr,
Greg Kroah-Hartman
maintainerPATCH 792/800 drm/amd/pm: add abnormal fan detection for smu 13.0.0
In reply to Greg Kroah-HartmanFrom: Kenneth Feng <[email protected]>
commit 2da0036ea99bccb27f7fe3cf2aa2900860e9be46 upstream
add abnormal fan detection for smu 13.0.0
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -1300,6 +1300,7 @@ static int smu_v13_0_0_get_thermal_tempe range->mem_emergency_max = (pptable->SkuTable.TemperatureLimit[TEMP_MEM ] +CTF_OFFSET_MEM )*SMU_TEMPERATURE_UNITS_PER_CENTIGRADES ; range->software_shutdown_temp = powerplay_table->software_shutdown_temp; + range->software_shutdown_temp_offset = pptable->SkuTable.FanAbnormalTempLimitOffset;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 793/800 drm/amdgpu: check RAS irq existence for VCN/JPEG
In reply to Greg Kroah-HartmanFrom: Tao Zhou <[email protected]>
commit 4ff96bcc0d40b66bf3ddd6010830e9a4f9b85d53 upstream
No RAS irq is allowed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2 -1
@@ -251,7 +251,8 @@ int amdgpu_jpeg_ras_late_init(struct amdif (amdgpu_ras_is_supported (adev, ras_block->block)) {for (i =0 ; i < adev->jpeg.num_jpeg_inst; ++i) { -if (adev->jpeg.harvest_config & (1 << i)) +if (adev->jpeg.harvest_config & (1 << i) || + !adev->jpeg.inst[i].ras_poison_irq.funcs)continue ; r =amdgpu_irq_get (adev, &adev->jpeg.inst[i].ras_poison_irq,0 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -1
@@ -1191,7 +1191,8 @@ int amdgpu_vcn_ras_late_init(struct amdgif (amdgpu_ras_is_supported (adev, ras_block->block)) {for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) +if (adev->vcn.harvest_config & (1 << i) || + !adev->vcn.inst[i].ras_poison_irq.funcs)continue ; r =amdgpu_irq_get (adev, &adev->vcn.inst[i].ras_poison_irq,0 );
Greg Kroah-Hartman
maintainerPATCH 794/800 netfilter: conntrack: Avoid nf_ct_helper_hash uses after free
In reply to Greg Kroah-HartmanFrom: Florent Revest <[email protected]>
commit 6eef7a2b933885a17679eb8ed0796ddf0ee5309b upstream.
If nf_conntrack_init_start() fails (for example due to a register_nf_conntrack_bpf() failure), the nf_conntrack_helper_fini() clean-up path frees the nf_ct_helper_hash map.
When built with NF_CONNTRACK=y, further netfilter modules (e.g:netfilter_conntrack_ftp) can still be loaded and call nf_conntrack_helpers_register(), independently of whether nf_conntrack initialized correctly. This accesses the nf_ct_helper_hash dangling pointer and causes a uaf, possibly leading to random memory corruption.
This patch guards nf_conntrack_helper_register() from accessing a freed or uninitialized nf_ct_helper_hash pointer and fixes possible uses-after-free when loading a conntrack module.
--- net/netfilter/nf_conntrack_helper.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_conntrack_helper.c +4 -0
@@ -360,6 +360,9 @@ int nf_conntrack_helper_register(structBUG_ON (me->expect_class_max >=NF_CT_MAX_EXPECT_CLASSES );BUG_ON (strlen (me->name) >NF_CT_HELPER_NAME_LEN -1 ); +if (!nf_ct_helper_hash) +return -ENOENT ; +if (me->expect_policy->max_expected >NF_CT_EXPECT_MAX_CNT )return -EINVAL ;
@@ -515,4 +518,5 @@ int nf_conntrack_helper_init(void)void nf_conntrack_helper_fini (void ) {kvfree (nf_ct_helper_hash); + nf_ct_helper_hash =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 795/800 netfilter: nf_tables: do not ignore genmask when looking up chain by id
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit 515ad530795c118f012539ed76d02bacfd426d89 upstream.
When adding a rule to a chain referring to its ID, if that chain had been deleted on the same batch, the rule might end up referring to a deleted chain.
This will lead to a WARNING like following:
[ 33.098431] ------------[ cut here ]------------ [ 33.098678] WARNING: CPU: 5 PID: 69 at net/netfilter/nf_tables_api.c:2037 nf_tables_chain_destroy+0x23d/0x260 [ 33.099217] Modules linked in: [ 33.099388] CPU: 5 PID: 69 Comm: kworker/5:1 Not tainted 6.4.0+ #409 [ 33.099726] Workqueue: events nf_tables_trans_destroy_work [ 33.100018] RIP: 0010:nf_tables_chain_destroy+0x23d/0x260 [ 33.100306] Code: 8b 7c 24 68 e8 64 9c ed fe 4c 89 e7 e8 5c 9c ed fe 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 89 c6 89 c7 c3 cc cc cc cc <0f> 0b 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 89 c6 89 c7 [ 33.101271] RSP: 0018:ffffc900004ffc48 EFLAGS: 00010202 [ 33.101546] RAX: 0000000000000001 RBX: ffff888006fc0a28 RCX: 0000000000000000 [ 33.101920] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 33.102649] RBP: ffffc900004ffc78 R08: 0000000000000000 R09: 0000000000000000 [ 33.103018] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880135ef500 [ 33.103385] R13: 0000000000000000 R14: dead000000000122 R15: ffff888006fc0a10 [ 33.103762] FS: 0000000000000000(0000) GS:ffff888024c80000(0000) knlGS:0000000000000000 [ 33.104184] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 33.104493] CR2: 00007fe863b56a50 CR3: 00000000124b0001 CR4: 0000000000770ee0 [ 33.104872] PKRU: 55555554 [ 33.104999] Call Trace: [ 33.105113] <TASK> [ 33.105214] ? show_regs+0x72/0x90 [ 33.105371] ? __warn+0xa5/0x210 [ 33.105520] ? nf_tables_chain_destroy+0x23d/0x260 [ 33.105732] ? report_bug+0x1f2/0x200 [ 33.105902] ? handle_bug+0x46/0x90 [ 33.106546] ? exc_invalid_op+0x19/0x50 [ 33.106762] ? asm_exc_invalid_op+0x1b/0x20 [ 33.106995] ? nf_tables_chain_destroy+0x23d/0x260 [ 33.107249] ? nf_tables_chain_destroy+0x30/0x260 [ 33.107506] nf_tables_trans_destroy_work+0x669/0x680 [ 33.107782] ? mark_held_locks+0x28/0xa0 [ 33.107996] ? __pfx_nf_tables_trans_destroy_work+0x10/0x10 [ 33.108294] ? _raw_spin_unlock_irq+0x28/0x70 [ 33.108538] process_one_work+0x68c/0xb70 [ 33.108755] ? lock_acquire+0x17f/0x420 [ 33.108977] ? __pfx_process_one_work+0x10/0x10 [ 33.109218] ? do_raw_spin_lock+0x128/0x1d0 [ 33.109435] ? _raw_spin_lock_irq+0x71/0x80 [ 33.109634] worker_thread+0x2bd/0x700 [ 33.109817] ? __pfx_worker_thread+0x10/0x10 [ 33.110254] kthread+0x18b/0x1d0 [ 33.110410] ? __pfx_kthread+0x10/0x10 [ 33.110581] ret_from_fork+0x29/0x50 [ 33.110757] </TASK> [ 33.110866] irq event stamp: 1651 [ 33.111017] hardirqs last enabled at (1659): [<ffffffffa206a209>] __up_console_sem+0x79/0xa0 [ 33.111379] hardirqs last disabled at (1666): [<ffffffffa206a1ee>] __up_console_sem+0x5e/0xa0 [ 33.111740] softirqs last enabled at (1616): [<ffffffffa1f5d40e>] __irq_exit_rcu+0x9e/0xe0 [ 33.112094] softirqs last disabled at (1367): [<ffffffffa1f5d40e>] __irq_exit_rcu+0x9e/0xe0 [ 33.112453] ---[ end trace 0000000000000000 ]---
This is due to the nft_chain_lookup_byid ignoring the genmask. After this change, adding the new rule will fail as it will not find the chain.
--- net/netfilter/nf_tables_api.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +7 -4
@@ -2693,7 +2693,7 @@ err_hooks:static struct nft_chain *nft_chain_lookup_byid (const struct net *net,const struct nft_table *table, -const struct nlattr *nla) +const struct nlattr *nla,u8 genmask) {struct nftables_pernet *nft_net =nft_pernet (net);u32 id =ntohl (nla_get_be32 (nla));
@@ -2704,7 +2704,8 @@ static struct nft_chain *nft_chain_lookuif (trans->msg_type ==NFT_MSG_NEWCHAIN && chain->table == table && - id ==nft_trans_chain_id (trans)) + id ==nft_trans_chain_id (trans) && +nft_active_genmask (chain, genmask))return chain; }return ERR_PTR (-ENOENT );
@@ -3808,7 +3809,8 @@ static int nf_tables_newrule(struct sk_breturn -EOPNOTSUPP ; }else if (nla[NFTA_RULE_CHAIN_ID ]) { - chain =nft_chain_lookup_byid (net, table, nla[NFTA_RULE_CHAIN_ID ]); + chain =nft_chain_lookup_byid (net, table, nla[NFTA_RULE_CHAIN_ID ], + genmask);if (IS_ERR (chain)) {NL_SET_BAD_ATTR (extack, nla[NFTA_RULE_CHAIN_ID ]);return PTR_ERR (chain);
@@ -10467,7 +10469,8 @@ static int nft_verdict_init(const struct genmask); }else if (tb[NFTA_VERDICT_CHAIN_ID ]) { chain =nft_chain_lookup_byid (ctx->net, ctx->table, - tb[NFTA_VERDICT_CHAIN_ID ]); + tb[NFTA_VERDICT_CHAIN_ID ], + genmask);if (IS_ERR (chain))return PTR_ERR (chain); }else {
Greg Kroah-Hartman
maintainerPATCH 786/800 LoongArch: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation
In reply to Greg Kroah-HartmanFrom: WANG Xuerui <[email protected]>
commit 5ddc7a3794ddd3470635ebd325fa1dffea5b18c0 upstream.
This is a port of commit 08f6554ff90e ("mips: Include KBUILD_CPPFLAGS in CHECKFLAGS invocation") to arch/loongarch, for fixing cross-compilation of Linux/LoongArch with Clang, where previously the --target flag would no longer be present for the CHECKFLAGS cc invocation leading to build failure.
--- arch/loongarch/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/Makefile +1 -1
@@ -107,7 +107,7 @@ KBUILD_CFLAGS += -isystem $(shell $(CC) KBUILD_LDFLAGS += -m $(ld-emul) ifdef CONFIG_LOONGARCH -CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ +CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') endif
Re: [PATCH 6.4 118/800] net/handshake: Unpin sock->file if a handshake is cancelled
In reply to Greg Kroah-HartmanQuoted 52 lines · Greg Kroah-Hartman
From: Chuck Lever <[email protected]>
[ Upstream commit
f921bd41001ccff2249f5f443f2917f7ef937daf]If user space never calls DONE, sock->file's reference count remains elevated. Enable
sock->fileto be freed eventually in this case.Reported-by Jakub Kacinski <[email protected]>Fixes 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")Signed-off-by Chuck Lever <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
net/handshake/handshake.h| 1 +net/handshake/request.c| 4 ++++2 files changed, 5 insertions(+)net/handshake/handshake.h +1
-0@@ -31,6 +31,7 @@ struct handshake_req {struct list_head hr_list;struct rhash_head hr_rhash;unsigned long hr_flags; +struct file *hr_file;const struct handshake_proto *hr_proto;struct sock *hr_sk;void (*hr_odestruct)(struct sock *sk);net/handshake/request.c +4
-0@@ -239,6 +239,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req, } req->hr_odestruct = req->hr_sk->sk_destruct; req->hr_sk->sk_destruct = handshake_sk_destruct; + req->hr_file = sock->file; ret = -EOPNOTSUPP ; net =sock_net (req->hr_sk);@@ -334,6 +335,9 @@ bool handshake_req_cancel(struct sock *sk)return false; } +/* Request accepted and waiting for DONE */ +fput (req->hr_file); +
Quoted 8 lines
out_true:trace_handshake_cancel(net, req, sk);Signature · 1 line
2.39.2
Don't take this one. It's fixed by a later commit:
361b6889ae636926cdff517add240c3c8e24593a
that reverts it.
--
Chuck Lever
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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 Tue, 18 Jul 2023 19:48:07 +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.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Following kernel warnings / BUG noticed on qemu-arm64 while running Kunit / KASAN tests while booting stable rc 6.4 kernel.
Similar issues have been reported on Linux next [1].
next: qemu-arm64: kernel BUG at fs/inode.c:1763!
[1] https://lore.kernel.org/linux-mm/[email protected]/
Crash log:
---
<6>[ 928.522368] ok 67 Encryption test suite # SKIP
<6>[ 928.526361] KTAP version 1
<6>[ 928.527663] # Subtest: Handshake API tests
<6>[ 928.528569] 1..11
<6>[ 928.529461] KTAP version 1
<6>[ 928.530289] # Subtest: req_alloc API fuzzing
<6>[ 928.534580] ok 1 handshake_req_alloc NULL proto
<6>[ 928.540928] ok 2 handshake_req_alloc CLASS_NONE
<6>[ 928.546026] ok 3 handshake_req_alloc CLASS_MAX
<6>[ 928.556181] ok 4 handshake_req_alloc no callbacks
<6>[ 928.561854] ok 5 handshake_req_alloc no done callback
<6>[ 928.568591] ok 6 handshake_req_alloc excessive privsize
<6>[ 928.574197] ok 7 handshake_req_alloc all good
<6>[ 928.577290] # req_alloc API fuzzing: pass:7 fail:0 skip:0 total:7
<6>[ 928.578830] ok 1 req_alloc API fuzzing
<6>[ 928.589194] ok 2 req_submit NULL req arg
<6>[ 928.595860] ok 3 req_submit NULL sock arg
<6>[ 928.601760] ok 4 req_submit NULL sock->file
<6>[ 928.613613] ok 5 req_lookup works
<6>[ 928.621095] ok 6 req_submit max pending
<6>[ 928.627492] ok 7 req_submit multiple
<6>[ 928.633124] ok 8 req_cancel before accept
<6>[ 928.640751] ok 9 req_cancel after accept
<6>[ 928.646414] ok 10 req_cancel after done
<4>[ 928.650411] ------------[ cut here ]------------
<2>[ 928.654074] kernel BUG at fs/inode.c:1805!
<0>[ 928.655661] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
<4>[ 928.657205] Modules linked in:
<4>[ 928.659307] CPU: 1 PID: 21 Comm: kworker/1:0 Tainted: G
N 6.4.4-rc1 #1
<4>[ 928.660829] Hardware name: linux,dummy-virt (DT)
<4>[ 928.662415] Workqueue: events delayed_fput
<4>[ 928.664806] pstate: 42400005 (nZcv daif +PAN -UAO +TCO -DIT
-SSBS BTYPE=--)
<4>[ 928.666592] pc : iput+0x2cc/0x2d0
<4>[ 928.667870] lr : iput+0x30/0x2d0
<4>[ 928.668975] sp : ffff8000081d7af0
<4>[ 928.669951] x29: ffff8000081d7af0 x28: ffff0000c094c020 x27:
00000000002e0003
<4>[ 928.672194] x26: ffff0000c4f61668 x25: ffff0000c6911590 x24:
0000000000000000
<4>[ 928.674232] x23: ffff0000c0467638 x22: ffff0000c69115b0 x21:
ffff0000c0467598
<4>[ 928.676413] x20: ffff0000c0467500 x19: ffff0000c0467500 x18:
0000000010992f9a
<4>[ 928.678485] x17: ffffa2bb7d60bc64 x16: ffffa2bb7d60c00c x15:
ffffa2bb7e7c02f4
<4>[ 928.680443] x14: ffffa2bb7d63c708 x13: ffffa2bb7d216100 x12:
0000000000000001
<4>[ 928.682505] x11: 1fffe0001808ceb1 x10: 1fffe0001808ceb3 x9 :
0000000000000000
<4>[ 928.684647] x8 : 0000000000000060 x7 : 0000000000000000 x6 :
ffffa2bb7d5c67b8
<4>[ 928.686630] x5 : ffff0000c814a6d8 x4 : 0000000000000000 x3 :
ffffa2bb7ead2fec
<4>[ 928.689091] x2 : 0000000000000001 x1 : 0000000000000001 x0 :
ffff0000c0467598
<6>[ 928.690005] ok 11 req_destroy works
<4>[ 928.690476]
<6>[ 928.693528] # Handshake API tests: pass:11 fail:0 skip:0 total:11
<4>[ 928.694200] Call trace:
<4>[ 928.694404] iput+0x2cc/0x2d0
<6>[ 928.697513] # Totals: pass:17 fail:0 skip:0 total:17
<4>[ 928.697467] dentry_unlink_inode+0x220/0x240
<6>[ 928.698341] ok 68 Handshake API tests
<4>[ 928.699216] __dentry_kill+0x190/0x2a4
<4>[ 928.702948] dentry_kill+0x90/0x150
<4>[ 928.704551] dput+0xd8/0x144
<4>[ 928.706425] __fput+0x2bc/0x3cc
<4>[ 928.707982] delayed_fput+0x54/0x6c
<4>[ 928.709490] process_one_work+0x3c4/0x574
<4>[ 928.711092] worker_thread+0x488/0x83c
<4>[ 928.712551] kthread+0x1ac/0x238
<4>[ 928.714034] ret_from_fork+0x10/0x20
<0>[ 928.717103] Code: 94522f0a 17ffffec d4210000 17ffffba (d4210000)
<4>[ 928.719393] ---[ end trace 0000000000000000 ]---
<6>[ 928.721045] note: kworker/1:0[21] exited with irqs disabled
<6>[ 928.725022] note: kworker/1:0[21] exited with preempt_count 1
<6>[ 928.730067] uart-pl011 9000000.pl011: no DMA platform data
<4>[ 928.733763] ------------[ cut here ]------------
<4>[ 928.735164] WARNING: CPU: 1 PID: 0 at
kernel/context_tracking.c:128 ct_kernel_exit+0xa4/0xac
<4>[ 928.737209] Modules linked in:
<4>[ 928.738504] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D
N 6.4.4-rc1 #1
<4>[ 928.740310] Hardware name: linux,dummy-virt (DT)
<4>[ 928.741569] pstate: 224003c5 (nzCv DAIF +PAN -UAO +TCO -DIT
-SSBS BTYPE=--)
<4>[ 928.743556] pc : ct_kernel_exit+0xa4/0xac
<4>[ 928.745560] lr : ct_kernel_exit+0x14/0xac
<4>[ 928.747498] sp : ffff800008187db0
<4>[ 928.749156] x29: ffff800008187db0 x28: ffffa2bb7ff5cb38 x27:
ffffa2bb7ffdd000
<4>[ 928.751416] x26: 0000000000000002 x25: 0000000000000001 x24:
0000000000000000
<4>[ 928.753426] x23: 0000000000000000 x22: 0000000000000000 x21:
ffffa2bb7ffddb50
<4>[ 928.755520] x20: ffffa2bb7ffdda40 x19: ffff0000daea6a20 x18:
0000000010992f9a
<4>[ 928.757619] x17: 0000000000000000 x16: 0000000100000000 x15:
0000000200000002
<4>[ 928.759766] x14: 00000000ffffa2bb x13: 00000000000711d6 x12:
0000000008000000
<4>[ 928.761789] x11: 000db58580000000 x10: 4000000000000000 x9 :
4000000000000002
<4>[ 928.763942] x8 : ffffa2bb7ff5aa20 x7 : 0000000000000000 x6 :
000000000000003f
<4>[ 928.766237] x5 : 0000000000000040 x4 : 0000000000000000 x3 :
ffffa2bb7d316f00
<4>[ 928.768327] x2 : 0000000000000001 x1 : 0000000000000001 x0 :
ffff5d455af4c000
<4>[ 928.770366] Call trace:
<4>[ 928.771153] ct_kernel_exit+0xa4/0xac
<4>[ 928.772308] ct_idle_enter+0x10/0x1c
<4>[ 928.773463] default_idle_call+0x1c/0x38
<4>[ 928.774700] do_idle+0x134/0x2fc
<4>[ 928.775976] cpu_startup_entry+0x24/0x28
<4>[ 928.777255] secondary_start_kernel+0x170/0x194
<4>[ 928.778638] __secondary_switched+0xb8/0xbc
<4>[ 928.780012] ---[ end trace 0000000000000000 ]---
<6>[ 928.888117] EXT4-fs (vda): mounted filesystem488f3595-af73-4163-86f5-9256efc01ed6 ro with ordered data mode. Quota
mode: none.
Links:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.3-801-g2b7c5a626789/testrun/18368775/suite/boot/test/clang-nightly-defconfig-40bc7ee5/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.3-801-g2b7c5a626789/testrun/18368340/suite/boot/test/gcc-12-defconfig-40bc7ee5/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.3-801-g2b7c5a626789/testrun/18374719/suite/boot/test/gcc-12-lkftconfig-kunit/details/
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2SfVz5dCm2BdJzRORqOHFcy7nOK/
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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 Tue, 18 Jul 2023 19:48:07 +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.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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 Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
As I had already reported:
Building mips:allmodconfig ... failed
--------------
Error log:
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: [scripts/Makefile.lib:419: arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[4]: [scripts/Makefile.lib:419: arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
This is the same error as reported for 6.3.13-rc3, introduced with "MIPS: DTS:
CI20: Add parent supplies to ACT8600 regulators" which uses vcc_33v without introducing it (it was introduced with commit c9f4b25272843).
Guenter
Greg Kroah-Hartman
maintainerRe: [PATCH 6.4 118/800] net/handshake: Unpin sock->file if a handshake is cancelled
In reply to Chuck Lever IIIQuoted 63 lines · Chuck Lever III
Quoted 52 lines · Greg Kroah-Hartman
From: Chuck Lever <[email protected]>
[ Upstream commit
f921bd41001ccff2249f5f443f2917f7ef937daf]If user space never calls DONE, sock->file's reference count remains elevated. Enable
sock->fileto be freed eventually in this case.Reported-by Jakub Kacinski <[email protected]>Fixes 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")Signed-off-by Chuck Lever <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
net/handshake/handshake.h| 1 +net/handshake/request.c| 4 ++++2 files changed, 5 insertions(+)net/handshake/handshake.h +1
-0@@ -31,6 +31,7 @@ struct handshake_req {struct list_head hr_list;struct rhash_head hr_rhash;unsigned long hr_flags; +struct file *hr_file;const struct handshake_proto *hr_proto;struct sock *hr_sk;void (*hr_odestruct)(struct sock *sk);net/handshake/request.c +4
-0@@ -239,6 +239,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req, } req->hr_odestruct = req->hr_sk->sk_destruct; req->hr_sk->sk_destruct = handshake_sk_destruct; + req->hr_file = sock->file; ret = -EOPNOTSUPP ; net =sock_net (req->hr_sk);@@ -334,6 +335,9 @@ bool handshake_req_cancel(struct sock *sk)return false; } +/* Request accepted and waiting for DONE */ +fput (req->hr_file); +Quoted 8 lines
out_true:trace_handshake_cancel(net, req, sk);Signature · 1 line
2.39.2Don't take this one. It's fixed by a later commit:
Quoted 3 lines
361b6889ae636926cdff517add240c3c8e24593athat reverts it.
How? That commit is in 6.4 already, yet this commit, is from 6.5-rc1.
confused,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 34 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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 Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
As I had already reported:
Building mips:allmodconfig ... failed
--------------
Error log:
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: [scripts/Makefile.lib:419:arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[4]: [scripts/Makefile.lib:419:arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
Quoted 3 lines
This is the same error as reported for 6.3.13-rc3, introduced with "MIPS: DTS:
CI20: Add parent supplies to ACT8600 regulators" which usesvcc_33vwithout introducing it (it was introduced with commitc9f4b25272843).
Ah, ick, sorry, I tried to fix this up but I applied a different "fix". I'll go drop this one, and the "fix up" patch as well and push out a -rc2 soon.
thanks,
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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.
My CI has no complaints about 6.4,
Thanks,
Conor.
Re: [PATCH 6.4 118/800] net/handshake: Unpin sock->file if a handshake is cancelled
In reply to Greg Kroah-HartmanQuoted 68 lines · Greg Kroah-Hartman
Quoted 63 lines · Chuck Lever III
Quoted 52 lines · Greg Kroah-Hartman
From: Chuck Lever <[email protected]>
[ Upstream commit
f921bd41001ccff2249f5f443f2917f7ef937daf]If user space never calls DONE, sock->file's reference count remains elevated. Enable
sock->fileto be freed eventually in this case.Reported-by Jakub Kacinski <[email protected]>Fixes 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")Signed-off-by Chuck Lever <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
net/handshake/handshake.h| 1 +net/handshake/request.c| 4 ++++2 files changed, 5 insertions(+)net/handshake/handshake.h +1
-0@@ -31,6 +31,7 @@ struct handshake_req {struct list_head hr_list;struct rhash_head hr_rhash;unsigned long hr_flags; +struct file *hr_file;const struct handshake_proto *hr_proto;struct sock *hr_sk;void (*hr_odestruct)(struct sock *sk);net/handshake/request.c +4
-0@@ -239,6 +239,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req, } req->hr_odestruct = req->hr_sk->sk_destruct; req->hr_sk->sk_destruct = handshake_sk_destruct; + req->hr_file = sock->file; ret = -EOPNOTSUPP ; net =sock_net (req->hr_sk);@@ -334,6 +335,9 @@ bool handshake_req_cancel(struct sock *sk)return false; } +/* Request accepted and waiting for DONE */ +fput (req->hr_file); +Quoted 8 lines
out_true:trace_handshake_cancel(net, req, sk);Signature · 1 line
2.39.2Don't take this one. It's fixed by a later commit:
Quoted 5 lines
Quoted 3 lines
361b6889ae636926cdff517add240c3c8e24593athat reverts it.
How? That commit is in 6.4 already, yet this commit, is from 6.5-rc1.
I do not see f921bd41001ccff2249f5f443f2917f7ef937daf in v6.5-rc2. Whatever that is, it's not in upstream.
[cel@manet server-development]$ git log --pretty=oneline v6.5-rc2 -- net/handshake/ 173780ff18a93298ca84224cc79df69f9cc198ce Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net361b6889ae636926cdff517add240c3c8e24593a net/handshake: remove fput() that causes use-after-free 9b66ee06e5ca2698d0ba12a7ad7188cb724279e7 net: ynl: prefix uAPI header include with uapi/ 26fb5480a27d34975cc2b680b77af189620dd740 net/handshake: Enable the SNI extension to work properly 1ce77c998f0415d7d9d91cb9bd7665e25c8f75f1 net/handshake: Unpin sock->file if a handshake is cancelled fc490880e39d86c65ab2bcbd357af1950fa55e48 net/handshake: handshake_genl_notify() shouldn't ignore @flags 7afc6d0a107ffbd448c96eb2458b9e64a5af7860 net/handshake: Fix uninitialized local variable 7ea9c1ec66bc099b0bfba961a8a46dfe25d7d8e4 net/handshake: Fix handshake_dup() ref counting a095326e2c0f33743ce8e887d5b90edf3f36cced net/handshake: Remove unneeded check from handshake_dup() 18c40a1cc1d990c51381ef48cd93fdb31d5cd903 net/handshake: Fix sock->file allocation b21c7ba6d9a5532add3827a3b49f49cbc0cb9779 net/handshake: Squelch allocation warning during Kunit test 6aa445e39693bff9c98b12f960e66b4e18c7378b net/handshake: Fix section mismatch in handshake_exit 88232ec1ec5ecf4aa5de439cff3d5e2b7adcac93 net/handshake: Add Kunit tests for the handshake consumer API 2fd5532044a89d2403b543520b4902e196f7d165 net/handshake: Add a kernel API for requesting a TLSv1.3 handshake 3b3009ea8abb713b022d94fba95ec270cf6e7eae net/handshake: Create a NETLINK service for handling handshake requests [cel@manet server-development]$
But I do see 1ce77c998f0415d7d9d91cb9bd7665e25c8f75f1 and the commit that reverts it, 361b6889ae636926cdff517add240c3c8e24593a.
--
Chuck Lever
Greg Kroah-Hartman
maintainerQuoted 22 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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 Tue, 18 Jul 2023 19:48:07 +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.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Quoted 8 lines
Following kernel warnings / BUG noticed on qemu-arm64 while running Kunit / KASAN tests while booting stable rc 6.4 kernel.
Similar issues have been reported on Linux next [1].
next: qemu-arm64: kernel BUG atfs/inode.c:1763!
[1] https://lore.kernel.org/linux-mm/[email protected]/
Does bisection help?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 6.4 118/800] net/handshake: Unpin sock->file if a handshake is cancelled
In reply to Chuck Lever IIIQuoted 68 lines · Chuck Lever III
Quoted 68 lines · Greg Kroah-Hartman
Quoted 63 lines · Chuck Lever III
Quoted 52 lines · Greg Kroah-Hartman
From: Chuck Lever <[email protected]>
[ Upstream commit
f921bd41001ccff2249f5f443f2917f7ef937daf]If user space never calls DONE, sock->file's reference count remains elevated. Enable
sock->fileto be freed eventually in this case.Reported-by Jakub Kacinski <[email protected]>Fixes 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")Signed-off-by Chuck Lever <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
net/handshake/handshake.h| 1 +net/handshake/request.c| 4 ++++2 files changed, 5 insertions(+)net/handshake/handshake.h +1
-0@@ -31,6 +31,7 @@ struct handshake_req {struct list_head hr_list;struct rhash_head hr_rhash;unsigned long hr_flags; +struct file *hr_file;const struct handshake_proto *hr_proto;struct sock *hr_sk;void (*hr_odestruct)(struct sock *sk);net/handshake/request.c +4
-0@@ -239,6 +239,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req, } req->hr_odestruct = req->hr_sk->sk_destruct; req->hr_sk->sk_destruct = handshake_sk_destruct; + req->hr_file = sock->file; ret = -EOPNOTSUPP ; net =sock_net (req->hr_sk);@@ -334,6 +335,9 @@ bool handshake_req_cancel(struct sock *sk)return false; } +/* Request accepted and waiting for DONE */ +fput (req->hr_file); +Quoted 8 lines
out_true:trace_handshake_cancel(net, req, sk);Signature · 1 line
2.39.2Don't take this one. It's fixed by a later commit:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
361b6889ae636926cdff517add240c3c8e24593athat reverts it.
How? That commit is in 6.4 already, yet this commit, is from 6.5-rc1.
I do not see
f921bd41001ccff2249f5f443f2917f7ef937dafin v6.5-rc2. Whatever that is, it's not in upstream.
I see it:
$ git describe --contains f921bd41001ccff2249f5f443f2917f7ef937daf v6.5-rc1~163^2~292^2~1 $ git show --oneline f921bd41001ccff2249f5f443f2917f7ef937daf | head -n 1 f921bd41001c net/handshake: Unpin sock->file if a handshake is cancelled
$ git describe --contains 361b6889ae636926cdff517add240c3c8e24593a v6.4-rc7~17^2~14 $ git show --oneline 361b6889ae636926cdff517add240c3c8e24593a | head -n 1 361b6889ae63 net/handshake: remove fput() that causes use-after-free
So commit 361b6889ae63 ("net/handshake: remove fput() that causes use-after-free") came into 6.4-rc7, and commit f921bd41001c ("net/handshake: Unpin sock->file if a handshake is cancelled") came into 6.5-rc1.
Quoted 18 lines
[cel@manet server-development]$ git log --pretty=oneline v6.5-rc2 --
net/handshake/173780ff18a93298ca84224cc79df69f9cc198ceMergegit://git.kernel.org/pub/scm/linux/kernel/git/netdev/net361b6889ae636926cdff517add240c3c8e24593anet/handshake: removefput()that causes use-after-free9b66ee06e5ca2698d0ba12a7ad7188cb724279e7net: ynl: prefix uAPI header include with uapi/26fb5480a27d34975cc2b680b77af189620dd740net/handshake: Enable the SNI extension to work properly1ce77c998f0415d7d9d91cb9bd7665e25c8f75f1net/handshake: Unpinsock->fileif a handshake is cancelledfc490880e39d86c65ab2bcbd357af1950fa55e48net/handshake:handshake_genl_notify()shouldn't ignore @flags7afc6d0a107ffbd448c96eb2458b9e64a5af7860net/handshake: Fix uninitialized local variable7ea9c1ec66bc099b0bfba961a8a46dfe25d7d8e4net/handshake: Fixhandshake_dup()ref countinga095326e2c0f33743ce8e887d5b90edf3f36ccednet/handshake: Remove unneeded check fromhandshake_dup()18c40a1cc1d990c51381ef48cd93fdb31d5cd903net/handshake: Fixsock->fileallocationb21c7ba6d9a5532add3827a3b49f49cbc0cb9779net/handshake: Squelch allocation warning during Kunit test6aa445e39693bff9c98b12f960e66b4e18c7378bnet/handshake: Fix section mismatch inhandshake_exit88232ec1ec5ecf4aa5de439cff3d5e2b7adcac93net/handshake: Add Kunit tests for the handshake consumer API2fd5532044a89d2403b543520b4902e196f7d165net/handshake: Add a kernel API for requesting a TLSv1.3 handshake3b3009ea8abb713b022d94fba95ec270cf6e7eaenet/handshake: Create a NETLINK service for handling handshake requests [cel@manet server-development]$
Quoted 2 lines
But I do see
1ce77c998f0415d7d9d91cb9bd7665e25c8f75f1and the commit that reverts it,361b6889ae636926cdff517add240c3c8e24593a.
Very strange. As this is confusing, I'll just drop it for now until someone can straighten it out :)
thanks,
greg k-h
Re: [PATCH 6.4 118/800] net/handshake: Unpin sock->file if a handshake is cancelled
Quoted 79 lines · Greg Kroah-Hartman
Quoted 74 lines · Chuck Lever III
Quoted 73 lines · Greg Kroah-Hartman
Quoted 63 lines · Chuck Lever III
Quoted 52 lines · Greg Kroah-Hartman
From: Chuck Lever <[email protected]>
[ Upstream commit
f921bd41001ccff2249f5f443f2917f7ef937daf]If user space never calls DONE, sock->file's reference count remains elevated. Enable
sock->fileto be freed eventually in this case.Reported-by Jakub Kacinski <[email protected]>Fixes 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")Signed-off-by Chuck Lever <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
net/handshake/handshake.h| 1 +net/handshake/request.c| 4 ++++2 files changed, 5 insertions(+)net/handshake/handshake.h +1
-0@@ -31,6 +31,7 @@ struct handshake_req {struct list_head hr_list;struct rhash_head hr_rhash;unsigned long hr_flags; +struct file *hr_file;const struct handshake_proto *hr_proto;struct sock *hr_sk;void (*hr_odestruct)(struct sock *sk);net/handshake/request.c +4
-0@@ -239,6 +239,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req, } req->hr_odestruct = req->hr_sk->sk_destruct; req->hr_sk->sk_destruct = handshake_sk_destruct; + req->hr_file = sock->file; ret = -EOPNOTSUPP ; net =sock_net (req->hr_sk);@@ -334,6 +335,9 @@ bool handshake_req_cancel(struct sock *sk)return false; } +/* Request accepted and waiting for DONE */ +fput (req->hr_file); +Quoted 8 lines
out_true:trace_handshake_cancel(net, req, sk);Signature · 1 line
2.39.2Don't take this one. It's fixed by a later commit:
Quoted 3 lines
361b6889ae636926cdff517add240c3c8e24593athat reverts it.
How? That commit is in 6.4 already, yet this commit, is from 6.5-rc1.
Quoted 8 lines
Quoted 2 lines
I do not see
f921bd41001ccff2249f5f443f2917f7ef937dafin v6.5-rc2. Whatever that is, it's not in upstream.I see it:
$ git describe --contains f921bd41001ccff2249f5f443f2917f7ef937daf v6.5-rc1~163^2~292^2~1 $ git show --oneline f921bd41001ccff2249f5f443f2917f7ef937daf | head -n 1 f921bd41001c net/handshake: Unpin sock->file if a handshake is cancelled
Yes, I see it too, it's in the repo. But it's not in the commit history of tag v6.5-rc2, and the source tree, as of v6.5-rc2, does not have that change.
Quoted 9 lines
$ git describe --contains 361b6889ae636926cdff517add240c3c8e24593a v6.4-rc7~17^2~14 $ git show --oneline 361b6889ae636926cdff517add240c3c8e24593a | head -n 1 361b6889ae63 net/handshake: remove fput() that causes use-after-freeSo commit
361b6889ae63("net/handshake: removefput()that causes use-after-free") came into 6.4-rc7, and commitf921bd41001c("net/handshake: Unpinsock->fileif a handshake is cancelled") came into 6.5-rc1.
f921bd41001c isn't in 6.5-rc at all, according to the commit history.
Quoted 18 lines
Quoted 18 lines
[cel@manet server-development]$ git log --pretty=oneline v6.5-rc2 --
net/handshake/173780ff18a93298ca84224cc79df69f9cc198ceMergegit://git.kernel.org/pub/scm/linux/kernel/git/netdev/net361b6889ae636926cdff517add240c3c8e24593anet/handshake: removefput()that causes use-after-free9b66ee06e5ca2698d0ba12a7ad7188cb724279e7net: ynl: prefix uAPI header include with uapi/26fb5480a27d34975cc2b680b77af189620dd740net/handshake: Enable the SNI extension to work properly1ce77c998f0415d7d9d91cb9bd7665e25c8f75f1net/handshake: Unpinsock->fileif a handshake is cancelledfc490880e39d86c65ab2bcbd357af1950fa55e48net/handshake:handshake_genl_notify()shouldn't ignore @flags7afc6d0a107ffbd448c96eb2458b9e64a5af7860net/handshake: Fix uninitialized local variable7ea9c1ec66bc099b0bfba961a8a46dfe25d7d8e4net/handshake: Fixhandshake_dup()ref countinga095326e2c0f33743ce8e887d5b90edf3f36ccednet/handshake: Remove unneeded check fromhandshake_dup()18c40a1cc1d990c51381ef48cd93fdb31d5cd903net/handshake: Fixsock->fileallocationb21c7ba6d9a5532add3827a3b49f49cbc0cb9779net/handshake: Squelch allocation warning during Kunit test6aa445e39693bff9c98b12f960e66b4e18c7378bnet/handshake: Fix section mismatch inhandshake_exit88232ec1ec5ecf4aa5de439cff3d5e2b7adcac93net/handshake: Add Kunit tests for the handshake consumer API2fd5532044a89d2403b543520b4902e196f7d165net/handshake: Add a kernel API for requesting a TLSv1.3 handshake3b3009ea8abb713b022d94fba95ec270cf6e7eaenet/handshake: Create a NETLINK service for handling handshake requests [cel@manet server-development]$
Quoted 5 lines
Quoted 2 lines
But I do see
1ce77c998f0415d7d9d91cb9bd7665e25c8f75f1and the commit that reverts it,361b6889ae636926cdff517add240c3c8e24593a.Very strange. As this is confusing, I'll just drop it for now until someone can straighten it out :)
Thanks for dropping!
--
Chuck Lever
Greg Kroah-Hartman
maintainerRe: [PATCH 6.4 118/800] net/handshake: Unpin sock->file if a handshake is cancelled
Quoted 98 lines · Chuck Lever III
Quoted 79 lines · Greg Kroah-Hartman
Quoted 74 lines · Chuck Lever III
Quoted 73 lines · Greg Kroah-Hartman
Quoted 63 lines · Chuck Lever III
Quoted 52 lines · Greg Kroah-Hartman
From: Chuck Lever <[email protected]>
[ Upstream commit
f921bd41001ccff2249f5f443f2917f7ef937daf]If user space never calls DONE, sock->file's reference count remains elevated. Enable
sock->fileto be freed eventually in this case.Reported-by Jakub Kacinski <[email protected]>Fixes 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")Signed-off-by Chuck Lever <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
net/handshake/handshake.h| 1 +net/handshake/request.c| 4 ++++2 files changed, 5 insertions(+)net/handshake/handshake.h +1
-0@@ -31,6 +31,7 @@ struct handshake_req {struct list_head hr_list;struct rhash_head hr_rhash;unsigned long hr_flags; +struct file *hr_file;const struct handshake_proto *hr_proto;struct sock *hr_sk;void (*hr_odestruct)(struct sock *sk);net/handshake/request.c +4
-0@@ -239,6 +239,7 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req, } req->hr_odestruct = req->hr_sk->sk_destruct; req->hr_sk->sk_destruct = handshake_sk_destruct; + req->hr_file = sock->file; ret = -EOPNOTSUPP ; net =sock_net (req->hr_sk);@@ -334,6 +335,9 @@ bool handshake_req_cancel(struct sock *sk)return false; } +/* Request accepted and waiting for DONE */ +fput (req->hr_file); +Quoted 8 lines
out_true:trace_handshake_cancel(net, req, sk);Signature · 1 line
2.39.2Don't take this one. It's fixed by a later commit:
Quoted 3 lines
361b6889ae636926cdff517add240c3c8e24593athat reverts it.
How? That commit is in 6.4 already, yet this commit, is from 6.5-rc1.
Quoted 8 lines
Quoted 2 lines
I do not see
f921bd41001ccff2249f5f443f2917f7ef937dafin v6.5-rc2. Whatever that is, it's not in upstream.I see it:
$ git describe --contains f921bd41001ccff2249f5f443f2917f7ef937daf v6.5-rc1~163^2~292^2~1 $ git show --oneline f921bd41001ccff2249f5f443f2917f7ef937daf | head -n 1 f921bd41001c net/handshake: Unpin sock->file if a handshake is cancelledYes, I see it too, it's in the repo. But it's not in the commit history of tag v6.5-rc2, and the source tree, as of v6.5-rc2, does not have that change.
Quoted 5 lines
$ git describe --contains 361b6889ae636926cdff517add240c3c8e24593a v6.4-rc7~17^2~14 $ git show --oneline 361b6889ae636926cdff517add240c3c8e24593a | head -n 1 361b6889ae63 net/handshake: remove fput() that causes use-after-free
Quoted 9 lines
Quoted 4 lines
So commit
361b6889ae63("net/handshake: removefput()that causes use-after-free") came into 6.4-rc7, and commitf921bd41001c("net/handshake: Unpinsock->fileif a handshake is cancelled") came into 6.5-rc1.
f921bd41001cisn't in 6.5-rc at all, according to the commit history.Quoted 1 line
Quoted 1 line
[cel@manet server-development]$ git log --pretty=oneline v6.5-rc2 --
net/handshake/
I think the issue is that you are comparing it to the current state of net/handshake, if you look overall at the log, you will see it:
$ git log --pretty=oneline v6.5-rc2 | grep f921bd41001ccff2249f5f443f2917f7ef937daf f921bd41001ccff2249f5f443f2917f7ef937daf net/handshake: Unpin sock->file if a handshake is cancelled
Or just a normal "git log" will also show it.
There is a way to say "ignore the current state of the directory I'm asking for the log for, and just give me all the commits that touched it" but I can't ever remember the option to git log for it.
Ah, it's the --full-history option:
$ git log --pretty=oneline --full-history v6.5-rc2 -- net/handshake/ | grep f921bd41001ccff2249f5f443f2917f7ef937daf f921bd41001ccff2249f5f443f2917f7ef937daf net/handshake: Unpin sock->file if a handshake is cancelled
So yes, it's really there. Read the "History Simplification" section in the git log manpage for all the details as to why it didn't show up in your command. And one day I'll actually remember that option...
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 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 Tue, 18 Jul 2023 19:48:07 +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.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Greg Kroah-HartmanHello.
Quoted 66 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +10
-0@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )
io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 10 lines
io_uring/io_uring.c +3
-2schedule (); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/*
Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Please check.
Thanks.
[1] https://bbs.archlinux.org/viewtopic.php?id=287343
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217700
[3] https://bugzilla.kernel.org/show_bug.cgi?id=217699
Signature · 1 line
Oleksandr Natalenko (post-factum)
Greg Kroah-Hartman
maintainerRe: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 78 lines · Oleksandr Natalenko
Hello.
Quoted 75 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +13
-2@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }
Quoted 7 lines
io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 1 line
io_uring/io_uring.c +0
-0/* Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Please check.
Is this also an issue in 6.5-rc2?
thanks,
greg k-h
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 83 lines · On neděle 23. července 2023 12:50:30 CEST Greg Kroah-Hartman wrote:
Quoted 82 lines · Oleksandr Natalenko
Hello.
Quoted 66 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +10
-0@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 10 lines
io_uring/io_uring.c +3
-2schedule (); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/* Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Quoted 5 lines
Quoted 3 lines
Reverting this commit fixes the issue.
Please check.
Is this also an issue in 6.5-rc2?
As per [1], yes.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=217699#c4
Quoted 5 lines
thanks,
greg k-h
Signature · 1 line
Oleksandr Natalenko (post-factum)
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Oleksandr Natalenko
Hello.
Quoted 5 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That
...
Quoted 5 lines
Quoted 5 lines
Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Quoted 7 lines
Quoted 1 line
Please check.
Is this also an issue in 6.5-rc2?
thanks,
greg k-h
Yes - I can confirm this issue is in 6.5-rc2 and with Linus' commit c2782531397f5cb19ca3f8f9c17727f1cdf5bee8.
gene
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Oleksandr Natalenko[CCing the regression list, as it should be in the loop for regressions:
https://docs.kernel.org/admin-guide/reporting-regressions.html]
[TLDR: I'm adding this report to the list of tracked Linux kernel regressions; the text you find below is based on a few templates paragraphs you might have encountered already in similar form. See link in footer if these mails annoy you.]
Quoted 20 lines · Oleksandr Natalenko
Quoted 9 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().Quoted 5 lines
The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Quoted 7 lines
Please check.
Thanks.
[1] https://bbs.archlinux.org/viewtopic.php?id=287343
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217700
[3] https://bugzilla.kernel.org/show_bug.cgi?id=217699
Thanks for the report. To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot:
#regzbot introduced 8a796565cec360107 ^
https://bbs.archlinux.org/viewtopic.php?id=287343
https://bugzilla.kernel.org/show_bug.cgi?id=217700
https://bugzilla.kernel.org/show_bug.cgi?id=217699
#regzbot title block: io_uring: high iowait rates and stalls #regzbot ignore-activity
This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply and tell me -- ideally while also telling regzbot about it, as explained by the page listed in the footer of this mail.
Developers: When fixing the issue, remember to add 'Link:' tags pointing to the report (the parent of this mail). See page linked in footer for details.
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.
Jens Axboe
maintainerRe: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Oleksandr NatalenkoQuoted 84 lines · Oleksandr Natalenko
Hello.
Quoted 66 lines · On ned?le 16. ?ervence 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +10
-0@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 10 lines
io_uring/io_uring.c +3
-2schedule (); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/* Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Quoted 7 lines
Please check.
Thanks.
[1] https://bbs.archlinux.org/viewtopic.php?id=287343
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217700
[3] https://bugzilla.kernel.org/show_bug.cgi?id=217699
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Signature · 1 line
Jens Axboe
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Linux regression tracking #adding (Thorsten Leemhuis)Quoted 11 lines · Linux regression tracking #adding (Thorsten Leemhuis)
Quoted 9 lines · Oleksandr Natalenko
Quoted 8 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().
Quoted 6 lines
#regzbot introduced
8a796565cec360107^
https://bbs.archlinux.org/viewtopic.php?id=287343
https://bugzilla.kernel.org/show_bug.cgi?id=217700
https://bugzilla.kernel.org/show_bug.cgi?id=217699
#regzbot title block:io_uring: high iowait rates and stalls #regzbot ignore-activity
Apparently expected behavior:
https://lore.kernel.org/lkml/[email protected]/
#regzbot resolve: notabug: on a closer look it turned out that's expected behavior
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.
#regzbot ignore-activity
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Jens AxboeOn 7/23/23 11:31, Jens Axboe wrote:
...
Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100
# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# systemctl start mariadb (iowaits -> 100%)
# iotop -bo |grep maria (shows no output, iowait stays 100%)
(this persists until mariadb process exits)
# systemctl stop mariadb (iowait drops to 0%)
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Hello.
Quoted 28 lines · On neděle 23. července 2023 19:43:50 CEST Genes Lists wrote:
On 7/23/23 11:31, Jens Axboe wrote:
...Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql# systemctl start mariadb (iowaits -> 100%)
Quoted 6 lines
# iotop -bo |grep maria (shows no output, iowait stays 100%)(this persists until mariadb process exits)
# systemctl stop mariadb (iowait drops to 0%)
This is a visible userspace behaviour change with no changes in the userspace itself, so we cannot just ignore it. If for some reason this is how it should be now, how do we explain it to MariaDB devs to get this fixed?
Thanks.
Signature · 1 line
Oleksandr Natalenko (post-factum)
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Hi,
Quoted 34 lines · Oleksandr Natalenko
Quoted 33 lines · On neděle 23. července 2023 19:43:50 CEST Genes Lists wrote:
On 7/23/23 11:31, Jens Axboe wrote:
...Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql# systemctl start mariadb (iowaits -> 100%)# iotop -bo |grep maria (shows no output, iowait stays 100%)(this persists until mariadb process exits)
Quoted 6 lines
Quoted 1 line
# systemctl stop mariadb (iowait drops to 0%)This is a visible userspace behaviour change with no changes in the userspace itself, so we cannot just ignore it. If for some reason this is how it should be now, how do we explain it to MariaDB devs to get this fixed?
Just to confirm I understand: Your concern is how it looks in mpstat, not performance or anything like that?
As far as I can tell, mariadb submits a bunch of IOs, which all have completed:
...
mariadbd 438034 [000] 67593.094595: io_uring:io_uring_submit_req: ring 0xffff8887878ac800, req 0xffff888929df2400, user_data 0x55d5eaf29488, opcode READV, flags 0x0, sq_thread 0
mariadbd 438034 [000] 67593.094604: io_uring:io_uring_submit_req: ring 0xffff8887878ac800, req 0xffff888929df2500, user_data 0x55d5eaf29520, opcode READV, flags 0x0, sq_thread 0
mariadbd 438034 [000] 67593.094690: io_uring:io_uring_complete: ring 0xffff8887878ac800, req 0xffff888929df2400, user_data 0x55d5eaf29488, result 16384, cflags 0x0 extra1 0 extra2 0
mariadbd 438034 [000] 67593.094699: io_uring:io_uring_complete: ring 0xffff8887878ac800, req 0xffff888929df2500, user_data 0x55d5eaf29520, result 16384, cflags 0x0 extra1 0 extra2 0 Then waits for io_uring events:
mariadbd 438032 [003] 67593.095282: io_uring:io_uring_cqring_wait: ring 0xffff8887878ac800, min_events 1
There won't be any completions without further IO being submitted.
io_uring could have logic to somehow report a different state in such a case (where there'll not be any completions before new IOs being submitted), but that'd likely not be free.
Greetings,
Andres Freund
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 2 lines · Andres Freund
Just to confirm I understand: Your concern is how it looks in mpstat, not performance or anything like that?
Right - there is no performance issue or any other issue to my knowledge and cores are idle.
So, as you said, its just a small reporting item - which is now quite clear.
thank you.
gene
Jens Axboe
maintainerRe: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Oleksandr NatalenkoQuoted 36 lines · Oleksandr Natalenko
Hello.
Quoted 33 lines · On ned?le 23. ?ervence 2023 19:43:50 CEST Genes Lists wrote:
On 7/23/23 11:31, Jens Axboe wrote:
...Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql# systemctl start mariadb (iowaits -> 100%)# iotop -bo |grep maria (shows no output, iowait stays 100%)(this persists until mariadb process exits)
Quoted 6 lines
Quoted 1 line
# systemctl stop mariadb (iowait drops to 0%)This is a visible userspace behaviour change with no changes in the userspace itself, so we cannot just ignore it. If for some reason this is how it should be now, how do we explain it to MariaDB devs to get this fixed?
It's not a behavioural change, it's a reporting change. There's no functionality changing here. That said, I do think we should narrow it a bit so we're only marked as in iowait if the task waiting has pending IO. That should still satisfy the initial problem, and it won't flag iowait on mariadb like cases where they have someone else just perpetually waiting on requests.
As a side effect, this also removes the flush that wasn't at all necessary on io_uring.
If folks are able to test the below, that would be appreciated.
io_uring/io_uring.c +17 -6
@@ -2493,11 +2493,20 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx)return 0 ; } +static bool current_pending_io (void ) +{ +struct io_uring_task *tctx = current->io_uring; + +if (!tctx) +return false; +return percpu_counter_read_positive (&tctx->inflight); +} +/* when returns >0, the caller should retry */ static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { -int token, ret; +int io_wait, ret;if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;
@@ -2511,17 +2520,19 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,return 0 ;/* -* Use io_schedule_prepare/finish, so cpufreq can take into account -* that the task is waiting for IO - turns out to be important for low -* QD IO. +* Mark us as being in io_wait if we have pending requests, so cpufreq +* can take into account that the task is waiting for IO - turns out +* to be important for low QD IO. */ - token =io_schedule_prepare (); + io_wait = current->in_iowait; +if (current_pending_io ()) + current->in_iowait =1 ; ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) ret = -ETIME ; -io_schedule_finish (token); + current->in_iowait = io_wait;return ret; }
Signature · 1 line
Jens Axboe
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 55 lines · Jens Axboe
It's not a behavioural change, it's a reporting change. There's no functionality changing here. That said, I do think we should narrow it a bit so we're only marked as in iowait if the task waiting has pending IO. That should still satisfy the initial problem, and it won't flag iowait on mariadb like cases where they have someone else just perpetually waiting on requests.
As a side effect, this also removes the flush that wasn't at all necessary on
io_uring.If folks are able to test the below, that would be appreciated.
io_uring/io_uring.c +16
-5@@ -2493,11 +2493,20 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx)return 0 ; } +static bool current_pending_io (void ) +{ +struct io_uring_task *tctx = current->io_uring; + +if (!tctx) +return false; +return percpu_counter_read_positive (&tctx->inflight); +} +/* when returns >0, the caller should retry */ static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { -int token, ret; +int io_wait, ret;if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;@@ -2511,17 +2520,19 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,return 0 ;/* -* Use io_schedule_prepare/finish, so cpufreq can take into account -* that the task is waiting for IO - turns out to be important for low -* QD IO. +* Mark us as being in io_wait if we have pending requests, so cpufreq +* can take into account that the task is waiting for IO - turns out +* to be important for low QD IO. */ - token =io_schedule_prepare (); + io_wait = current->in_iowait; +if (current_pending_io ()) + current->in_iowait =1 ;
io_uring/io_uring.c static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, · line 2538
Quoted 10 lines
io_uring/io_uring.c +1
-1ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) ret = -ETIME ; -io_schedule_finish (token); + current->in_iowait = io_wait;return ret; }
Tested on top of 6.4.6 stable - and working great - iowait stats now look like they always did.
thank you
gene