WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86/cpuidle: clean up hw residencies read

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86/cpuidle: clean up hw residencies reading code
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 11 Nov 2011 04:33:34 +0000
Delivery-date: Thu, 10 Nov 2011 20:39:04 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1320769800 -3600
# Node ID 7f150d70ce5cf6165b7549eea56ffb566325f8a5
# Parent  dc8e55c90604b1f867c83ab7409a244e4e51e815
x86/cpuidle: clean up hw residencies reading code

Fold redundant code and eliminate pointless casts.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r dc8e55c90604 -r 7f150d70ce5c xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c      Tue Nov 08 17:29:31 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c      Tue Nov 08 17:30:00 2011 +0100
@@ -99,13 +99,19 @@
 static void do_get_hw_residencies(void *arg)
 {
     struct cpuinfo_x86 *c = &current_cpu_data;
-    struct hw_residencies *hw_res = (struct hw_residencies *)arg;
+    struct hw_residencies *hw_res = arg;
 
     if ( c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6 )
         return;
 
     switch ( c->x86_model )
     {
+    /* Sandy bridge */
+    case 0x2A:
+    case 0x2D:
+        GET_PC2_RES(hw_res->pc2);
+        GET_CC7_RES(hw_res->cc7);
+        /* fall through */
     /* Nehalem */
     case 0x1A:
     case 0x1E:
@@ -120,32 +126,22 @@
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
-    /* Sandy bridge */
-    case 0x2A:
-    case 0x2D:
-        GET_PC2_RES(hw_res->pc2);
-        GET_PC3_RES(hw_res->pc3);
-        GET_PC6_RES(hw_res->pc6);
-        GET_PC7_RES(hw_res->pc7);
-        GET_CC3_RES(hw_res->cc3);
-        GET_CC6_RES(hw_res->cc6);
-        GET_CC7_RES(hw_res->cc7);
-        break;
     }
 }
 
 static void get_hw_residencies(uint32_t cpu, struct hw_residencies *hw_res)
 {
+    memset(hw_res, 0, sizeof(*hw_res));
+
     if ( smp_processor_id() == cpu )
-        do_get_hw_residencies((void *)hw_res);
+        do_get_hw_residencies(hw_res);
     else
-        on_selected_cpus(cpumask_of(cpu),
-                         do_get_hw_residencies, (void *)hw_res, 1);
+        on_selected_cpus(cpumask_of(cpu), do_get_hw_residencies, hw_res, 1);
 }
 
 static void print_hw_residencies(uint32_t cpu)
 {
-    struct hw_residencies hw_res = {0};
+    struct hw_residencies hw_res;
 
     get_hw_residencies(cpu, &hw_res);
 
@@ -1042,7 +1038,7 @@
     struct acpi_processor_power *power = processor_powers[cpuid];
     uint64_t usage, res, idle_usage = 0, idle_res = 0;
     int i;
-    struct hw_residencies hw_res = {0};
+    struct hw_residencies hw_res;
 
     if ( power == NULL )
     {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86/cpuidle: clean up hw residencies reading code, Xen patchbot-unstable <=