Skip to contentSkip to conversation

Use get_online_cpus to avoid races involving CPU hotplug

PATCH Applied Silas Boyd-Wickizer 2 participants 3 messages Aug 3, 2012 – Sep 4, 2012

lore
Share & tools
lore
#1 lore raw
Quoted 4 lines · Silas Boyd-Wickizer

Hello,

This is the second version of the patches to fix races described in:

Quoted 8 lines

https://groups.google.com/forum/?fromgroups#!topic/linux.kernel/iSUDr94Qehc

The changes in this version are:

* fix commit log typo;
* prevent a race in via_cputemp_exit;
* and a new patch that prevents races during init/exit in drivers/hwmon/coretemp.c.

Hi Silas,

Good work! How did you find these?

Cheers,
Rusty.

#2 lore raw

Hi Rusty,

I used libsparse and kernel source annotations to check that code uses for_each_online_cpu in contexts with hotplug disabled
(e.g. get_online_cpus(), preempt_disable, ..). I compiled with an x86 64-bit allyesconfig, so I missed other architecture specific usages. The checker code isn't great and the results still require some manual inspection for weeding out false positives, etc:

http://pdos.csail.mit.edu/~sbw/online-checker/

Silas

Quoted 22 lines · Rusty Russell
Quoted 4 lines · Silas Boyd-Wickizer

Hello,

This is the second version of the patches to fix races described in:

Quoted 8 lines

https://groups.google.com/forum/?fromgroups#!topic/linux.kernel/iSUDr94Qehc

The changes in this version are:

* fix commit log typo;
* prevent a race in via_cputemp_exit;
* and a new patch that prevents races during init/exit in drivers/hwmon/coretemp.c.

Hi Silas,

Good work! How did you find these?

Cheers,
Rusty.