[lkml]   [2012]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[ 02/68] powerpc/xmon: Use cpumask iterator to avoid warning
    From: Greg KH <>

    3.0-stable review patch. If anyone has any objections, please let me know.


    From: Anton Blanchard <>

    commit bc1d7702910c7c7e88eb60b58429dbfe293683ce upstream.

    We have a bug report where the kernel hits a warning in the cpumask

    WARNING: at include/linux/cpumask.h:107

    Which is:
    WARN_ON_ONCE(cpu >= nr_cpumask_bits);

    The backtrace is:

    xmon is iterating through 0 to NR_CPUS. I'm not sure why we are still
    open coding this but iterating above nr_cpu_ids is definitely a bug.

    This patch iterates through all possible cpus, in case we issue a
    system reset and CPUs in an offline state call in.

    Perhaps the old code was trying to handle CPUs that were in the
    partition but were never started (eg kexec into a kernel with an
    nr_cpus= boot option). They are going to die way before we get into
    xmon since we haven't set any kernel state up for them.

    Signed-off-by: Anton Blanchard <>
    Signed-off-by: Benjamin Herrenschmidt <>
    Signed-off-by: Greg Kroah-Hartman <>

    arch/powerpc/xmon/xmon.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/arch/powerpc/xmon/xmon.c
    +++ b/arch/powerpc/xmon/xmon.c
    @@ -975,7 +975,7 @@ static int cpu_cmd(void)
    /* print cpus waiting or in xmon */
    printf("cpus stopped:");
    count = 0;
    - for (cpu = 0; cpu < NR_CPUS; ++cpu) {
    + for_each_possible_cpu(cpu) {
    if (cpumask_test_cpu(cpu, &cpus_in_xmon)) {
    if (count == 0)
    printf(" %x", cpu);

     \ /
      Last update: 2012-07-13 02:01    [W:0.025 / U:63.744 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site