* [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
@ 2025-01-24 18:53 Pavel Begunkov
2025-01-24 20:47 ` Jens Axboe
2025-01-25 6:59 ` lizetao
0 siblings, 2 replies; 6+ messages in thread
From: Pavel Begunkov @ 2025-01-24 18:53 UTC (permalink / raw)
To: io-uring, stable; +Cc: asml.silence, Xan Charbonnet, Salvatore Bonaccorso
[ upstream commit 3181e22fb79910c7071e84a43af93ac89e8a7106 ]
There are reports of mariadb hangs, which is caused by a missing
barrier in the waking code resulting in waiters losing events.
The problem was introduced in a backport
3ab9326f93ec4 ("io_uring: wake up optimisations"),
and the change restores the barrier present in the original commit
3ab9326f93ec4 ("io_uring: wake up optimisations")
Reported by: Xan Charbonnet <[email protected]>
Fixes: 3ab9326f93ec4 ("io_uring: wake up optimisations")
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093243#99
Signed-off-by: Pavel Begunkov <[email protected]>
---
io_uring/io_uring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 9b58ba4616d40..e5a8ee944ef59 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -592,8 +592,10 @@ static inline void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
io_commit_cqring(ctx);
spin_unlock(&ctx->completion_lock);
io_commit_cqring_flush(ctx);
- if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
+ if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) {
+ smp_mb();
__io_cqring_wake(ctx);
+ }
}
void io_cq_unlock_post(struct io_ring_ctx *ctx)
--
2.47.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
2025-01-24 18:53 [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups Pavel Begunkov
@ 2025-01-24 20:47 ` Jens Axboe
2025-01-24 21:23 ` Pavel Begunkov
2025-01-25 6:59 ` lizetao
1 sibling, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2025-01-24 20:47 UTC (permalink / raw)
To: Pavel Begunkov, io-uring, stable; +Cc: Xan Charbonnet, Salvatore Bonaccorso
On 1/24/25 11:53 AM, Pavel Begunkov wrote:
> [ upstream commit 3181e22fb79910c7071e84a43af93ac89e8a7106 ]
>
> There are reports of mariadb hangs, which is caused by a missing
> barrier in the waking code resulting in waiters losing events.
>
> The problem was introduced in a backport
> 3ab9326f93ec4 ("io_uring: wake up optimisations"),
> and the change restores the barrier present in the original commit
> 3ab9326f93ec4 ("io_uring: wake up optimisations")
>
> Reported by: Xan Charbonnet <[email protected]>
> Fixes: 3ab9326f93ec4 ("io_uring: wake up optimisations")
> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093243#99
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
> io_uring/io_uring.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 9b58ba4616d40..e5a8ee944ef59 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -592,8 +592,10 @@ static inline void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
> io_commit_cqring(ctx);
> spin_unlock(&ctx->completion_lock);
> io_commit_cqring_flush(ctx);
> - if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
> + if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) {
> + smp_mb();
> __io_cqring_wake(ctx);
> + }
> }
We could probably just s/__io_cqring_wake/io_cqring_wake here to get
the same effect. Not that it really matters, it's just simpler.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
2025-01-24 20:47 ` Jens Axboe
@ 2025-01-24 21:23 ` Pavel Begunkov
2025-01-24 21:23 ` Jens Axboe
0 siblings, 1 reply; 6+ messages in thread
From: Pavel Begunkov @ 2025-01-24 21:23 UTC (permalink / raw)
To: Jens Axboe, io-uring, stable; +Cc: Xan Charbonnet, Salvatore Bonaccorso
On 1/24/25 20:47, Jens Axboe wrote:
> On 1/24/25 11:53 AM, Pavel Begunkov wrote:
>> [ upstream commit 3181e22fb79910c7071e84a43af93ac89e8a7106 ]
>>
>> There are reports of mariadb hangs, which is caused by a missing
>> barrier in the waking code resulting in waiters losing events.
>>
>> The problem was introduced in a backport
>> 3ab9326f93ec4 ("io_uring: wake up optimisations"),
>> and the change restores the barrier present in the original commit
>> 3ab9326f93ec4 ("io_uring: wake up optimisations")
>>
>> Reported by: Xan Charbonnet <[email protected]>
>> Fixes: 3ab9326f93ec4 ("io_uring: wake up optimisations")
>> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093243#99
>> Signed-off-by: Pavel Begunkov <[email protected]>
>> ---
>> io_uring/io_uring.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
>> index 9b58ba4616d40..e5a8ee944ef59 100644
>> --- a/io_uring/io_uring.c
>> +++ b/io_uring/io_uring.c
>> @@ -592,8 +592,10 @@ static inline void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
>> io_commit_cqring(ctx);
>> spin_unlock(&ctx->completion_lock);
>> io_commit_cqring_flush(ctx);
>> - if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
>> + if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) {
>> + smp_mb();
>> __io_cqring_wake(ctx);
>> + }
>> }
>
> We could probably just s/__io_cqring_wake/io_cqring_wake here to get
> the same effect. Not that it really matters, it's just simpler.
Right, I noticed but am keeping it closer to the original
in case we'd need to port more in the future.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
2025-01-24 21:23 ` Pavel Begunkov
@ 2025-01-24 21:23 ` Jens Axboe
0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2025-01-24 21:23 UTC (permalink / raw)
To: Pavel Begunkov, io-uring, stable; +Cc: Xan Charbonnet, Salvatore Bonaccorso
On 1/24/25 2:23 PM, Pavel Begunkov wrote:
> On 1/24/25 20:47, Jens Axboe wrote:
>> On 1/24/25 11:53 AM, Pavel Begunkov wrote:
>>> [ upstream commit 3181e22fb79910c7071e84a43af93ac89e8a7106 ]
>>>
>>> There are reports of mariadb hangs, which is caused by a missing
>>> barrier in the waking code resulting in waiters losing events.
>>>
>>> The problem was introduced in a backport
>>> 3ab9326f93ec4 ("io_uring: wake up optimisations"),
>>> and the change restores the barrier present in the original commit
>>> 3ab9326f93ec4 ("io_uring: wake up optimisations")
>>>
>>> Reported by: Xan Charbonnet <[email protected]>
>>> Fixes: 3ab9326f93ec4 ("io_uring: wake up optimisations")
>>> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093243#99
>>> Signed-off-by: Pavel Begunkov <[email protected]>
>>> ---
>>> io_uring/io_uring.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
>>> index 9b58ba4616d40..e5a8ee944ef59 100644
>>> --- a/io_uring/io_uring.c
>>> +++ b/io_uring/io_uring.c
>>> @@ -592,8 +592,10 @@ static inline void __io_cq_unlock_post_flush(struct io_ring_ctx *ctx)
>>> io_commit_cqring(ctx);
>>> spin_unlock(&ctx->completion_lock);
>>> io_commit_cqring_flush(ctx);
>>> - if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
>>> + if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) {
>>> + smp_mb();
>>> __io_cqring_wake(ctx);
>>> + }
>>> }
>>
>> We could probably just s/__io_cqring_wake/io_cqring_wake here to get
>> the same effect. Not that it really matters, it's just simpler.
>
> Right, I noticed but am keeping it closer to the original
> in case we'd need to port more in the future.
Yep that's fine, let's just go with this one as-is.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
2025-01-24 18:53 [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups Pavel Begunkov
2025-01-24 20:47 ` Jens Axboe
@ 2025-01-25 6:59 ` lizetao
2025-01-30 8:51 ` Greg KH
1 sibling, 1 reply; 6+ messages in thread
From: lizetao @ 2025-01-25 6:59 UTC (permalink / raw)
To: Pavel Begunkov, [email protected], [email protected]
Cc: Xan Charbonnet, Salvatore Bonaccorso
> -----Original Message-----
> From: Pavel Begunkov <[email protected]>
> Sent: Saturday, January 25, 2025 2:54 AM
> To: [email protected]; [email protected]
> Cc: [email protected]; Xan Charbonnet <[email protected]>;
> Salvatore Bonaccorso <[email protected]>
> Subject: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
>
> [ upstream commit 3181e22fb79910c7071e84a43af93ac89e8a7106 ]
>
> There are reports of mariadb hangs, which is caused by a missing barrier in the
> waking code resulting in waiters losing events.
>
> The problem was introduced in a backport
> 3ab9326f93ec4 ("io_uring: wake up optimisations"), and the change restores
> the barrier present in the original commit
> 3ab9326f93ec4 ("io_uring: wake up optimisations")
>
> Reported by: Xan Charbonnet <[email protected]>
> Fixes: 3ab9326f93ec4 ("io_uring: wake up optimisations")
> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093243#99
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
> io_uring/io_uring.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index
> 9b58ba4616d40..e5a8ee944ef59 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -592,8 +592,10 @@ static inline void __io_cq_unlock_post_flush(struct
> io_ring_ctx *ctx)
> io_commit_cqring(ctx);
> spin_unlock(&ctx->completion_lock);
> io_commit_cqring_flush(ctx);
> - if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
> + if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) {
> + smp_mb();
> __io_cqring_wake(ctx);
> + }
> }
>
> void io_cq_unlock_post(struct io_ring_ctx *ctx)
> --
> 2.47.1
>
Reviewed-by: Li Zetao <[email protected]>
--
Li Zetao
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
2025-01-25 6:59 ` lizetao
@ 2025-01-30 8:51 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2025-01-30 8:51 UTC (permalink / raw)
To: lizetao
Cc: Pavel Begunkov, [email protected], [email protected],
Xan Charbonnet, Salvatore Bonaccorso
On Sat, Jan 25, 2025 at 06:59:06AM +0000, lizetao wrote:
>
>
> > -----Original Message-----
> > From: Pavel Begunkov <[email protected]>
> > Sent: Saturday, January 25, 2025 2:54 AM
> > To: [email protected]; [email protected]
> > Cc: [email protected]; Xan Charbonnet <[email protected]>;
> > Salvatore Bonaccorso <[email protected]>
> > Subject: [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups
> >
> > [ upstream commit 3181e22fb79910c7071e84a43af93ac89e8a7106 ]
> >
> > There are reports of mariadb hangs, which is caused by a missing barrier in the
> > waking code resulting in waiters losing events.
> >
> > The problem was introduced in a backport
> > 3ab9326f93ec4 ("io_uring: wake up optimisations"), and the change restores
> > the barrier present in the original commit
> > 3ab9326f93ec4 ("io_uring: wake up optimisations")
> >
> > Reported by: Xan Charbonnet <[email protected]>
> > Fixes: 3ab9326f93ec4 ("io_uring: wake up optimisations")
> > Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1093243#99
> > Signed-off-by: Pavel Begunkov <[email protected]>
> > ---
> > io_uring/io_uring.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index
> > 9b58ba4616d40..e5a8ee944ef59 100644
> > --- a/io_uring/io_uring.c
> > +++ b/io_uring/io_uring.c
> > @@ -592,8 +592,10 @@ static inline void __io_cq_unlock_post_flush(struct
> > io_ring_ctx *ctx)
> > io_commit_cqring(ctx);
> > spin_unlock(&ctx->completion_lock);
> > io_commit_cqring_flush(ctx);
> > - if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
> > + if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) {
> > + smp_mb();
> > __io_cqring_wake(ctx);
> > + }
> > }
> >
> > void io_cq_unlock_post(struct io_ring_ctx *ctx)
> > --
> > 2.47.1
> >
>
> Reviewed-by: Li Zetao <[email protected]>
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-30 8:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24 18:53 [PATCH stable-6.1 1/1] io_uring: fix waiters missing wake ups Pavel Begunkov
2025-01-24 20:47 ` Jens Axboe
2025-01-24 21:23 ` Pavel Begunkov
2025-01-24 21:23 ` Jens Axboe
2025-01-25 6:59 ` lizetao
2025-01-30 8:51 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox