xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir.fraser@eu.citrix.com>
To: "Jiang, Yunhong" <yunhong.jiang@intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Jan Beulich <JBeulich@novell.com>
Subject: Re: Re: [PATCH] [RFC] Fix a small window on CPU online/offline
Date: Fri, 02 Apr 2010 08:27:57 +0100	[thread overview]
Message-ID: <C7DB5B0E.F81A%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <C7DB57FA.F810%keir.fraser@eu.citrix.com>

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

On 02/04/2010 08:14, "Keir Fraser" <keir.fraser@eu.citrix.com> wrote:

> Hm, actually maybe that could work. You might not even need a flag in case
> current is non-idle in cpu_disable_scheduler(). It might suffice to force
> context_switch() to do full context switch synchronously when the CPU is
> going offline (see appended patch). I was thinking there was a race as soon
> as the cpu is cleared from cpu_online_map, but actually the problem occurs
> only once the vcpu is descheduled, so if we can synchronously sync its state
> before calling context_saved(), perhaps we are fine.
> 
> This could be a very small patch after all! :-)

Perhaps even as small as the attached patch?

It's simple enough we could almost consider it for 4.0.0.

 -- Keir


[-- Attachment #2: 00-offline --]
[-- Type: application/octet-stream, Size: 1012 bytes --]

diff -r 537451477469 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Thu Apr 01 09:55:27 2010 +0100
+++ b/xen/arch/x86/domain.c	Fri Apr 02 08:25:30 2010 +0100
@@ -1442,7 +1442,8 @@
 
     set_current(next);
 
-    if ( (per_cpu(curr_vcpu, cpu) == next) || is_idle_vcpu(next) )
+    if ( (per_cpu(curr_vcpu, cpu) == next) ||
+         (is_idle_vcpu(next) && cpu_online(cpu)) )
     {
         local_irq_enable();
     }
diff -r 537451477469 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Apr 01 09:55:27 2010 +0100
+++ b/xen/arch/x86/smpboot.c	Fri Apr 02 08:25:30 2010 +0100
@@ -1302,6 +1302,13 @@
 
 	remove_siblinginfo(cpu);
 
+	/*
+	 * If we are running the idle vcpu, sync last non-idle vcpu's state
+	 * before changing cpu_online_map. If we are running non-idle vcpu,
+         * we will synchronously sync the state in context_switch() later.
+	 */
+	__sync_lazy_execstate();
+
 	/* It's now safe to remove this processor from the online map */
 	cpu_clear(cpu, cpu_online_map);
 	fixup_irqs();

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

      reply	other threads:[~2010-04-02  7:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-01  9:22 [PATCH] [RFC] Fix a small window on CPU online/offline Jiang, Yunhong
2010-04-01 10:25 ` Keir Fraser
2010-04-01 10:33   ` Keir Fraser
2010-04-02  3:31   ` Jiang, Yunhong
2010-04-02  7:14     ` Keir Fraser
2010-04-02  7:27       ` Keir Fraser [this message]

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=C7DB5B0E.F81A%keir.fraser@eu.citrix.com \
    --to=keir.fraser@eu.citrix.com \
    --cc=JBeulich@novell.com \
    --cc=kevin.tian@intel.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=yunhong.jiang@intel.com \
    /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).