mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Toshi Kani <toshi.kani@hp.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: [PATCH] ACPI / processor: Initialize per_cpu(processors, pr->id) properly (Re: System slow down from udev)
Date: Thu, 30 May 2013 21:49:57 +0200	[thread overview]
Message-ID: <3972909.bTSgjJ1tfq@vostro.rjw.lan> (raw)
In-Reply-To: <CAE9FiQWC=2yfVvFAMPQ7D5n5M8QNWROpcr6H-VwWZ+CSoyduyw@mail.gmail.com>

On Thursday, May 30, 2013 11:12:30 AM Yinghai Lu wrote:
> On Thu, May 30, 2013 at 10:42 AM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Thu, May 30, 2013 at 9:36 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> 
> > do you need to remove
> >     per_cpu(processors, pr->id) = NULL;
> > from processor_driver.c::acpi_processor_stop ?
> 
> updated patch.

Thanks!

Appended is essentially the same one with a changelog and tags.

Thanks,
Rafael


---
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: ACPI / processor: Initialize per_cpu(processors, pr->id) properly

Commit ac212b6 (ACPI / processor: Use common hotplug infrastructure)
forgot about initializing the per-CPU 'processors' variables which
lead to ACPI cpuidle failure to use C-states and caused boot slowdown
on multi-CPU machines.

Fix the problem by adding per_cpu(processors, pr->id) initialization
to acpi_processor_add() and add make acpi_processor_remove() clean it
up as appropriate.

Also modify acpi_processor_stop() so that it doesn't clear
per_cpu(processors, pr->id) on processor driver removal which would
then cause problems to happen when the driver is loaded again.

This version of the patch contains fixes from Yinghai Lu.

Reported-and-tested-by: Yinghai Lu <yinghai@kernel.org>
Reported-and-tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/acpi_processor.c   |    6 ++++++
 drivers/acpi/processor_driver.c |    5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/acpi/processor_driver.c
===================================================================
--- linux-pm.orig/drivers/acpi/processor_driver.c
+++ linux-pm/drivers/acpi/processor_driver.c
@@ -78,9 +78,6 @@ static struct device_driver acpi_process
 	.remove = acpi_processor_stop,
 };
 
-DEFINE_PER_CPU(struct acpi_processor *, processors);
-EXPORT_PER_CPU_SYMBOL(processors);
-
 static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
 {
 	struct acpi_device *device = data;
@@ -268,8 +265,6 @@ static int acpi_processor_stop(struct de
 		thermal_cooling_device_unregister(pr->cdev);
 		pr->cdev = NULL;
 	}
-
-	per_cpu(processors, pr->id) = NULL;
 	return 0;
 }
 
Index: linux-pm/drivers/acpi/acpi_processor.c
===================================================================
--- linux-pm.orig/drivers/acpi/acpi_processor.c
+++ linux-pm/drivers/acpi/acpi_processor.c
@@ -29,6 +29,9 @@
 
 ACPI_MODULE_NAME("processor");
 
+DEFINE_PER_CPU(struct acpi_processor *, processors);
+EXPORT_PER_CPU_SYMBOL(processors);
+
 /* --------------------------------------------------------------------------
                                 Errata Handling
    -------------------------------------------------------------------------- */
@@ -387,6 +390,7 @@ static int __cpuinit acpi_processor_add(
 	 * checks.
 	 */
 	per_cpu(processor_device_array, pr->id) = device;
+	per_cpu(processors, pr->id) = pr;
 
 	dev = get_cpu_device(pr->id);
 	result = acpi_bind_one(dev, pr->handle);
@@ -406,6 +410,7 @@ static int __cpuinit acpi_processor_add(
  err:
 	free_cpumask_var(pr->throttling.shared_cpu_map);
 	device->driver_data = NULL;
+	per_cpu(processors, pr->id) = NULL;
  err_free_pr:
 	kfree(pr);
 	return result;
@@ -440,6 +445,7 @@ static void acpi_processor_remove(struct
 
 	/* Clean up. */
 	per_cpu(processor_device_array, pr->id) = NULL;
+	per_cpu(processors, pr->id) = NULL;
 	try_offline_node(cpu_to_node(pr->id));
 
 	/* Remove the CPU. */


  reply	other threads:[~2013-05-30 19:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 23:39 System slow down from udev Yinghai Lu
2013-05-28 23:50 ` Rafael J. Wysocki
2013-05-28 23:46   ` Yinghai Lu
2013-05-28 23:57     ` Rafael J. Wysocki
2013-05-29  0:01       ` Yinghai Lu
2013-05-29  0:30         ` Rafael J. Wysocki
2013-05-29  1:07           ` Greg Kroah-Hartman
2013-05-29  3:46           ` Yinghai Lu
2013-05-29 11:29             ` Rafael J. Wysocki
2013-05-29 20:13               ` Yinghai Lu
2013-05-29 21:34                 ` Rafael J. Wysocki
     [not found]                   ` <CAE9FiQV8CZN+mQvZScr16y9R1y6Tyx7uQg_DbNwE5KkHdi5H1w@mail.gmail.com>
2013-05-29 23:55                     ` Rafael J. Wysocki
2013-05-30  0:20                       ` Rafael J. Wysocki
2013-05-30  2:12                         ` Yinghai Lu
2013-05-30  1:55                       ` Yinghai Lu
2013-05-30 14:34                         ` Rafael J. Wysocki
2013-05-30 14:45                           ` Rafael J. Wysocki
2013-05-30 16:36                             ` Rafael J. Wysocki
2013-05-30 17:42                               ` Yinghai Lu
2013-05-30 17:49                                 ` Yinghai Lu
2013-05-30 19:48                                   ` Rafael J. Wysocki
2013-05-30 18:12                                 ` Yinghai Lu
2013-05-30 19:49                                   ` Rafael J. Wysocki [this message]
2013-05-30 19:46                                 ` 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=3972909.bTSgjJ1tfq@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=daniel.lezcano@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=toshi.kani@hp.com \
    --cc=yinghai@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®