linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, imammedo@redhat.com, bp@suse.de,
	paul.gortmaker@windriver.com, JBeulich@suse.com,
	prarit@redhat.com, drjones@redhat.com, toshi.kani@hp.com,
	riel@redhat.com, gong.chen@linux.intel.com, andi@firstfloor.org,
	lenb@kernel.org, rjw@rjwysocki.net, linux-acpi@vger.kernel.org
Subject: [PATCH v3 3/5] x86: fix list corruption on CPU hotplug
Date: Thu, 10 Apr 2014 19:14:19 +0200	[thread overview]
Message-ID: <1397150061-29735-4-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1397150061-29735-1-git-send-email-imammedo@redhat.com>

currently if AP wake up is failed, master CPU marks AP as not present
in do_boot_cpu() by calling set_cpu_present(cpu, false).
That leads to following list corruption on the next physical CPU
hotplug:

[  418.107336] WARNING: CPU: 1 PID: 45 at lib/list_debug.c:33 __list_add+0xbe/0xd0()
[  418.115268] list_add corruption. prev->next should be next (ffff88003dc57600), but was ffff88003e20c3a0. (prev=ffff88003e20c3a0).
[  418.123693] Modules linked in: nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT ipt_REJECT cfg80211 xt_conntrack rfkill ee
[  418.138979] CPU: 1 PID: 45 Comm: kworker/u10:1 Not tainted 3.14.0-rc6+ #387
[  418.149989] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
[  418.165750] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
[  418.166433]  0000000000000021 ffff880038ca7988 ffffffff8159b22d 0000000000000021
[  418.176460]  ffff880038ca79d8 ffff880038ca79c8 ffffffff8106942c ffff880038ca79e8
[  418.177453]  ffff88003e20c3a0 ffff88003dc57600 ffff88003e20c3a0 00000000ffffffea
[  418.178445] Call Trace:
[  418.185811]  [<ffffffff8159b22d>] dump_stack+0x49/0x5c
[  418.186440]  [<ffffffff8106942c>] warn_slowpath_common+0x8c/0xc0
[  418.187192]  [<ffffffff81069516>] warn_slowpath_fmt+0x46/0x50
[  418.191231]  [<ffffffff8136ef51>] ? acpi_ns_get_node+0xb7/0xc7
[  418.193889]  [<ffffffff812f796e>] __list_add+0xbe/0xd0
[  418.196649]  [<ffffffff812e2aa9>] kobject_add_internal+0x79/0x200
[  418.208610]  [<ffffffff812e2e18>] kobject_add_varg+0x38/0x60
[  418.213831]  [<ffffffff812e2ef4>] kobject_add+0x44/0x70
[  418.229961]  [<ffffffff813e2c60>] device_add+0xd0/0x550
[  418.234991]  [<ffffffff813f0e95>] ? pm_runtime_init+0xe5/0xf0
[  418.250226]  [<ffffffff813e32be>] device_register+0x1e/0x30
[  418.255296]  [<ffffffff813e82a3>] register_cpu+0xe3/0x130
[  418.266539]  [<ffffffff81592be5>] arch_register_cpu+0x65/0x150
[  418.285845]  [<ffffffff81355c0d>] acpi_processor_hotadd_init+0x5a/0x9b
...
Which is caused by the fact that generic_processor_info() allocates
logical CPU id by calling:

 cpu = cpumask_next_zero(-1, cpu_present_mask);

which returns id of previously failed to wake up CPU, since its bit
is cleared by do_boot_cpu() and as result register_cpu() tries to
register another CPU with the same id as already present but failed
to be onlined CPU.

Taking in account that AP will not do anything if master CPU failed to
wake it up, there is no reason to mark that AP as not present and
break next cpu hotplug attempts. As a side effect of not marking AP
as not present, user would be allowed to online it again later.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 arch/x86/kernel/smpboot.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 853473d..e7c15d7 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -822,7 +822,6 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
 			schedule();
 		}
 	} else {
-		set_cpu_present(cpu, false);
 		per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
 	}
 
-- 
1.7.1

  parent reply	other threads:[~2014-04-10 17:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 17:14 [PATCH v3 0/5] x86: fix hang when AP bringup is too slow Igor Mammedov
2014-04-10 17:14 ` [PATCH v3 1/5] x86: initialize secondary CPU only if master CPU will wait for it Igor Mammedov
2014-04-14  9:16   ` Ingo Molnar
2014-04-14  9:52     ` Igor Mammedov
2014-04-14 10:03       ` Ingo Molnar
2014-04-14 10:21         ` Igor Mammedov
2014-04-14 12:50         ` Igor Mammedov
2014-04-14 14:51           ` Ingo Molnar
2014-04-14 15:03             ` Igor Mammedov
2014-04-10 17:14 ` [PATCH v3 2/5] x86: log error on secondary CPU wakeup failure at ERR level Igor Mammedov
2014-04-10 17:14 ` Igor Mammedov [this message]
2014-04-14  9:19   ` [PATCH v3 3/5] x86: fix list corruption on CPU hotplug Ingo Molnar
2014-04-14  9:56     ` Igor Mammedov
2014-04-14 10:04       ` Ingo Molnar
2014-04-14 10:23         ` Igor Mammedov
2014-04-14 10:34           ` Ingo Molnar
2014-04-14 10:48             ` Igor Mammedov
2014-04-14 10:56               ` Ingo Molnar
2014-04-10 17:14 ` [PATCH v3 4/5] x86: fix memory corruption in acpi_unmap_lsapic() Igor Mammedov
2014-04-14  9:20   ` Ingo Molnar
2014-04-10 17:14 ` [PATCH v3 5/5] acpi_processor: do not mark present at boot but not onlined CPU as onlined Igor Mammedov
2014-04-14  9:21   ` Ingo Molnar
2014-04-15  5:36     ` Rafael J. Wysocki
2014-04-15  5:43   ` Rafael J. Wysocki

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=1397150061-29735-4-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=JBeulich@suse.com \
    --cc=andi@firstfloor.org \
    --cc=bp@suse.de \
    --cc=drjones@redhat.com \
    --cc=gong.chen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=prarit@redhat.com \
    --cc=riel@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.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;
as well as URLs for NNTP newsgroup(s).