sched/vtime: Prevent unstable evaluation of WARN(vtime->state)
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 23 Jan 2020 18:08:49 +0000 (19:08 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 6 Mar 2020 11:57:16 +0000 (12:57 +0100)
commitf1dfdab694eb3838ac26f4b73695929c07d92a33
tree37791cfddf0e1e76792321e96271bf86cbe9c5bf
parent1b10d388d094bb32129060236add6f50b204a69d
sched/vtime: Prevent unstable evaluation of WARN(vtime->state)

As the vtime is sampled under loose seqcount protection by kcpustat, the
vtime fields may change as the code flows. Where logic dictates a field
has a static value, use a READ_ONCE.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Fixes: 74722bb223d0 ("sched/vtime: Bring up complete kcpustat accessor")
Link: https://lkml.kernel.org/r/20200123180849.28486-1-frederic@kernel.org
kernel/sched/cputime.c