RFC Introduce checks for preemptable code for this_cpu_read/write()
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest5 patches 67 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | x86: Remove const_udelay() caring about which cpu var it usesarch/ | +1 | 2 replies | |
| 2/5 | mm: Switch mod_state() to __this_cpu_read()mm/ | +2 | 18 replies | |
| 3/5 | memcg: Disable preemption in memcg_check_events()mm/ | +2 | 4 replies | |
| 4/5 | printk: Have wake_up_klogd() use __this_cpu_write()kernel/ | +1 | 4 replies | |
| 5/5 | percpu: Add preempt checks back into this_cpu_read/write()include/ | +15 | 0 replies |
Reviews trailers per patch
2 of 5 patches have a Reviewed-by or Acked-by.
| Patch | KAMEZAWA Hiroyuki | Balbir Singh | Christoph Lameter |
|---|---|---|---|
| 1/5 | |||
| 2/5 | |||
| 3/5 | A-b | A-b | |
| 4/5 | R-b | ||
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [RFC][PATCH 0/5] Introduce checks for preemptable code for this_cpu_read/write()
I just found out that the this_cpu_*() functions do not perform the test to see if the usage is in atomic or not. Thus, the blind conversion of the per_cpu(*, smp_processor_id()) and the get_cpu_var() code to this_cpu_*() introduce the regression to detect the hard to find case where a per cpu variable is used in preempt code that migrates and causes bugs.
I'm adding back a simple call to smp_processor_id() to this_cpu_read() and this_cpu_write() to see what errors I find. I found 4 places that required touch up. 3 were areas that the race is known and we don't care, but the memcg looks very buggy.
Anyway, if I had known that the this_cpu_*() code removed this smp_processor_id() check, I would have NAK'd all the changes to the tracing code.
I only modified this_cpu_read and *_write() I may decide other this_cpu_* code should be updated too. Especially the ones that return a value.
-- Steve
Steven Rostedt (5):
x86: Remove const_udelay() caring about which cpu var it uses
mm: Switch mod_state() to __this_cpu_read()
memcg: Disable preemption in memcg_check_events()
printk: Have wake_up_klogd() use __this_cpu_write()
percpu: Add preempt checks back into this_cpu_read/write()
----
arch/x86/lib/delay.c | 2 +- include/linux/percpu.h | 17 +++++++++++++++-- kernel/printk.c | 2 +- mm/memcontrol.c | 2 ++ mm/vmstat.c | 4 ++-- 5 files changed, 21 insertions(+), 6 deletions(-)