[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7efda5d2-96bf-05a4-418d-122bfdf2ce04@huaweicloud.com>
Date: Fri, 31 Mar 2023 09:08:19 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Logan Gunthorpe <logang@...tatee.com>,
Yu Kuai <yukuai1@...weicloud.com>, song@...nel.org
Cc: linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
yi.zhang@...wei.com, yangerkun@...wei.com,
"yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH v3 3/3] md: protect md_thread with rcu
Hi, Logan!
在 2023/03/31 3:35, Logan Gunthorpe 写道:
>
> A couple points:
>
> I don't think we need a double pointer here. rcu_dereference() doesn't
> actually do anything but annotate the fact that we are accessing a
> pointer protected by rcu. It does require annotations on that pointer
> (__rcu) which is checked by sparse (I suspect this patch will produce a
> lot of sparse errors from kbuild bot).
>
> I think all we need is:
>
> void md_wakeup_thread(struct md_thread __rcu *rthread)
> {
> struct md_thread *thread;
>
> rcu_read_lock();
> thread = rcu_dereference(rthread);
> ...
> rcu_read_unlock();
>
> }
>
> The __rcu annotation will have to be added to all the pointers this
> function is called on as well as to md_register_thread() and
> md_unregister_thread(). And anything else that uses those pointers.
> Running sparse on the code and eliminating all new errors for the patch
> is important.
Yes, you're right, I'll remove patch 2 and update patch 3. And I'll try
to run sparse before sending the new version.
Thanks,
Kuai
Powered by blists - more mailing lists