linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* mm/vmstat.c: fix vmstat_update() preemption BUG
@ 2018-03-29 16:32 Christopher Lameter
  2018-03-29 17:50 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher Lameter @ 2018-03-29 16:32 UTC (permalink / raw)
  To: akpm; +Cc: Steven J. Hill, linux-mm

Just saw

commit c7f26ccfb2c31eb1bf810ba13d044fcf583232db
Author: Steven J. Hill <steven.hill@cavium.com>
Date:   Wed Mar 28 16:01:09 2018 -0700

    mm/vmstat.c: fix vmstat_update() preemption BUG

    Attempting to hotplug CPUs with CONFIG_VM_EVENT_COUNTERS enabled can
    cause vmstat_update() to report a BUG due to preemption not being
    disabled around smp_processor_id().



The fix is wrong.

vmstat_update cannot be moved to a differentprocessor and thus
preemption should be off.

vmstat_update repeatedly accesses per cpu information.

vmstat_update first checks if there are counter to be updated on the
current cpu and then updates the counters. This cannot happen if the
process can be moved to a different cpu.

The patch "switches off" preemption after the check if there are changes
to the local per cpu counter.

Lets find out what changed in the callers of vmstat_update() that caused
the BUG to be triggered.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mm/vmstat.c: fix vmstat_update() preemption BUG
  2018-03-29 16:32 mm/vmstat.c: fix vmstat_update() preemption BUG Christopher Lameter
@ 2018-03-29 17:50 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2018-03-29 17:50 UTC (permalink / raw)
  To: Christopher Lameter; +Cc: Steven J. Hill, linux-mm

On Thu, 29 Mar 2018 11:32:44 -0500 (CDT) Christopher Lameter <cl@linux.com> wrote:

> Just saw
> 
> commit c7f26ccfb2c31eb1bf810ba13d044fcf583232db
> Author: Steven J. Hill <steven.hill@cavium.com>
> Date:   Wed Mar 28 16:01:09 2018 -0700
> 
>     mm/vmstat.c: fix vmstat_update() preemption BUG
> 
>     Attempting to hotplug CPUs with CONFIG_VM_EVENT_COUNTERS enabled can
>     cause vmstat_update() to report a BUG due to preemption not being
>     disabled around smp_processor_id().
> 
> 
> 
> The fix is wrong.
> 
> vmstat_update cannot be moved to a differentprocessor and thus
> preemption should be off.
> 
> vmstat_update repeatedly accesses per cpu information.
> 
> vmstat_update first checks if there are counter to be updated on the
> current cpu and then updates the counters. This cannot happen if the
> process can be moved to a different cpu.
> 
> The patch "switches off" preemption after the check if there are changes
> to the local per cpu counter.
> 
> Lets find out what changed in the callers of vmstat_update() that caused
> the BUG to be triggered.

Yup.  Please see the discussion at
http://lkml.kernel.org/r/1520881552-25659-1-git-send-email-steven.hill@cavium.com
- I'm suspecting that it's a shortcoming in
check_preemption_disabled().  But check_preemption_disabled() does
indeed check to see if the CPU is pinned to a single CPU so that
explanation doesn't fly.  Maybe it's a glitch in the MIPS port - the
fact that it's triggered by CPU hotplugging makes me wonder if some
state got messed up.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-29 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-29 16:32 mm/vmstat.c: fix vmstat_update() preemption BUG Christopher Lameter
2018-03-29 17:50 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox