Messages in this thread | | | Subject | Re: [PATCH v3 3/3] md: protect md_thread with rcu | From | Yu Kuai <> | Date | Fri, 31 Mar 2023 14:36:22 +0800 |
| |
Hi,
在 2023/03/31 9:08, Yu Kuai 写道: > 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. >
By the way, I observed lots of sparse errors and warnings for current code, will it make sense to fix them?
Thanks, Kuai
| |