[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140214125325.GD28438@linutronix.de>
Date: Fri, 14 Feb 2014 13:53:25 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Nicholas Mc Guire <der.herr@...r.at>
Cc: linux-rt-users@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>,
Carsten Emde <C.Emde@...dl.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andreas Platschek <platschek@....tuwien.ac.at>
Subject: Re: [PATCH RT 2/5] allow preemption in alloc and free _buffer_head
* Nicholas Mc Guire | 2014-02-10 16:37:59 [+0100]:
>2a) premption induced race in __this_cpu_dec
> T1 dec:start
> T2 dec
> T1 dec:end
>
>__this_cpu_dec
> -> __this_cpu_sub
> -> __this_cpu_add
> -> __this_cpu_add_#
> -> __this_cpu_generic_to_op
> -> __this_cpu_ptr += val
>
>
>so we end up with the possibilities of
> T1 load
> T2 load
> T2 store
> T1 store
>and the increment provided by T2 would be lost. The result of which
>is that reaching the buffer_heads_over_limit threshold in recalc_bh_state
I don't like this very much. __this_cpu_inc() is not atomic as you say
and without the locking that is provided by preempt_disable() it might
lose one store in inc or dec direction. This error will never be
corrected again. That code path looks very short unless you have 4096
CPUs.
Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists