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

[Xen-devel] Re: [PATCH] Fix cpuidle bug

To: "Liu, Jinsong" <jinsong.liu@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] Fix cpuidle bug
From: Keir Fraser <keir.xen@xxxxxxxxx>
Date: Thu, 10 Mar 2011 08:48:59 +0000
Cc: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, "Wei, Gang" <gang.wei@xxxxxxxxx>, "Li, Xin" <xin.li@xxxxxxxxx>
Delivery-date: Thu, 10 Mar 2011 00:50:03 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:user-agent:date:subject:from:to:cc:message-id :thread-topic:thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=DtfqbopjJ8s2SDTwWW9aIOfHHnQsQW3VQUlMU5gWTJ0=; b=A+rvzw2UijvFE+HFJIEGoCK3IDpVSsBv4sJD0b61iIitdr7enm3EFZOa9EZJEwsnKX QMKSTIPO24QEPu2JD3hgfvdsEklZMQivIEtH85TM0rVL9H8/8kcOQpCdLy1C1lP9X+YS Ku7KQftydvWOK9rVH14/8gPUXaKEleyMbEbpE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:cc:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=plejkj84WB3844EZUHqjRNlLNxF/4jqtX+707qU6dM+6QapYh1YuYXcWWVYMlrektJ XDsA6yUbiVlJmdC0DkI+M92UnAgpmQ54qeL3z+AJsCA6Uvj+wvGH8Uxu4mRXg156VSG+ NnSD1xXIPVRInyzztZtTp5vm9nOpsUp4ity0U=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <BC00F5384FCFC9499AF06F92E8B78A9E1FCCF2952B@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: Acve/l4/nbGaRofNRf+kf3qi+Jv41wAAaD2p
Thread-topic: [PATCH] Fix cpuidle bug
User-agent: Microsoft-Entourage/12.28.0.101117
Is this for 4.0 and 4.1 branches as well?

 -- Keir

On 10/03/2011 08:37, "Liu, Jinsong" <jinsong.liu@xxxxxxxxx> wrote:

> Fix cpuidle bug
> 
> Before invoking C3, bus master disable / flush cache should be the last step;
> After resume from C3, bus master enable should be the first step;
> 
> Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
> 
> diff -r 9d6da64267ed xen/arch/x86/acpi/cpu_idle.c
> --- a/xen/arch/x86/acpi/cpu_idle.c Sun Mar 06 17:28:48 2022 +0800
> +++ b/xen/arch/x86/acpi/cpu_idle.c Mon Mar 07 05:31:46 2022 +0800
> @@ -457,6 +457,19 @@ static void acpi_processor_idle(void)
>  
>      case ACPI_STATE_C3:
>          /*
> +         * Before invoking C3, be aware that TSC/APIC timer may be
> +         * stopped by H/W. Without carefully handling of TSC/APIC stop
> issues,
> +         * deep C state can't work correctly.
> +         */
> +        /* preparing APIC stop */
> +        lapic_timer_off();
> +
> +        /* Get start time (ticks) */
> +        t1 = get_tick();
> +        /* Trace cpu idle entry */
> +        TRACE_4D(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred);
> +
> +        /*
>           * disable bus master
>           * bm_check implies we need ARB_DIS
>           * !bm_check implies we need cache flush
> @@ -485,20 +498,18 @@ static void acpi_processor_idle(void)
>              ACPI_FLUSH_CPU_CACHE();
>          }
>  
> -        /*
> -         * Before invoking C3, be aware that TSC/APIC timer may be
> -         * stopped by H/W. Without carefully handling of TSC/APIC stop
> issues,
> -         * deep C state can't work correctly.
> -         */
> -        /* preparing APIC stop */
> -        lapic_timer_off();
> -
> -        /* Get start time (ticks) */
> -        t1 = get_tick();
> -        /* Trace cpu idle entry */
> -        TRACE_4D(TRC_PM_IDLE_ENTRY, cx->idx, t1, exp, pred);
>          /* Invoke C3 */
>          acpi_idle_do_entry(cx);
> +
> +        if ( power->flags.bm_check && power->flags.bm_control )
> +        {
> +            /* Enable bus master arbitration */
> +            spin_lock(&c3_cpu_status.lock);
> +            acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
> +            c3_cpu_status.count--;
> +            spin_unlock(&c3_cpu_status.lock);
> +        }
> +
>          /* Get end time (ticks) */
>          t2 = get_tick();
>  
> @@ -508,15 +519,6 @@ static void acpi_processor_idle(void)
>          /* Trace cpu idle exit */
>          TRACE_6D(TRC_PM_IDLE_EXIT, cx->idx, t2,
>                   irq_traced[0], irq_traced[1], irq_traced[2], irq_traced[3]);
> -
> -        if ( power->flags.bm_check && power->flags.bm_control )
> -        {
> -            /* Enable bus master arbitration */
> -            spin_lock(&c3_cpu_status.lock);
> -            if ( c3_cpu_status.count-- == num_online_cpus() )
> -                acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
> -            spin_unlock(&c3_cpu_status.lock);
> -        }
>  
>          /* Re-enable interrupts */
>          local_irq_enable();



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

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