5.17.3-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 283/343 btrfs: fix qgroup reserve overflow the qgroup limit
In reply to Greg Kroah-HartmanFrom: Ethan Lien <[email protected]>
commit b642b52d0b50f4d398cb4293f64992d0eed2e2ce upstream.
We use extent_changeset->bytes_changed in qgroup_reserve_data() to record how many bytes we set for EXTENT_QGROUP_RESERVED state. Currently the bytes_changed is set as "unsigned int", and it will overflow if we try to fallocate a range larger than 4GiB. The result is we reserve less bytes and eventually break the qgroup limit.
Unlike regular buffered/direct write, which we use one changeset for each ordered extent, which can never be larger than 256M. For fallocate, we use one changeset for the whole range, thus it no longer respects the 256M per extent limit, and caused the problem.
The following example test script reproduces the problem:
$ cat qgroup-overflow.sh #!/bin/bash
DEV=/dev/sdj
MNT=/mnt/sdj
mkfs.btrfs -f $DEV
mount $DEV $MNT
# Set qgroup limit to 2GiB.
btrfs quota enable $MNT
btrfs qgroup limit 2G $MNT
# Try to fallocate a 3GiB file. This should fail. echo
echo "Try to fallocate a 3GiB file..." fallocate -l 3G $MNT/3G.file
# Try to fallocate a 5GiB file.
echo
echo "Try to fallocate a 5GiB file..."
fallocate -l 5G $MNT/5G.file
# See we break the qgroup limit.
echo
sync
btrfs qgroup show -r $MNT
umount $MNT
When running the test:
$ ./qgroup-overflow.sh (...)
Try to fallocate a 3GiB file...
fallocate: fallocate failed: Disk quota exceeded
Try to fallocate a 5GiB file...
qgroupid rfer excl max_rfer
-------- ---- ---- --------
0/5 5.00GiB 5.00GiB 2.00GiB
Since we have no control of how bytes_changed is used, it's better to set it to u64.
--- fs/btrfs/extent_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent_io.h +1 -1
@@ -118,7 +118,7 @@ struct btrfs_bio_ctrl {*/ struct extent_changeset {/* How many bytes are set/cleared in this operation */ -unsigned int bytes_changed; +u64 bytes_changed;/* Changed ranges */ struct ulist range_changed;
Greg Kroah-Hartman
maintainerPATCH 284/343 btrfs: zoned: traverse devices under chunk_mutex in btrfs_can_activate_zone
In reply to Greg Kroah-HartmanFrom: Johannes Thumshirn <[email protected]>
commit 0b9e66762aa0cda2a9c2d5542d64e04dac528fa6 upstream.
btrfs_can_activate_zone() can be called with the device_list_mutex already held, which will lead to a deadlock:
insert_dev_extents() // Takes device_list_mutex
`-> insert_dev_extent()
`-> btrfs_insert_empty_item()
`-> btrfs_insert_empty_items()
`-> btrfs_search_slot()
`-> btrfs_cow_block()
`-> __btrfs_cow_block()
`-> btrfs_alloc_tree_block()
`-> btrfs_reserve_extent()
`-> find_free_extent()
`-> find_free_extent_update_loop()
`-> can_allocate_chunk()
`-> btrfs_can_activate_zone() // Takes device_list_mutex againInstead of using the RCU on fs_devices->device_list we
can use fs_devices->alloc_list, protected by the chunk_mutex to traverse the list of active devices.
We are in the chunk allocation thread. The newer chunk allocation happens from the devices in the fs_device->alloc_list protected by the chunk_mutex.
btrfs_create_chunk()
lockdep_assert_held(&info->chunk_mutex);
gather_device_info
list_for_each_entry(device, &fs_devices->alloc_list, dev_alloc_list)Also, a device that reappears after the mount won't join the alloc_list yet and, it will be in the dev_list, which we don't want to consider in the context of the chunk alloc.
[15.166572] WARNING: possible recursive locking detected
[15.167117] 5.17.0-rc6-dennis #79 Not tainted
[15.167487] --------------------------------------------
[15.167733] kworker/u8:3/146 is trying to acquire lock:
[15.167733] ffff888102962ee0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: find_free_extent+0x15a/0x14f0 [btrfs]
[15.167733]
[15.167733] but task is already holding lock:
[15.167733] ffff888102962ee0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_create_pending_block_groups+0x20a/0x560 [btrfs]
[15.167733]
[15.167733] other info that might help us debug this:
[15.167733] Possible unsafe locking scenario:
[15.167733]
[15.171834] CPU0
[15.171834] ----
[15.171834] lock(&fs_devs->device_list_mutex);
[15.171834] lock(&fs_devs->device_list_mutex);
[15.171834]
[15.171834] *** DEADLOCK ***
[15.171834]
[15.171834] May be due to missing lock nesting notation
[15.171834]
[15.171834] 5 locks held by kworker/u8:3/146:
[15.171834] #0: ffff888100050938 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x1c3/0x5a0
[15.171834] #1: ffffc9000067be80 ((work_completion)(&fs_info->async_data_reclaim_work)){+.+.}-{0:0}, at: process_one_work+0x1c3/0x5a0
[15.176244] #2: ffff88810521e620 (sb_internal){.+.+}-{0:0}, at: flush_space+0x335/0x600 [btrfs]
[15.176244] #3: ffff888102962ee0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_create_pending_block_groups+0x20a/0x560 [btrfs]
[15.176244] #4: ffff8881152e4b78 (btrfs-dev-00){++++}-{3:3}, at: __btrfs_tree_lock+0x27/0x130 [btrfs]
[15.179641]
[15.179641] stack backtrace:
[15.179641] CPU: 1 PID: 146 Comm: kworker/u8:3 Not tainted 5.17.0-rc6-dennis #79
[15.179641] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1.fc35 04/01/2014
[15.179641] Workqueue: events_unbound btrfs_async_reclaim_data_space [btrfs]
[15.179641] Call Trace:
[15.179641] <TASK>
[15.179641] dump_stack_lvl+0x45/0x59
[15.179641] __lock_acquire.cold+0x217/0x2b2
[15.179641] lock_acquire+0xbf/0x2b0
[15.183838] ? find_free_extent+0x15a/0x14f0 [btrfs]
[15.183838] __mutex_lock+0x8e/0x970
[15.183838] ? find_free_extent+0x15a/0x14f0 [btrfs]
[15.183838] ? find_free_extent+0x15a/0x14f0 [btrfs]
[15.183838] ? lock_is_held_type+0xd7/0x130
[15.183838] ? find_free_extent+0x15a/0x14f0 [btrfs]
[15.183838] find_free_extent+0x15a/0x14f0 [btrfs]
[15.183838] ? _raw_spin_unlock+0x24/0x40
[15.183838] ? btrfs_get_alloc_profile+0x106/0x230 [btrfs]
[15.187601] btrfs_reserve_extent+0x131/0x260 [btrfs]
[15.187601] btrfs_alloc_tree_block+0xb5/0x3b0 [btrfs]
[15.187601] __btrfs_cow_block+0x138/0x600 [btrfs]
[15.187601] btrfs_cow_block+0x10f/0x230 [btrfs]
[15.187601] btrfs_search_slot+0x55f/0xbc0 [btrfs]
[15.187601] ? lock_is_held_type+0xd7/0x130
[15.187601] btrfs_insert_empty_items+0x2d/0x60 [btrfs]
[15.187601] btrfs_create_pending_block_groups+0x2b3/0x560 [btrfs]
[15.187601] __btrfs_end_transaction+0x36/0x2a0 [btrfs]
[15.192037] flush_space+0x374/0x600 [btrfs]
[15.192037] ? find_held_lock+0x2b/0x80
[15.192037] ? btrfs_async_reclaim_data_space+0x49/0x180 [btrfs]
[15.192037] ? lock_release+0x131/0x2b0
[15.192037] btrfs_async_reclaim_data_space+0x70/0x180 [btrfs]
[15.192037] process_one_work+0x24c/0x5a0
[15.192037] worker_thread+0x4a/0x3d0--- fs/btrfs/zoned.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/btrfs/zoned.c +5 -4
@@ -1927,18 +1927,19 @@ int btrfs_zone_finish(struct btrfs_blockbool btrfs_can_activate_zone (struct btrfs_fs_devices *fs_devices,u64 flags) { +struct btrfs_fs_info *fs_info = fs_devices->fs_info;struct btrfs_device *device;bool ret = false; -if (!btrfs_is_zoned (fs_devices->fs_info)) +if (!btrfs_is_zoned (fs_info))return true;/* Non-single profiles are not supported yet */ ASSERT ((flags &BTRFS_BLOCK_GROUP_PROFILE_MASK ) ==0 );/* Check if there is a device with active zones left */ -mutex_lock (&fs_devices->device_list_mutex); -list_for_each_entry (device, &fs_devices->devices, dev_list) { +mutex_lock (&fs_info->chunk_mutex); +list_for_each_entry (device, &fs_devices->alloc_list, dev_alloc_list) {struct btrfs_zoned_device_info *zinfo = device->zone_info;if (!device->bdev)
@@ -1950,7 +1951,7 @@ bool btrfs_can_activate_zone(struct btrfbreak ; } } -mutex_unlock (&fs_devices->device_list_mutex); +mutex_unlock (&fs_info->chunk_mutex);return ret; }
Greg Kroah-Hartman
maintainerPATCH 285/343 btrfs: remove device item and update super block in the same transaction
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit bbac58698a55cc0a6f0c0d69a6dcd3f9f3134c11 upstream.
[BUG]
There is a report that a btrfs has a bad super block num devices.
This makes btrfs to reject the fs completely.
BTRFS error (device sdd3): super_num_devices 3 mismatch with num_devices 2 found here BTRFS error (device sdd3): failed to read chunk tree: -22
BTRFS error (device sdd3): open_ctree failed
[CAUSE]
During btrfs device removal, chunk tree and super block num devs are updated in two different transactions:
btrfs_rm_device()
|- btrfs_rm_dev_item(device) | |- trans = btrfs_start_transaction() | | Now we got transaction X | | | |- btrfs_del_item() | | Now device item is removed from chunk tree | | | |- btrfs_commit_transaction() | Transaction X got committed, super num devs untouched, | but device item removed from chunk tree. | (AKA, super num devs is already incorrect) | |- cur_devices->num_devices--; |- cur_devices->total_devices--; |- btrfs_set_super_num_devices()
All those operations are not in transaction X, thus it will only be written back to disk in next transaction.
So after the transaction X in btrfs_rm_dev_item() committed, but before transaction X+1 (which can be minutes away), a power loss happen, then we got the super num mismatch.
[FIX]
Instead of starting and committing a transaction inside btrfs_rm_dev_item(), start a transaction in side btrfs_rm_device() and pass it to btrfs_rm_dev_item().
And only commit the transaction after everything is done.
--- fs/btrfs/volumes.c | 65 ++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 37 deletions(-)
fs/btrfs/volumes.c +28 -37
@@ -1945,23 +1945,18 @@ static void update_dev_time(const char *path_put (&path); } -static int btrfs_rm_dev_item (struct btrfs_device *device) +static int btrfs_rm_dev_item (struct btrfs_trans_handle *trans, +struct btrfs_device *device) {struct btrfs_root *root = device->fs_info->chunk_root;int ret;struct btrfs_path *path;struct btrfs_key key; -struct btrfs_trans_handle *trans; path =btrfs_alloc_path ();if (!path)return -ENOMEM ; - trans =btrfs_start_transaction (root,0 ); -if (IS_ERR (trans)) { -btrfs_free_path (path); -return PTR_ERR (trans); - } key.objectid =BTRFS_DEV_ITEMS_OBJECTID ; key.type =BTRFS_DEV_ITEM_KEY ; key.offset = device->devid;
@@ -1972,21 +1967,12 @@ static int btrfs_rm_dev_item(struct btrfif (ret) {if (ret >0 ) ret = -ENOENT ; -btrfs_abort_transaction (trans, ret); -btrfs_end_transaction (trans); goto out; } ret =btrfs_del_item (trans, root, path); -if (ret) { -btrfs_abort_transaction (trans, ret); -btrfs_end_transaction (trans); - } - out:btrfs_free_path (path); -if (!ret) - ret =btrfs_commit_transaction (trans);return ret; }
@@ -2127,6 +2113,7 @@ int btrfs_rm_device(struct btrfs_fs_infostruct btrfs_dev_lookup_args *args, struct block_device **bdev, fmode_t *mode) { + struct btrfs_trans_handle *trans;struct btrfs_device *device;struct btrfs_fs_devices *cur_devices;struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
@@ -2142,7 +2129,7 @@ int btrfs_rm_device(struct btrfs_fs_info ret =btrfs_check_raid_min_devices (fs_info, num_devices -1 );if (ret) - goto out; +return ret; device =btrfs_find_device (fs_info->fs_devices, args);if (!device) {
@@ -2150,27 +2137,22 @@ int btrfs_rm_device(struct btrfs_fs_info ret =BTRFS_ERROR_DEV_MISSING_NOT_FOUND ; else ret = -ENOENT ; - goto out; +return ret; }if (btrfs_pinned_by_swapfile (fs_info, device)) {btrfs_warn_in_rcu (fs_info,"cannot remove device %s (devid %llu) due to active swapfile" ,rcu_str_deref (device->name), device->devid); - ret = -ETXTBSY ; - goto out; +return -ETXTBSY ; } -if (test_bit (BTRFS_DEV_STATE_REPLACE_TGT , &device->dev_state)) { - ret =BTRFS_ERROR_DEV_TGT_REPLACE ; - goto out; - } +if (test_bit (BTRFS_DEV_STATE_REPLACE_TGT , &device->dev_state)) +return BTRFS_ERROR_DEV_TGT_REPLACE ;if (test_bit (BTRFS_DEV_STATE_WRITEABLE , &device->dev_state) && - fs_info->fs_devices->rw_devices ==1 ) { - ret =BTRFS_ERROR_DEV_ONLY_WRITABLE ; - goto out; - } + fs_info->fs_devices->rw_devices ==1 ) +return BTRFS_ERROR_DEV_ONLY_WRITABLE ;if (test_bit (BTRFS_DEV_STATE_WRITEABLE , &device->dev_state)) {mutex_lock (&fs_info->chunk_mutex);
@@ -2183,14 +2165,22 @@ int btrfs_rm_device(struct btrfs_fs_infoif (ret) goto error_undo; -/* -* TODO: the superblock still includes this device in its num_devices -* counter although write_all_supers() is not locked out. This -* could give a filesystem state which requires a degraded mount. -*/ - ret =btrfs_rm_dev_item (device); -if (ret) + trans =btrfs_start_transaction (fs_info->chunk_root,0 ); +if (IS_ERR (trans)) { + ret =PTR_ERR (trans); goto error_undo; + } + + ret =btrfs_rm_dev_item (trans, device); +if (ret) { +/* Any error in dev item removal is critical */ +btrfs_crit (fs_info, +"failed to remove device item for devid %llu: %d" , + device->devid, ret); +btrfs_abort_transaction (trans, ret); +btrfs_end_transaction (trans); +return ret; + }clear_bit (BTRFS_DEV_STATE_IN_FS_METADATA , &device->dev_state);btrfs_scrub_cancel_dev (device);
@@ -2273,7 +2263,8 @@ int btrfs_rm_device(struct btrfs_fs_infofree_fs_devices (cur_devices); } -out: + ret =btrfs_commit_transaction (trans); +return ret; error_undo:
@@ -2284,7 +2275,7 @@ error_undo: device->fs_devices->rw_devices++;mutex_unlock (&fs_info->chunk_mutex); } - goto out; +return ret; }void btrfs_rm_dev_replace_remove_srcdev (struct btrfs_device *srcdev)
Greg Kroah-Hartman
maintainerPATCH 286/343 btrfs: avoid defragging extents whose next extents are not targets
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit 75a36a7d3ea904cef2e5b56af0c58cc60dcf947a upstream.
[BUG]
There is a report that autodefrag is defragging single sector, which is completely waste of IO, and no help for defragging:
btrfs-cleaner-808 defrag_one_locked_range: root=256 ino=651122 start=0 len=4096
[CAUSE]
In defrag_collect_targets(), we check if the current range (A) can be merged with next one (B).
If mergeable, we will add range A into target for defrag.
However there is a catch for autodefrag, when checking mergeability against range B, we intentionally pass 0 as @newer_than, hoping to get a higher chance to merge with the next extent.
But in the next iteration, range B will looked up by defrag_lookup_extent(), with non-zero @newer_than.
And if range B is not really newer, it will rejected directly, causing only range A being defragged, while we expect to defrag both range A and B.
[FIX]
Since the root cause is the difference in check condition of defrag_check_next_extent() and defrag_collect_targets(), we fix it by:
1. Pass @newer_than to defrag_check_next_extent()
2. Pass @extent_thresh to defrag_check_next_extent()
This makes the check between defrag_collect_targets() and defrag_check_next_extent() more consistent.
While there is still some minor difference, the remaining checks are focus on runtime flags like writeback/delalloc, which are mostly transient and safe to be checked only in defrag_collect_targets().
--- fs/btrfs/ioctl.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
fs/btrfs/ioctl.c +14 -6
@@ -1215,7 +1215,7 @@ static u32 get_extent_max_capacity(const }static bool defrag_check_next_extent (struct inode *inode,struct extent_map *em, -bool locked) +u32 extent_thresh,u64 newer_than,bool locked) {struct extent_map *next;bool ret = false;
@@ -1225,11 +1225,12 @@ static bool defrag_check_next_extent(strreturn false;/* -* We want to check if the next extent can be merged with the current -* one, which can be an extent created in a past generation, so we pass -* a minimum generation of 0 to defrag_lookup_extent(). +* Here we need to pass @newer_then when checking the next extent, or +* we will hit a case we mark current extent for defrag, but the next +* one will not be a target. +* This will just cause extra IO without really reducing the fragments. */ - next =defrag_lookup_extent (inode, em->start + em->len,0 , locked); + next =defrag_lookup_extent (inode, em->start + em->len, newer_than, locked);/* No more em or hole */ if (!next || next->block_start >=EXTENT_MAP_LAST_BYTE ) goto out;
@@ -1241,6 +1242,13 @@ static bool defrag_check_next_extent(str*/ if (next->len >=get_extent_max_capacity (em)) goto out; +/* Skip older extent */ +if (next->generation < newer_than) + goto out; +/* Also check extent size */ +if (next->len >= extent_thresh) + goto out; + ret = true; out:free_extent_map (next);
@@ -1446,7 +1454,7 @@ static int defrag_collect_targets(struct goto next; next_mergeable =defrag_check_next_extent (&inode->vfs_inode, em, - locked); + extent_thresh, newer_than, locked);if (!next_mergeable) {struct defrag_target_range *last;
Greg Kroah-Hartman
maintainerPATCH 287/343 btrfs: prevent subvol with swapfile from being deleted
In reply to Greg Kroah-HartmanFrom: Kaiwen Hu <[email protected]>
commit 60021bd754c6ca0addc6817994f20290a321d8d6 upstream.
A subvolume with an active swapfile must not be deleted otherwise it would not be possible to deactivate it.
After the subvolume is deleted, we cannot swapoff the swapfile in this deleted subvolume because the path is unreachable. The swapfile is still active and holding references, the filesystem cannot be unmounted.
The test looks like this:
mkfs.btrfs -f $dev > /dev/null
mount $dev $mnt
btrfs sub create $mnt/subvol
touch $mnt/subvol/swapfile
chmod 600 $mnt/subvol/swapfile
chattr +C $mnt/subvol/swapfile
dd if=/dev/zero of=$mnt/subvol/swapfile bs=1K count=4096 mkswap $mnt/subvol/swapfile
swapon $mnt/subvol/swapfile
btrfs sub delete $mnt/subvol
swapoff $mnt/subvol/swapfile # failed: No such file or directory swapoff --all
unmount $mnt # target is busy.
To prevent above issue, we simply check that whether the subvolume contains any active swapfile, and stop the deleting process. This behavior is like snapshot ioctl dealing with a swapfile.
--- fs/btrfs/inode.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +23 -1
@@ -4466,6 +4466,13 @@ int btrfs_delete_subvolume(struct inode dest->root_key.objectid);return -EPERM ; } +if (atomic_read (&dest->nr_swapfiles)) { +spin_unlock (&dest->root_item_lock); +btrfs_warn (fs_info, +"attempt to delete subvolume %llu with active swapfile" , + root->root_key.objectid); +return -EPERM ; + } root_flags =btrfs_root_flags (&dest->root_item);btrfs_set_root_flags (&dest->root_item, root_flags |BTRFS_ROOT_SUBVOL_DEAD );
@@ -10424,8 +10431,23 @@ static int btrfs_swap_activate(struct sw* set. We use this counter to prevent snapshots. We must increment it * before walking the extents because we don't want a concurrent * snapshot to run after we've already checked the extents. -*/ +* +* It is possible that subvolume is marked for deletion but still not +* removed yet. To prevent this race, we check the root status before +* activating the swapfile. +*/ +spin_lock (&root->root_item_lock); +if (btrfs_root_dead (root)) { +spin_unlock (&root->root_item_lock); + +btrfs_exclop_finish (fs_info); +btrfs_warn (fs_info, +"cannot activate swapfile because subvolume %llu is being deleted" , + root->root_key.objectid); +return -EPERM ; + }atomic_inc (&root->nr_swapfiles); +spin_unlock (&root->root_item_lock); isize =ALIGN_DOWN (inode->i_size, fs_info->sectorsize);
Greg Kroah-Hartman
maintainerPATCH 288/343 spi: core: add dma_map_dev for __spi_unmap_msg()
In reply to Greg Kroah-HartmanFrom: Vinod Koul <[email protected]>
commit 409543cec01a84610029d6440c480c3fdd7214fb upstream.
Commit b470e10eb43f ("spi: core: add dma_map_dev for dma device") added dma_map_dev for _spi_map_msg() but missed to add for unmap routine, __spi_unmap_msg(), so add it now.
--- drivers/spi/spi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi.c +4 -0
@@ -1149,11 +1149,15 @@ static int __spi_unmap_msg(struct spi_coif (ctlr->dma_tx) tx_dev = ctlr->dma_tx->device->dev; +else if (ctlr->dma_map_dev) + tx_dev = ctlr->dma_map_dev;else tx_dev = ctlr->dev.parent;if (ctlr->dma_rx) rx_dev = ctlr->dma_rx->device->dev; +else if (ctlr->dma_map_dev) + rx_dev = ctlr->dma_map_dev;else rx_dev = ctlr->dev.parent;
Greg Kroah-Hartman
maintainerPATCH 289/343 cifs: force new session setup and tcon for dfs
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
commit fb39d30e227233498c8debe6a9fe3e7cf575c85f upstream.
Do not reuse existing sessions and tcons in DFS failover as it might connect to different servers and shares.
--- fs/cifs/connect.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
fs/cifs/connect.c +8 -5
@@ -453,9 +453,7 @@ static int reconnect_target_unlocked(strreturn rc; } -static int -reconnect_dfs_server (struct TCP_Server_Info *server, -bool mark_smb_session) +static int reconnect_dfs_server (struct TCP_Server_Info *server) {int rc =0 ;const char *refpath = server->current_fullpath +1 ;
@@ -479,7 +477,12 @@ reconnect_dfs_server(struct TCP_Server_Iif (!cifs_tcp_ses_needs_reconnect (server, num_targets))return 0 ; -cifs_mark_tcp_ses_conns_for_reconnect (server, mark_smb_session); +/* +* Unconditionally mark all sessions & tcons for reconnect as we might be connecting to a +* different server or share during failover. It could be improved by adding some logic to +* only do that in case it connects to a different server or share, though. +*/ +cifs_mark_tcp_ses_conns_for_reconnect (server, true);cifs_abort_connection (server);
@@ -537,7 +540,7 @@ int cifs_reconnect(struct TCP_Server_Inf }spin_unlock (&cifs_tcp_ses_lock); -return reconnect_dfs_server (server, mark_smb_session); +return reconnect_dfs_server (server); }#else int cifs_reconnect (struct TCP_Server_Info *server,bool mark_smb_session)
Greg Kroah-Hartman
maintainerPATCH 290/343 qed: fix ethtool register dump
In reply to Greg Kroah-HartmanFrom: Manish Chopra <[email protected]>
commit 20921c0c86092b4082c91bd7c88305da74e5520b upstream.
To fix a coverity complain, commit d5ac07dfbd2b ("qed: Initialize debug string array") removed "sw-platform" (one of the common global parameters) from the dump as this was used in the dump with an uninitialized string, however it did not reduce the number of common global parameters which caused the incorrect (unable to parse) register dump
this patch fixes it with reducing NUM_COMMON_GLOBAL_PARAMS bye one.
--- drivers/net/ethernet/qlogic/qed/qed_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_debug.c +1 -1
@@ -489,7 +489,7 @@ struct split_type_defs {#define STATIC_DEBUG_LINE_DWORDS 9 -#define NUM_COMMON_GLOBAL_PARAMS 11 +#define NUM_COMMON_GLOBAL_PARAMS 10#define MAX_RECURSION_DEPTH 10
Greg Kroah-Hartman
maintainerPATCH 291/343 arm64: patch_text: Fixup last cpu should be master
In reply to Greg Kroah-HartmanFrom: Guo Ren <[email protected]>
commit 31a099dbd91e69fcab55eef4be15ed7a8c984918 upstream.
These patch_text implementations are using stop_machine_cpuslocked infrastructure with atomic cpu_count. The original idea: When the master CPU patch_text, the others should wait for it. But current implementation is using the first CPU as master, which couldn't guarantee the remaining CPUs are waiting. This patch changes the last CPU as the master to solve the potential risk.
--- arch/arm64/kernel/patching.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/patching.c +2 -2
@@ -117,8 +117,8 @@ static int __kprobes aarch64_insn_patch_int i, ret =0 ;struct aarch64_insn_patch *pp = arg; -/* The first CPU becomes master */ -if (atomic_inc_return (&pp->cpu_count) ==1 ) { +/* The last CPU becomes master */ +if (atomic_inc_return (&pp->cpu_count) ==num_online_cpus ()) {for (i =0 ; ret ==0 && i < pp->insn_cnt; i++) ret =aarch64_insn_patch_text_nosync (pp->text_addrs[i], pp->new_insns[i]);
Greg Kroah-Hartman
maintainerPATCH 292/343 RDMA/hfi1: Fix use-after-free bug for mm struct
In reply to Greg Kroah-HartmanFrom: Douglas Miller <[email protected]>
commit 2bbac98d0930e8161b1957dc0ec99de39ade1b3c upstream.
Under certain conditions, such as MPI_Abort, the hfi1 cleanup code may represent the last reference held on the task mm. hfi1_mmu_rb_unregister() then drops the last reference and the mm is freed before the final use in hfi1_release_user_pages(). A new task may allocate the mm structure while it is still being used, resulting in problems. One manifestation is corruption of the mmap_sem counter leading to a hang in down_write(). Another is corruption of an mm struct that is in use by another task.
--- drivers/infiniband/hw/hfi1/mmu_rb.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/infiniband/hw/hfi1/mmu_rb.c +6 -0
@@ -80,6 +80,9 @@ void hfi1_mmu_rb_unregister(struct mmu_runsigned long flags;struct list_head del_list; +/* Prevent freeing of mm until we are completely finished. */ +mmgrab (handler->mn.mm); +/* Unregister first so we don't get any more notifications. */ mmu_notifier_unregister (&handler->mn, handler->mn.mm);
@@ -102,6 +105,9 @@ void hfi1_mmu_rb_unregister(struct mmu_rdo_remove (handler, &del_list); +/* Now the mm may be freed. */ +mmdrop (handler->mn.mm); +kfree (handler); }
Greg Kroah-Hartman
maintainerPATCH 293/343 drbd: fix an invalid memory access caused by incorrect use of list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit ae4d37b5df749926891583d42a6801b5da11e3c1 upstream.
The bug is here:
idr_remove(&connection->peer_devices, vnr);
If the previous for_each_connection() don't exit early (no goto hit inside the loop), the iterator 'connection' after the loop will be a bogus pointer to an invalid structure object containing the HEAD (&resource->connections). As a result, the use of 'connection' above will lead to a invalid memory access (including a possible invalid free as idr_remove could call free_layer).
The original intention should have been to remove all peer_devices, but the following lines have already done the work. So just remove this line and the unneeded label, to fix this bug.
--- drivers/block/drbd/drbd_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/block/drbd/drbd_main.c +2 -4
@@ -2793,12 +2793,12 @@ enum drbd_ret_code drbd_create_device(stif (init_submitter (device)) { err =ERR_NOMEM ; - goto out_idr_remove_vol; + goto out_idr_remove_from_resource; } err =add_disk (disk);if (err) - goto out_idr_remove_vol; + goto out_idr_remove_from_resource;/* inherit the connection state */ device->state.conn =first_connection (resource)->cstate;
@@ -2812,8 +2812,6 @@ enum drbd_ret_code drbd_create_device(stdrbd_debugfs_device_add (device);return NO_ERROR ; -out_idr_remove_vol: -idr_remove (&connection->peer_devices, vnr); out_idr_remove_from_resource:for_each_connection (connection, resource) { peer_device =idr_remove (&connection->peer_devices, vnr);
Greg Kroah-Hartman
maintainerPATCH 294/343 gpio: Restrict usage of GPIO chip irq members before initialization
In reply to Greg Kroah-HartmanFrom: Shreeya Patel <[email protected]>
commit 5467801f1fcbdc46bc7298a84dbf3ca1ff2a7320 upstream.
GPIO chip irq members are exposed before they could be completely initialized and this leads to race conditions.
One such issue was observed for the gc->irq.domain variable which was accessed through the I2C interface in gpiochip_to_irq() before it could be initialized by gpiochip_add_irqchip(). This resulted in Kernel NULL pointer dereference.
Following are the logs for reference :-
kernel: Call Trace: kernel: gpiod_to_irq+0x53/0x70 kernel: acpi_dev_gpio_irq_get_by+0x113/0x1f0 kernel: i2c_acpi_get_irq+0xc0/0xd0 kernel: i2c_device_probe+0x28a/0x2a0 kernel: really_probe+0xf2/0x460 kernel: RIP: 0010:gpiochip_to_irq+0x47/0xc0
To avoid such scenarios, restrict usage of GPIO chip irq members before they are completely initialized.
--- drivers/gpio/gpiolib.c | 19 +++++++++++++++++++ include/linux/gpio/driver.h | 9 +++++++++ 2 files changed, 28 insertions(+)
drivers/gpio/gpiolib.c +19 -0
@@ -1404,6 +1404,16 @@ static int gpiochip_to_irq(struct gpio_c {struct irq_domain *domain = gc->irq.domain; +#ifdef CONFIG_GPIOLIB_IRQCHIP +/* +* Avoid race condition with other code, which tries to lookup +* an IRQ before the irqchip has been properly registered, +* i.e. while gpiochip is still being brought up. +*/ +if (!gc->irq.initialized) +return -EPROBE_DEFER ; +#endif +if (!gpiochip_irqchip_irq_valid (gc, offset))return -ENXIO ;
@@ -1593,6 +1603,15 @@ static int gpiochip_add_irqchip(struct gacpi_gpiochip_request_interrupts (gc); +/* +* Using barrier() here to prevent compiler from reordering +* gc->irq.initialized before initialization of above +* GPIO chip irq members. +*/ +barrier (); + + gc->irq.initialized = true; +return 0 ; }
include/linux/gpio/driver.h +9 -0
@@ -219,6 +219,15 @@ struct gpio_irq_chip {bool per_parent_data;/** +* @initialized: +* +* Flag to track GPIO chip irq member's initialization. +* This flag will make sure GPIO chip irq members are not used +* before they are initialized. +*/ +bool initialized; + +/** * @init_hw: optional routine to initialize hardware before * an IRQ chip will be added. This is quite useful when * a particular driver wants to clear IRQ related registers
Greg Kroah-Hartman
maintainerPATCH 295/343 x86/msi: Fix msi message data shadow struct
In reply to Greg Kroah-HartmanFrom: Reto Buerki <[email protected]>
commit 59b18a1e65b7a2134814106d0860010e10babe18 upstream.
The x86 MSI message data is 32 bits in total and is either in compatibility or remappable format, see Intel Virtualization Technology for Directed I/O, section 5.1.2.
--- arch/x86/include/asm/msi.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/x86/include/asm/msi.h +11 -8
@@ -12,14 +12,17 @@ int pci_msi_prepare(struct irq_domain *d/* Structs and defines for the X86 specific MSI message format */ typedef struct x86_msi_data { -u32 vector :8 , - delivery_mode :3 , - dest_mode_logical :1 , - reserved :2 , - active_low :1 , - is_level :1 ; - -u32 dmar_subhandle; +union { +struct { +u32 vector :8 , + delivery_mode :3 , + dest_mode_logical :1 , + reserved :2 , + active_low :1 , + is_level :1 ; + }; +u32 dmar_subhandle; + }; } __attribute__ ((packed))arch_msi_msg_data_t ;#define arch_msi_msg_data x86_msi_data
Greg Kroah-Hartman
maintainerPATCH 296/343 x86/mm/tlb: Revert retpoline avoidance approach
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
commit d39268ad24c0fd0665d0c5cf55a7c1a0ebf94766 upstream.
0day reported a regression on a microbenchmark which is intended to stress the TLB flushing path:
https://lore.kernel.org/all/20220317090415.GE735@xsang-OptiPlex-9020/
It pointed at a commit from Nadav which intended to remove retpoline overhead in the TLB flushing path by taking the 'cond'-ition in on_each_cpu_cond_mask(), pre-calculating it, and incorporating it into 'cpumask'. That allowed the code to use a bunch of earlier direct calls instead of later indirect calls that need a retpoline.
But, in practice, threads can go idle (and into lazy TLB mode where they don't need to flush their TLB) between the early and late calls. It works in this direction and not in the other because TLB-flushing threads tend to hold mmap_lock for write. Contention on that lock causes threads to _go_ idle right in this early/late window.
There was not any performance data in the original commit specific to the retpoline overhead. I did a few tests on a system with retpolines:
https://lore.kernel.org/all/[email protected]/
which showed a possible small win. But, that small win pales in comparison with the bigger loss induced on non-retpoline systems.
Revert the patch that removed the retpolines. This was not a clean revert, but it was self-contained enough not to be too painful.
--- arch/x86/mm/tlb.c | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-)
arch/x86/mm/tlb.c +5 -32
@@ -854,13 +854,11 @@ done: nr_invalidate); } -static bool tlb_is_not_lazy (int cpu) +static bool tlb_is_not_lazy (int cpu,void *data) {return !per_cpu (cpu_tlbstate_shared.is_lazy, cpu); } -static DEFINE_PER_CPU(cpumask_t, flush_tlb_mask); - DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state_shared, cpu_tlbstate_shared);EXPORT_PER_CPU_SYMBOL (cpu_tlbstate_shared);
@@ -889,36 +887,11 @@ STATIC_NOPV void native_flush_tlb_multi(* up on the new contents of what used to be page tables, while * doing a speculative memory access. */ -if (info->freed_tables) { +if (info->freed_tables)on_each_cpu_mask (cpumask, flush_tlb_func, (void *)info, true); - }else { -/* -* Although we could have used on_each_cpu_cond_mask(), -* open-coding it has performance advantages, as it eliminates -* the need for indirect calls or retpolines. In addition, it -* allows to use a designated cpumask for evaluating the -* condition, instead of allocating one. -* -* This code works under the assumption that there are no nested -* TLB flushes, an assumption that is already made in -* flush_tlb_mm_range(). -* -* cond_cpumask is logically a stack-local variable, but it is -* more efficient to have it off the stack and not to allocate -* it on demand. Preemption is disabled and this code is -* non-reentrant. -*/ -struct cpumask *cond_cpumask =this_cpu_ptr (&flush_tlb_mask); -int cpu; - -cpumask_clear (cond_cpumask); - -for_each_cpu (cpu, cpumask) { -if (tlb_is_not_lazy (cpu)) -__cpumask_set_cpu (cpu, cond_cpumask); - } -on_each_cpu_mask (cond_cpumask, flush_tlb_func, (void *)info, true); - } +else +on_each_cpu_cond_mask (tlb_is_not_lazy, flush_tlb_func, + (void *)info,1 , cpumask); } void flush_tlb_multi(const struct cpumask *cpumask,
Greg Kroah-Hartman
maintainerPATCH 297/343 perf/x86/intel: Dont extend the pseudo-encoding to GP counters
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
commit 4a263bf331c512849062805ef1b4ac40301a9829 upstream.
The INST_RETIRED.PREC_DIST event (0x0100) doesn't count on SPR. perf stat -e cpu/event=0xc0,umask=0x0/,cpu/event=0x0,umask=0x1/ -C0
Performance counter stats for 'CPU(s) 0':
607,246 cpu/event=0xc0,umask=0x0/
0 cpu/event=0x0,umask=0x1/The encoding for INST_RETIRED.PREC_DIST is pseudo-encoding, which doesn't work on the generic counters. However, current perf extends its mask to the generic counters.
The pseudo event-code for a fixed counter must be 0x00. Check and avoid extending the mask for the fixed counter event which using the pseudo-encoding, e.g., ref-cycles and PREC_DIST event.
With the patch,
perf stat -e cpu/event=0xc0,umask=0x0/,cpu/event=0x0,umask=0x1/ -C0
Performance counter stats for 'CPU(s) 0':
583,184 cpu/event=0xc0,umask=0x0/
583,048 cpu/event=0x0,umask=0x1/--- arch/x86/events/intel/core.c | 6 +++++- arch/x86/include/asm/perf_event.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +5 -1
@@ -5515,7 +5515,11 @@ static void intel_pmu_check_event_constr/* Disabled fixed counters which are not in CPUID */ c->idxmsk64 &= intel_ctrl; -if (c->idxmsk64 !=INTEL_PMC_MSK_FIXED_REF_CYCLES ) +/* +* Don't extend the pseudo-encoding to the +* generic counters +*/ +if (!use_fixed_pseudo_encoding (c->code)) c->idxmsk64 |= (1ULL << num_counters) -1 ; } c->idxmsk64 &=
arch/x86/include/asm/perf_event.h +5 -0
@@ -241,6 +241,11 @@ struct x86_pmu_capability {#define INTEL_PMC_IDX_FIXED_SLOTS (INTEL_PMC_IDX_FIXED + 3)#define INTEL_PMC_MSK_FIXED_SLOTS (1ULL << INTEL_PMC_IDX_FIXED_SLOTS) +static inline bool use_fixed_pseudo_encoding (u64 code) +{ +return !(code &0xff ); +} +/* * We model BTS tracing as another fixed-mode PMC. *
Greg Kroah-Hartman
maintainerPATCH 298/343 ata: sata_dwc_460ex: Fix crash due to OOB write
In reply to Greg Kroah-HartmanFrom: Christian Lamparter <[email protected]>
commit 7aa8104a554713b685db729e66511b93d989dd6a upstream.
the driver uses libata's "tag" values from in various arrays. Since the mentioned patch bumped the ATA_TAG_INTERNAL to 32, the value of the SATA_DWC_QCMD_MAX needs to account for that.
Otherwise ATA_TAG_INTERNAL usage cause similar crashes like this as reported by Tice Rex on the OpenWrt Forum and reproduced (with symbols) here:
| BUG: Kernel NULL pointer dereference at 0x00000000 | Faulting instruction address: 0xc03ed4b8 | Oops: Kernel access of bad area, sig: 11 [#1] | BE PAGE_SIZE=4K PowerPC 44x Platform | CPU: 0 PID: 362 Comm: scsi_eh_1 Not tainted 5.4.163 #0 | NIP: c03ed4b8 LR: c03d27e8 CTR: c03ed36c | REGS: cfa59950 TRAP: 0300 Not tainted (5.4.163) | MSR: 00021000 <CE,ME> CR: 42000222 XER: 00000000 | DEAR: 00000000 ESR: 00000000 | GPR00: c03d27e8 cfa59a08 cfa55fe0 00000000 0fa46bc0 [...] | [..] | NIP [c03ed4b8] sata_dwc_qc_issue+0x14c/0x254 | LR [c03d27e8] ata_qc_issue+0x1c8/0x2dc | Call Trace: | [cfa59a08] [c003f4e0] __cancel_work_timer+0x124/0x194 (unreliable) | [cfa59a78] [c03d27e8] ata_qc_issue+0x1c8/0x2dc | [cfa59a98] [c03d2b3c] ata_exec_internal_sg+0x240/0x524 | [cfa59b08] [c03d2e98] ata_exec_internal+0x78/0xe0 | [cfa59b58] [c03d30fc] ata_read_log_page.part.38+0x1dc/0x204 | [cfa59bc8] [c03d324c] ata_identify_page_supported+0x68/0x130 | [...]
This is because sata_dwc_dma_xfer_complete() NULLs the dma_pending's next neighbour "chan" (a *dma_chan struct) in this '32' case right here (line ~735):
Quoted 1 line
hsdevp->dma_pending[tag] =
SATA_DWC_DMA_PENDING_NONE;
Then the next time, a dma gets issued; dma_dwc_xfer_setup() passes the NULL'd hsdevp->chan to the dmaengine_slave_config() which then causes the crash.
With this patch, SATA_DWC_QCMD_MAX is now set to ATA_MAX_QUEUE + 1. This avoids the OOB. But please note, there was a worthwhile discussion on what ATA_TAG_INTERNAL and ATA_MAX_QUEUE is. And why there should not be a "fake" 33 command-long queue size.
Ideally, the dw driver should account for the ATA_TAG_INTERNAL. In Damien Le Moal's words: "... having looked at the driver, it is a bigger change than just faking a 33rd "tag" that is in fact not a command tag at all."
--- drivers/ata/sata_dwc_460ex.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/ata/sata_dwc_460ex.c +5 -1
@@ -137,7 +137,11 @@ struct sata_dwc_device {#endif }; -#define SATA_DWC_QCMD_MAX 32 +/* +* Allow one extra special slot for commands and DMA management +* to account for libata internal commands. +*/ +#define SATA_DWC_QCMD_MAX (ATA_MAX_QUEUE + 1)struct sata_dwc_device_port {struct sata_dwc_device *hsdev;
Greg Kroah-Hartman
maintainerPATCH 299/343 perf: qcom_l2_pmu: fix an incorrect NULL check on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
commit 2012a9e279013933885983cbe0a5fe828052563b upstream.
The bug is here:
return cluster;
The list iterator value 'cluster' will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found.
To fix the bug, return 'cluster' when found, otherwise return NULL.
--- drivers/perf/qcom_l2_pmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/perf/qcom_l2_pmu.c +3 -3
@@ -736,7 +736,7 @@ static struct cluster_pmu *l2_cache_asso {u64 mpidr;int cpu_cluster_id; -struct cluster_pmu *cluster =NULL ; +struct cluster_pmu *cluster;/* * This assumes that the cluster_id is in MPIDR[aff1] for
@@ -758,10 +758,10 @@ static struct cluster_pmu *l2_cache_asso cluster->cluster_id);cpumask_set_cpu (cpu, &cluster->cluster_cpus); *per_cpu_ptr (l2cache_pmu->pmu_cluster, cpu) = cluster; -break ; +return cluster; } -return cluster; +return NULL ; }static int l2cache_pmu_online_cpu (unsigned int cpu,struct hlist_node *node)
Greg Kroah-Hartman
maintainerPATCH 300/343 perf/core: Inherit event_caps
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
commit e3265a4386428d3d157d9565bb520aabff8b4bf0 upstream.
It was reported that some perf event setup can make fork failed on ARM64. It was the case of a group of mixed hw and sw events and it failed in perf_event_init_task() due to armpmu_event_init().
The ARM PMU code checks if all the events in a group belong to the same PMU except for software events. But it didn't set the event_caps of inherited events and no longer identify them as software events. Therefore the test failed in a child process.
A simple reproducer is:
$ perf stat -e '{cycles,cs,instructions}' perf bench sched messaging
# Running 'sched/messaging' benchmark:
perf: fork(): Invalid argumentThe perf stat was fine but the perf bench failed in fork(). Let's inherit the event caps from the parent.
--- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/events/core.c +3 -0
@@ -11640,6 +11640,9 @@ perf_event_alloc(struct perf_event_attr event->state =PERF_EVENT_STATE_INACTIVE ; +if (parent_event) + event->event_caps = parent_event->event_caps; +if (event->attr.sigtrap)atomic_set (&event->event_limit,1 );
Greg Kroah-Hartman
maintainerPATCH 301/343 irqchip/gic-v3: Fix GICR_CTLR.RWP polling
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 0df6664531a12cdd8fc873f0cac0dcb40243d3e9 upstream.
It turns out that our polling of RWP is totally wrong when checking for it in the redistributors, as we test the *distributor* bit index, whereas it is a different bit number in the RDs... Oopsie boo.
This is embarassing. Not only because it is wrong, but also because it took *8 years* to notice the blunder...
Just fix the damn thing.
--- drivers/irqchip/irq-gic-v3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/irqchip/irq-gic-v3.c +4 -4
@@ -206,11 +206,11 @@ static inline void __iomem *gic_dist_bas } } -static void gic_do_wait_for_rwp (void __iomem *base) +static void gic_do_wait_for_rwp (void __iomem *base,u32 bit) {u32 count =1000000 ;/* 1s! */ -while (readl_relaxed (base +GICD_CTLR ) &GICD_CTLR_RWP ) { +while (readl_relaxed (base +GICD_CTLR ) & bit) { count--;if (!count) {pr_err_ratelimited ("RWP timeout, gone fishing\n" );
@@ -224,13 +224,13 @@ static void gic_do_wait_for_rwp(void __i/* Wait for completion of a distributor change */ static void gic_dist_wait_for_rwp (void ) { -gic_do_wait_for_rwp (gic_data.dist_base); +gic_do_wait_for_rwp (gic_data.dist_base,GICD_CTLR_RWP ); }/* Wait for completion of a redistributor change */ static void gic_redist_wait_for_rwp (void ) { -gic_do_wait_for_rwp (gic_data_rdist_rd_base ()); +gic_do_wait_for_rwp (gic_data_rdist_rd_base (),GICR_CTLR_RWP ); }#ifdef CONFIG_ARM64
Greg Kroah-Hartman
maintainerPATCH 302/343 fbdev: Fix unregistering of framebuffers without device
In reply to Greg Kroah-HartmanFrom: Thomas Zimmermann <[email protected]>
commit 0f525289ff0ddeb380813bd81e0f9bdaaa1c9078 upstream.
OF framebuffers do not have an underlying device in the Linux device hierarchy. Do a regular unregister call instead of hot unplugging such a non-existing device. Fixes a NULL dereference. An example error message on ppc64le is shown below.
BUG: Kernel NULL pointer dereference on read at 0x00000060 Faulting instruction address: 0xc00000000080dfa4 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries [...] CPU: 2 PID: 139 Comm: systemd-udevd Not tainted 5.17.0-ae085d7f9365 #1 NIP: c00000000080dfa4 LR: c00000000080df9c CTR: c000000000797430 REGS: c000000004132fe0 TRAP: 0300 Not tainted (5.17.0-ae085d7f9365) MSR: 8000000002009033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 28228282 XER: 20000000 CFAR: c00000000000c80c DAR: 0000000000000060 DSISR: 40000000 IRQMASK: 0 GPR00: c00000000080df9c c000000004133280 c00000000169d200 0000000000000029 GPR04: 00000000ffffefff c000000004132f90 c000000004132f88 0000000000000000 GPR08: c0000000015658f8 c0000000015cd200 c0000000014f57d0 0000000048228283 GPR12: 0000000000000000 c00000003fffe300 0000000020000000 0000000000000000 GPR16: 0000000000000000 0000000113fc4a40 0000000000000005 0000000113fcfb80 GPR20: 000001000f7283b0 0000000000000000 c000000000e4a588 c000000000e4a5b0 GPR24: 0000000000000001 00000000000a0000 c008000000db0168 c0000000021f6ec0 GPR28: c0000000016d65a8 c000000004b36460 0000000000000000 c0000000016d64b0 NIP [c00000000080dfa4] do_remove_conflicting_framebuffers+0x184/0x1d0 [c000000004133280] [c00000000080df9c] do_remove_conflicting_framebuffers+0x17c/0x1d0 (unreliable) [c000000004133350] [c00000000080e4d0] remove_conflicting_framebuffers+0x60/0x150 [c0000000041333a0] [c00000000080e6f4] remove_conflicting_pci_framebuffers+0x134/0x1b0 [c000000004133450] [c008000000e70438] drm_aperture_remove_conflicting_pci_framebuffers+0x90/0x100 [drm] [c000000004133490] [c008000000da0ce4] bochs_pci_probe+0x6c/0xa64 [bochs] [...] [c000000004133db0] [c00000000002aaa0] system_call_exception+0x170/0x2d0 [c000000004133e10] [c00000000000c3cc] system_call_common+0xec/0x250
The bug [1] was introduced by commit 27599aacbaef ("fbdev: Hot-unplug firmware fb devices on forced removal"). Most firmware framebuffers have an underlying platform device, which can be hot-unplugged before loading the native graphics driver. OF framebuffers do not (yet) have that device. Fix the code by unregistering the framebuffer as before without a hot unplug.
Tested with 5.17 on qemu ppc64le emulation.
--- drivers/video/fbdev/core/fbmem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/fbmem.c +8 -1
@@ -1583,7 +1583,14 @@ static void do_remove_conflicting_frameb* If it's not a platform device, at least print a warning. A * fix would add code to remove the device from the system. */ -if (dev_is_platform (device)) { +if (!device) { +/* TODO: Represent each OF framebuffer as its own +* device in the device hierarchy. For now, offb +* doesn't have such a device, so unregister the +* framebuffer as before without warning. +*/ +do_unregister_framebuffer (registered_fb[i]); + }else if (dev_is_platform (device)) { registered_fb[i]->forced_out = true;platform_device_unregister (to_platform_device (device)); }else {
Greg Kroah-Hartman
maintainerPATCH 303/343 amd/display: set backlight only if required
In reply to Greg Kroah-HartmanFrom: Shirish S <[email protected]>
commit 4052287a75eb3fc0f487fcc5f768a38bede455c8 upstream.
[Why]
comparing pwm bl values (coverted) with user brightness(converted) levels in commit_tail leads to continuous setting of backlight via dmub as they don't to match.
This leads overdrive in queuing of commands to DMCU that sometimes lead to depending on load on DMCU fw:
"[drm:dc_dmub_srv_wait_idle] *ERROR* Error waiting for DMUB idle: status=3"
[How]
Store last successfully set backlight value and compare with it instead of pwm reads which is not what we should compare with.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++++--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
@@ -3951,7 +3951,7 @@ static u32 convert_brightness_to_user(co max - min); } -static int amdgpu_dm_backlight_set_level (struct amdgpu_display_manager *dm, +static void amdgpu_dm_backlight_set_level (struct amdgpu_display_manager *dm,int bl_idx,u32 user_brightness) {
@@ -3982,7 +3982,8 @@ static int amdgpu_dm_backlight_set_levelDRM_DEBUG ("DM: Failed to update backlight on eDP[%d]\n" , bl_idx); } -return rc ?0 :1 ; +if (rc) + dm->actual_brightness[bl_idx] = user_brightness; }static int amdgpu_dm_backlight_update_status (struct backlight_device *bd)
@@ -9914,7 +9915,7 @@ static void amdgpu_dm_atomic_commit_tail/* restore the backlight level */ for (i =0 ; i < dm->num_of_edps; i++) {if (dm->backlight_dev[i] && - (amdgpu_dm_backlight_get_level (dm, i) != dm->brightness[i])) + (dm->actual_brightness[i] != dm->brightness[i]))amdgpu_dm_backlight_set_level (dm, i, dm->brightness[i]); }#endif
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +6 -0
@@ -540,6 +540,12 @@ struct amdgpu_display_manager {* cached backlight values. */ u32 brightness[AMDGPU_DM_MAX_NUM_EDP ]; +/** +* @actual_brightness: +* +* last successfully applied backlight values. +*/ +u32 actual_brightness[AMDGPU_DM_MAX_NUM_EDP ]; };enum dsc_clock_force_state {
Greg Kroah-Hartman
maintainerPATCH 304/343 drm/panel: ili9341: fix optional regulator handling
In reply to Greg Kroah-HartmanFrom: Daniel Mack <[email protected]>
commit d14eb80e27795b7b20060f7b151cdfe39722a813 upstream.
If the optional regulator lookup fails, reset the pointer to NULL. Other functions such as mipi_dbi_poweron_reset_conditional() only do a NULL pointer check and will otherwise dereference the error pointer.
--- drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-ilitek-ili9341.c +3 -1
@@ -612,8 +612,10 @@ static int ili9341_dbi_probe(struct spi_int ret; vcc =devm_regulator_get_optional (dev,"vcc" ); -if (IS_ERR (vcc)) +if (IS_ERR (vcc)) {dev_err (dev,"get optional vcc failed\n" ); + vcc =NULL ; + } dbidev =devm_drm_dev_alloc (dev, &ili9341_dbi_driver, struct mipi_dbi_dev, drm);
Greg Kroah-Hartman
maintainerPATCH 305/343 drm/amd/display: Fix by adding FPU protection for dcn30_internal_validate_bw
In reply to Greg Kroah-HartmanFrom: CHANDAN VURDIGERE NATARAJ <[email protected]>
commit ca1198849ab0e7af5efb392ef6baf1138f6fc086 upstream.
[Why]
Below general protection fault observed when WebGL Aquarium is run for longer duration. If drm debug logs are enabled and set to 0x1f then the issue is observed within 10 minutes of run.
[ 100.717056] general protection fault, probably for non-canonical address 0x2d33302d32323032: 0000 [#1] PREEMPT SMP NOPTI [ 100.727921] CPU: 3 PID: 1906 Comm: DrmThread Tainted: G W 5.15.30 #12 d726c6a2d6ebe5cf9223931cbca6892f916fe18b [ 100.754419] RIP: 0010:CalculateSwathWidth+0x1f7/0x44f [ 100.767109] Code: 00 00 00 f2 42 0f 11 04 f0 48 8b 85 88 00 00 00 f2 42 0f 10 04 f0 48 8b 85 98 00 00 00 f2 42 0f 11 04 f0 48 8b 45 10 0f 57 c0 <f3> 42 0f 2a 04 b0 0f 57 c9 f3 43 0f 2a 0c b4 e8 8c e2 f3 ff 48 8b [ 100.781269] RSP: 0018:ffffa9230079eeb0 EFLAGS: 00010246 [ 100.812528] RAX: 2d33302d32323032 RBX: 0000000000000500 RCX: 0000000000000000 [ 100.819656] RDX: 0000000000000001 RSI: ffff99deb712c49c RDI: 0000000000000000 [ 100.826781] RBP: ffffa9230079ef50 R08: ffff99deb712460c R09: ffff99deb712462c [ 100.833907] R10: ffff99deb7124940 R11: ffff99deb7124d70 R12: ffff99deb712ae44 [ 100.841033] R13: 0000000000000001 R14: 0000000000000000 R15: ffffa9230079f0a0 [ 100.848159] FS: 00007af121212640(0000) GS:ffff99deba780000(0000) knlGS:0000000000000000 [ 100.856240] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 100.861980] CR2: 0000209000fe1000 CR3: 000000011b18c000 CR4: 0000000000350ee0 [ 100.869106] Call Trace: [ 100.871555] <TASK> [ 100.873655] ? asm_sysvec_reschedule_ipi+0x12/0x20 [ 100.878449] CalculateSwathAndDETConfiguration+0x1a3/0x6dd [ 100.883937] dml31_ModeSupportAndSystemConfigurationFull+0x2ce4/0x76da [ 100.890467] ? kallsyms_lookup_buildid+0xc8/0x163 [ 100.895173] ? kallsyms_lookup_buildid+0xc8/0x163 [ 100.899874] ? __sprint_symbol+0x80/0x135 [ 100.903883] ? dm_update_plane_state+0x3f9/0x4d2 [ 100.908500] ? symbol_string+0xb7/0xde [ 100.912250] ? number+0x145/0x29b [ 100.915566] ? vsnprintf+0x341/0x5ff [ 100.919141] ? desc_read_finalized_seq+0x39/0x87 [ 100.923755] ? update_load_avg+0x1b9/0x607 [ 100.927849] ? compute_mst_dsc_configs_for_state+0x7d/0xd5b [ 100.933416] ? fetch_pipe_params+0xa4d/0xd0c [ 100.937686] ? dc_fpu_end+0x3d/0xa8 [ 100.941175] dml_get_voltage_level+0x16b/0x180 [ 100.945619] dcn30_internal_validate_bw+0x10e/0x89b [ 100.950495] ? dcn31_validate_bandwidth+0x68/0x1fc [ 100.955285] ? resource_build_scaling_params+0x98b/0xb8c [ 100.960595] ? dcn31_validate_bandwidth+0x68/0x1fc [ 100.965384] dcn31_validate_bandwidth+0x9a/0x1fc [ 100.970001] dc_validate_global_state+0x238/0x295 [ 100.974703] amdgpu_dm_atomic_check+0x9c1/0xbce [ 100.979235] ? _printk+0x59/0x73 [ 100.982467] drm_atomic_check_only+0x403/0x78b [ 100.986912] drm_mode_atomic_ioctl+0x49b/0x546 [ 100.991358] ? drm_ioctl+0x1c1/0x3b3 [ 100.994936] ? drm_atomic_set_property+0x92a/0x92a [ 100.999725] drm_ioctl_kernel+0xdc/0x149 [ 101.003648] drm_ioctl+0x27f/0x3b3 [ 101.007051] ? drm_atomic_set_property+0x92a/0x92a [ 101.011842] amdgpu_drm_ioctl+0x49/0x7d [ 101.015679] __se_sys_ioctl+0x7c/0xb8 [ 101.015685] do_syscall_64+0x5f/0xb8 [ 101.015690] ? __irq_exit_rcu+0x34/0x96
[How]
It calles populate_dml_pipes which uses doubles to initialize. Adding FPU protection avoids context switch and probable loss of vba context as there is potential contention while drm debug logs are enabled.
--- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +2 -0
@@ -2025,7 +2025,9 @@ bool dcn31_validate_bandwidth(struct dcBW_VAL_TRACE_COUNT (); +DC_FP_START (); out =dcn30_internal_validate_bw (dc, context, pipes, &pipe_cnt, &vlevel, fast_validate); +DC_FP_END ();// Disable fast_validate to set min dcfclk in alculate_wm_and_dlg if (pipe_cnt ==0 )
Greg Kroah-Hartman
maintainerPATCH 306/343 drm/amdgpu/display: change pipe policy for DCN 2.1
In reply to Greg Kroah-HartmanFrom: Benjamin Marty <[email protected]>
commit 879791ad8bf3dc5453061cad74776a617b6e3319 upstream.
Fixes crash on MST Hub disconnect.
--- drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +1 -1
@@ -873,7 +873,7 @@ static const struct dc_debug_options deb .clock_trace = true, .disable_pplib_clock_request = true, .min_disp_clk_khz = 100000, - .pipe_split_policy = MPC_SPLIT_DYNAMIC, + .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, .force_single_disp_pipe_split = false, .disable_dcc = DCC_ENABLE, .vsr_support = true,
Greg Kroah-Hartman
maintainerPATCH 307/343 drm/amdgpu/smu10: fix SoC/fclk units in auto mode
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit 2f25d8ce09b7ba5d769c132ba3d4eb84a941d2cb upstream.
SMU takes clock limits in Mhz units. socclk and fclk were using 10 khz units in some cases. Switch to Mhz units. Fixes higher than required SoC clocks.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +4 -4
@@ -773,13 +773,13 @@ static int smu10_dpm_force_dpm_level(strsmum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetHardMinFclkByFreq, hwmgr->display_config->num_display >3 ? - data->clock_vol_info.vdd_dep_on_fclk->entries[0 ].clk : + (data->clock_vol_info.vdd_dep_on_fclk->entries[0 ].clk /100 ) : min_mclk,NULL );smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetHardMinSocclkByFreq, - data->clock_vol_info.vdd_dep_on_socclk->entries[0 ].clk, + data->clock_vol_info.vdd_dep_on_socclk->entries[0 ].clk /100 ,NULL ); smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetHardMinVcn,
@@ -792,11 +792,11 @@ static int smu10_dpm_force_dpm_level(str NULL);smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetSoftMaxFclkByFreq, - data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk, + data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk /100 ,NULL );smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetSoftMaxSocclkByFreq, - data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk, + data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk /100 ,NULL ); smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetSoftMaxVcn,
Greg Kroah-Hartman
maintainerPATCH 308/343 drm/amdgpu/vcn: Fix the register setting for vcn1
In reply to Greg Kroah-HartmanFrom: Emily Deng <[email protected]>
commit 02fc996d5098f4c3f65bdf6cdb6b28e3f29ba789 upstream.
Correct the code error for setting register UVD_GFX10_ADDR_CONFIG. Need to use inst_idx, or it only will set VCN0.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +2 -2
@@ -569,8 +569,8 @@ static void vcn_v3_0_mc_resume_dpg_mode( AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)), 0, indirect);/* VCN global tiling registers */ -WREG32_SOC15_DPG_MODE (0 ,SOC15_DPG_MODE_OFFSET ( -UVD ,0 , mmUVD_GFX10_ADDR_CONFIG), adev->gfx.config.gb_addr_config,0 , indirect); +WREG32_SOC15_DPG_MODE (inst_idx,SOC15_DPG_MODE_OFFSET ( +UVD , inst_idx, mmUVD_GFX10_ADDR_CONFIG), adev->gfx.config.gb_addr_config,0 , indirect); }static void vcn_v3_0_disable_static_power_gating (struct amdgpu_device *adev,int inst)
Greg Kroah-Hartman
maintainerPATCH 309/343 drm/nouveau/pmu: Add missing callbacks for Tegra devices
In reply to Greg Kroah-HartmanFrom: Karol Herbst <[email protected]>
commit 38d4e5cf5b08798f093374e53c2f4609d5382dd5 upstream.
Fixes a crash booting on those platforms with nouveau.
--- drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm20b.c | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp10b.c | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h | 1 + 4 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm20b.c +1 -0
@@ -216,6 +216,7 @@ gm20b_pmu = { .intr = gt215_pmu_intr, .recv = gm20b_pmu_recv, .initmsg = gm20b_pmu_initmsg, + .reset = gf100_pmu_reset, };#if IS_ENABLED (CONFIG_ARCH_TEGRA_210_SOC )
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c +1 -1
@@ -23,7 +23,7 @@*/ #include "priv.h" -static void +void gp102_pmu_reset (struct nvkm_pmu *pmu) {struct nvkm_device *device = pmu->subdev.device;
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp10b.c +1 -0
@@ -83,6 +83,7 @@ gp10b_pmu = { .intr = gt215_pmu_intr, .recv = gm20b_pmu_recv, .initmsg = gm20b_pmu_initmsg, + .reset = gp102_pmu_reset, };#if IS_ENABLED (CONFIG_ARCH_TEGRA_210_SOC )
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h +1 -0
@@ -41,6 +41,7 @@ int gt215_pmu_send(struct nvkm_pmu *, u3bool gf100_pmu_enabled (struct nvkm_pmu *);void gf100_pmu_reset (struct nvkm_pmu *); +void gp102_pmu_reset (struct nvkm_pmu *pmu);void gk110_pmu_pgob (struct nvkm_pmu *,bool );
Greg Kroah-Hartman
maintainerPATCH 310/343 drm/amdkfd: Create file descriptor after client is added to smi_clients list
In reply to Greg Kroah-HartmanFrom: Lee Jones <[email protected]>
commit e79a2398e1b2d47060474dca291542368183bc0f upstream.
This ensures userspace cannot prematurely clean-up the client before it is fully initialised which has been proven to cause issues in the past.
--- drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c +15 -9
@@ -268,15 +268,6 @@ int kfd_smi_event_open(struct kfd_dev *dreturn ret; } - ret =anon_inode_getfd (kfd_smi_name, &kfd_smi_ev_fops, (void *)client, -O_RDWR ); -if (ret <0 ) { -kfifo_free (&client->fifo); -kfree (client); -return ret; - } - *fd = ret; -init_waitqueue_head (&client->wait_queue);spin_lock_init (&client->lock); client->events =0 ;
@@ -286,5 +277,20 @@ int kfd_smi_event_open(struct kfd_dev *dlist_add_rcu (&client->list, &dev->smi_clients);spin_unlock (&dev->smi_lock); + ret =anon_inode_getfd (kfd_smi_name, &kfd_smi_ev_fops, (void *)client, +O_RDWR ); +if (ret <0 ) { +spin_lock (&dev->smi_lock); +list_del_rcu (&client->list); +spin_unlock (&dev->smi_lock); + +synchronize_rcu (); + +kfifo_free (&client->fifo); +kfree (client); +return ret; + } + *fd = ret; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 311/343 drm/amdgpu: dont use BACO for reset in S3
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit ebc002e3ee78409c42156e62e4e27ad1d09c5a75 upstream.
Seems to cause a reboots or hangs on some systems.
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +11 -0
@@ -1045,6 +1045,17 @@ bool amdgpu_dpm_is_baco_supported(structif (!pp_funcs || !pp_funcs->get_asic_baco_capability)return false; +/* Don't use baco for reset in S3. +* This is a workaround for some platforms +* where entering BACO during suspend +* seems to cause reboots or hangs. +* This might be related to the fact that BACO controls +* power to the whole GPU including devices like audio and USB. +* Powering down/up everything may adversely affect these other +* devices. Needs more investigation. +*/ +if (adev->in_s3) +return false;if (pp_funcs->get_asic_baco_capability (pp_handle, &baco_cap))return false;
Greg Kroah-Hartman
maintainerPATCH 312/343 SUNRPC: Ensure we flush any closed sockets before xs_xprt_free()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit f00432063db1a0db484e85193eccc6845435b80e upstream.
We must ensure that all sockets are closed before we call xprt_free() and release the reference to the net namespace. The problem is that calling fput() will defer closing the socket until delayed_fput() gets called.
Let's fix the situation by allowing rpciod and the transport teardown code (which runs on the system wq) to call __fput_sync(), and directly close the socket.
--- fs/file_table.c | 1 + include/trace/events/sunrpc.h | 1 - net/sunrpc/xprt.c | 7 +------ net/sunrpc/xprtsock.c | 16 +++++++++++++--- 4 files changed, 15 insertions(+), 10 deletions(-)
fs/file_table.c +1 -0
@@ -412,6 +412,7 @@ void __fput_sync(struct file *file) }EXPORT_SYMBOL (fput); +EXPORT_SYMBOL (__fput_sync);void __init files_init (void ) {
include/trace/events/sunrpc.h +0 -1
@@ -1005,7 +1005,6 @@ DEFINE_RPC_XPRT_LIFETIME_EVENT(connect);DEFINE_RPC_XPRT_LIFETIME_EVENT (disconnect_auto);DEFINE_RPC_XPRT_LIFETIME_EVENT (disconnect_done);DEFINE_RPC_XPRT_LIFETIME_EVENT (disconnect_force); -DEFINE_RPC_XPRT_LIFETIME_EVENT (disconnect_cleanup);DEFINE_RPC_XPRT_LIFETIME_EVENT (destroy); DECLARE_EVENT_CLASS(rpc_xprt_event,
net/sunrpc/xprt.c +1 -6
@@ -929,12 +929,7 @@ void xprt_connect(struct rpc_task *task)if (!xprt_lock_write (xprt, task))return ; -if (test_and_clear_bit (XPRT_CLOSE_WAIT , &xprt->state)) { -trace_xprt_disconnect_cleanup (xprt); - xprt->ops->close (xprt); - } - -if (!xprt_connected (xprt)) { +if (!xprt_connected (xprt) && !test_bit (XPRT_CLOSE_WAIT , &xprt->state)) { task->tk_rqstp->rq_connect_cookie = xprt->connect_cookie;rpc_sleep_on_timeout (&xprt->pending, task,NULL ,xprt_request_timeout (task->tk_rqstp));
net/sunrpc/xprtsock.c +13 -3
@@ -880,7 +880,7 @@ static int xs_local_send_request(struct/* Close the stream if the previous transmission was incomplete */ if (xs_send_request_was_aborted (transport, req)) { -xs_close (xprt); +xprt_force_disconnect (xprt);return -ENOTCONN ; }
@@ -918,7 +918,7 @@ static int xs_local_send_request(struct -status); fallthrough;case -EPIPE : -xs_close (xprt); +xprt_force_disconnect (xprt); status = -ENOTCONN ; }
@@ -1203,6 +1203,16 @@ static void xs_reset_transport(struct soif (sk ==NULL )return ; +/* +* Make sure we're calling this in a context from which it is safe +* to call __fput_sync(). In practice that means rpciod and the +* system workqueue. +*/ +if (!(current->flags &PF_WQ_WORKER )) { +WARN_ON_ONCE (1 ); +set_bit (XPRT_CLOSE_WAIT , &xprt->state); +return ; + }if (atomic_read (&transport->xprt.swapper))sk_clear_memalloc (sk);
@@ -1226,7 +1236,7 @@ static void xs_reset_transport(struct somutex_unlock (&transport->recv_mutex);trace_rpc_socket_close (xprt, sock); -fput (filp); +__fput_sync (filp);xprt_disconnect_done (xprt); }
Greg Kroah-Hartman
maintainerPATCH 313/343 Revert "ACPI: processor: idle: Only flush cache on entering C3"
In reply to Greg Kroah-HartmanFrom: Akihiko Odaki <[email protected]>
commit dfbba2518aac4204203b0697a894d3b2f80134d3 upstream.
Revert commit 87ebbb8c612b ("ACPI: processor: idle: Only flush cache on entering C3") that broke the assumptions of the acpi_idle_play_dead() callers.
Namely, the CPU cache must always be flushed in acpi_idle_play_dead(), regardless of the target C-state that is going to be requested, because this is likely to be part of a CPU offline procedure or preparation for entering a system-wide sleep state and the lack of synchronization between the CPU cache and RAM may lead to problems going forward, for example when the CPU is brought back online.
In particular, it breaks resume from suspend-to-RAM on Lenovo ThinkPad C13 which fails occasionally until the problematic commit is reverted.
--- drivers/acpi/processor_idle.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/processor_idle.c +1 -2
@@ -570,8 +570,7 @@ static int acpi_idle_play_dead(struct cp {struct acpi_processor_cx *cx =per_cpu (acpi_cstate[index], dev->cpu); -if (cx->type ==ACPI_STATE_C3 ) -ACPI_FLUSH_CPU_CACHE (); +ACPI_FLUSH_CPU_CACHE ();while (1 ) {
Greg Kroah-Hartman
maintainerPATCH 314/343 drm/amdkfd: Fix variable set but not used warning
In reply to Greg Kroah-HartmanFrom: Philip Yang <[email protected]>
commit 90c44207cdd18091ac9aa7cab8a3e7b0ef00e847 upstream.
All warnings (new ones prefixed by >>):
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c: In function
'svm_range_deferred_list_work':
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:2067:22: warning:
variable 'p' set but not used [-Wunused-but-set-variable]
2067 | struct kfd_process *p;
|--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +0 -3
@@ -2066,13 +2066,10 @@ static void svm_range_deferred_list_workstruct svm_range_list *svms;struct svm_range *prange;struct mm_struct *mm; -struct kfd_process *p; svms = container_of(work, struct svm_range_list, deferred_list_work);pr_debug ("enter svms 0x%p\n" , svms); - p = container_of(svms, struct kfd_process, svms); -spin_lock (&svms->deferred_list_lock);while (!list_empty (&svms->deferred_range_list)) { prange = list_first_entry(&svms->deferred_range_list,
Greg Kroah-Hartman
maintainerPATCH 315/343 net/smc: send directly on setting TCP_NODELAY
In reply to Greg Kroah-HartmanFrom: Dust Li <[email protected]>
commit b70a5cc045197aad9c159042621baf3c015f6cc7 upstream.
In commit ea785a1a573b("net/smc: Send directly when TCP_CORK is cleared"), we don't use delayed work to implement cork.
This patch use the same algorithm, removes the delayed work when setting TCP_NODELAY and send directly in setsockopt(). This also makes the TCP_NODELAY the same as TCP.
--- net/smc/af_smc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/smc/af_smc.c +2 -2
@@ -2625,8 +2625,8 @@ static int smc_setsockopt(struct socket sk->sk_state != SMC_CLOSED) {if (val) {SMC_STAT_INC (smc, ndly_cnt); -mod_delayed_work (smc->conn.lgr->tx_wq, - &smc->conn.tx_work,0 ); +smc_tx_pending (&smc->conn); +cancel_delayed_work (&smc->conn.tx_work); } }break ;
Greg Kroah-Hartman
maintainerPATCH 316/343 Revert "selftests: net: Add tls config dependency for tls selftests"
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
commit 20695e9a9fd39103d1b0669470ae74030b7aa196 upstream.
This reverts commit d9142e1cf3bbdaf21337767114ecab26fe702d47.
The test is supposed to run cleanly with TLS is disabled, to test compatibility with TCP behavior. I can't repro the failure [1], the problem should be debugged rather than papered over.
--- tools/testing/selftests/net/config | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/net/config +0 -1
@@ -43,6 +43,5 @@ CONFIG_NET_ACT_TUNNEL_KEY=m CONFIG_NET_ACT_MIRRED=m CONFIG_BAREUDP=m CONFIG_IPV6_IOAM6_LWTUNNEL=y -CONFIG_TLS=m CONFIG_CRYPTO_SM4=y CONFIG_AMT=m
Greg Kroah-Hartman
maintainerPATCH 317/343 bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
commit 9a69e2b385f443f244a7e8b8bcafe5ccfb0866b4 upstream.
remote_port is another case of a BPF context field documented as a 32-bit value in network byte order for which the BPF context access converter generates a load of a zero-padded 16-bit integer in network byte order.
First such case was dst_port in bpf_sock which got addressed in commit 4421a582718a ("bpf: Make dst_port field in struct bpf_sock 16-bit wide").
Loading 4-bytes from the remote_port offset and converting the value with bpf_ntohl() leads to surprising results, as the expected value is shifted by 16 bits.
Reduce the confusion by splitting the field in two - a 16-bit field holding a big-endian integer, and a 16-bit zero-padding anonymous field that follows it.
--- include/uapi/linux/bpf.h | 3 ++- net/bpf/test_run.c | 4 ++-- net/core/filter.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-)
include/uapi/linux/bpf.h +2 -1
@@ -6379,7 +6379,8 @@ struct bpf_sk_lookup {__u32 protocol;/* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */ __u32 remote_ip4;/* Network byte order */ __u32 remote_ip6[4 ];/* Network byte order */ -__u32 remote_port;/* Network byte order */ +__be16 remote_port;/* Network byte order */ + __u16 :16 ;/* Zero padding */ __u32 local_ip4;/* Network byte order */ __u32 local_ip6[4 ];/* Network byte order */ __u32 local_port;/* Host byte order */
net/bpf/test_run.c +2 -2
@@ -960,7 +960,7 @@ int bpf_prog_test_run_sk_lookup(struct bif (!range_is_zero (user_ctx,offsetofend (typeof (*user_ctx), local_port),sizeof (*user_ctx))) goto out; -if (user_ctx->local_port >U16_MAX || user_ctx->remote_port >U16_MAX ) { +if (user_ctx->local_port >U16_MAX ) { ret = -ERANGE ; goto out; }
@@ -968,7 +968,7 @@ int bpf_prog_test_run_sk_lookup(struct b ctx.family = (u16 )user_ctx->family; ctx.protocol = (u16 )user_ctx->protocol; ctx.dport = (u16 )user_ctx->local_port; - ctx.sport = (__force __be16 )user_ctx->remote_port; + ctx.sport = user_ctx->remote_port;switch (ctx.family) {case AF_INET :
net/core/filter.c +2 -1
@@ -10621,7 +10621,8 @@ static bool sk_lookup_is_valid_access(in case bpf_ctx_range(struct bpf_sk_lookup, local_ip4): case bpf_ctx_range_till(struct bpf_sk_lookup, remote_ip6[0], remote_ip6[3]): case bpf_ctx_range_till(struct bpf_sk_lookup, local_ip6[0], local_ip6[3]): - case bpf_ctx_range(struct bpf_sk_lookup, remote_port): + case offsetof(struct bpf_sk_lookup, remote_port) ... + offsetof(struct bpf_sk_lookup , local_ip4) -1 : case bpf_ctx_range(struct bpf_sk_lookup, local_port): case bpf_ctx_range(struct bpf_sk_lookup, ingress_ifindex):bpf_ctx_record_field_size (info,sizeof (__u32));
Greg Kroah-Hartman
maintainerPATCH 318/343 selftests/bpf: Fix u8 narrow load checks for bpf_sk_lookup remote_port
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
commit 3c69611b8926f8e74fcf76bd97ae0e5dafbeb26a upstream.
In commit 9a69e2b385f4 ("bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide") ->remote_port field changed from __u32 to __be16.
However, narrow load tests which exercise 1-byte sized loads from offsetof(struct bpf_sk_lookup, remote_port) were not adopted to reflect the change.
As a result, on little-endian we continue testing loads from addresses:
- (__u8 *)&ctx->remote_port + 3
- (__u8 *)&ctx->remote_port + 4
which map to the zero padding following the remote_port field, and don't break the tests because there is no observable change.
While on big-endian, we observe breakage because tests expect to see zeros for values loaded from:
- (__u8 *)&ctx->remote_port - 1
- (__u8 *)&ctx->remote_port - 2
Above addresses map to ->remote_ip6 field, which precedes ->remote_port, and are populated during the bpf_sk_lookup IPv6 tests.
Unsurprisingly, on s390x we observe:
#136/38 sk_lookup/narrow access to ctx v4:OK
#136/39 sk_lookup/narrow access to ctx v6:FAIL
Fix it by removing the checks for 1-byte loads from offsets outside of the ->remote_port field.
--- tools/testing/selftests/bpf/progs/test_sk_lookup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/test_sk_lookup.c +1 -2
@@ -412,8 +412,7 @@ int ctx_narrow_access(struct bpf_sk_look/* Narrow loads from remote_port field. Expect SRC_PORT. */ if (LSB (ctx->remote_port,0 ) != ((SRC_PORT >>0 ) &0xff ) || -LSB (ctx->remote_port,1 ) != ((SRC_PORT >>8 ) &0xff ) || -LSB (ctx->remote_port,2 ) !=0 ||LSB (ctx->remote_port,3 ) !=0 ) +LSB (ctx->remote_port,1 ) != ((SRC_PORT >>8 ) &0xff ))return SK_DROP ;if (LSW (ctx->remote_port,0 ) !=SRC_PORT )return SK_DROP ;
Greg Kroah-Hartman
maintainerPATCH 319/343 bpf: Treat bpf_sk_lookup remote_port as a 2-byte field
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
commit 058ec4a7d9cf77238c73ad9f1e1a3ed9a29afcab upstream.
In commit 9a69e2b385f4 ("bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide") the remote_port field has been split up and re-declared from u32 to be16.
However, the accompanying changes to the context access converter have not been well thought through when it comes big-endian platforms.
Today 2-byte wide loads from offsetof(struct bpf_sk_lookup, remote_port) are handled as narrow loads from a 4-byte wide field.
This by itself is not enough to create a problem, but when we combine
1. 32-bit wide access to ->remote_port backed by a 16-wide wide load, with
2. inherent difference between litte- and big-endian in how narrow loads need have to be handled (see bpf_ctx_narrow_access_offset),
we get inconsistent results for a 2-byte loads from &ctx->remote_port on LE and BE architectures. This in turn makes BPF C code for the common case of 2-byte load from ctx->remote_port not portable.
To rectify it, inform the context access converter that remote_port is 2-byte wide field, and only 1-byte loads need to be treated as narrow loads.
At the same time, we special-case the 4-byte load from &ctx->remote_port to continue handling it the same way as do today, in order to keep the existing BPF programs working.
--- net/core/filter.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
net/core/filter.c +18 -2
@@ -10621,13 +10621,24 @@ static bool sk_lookup_is_valid_access(in case bpf_ctx_range(struct bpf_sk_lookup, local_ip4): case bpf_ctx_range_till(struct bpf_sk_lookup, remote_ip6[0], remote_ip6[3]): case bpf_ctx_range_till(struct bpf_sk_lookup, local_ip6[0], local_ip6[3]): - case offsetof(struct bpf_sk_lookup, remote_port) ... - offsetof(struct bpf_sk_lookup , local_ip4) -1 : case bpf_ctx_range(struct bpf_sk_lookup, local_port): case bpf_ctx_range(struct bpf_sk_lookup, ingress_ifindex):bpf_ctx_record_field_size (info,sizeof (__u32));return bpf_ctx_narrow_access_ok (off, size,sizeof (__u32)); + case bpf_ctx_range(struct bpf_sk_lookup, remote_port): +/* Allow 4-byte access to 2-byte field for backward compatibility */ +if (size ==sizeof (__u32)) +return true; +bpf_ctx_record_field_size (info,sizeof (__be16)); +return bpf_ctx_narrow_access_ok (off, size,sizeof (__be16)); + + case offsetofend(struct bpf_sk_lookup, remote_port) ... + offsetof(struct bpf_sk_lookup, local_ip4) - 1: +/* Allow access to zero padding for backward compatibility */ +bpf_ctx_record_field_size (info,sizeof (__u16)); +return bpf_ctx_narrow_access_ok (off, size,sizeof (__u16)); +default :return false; }
@@ -10709,6 +10720,11 @@ static u32 sk_lookup_convert_ctx_access( sport, 2, target_size));break ; + case offsetofend(struct bpf_sk_lookup, remote_port): + *target_size =2 ; + *insn++ =BPF_MOV32_IMM (si->dst_reg,0 ); +break ; +case offsetof(struct bpf_sk_lookup , local_port): *insn++ = BPF_LDX_MEM(BPF_H, si->dst_reg, si->src_reg, bpf_target_off(struct bpf_sk_lookup_kern,
Greg Kroah-Hartman
maintainerPATCH 320/343 perf build: Dont use -ffat-lto-objects in the python feature test when building with clang-13
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit 3a8a0475861a443f02e3a9b57d044fe2a0a99291 upstream.
Using -ffat-lto-objects in the python feature test when building with clang-13 results in:
clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
error: command '/usr/sbin/clang' failed with exit code 1
cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1
Noticed when building on a docker.io/library/archlinux:base container.
--- tools/perf/Makefile.config | 3 +++ tools/perf/util/setup.py | 2 ++ 2 files changed, 5 insertions(+)
tools/perf/Makefile.config +3 -0
@@ -272,6 +272,9 @@ ifdef PYTHON_CONFIG PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) + ifeq ($(CC_NO_CLANG), 0) + PYTHON_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PYTHON_EMBED_CCOPTS)) + endif endif FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
tools/perf/util/setup.py +2 -0
@@ -23,6 +23,8 @@ if cc_is_clang: vars[var] = sub("-fstack-protector-strong", "", vars[var]) if not clang_has_option("-fno-semantic-interposition"): vars[var] = sub("-fno-semantic-interposition", "", vars[var]) + if not clang_has_option("-ffat-lto-objects"): + vars[var] = sub("-ffat-lto-objects", "", vars[var]) from distutils.core import setup, Extension
Greg Kroah-Hartman
maintainerPATCH 321/343 perf python: Fix probing for some clang command line options
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit dd6e1fe91cdd52774ca642d1da75b58a86356b56 upstream.
The clang compiler complains about some options even without a source file being available, while others require one, so use the simple tools/build/feature/test-hello.c file.
Then check for the "is not supported" string in its output, in addition to the "unknown argument" already being looked for.
This was noticed when building with clang-13 where -ffat-lto-objects isn't supported and since we were looking just for "unknown argument" and not providing a source code to clang, was mistakenly assumed as being available and not being filtered to set of command line options provided to clang, leading to a build failure.
--- tools/perf/util/setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/setup.py +4 -2
@@ -1,12 +1,14 @@ -from os import getenv +from os import getenv, path from subprocess import Popen, PIPE from re import sub cc = getenv("CC") cc_is_clang = b"clang version" in Popen([cc.split()[0], "-v"], stderr=PIPE).stderr.readline() +src_feature_tests = getenv('srctree') + '/tools/build/feature' def clang_has_option(option): - return [o for o in Popen([cc, option], stderr=PIPE).stderr.readlines() if b"unknown argument" in o] == [ ] + cc_output = Popen([cc, option, path.join(src_feature_tests, "test-hello.c") ], stderr=PIPE).stderr.readlines() + return [o for o in cc_output if ((b"unknown argument" in o) or (b"is not supported" in o))] == [ ] if cc_is_clang: from distutils.sysconfig import get_config_vars
Greg Kroah-Hartman
maintainerPATCH 322/343 tools build: Filter out options and warnings not supported by clang
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit 41caff459a5b956b3e23ba9ca759dd0629ad3dda upstream.
These make the feature check fail when using clang, so remove them just like is done in tools/perf/Makefile.config to build perf itself.
Adding -Wno-compound-token-split-by-macro to tools/perf/Makefile.config when building with clang is also necessary to avoid these warnings turned into errors (-Werror):
CC /tmp/build/perf/util/scripting-engines/trace-event-perl.o
In file included from util/scripting-engines/trace-event-perl.c:35:
In file included from /usr/lib64/perl5/CORE/perl.h:4085:
In file included from /usr/lib64/perl5/CORE/hv.h:659:
In file included from /usr/lib64/perl5/CORE/hv_func.h:34:
In file included from /usr/lib64/perl5/CORE/sbox32_hash.h:4:
/usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
#define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START { \
^~~~~~~~~~
/usr/lib64/perl5/CORE/perl.h:737:29: note: expanded from macro 'STMT_START'
# define STMT_START (void)( /* gcc supports "({ STATEMENTS; })" */
^
/usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: '{' token is here
ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
#define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START { \
^
/usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:87:41: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
v ^= (v>>23); \
^
/usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: ')' token is here
ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib64/perl5/CORE/zaphod32_hash.h:88:3: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
} STMT_END
^~~~~~~~
/usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
# define STMT_END )
^Please refer to the discussion on the Link: tag below, where Nathan clarifies the situation:
<quote>
acme> And then get to the problems at the end of this message, which seem acme> similar to the problem described here:
acme>
acme> From Nathan Chancellor <>
acme> Subject [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
acme>
acme> https://lkml.org/lkml/2020/9/1/135
acme>
acme> So perhaps in this case its better to disable that acme> -Werror,-Wcompound-token-split-by-macro when building with clang?
Yes, I think that is probably the best solution. As far as I can tell, at least in this file and context, the warning appears harmless, as the "create a GNU C statement expression from two different macros" is very much intentional, based on the presence of PERL_USE_GCC_BRACE_GROUPS. The warning is fixed in upstream Perl by just avoiding creating GNU C statement expressions using STMT_START and STMT_END:
https://github.com/Perl/perl5/issues/18780
https://github.com/Perl/perl5/pull/18984
If I am reading the source code correctly, an alternative to disabling the warning would be specifying -DPERL_GCC_BRACE_GROUPS_FORBIDDEN but it seems like that might end up impacting more than just this site, according to the issue discussion above.
</quote>
--- tools/build/feature/Makefile | 7 +++++++ tools/perf/Makefile.config | 3 +++ 2 files changed, 10 insertions(+)
tools/build/feature/Makefile +7 -0
@@ -220,6 +220,13 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(P PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) +ifeq ($(CC_NO_CLANG), 0) + PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) + PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) + PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) + FLAGS_PERL_EMBED += -Wno-compound-token-split-by-macro +endif + $(OUTPUT)test-libperl.bin: $(BUILD) $(FLAGS_PERL_EMBED)
tools/perf/Makefile.config +3 -0
@@ -793,6 +793,9 @@ else LDFLAGS += $(PERL_EMBED_LDFLAGS) EXTLIBS += $(PERL_EMBED_LIBADD) CFLAGS += -DHAVE_LIBPERL_SUPPORT + ifeq ($(CC_NO_CLANG), 0) + CFLAGS += -Wno-compound-token-split-by-macro + endif $(call detected,CONFIG_LIBPERL) endif endif
Greg Kroah-Hartman
maintainerPATCH 323/343 tools build: Use $(shell ) instead of `` to get embedded libperls ccopts
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
commit 541f695cbcb6932c22638b06e0cbe1d56177e2e9 upstream.
Just like its done for ldopts and for both in tools/perf/Makefile.config.
Using `` to initialize PERL_EMBED_CCOPTS somehow precludes using:
$(filter-out SOMETHING_TO_FILTER,$(PERL_EMBED_CCOPTS))
And we need to do it to allow for building with versions of clang where some gcc options selected by distros are not available.
--- tools/build/feature/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +1 -1
@@ -217,7 +217,7 @@ strip-libs = $(filter-out -l%,$(1)) PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) -PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` +PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) ifeq ($(CC_NO_CLANG), 0)
Greg Kroah-Hartman
maintainerPATCH 324/343 dmaengine: Revert "dmaengine: shdma: Fix runtime PM imbalance on error"
In reply to Greg Kroah-HartmanFrom: Vinod Koul <[email protected]>
commit d143f939a95696d38ff800ada14402fa50ebbd6c upstream.
This reverts commit 455896c53d5b ("dmaengine: shdma: Fix runtime PM imbalance on error") as the patch wrongly reduced the count on error and did not bail out. So drop the count by reverting the patch .
--- drivers/dma/sh/shdma-base.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/dma/sh/shdma-base.c +1 -3
@@ -115,10 +115,8 @@ static dma_cookie_t shdma_tx_submit(stru ret =pm_runtime_get (schan->dev);spin_unlock_irq (&schan->chan_lock); -if (ret <0 ) { +if (ret <0 )dev_err (schan->dev,"%s(): GET = %d\n" , __func__, ret); -pm_runtime_put (schan->dev); - }pm_runtime_barrier (schan->dev);
Greg Kroah-Hartman
maintainerPATCH 325/343 KVM: avoid NULL pointer dereference in kvm_dirty_ring_push
In reply to Greg Kroah-HartmanFrom: Paolo Bonzini <[email protected]>
commit 5593473a1e6c743764b08e3b6071cb43b5cfa6c4 upstream.
kvm_vcpu_release() will call kvm_dirty_ring_free(), freeing ring->dirty_gfns and setting it to NULL. Afterwards, it calls kvm_arch_vcpu_destroy().
However, if closing the file descriptor races with KVM_RUN in such away that vcpu->arch.st.preempted == 0, the following call stack leads to a NULL pointer dereference in kvm_dirty_run_push():
mark_page_dirty_in_slot+0x192/0x270 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3171 kvm_steal_time_set_preempted arch/x86/kvm/x86.c:4600 [inline] kvm_arch_vcpu_put+0x34e/0x5b0 arch/x86/kvm/x86.c:4618 vcpu_put+0x1b/0x70 arch/x86/kvm/../../../virt/kvm/kvm_main.c:211 vmx_free_vcpu+0xcb/0x130 arch/x86/kvm/vmx/vmx.c:6985 kvm_arch_vcpu_destroy+0x76/0x290 arch/x86/kvm/x86.c:11219 kvm_vcpu_destroy arch/x86/kvm/../../../virt/kvm/kvm_main.c:441 [inline]
The fix is to release the dirty page ring after kvm_arch_vcpu_destroy has run.
--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
@@ -439,8 +439,8 @@ static void kvm_vcpu_init(struct kvm_vcpstatic void kvm_vcpu_destroy (struct kvm_vcpu *vcpu) { -kvm_dirty_ring_free (&vcpu->dirty_ring);kvm_arch_vcpu_destroy (vcpu); +kvm_dirty_ring_free (&vcpu->dirty_ring);/* * No need for rcu_read_lock as VCPU_RUN is the only place that changes
Greg Kroah-Hartman
maintainerPATCH 326/343 Drivers: hv: vmbus: Replace smp_store_mb() with virt_store_mb()
In reply to Greg Kroah-HartmanFrom: Andrea Parri (Microsoft) <[email protected]>
commit eaa03d34535872d29004cb5cf77dc9dec1ba9a25 upstream.
Following the recommendation in Documentation/memory-barriers.txt for virtual machine guests.
--- drivers/hv/channel_mgmt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hv/channel_mgmt.c +3 -3
@@ -380,7 +380,7 @@ void vmbus_channel_map_relid(struct vmbu* execute: * * (a) In the "normal (i.e., not resuming from hibernation)" path, -* the full barrier in smp_store_mb() guarantees that the store +* the full barrier in virt_store_mb() guarantees that the store * is propagated to all CPUs before the add_channel_work work * is queued. In turn, add_channel_work is queued before the * channel's ring buffer is allocated/initialized and the
@@ -392,14 +392,14 @@ void vmbus_channel_map_relid(struct vmbu* recv_int_page before retrieving the channel pointer from the * array of channels. * -* (b) In the "resuming from hibernation" path, the smp_store_mb() +* (b) In the "resuming from hibernation" path, the virt_store_mb() * guarantees that the store is propagated to all CPUs before * the VMBus connection is marked as ready for the resume event * (cf. check_ready_for_resume_event()). The interrupt handler * of the VMBus driver and vmbus_chan_sched() can not run before * vmbus_bus_resume() has completed execution (cf. resume_noirq). */ -smp_store_mb ( +virt_store_mb ( vmbus_connection.channels[channel->offermsg.child_relid], channel); }
Greg Kroah-Hartman
maintainerPATCH 327/343 powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit
In reply to Greg Kroah-HartmanFrom: Kefeng Wang <[email protected]>
commit ffa0b64e3be58519ae472ea29a1a1ad681e32f48 upstream.
mpe: On 64-bit Book3E vmalloc space starts at 0x8000000000000000.
Because of the way __pa() works we have:
__pa(0x8000000000000000) == 0, and therefore virt_to_pfn(0x8000000000000000) == 0, and therefore virt_addr_valid(0x8000000000000000) == true
Which is wrong, virt_addr_valid() should be false for vmalloc space. In fact all vmalloc addresses that alias with a valid PFN will return true from virt_addr_valid(). That can cause bugs with hardened usercopy as described below by Kefeng Wang:
When running ethtool eth0 on 64-bit Book3E, a BUG occurred:
usercopy: Kernel memory exposure attempt detected from SLUB object not in SLUB page?! (offset 0, size 1048)!
kernel BUG at mm/usercopy.c:99
...
usercopy_abort+0x64/0xa0 (unreliable)
__check_heap_object+0x168/0x190
__check_object_size+0x1a0/0x200
dev_ethtool+0x2494/0x2b20
dev_ioctl+0x5d0/0x770
sock_do_ioctl+0xf0/0x1d0
sock_ioctl+0x3ec/0x5a0
__se_sys_ioctl+0xf0/0x160
system_call_exception+0xfc/0x1f0
system_call_common+0xf8/0x200The code shows below,
data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN)); copy_to_user(useraddr, data, gstrings.len * ETH_GSTRING_LEN))
The data is alloced by vmalloc(), virt_addr_valid(ptr) will return true on 64-bit Book3E, which leads to the panic.
As commit 4dd7554a6456 ("powerpc/64: Add VIRTUAL_BUG_ON checks for __va and __pa addresses") does, make sure the virt addr above PAGE_OFFSET in the virt_addr_valid() for 64-bit, also add upper limit check to make sure the virt is below high_memory.
Meanwhile, for 32-bit PAGE_OFFSET is the virtual address of the start of lowmem, high_memory is the upper low virtual address, the check is suitable for 32-bit, this will fix the issue mentioned in commit 602946ec2f90 ("powerpc: Set max_mapnr correctly") too.
On 32-bit there is a similar problem with high memory, that was fixed in commit 602946ec2f90 ("powerpc: Set max_mapnr correctly"), but that commit breaks highmem and needs to be reverted.
We can't easily fix __pa(), we have code that relies on its current behaviour. So for now add extra checks to virt_addr_valid().
For 64-bit Book3S the extra checks are not necessary, the combination of virt_to_pfn() and pfn_valid() should yield the correct result, but they are harmless.
--- arch/powerpc/include/asm/page.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/page.h +5 -1
@@ -132,7 +132,11 @@ static inline bool pfn_valid(unsigned lo#define virt_to_page (kaddr) pfn_to_page(virt_to_pfn(kaddr))#define pfn_to_kaddr (pfn) __va((pfn) << PAGE_SHIFT) -#define virt_addr_valid (kaddr) pfn_valid(virt_to_pfn(kaddr)) +#define virt_addr_valid (vaddr) ({ \ + unsigned long _addr = (unsigned long)vaddr; \ + _addr >= PAGE_OFFSET && _addr < (unsigned long)high_memory && \ + pfn_valid(virt_to_pfn(_addr)); \ +})/* * On Book-E parts we need __va to parse the device tree and we can't
Greg Kroah-Hartman
maintainerPATCH 328/343 Revert "powerpc: Set max_mapnr correctly"
In reply to Greg Kroah-HartmanFrom: Kefeng Wang <[email protected]>
commit 1ff5c8e8c835e8a81c0868e3050c76563dd56a2c upstream.
This reverts commit 602946ec2f90d5bd965857753880db29d2d9a1e9.
If CONFIG_HIGHMEM is enabled, no highmem will be added with max_mapnr set to max_low_pfn, see mem_init():
for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
...
free_highmem_page();
}Now that virt_addr_valid() has been fixed in the previous commit, we can revert the change to max_mapnr.
--- arch/powerpc/mm/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/mem.c +1 -1
@@ -255,7 +255,7 @@ void __init mem_init(void)#endif high_memory = (void *)__va (max_low_pfn *PAGE_SIZE ); -set_max_mapnr (max_low_pfn); +set_max_mapnr (max_pfn);kasan_late_init ();
Greg Kroah-Hartman
maintainerPATCH 329/343 x86/bug: Prevent shadowing in __WARN_FLAGS
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
commit 9ce02f0fc68326dd1f87a0a3a4c6ae7fdd39e6f6 upstream.
The macro __WARN_FLAGS() uses a local variable named "f". This being a common name, there is a risk of shadowing other variables.
For example, GCC would yield:
| In file included from ./include/linux/bug.h:5, | from ./include/linux/cpumask.h:14, | from ./arch/x86/include/asm/cpumask.h:5, | from ./arch/x86/include/asm/msr.h:11, | from ./arch/x86/include/asm/processor.h:22, | from ./arch/x86/include/asm/timex.h:5, | from ./include/linux/timex.h:65, | from ./include/linux/time32.h:13, | from ./include/linux/time.h:60, | from ./include/linux/stat.h:19, | from ./include/linux/module.h:13, | from virt/lib/irqbypass.mod.c:1: | ./include/linux/rcupdate.h: In function 'rcu_head_after_call_rcu': | ./arch/x86/include/asm/bug.h:80:21: warning: declaration of 'f' shadows a parameter [-Wshadow] | 80 | __auto_type f = BUGFLAG_WARNING|(flags); \ | | ^ | ./include/asm-generic/bug.h:106:17: note: in expansion of macro '__WARN_FLAGS' | 106 | __WARN_FLAGS(BUGFLAG_ONCE | \ | | ^~~~~~~~~~~~ | ./include/linux/rcupdate.h:1007:9: note: in expansion of macro 'WARN_ON_ONCE' | 1007 | WARN_ON_ONCE(func != (rcu_callback_t)~0L); | | ^~~~~~~~~~~~ | In file included from ./include/linux/rbtree.h:24, | from ./include/linux/mm_types.h:11, | from ./include/linux/buildid.h:5, | from ./include/linux/module.h:14, | from virt/lib/irqbypass.mod.c:1: | ./include/linux/rcupdate.h:1001:62: note: shadowed declaration is here | 1001 | rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f) | | ~~~~~~~~~~~~~~~^
For reference, sparse also warns about it, c.f. [1].
This patch renames the variable from f to __flags (with two underscore prefixes as suggested in the Linux kernel coding style [2]) in order to prevent collisions.
[1] https://lore.kernel.org/all/CAFGhKbyifH1a+nAMCvWM88TK6fpNPdzFtUXPmRGnnQeePV+1sw@mail.gmail.com/
[2] Linux kernel coding style, section 12) Macros, Enums and RTL, paragraph 5) namespace collisions when defining local variables in macros resembling functions
https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl
--- arch/x86/include/asm/bug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/bug.h +2 -2
@@ -77,9 +77,9 @@ do { \*/ #define __WARN_FLAGS (flags) \ do { \ - __auto_type f = BUGFLAG_WARNING|(flags); \ + __auto_type __flags = BUGFLAG_WARNING|(flags); \ instrumentation_begin(); \ - _BUG_FLAGS(ASM_UD2, f, ASM_REACHABLE); \ + _BUG_FLAGS(ASM_UD2, __flags, ASM_REACHABLE); \ instrumentation_end(); \ } while (0)
Greg Kroah-Hartman
maintainerPATCH 330/343 objtool: Fix SLS validation for kcov tail-call replacement
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 7a53f408902d913cd541b4f8ad7dbcd4961f5b82 upstream.
Since not all compilers have a function attribute to disable KCOV instrumentation, objtool can rewrite KCOV instrumentation in noinstr functions as per commit:
f56dae88a81f ("objtool: Handle __sanitize_cov*() tail calls")
However, this has subtle interaction with the SLS validation from commit:
1cc1e4c8aab4 ("objtool: Add straight-line-speculation validation")
In that when a tail-call instrucion is replaced with a RET an additional INT3 instruction is also written, but is not represented in the decoded instruction stream.
This then leads to false positive missing INT3 objtool warnings in noinstr code.
Instead of adding additional struct instruction objects, mark the RET instruction with retpoline_safe to suppress the warning (since we know there really is an INT3).
--- tools/objtool/check.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/objtool/check.c +11 -0
@@ -1090,6 +1090,17 @@ static void annotate_call_site(struct ob : arch_nop_insn(insn->len)); insn->type = sibling ?INSN_RETURN :INSN_NOP ; + +if (sibling) { +/* +* We've replaced the tail-call JMP insn by two new +* insn: RET; INT3, except we only have a single struct +* insn here. Mark it retpoline_safe to avoid the SLS +* warning, instead of adding another insn. +*/ + insn->retpoline_safe = true; + } +return ; }
Greg Kroah-Hartman
maintainerPATCH 331/343 sched/core: Fix forceidle balancing
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 5b6547ed97f4f5dfc23f8e3970af6d11d7b7ed7e upstream.
Steve reported that ChromeOS encounters the forceidle balancer being ran from rt_mutex_setprio()'s balance_callback() invocation and explodes.
Now, the forceidle balancer gets queued every time the idle task gets selected, set_next_task(), which is strictly too often. rt_mutex_setprio() also uses set_next_task() in the 'change' pattern:
queued = task_on_rq_queued(p); /* p->on_rq == TASK_ON_RQ_QUEUED */ running = task_current(rq, p); /* rq->curr == p */ if (queued) dequeue_task(...); if (running) put_prev_task(...); /* change task properties */ if (queued) enqueue_task(...); if (running) set_next_task(...);
However, rt_mutex_setprio() will explicitly not run this pattern on the idle task (since priority boosting the idle task is quite insane). Most other 'change' pattern users are pidhash based and would also not apply to idle.
Also, the change pattern doesn't contain a __balance_callback() invocation and hence we could have an out-of-band balance-callback, which *should* trigger the WARN in rq_pin_lock() (which guards against this exact anti-pattern).
So while none of that explains how this happens, it does indicate that having it in set_next_task() might not be the most robust option.
Instead, explicitly queue the forceidle balancer from pick_next_task() when it does indeed result in forceidle selection. Having it here, ensures it can only be triggered under the __schedule() rq->lock instance, and hence must be ran from that context.
This also happens to clean up the code a little, so win-win.
--- kernel/sched/core.c | 14 ++++++++++---- kernel/sched/idle.c | 1 - kernel/sched/sched.h | 6 ------ 3 files changed, 10 insertions(+), 11 deletions(-)
kernel/sched/core.c +10 -4
@@ -5675,6 +5675,8 @@ static inline struct task_struct *pick_textern void task_vruntime_update (struct rq *rq,struct task_struct *p,bool in_fi); +static void queue_core_balance (struct rq *rq); +static struct task_struct *pick_next_task (struct rq *rq,struct task_struct *prev,struct rq_flags *rf) {
@@ -5724,7 +5726,7 @@ pick_next_task(struct rq *rq, struct tas } rq->core_pick =NULL ; -return next; + goto out; }put_prev_task_balance (rq, prev, rf);
@@ -5774,7 +5776,7 @@ pick_next_task(struct rq *rq, struct tas*/ WARN_ON_ONCE (fi_before);task_vruntime_update (rq, next, false); - goto done; + goto out_set_next; } }
@@ -5893,8 +5895,12 @@ pick_next_task(struct rq *rq, struct tasresched_curr (rq_i); } -done: +out_set_next:set_next_task (rq, next); +out: +if (rq->core->core_forceidle_count && next == rq->idle) +queue_core_balance (rq); +return next; }
@@ -5989,7 +5995,7 @@ static void sched_core_balance(struct rq static DEFINE_PER_CPU(struct callback_head, core_balance_head); -void queue_core_balance (struct rq *rq) +static void queue_core_balance (struct rq *rq) {if (!sched_core_enabled (rq))return ;
kernel/sched/idle.c +0 -1
@@ -437,7 +437,6 @@ static void set_next_task_idle(struct rq {update_idle_core (rq);schedstat_inc (rq->sched_goidle); -queue_core_balance (rq); }#ifdef CONFIG_SMP
kernel/sched/sched.h +0 -6
@@ -1247,8 +1247,6 @@ static inline bool sched_group_cookie_mareturn false; } -extern void queue_core_balance (struct rq *rq); -static inline bool sched_core_enqueued (struct task_struct *p) {return !RB_EMPTY_NODE (&p->core_node);
@@ -1282,10 +1280,6 @@ static inline raw_spinlock_t *__rq_lockpreturn &rq->__lock; } -static inline void queue_core_balance (struct rq *rq) -{ -} -static inline bool sched_cpu_cookie_match (struct rq *rq,struct task_struct *p) {return true;
Greg Kroah-Hartman
maintainerPATCH 332/343 sched: Teach the forced-newidle balancer about CPU affinity limitation.
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
commit 386ef214c3c6ab111d05e1790e79475363abaa05 upstream.
try_steal_cookie() looks at task_struct::cpus_mask to decide if the task could be moved to `this' CPU. It ignores that the task might be in a migration disabled section while not on the CPU. In this case the task must not be moved otherwise per-CPU assumption are broken.
Use is_cpu_allowed(), as suggested by Peter Zijlstra, to decide if the a task can be moved.
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -5929,7 +5929,7 @@ static bool try_steal_cookie(int this, iif (p == src->core_pick || p == src->curr) goto next; -if (!cpumask_test_cpu (this, &p->cpus_mask)) +if (!is_cpu_allowed (p, this)) goto next;if (p->core_occupation > dst->idle->core_occupation)
Greg Kroah-Hartman
maintainerPATCH 333/343 x86,static_call: Fix __static_call_return0 for i386
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 1cd5f059d956e6f614ba6666ecdbcf95db05d5f5 upstream.
Paolo reported that the instruction sequence that is used to replace:
call __static_call_return0
namely:
66 66 48 31 c0 data16 data16 xor %rax,%rax
decodes to something else on i386, namely:
66 66 48 data16 dec %ax
31 c0 xor %eax,%eaxWhich is a nonsensical sequence that happens to have the same outcome. *However* an important distinction is that it consists of 2 instructions which is a problem when the thing needs to be overwriten with a regular call instruction again.
As such, replace the instruction with something that decodes the same on both i386 and x86_64.
--- arch/x86/kernel/static_call.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/static_call.c +2 -3
@@ -12,10 +12,9 @@ enum insn_type { };/* -* data16 data16 xorq %rax, %rax - a single 5 byte instruction that clears %rax -* The REX.W cancels the effect of any data16. +* cs cs cs xorl %eax, %eax - a single 5 byte instruction that clears %[er]ax */ -static const u8 xor5rax[] = {0x66 ,0x66 ,0x48 ,0x31 ,0xc0 }; +static const u8 xor5rax[] = {0x2e ,0x2e ,0x2e ,0x31 ,0xc0 };static const u8 retinsn[] = {RET_INSN_OPCODE ,0xcc ,0xcc ,0xcc ,0xcc };
Greg Kroah-Hartman
maintainerPATCH 334/343 x86/extable: Prefer local labels in .set directives
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
commit 334865b2915c33080624e0d06f1c3e917036472c upstream.
Bernardo reported an error that Nathan bisected down to (x86_64) defconfig+LTO_CLANG_FULL+X86_PMEM_LEGACY.
LTO vmlinux.o
ld.lld: error: <instantiation>:1:13: redefinition of 'found' .set found, 0
^
<inline asm>:29:1: while in macro instantiation extable_type_reg reg=%eax, type=(17 | ((0) << 16)) ^
This appears to be another LTO specific issue similar to what was folded into commit 4b5305decc84 ("x86/extable: Extend extable functionality"), where the .set found, 0 in DEFINE_EXTABLE_TYPE_REG in arch/x86/include/asm/asm.h conflicts with the symbol for the static function found in arch/x86/kernel/pmem.c.
Assembler .set directive declare symbols with global visibility, so the assembler may not rename such symbols in the event of a conflict. LTO could rename static functions if there was a conflict in C sources, but it cannot see into symbols defined in inline asm.
The symbols are also retained in the symbol table, regardless of LTO.
Give the symbols .L prefixes making them locally visible, so that they may be renamed for LTO to avoid conflicts, and to drop them from the symbol table regardless of LTO.
--- arch/x86/include/asm/asm.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/x86/include/asm/asm.h +10 -10
@@ -154,24 +154,24 @@# define DEFINE_EXTABLE_TYPE_REG \ ".macro extable_type_reg type:req reg:req\n" \ - ".set found, 0\n" \ - ".set regnr, 0\n" \ + ".set .Lfound, 0\n" \ + ".set .Lregnr, 0\n" \ ".irp rs,rax,rcx,rdx,rbx,rsp,rbp,rsi,rdi,r8,r9,r10,r11,r12,r13,r14,r15\n" \ ".ifc \\reg, %%\\rs\n" \ - ".set found, found+1\n" \ - ".long \\type + (regnr << 8)\n" \ + ".set .Lfound, .Lfound+1\n" \ + ".long \\type + (.Lregnr << 8)\n" \ ".endif\n" \ - ".set regnr, regnr+1\n" \ + ".set .Lregnr, .Lregnr+1\n" \ ".endr\n" \ - ".set regnr, 0\n" \ + ".set .Lregnr, 0\n" \ ".irp rs,eax,ecx,edx,ebx,esp,ebp,esi,edi,r8d,r9d,r10d,r11d,r12d,r13d,r14d,r15d\n" \ ".ifc \\reg, %%\\rs\n" \ - ".set found, found+1\n" \ - ".long \\type + (regnr << 8)\n" \ + ".set .Lfound, .Lfound+1\n" \ + ".long \\type + (.Lregnr << 8)\n" \ ".endif\n" \ - ".set regnr, regnr+1\n" \ + ".set .Lregnr, .Lregnr+1\n" \ ".endr\n" \ - ".if (found != 1)\n" \ + ".if (.Lfound != 1)\n" \ ".error \"extable_type_reg: bad register argument\"\n" \ ".endif\n" \ ".endm\n"
Greg Kroah-Hartman
maintainerPATCH 335/343 irqchip/gic-v4: Wait for GICR_VPENDBASER.Dirty to clear before descheduling
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit af27e41612ec7e5b4783f589b753a7c31a37aac8 upstream.
The way KVM drives GICv4.{0,1} is as follows:
- vcpu_load() makes the VPE resident, instructing the RD to start scanning for interrupts
- just before entering the guest, we check that the RD has finished scanning and that we can start running the vcpu
- on preemption, we deschedule the VPE by making it invalid on the RD
However, we are preemptible between the first two steps. If it so happens *and* that the RD was still scanning, we nonetheless write to the GICR_VPENDBASER register while Dirty is set, and bad things happen (we're in UNPRED land).
This affects both the 4.0 and 4.1 implementations.
Make sure Dirty is cleared before performing the deschedule, meaning that its_clear_vpend_valid() becomes a sort of full VPE residency barrier.
--- drivers/irqchip/irq-gic-v3-its.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +19 -9
@@ -3011,18 +3011,12 @@ static int __init allocate_lpi_tables(voreturn 0 ; } -static u64 its_clear_vpend_valid (void __iomem *vlpi_base,u64 clr,u64 set) +static u64 read_vpend_dirty_clear (void __iomem *vlpi_base) {u32 count =1000000 ;/* 1s! */ bool clean;u64 val; - val =gicr_read_vpendbaser (vlpi_base +GICR_VPENDBASER ); - val &= ~GICR_VPENDBASER_Valid; - val &= ~clr; - val |= set; -gicr_write_vpendbaser (val, vlpi_base +GICR_VPENDBASER ); - do { val = gicr_read_vpendbaser(vlpi_base + GICR_VPENDBASER); clean = !(val & GICR_VPENDBASER_Dirty);
@@ -3033,10 +3027,26 @@ static u64 its_clear_vpend_valid(void __ } }while (!clean && count); -if (unlikely (val & GICR_VPENDBASER_Dirty)) { +if (unlikely (!clean))pr_err_ratelimited ("ITS virtual pending table not cleaning\n" ); + +return val; +} + +static u64 its_clear_vpend_valid (void __iomem *vlpi_base,u64 clr,u64 set) +{ +u64 val; + +/* Make sure we wait until the RD is done with the initial scan */ + val =read_vpend_dirty_clear (vlpi_base); + val &= ~GICR_VPENDBASER_Valid; + val &= ~clr; + val |= set; +gicr_write_vpendbaser (val, vlpi_base +GICR_VPENDBASER ); + + val =read_vpend_dirty_clear (vlpi_base); +if (unlikely (val & GICR_VPENDBASER_Dirty)) val |= GICR_VPENDBASER_PendingLast; - }return val; }
Greg Kroah-Hartman
maintainerPATCH 336/343 powerpc/64: Fix build failure with allyesconfig in book3s_64_entry.S
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit af41d2866f7d75bbb38d487f6ec7770425d70e45 upstream.
Using conditional branches between two files is hasardous, they may get linked too far from each other.
arch/powerpc/kvm/book3s_64_entry.o:(.text+0x3ec): relocation truncated to fit: R_PPC64_REL14 (stub) against symbol `system_reset_common' defined in .text section in arch/powerpc/kernel/head_64.o
Reorganise the code to use non conditional branches.
--- arch/powerpc/kvm/book3s_64_entry.S | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_entry.S +8 -2
@@ -414,10 +414,16 @@ END_FTR_SECTION_IFSET(CPU_FTR_DAWR1) */ ld r10,HSTATE_SCRATCH0(r13) cmpwi r10,BOOK3S_INTERRUPT_MACHINE_CHECK - beq machine_check_common + beq .Lcall_machine_check_common cmpwi r10,BOOK3S_INTERRUPT_SYSTEM_RESET - beq system_reset_common + beq .Lcall_system_reset_common b . + +.Lcall_machine_check_common: + b machine_check_common + +.Lcall_system_reset_common: + b system_reset_common #endif
Greg Kroah-Hartman
maintainerPATCH 337/343 irqchip/gic, gic-v3: Prevent GSI to SGI translations
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
commit 544808f7e21cb9ccdb8f3aa7de594c05b1419061 upstream.
At the moment the GIC IRQ domain translation routine happily converts ACPI table GSI numbers below 16 to GIC SGIs (Software Generated Interrupts aka IPIs). On the Devicetree side we explicitly forbid this translation, actually the function will never return HWIRQs below 16 when using a DT based domain translation.
We expect SGIs to be handled in the first part of the function, and any further occurrence should be treated as a firmware bug, so add a check and print to report this explicitly and avoid lengthy debug sessions.
--- drivers/irqchip/irq-gic-v3.c | 6 ++++++ drivers/irqchip/irq-gic.c | 6 ++++++ 2 files changed, 12 insertions(+)
drivers/irqchip/irq-gic-v3.c +6 -0
@@ -1466,6 +1466,12 @@ static int gic_irq_domain_translate(struif (fwspec->param_count !=2 )return -EINVAL ; +if (fwspec->param[0 ] <16 ) { +pr_err (FW_BUG "Illegal GSI%d translation request\n" , + fwspec->param[0 ]); +return -EINVAL ; + } + *hwirq = fwspec->param[0 ]; *type = fwspec->param[1 ];
drivers/irqchip/irq-gic.c +6 -0
@@ -1085,6 +1085,12 @@ static int gic_irq_domain_translate(struif (fwspec->param_count !=2 )return -EINVAL ; +if (fwspec->param[0 ] <16 ) { +pr_err (FW_BUG "Illegal GSI%d translation request\n" , + fwspec->param[0 ]); +return -EINVAL ; + } + *hwirq = fwspec->param[0 ]; *type = fwspec->param[1 ];
Greg Kroah-Hartman
maintainerPATCH 338/343 mm/sparsemem: fix mem_section will never be NULL gcc 12 warning
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
commit a431dbbc540532b7465eae4fc8b56a85a9fc7d17 upstream.
The gcc 12 compiler reports a "'mem_section' will never be NULL" warning on the following code:
static inline struct mem_section *__nr_to_section(unsigned long nr)
{
#ifdef CONFIG_SPARSEMEM_EXTREME
if (!mem_section)
return NULL;
#endif
if (!mem_section[SECTION_NR_TO_ROOT(nr)])
return NULL;
:It happens with CONFIG_SPARSEMEM_EXTREME off. The mem_section definition is
#ifdef CONFIG_SPARSEMEM_EXTREME
extern struct mem_section **mem_section;
#else
extern struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT];
#endifIn the !CONFIG_SPARSEMEM_EXTREME case, mem_section is a static 2-dimensional array and so the check "!mem_section[SECTION_NR_TO_ROOT(nr)]" doesn't make sense.
Fix this warning by moving the "!mem_section[SECTION_NR_TO_ROOT(nr)]" check up inside the CONFIG_SPARSEMEM_EXTREME block and adding an explicit NR_SECTION_ROOTS check to make sure that there is no out-of-bound array access.
--- include/linux/mmzone.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
include/linux/mmzone.h +7 -4
@@ -1389,13 +1389,16 @@ static inline unsigned long *section_to_static inline struct mem_section *__nr_to_section (unsigned long nr) { +unsigned long root =SECTION_NR_TO_ROOT (nr); + +if (unlikely (root >=NR_SECTION_ROOTS )) +return NULL ; +#ifdef CONFIG_SPARSEMEM_EXTREME -if (!mem_section) +if (!mem_section || !mem_section[root])return NULL ;#endif -if (!mem_section[SECTION_NR_TO_ROOT (nr)]) -return NULL ; -return &mem_section[SECTION_NR_TO_ROOT (nr)][nr &SECTION_ROOT_MASK ]; +return &mem_section[root][nr &SECTION_ROOT_MASK ]; }extern size_t mem_section_usage_size (void );
Greg Kroah-Hartman
maintainerPATCH 339/343 static_call: Dont make __static_call_return0 static
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 8fd4ddda2f49a66bf5dd3d0c01966c4b1971308b upstream.
System.map shows that vmlinux contains several instances of __static_call_return0():
c0004fc0 t __static_call_return0 c0011518 t __static_call_return0 c00d8160 t __static_call_return0
arch_static_call_transform() uses the middle one to check whether we are setting a call to __static_call_return0 or not:
c0011520 <arch_static_call_transform>: c0011520: 3d 20 c0 01 lis r9,-16383 <== r9 = 0xc001 << 16 c0011524: 39 29 15 18 addi r9,r9,5400 <== r9 += 0x1518 c0011528: 7c 05 48 00 cmpw r5,r9 <== r9 has value 0xc0011518 here
So if static_call_update() is called with one of the other instances of __static_call_return0(), arch_static_call_transform() won't recognise it.
In order to work properly, global single instance of __static_call_return0() is required.
--- include/linux/static_call.h | 5 kernel/Makefile | 3 kernel/static_call.c | 542 ------------------------------------------- kernel/static_call_inline.c | 543 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 547 insertions(+), 546 deletions(-) create mode 100644 kernel/static_call_inline.c
include/linux/static_call.h +1 -4
@@ -248,10 +248,7 @@ static inline int static_call_text_reserreturn 0 ; } -static inline long __static_call_return0 (void ) -{ -return 0 ; -} +extern long __static_call_return0 (void );#define EXPORT_STATIC_CALL (name) \ EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \
kernel/Makefile +2 -1
@@ -113,7 +113,8 @@ obj-$(CONFIG_CPU_PM) += cpu_pm.o obj-$(CONFIG_BPF) += bpf/ obj-$(CONFIG_KCSAN) += kcsan/ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o -obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call.o +obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o +obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o obj-$(CONFIG_CFI_CLANG) += cfi.o obj-$(CONFIG_PERF_EVENTS) += events/
kernel/static_call.c +1 -541
549 lines not on this page · raw message
kernel/static_call_inline.c new file +543 -0
543 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 340/343 io_uring: move read/write file prep state into actual opcode handler
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 584b0180f0f4d67d7145950fe68c625f06c88b10 upstream.
In preparation for not necessarily having a file assigned at prep time, defer any initialization associated with the file to when the opcode handler is run.
--- fs/io_uring.c | 119 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 62 insertions(+), 57 deletions(-)
fs/io_uring.c +62 -57
@@ -560,7 +560,8 @@ struct io_rw {/* NOTE: kiocb has the file as the first member, so don't do it here */ struct kiocb kiocb;u64 addr; -u64 len; +u32 len; +u32 flags; };struct io_connect {
@@ -2984,50 +2985,11 @@ static inline bool io_file_supports_nowastatic int io_prep_rw (struct io_kiocb *req,const struct io_uring_sqe *sqe) { -struct io_ring_ctx *ctx = req->ctx;struct kiocb *kiocb = &req->rw.kiocb; -struct file *file = req->file;unsigned ioprio;int ret; -if (!io_req_ffs_set (req)) - req->flags |=io_file_get_flags (file) <<REQ_F_SUPPORT_NOWAIT_BIT ; - kiocb->ki_pos =READ_ONCE (sqe->off); -if (kiocb->ki_pos ==-1 ) { -if (!(file->f_mode &FMODE_STREAM )) { - req->flags |=REQ_F_CUR_POS ; - kiocb->ki_pos = file->f_pos; - }else { - kiocb->ki_pos =0 ; - } - } - kiocb->ki_flags =iocb_flags (file); - ret =kiocb_set_rw_flags (kiocb,READ_ONCE (sqe->rw_flags)); -if (unlikely (ret)) -return ret; - -/* -* If the file is marked O_NONBLOCK, still allow retry for it if it -* supports async. Otherwise it's impossible to use O_NONBLOCK files -* reliably. If not, or it IOCB_NOWAIT is set, don't retry. -*/ -if ((kiocb->ki_flags &IOCB_NOWAIT ) || - ((file->f_flags &O_NONBLOCK ) && !io_file_supports_nowait (req))) - req->flags |=REQ_F_NOWAIT ; - -if (ctx->flags &IORING_SETUP_IOPOLL ) { -if (!(kiocb->ki_flags &IOCB_DIRECT ) || !file->f_op->iopoll) -return -EOPNOTSUPP ; - - kiocb->ki_flags |=IOCB_HIPRI |IOCB_ALLOC_CACHE ; - kiocb->ki_complete = io_complete_rw_iopoll; - req->iopoll_completed =0 ; - }else { -if (kiocb->ki_flags &IOCB_HIPRI ) -return -EINVAL ; - kiocb->ki_complete = io_complete_rw; - } ioprio =READ_ONCE (sqe->ioprio);if (ioprio) {
@@ -3043,6 +3005,7 @@ static int io_prep_rw(struct io_kiocb *r req->imu =NULL ; req->rw.addr =READ_ONCE (sqe->addr); req->rw.len =READ_ONCE (sqe->len); + req->rw.flags =READ_ONCE (sqe->rw_flags); req->buf_index =READ_ONCE (sqe->buf_index);return 0 ; }
@@ -3523,13 +3486,6 @@ static inline int io_rw_prep_async(strucreturn 0 ; } -static int io_read_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) -{ -if (unlikely (!(req->file->f_mode &FMODE_READ ))) -return -EBADF ; -return io_prep_rw (req, sqe); -} -/* * This is our waitqueue callback handler, registered through __folio_lock_async() * when we initially tried to do the IO with the iocb armed our waitqueue.
@@ -3617,6 +3573,58 @@ static bool need_read_all(struct io_kiocS_ISBLK (file_inode (req->file)->i_mode); } +static int io_rw_init_file (struct io_kiocb *req,fmode_t mode) +{ +struct kiocb *kiocb = &req->rw.kiocb; +struct io_ring_ctx *ctx = req->ctx; +struct file *file = req->file; +int ret; + +if (unlikely (!file || !(file->f_mode & mode))) +return -EBADF ; + +if (!io_req_ffs_set (req)) + req->flags |=io_file_get_flags (file) <<REQ_F_SUPPORT_NOWAIT_BIT ; + +if (kiocb->ki_pos ==-1 ) { +if (!(file->f_mode &FMODE_STREAM )) { + req->flags |=REQ_F_CUR_POS ; + kiocb->ki_pos = file->f_pos; + }else { + kiocb->ki_pos =0 ; + } + } + + kiocb->ki_flags =iocb_flags (file); + ret =kiocb_set_rw_flags (kiocb, req->rw.flags); +if (unlikely (ret)) +return ret; + +/* +* If the file is marked O_NONBLOCK, still allow retry for it if it +* supports async. Otherwise it's impossible to use O_NONBLOCK files +* reliably. If not, or it IOCB_NOWAIT is set, don't retry. +*/ +if ((kiocb->ki_flags &IOCB_NOWAIT ) || + ((file->f_flags &O_NONBLOCK ) && !io_file_supports_nowait (req))) + req->flags |=REQ_F_NOWAIT ; + +if (ctx->flags &IORING_SETUP_IOPOLL ) { +if (!(kiocb->ki_flags &IOCB_DIRECT ) || !file->f_op->iopoll) +return -EOPNOTSUPP ; + + kiocb->ki_flags |=IOCB_HIPRI |IOCB_ALLOC_CACHE ; + kiocb->ki_complete = io_complete_rw_iopoll; + req->iopoll_completed =0 ; + }else { +if (kiocb->ki_flags &IOCB_HIPRI ) +return -EINVAL ; + kiocb->ki_complete = io_complete_rw; + } + +return 0 ; +} +static int io_read (struct io_kiocb *req,unsigned int issue_flags) {struct io_rw_state __s, *s = &__s;
@@ -3641,6 +3649,9 @@ static int io_read(struct io_kiocb *req,iov_iter_restore (&s->iter, &s->iter_state); iovec =NULL ; } + ret =io_rw_init_file (req,FMODE_READ ); +if (unlikely (ret)) +return ret; req->result =iov_iter_count (&s->iter);if (force_nonblock) {
@@ -3739,14 +3750,6 @@ out_free:return 0 ; } -static int io_write_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) -{ -if (unlikely (!(req->file->f_mode &FMODE_WRITE ))) -return -EBADF ; - req->rw.kiocb.ki_hint =ki_hint_validate (file_write_hint (req->file)); -return io_prep_rw (req, sqe); -} -static int io_write (struct io_kiocb *req,unsigned int issue_flags) {struct io_rw_state __s, *s = &__s;
@@ -3766,6 +3769,9 @@ static int io_write(struct io_kiocb *reqiov_iter_restore (&s->iter, &s->iter_state); iovec =NULL ; } + ret =io_rw_init_file (req,FMODE_WRITE ); +if (unlikely (ret)) +return ret; req->result =iov_iter_count (&s->iter);if (force_nonblock) {
@@ -6501,11 +6507,10 @@ static int io_req_prep(struct io_kiocb *case IORING_OP_READV :case IORING_OP_READ_FIXED :case IORING_OP_READ : -return io_read_prep (req, sqe);case IORING_OP_WRITEV :case IORING_OP_WRITE_FIXED :case IORING_OP_WRITE : -return io_write_prep (req, sqe); +return io_prep_rw (req, sqe);case IORING_OP_POLL_ADD :return io_poll_add_prep (req, sqe);case IORING_OP_POLL_REMOVE :
Greg Kroah-Hartman
maintainerPATCH 341/343 io_uring: propagate issue_flags state down to file assignment
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 5106dd6e74ab6c94daac1c357094f11e6934b36f upstream.
We'll need this in a future patch, when we could be assigning the file after the prep stage. While at it, get rid of the io_file_get() helper, it just makes the code harder to read.
--- fs/io_uring.c | 82 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 35 deletions(-)
fs/io_uring.c +47 -35
@@ -1128,8 +1128,9 @@ static int __io_register_rsrc_update(strstruct io_uring_rsrc_update2 *up, unsigned nr_args);static void io_clean_op (struct io_kiocb *req); -static struct file *io_file_get (struct io_ring_ctx *ctx, -struct io_kiocb *req,int fd,bool fixed); +static inline struct file *io_file_get_fixed (struct io_kiocb *req,int fd, +unsigned issue_flags); +static inline struct file *io_file_get_normal (struct io_kiocb *req,int fd);static void __io_queue_sqe (struct io_kiocb *req);static void io_rsrc_put_work (struct work_struct *work);
@@ -1258,13 +1259,20 @@ static void io_rsrc_refs_refill(struct i }static inline void io_req_set_rsrc_node (struct io_kiocb *req, -struct io_ring_ctx *ctx) +struct io_ring_ctx *ctx, +unsigned int issue_flags) {if (!req->fixed_rsrc_refs) { req->fixed_rsrc_refs = &ctx->rsrc_node->refs; - ctx->rsrc_cached_refs--; -if (unlikely (ctx->rsrc_cached_refs <0 )) -io_rsrc_refs_refill (ctx); + +if (!(issue_flags &IO_URING_F_UNLOCKED )) { +lockdep_assert_held (&ctx->uring_lock); + ctx->rsrc_cached_refs--; +if (unlikely (ctx->rsrc_cached_refs <0 )) +io_rsrc_refs_refill (ctx); + }else { +percpu_ref_get (req->fixed_rsrc_refs); + } } }
@@ -3122,7 +3130,8 @@ static int __io_import_fixed(struct io_kreturn 0 ; } -static int io_import_fixed (struct io_kiocb *req,int rw,struct iov_iter *iter) +static int io_import_fixed (struct io_kiocb *req,int rw,struct iov_iter *iter, +unsigned int issue_flags) {struct io_mapped_ubuf *imu = req->imu;u16 index, buf_index = req->buf_index;
@@ -3132,7 +3141,7 @@ static int io_import_fixed(struct io_kioif (unlikely (buf_index >= ctx->nr_user_bufs))return -EFAULT ; -io_req_set_rsrc_node (req, ctx); +io_req_set_rsrc_node (req, ctx, issue_flags); index =array_index_nospec (buf_index, ctx->nr_user_bufs); imu =READ_ONCE (ctx->user_bufs[index]); req->imu = imu;
@@ -3288,7 +3297,7 @@ static struct iovec *__io_import_iovec(issize_t ret;if (opcode ==IORING_OP_READ_FIXED || opcode ==IORING_OP_WRITE_FIXED ) { - ret =io_import_fixed (req, rw, iter); + ret =io_import_fixed (req, rw, iter, issue_flags);if (ret)return ERR_PTR (ret);return NULL ;
@@ -4167,8 +4176,10 @@ static int io_tee(struct io_kiocb *req,if (issue_flags &IO_URING_F_NONBLOCK )return -EAGAIN ; - in =io_file_get (req->ctx, req, sp->splice_fd_in, - (sp->flags &SPLICE_F_FD_IN_FIXED )); +if (sp->flags &SPLICE_F_FD_IN_FIXED ) + in =io_file_get_fixed (req, sp->splice_fd_in,IO_URING_F_UNLOCKED ); +else + in =io_file_get_normal (req, sp->splice_fd_in);if (!in) { ret = -EBADF ; goto done;
@@ -4207,8 +4218,10 @@ static int io_splice(struct io_kiocb *reif (issue_flags &IO_URING_F_NONBLOCK )return -EAGAIN ; - in =io_file_get (req->ctx, req, sp->splice_fd_in, - (sp->flags &SPLICE_F_FD_IN_FIXED )); +if (sp->flags &SPLICE_F_FD_IN_FIXED ) + in =io_file_get_fixed (req, sp->splice_fd_in,IO_URING_F_UNLOCKED ); +else + in =io_file_get_normal (req, sp->splice_fd_in);if (!in) { ret = -EBADF ; goto done;
@@ -5513,7 +5526,7 @@ static void io_poll_remove_entries(struc* either spurious wakeup or multishot CQE is served. 0 when it's done with * the request, then the mask is stored in req->result. */ -static int io_poll_check_events (struct io_kiocb *req) +static int io_poll_check_events (struct io_kiocb *req,bool locked) {struct io_ring_ctx *ctx = req->ctx;struct io_poll_iocb *poll =io_poll_get_single (req);
@@ -5569,7 +5582,7 @@ static void io_poll_task_func(struct io_struct io_ring_ctx *ctx = req->ctx;int ret; - ret =io_poll_check_events (req); + ret =io_poll_check_events (req, *locked);if (ret >0 )return ;
@@ -5594,7 +5607,7 @@ static void io_apoll_task_func(struct iostruct io_ring_ctx *ctx = req->ctx;int ret; - ret =io_poll_check_events (req); + ret =io_poll_check_events (req, *locked);if (ret >0 )return ;
@@ -6962,30 +6975,36 @@ static void io_fixed_file_set(struct io_ file_slot->file_ptr = file_ptr; } -static inline struct file *io_file_get_fixed (struct io_ring_ctx *ctx, -struct io_kiocb *req,int fd) +static inline struct file *io_file_get_fixed (struct io_kiocb *req,int fd, +unsigned int issue_flags) { -struct file *file; +struct io_ring_ctx *ctx = req->ctx; +struct file *file =NULL ;unsigned long file_ptr; +if (issue_flags &IO_URING_F_UNLOCKED ) +mutex_lock (&ctx->uring_lock); +if (unlikely ((unsigned int )fd >= ctx->nr_user_files)) -return NULL ; + goto out; fd =array_index_nospec (fd, ctx->nr_user_files); file_ptr =io_fixed_file_slot (&ctx->file_table, fd)->file_ptr; file = (struct file *) (file_ptr &FFS_MASK ); file_ptr &= ~FFS_MASK ;/* mask in overlapping REQ_F and FFS bits */ req->flags |= (file_ptr <<REQ_F_SUPPORT_NOWAIT_BIT ); -io_req_set_rsrc_node (req, ctx); +io_req_set_rsrc_node (req, ctx,0 ); +out: +if (issue_flags &IO_URING_F_UNLOCKED ) +mutex_unlock (&ctx->uring_lock);return file; } -static struct file *io_file_get_normal (struct io_ring_ctx *ctx, -struct io_kiocb *req,int fd) +static struct file *io_file_get_normal (struct io_kiocb *req,int fd) {struct file *file =fget (fd); -trace_io_uring_file_get (ctx, fd); +trace_io_uring_file_get (req->ctx, fd);/* we don't allow fixed io_uring files */ if (file &&unlikely (file->f_op == &io_uring_fops))
@@ -6993,15 +7012,6 @@ static struct file *io_file_get_normal(sreturn file; } -static inline struct file *io_file_get (struct io_ring_ctx *ctx, -struct io_kiocb *req,int fd,bool fixed) -{ -if (fixed) -return io_file_get_fixed (ctx, req, fd); -else -return io_file_get_normal (ctx, req, fd); -} -static void io_req_task_link_timeout (struct io_kiocb *req,bool *locked) {struct io_kiocb *prev = req->timeout.prev;
@@ -7249,8 +7259,10 @@ static int io_init_req(struct io_ring_ctblk_start_plug_nr_ios (&state->plug, state->submit_nr); } - req->file =io_file_get (ctx, req,READ_ONCE (sqe->fd), - (sqe_flags &IOSQE_FIXED_FILE )); +if (req->flags &REQ_F_FIXED_FILE ) + req->file =io_file_get_fixed (req,READ_ONCE (sqe->fd),0 ); +else + req->file =io_file_get_normal (req,READ_ONCE (sqe->fd));if (unlikely (!req->file))return -EBADF ; }
Greg Kroah-Hartman
maintainerPATCH 342/343 io_uring: defer file assignment
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 6bf9c47a398911e0ab920e362115153596c80432 upstream.
If an application uses direct open or accept, it knows in advance what direct descriptor value it will get as it picks it itself. This allows combined requests such as:
sqe = io_uring_get_sqe(ring); io_uring_prep_openat_direct(sqe, ..., file_slot); sqe->flags |= IOSQE_IO_LINK | IOSQE_CQE_SKIP_SUCCESS;
sqe = io_uring_get_sqe(ring); io_uring_prep_read(sqe,file_slot, buf, buf_size, 0); sqe->flags |= IOSQE_FIXED_FILE;
io_uring_submit(ring);
where we prepare both a file open and read, and only get a completion event for the read when both have completed successfully.
Currently links are fully prepared before the head is issued, but that fails if the dependent link needs a file assigned that isn't valid until the head has completed.
Conversely, if the same chain is performed but the fixed file slot is already valid, then we would be unexpectedly returning data from the old file slot rather than the newly opened one. Make sure we're consistent here.
Allow deferral of file setup, which makes this documented case work.
--- fs/io-wq.h | 1 + fs/io_uring.c | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-)
fs/io-wq.h +1 -0
@@ -155,6 +155,7 @@ struct io_wq_work_node *wq_stack_extractstruct io_wq_work {struct io_wq_work_node list;unsigned flags; +int fd; };static inline struct io_wq_work *wq_next_work (struct io_wq_work *work)
fs/io_uring.c +29 -10
@@ -6745,6 +6745,23 @@ static void io_clean_op(struct io_kiocb req->flags &= ~IO_REQ_CLEAN_FLAGS ; } +static bool io_assign_file (struct io_kiocb *req,unsigned int issue_flags) +{ +if (req->file || !io_op_defs[req->opcode].needs_file) +return true; + +if (req->flags &REQ_F_FIXED_FILE ) + req->file =io_file_get_fixed (req, req->work.fd, issue_flags); +else + req->file =io_file_get_normal (req, req->work.fd); +if (req->file) +return true; + +req_set_fail (req); + req->result = -EBADF ; +return false; +} +static int io_issue_sqe (struct io_kiocb *req,unsigned int issue_flags) {const struct cred *creds =NULL ;
@@ -6755,6 +6772,8 @@ static int io_issue_sqe(struct io_kiocbif (!io_op_defs[req->opcode].audit_skip)audit_uring_entry (req->opcode); +if (unlikely (!io_assign_file (req, issue_flags))) +return -EBADF ;switch (req->opcode) {case IORING_OP_NOP :
@@ -6896,10 +6915,11 @@ static struct io_wq_work *io_wq_free_worstatic void io_wq_submit_work (struct io_wq_work *work) { struct io_kiocb *req = container_of(work, struct io_kiocb, work); +const struct io_op_def *def = &io_op_defs[req->opcode];unsigned int issue_flags =IO_URING_F_UNLOCKED ;bool needs_poll = false;struct io_kiocb *timeout; -int ret =0 ; +int ret =0 , err = -ECANCELED ;/* one will be dropped by ->io_free_work() after returning to io-wq */ if (!(req->flags &REQ_F_REFCOUNT ))
@@ -6911,14 +6931,18 @@ static void io_wq_submit_work(struct io_if (timeout)io_queue_linked_timeout (timeout); +if (!io_assign_file (req, issue_flags)) { + err = -EBADF ; + work->flags |=IO_WQ_WORK_CANCEL ; + } +/* either cancelled or io-wq is dying, so don't touch tctx->iowq */ if (work->flags &IO_WQ_WORK_CANCEL ) { -io_req_task_queue_fail (req, -ECANCELED ); +io_req_task_queue_fail (req, err);return ; }if (req->flags &REQ_F_FORCE_ASYNC ) { -const struct io_op_def *def = &io_op_defs[req->opcode];bool opcode_poll = def->pollin || def->pollout;if (opcode_poll &&file_can_poll (req->file)) {
@@ -7249,6 +7273,8 @@ static int io_init_req(struct io_ring_ctif (io_op_defs[opcode].needs_file) {struct io_submit_state *state = &ctx->submit_state; + req->work.fd =READ_ONCE (sqe->fd); +/* * Plug now if we have more than 2 IO left after this, and the * target is potentially a read/write to block based storage.
@@ -7258,13 +7284,6 @@ static int io_init_req(struct io_ring_ct state->need_plug = false;blk_start_plug_nr_ios (&state->plug, state->submit_nr); } - -if (req->flags &REQ_F_FIXED_FILE ) - req->file =io_file_get_fixed (req,READ_ONCE (sqe->fd),0 ); -else - req->file =io_file_get_normal (req,READ_ONCE (sqe->fd)); -if (unlikely (!req->file)) -return -EBADF ; } personality =READ_ONCE (sqe->personality);
Greg Kroah-Hartman
maintainerPATCH 343/343 io_uring: drop the old style inflight file tracking
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit d5361233e9ab920e135819f73dd8466355f1fddd upstream.
io_uring tracks requests that are referencing an io_uring descriptor to be able to cancel without worrying about loops in the references. Since we now assign the file at execution time, the easier approach is to drop a potentially problematic reference before we punt the request. This eliminates the need to special case these types of files beyond just marking them as such, and simplifies cancelation quite a bit.
This also fixes a recent issue where an async punted tee operation would with the io_uring descriptor as the output file would crash when attempting to get a reference to the file from the io-wq worker. We could have worked around that, but this is the much cleaner fix.
--- fs/io_uring.c | 85 ++++++++++++++++++---------------------------------------- 1 file changed, 27 insertions(+), 58 deletions(-)
fs/io_uring.c +27 -58
@@ -112,8 +112,7 @@ IOSQE_IO_DRAIN | IOSQE_CQE_SKIP_SUCCESS)#define IO_REQ_CLEAN_FLAGS (REQ_F_BUFFER_SELECTED | REQ_F_NEED_CLEANUP | \ - REQ_F_POLLED | REQ_F_INFLIGHT | REQ_F_CREDS | \ - REQ_F_ASYNC_DATA) + REQ_F_POLLED | REQ_F_CREDS | REQ_F_ASYNC_DATA)#define IO_TCTX_REFS_CACHE_NR (1U << 10)
@@ -469,7 +468,6 @@ struct io_uring_task {const struct io_ring_ctx *last;struct io_wq *io_wq;struct percpu_counter inflight; -atomic_t inflight_tracked;atomic_t in_idle;spinlock_t task_lock;
@@ -1131,6 +1129,8 @@ static void io_clean_op(struct io_kiocbstatic inline struct file *io_file_get_fixed (struct io_kiocb *req,int fd,unsigned issue_flags);static inline struct file *io_file_get_normal (struct io_kiocb *req,int fd); +static void io_drop_inflight_file (struct io_kiocb *req); +static bool io_assign_file (struct io_kiocb *req,unsigned int issue_flags);static void __io_queue_sqe (struct io_kiocb *req);static void io_rsrc_put_work (struct work_struct *work);
@@ -1312,29 +1312,9 @@ static bool io_match_task(struct io_kioc bool cancel_all) __must_hold(&req->ctx->timeout_lock) { -struct io_kiocb *req; -if (task && head->task != task)return false; -if (cancel_all) -return true; - -io_for_each_link (req, head) { -if (req->flags &REQ_F_INFLIGHT ) -return true; - } -return false; -} - -static bool io_match_linked (struct io_kiocb *head) -{ -struct io_kiocb *req; - -io_for_each_link (req, head) { -if (req->flags &REQ_F_INFLIGHT ) -return true; - } -return false; +return cancel_all; }/*
@@ -1344,24 +1324,9 @@ static bool io_match_linked(struct io_kistatic bool io_match_task_safe (struct io_kiocb *head,struct task_struct *task,bool cancel_all) { -bool matched; -if (task && head->task != task)return false; -if (cancel_all) -return true; - -if (head->flags &REQ_F_LINK_TIMEOUT ) { -struct io_ring_ctx *ctx = head->ctx; - -/* protect against races with linked timeouts */ -spin_lock_irq (&ctx->timeout_lock); - matched =io_match_linked (head); -spin_unlock_irq (&ctx->timeout_lock); - }else { - matched =io_match_linked (head); - } -return matched; +return cancel_all; }static inline bool req_has_async_data (struct io_kiocb *req)
@@ -1509,14 +1474,6 @@ static inline bool io_req_ffs_set(structreturn req->flags &REQ_F_FIXED_FILE ; } -static inline void io_req_track_inflight (struct io_kiocb *req) -{ -if (!(req->flags &REQ_F_INFLIGHT )) { - req->flags |=REQ_F_INFLIGHT ; -atomic_inc (¤t->io_uring->inflight_tracked); - } -} -static struct io_kiocb *__io_prep_linked_timeout (struct io_kiocb *req) {if (WARN_ON_ONCE (!req->link))
@@ -2380,6 +2337,8 @@ static void io_req_task_work_add(structWARN_ON_ONCE (!tctx); +io_drop_inflight_file (req); +spin_lock_irqsave (&tctx->task_lock, flags);if (priority)wq_list_add_tail (&req->io_task_work.node, &tctx->prior_task_list);
@@ -5548,7 +5507,10 @@ static int io_poll_check_events(struct iif (!req->result) {struct poll_table_struct pt = { ._key = poll->events }; - req->result =vfs_poll (req->file, &pt) & poll->events; +if (unlikely (!io_assign_file (req,IO_URING_F_UNLOCKED ))) + req->result = -EBADF ; +else + req->result =vfs_poll (req->file, &pt) & poll->events; }/* multishot, just fill an CQE and proceed */
@@ -6731,11 +6693,6 @@ static void io_clean_op(struct io_kiocbkfree (req->apoll); req->apoll =NULL ; } -if (req->flags &REQ_F_INFLIGHT ) { -struct io_uring_task *tctx = req->task->io_uring; - -atomic_dec (&tctx->inflight_tracked); - }if (req->flags &REQ_F_CREDS )put_cred (req->creds);if (req->flags &REQ_F_ASYNC_DATA ) {
@@ -7024,6 +6981,19 @@ out:return file; } +/* +* Drop the file for requeue operations. Only used of req->file is the +* io_uring descriptor itself. +*/ +static void io_drop_inflight_file (struct io_kiocb *req) +{ +if (unlikely (req->flags &REQ_F_INFLIGHT )) { +fput (req->file); + req->file =NULL ; + req->flags &= ~REQ_F_INFLIGHT ; + } +} +static struct file *io_file_get_normal (struct io_kiocb *req,int fd) {struct file *file =fget (fd);
@@ -7031,8 +7001,8 @@ static struct file *io_file_get_normal(strace_io_uring_file_get (req->ctx, fd);/* we don't allow fixed io_uring files */ -if (file &&unlikely (file->f_op == &io_uring_fops)) -io_req_track_inflight (req); +if (file && file->f_op == &io_uring_fops) + req->flags |=REQ_F_INFLIGHT ;return file; }
@@ -8804,7 +8774,6 @@ static __cold int io_uring_alloc_task_coxa_init (&tctx->xa);init_waitqueue_head (&tctx->wait);atomic_set (&tctx->in_idle,0 ); -atomic_set (&tctx->inflight_tracked,0 ); task->io_uring = tctx;spin_lock_init (&tctx->task_lock);INIT_WQ_LIST (&tctx->task_list);
@@ -9942,7 +9911,7 @@ static __cold void io_uring_clean_tctx(sstatic s64 tctx_inflight (struct io_uring_task *tctx,bool tracked) {if (tracked) -return atomic_read (&tctx->inflight_tracked); +return 0 ;return percpu_counter_sum (&tctx->inflight); }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
5.17.3-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Hi Greg,
Compiled and booted on my test system Lenovo P50s: Intel Core i7 No emergency and critical messages in the dmesg
./perf bench sched all
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.447 [sec]
# Running sched/pipe benchmark...
# Executed 1000000 pipe operations between two processes
Total time: 11.259 [sec]
11.259176 usecs/op
88816 ops/secThanks
-Zan
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 488 pass: 488 fail: 0
Guenter
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.17.3-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git branch: linux-5.17.y
* git commit: 66349d151ef98c411fbfe080a4e9c646dc41eca8
* git describe: v5.17.2-344-g66349d151ef9
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.17.y/build/v5.17.2-344-g66349d151ef9
## Test Regressions (compared to v5.17.2-340-ge5a51d774e89) No test regressions found.
## Metric Regressions (compared to v5.17.2-340-ge5a51d774e89) No metric regressions found.
## Test Fixes (compared to v5.17.2-340-ge5a51d774e89) No test fixes found.
## Metric Fixes (compared to v5.17.2-340-ge5a51d774e89) No metric fixes found.
## Test result summary
total: 100152, pass: 85962, fail: 732, skip: 12550, xfail: 908
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 296 total, 293 passed, 3 failed
* arm64: 47 total, 46 passed, 1 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 45 total, 41 passed, 4 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 41 total, 38 passed, 3 failed
* parisc: 14 total, 14 passed, 0 failed
* powerpc: 65 total, 56 passed, 9 failed
* riscv: 32 total, 26 passed, 6 failed
* s390: 26 total, 23 passed, 3 failed
* sh: 26 total, 24 passed, 2 failed
* sparc: 14 total, 14 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 47 total, 46 passed, 1 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-
* kselftest-android
* kselftest-arm64
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* perf/Zstd-perf.data-compression
* rcutorture
* ssuite
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.
openSUSE configs¹⁾ all green.
¹⁾ armv6hl armv7hl arm64 i386 ppc64 ppc64le riscv64 s390x x86_64
Signature · 2 lines
js suse labs
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
Hi Greg,
5.17.3-rc1 tested.
Run tested on:
- Allwinner H6 (Tanix TX6)
- Intel Tiger Lake x86_64 (nuc11 i7-1165G7)
In addition - build tested for:
- Allwinner A64
- Allwinner H3
- Allwinner H5
- NXP iMX6
- NXP iMX8
- Qualcomm Dragonboard
- Rockchip RK3288
- Rockchip RK3328
- Rockchip RK3399pro
- Samsung Exynos
--
Rudi
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.17.3 release. There are 343 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 Thu, 14 Apr 2022 06:28:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.17.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.17.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian