lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 16 Dec 2009 17:07:11 +0800
From:	Xiaotian Feng <xtfeng@...il.com>
To:	Sachin Sant <sachinp@...ibm.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	"Linux/PPC Development" <linuxppc-dev@...abs.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...e.hu>, linux-next@...r.kernel.org,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: Re: [Next] CPU Hotplug test failures on powerpc

On Wed, Dec 16, 2009 at 4:24 PM, Sachin Sant <sachinp@...ibm.com> wrote:
> Xiaotian Feng wrote:
>>
>> Could follow be possible?  We know there's cpu 0 and cpu 1,
>>
>> offline cpu1 > done
>> offline cpu0 > false
>>
>> consider this in cpu_down code,
>>
>>
>> int __ref cpu_down(unsigned int cpu)
>> {
>> <snip>
>>        set_cpu_active(cpu, false); // here, we set cpu 0 to inactive
>>
>>        synchronize_sched();
>>
>>        err = _cpu_down(cpu, 0);
>> out:
>> <snip>
>> }
>>
>> Then in _cpu_down code:
>>
>> static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
>> {
>> <snip>
>>        if (num_online_cpus() == 1)        // if we're trying to
>> offline cpu0, num_online_cpus will be 1
>>                return -EBUSY;                    // after return back
>> to cpu_down, we didn't change cpu 0 back to active
>>
>>        if (!cpu_online(cpu))
>>                return -EINVAL;
>>
>>        if (!alloc_cpumask_var(&old_allowed, GFP_KERNEL))
>>                return -ENOMEM;
>> <snip>
>> }
>>
>> Then cpu 0 is not active, but online, then we try to offline cpu1, .......
>> This can not be exposed because x86 does not have
>> /sys/devices/system/cpu0/online.
>> I guess following patch fixes this bug.
>>
>
> Just tested this one on the POWER box and the test passed.
> I did not observe the hang.

Thanks for confirm, I will send formatted patch to upstream then:-)

>
> Thanks
> -Sachin
>
>> ---
>> diff --git a/kernel/cpu.c b/kernel/cpu.c
>> index 291ac58..21ddace 100644
>> --- a/kernel/cpu.c
>> +++ b/kernel/cpu.c
>> @@ -199,14 +199,18 @@ static int __ref _cpu_down(unsigned int cpu, int
>> tasks_frozen)
>>                .hcpu = hcpu,
>>        };
>>
>> -       if (num_online_cpus() == 1)
>> +       if (num_online_cpus() == 1) {
>> +               set_cpu_active(cpu, true);
>>                return -EBUSY;
>> +       }
>>
>>        if (!cpu_online(cpu))
>>                return -EINVAL;
>>
>> -       if (!alloc_cpumask_var(&old_allowed, GFP_KERNEL))
>> +       if (!alloc_cpumask_var(&old_allowed, GFP_KERNEL)) {
>> +               set_cpu_active(cpu, true);
>>                return -ENOMEM;
>> +       }
>>
>>        cpu_hotplug_begin();
>>        err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
>>
>>
>>
>>>
>>> Unless of course, I messed up, which appears to be rather likely given
>>> these problems ;-)
>>>
>>>
>>>
>>
>>
>
>
> --
>
> ---------------------------------
> Sachin Sant
> IBM Linux Technology Center
> India Systems and Technology Labs
> Bangalore, India
> ---------------------------------
>
>
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ