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.