[dm-devel] dm-crypt: remove per-cpu structure

Mike Snitzer snitzer at redhat.com
Thu Feb 20 23:59:35 UTC 2014


On Thu, Feb 20 2014 at  6:01pm -0500,
Mikulas Patocka <mpatocka at redhat.com> wrote:

> Dm-crypt used per-cpu structures to hold pointers to ablkcipher_request.
> The code assumed that the work item keeps executing on a single CPU, so it
> used no synchronization when accessing this structure.
> 
> When we disable a CPU by writing zero to
> /sys/devices/system/cpu/cpu*/online, the work item could be moved to
> another CPU. This causes crashes in dm-crypt because the code starts using
> a wrong ablkcipher_request.
> 
> This patch fixes this bug by removing the percpu definition. The structure
> ablkcipher_request is accessed via a pointer from convert_context.
> Consequently, if the work item is rescheduled to a different CPU, the
> thread still uses the same ablkcipher_request.

Hi Mikulas,

Obviously avoiding crashes is more important than performance.

But are we losing performance by switching away from using percpu?  Do
we care?  I'd like to see the header to speak to the potential for
slowdown (if there is any).




More information about the dm-devel mailing list