Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1383871

[PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable

Path csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news.panservice.it!bofh.it!news.nic.it!robomod
From Lianwei Wang <lianwei.wang@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable
Date Thu, 21 Apr 2016 07:00:02 +0200
Message-ID <rqeSC-3do-7@gated-at.bofh.it> (permalink)
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Ar/ZfLiAkFJX4AOiVe1AvtYNOBIIYoNIGugvkshQRkg=; b=lsasEAxnLaejgUz6uO1LxUCm/MJklF7lnSRyTJP5+TbrHFbl2elgOj27IoX3vWZpcE /OPmnutOgdaVBuC40ZMP8Y9g9zlHFbyYDP2ZpzdwGRZ0l+gIBq7WuO4QCu3NBwso7+Rz WjY5Adm7FOufA6MayjGRSv90NZQinz+XzRP/G2HqT+rDnDDGlJddK/n3T50CfLX9E4V7 aA0jnDOE4dK6N2KHIMYMbQ6o0UdO3q0cSQh+ZunhGNv9xs/wQOjKtv/2edG/H6/yzQgC DNPaLjk9EKmh086DGEx2f0MtFX9m9zWhMRNWY6afPK/gr8KttuUdQet637ON2IpOM0ud fFQw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ar/ZfLiAkFJX4AOiVe1AvtYNOBIIYoNIGugvkshQRkg=; b=O9aLIDZxtvCx++ldDqpkPS2TEfrHnJqUfGSDpS3Aaa4HIlXRghph7cel3vkmOgvJvC Lg5MmU9H8387G+BgEN4s452BJlIzQMm6ikkxY0rN8aa2zCW5ORjtOlk8lApaaQ1XTyhc KRKhkYnGsSa4o676CU+yvBa6OpDPaBkaJxW032kSfF69Dby4TvHkQvjL8CqVGSQd3mlh XUCYGxivtmFMhwrS+GuqEVlzBikMu3+PqN+npKXMoRsi4QwyBPPd1qVd33iR9KXJCE4O /X5pmyFhxVYeAyYC4eY64u1JRcss+8DInp48ct41dk7GL+tHPv9Nzs9YNoBNXAWlHCC3 sC8Q==
X-Gm-Message-State AOPr4FWbNSIJVhnN1NwalSohcyxaEirjdIHXOWJbrblxeRNSlS/5pB4m9CkkrZ7HbJTUCg==
X-Received by 10.66.254.74 with SMTP id ag10mr17781782pad.106.1461214586081; Wed, 20 Apr 2016 21:56:26 -0700 (PDT)
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 74
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Lianwei Wang <lianwei.wang@gmail.com>
X-Original-Date Wed, 20 Apr 2016 21:56:07 -0700
X-Original-Message-ID <1461214567-3356-1-git-send-email-lianwei.wang@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1383871

Show key headers only | View raw


Currently it just print a warning message but did not
reset cpu_hotplug_disabled when the enable/disable is
unbalanced. The unbalanced enable/disable will lead
the cpu hotplug work abnormally.

Reset it to 0 when an unablanced enable detected.

Signed-off-by: Lianwei Wang <lianwei.wang@gmail.com>
---
 kernel/cpu.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6ea42e8da861..fef6caed77a3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -243,6 +243,19 @@ void cpu_hotplug_done(void)
 	cpuhp_lock_release();
 }
 
+static void _cpu_hotplug_disable(void)
+{
+	cpu_hotplug_disabled++;
+}
+
+static void _cpu_hotplug_enable(void)
+{
+	if (--cpu_hotplug_disabled < 0) {
+		WARN(1, "unbalanced hotplug enable %d\n", cpu_hotplug_disabled);
+		cpu_hotplug_disabled = 0;
+	}
+}
+
 /*
  * Wait for currently running CPU hotplug operations to complete (if any) and
  * disable future CPU hotplug (from sysfs). The 'cpu_add_remove_lock' protects
@@ -253,7 +266,7 @@ void cpu_hotplug_done(void)
 void cpu_hotplug_disable(void)
 {
 	cpu_maps_update_begin();
-	cpu_hotplug_disabled++;
+	_cpu_hotplug_disable();
 	cpu_maps_update_done();
 }
 EXPORT_SYMBOL_GPL(cpu_hotplug_disable);
@@ -261,7 +274,7 @@ EXPORT_SYMBOL_GPL(cpu_hotplug_disable);
 void cpu_hotplug_enable(void)
 {
 	cpu_maps_update_begin();
-	WARN_ON(--cpu_hotplug_disabled < 0);
+	_cpu_hotplug_enable();
 	cpu_maps_update_done();
 }
 EXPORT_SYMBOL_GPL(cpu_hotplug_enable);
@@ -1053,7 +1066,7 @@ int disable_nonboot_cpus(void)
 	 * this even in case of failure as all disable_nonboot_cpus() users are
 	 * supposed to do enable_nonboot_cpus() on the failure path.
 	 */
-	cpu_hotplug_disabled++;
+	_cpu_hotplug_disable();
 
 	cpu_maps_update_done();
 	return error;
@@ -1073,7 +1086,7 @@ void enable_nonboot_cpus(void)
 
 	/* Allow everyone to use the CPU hotplug again */
 	cpu_maps_update_begin();
-	WARN_ON(--cpu_hotplug_disabled < 0);
+	_cpu_hotplug_enable();
 	if (cpumask_empty(frozen_cpus))
 		goto out;
 
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-21 07:00 +0200
  Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Peter Zijlstra <peterz@infradead.org> - 2016-04-21 13:00 +0200
    Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-22 18:40 +0200
      Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-04-22 18:40 +0200
        Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-23 00:00 +0200
          Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-04-25 10:30 +0200
            Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-26 09:00 +0200
              Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-04-27 12:20 +0200
                Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Thomas Gleixner <tglx@linutronix.de> - 2016-04-28 08:20 +0200
                Re: [PATCH] cpu/hotplug: handle unbalanced hotplug enable/disable Lianwei Wang <lianwei.wang@gmail.com> - 2016-04-28 08:20 +0200

csiph-web