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-devel

Re: [Xen-devel] [PATCH] x86/cpuidle: clean up hw residencies reading cod

To: Jan Beulich <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] x86/cpuidle: clean up hw residencies reading code
From: Keir Fraser <keir@xxxxxxx>
Date: Tue, 08 Nov 2011 16:00:19 +0000
Cc:
Delivery-date: Tue, 08 Nov 2011 08:04:38 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=wnI4+BVZ+FkQ4v+1T6x3SG7L8QAo18DhMXDvag5vSV4=; b=Wa+xsILXYiVY+/j522uv8Wl0afY22TNudGOomVqX4WRc2mrgqAoCZPIHa1MOsn0XZh XvCfXNTFXuS/25Zt6aQ4pT+AwNWAcg8z547UBwPA6NKso4DWDPg3ZpMUCt0e48VocWB9 FPALnyeOw4e3YWOa8HQax5slUMMC6o+BtTPMs=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4EB95B0B020000780005FA38@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcyeL4NGr3/EZ6r4pU+HkfvlyG5zHQ==
Thread-topic: [Xen-devel] [PATCH] x86/cpuidle: clean up hw residencies reading code
User-agent: Microsoft-Entourage/12.30.0.110427
On 08/11/2011 15:38, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> Fold redundant code and eliminate pointless casts.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Keir Fraser <keir@xxxxxxx>

> --- a/xen/arch/x86/acpi/cpu_idle.c
> +++ b/xen/arch/x86/acpi/cpu_idle.c
> @@ -99,13 +99,19 @@ struct hw_residencies
>  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 @@ static void do_get_hw_residencies(void *
>          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 @@ int pmstat_get_cx_stat(uint32_t cpuid, s
>      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-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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

<Prev in Thread] Current Thread [Next in Thread>