[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] RE: bug in evtchn_cpu_notify (was domains not shutting down properly-theproblemisbackagain)


  • To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "James Harper" <james.harper@xxxxxxxxxxxxxxxx>
  • Date: Sat, 3 Jan 2009 18:04:25 +1100
  • Cc:
  • Delivery-date: Fri, 02 Jan 2009 23:04:57 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AclsEUiDJwnrGfQLQ6G5Bsw4GM+wzgAAL2RgAAIdJkkAHEzXYAAA9a8QAAD1UUAACaHcAAABmirxAAEexXAAAH2McAAAGpUAAAH94BAAAdTsvgABrLdgAASGj2IAHHluQAAA9upQAAGJNHAAAYE58A==
  • Thread-topic: bug in evtchn_cpu_notify (was domains not shutting down properly-theproblemisbackagain)

> 
> I think I've figured out what is going on... the 'per user data' in
> drivers/xen/evtchn/evtchn.c is per connection to the event channel
device,
> so the same 'per user data' may be assigned to multiple ports
> 
> Initially all the event channels opened by xenstored (eg 17 and 18)
have
> '1' in the vcpu of their user data, indicating that ports on that
> connection are bound to vcpu 1.
> 
> In evtchn_cpu_notify(CPU_DOWN_PREPARE) (when xend starts, reducing the
> number of cpu's in dom0 to 1), every port is looped through. Port 17
is
> found to be bound to vcpu 1 (via the per user data) which is about to
go
> away, so the port is rebound to vcpu 0 and the user data is updated to
> reflect the new vcpu (I only have 2 cpu's, so it is set to 0 as 1 is
going
> away). Port 18 is checked but because the per-user data has been
updated
> to vcpu=0 so nothing is done and the port stays bound to vcpu 1.
> 
> I'll try and come up with a solution when I get back to my computer in
a
> few hours if nobody beats me to it... is there another way to check
what
> vcpu a port is bound to than checking the per-user value of bind_vcpu?
> 

This patch fixes the problem for me... it doesn't require any new data
structures and evtchn_cpu_notify is hardly a performance critical code
path so I think we can wear the extra looping...

diff -r 618fc299e2f1 drivers/xen/evtchn/evtchn.c
--- a/drivers/xen/evtchn/evtchn.c  Thu Dec 18 11:51:36 2008 +0000
+++ b/drivers/xen/evtchn/evtchn.c  Sat Jan 03 18:01:04 2009 +1100
@@ -497,7 +497,7 @@
 {
   int hotcpu = (unsigned long)hcpu;
   cpumask_t map = cpu_online_map;
-  int port, newcpu;
+  int port, port2, newcpu;
   struct per_user_data *u;

   switch (action) {
@@ -508,7 +508,9 @@
       if ((u = port_user[port]) != NULL &&
           u->bind_cpu == hotcpu &&
           (newcpu = next_bind_cpu(map)) < NR_CPUS) {
-        rebind_evtchn_to_cpu(port, newcpu);
+        for (port2 = port; port2 < NR_EVENT_CHANNELS; port2++)
+          if (port_user[port2] == u)
+            rebind_evtchn_to_cpu(port2, newcpu);
         u->bind_cpu = newcpu;
       }
     }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.