lkml.org 
[lkml]   [2014]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] percpu-refcount: fix usage of this_cpu_ops (was Re: hanging aio process)
On Wed, Jun 04, 2014 at 03:58:24PM +0200, Sebastian Ott wrote:
> From 82295633cad58c7d6b9af4e470e3168ed43a6779 Mon Sep 17 00:00:00 2001
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> Date: Wed, 4 Jun 2014 12:53:19 +0200
> Subject: [PATCH] percpu-refcount: fix usage of this_cpu_ops
>
> The percpu-refcount infrastructure uses the underscore variants of
> this_cpu_ops in order to modify percpu reference counters.
> (e.g. __this_cpu_inc()).
>
> However the underscore variants do not atomically update the percpu
> variable, instead they may be implemented using read-modify-write
> semantics (more than one instruction). Therefore it is only safe to
> use the underscore variant if the context is always the same (process,
> softirq, or hardirq). Otherwise it is possible to lose updates.
>
> This problem is something that Sebastian has seen within the aio
> subsystem which uses percpu refcounters both in process and softirq
> context leading to reference counts that never dropped to zeroes; even
> though the number of "get" and "put" calls matched.
>
> Fix this by using the non-underscore this_cpu_ops variant which
> provides correct per cpu atomic semantics and fixes the corrupted
> reference counts.
>
> Cc: Kent Overstreet <kmo@daterainc.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: <stable@vger.kernel.org> # v3.11+
> Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Bah... should have caught it way back. Sorry about that. Appying to
percpu/for-3.15-fixes with stable cc'd.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2014-06-06 15:01    [W:0.254 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site