Subject: [PATCH v3 15/31] arm64: SMP support

From: [email-masked] (Hanjun Guo)
Date: Mon, 24 Aug 2015 20:14:03 +0800

Hi Timur,

On 08/22/2015 12:45 AM, Timur Tabi wrote:
> On 08/10/2015 12:05 PM, Timur Tabi wrote:
>>>>
>>>> This code was inherited from arch/arm which initially was always
>>>> dumping
>>>> the stack but it later gained the system_state check. Unless it's
>>>> useful
>>>> to anyone for debugging purposes, I'm ok with removing it.
>>>
>>> Do you have patch for this one? My colleagues said that they met the
>>> same problem :)
>>
>> Dropping the call to dump_stack() would probably be sufficient.
>
> Actually, I think we need to keep it.  I just heard from another
> developer who does actually use it for debugging.

Hmm, could you please give a example for how it used?

>
> I think the real problem is that emergency_restart() should not be
> causing these outputs.  Shouldn't machine_restart() change the
> system_state to SYSTEM_RESTART before it calls smp_send_stop()?

The system_state is set to SYSTEM_RESTART in kernel_restart_prepare(),
and kernel_restart() will call kernel_restart_prepare() and
machine_restart(), so if we change the system_state to SYSTEM_RESTART
in machine_restart(), it seems duplicate.

Could we just wait longer than one second in the following function?

void smp_send_stop(void)
{
         unsigned long timeout;

         if (num_online_cpus() > 1) {
                 cpumask_t mask;

                 cpumask_copy(&mask, cpu_online_mask);
                 cpumask_clear_cpu(smp_processor_id(), &mask);

                 smp_cross_call(&mask, IPI_CPU_STOP);
         }

         /* Wait up to one second for other CPUs to stop */
         timeout = USEC_PER_SEC;
         while (num_online_cpus() > 1 && timeout--)
                 udelay(1);

If we have lots of CPUs, one second seems not enough as it
print lots dump message.

Thanks
Hanjun