Re: [PATCH] arch: s390: kernel: reset 'c->hotpluggable' when failureoccurs

From: Chen Gang
Date: Wed Jun 26 2013 - 01:16:10 EST


On 06/25/2013 05:31 PM, Chen Gang wrote:
> On 06/25/2013 05:09 PM, Heiko Carstens wrote:
>> On Tue, Jun 25, 2013 at 03:24:09PM +0800, Chen Gang wrote:
>>> On 06/25/2013 02:48 PM, Heiko Carstens wrote:
>>>> On Tue, Jun 25, 2013 at 09:46:45AM +0800, Chen Gang wrote:
>>>>>> When smp_add_present_cpu() fails, it has reset all things excluding
>>>>>> 'c->hotpluggable', so need reset it as original state completely.
>>>>>>
>>>>>> + c->hotpluggable = 0;
>>>>>> return rc;
>>>> No, that doesn't make sense. All cpus on s390 are always hotplugable.
>>>> It really doesn't matter if the value of this field is 0 or 1 after
>>>> an error.
>>>>
>>>
>>> If so, is it better to set 'c->hotpluggable' for all cpus on s390 during
>>> initializing ?
>>
> No, just leave the code as it is.
>>
>

Please help check the diff below whether is valuable, thanks.


For architectures which may support 'hotpluggable', can loop all cpus
during subsys_initcall().

The caller will skip the return value of subsys_initcall(), so can only
return 0.

--------------------------------diff begin------------------------------

diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 15a016c..147cc18 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1065,8 +1065,9 @@ static int __init s390_smp_init(void)
#endif
for_each_present_cpu(cpu) {
rc = smp_add_present_cpu(cpu);
- if (rc)
- return rc;
+ if (unlikely(rc))
+ printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n",
+ __func__, cpu, rc);
}
return 0;
}

--------------------------------diff end--------------------------------


> Currently we have 3 possible states for 'struct cpu':
> initialized, and set hotplugable.
> unitialized, and set hotplugable.
> unitialized, and unset hotplugable.
>
> Either 2nd or 3rd is inconsistent.
>
> The cpu_is_hotplugable() will be used in kernel/rcutorture.c. I do not
> know whether it will cause issue or not, but it seems dangerous when
> __smp_rescan_cpus() has already called, and has some unsucessfull call
> of smp_add_present_cpu().
>
> Please help check.
>
> Thanks.
>


--
Chen Gang

Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/