6.4.4-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 788/800 drm/amdgpu: make sure that BOs have a backing store
In reply to Greg Kroah-HartmanFrom: Christian K�nig <[email protected]>
commit ca0b954a4315ca2228001c439ae1062561c81989 upstream
It's perfectly possible that the BO is about to be destroyed and doesn't have a backing store associated with it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -1
@@ -1266,8 +1266,12 @@ void amdgpu_bo_move_notify(struct ttm_buvoid amdgpu_bo_get_memory (struct amdgpu_bo *bo,struct amdgpu_mem_stats *stats) { -unsigned int domain;uint64_t size =amdgpu_bo_size (bo); +unsigned int domain; + +/* Abort if the BO doesn't currently have a backing store */ +if (!bo->tbo.resource) +return ; domain =amdgpu_mem_type_to_domain (bo->tbo.resource->mem_type);switch (domain) {
Greg Kroah-Hartman
maintainerPATCH 789/800 drm/amdgpu: Skip mark offset for high priority rings
In reply to Greg Kroah-HartmanFrom: Jiadong Zhu <[email protected]>
commit ef3c36a6e025e9b16ca3321479ba016841fa17a0 upstream
Only low priority rings are using chunks to save the offset. Bypass the mark offset callings from high priority rings.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c +3 -0
@@ -423,6 +423,9 @@ void amdgpu_sw_ring_ib_mark_offset(strucstruct amdgpu_ring_mux *mux = &adev->gfx.muxer;unsigned offset; +if (ring->hw_prio >AMDGPU_RING_PRIO_DEFAULT ) +return ; + offset = ring->wptr & ring->buf_mask;amdgpu_ring_mux_ib_mark_offset (mux, ring, offset, type);
Greg Kroah-Hartman
maintainerPATCH 790/800 drm/amd/pm: revise the ASPM settings for thunderbolt attached scenario
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit fd21987274463a439c074b8f3c93d3b132e4c031 upstream
Also, correct the comment for NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT as 0x0000000E stands for 400ms instead of 4ms.
--- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +7 -4
@@ -346,7 +346,7 @@ static void nbio_v2_3_init_registers(str#define NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT 0x00000000 // off by default, no gains over L1#define NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT 0x00000009 // 1=1us, 9=1ms -#define NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT 0x0000000E // 4ms +#define NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT 0x0000000E // 400msstatic void nbio_v2_3_enable_aspm (struct amdgpu_device *adev,bool enable)
@@ -479,9 +479,12 @@ static void nbio_v2_3_program_aspm(strucWREG32_SOC15 (NBIO ,0 , mmRCC_BIF_STRAP5, data); def = data =RREG32_PCIE (smnPCIE_LC_CNTL); - data &= ~PCIE_LC_CNTL__LC_L0S_INACTIVITY_MASK ; - data |=0x9 <<PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT ; - data |=0x1 <<PCIE_LC_CNTL__LC_PMI_TO_L1_DIS__SHIFT ; + data |=NAVI10_PCIE__LC_L0S_INACTIVITY_DEFAULT <<PCIE_LC_CNTL__LC_L0S_INACTIVITY__SHIFT ; +if (pci_is_thunderbolt_attached (adev->pdev)) + data |=NAVI10_PCIE__LC_L1_INACTIVITY_TBT_DEFAULT <<PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT ; +else + data |=NAVI10_PCIE__LC_L1_INACTIVITY_DEFAULT <<PCIE_LC_CNTL__LC_L1_INACTIVITY__SHIFT ; + data &= ~PCIE_LC_CNTL__LC_PMI_TO_L1_DIS_MASK ;if (def != data)WREG32_PCIE (smnPCIE_LC_CNTL, data);
Greg Kroah-Hartman
maintainerPATCH 791/800 drm/amdgpu/sdma4: set align mask to 255
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit e5df16d9428f5c6d2d0b1eff244d6c330ba9ef3a upstream
The wptr needs to be incremented at at least 64 dword intervals, use 256 to align with windows. This should fix potential hangs with unaligned updates.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
@@ -2306,7 +2306,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_fstatic const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .secure_submission_supported = true,
@@ -2338,7 +2338,7 @@ static const struct amdgpu_ring_funcs sdstatic const struct amdgpu_ring_funcs sdma_v4_0_page_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .secure_submission_supported = true,
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
@@ -1740,7 +1740,7 @@ const struct amd_ip_funcs sdma_v4_4_2_ipstatic const struct amdgpu_ring_funcs sdma_v4_4_2_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .get_rptr = sdma_v4_4_2_ring_get_rptr,
@@ -1771,7 +1771,7 @@ static const struct amdgpu_ring_funcs sdstatic const struct amdgpu_ring_funcs sdma_v4_4_2_page_ring_funcs = { .type =AMDGPU_RING_TYPE_SDMA , - .align_mask =0xf , + .align_mask =0xff , .nop =SDMA_PKT_NOP_HEADER_OP (SDMA_OP_NOP ), .support_64bit_ptrs = true, .get_rptr = sdma_v4_4_2_ring_get_rptr,
Greg Kroah-Hartman
maintainerPATCH 792/800 drm/amd/pm: add abnormal fan detection for smu 13.0.0
In reply to Greg Kroah-HartmanFrom: Kenneth Feng <[email protected]>
commit 2da0036ea99bccb27f7fe3cf2aa2900860e9be46 upstream
add abnormal fan detection for smu 13.0.0
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -1300,6 +1300,7 @@ static int smu_v13_0_0_get_thermal_tempe range->mem_emergency_max = (pptable->SkuTable.TemperatureLimit[TEMP_MEM ] +CTF_OFFSET_MEM )*SMU_TEMPERATURE_UNITS_PER_CENTIGRADES ; range->software_shutdown_temp = powerplay_table->software_shutdown_temp; + range->software_shutdown_temp_offset = pptable->SkuTable.FanAbnormalTempLimitOffset;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 793/800 drm/amdgpu: check RAS irq existence for VCN/JPEG
In reply to Greg Kroah-HartmanFrom: Tao Zhou <[email protected]>
commit 4ff96bcc0d40b66bf3ddd6010830e9a4f9b85d53 upstream
No RAS irq is allowed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2 -1
@@ -251,7 +251,8 @@ int amdgpu_jpeg_ras_late_init(struct amdif (amdgpu_ras_is_supported (adev, ras_block->block)) {for (i =0 ; i < adev->jpeg.num_jpeg_inst; ++i) { -if (adev->jpeg.harvest_config & (1 << i)) +if (adev->jpeg.harvest_config & (1 << i) || + !adev->jpeg.inst[i].ras_poison_irq.funcs)continue ; r =amdgpu_irq_get (adev, &adev->jpeg.inst[i].ras_poison_irq,0 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -1
@@ -1191,7 +1191,8 @@ int amdgpu_vcn_ras_late_init(struct amdgif (amdgpu_ras_is_supported (adev, ras_block->block)) {for (i =0 ; i < adev->vcn.num_vcn_inst; i++) { -if (adev->vcn.harvest_config & (1 << i)) +if (adev->vcn.harvest_config & (1 << i) || + !adev->vcn.inst[i].ras_poison_irq.funcs)continue ; r =amdgpu_irq_get (adev, &adev->vcn.inst[i].ras_poison_irq,0 );
Greg Kroah-Hartman
maintainerPATCH 794/800 netfilter: conntrack: Avoid nf_ct_helper_hash uses after free
In reply to Greg Kroah-HartmanFrom: Florent Revest <[email protected]>
commit 6eef7a2b933885a17679eb8ed0796ddf0ee5309b upstream.
If nf_conntrack_init_start() fails (for example due to a register_nf_conntrack_bpf() failure), the nf_conntrack_helper_fini() clean-up path frees the nf_ct_helper_hash map.
When built with NF_CONNTRACK=y, further netfilter modules (e.g:netfilter_conntrack_ftp) can still be loaded and call nf_conntrack_helpers_register(), independently of whether nf_conntrack initialized correctly. This accesses the nf_ct_helper_hash dangling pointer and causes a uaf, possibly leading to random memory corruption.
This patch guards nf_conntrack_helper_register() from accessing a freed or uninitialized nf_ct_helper_hash pointer and fixes possible uses-after-free when loading a conntrack module.
--- net/netfilter/nf_conntrack_helper.c | 4 ++++ 1 file changed, 4 insertions(+)
net/netfilter/nf_conntrack_helper.c +4 -0
@@ -360,6 +360,9 @@ int nf_conntrack_helper_register(structBUG_ON (me->expect_class_max >=NF_CT_MAX_EXPECT_CLASSES );BUG_ON (strlen (me->name) >NF_CT_HELPER_NAME_LEN -1 ); +if (!nf_ct_helper_hash) +return -ENOENT ; +if (me->expect_policy->max_expected >NF_CT_EXPECT_MAX_CNT )return -EINVAL ;
@@ -515,4 +518,5 @@ int nf_conntrack_helper_init(void)void nf_conntrack_helper_fini (void ) {kvfree (nf_ct_helper_hash); + nf_ct_helper_hash =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 795/800 netfilter: nf_tables: do not ignore genmask when looking up chain by id
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit 515ad530795c118f012539ed76d02bacfd426d89 upstream.
When adding a rule to a chain referring to its ID, if that chain had been deleted on the same batch, the rule might end up referring to a deleted chain.
This will lead to a WARNING like following:
[ 33.098431] ------------[ cut here ]------------ [ 33.098678] WARNING: CPU: 5 PID: 69 at net/netfilter/nf_tables_api.c:2037 nf_tables_chain_destroy+0x23d/0x260 [ 33.099217] Modules linked in: [ 33.099388] CPU: 5 PID: 69 Comm: kworker/5:1 Not tainted 6.4.0+ #409 [ 33.099726] Workqueue: events nf_tables_trans_destroy_work [ 33.100018] RIP: 0010:nf_tables_chain_destroy+0x23d/0x260 [ 33.100306] Code: 8b 7c 24 68 e8 64 9c ed fe 4c 89 e7 e8 5c 9c ed fe 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 89 c6 89 c7 c3 cc cc cc cc <0f> 0b 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 89 c6 89 c7 [ 33.101271] RSP: 0018:ffffc900004ffc48 EFLAGS: 00010202 [ 33.101546] RAX: 0000000000000001 RBX: ffff888006fc0a28 RCX: 0000000000000000 [ 33.101920] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 33.102649] RBP: ffffc900004ffc78 R08: 0000000000000000 R09: 0000000000000000 [ 33.103018] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880135ef500 [ 33.103385] R13: 0000000000000000 R14: dead000000000122 R15: ffff888006fc0a10 [ 33.103762] FS: 0000000000000000(0000) GS:ffff888024c80000(0000) knlGS:0000000000000000 [ 33.104184] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 33.104493] CR2: 00007fe863b56a50 CR3: 00000000124b0001 CR4: 0000000000770ee0 [ 33.104872] PKRU: 55555554 [ 33.104999] Call Trace: [ 33.105113] <TASK> [ 33.105214] ? show_regs+0x72/0x90 [ 33.105371] ? __warn+0xa5/0x210 [ 33.105520] ? nf_tables_chain_destroy+0x23d/0x260 [ 33.105732] ? report_bug+0x1f2/0x200 [ 33.105902] ? handle_bug+0x46/0x90 [ 33.106546] ? exc_invalid_op+0x19/0x50 [ 33.106762] ? asm_exc_invalid_op+0x1b/0x20 [ 33.106995] ? nf_tables_chain_destroy+0x23d/0x260 [ 33.107249] ? nf_tables_chain_destroy+0x30/0x260 [ 33.107506] nf_tables_trans_destroy_work+0x669/0x680 [ 33.107782] ? mark_held_locks+0x28/0xa0 [ 33.107996] ? __pfx_nf_tables_trans_destroy_work+0x10/0x10 [ 33.108294] ? _raw_spin_unlock_irq+0x28/0x70 [ 33.108538] process_one_work+0x68c/0xb70 [ 33.108755] ? lock_acquire+0x17f/0x420 [ 33.108977] ? __pfx_process_one_work+0x10/0x10 [ 33.109218] ? do_raw_spin_lock+0x128/0x1d0 [ 33.109435] ? _raw_spin_lock_irq+0x71/0x80 [ 33.109634] worker_thread+0x2bd/0x700 [ 33.109817] ? __pfx_worker_thread+0x10/0x10 [ 33.110254] kthread+0x18b/0x1d0 [ 33.110410] ? __pfx_kthread+0x10/0x10 [ 33.110581] ret_from_fork+0x29/0x50 [ 33.110757] </TASK> [ 33.110866] irq event stamp: 1651 [ 33.111017] hardirqs last enabled at (1659): [<ffffffffa206a209>] __up_console_sem+0x79/0xa0 [ 33.111379] hardirqs last disabled at (1666): [<ffffffffa206a1ee>] __up_console_sem+0x5e/0xa0 [ 33.111740] softirqs last enabled at (1616): [<ffffffffa1f5d40e>] __irq_exit_rcu+0x9e/0xe0 [ 33.112094] softirqs last disabled at (1367): [<ffffffffa1f5d40e>] __irq_exit_rcu+0x9e/0xe0 [ 33.112453] ---[ end trace 0000000000000000 ]---
This is due to the nft_chain_lookup_byid ignoring the genmask. After this change, adding the new rule will fail as it will not find the chain.
--- net/netfilter/nf_tables_api.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +7 -4
@@ -2693,7 +2693,7 @@ err_hooks:static struct nft_chain *nft_chain_lookup_byid (const struct net *net,const struct nft_table *table, -const struct nlattr *nla) +const struct nlattr *nla,u8 genmask) {struct nftables_pernet *nft_net =nft_pernet (net);u32 id =ntohl (nla_get_be32 (nla));
@@ -2704,7 +2704,8 @@ static struct nft_chain *nft_chain_lookuif (trans->msg_type ==NFT_MSG_NEWCHAIN && chain->table == table && - id ==nft_trans_chain_id (trans)) + id ==nft_trans_chain_id (trans) && +nft_active_genmask (chain, genmask))return chain; }return ERR_PTR (-ENOENT );
@@ -3808,7 +3809,8 @@ static int nf_tables_newrule(struct sk_breturn -EOPNOTSUPP ; }else if (nla[NFTA_RULE_CHAIN_ID ]) { - chain =nft_chain_lookup_byid (net, table, nla[NFTA_RULE_CHAIN_ID ]); + chain =nft_chain_lookup_byid (net, table, nla[NFTA_RULE_CHAIN_ID ], + genmask);if (IS_ERR (chain)) {NL_SET_BAD_ATTR (extack, nla[NFTA_RULE_CHAIN_ID ]);return PTR_ERR (chain);
@@ -10467,7 +10469,8 @@ static int nft_verdict_init(const struct genmask); }else if (tb[NFTA_VERDICT_CHAIN_ID ]) { chain =nft_chain_lookup_byid (ctx->net, ctx->table, - tb[NFTA_VERDICT_CHAIN_ID ]); + tb[NFTA_VERDICT_CHAIN_ID ], + genmask);if (IS_ERR (chain))return PTR_ERR (chain); }else {
Greg Kroah-Hartman
maintainerPATCH 796/800 netfilter: nf_tables: prevent OOB access in nft_byteorder_eval
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit caf3ef7468f7534771b5c44cd8dbd6f7f87c2cbd upstream.
When evaluating byteorder expressions with size 2, a union with 32-bit and 16-bit members is used. Since the 16-bit members are aligned to 32-bit, the array accesses will be out-of-bounds.
It may lead to a stack-out-of-bounds access like the one below:
[ 23.095215] ================================================================== [ 23.095625] BUG: KASAN: stack-out-of-bounds in nft_byteorder_eval+0x13c/0x320 [ 23.096020] Read of size 2 at addr ffffc90000007948 by task ping/115 [ 23.096358] [ 23.096456] CPU: 0 PID: 115 Comm: ping Not tainted 6.4.0+ #413 [ 23.096770] Call Trace: [ 23.096910] <IRQ> [ 23.097030] dump_stack_lvl+0x60/0xc0 [ 23.097218] print_report+0xcf/0x630 [ 23.097388] ? nft_byteorder_eval+0x13c/0x320 [ 23.097577] ? kasan_addr_to_slab+0xd/0xc0 [ 23.097760] ? nft_byteorder_eval+0x13c/0x320 [ 23.097949] kasan_report+0xc9/0x110 [ 23.098106] ? nft_byteorder_eval+0x13c/0x320 [ 23.098298] __asan_load2+0x83/0xd0 [ 23.098453] nft_byteorder_eval+0x13c/0x320 [ 23.098659] nft_do_chain+0x1c8/0xc50 [ 23.098852] ? __pfx_nft_do_chain+0x10/0x10 [ 23.099078] ? __kasan_check_read+0x11/0x20 [ 23.099295] ? __pfx___lock_acquire+0x10/0x10 [ 23.099535] ? __pfx___lock_acquire+0x10/0x10 [ 23.099745] ? __kasan_check_read+0x11/0x20 [ 23.099929] nft_do_chain_ipv4+0xfe/0x140 [ 23.100105] ? __pfx_nft_do_chain_ipv4+0x10/0x10 [ 23.100327] ? lock_release+0x204/0x400 [ 23.100515] ? nf_hook.constprop.0+0x340/0x550 [ 23.100779] nf_hook_slow+0x6c/0x100 [ 23.100977] ? __pfx_nft_do_chain_ipv4+0x10/0x10 [ 23.101223] nf_hook.constprop.0+0x334/0x550 [ 23.101443] ? __pfx_ip_local_deliver_finish+0x10/0x10 [ 23.101677] ? __pfx_nf_hook.constprop.0+0x10/0x10 [ 23.101882] ? __pfx_ip_rcv_finish+0x10/0x10 [ 23.102071] ? __pfx_ip_local_deliver_finish+0x10/0x10 [ 23.102291] ? rcu_read_lock_held+0x4b/0x70 [ 23.102481] ip_local_deliver+0xbb/0x110 [ 23.102665] ? __pfx_ip_rcv+0x10/0x10 [ 23.102839] ip_rcv+0x199/0x2a0 [ 23.102980] ? __pfx_ip_rcv+0x10/0x10 [ 23.103140] __netif_receive_skb_one_core+0x13e/0x150 [ 23.103362] ? __pfx___netif_receive_skb_one_core+0x10/0x10 [ 23.103647] ? mark_held_locks+0x48/0xa0 [ 23.103819] ? process_backlog+0x36c/0x380 [ 23.103999] __netif_receive_skb+0x23/0xc0 [ 23.104179] process_backlog+0x91/0x380 [ 23.104350] __napi_poll.constprop.0+0x66/0x360 [ 23.104589] ? net_rx_action+0x1cb/0x610 [ 23.104811] net_rx_action+0x33e/0x610 [ 23.105024] ? _raw_spin_unlock+0x23/0x50 [ 23.105257] ? __pfx_net_rx_action+0x10/0x10 [ 23.105485] ? mark_held_locks+0x48/0xa0 [ 23.105741] __do_softirq+0xfa/0x5ab [ 23.105956] ? __dev_queue_xmit+0x765/0x1c00 [ 23.106193] do_softirq.part.0+0x49/0xc0 [ 23.106423] </IRQ> [ 23.106547] <TASK> [ 23.106670] __local_bh_enable_ip+0xf5/0x120 [ 23.106903] __dev_queue_xmit+0x789/0x1c00 [ 23.107131] ? __pfx___dev_queue_xmit+0x10/0x10 [ 23.107381] ? find_held_lock+0x8e/0xb0 [ 23.107585] ? lock_release+0x204/0x400 [ 23.107798] ? neigh_resolve_output+0x185/0x350 [ 23.108049] ? mark_held_locks+0x48/0xa0 [ 23.108265] ? neigh_resolve_output+0x185/0x350 [ 23.108514] neigh_resolve_output+0x246/0x350 [ 23.108753] ? neigh_resolve_output+0x246/0x350 [ 23.109003] ip_finish_output2+0x3c3/0x10b0 [ 23.109250] ? __pfx_ip_finish_output2+0x10/0x10 [ 23.109510] ? __pfx_nf_hook+0x10/0x10 [ 23.109732] __ip_finish_output+0x217/0x390 [ 23.109978] ip_finish_output+0x2f/0x130 [ 23.110207] ip_output+0xc9/0x170 [ 23.110404] ip_push_pending_frames+0x1a0/0x240 [ 23.110652] raw_sendmsg+0x102e/0x19e0 [ 23.110871] ? __pfx_raw_sendmsg+0x10/0x10 [ 23.111093] ? lock_release+0x204/0x400 [ 23.111304] ? __mod_lruvec_page_state+0x148/0x330 [ 23.111567] ? find_held_lock+0x8e/0xb0 [ 23.111777] ? find_held_lock+0x8e/0xb0 [ 23.111993] ? __rcu_read_unlock+0x7c/0x2f0 [ 23.112225] ? aa_sk_perm+0x18a/0x550 [ 23.112431] ? filemap_map_pages+0x4f1/0x900 [ 23.112665] ? __pfx_aa_sk_perm+0x10/0x10 [ 23.112880] ? find_held_lock+0x8e/0xb0 [ 23.113098] inet_sendmsg+0xa0/0xb0 [ 23.113297] ? inet_sendmsg+0xa0/0xb0 [ 23.113500] ? __pfx_inet_sendmsg+0x10/0x10 [ 23.113727] sock_sendmsg+0xf4/0x100 [ 23.113924] ? move_addr_to_kernel.part.0+0x4f/0xa0 [ 23.114190] __sys_sendto+0x1d4/0x290 [ 23.114391] ? __pfx___sys_sendto+0x10/0x10 [ 23.114621] ? __pfx_mark_lock.part.0+0x10/0x10 [ 23.114869] ? lock_release+0x204/0x400 [ 23.115076] ? find_held_lock+0x8e/0xb0 [ 23.115287] ? rcu_is_watching+0x23/0x60 [ 23.115503] ? __rseq_handle_notify_resume+0x6e2/0x860 [ 23.115778] ? __kasan_check_write+0x14/0x30 [ 23.116008] ? blkcg_maybe_throttle_current+0x8d/0x770 [ 23.116285] ? mark_held_locks+0x28/0xa0 [ 23.116503] ? do_syscall_64+0x37/0x90 [ 23.116713] __x64_sys_sendto+0x7f/0xb0 [ 23.116924] do_syscall_64+0x59/0x90 [ 23.117123] ? irqentry_exit_to_user_mode+0x25/0x30 [ 23.117387] ? irqentry_exit+0x77/0xb0 [ 23.117593] ? exc_page_fault+0x92/0x140 [ 23.117806] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 [ 23.118081] RIP: 0033:0x7f744aee2bba [ 23.118282] Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89 [ 23.119237] RSP: 002b:00007ffd04a7c9f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c [ 23.119644] RAX: ffffffffffffffda RBX: 00007ffd04a7e0a0 RCX: 00007f744aee2bba [ 23.120023] RDX: 0000000000000040 RSI: 000056488e9e6300 RDI: 0000000000000003 [ 23.120413] RBP: 000056488e9e6300 R08: 00007ffd04a80320 R09: 0000000000000010 [ 23.120809] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000040 [ 23.121219] R13: 00007ffd04a7dc38 R14: 00007ffd04a7ca00 R15: 00007ffd04a7e0a0 [ 23.121617] </TASK> [ 23.121749] [ 23.121845] The buggy address belongs to the virtual mapping at [ 23.121845] [ffffc90000000000, ffffc90000009000) created by: [ 23.121845] irq_init_percpu_irqstack+0x1cf/0x270 [ 23.122707] [ 23.122803] The buggy address belongs to the physical page: [ 23.123104] page:0000000072ac19f0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24a09 [ 23.123609] flags: 0xfffffc0001000(reserved|node=0|zone=1|lastcpupid=0x1fffff) [ 23.123998] page_type: 0xffffffff() [ 23.124194] raw: 000fffffc0001000 ffffea0000928248 ffffea0000928248 0000000000000000 [ 23.124610] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 [ 23.125023] page dumped because: kasan: bad access detected [ 23.125326] [ 23.125421] Memory state around the buggy address: [ 23.125682] ffffc90000007800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 23.126072] ffffc90000007880: 00 00 00 00 00 f1 f1 f1 f1 f1 f1 00 00 f2 f2 00 [ 23.126455] >ffffc90000007900: 00 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00 00 00 [ 23.126840] ^ [ 23.127138] ffffc90000007980: 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 [ 23.127522] ffffc90000007a00: f3 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 [ 23.127906] ================================================================== [ 23.128324] Disabling lock debugging due to kernel taint
Using simple s16 pointers for the 16-bit accesses fixes the problem. For the 32-bit accesses, src and dst can be used directly.
--- net/netfilter/nft_byteorder.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/netfilter/nft_byteorder.c +7 -7
@@ -30,11 +30,11 @@ void nft_byteorder_eval(const struct nftconst struct nft_byteorder *priv =nft_expr_priv (expr);u32 *src = ®s->data[priv->sreg];u32 *dst = ®s->data[priv->dreg]; -union {u32 u32;u16 u16; } *s, *d; +u16 *s16, *d16;unsigned int i; - s = (void *)src; - d = (void *)dst; + s16 = (void *)src; + d16 = (void *)dst;switch (priv->size) {case 8 : {
@@ -62,11 +62,11 @@ void nft_byteorder_eval(const struct nftswitch (priv->op) {case NFT_BYTEORDER_NTOH :for (i =0 ; i < priv->len /4 ; i++) - d[i].u32 =ntohl ((__force __be32 )s[i].u32); + dst[i] =ntohl ((__force __be32 )src[i]);break ;case NFT_BYTEORDER_HTON :for (i =0 ; i < priv->len /4 ; i++) - d[i].u32 = (__force __u32 )htonl (s[i].u32); + dst[i] = (__force __u32 )htonl (src[i]);break ; }break ;
@@ -74,11 +74,11 @@ void nft_byteorder_eval(const struct nftswitch (priv->op) {case NFT_BYTEORDER_NTOH :for (i =0 ; i < priv->len /2 ; i++) - d[i].u16 =ntohs ((__force __be16 )s[i].u16); + d16[i] =ntohs ((__force __be16 )s16[i]);break ;case NFT_BYTEORDER_HTON :for (i =0 ; i < priv->len /2 ; i++) - d[i].u16 = (__force __u16 )htons (s[i].u16); + d16[i] = (__force __u16 )htons (s16[i]);break ; }break ;
Greg Kroah-Hartman
maintainerPATCH 797/800 wireguard: queueing: use saner cpu selection wrapping
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit 7387943fa35516f6f8017a3b0e9ce48a3bef9faa upstream.
Using % nr_cpumask_bits is slow and complicated, and not totally robust toward dynamic changes to CPU topologies. Rather than storing the next CPU in the round-robin, just store the last one, and also return that value. This simplifies the loop drastically into a much more common pattern.
--- drivers/net/wireguard/queueing.c | 1 + drivers/net/wireguard/queueing.h | 25 +++++++++++-------------- drivers/net/wireguard/receive.c | 2 +- drivers/net/wireguard/send.c | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-)
drivers/net/wireguard/queueing.c +1 -0
@@ -28,6 +28,7 @@ int wg_packet_queue_init(struct crypt_quint ret;memset (queue,0 ,sizeof (*queue)); + queue->last_cpu =-1 ; ret =ptr_ring_init (&queue->ring, len,GFP_KERNEL );if (ret)return ret;
drivers/net/wireguard/queueing.h +11 -14
@@ -117,20 +117,17 @@ static inline int wg_cpumask_choose_onlireturn cpu; } -/* This function is racy, in the sense that next is unlocked, so it could return -* the same CPU twice. A race-free version of this would be to instead store an -* atomic sequence number, do an increment-and-return, and then iterate through -* every possible CPU until we get to that index -- choose_cpu. However that's -* a bit slower, and it doesn't seem like this potential race actually -* introduces any performance loss, so we live with it. +/* This function is racy, in the sense that it's called while last_cpu is +* unlocked, so it could return the same CPU twice. Adding locking or using +* atomic sequence numbers is slower though, and the consequences of racing are +* harmless, so live with it. */ -static inline int wg_cpumask_next_online (int *next) +static inline int wg_cpumask_next_online (int *last_cpu) { -int cpu = *next; - -while (unlikely (!cpumask_test_cpu (cpu, cpu_online_mask))) - cpu =cpumask_next (cpu, cpu_online_mask) % nr_cpumask_bits; - *next =cpumask_next (cpu, cpu_online_mask) % nr_cpumask_bits; +int cpu =cpumask_next (*last_cpu, cpu_online_mask); +if (cpu >= nr_cpu_ids) + cpu =cpumask_first (cpu_online_mask); + *last_cpu = cpu;return cpu; }
@@ -159,7 +156,7 @@ static inline void wg_prev_queue_drop_pestatic inline int wg_queue_enqueue_per_device_and_peer (struct crypt_queue *device_queue,struct prev_queue *peer_queue, -struct sk_buff *skb,struct workqueue_struct *wq,int *next_cpu) +struct sk_buff *skb,struct workqueue_struct *wq) {int cpu;
@@ -173,7 +170,7 @@ static inline int wg_queue_enqueue_per_d/* Then we queue it up in the device queue, which consumes the * packet as soon as it can. */ - cpu =wg_cpumask_next_online (next_cpu); + cpu =wg_cpumask_next_online (&device_queue->last_cpu);if (unlikely (ptr_ring_produce_bh (&device_queue->ring, skb)))return -EPIPE ;queue_work_on (cpu, wq, &per_cpu_ptr (device_queue->worker, cpu)->work);
drivers/net/wireguard/receive.c +1 -1
@@ -524,7 +524,7 @@ static void wg_packet_consume_data(struc goto err; ret =wg_queue_enqueue_per_device_and_peer (&wg->decrypt_queue, &peer->rx_queue, skb, - wg->packet_crypt_wq, &wg->decrypt_queue.last_cpu); + wg->packet_crypt_wq);if (unlikely (ret == -EPIPE ))wg_queue_enqueue_per_peer_rx (skb,PACKET_STATE_DEAD );if (likely (!ret || ret == -EPIPE )) {
drivers/net/wireguard/send.c +1 -1
@@ -318,7 +318,7 @@ static void wg_packet_create_data(struct goto err; ret =wg_queue_enqueue_per_device_and_peer (&wg->encrypt_queue, &peer->tx_queue, first, - wg->packet_crypt_wq, &wg->encrypt_queue.last_cpu); + wg->packet_crypt_wq);if (unlikely (ret == -EPIPE ))wg_queue_enqueue_per_peer_tx (first,PACKET_STATE_DEAD ); err:
Greg Kroah-Hartman
maintainerPATCH 798/800 wireguard: netlink: send staged packets when setting initial private key
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit f58d0a9b4c6a7a5199c3af967e43cc8b654604d4 upstream.
Packets bound for peers can queue up prior to the device private key being set. For example, if persistent keepalive is set, a packet is queued up to be sent as soon as the device comes up. However, if the private key hasn't been set yet, the handshake message never sends, and no timer is armed to retry, since that would be pointless.
But, if a user later sets a private key, the expectation is that those queued packets, such as a persistent keepalive, are actually sent. So adjust the configuration logic to account for this edge case, and add a test case to make sure this works.
Maxim noticed this with a wg-quick(8) config to the tune of:
[Interface]
PostUp = wg set %i private-key somefile
[Peer]
PublicKey = ...
Endpoint = ...
PersistentKeepalive = 25Here, the private key gets set after the device comes up using a PostUp script, triggering the bug.
--- drivers/net/wireguard/netlink.c | 14 ++++++++----- tools/testing/selftests/wireguard/netns.sh | 30 +++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 9 deletions(-)
drivers/net/wireguard/netlink.c +9 -5
@@ -546,6 +546,7 @@ static int wg_set_device(struct sk_buffu8 *private_key =nla_data (info->attrs[WGDEVICE_A_PRIVATE_KEY ]);u8 public_key[NOISE_PUBLIC_KEY_LEN ];struct wg_peer *peer, *temp; +bool send_staged_packets;if (!crypto_memneq (wg->static_identity.static_private, private_key,NOISE_PUBLIC_KEY_LEN ))
@@ -564,14 +565,17 @@ static int wg_set_device(struct sk_buff }down_write (&wg->static_identity.lock); -wg_noise_set_static_identity_private_key (&wg->static_identity, - private_key); -list_for_each_entry_safe (peer, temp, &wg->peer_list, - peer_list) { + send_staged_packets = !wg->static_identity.has_identity &&netif_running (wg->dev); +wg_noise_set_static_identity_private_key (&wg->static_identity, private_key); + send_staged_packets = send_staged_packets && wg->static_identity.has_identity; + +wg_cookie_checker_precompute_device_keys (&wg->cookie_checker); +list_for_each_entry_safe (peer, temp, &wg->peer_list, peer_list) {wg_noise_precompute_static_static (peer);wg_noise_expire_current_peer_keypairs (peer); +if (send_staged_packets) +wg_packet_send_staged_packets (peer); } -wg_cookie_checker_precompute_device_keys (&wg->cookie_checker);up_write (&wg->static_identity.lock); } skip_set_private_key:
tools/testing/selftests/wireguard/netns.sh +26 -4
@@ -514,10 +514,32 @@ n2 bash -c 'printf 0 > /proc/sys/net/ipv n1 ping -W 1 -c 1 192.168.241.2 [[ $(n2 wg show wg0 endpoints) == "$pub1 10.0.0.3:1" ]] -ip1 link del veth1 -ip1 link del veth3 -ip1 link del wg0 -ip2 link del wg0 +ip1 link del dev veth3 +ip1 link del dev wg0 +ip2 link del dev wg0 + +# Make sure persistent keep alives are sent when an adapter comes up +ip1 link add dev wg0 type wireguard +n1 wg set wg0 private-key <(echo "$key1") peer "$pub2" endpoint 10.0.0.1:1 persistent-keepalive 1 +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -eq 0 ]] +ip1 link set dev wg0 up +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -gt 0 ]] +ip1 link del dev wg0 +# This should also happen even if the private key is set later +ip1 link add dev wg0 type wireguard +n1 wg set wg0 peer "$pub2" endpoint 10.0.0.1:1 persistent-keepalive 1 +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -eq 0 ]] +ip1 link set dev wg0 up +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -eq 0 ]] +n1 wg set wg0 private-key <(echo "$key1") +read _ _ tx_bytes < <(n1 wg show wg0 transfer) +[[ $tx_bytes -gt 0 ]] +ip1 link del dev veth1 +ip1 link del dev wg0 # We test that Netlink/IPC is working properly by doing things that usually cause split responses ip0 link add dev wg0 type wireguard
Greg Kroah-Hartman
maintainerPATCH 799/800 tty: serial: fsl_lpuart: add earlycon for imx8ulp platform
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
commit e0edfdc15863ec80a1d9ac6e174dbccc00206dd0 upstream.
Add earlycon support for imx8ulp platform.
--- drivers/tty/serial/fsl_lpuart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/fsl_lpuart.c +1 -0
@@ -2676,6 +2676,7 @@ OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lOF_EARLYCON_DECLARE (lpuart32,"fsl,ls1021a-lpuart" , lpuart32_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,ls1028a-lpuart" , ls1028a_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,imx7ulp-lpuart" , lpuart32_imx_early_console_setup); +OF_EARLYCON_DECLARE (lpuart32,"fsl,imx8ulp-lpuart" , lpuart32_imx_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,imx8qxp-lpuart" , lpuart32_imx_early_console_setup);OF_EARLYCON_DECLARE (lpuart32,"fsl,imxrt1050-lpuart" , lpuart32_imx_early_console_setup);EARLYCON_DECLARE (lpuart, lpuart_early_console_setup);
Greg Kroah-Hartman
maintainerPATCH 800/800 io_uring: Use io_schedule* in cqring wait
In reply to Greg Kroah-HartmanFrom: Andres Freund <[email protected]>
commit 8a796565cec3601071cbbd27d6304e202019d014 upstream.
I observed poor performance of io_uring compared to synchronous IO. That turns out to be caused by deeper CPU idle states entered with io_uring, due to io_uring using plain schedule(), whereas synchronous IO uses io_schedule().
The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0 /mnt/t2/fio/write.0.0
This is repeatable with different filesystems, using raw block devices and using different block devices.
Use io_schedule_prepare() / io_schedule_finish() in io_cqring_wait_schedule() to address the difference.
After that using io_uring is on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).
There are other calls to schedule() in io_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible that mutex_lock_io() should be used, but it's not clear if there are cases where that matters.
--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
io_uring/io_uring.c +13 -2
@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))
@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/*
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Hello.
Quoted 66 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +10
-0@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )
io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 10 lines
io_uring/io_uring.c +3
-2schedule (); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/*
Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Please check.
Thanks.
[1] https://bbs.archlinux.org/viewtopic.php?id=287343
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217700
[3] https://bugzilla.kernel.org/show_bug.cgi?id=217699
Signature · 1 line
Oleksandr Natalenko (post-factum)
Greg Kroah-Hartman
maintainerRe: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 78 lines · Oleksandr Natalenko
Hello.
Quoted 75 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +13
-2@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }
Quoted 7 lines
io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 1 line
io_uring/io_uring.c +0
-0/* Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Please check.
Is this also an issue in 6.5-rc2?
thanks,
greg k-h
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 83 lines · On neděle 23. července 2023 12:50:30 CEST Greg Kroah-Hartman wrote:
Quoted 82 lines · Oleksandr Natalenko
Hello.
Quoted 66 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +10
-0@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 10 lines
io_uring/io_uring.c +3
-2schedule (); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/* Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Quoted 5 lines
Quoted 3 lines
Reverting this commit fixes the issue.
Please check.
Is this also an issue in 6.5-rc2?
As per [1], yes.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=217699#c4
Quoted 5 lines
thanks,
greg k-h
Signature · 1 line
Oleksandr Natalenko (post-factum)
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Oleksandr Natalenko
Hello.
Quoted 5 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That
...
Quoted 5 lines
Quoted 5 lines
Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Quoted 7 lines
Quoted 1 line
Please check.
Is this also an issue in 6.5-rc2?
thanks,
greg k-h
Yes - I can confirm this issue is in 6.5-rc2 and with Linus' commit c2782531397f5cb19ca3f8f9c17727f1cdf5bee8.
gene
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Oleksandr Natalenko[CCing the regression list, as it should be in the loop for regressions:
https://docs.kernel.org/admin-guide/reporting-regressions.html]
[TLDR: I'm adding this report to the list of tracked Linux kernel regressions; the text you find below is based on a few templates paragraphs you might have encountered already in similar form. See link in footer if these mails annoy you.]
Quoted 20 lines · Oleksandr Natalenko
Quoted 9 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().Quoted 5 lines
The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Quoted 7 lines
Please check.
Thanks.
[1] https://bbs.archlinux.org/viewtopic.php?id=287343
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217700
[3] https://bugzilla.kernel.org/show_bug.cgi?id=217699
Thanks for the report. To be sure the issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, the Linux kernel regression tracking bot:
#regzbot introduced 8a796565cec360107 ^
https://bbs.archlinux.org/viewtopic.php?id=287343
https://bugzilla.kernel.org/show_bug.cgi?id=217700
https://bugzilla.kernel.org/show_bug.cgi?id=217699
#regzbot title block: io_uring: high iowait rates and stalls #regzbot ignore-activity
This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply and tell me -- ideally while also telling regzbot about it, as explained by the page listed in the footer of this mail.
Developers: When fixing the issue, remember to add 'Link:' tags pointing to the report (the parent of this mail). See page linked in footer for details.
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 11 lines · Linux regression tracking #adding (Thorsten Leemhuis)
Quoted 9 lines · Oleksandr Natalenko
Quoted 8 lines · On neděle 16. července 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().
Quoted 6 lines
#regzbot introduced
8a796565cec360107^
https://bbs.archlinux.org/viewtopic.php?id=287343
https://bugzilla.kernel.org/show_bug.cgi?id=217700
https://bugzilla.kernel.org/show_bug.cgi?id=217699
#regzbot title block:io_uring: high iowait rates and stalls #regzbot ignore-activity
Apparently expected behavior:
https://lore.kernel.org/lkml/[email protected]/
#regzbot resolve: notabug: on a closer look it turned out that's expected behavior
Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.
#regzbot ignore-activity
Jens Axboe
maintainerRe: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Oleksandr NatalenkoQuoted 84 lines · Oleksandr Natalenko
Hello.
Quoted 66 lines · On ned?le 16. ?ervence 2023 21:50:53 CEST Greg Kroah-Hartman wrote:
From: Andres Freund <[email protected]>
commit
8a796565cec3601071cbbd27d6304e202019d014upstream.I observed poor performance of
io_uringcompared to synchronous IO. That turns out to be caused by deeper CPU idle states entered withio_uring, due toio_uringusing plainschedule(), whereas synchronous IO usesio_schedule().The losses due to this are substantial. On my cascade lake workstation, t/io_uring from the fio repository e.g. yields regressions between 20% and 40% with the following command:
./t/io_uring -r 5 -X0 -d 1 -s 1 -c 1 -p 0 -S$use_sync -R 0/mnt/t2/fio/write.0.0This is repeatable with different filesystems, using raw block devices and using different block devices.
Use
io_schedule_prepare()/io_schedule_finish()inio_cqring_wait_schedule()to address the difference.After that using
io_uringis on par or surpassing synchronous IO (using registered files etc makes it reliably win, but arguably is a less fair comparison).There are other calls to
schedule()inio_uring/, but none immediately jump out to be similarly situated, so I did not touch them. Similarly, it's possible thatmutex_lock_io()should be used, but it's not clear if there are cases where that matters.Cc [email protected] # 5.10+Cc Pavel Begunkov <[email protected]>Signed-off-by Andres Freund <[email protected]>[axboe: minor style fixup]Signed-off-by Jens Axboe <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- io_uring/io_uring.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)io_uring/io_uring.c +10
-0@@ -2575,6 +2575,8 @@ int io_run_task_work_sig(struct io_ring_static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { +int token, ret; +if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;if (unlikely (!llist_empty (&ctx->work_llist)))@@ -2585,11 +2587,20 @@ static inline int io_cqring_wait_schedulreturn -EINTR ;if (unlikely (io_should_wake (iowq)))return 0 ; + +/* +* Use io_schedule_prepare/finish, so cpufreq can take into account +* that the task is waiting for IO - turns out to be important for low +* QD IO. +*/ + token =io_schedule_prepare (); + ret =0 ;if (iowq->timeout ==KTIME_MAX )io_uring/io_uring.c static inline int io_cqring_wait_schedul · line 2606
Quoted 10 lines
io_uring/io_uring.c +3
-2schedule (); else if (!schedule_hrtimeout(&iowq->timeout, HRTIMER_MODE_ABS)) -return -ETIME ; -return 0 ; + ret = -ETIME ; +io_schedule_finish (token); +return ret; }/* Reportedly, this caused a regression as reported in [1] [2] [3]. Not only v6.4.4 is affected, v6.1.39 is affected too.
Reverting this commit fixes the issue.
Quoted 7 lines
Please check.
Thanks.
[1] https://bbs.archlinux.org/viewtopic.php?id=287343
[2] https://bugzilla.kernel.org/show_bug.cgi?id=217700
[3] https://bugzilla.kernel.org/show_bug.cgi?id=217699
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Signature · 1 line
Jens Axboe
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
On 7/23/23 11:31, Jens Axboe wrote:
...
Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100
# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
# systemctl start mariadb (iowaits -> 100%)
# iotop -bo |grep maria (shows no output, iowait stays 100%)
(this persists until mariadb process exits)
# systemctl stop mariadb (iowait drops to 0%)
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Hello.
Quoted 28 lines · On neděle 23. července 2023 19:43:50 CEST Genes Lists wrote:
On 7/23/23 11:31, Jens Axboe wrote:
...Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql# systemctl start mariadb (iowaits -> 100%)
Quoted 6 lines
# iotop -bo |grep maria (shows no output, iowait stays 100%)(this persists until mariadb process exits)
# systemctl stop mariadb (iowait drops to 0%)
This is a visible userspace behaviour change with no changes in the userspace itself, so we cannot just ignore it. If for some reason this is how it should be now, how do we explain it to MariaDB devs to get this fixed?
Thanks.
Signature · 1 line
Oleksandr Natalenko (post-factum)
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Hi,
Quoted 34 lines · Oleksandr Natalenko
Quoted 33 lines · On neděle 23. července 2023 19:43:50 CEST Genes Lists wrote:
On 7/23/23 11:31, Jens Axboe wrote:
...Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql# systemctl start mariadb (iowaits -> 100%)# iotop -bo |grep maria (shows no output, iowait stays 100%)(this persists until mariadb process exits)
Quoted 6 lines
Quoted 1 line
# systemctl stop mariadb (iowait drops to 0%)This is a visible userspace behaviour change with no changes in the userspace itself, so we cannot just ignore it. If for some reason this is how it should be now, how do we explain it to MariaDB devs to get this fixed?
Just to confirm I understand: Your concern is how it looks in mpstat, not performance or anything like that?
As far as I can tell, mariadb submits a bunch of IOs, which all have completed:
...
mariadbd 438034 [000] 67593.094595: io_uring:io_uring_submit_req: ring 0xffff8887878ac800, req 0xffff888929df2400, user_data 0x55d5eaf29488, opcode READV, flags 0x0, sq_thread 0
mariadbd 438034 [000] 67593.094604: io_uring:io_uring_submit_req: ring 0xffff8887878ac800, req 0xffff888929df2500, user_data 0x55d5eaf29520, opcode READV, flags 0x0, sq_thread 0
mariadbd 438034 [000] 67593.094690: io_uring:io_uring_complete: ring 0xffff8887878ac800, req 0xffff888929df2400, user_data 0x55d5eaf29488, result 16384, cflags 0x0 extra1 0 extra2 0
mariadbd 438034 [000] 67593.094699: io_uring:io_uring_complete: ring 0xffff8887878ac800, req 0xffff888929df2500, user_data 0x55d5eaf29520, result 16384, cflags 0x0 extra1 0 extra2 0 Then waits for io_uring events:
mariadbd 438032 [003] 67593.095282: io_uring:io_uring_cqring_wait: ring 0xffff8887878ac800, min_events 1
There won't be any completions without further IO being submitted.
io_uring could have logic to somehow report a different state in such a case (where there'll not be any completions before new IOs being submitted), but that'd likely not be free.
Greetings,
Andres Freund
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 2 lines · Andres Freund
Just to confirm I understand: Your concern is how it looks in mpstat, not performance or anything like that?
Right - there is no performance issue or any other issue to my knowledge and cores are idle.
So, as you said, its just a small reporting item - which is now quite clear.
thank you.
gene
Jens Axboe
maintainerRe: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
In reply to Oleksandr NatalenkoQuoted 36 lines · Oleksandr Natalenko
Hello.
Quoted 33 lines · On ned?le 23. ?ervence 2023 19:43:50 CEST Genes Lists wrote:
On 7/23/23 11:31, Jens Axboe wrote:
...Quoted 5 lines
Just read the first one, but this is very much expected. It's now just correctly reflecting that one thread is waiting on IO. IO wait being 100% doesn't mean that one core is running 100% of the time, it just means it's WAITING on IO 100% of the time.
Seems reasonable thank you.
Question - do you expect the iowait to stay high for a freshly created mariadb doing nothing (as far as I can tell anyway) until process exited? Or Would you think it would drop in this case prior to the process exiting.
For example I tried the following - is the output what you expect?
Create a fresh mariab with no databases - monitor the core showing the iowaits with:
mpstat -P ALL 2 100# rm -f /var/lib/mysql/* # mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql# systemctl start mariadb (iowaits -> 100%)# iotop -bo |grep maria (shows no output, iowait stays 100%)(this persists until mariadb process exits)
Quoted 6 lines
Quoted 1 line
# systemctl stop mariadb (iowait drops to 0%)This is a visible userspace behaviour change with no changes in the userspace itself, so we cannot just ignore it. If for some reason this is how it should be now, how do we explain it to MariaDB devs to get this fixed?
It's not a behavioural change, it's a reporting change. There's no functionality changing here. That said, I do think we should narrow it a bit so we're only marked as in iowait if the task waiting has pending IO. That should still satisfy the initial problem, and it won't flag iowait on mariadb like cases where they have someone else just perpetually waiting on requests.
As a side effect, this also removes the flush that wasn't at all necessary on io_uring.
If folks are able to test the below, that would be appreciated.
io_uring/io_uring.c +17 -6
@@ -2493,11 +2493,20 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx)return 0 ; } +static bool current_pending_io (void ) +{ +struct io_uring_task *tctx = current->io_uring; + +if (!tctx) +return false; +return percpu_counter_read_positive (&tctx->inflight); +} +/* when returns >0, the caller should retry */ static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { -int token, ret; +int io_wait, ret;if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;
@@ -2511,17 +2520,19 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,return 0 ;/* -* Use io_schedule_prepare/finish, so cpufreq can take into account -* that the task is waiting for IO - turns out to be important for low -* QD IO. +* Mark us as being in io_wait if we have pending requests, so cpufreq +* can take into account that the task is waiting for IO - turns out +* to be important for low QD IO. */ - token =io_schedule_prepare (); + io_wait = current->in_iowait; +if (current_pending_io ()) + current->in_iowait =1 ; ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) ret = -ETIME ; -io_schedule_finish (token); + current->in_iowait = io_wait;return ret; }
Signature · 1 line
Jens Axboe
Re: [PATCH 6.4 800/800] io_uring: Use io_schedule* in cqring wait
Quoted 55 lines · Jens Axboe
It's not a behavioural change, it's a reporting change. There's no functionality changing here. That said, I do think we should narrow it a bit so we're only marked as in iowait if the task waiting has pending IO. That should still satisfy the initial problem, and it won't flag iowait on mariadb like cases where they have someone else just perpetually waiting on requests.
As a side effect, this also removes the flush that wasn't at all necessary on
io_uring.If folks are able to test the below, that would be appreciated.
io_uring/io_uring.c +16
-5@@ -2493,11 +2493,20 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx)return 0 ; } +static bool current_pending_io (void ) +{ +struct io_uring_task *tctx = current->io_uring; + +if (!tctx) +return false; +return percpu_counter_read_positive (&tctx->inflight); +} +/* when returns >0, the caller should retry */ static inline int io_cqring_wait_schedule (struct io_ring_ctx *ctx,struct io_wait_queue *iowq) { -int token, ret; +int io_wait, ret;if (unlikely (READ_ONCE (ctx->check_cq)))return 1 ;@@ -2511,17 +2520,19 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,return 0 ;/* -* Use io_schedule_prepare/finish, so cpufreq can take into account -* that the task is waiting for IO - turns out to be important for low -* QD IO. +* Mark us as being in io_wait if we have pending requests, so cpufreq +* can take into account that the task is waiting for IO - turns out +* to be important for low QD IO. */ - token =io_schedule_prepare (); + io_wait = current->in_iowait; +if (current_pending_io ()) + current->in_iowait =1 ;
io_uring/io_uring.c static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, · line 2538
Quoted 10 lines
io_uring/io_uring.c +1
-1ret =0 ;if (iowq->timeout ==KTIME_MAX )schedule ();else if (!schedule_hrtimeout (&iowq->timeout,HRTIMER_MODE_ABS )) ret = -ETIME ; -io_schedule_finish (token); + current->in_iowait = io_wait;return ret; }
Tested on top of 6.4.6 stable - and working great - iowait stats now look like they always did.
thank you
gene
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Following kernel warnings / BUG noticed on qemu-arm64 while running Kunit / KASAN tests while booting stable rc 6.4 kernel.
Similar issues have been reported on Linux next [1].
next: qemu-arm64: kernel BUG at fs/inode.c:1763!
[1] https://lore.kernel.org/linux-mm/[email protected]/
Crash log:
---
<6>[ 928.522368] ok 67 Encryption test suite # SKIP
<6>[ 928.526361] KTAP version 1
<6>[ 928.527663] # Subtest: Handshake API tests
<6>[ 928.528569] 1..11
<6>[ 928.529461] KTAP version 1
<6>[ 928.530289] # Subtest: req_alloc API fuzzing
<6>[ 928.534580] ok 1 handshake_req_alloc NULL proto
<6>[ 928.540928] ok 2 handshake_req_alloc CLASS_NONE
<6>[ 928.546026] ok 3 handshake_req_alloc CLASS_MAX
<6>[ 928.556181] ok 4 handshake_req_alloc no callbacks
<6>[ 928.561854] ok 5 handshake_req_alloc no done callback
<6>[ 928.568591] ok 6 handshake_req_alloc excessive privsize
<6>[ 928.574197] ok 7 handshake_req_alloc all good
<6>[ 928.577290] # req_alloc API fuzzing: pass:7 fail:0 skip:0 total:7
<6>[ 928.578830] ok 1 req_alloc API fuzzing
<6>[ 928.589194] ok 2 req_submit NULL req arg
<6>[ 928.595860] ok 3 req_submit NULL sock arg
<6>[ 928.601760] ok 4 req_submit NULL sock->file
<6>[ 928.613613] ok 5 req_lookup works
<6>[ 928.621095] ok 6 req_submit max pending
<6>[ 928.627492] ok 7 req_submit multiple
<6>[ 928.633124] ok 8 req_cancel before accept
<6>[ 928.640751] ok 9 req_cancel after accept
<6>[ 928.646414] ok 10 req_cancel after done
<4>[ 928.650411] ------------[ cut here ]------------
<2>[ 928.654074] kernel BUG at fs/inode.c:1805!
<0>[ 928.655661] Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
<4>[ 928.657205] Modules linked in:
<4>[ 928.659307] CPU: 1 PID: 21 Comm: kworker/1:0 Tainted: G
N 6.4.4-rc1 #1
<4>[ 928.660829] Hardware name: linux,dummy-virt (DT)
<4>[ 928.662415] Workqueue: events delayed_fput
<4>[ 928.664806] pstate: 42400005 (nZcv daif +PAN -UAO +TCO -DIT
-SSBS BTYPE=--)
<4>[ 928.666592] pc : iput+0x2cc/0x2d0
<4>[ 928.667870] lr : iput+0x30/0x2d0
<4>[ 928.668975] sp : ffff8000081d7af0
<4>[ 928.669951] x29: ffff8000081d7af0 x28: ffff0000c094c020 x27:
00000000002e0003
<4>[ 928.672194] x26: ffff0000c4f61668 x25: ffff0000c6911590 x24:
0000000000000000
<4>[ 928.674232] x23: ffff0000c0467638 x22: ffff0000c69115b0 x21:
ffff0000c0467598
<4>[ 928.676413] x20: ffff0000c0467500 x19: ffff0000c0467500 x18:
0000000010992f9a
<4>[ 928.678485] x17: ffffa2bb7d60bc64 x16: ffffa2bb7d60c00c x15:
ffffa2bb7e7c02f4
<4>[ 928.680443] x14: ffffa2bb7d63c708 x13: ffffa2bb7d216100 x12:
0000000000000001
<4>[ 928.682505] x11: 1fffe0001808ceb1 x10: 1fffe0001808ceb3 x9 :
0000000000000000
<4>[ 928.684647] x8 : 0000000000000060 x7 : 0000000000000000 x6 :
ffffa2bb7d5c67b8
<4>[ 928.686630] x5 : ffff0000c814a6d8 x4 : 0000000000000000 x3 :
ffffa2bb7ead2fec
<4>[ 928.689091] x2 : 0000000000000001 x1 : 0000000000000001 x0 :
ffff0000c0467598
<6>[ 928.690005] ok 11 req_destroy works
<4>[ 928.690476]
<6>[ 928.693528] # Handshake API tests: pass:11 fail:0 skip:0 total:11
<4>[ 928.694200] Call trace:
<4>[ 928.694404] iput+0x2cc/0x2d0
<6>[ 928.697513] # Totals: pass:17 fail:0 skip:0 total:17
<4>[ 928.697467] dentry_unlink_inode+0x220/0x240
<6>[ 928.698341] ok 68 Handshake API tests
<4>[ 928.699216] __dentry_kill+0x190/0x2a4
<4>[ 928.702948] dentry_kill+0x90/0x150
<4>[ 928.704551] dput+0xd8/0x144
<4>[ 928.706425] __fput+0x2bc/0x3cc
<4>[ 928.707982] delayed_fput+0x54/0x6c
<4>[ 928.709490] process_one_work+0x3c4/0x574
<4>[ 928.711092] worker_thread+0x488/0x83c
<4>[ 928.712551] kthread+0x1ac/0x238
<4>[ 928.714034] ret_from_fork+0x10/0x20
<0>[ 928.717103] Code: 94522f0a 17ffffec d4210000 17ffffba (d4210000)
<4>[ 928.719393] ---[ end trace 0000000000000000 ]---
<6>[ 928.721045] note: kworker/1:0[21] exited with irqs disabled
<6>[ 928.725022] note: kworker/1:0[21] exited with preempt_count 1
<6>[ 928.730067] uart-pl011 9000000.pl011: no DMA platform data
<4>[ 928.733763] ------------[ cut here ]------------
<4>[ 928.735164] WARNING: CPU: 1 PID: 0 at
kernel/context_tracking.c:128 ct_kernel_exit+0xa4/0xac
<4>[ 928.737209] Modules linked in:
<4>[ 928.738504] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D
N 6.4.4-rc1 #1
<4>[ 928.740310] Hardware name: linux,dummy-virt (DT)
<4>[ 928.741569] pstate: 224003c5 (nzCv DAIF +PAN -UAO +TCO -DIT
-SSBS BTYPE=--)
<4>[ 928.743556] pc : ct_kernel_exit+0xa4/0xac
<4>[ 928.745560] lr : ct_kernel_exit+0x14/0xac
<4>[ 928.747498] sp : ffff800008187db0
<4>[ 928.749156] x29: ffff800008187db0 x28: ffffa2bb7ff5cb38 x27:
ffffa2bb7ffdd000
<4>[ 928.751416] x26: 0000000000000002 x25: 0000000000000001 x24:
0000000000000000
<4>[ 928.753426] x23: 0000000000000000 x22: 0000000000000000 x21:
ffffa2bb7ffddb50
<4>[ 928.755520] x20: ffffa2bb7ffdda40 x19: ffff0000daea6a20 x18:
0000000010992f9a
<4>[ 928.757619] x17: 0000000000000000 x16: 0000000100000000 x15:
0000000200000002
<4>[ 928.759766] x14: 00000000ffffa2bb x13: 00000000000711d6 x12:
0000000008000000
<4>[ 928.761789] x11: 000db58580000000 x10: 4000000000000000 x9 :
4000000000000002
<4>[ 928.763942] x8 : ffffa2bb7ff5aa20 x7 : 0000000000000000 x6 :
000000000000003f
<4>[ 928.766237] x5 : 0000000000000040 x4 : 0000000000000000 x3 :
ffffa2bb7d316f00
<4>[ 928.768327] x2 : 0000000000000001 x1 : 0000000000000001 x0 :
ffff5d455af4c000
<4>[ 928.770366] Call trace:
<4>[ 928.771153] ct_kernel_exit+0xa4/0xac
<4>[ 928.772308] ct_idle_enter+0x10/0x1c
<4>[ 928.773463] default_idle_call+0x1c/0x38
<4>[ 928.774700] do_idle+0x134/0x2fc
<4>[ 928.775976] cpu_startup_entry+0x24/0x28
<4>[ 928.777255] secondary_start_kernel+0x170/0x194
<4>[ 928.778638] __secondary_switched+0xb8/0xbc
<4>[ 928.780012] ---[ end trace 0000000000000000 ]---
<6>[ 928.888117] EXT4-fs (vda): mounted filesystem488f3595-af73-4163-86f5-9256efc01ed6 ro with ordered data mode. Quota
mode: none.
Links:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.3-801-g2b7c5a626789/testrun/18368775/suite/boot/test/clang-nightly-defconfig-40bc7ee5/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.3-801-g2b7c5a626789/testrun/18368340/suite/boot/test/gcc-12-defconfig-40bc7ee5/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.4.y/build/v6.4.3-801-g2b7c5a626789/testrun/18374719/suite/boot/test/gcc-12-lkftconfig-kunit/details/
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2SfVz5dCm2BdJzRORqOHFcy7nOK/
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 22 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Quoted 8 lines
Following kernel warnings / BUG noticed on qemu-arm64 while running Kunit / KASAN tests while booting stable rc 6.4 kernel.
Similar issues have been reported on Linux next [1].
next: qemu-arm64: kernel BUG atfs/inode.c:1763!
[1] https://lore.kernel.org/linux-mm/[email protected]/
Does bisection help?
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
As I had already reported:
Building mips:allmodconfig ... failed
--------------
Error log:
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: [scripts/Makefile.lib:419: arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[4]: [scripts/Makefile.lib:419: arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
This is the same error as reported for 6.3.13-rc3, introduced with "MIPS: DTS:
CI20: Add parent supplies to ACT8600 regulators" which uses vcc_33v without introducing it (it was introduced with commit c9f4b25272843).
Guenter
Greg Kroah-Hartman
maintainerQuoted 34 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
As I had already reported:
Building mips:allmodconfig ... failed
--------------
Error log:
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[3]: [scripts/Makefile.lib:419:arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
arch/mips/boot/dts/ingenic/ci20.dts:242.19-247.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC1: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:248.18-253.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC2: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:254.18-259.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/DCDC3: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:265.17-270.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO5: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:271.18-276.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO6: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:277.20-282.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO7: Reference to non-existent node or label "vcc_33v" arch/mips/boot/dts/ingenic/ci20.dts:283.20-288.6: ERROR (phandle_references): /i2c@10050000/act8600@5a/regulators/LDO8: Reference to non-existent node or label "vcc_33v"
ERROR: Input tree has errors, aborting (use -f to force output)
make[4]: [scripts/Makefile.lib:419:arch/mips/boot/dts/ingenic/ci20.dtb] Error 2 (ignored)
Quoted 3 lines
This is the same error as reported for 6.3.13-rc3, introduced with "MIPS: DTS:
CI20: Add parent supplies to ACT8600 regulators" which usesvcc_33vwithout introducing it (it was introduced with commitc9f4b25272843).
Ah, ick, sorry, I tried to fix this up but I applied a different "fix". I'll go drop this one, and the "fix up" patch as well and push out a -rc2 soon.
thanks,
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
My CI has no complaints about 6.4,
Thanks,
Conor.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.4.4 release. There are 800 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 18 Jul 2023 19:48:07 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.4.4-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah