Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen/xen Features (like feature-rx-copy) are set dur...
details: https://anonhg.NetBSD.org/src/rev/7c05339a8fff
branches: trunk
changeset: 758051:7c05339a8fff
user: jym <jym%NetBSD.org@localhost>
date: Sat Oct 16 00:12:08 2010 +0000
description:
Features (like feature-rx-copy) are set during XenbusStateInitWait in
backend. So delay xennet_xenbus_resume() up to notification of
backend state change.
This avoids a race that happens during dynamic attach/detach of network
interfaces with xm(1), where frontend queries xenstore for features not
yet reported by backend. This does not happen during normal domU boot,
as the backend has enough time to fill in these entries before frontend
asks for them.
Issue was reported by sborrill@: detaching xennet interfaces with RX copy
mode enabled turns them back during attach to RX flip mode due to the race.
feature-rx-copy support is part of another patch.
diffstat:
sys/arch/xen/xen/if_xennet_xenbus.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diffs (60 lines):
diff -r caa204d83300 -r 7c05339a8fff sys/arch/xen/xen/if_xennet_xenbus.c
--- a/sys/arch/xen/xen/if_xennet_xenbus.c Fri Oct 15 22:18:58 2010 +0000
+++ b/sys/arch/xen/xen/if_xennet_xenbus.c Sat Oct 16 00:12:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xennet_xenbus.c,v 1.41 2010/04/05 07:19:32 joerg Exp $ */
+/* $NetBSD: if_xennet_xenbus.c,v 1.42 2010/10/16 00:12:08 jym Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.41 2010/04/05 07:19:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.42 2010/10/16 00:12:08 jym Exp $");
#include "opt_xen.h"
#include "opt_nfs_boot.h"
@@ -369,9 +369,6 @@
rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
RND_TYPE_NET, 0);
#endif
-
- /* initialise shared structures and tell backend that we are ready */
- xennet_xenbus_resume(sc);
}
static int
@@ -500,12 +497,6 @@
errmsg = "writing event channel";
goto abort_transaction;
}
- error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
- "state", "%d", XenbusStateConnected);
- if (error) {
- errmsg = "writing frontend XenbusStateConnected";
- goto abort_transaction;
- }
error = xenbus_transaction_end(xbt, 0);
if (error == EAGAIN)
goto again;
@@ -531,14 +522,16 @@
switch (new_state) {
case XenbusStateInitialising:
- case XenbusStateInitWait:
case XenbusStateInitialised:
+ case XenbusStateConnected:
break;
case XenbusStateClosing:
sc->sc_backend_status = BEST_CLOSED;
xenbus_switch_state(sc->sc_xbusd, NULL, XenbusStateClosed);
break;
- case XenbusStateConnected:
+ case XenbusStateInitWait:
+ xennet_xenbus_resume(sc);
+ xenbus_switch_state(sc->sc_xbusd, NULL, XenbusStateConnected);
break;
case XenbusStateUnknown:
default:
Home |
Main Index |
Thread Index |
Old Index