xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ben Guthro <benjamin.guthro@citrix.com>
To: Konrad Rzeszutek Wilk <konrad@kernel.org>,
	xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org
Cc: Ben Guthro <benjamin.guthro@citrix.com>
Subject: [PATCH] xen: Re-upload processor PM data to hypervisor after S3 resume
Date: Thu, 24 Jan 2013 11:59:19 -0500	[thread overview]
Message-ID: <1359046759-11376-1-git-send-email-benjamin.guthro@citrix.com> (raw)

Upon resume, it was found that ACPI C-states were missing from non-boot CPUs.
This change registers a syscore_ops handler for this case, and performs a
subset of the xen_acpi_processor_init() functionality to achieve this case.

Signed-Off-By: Ben Guthro <benjamin.guthro@citrix.com>
---
 drivers/xen/xen-acpi-processor.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c
index 316df65..1510c64 100644
--- a/drivers/xen/xen-acpi-processor.c
+++ b/drivers/xen/xen-acpi-processor.c
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/types.h>
+#include <linux/syscore_ops.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/processor.h>
@@ -467,6 +468,26 @@ static void free_acpi_perf_data(void)
 	free_percpu(acpi_perf_data);
 }
 
+static void xen_acpi_processor_resume(void)
+{
+	int i;
+	printk(KERN_INFO "Resuming Xen processor info\n");
+
+	for_each_possible_cpu(i) {
+		struct acpi_processor *_pr;
+		_pr = per_cpu(processors, i /* APIC ID */);
+		if (!_pr)
+			continue;
+
+		__clear_bit(_pr->acpi_id, acpi_ids_done);
+		(void)upload_pm_data(_pr);
+	}
+}
+
+static struct syscore_ops xap_syscore_ops = {
+	.resume			= xen_acpi_processor_resume,
+};
+
 static int __init xen_acpi_processor_init(void)
 {
 	struct acpi_processor *pr_backup = NULL;
@@ -532,6 +553,8 @@ static int __init xen_acpi_processor_init(void)
 	if (rc)
 		goto err_unregister;
 
+	register_syscore_ops(&xap_syscore_ops);
+
 	return 0;
 err_unregister:
 	for_each_possible_cpu(i) {
@@ -550,6 +573,7 @@ static void __exit xen_acpi_processor_exit(void)
 	int i;
 
 	kfree(acpi_ids_done);
+	unregister_syscore_ops(&xap_syscore_ops);
 	for_each_possible_cpu(i) {
 		struct acpi_processor_performance *perf;
 		perf = per_cpu_ptr(acpi_perf_data, i);
-- 
1.7.9.5

                 reply	other threads:[~2013-01-24 16:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1359046759-11376-1-git-send-email-benjamin.guthro@citrix.com \
    --to=benjamin.guthro@citrix.com \
    --cc=konrad@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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).