xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Shin <jacob.shin@amd.com>
To: Jan Beulich <jbeulich@suse.com>, Liu Jinsong <jinsong.liu@intel.com>
Cc: Jacob Shin <jacob.shin@amd.com>,
	Suravee Suthikulanit <suravee.suthikulpanit@amd.com>,
	xen-devel@lists.xen.org
Subject: [PATCH V2 2/2] cpufreq, powernow: enable/disable core performance boost for all CPUs in the Node
Date: Thu, 20 Jun 2013 12:04:09 -0500	[thread overview]
Message-ID: <1371747849-1817-2-git-send-email-jacob.shin@amd.com> (raw)
In-Reply-To: <1371747849-1817-1-git-send-email-jacob.shin@amd.com>

Since disabling turbo mode on one CPU also affect all other sibling
CPUs in the same Node, we need to call update_cpb on all CPUs in the
same node.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
---
 xen/arch/x86/acpi/cpufreq/powernow.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
index 2c9fea2..3b5507a 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -29,6 +29,7 @@
 #include <xen/cpumask.h>
 #include <xen/timer.h>
 #include <xen/xmalloc.h>
+#include <xen/numa.h>
 #include <asm/bug.h>
 #include <asm/msr.h>
 #include <asm/io.h>
@@ -82,10 +83,20 @@ static void update_cpb(void *data)
 static int powernow_cpufreq_update (int cpuid,
 				     struct cpufreq_policy *policy)
 {
-    if (!cpumask_test_cpu(cpuid, &cpu_online_map))
-        return -EINVAL;
-
-    on_selected_cpus(cpumask_of(cpuid), update_cpb, policy, 1);
+    unsigned int cpu;
+    cpumask_t cpus;
+
+    cpumask_and(&cpus, &cpu_online_map, &node_to_cpumask[cpu_to_node[cpuid]]);
+    on_selected_cpus(&cpus, update_cpb, policy, 1);
+
+    if (!cpumask_equal(policy->cpus, &cpus)) {
+        ASSERT(cpumask_subset(policy->cpus, &cpus));
+        for_each_cpu(cpu, &cpus) {
+            struct cpufreq_policy *p;
+            p = per_cpu(cpufreq_cpu_policy, cpu);
+            p->turbo = policy->turbo;
+        }
+    }
 
     return 0;
 }
-- 
1.7.9.5

  reply	other threads:[~2013-06-20 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 17:04 [PATCH V2 1/2] cpufreq, xenpm: fix cpufreq and xenpm mismatch Jacob Shin
2013-06-20 17:04 ` Jacob Shin [this message]
2013-06-20 21:18   ` [PATCH V2 2/2] cpufreq, powernow: enable/disable core performance boost for all CPUs in the Node Liu, Jinsong
2013-06-21  6:35   ` Jan Beulich

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=1371747849-1817-2-git-send-email-jacob.shin@amd.com \
    --to=jacob.shin@amd.com \
    --cc=jbeulich@suse.com \
    --cc=jinsong.liu@intel.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.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).