From: Tim Chen <tim.c.chen@linux.intel.com>
To: Dongli Zhang <dongli.zhang@oracle.com>, x86@kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org,
rafael.j.wysocki@intel.com, vkuznets@redhat.com,
alison.schofield@intel.com, boris.ostrovsky@oracle.com,
joe.jin@oracle.com, longpeng2@huawei.com, bigeasy@linutronix.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 1/1] x86/smpboot: check cpu_initialized_mask first after returning from schedule()
Date: Wed, 05 Jan 2022 11:19:04 -0800 [thread overview]
Message-ID: <2ddaf5e732c48f74a3758484869c81195adbc47a.camel@linux.intel.com> (raw)
In-Reply-To: <20211223210343.1116-1-dongli.zhang@oracle.com>
On Thu, 2021-12-23 at 13:03 -0800, Dongli Zhang wrote:
> To online a new CPU, the master CPU signals the secondary and waits
> for at
> most 10 seconds until cpu_initialized_mask is set by the secondary
> CPU.
> There is a case that the master CPU fails the online when it takes
> 10+
> seconds for schedule() to return (although the cpu_initialized_mask
> is
> already set by the secondary CPU).
>
> 1. The master CPU signals the secondary CPU in do_boot_cpu().
>
> 2. As the cpu_initialized_mask is still not set, the master CPU
> reschedules
> via schedule().
>
> 3. Suppose it takes 10+ seconds until schedule() returns due to
> performance
> issue. The secondary CPU sets the cpu_initialized_mask during those
> 10+
> seconds.
The patch seems reasonable. But do you know what other task got run
and caused such long delay (>10 sec), preventing switch
back to in the master CPU? It seems like there could be some problem
causing the long delay. It is better if we understand the root cause
of that.
Tim
>
> 4. Once the schedule() at the master CPU returns, although the
> cpu_initialized_mask is set, the time_before(jiffies, timeout) fails.
> As a
> result, the master CPU regards this as failure.
>
> [ 51.983296] smpboot: do_boot_cpu failed(-1) to wakeup CPU#4
>
> 5. Since the secondary CPU is stuck at state CPU_UP_PREPARE, any
> further
> online operation will fail by cpu_check_up_prepare(), unless the
> below
> patch set is applied.
>
> https://lore.kernel.org/all/20211206152034.2150770-1-bigeasy@linutronix.de/
>
> This issue is resolved by always first checking whether the secondary
> CPU
> has set cpu_initialized_mask.
>
> Cc: Longpeng(Mike) <longpeng2@huawei.com>
> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Joe Jin <joe.jin@oracle.com>
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
> ---
> To resend by Cc linux-kernel@vger.kernel.org as well.
>
> arch/x86/kernel/smpboot.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 617012f4619f..faad4fcf67eb 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -1145,7 +1145,7 @@ static int do_boot_cpu(int apicid, int cpu,
> struct task_struct *idle,
> */
> boot_error = -1;
> timeout = jiffies + 10*HZ;
> - while (time_before(jiffies, timeout)) {
> + while (true) {
> if (cpumask_test_cpu(cpu,
> cpu_initialized_mask)) {
> /*
> * Tell AP to proceed with
> initialization
> @@ -1154,6 +1154,10 @@ static int do_boot_cpu(int apicid, int cpu,
> struct task_struct *idle,
> boot_error = 0;
> break;
> }
> +
> + if (time_after_eq(jiffies, timeout))
> + break;
> +
> schedule();
> }
> }
next prev parent reply other threads:[~2022-01-05 19:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 21:03 Dongli Zhang
2022-01-05 19:19 ` Tim Chen [this message]
2022-01-05 23:28 ` Dongli Zhang
2022-01-10 17:43 ` Dongli Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ddaf5e732c48f74a3758484869c81195adbc47a.camel@linux.intel.com \
--to=tim.c.chen@linux.intel.com \
--cc=alison.schofield@intel.com \
--cc=bigeasy@linutronix.de \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dongli.zhang@oracle.com \
--cc=hpa@zytor.com \
--cc=joe.jin@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longpeng2@huawei.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®