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 3/3] Disable ARB_DIS conditionally

To: "Wei, Gang" <gang.wei@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 3/3] Disable ARB_DIS conditionally
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Wed, 03 Sep 2008 09:40:43 +0100
Cc:
Delivery-date: Wed, 03 Sep 2008 01:40:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <8FED46E8A9CA574792FC7AACAC38FE770180652418@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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: AckNaBRbmlf20lzgRmapdIQh+qyTZAAOKwDG
Thread-topic: [Xen-devel] [PATCH 3/3] Disable ARB_DIS conditionally
User-agent: Microsoft-Entourage/11.4.0.080122
I'm not sure about how safe it would be to have ARB_DISABLE set to 1 while
CPUs are not idling. This patch has race that could allow that to happen:

Two CPUs stop idling, one sets ARB_DISABLE=0 but before it decrements
c3_cpu_count the other does so, then re-enters the idle function,
re-increments c3_cpu_count, and sets ARB_DISABLE=1. We now have at least one
CPU running normally yet ARB_DISABLE=1.

If that race is bad then either we have to leave as is, or synchronise on a
spinlock.

 -- Keir

On 3/9/08 02:55, "Wei, Gang" <gang.wei@xxxxxxxxx> wrote:

> CPUIDLE: Write to ARB_DISABLE conditionally to reduce some idle overheads.
> 
> Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
> 
> diff -r 48ab8d09f41e xen/arch/x86/acpi/cpu_idle.c
> --- a/xen/arch/x86/acpi/cpu_idle.c      Tue Sep 02 15:38:37 2008 +0800
> +++ b/xen/arch/x86/acpi/cpu_idle.c      Tue Sep 02 16:03:09 2008 +0800
> @@ -455,8 +455,9 @@ static void acpi_processor_idle(void)
>          if ( power->flags.bm_check && power->flags.bm_control )
>          {
>              /* Enable bus master arbitration */
> +            if ( atomic_read(&c3_cpu_count) == num_online_cpus() )
> +                acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
>              atomic_dec(&c3_cpu_count);
> -            acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
>          }
> 
>          /* Re-enable interrupts */
> _______________________________________________
> 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