From: Qi Zheng <zhengqi.arch@bytedance.com>
To: Dennis Zhou <dennis@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Muchun Song <songmuchun@bytedance.com>,
tj@kernel.org, cl@linux.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, zhouchengming@bytedance.com
Subject: Re: [PATCH] percpu_ref: call wake_up_all() after percpu_ref_put() completes
Date: Fri, 8 Apr 2022 14:28:41 +0800 [thread overview]
Message-ID: <aad36908-3e95-a8c9-533d-2a39ea76cd3a@bytedance.com> (raw)
In-Reply-To: <Yk/OtIKckFprZrGx@fedora>
On 2022/4/8 1:57 PM, Dennis Zhou wrote:
> On Fri, Apr 08, 2022 at 12:14:54PM +0800, Qi Zheng wrote:
>>
>>
>> On 2022/4/8 12:10 PM, Andrew Morton wrote:
>>> On Fri, 8 Apr 2022 12:06:20 +0800 Qi Zheng <zhengqi.arch@bytedance.com> wrote:
>>>
>>>>
>>>>
>>>>>>>> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
>>>>>>>
>>>>>>> Are any users affected by this? If so, I think a Fixes tag
>>>>>>> is necessary.
>>>>>>
>>>>>> Looks all current users(blk_pre_runtime_suspend() and set_in_sync()) are
>>>>>> affected by this.
>>>>>>
>>>>>> I see that this patch has been merged into the mm tree, can Andrew help
>>>>>> me add the following Fixes tag?
>>>>>
>>>>> Andrew is helpful ;)
>>>>>
>>>>> Do you see reasons why we should backport this into -stable trees?
>>>>> It's 8 years old, so my uninformed guess is "no"?
>>>>
>>>> Hmm, although the commit 490c79a65708 add wake_up_all(), it is no
>>>> problem for the usage at that time, maybe the correct Fixes tag is the
>>>> following:
>>>>
>>>> Fixes: 210f7cdcf088 ("percpu-refcount: support synchronous switch to
>>>> atomic mode.")
>>>>
>>>> But in fact, there is no problem with it, but all current users expect
>>>> the refcount is stable after percpu_ref_switch_to_atomic_sync() returns.
>>>>
>>>> I have no idea as which Fixes tag to add.
>>>
>>> Well the solution to that problem is to add cc:stable and let Greg
>>> figure it out ;)
>>>
>>> The more serious question is "should we backport this". What is the
>>> end-user-visible impact of the bug? Do our users need the fix or not?
>>
>> The impact on the current user is that it is possible to miss an opportunity
>> to reach 0 due to the case B in the commit message:
>>
>
> Did you find this bug through code inspection or was the finding
> motivated by a production incident?
I find this bug through code inspection, because I want to use
percpu_ref_switch_to_atomic_sync()+percpu_ref_is_zero() to do something
similar.
>
> The usage in block/blk-pm.c looks problematic, but I'm guessing this is
> a really, really hard bug to trigger. You need to have the wake up be
Agree, I manually added the delay in wake_up_all() and percpu_ref_put()
to trigger the case B.
> faster than an atomic decrement. The q_usage_counter allows reinit so it
> skips the __percpu_ref_exit() call.
>
> Thanks,
> Dennis
--
Thanks,
Qi
next prev parent reply other threads:[~2022-04-08 6:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 10:33 Qi Zheng
2022-04-07 22:57 ` Andrew Morton
2022-04-08 0:39 ` Dennis Zhou
2022-04-08 1:40 ` Ming Lei
2022-04-08 2:54 ` Muchun Song
2022-04-08 3:50 ` Qi Zheng
2022-04-08 3:54 ` Andrew Morton
2022-04-08 4:06 ` Qi Zheng
2022-04-08 4:10 ` Andrew Morton
2022-04-08 4:14 ` Qi Zheng
2022-04-08 4:16 ` Qi Zheng
2022-04-08 5:57 ` Dennis Zhou
2022-04-08 6:28 ` Qi Zheng [this message]
2022-04-08 17:41 ` Tejun Heo
2022-04-08 19:19 ` Dennis Zhou
2022-04-09 0:40 ` Qi Zheng
2022-04-11 7:19 ` Qi Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aad36908-3e95-a8c9-533d-2a39ea76cd3a@bytedance.com \
--to=zhengqi.arch@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=dennis@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=songmuchun@bytedance.com \
--cc=tj@kernel.org \
--cc=zhouchengming@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox