Kieran Mansley
2008-Feb-08 14:27 UTC
[Xen-devel] [PATCH] Fix double-probe of accelerator on suspend_cancel
I just fixed a bug in the network acceleration stuff where an
accelerator could get probed with the same interface twice on a suspend-
cancel - once manually in the suspend_cancel handler, and once when the
watch on the accel configuration option fired after being reinstated.
This patch fixes it.
diff -r 0c1a374e9fcb drivers/xen/netfront/accel.c
--- a/drivers/xen/netfront/accel.c
+++ b/drivers/xen/netfront/accel.c
@@ -696,32 +696,11 @@ int netfront_accelerator_suspend_cancel(
int netfront_accelerator_suspend_cancel(struct netfront_info *np,
struct xenbus_device *dev)
{
- struct netfront_accel_vif_state *accel_vif_state = NULL;
-
- mutex_lock(&accelerator_mutex);
-
- /* Check that we''ve got a device that was accelerated */
- if (np->accelerator == NULL)
- goto out;
-
- /* Find the vif_state from the accelerator''s list */
- list_for_each_entry(accel_vif_state, &np->accelerator->vif_states,
- link) {
- if (accel_vif_state->dev == dev) {
- BUG_ON(accel_vif_state != &np->accel_vif_state);
-
- /*
- * Kick things off again to restore
- * acceleration as it was before suspend
- */
- accelerator_probe_new_vif(np, dev, np->accelerator);
-
- break;
- }
- }
-
- out:
- mutex_unlock(&accelerator_mutex);
+ /*
+ * Setting the watch will cause it to fire and probe the
+ * accelerator, so no need to call accelerator_probe_new_vif()
+ * directly here
+ */
netfront_accelerator_add_watch(np);
return 0;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Kieran Mansley
2008-Feb-08 16:46 UTC
Re: [Xen-devel] [PATCH] Fix double-probe of accelerator on suspend_cancel
On Fri, 2008-02-08 at 14:27 +0000, Kieran Mansley wrote:> I just fixed a bug in the network acceleration stuff where an > accelerator could get probed with the same interface twice on a suspend- > cancel - once manually in the suspend_cancel handler, and once when the > watch on the accel configuration option fired after being reinstated. > This patch fixes it.Forgot the: Signed-off-by: Kieran Mansley <kmansley@solarflare.com> diff -r 0c1a374e9fcb drivers/xen/netfront/accel.c > --- a/drivers/xen/netfront/accel.c > +++ b/drivers/xen/netfront/accel.c > @@ -696,32 +696,11 @@ int netfront_accelerator_suspend_cancel( > int netfront_accelerator_suspend_cancel(struct netfront_info *np, > struct xenbus_device *dev) > { > - struct netfront_accel_vif_state *accel_vif_state = NULL; > - > - mutex_lock(&accelerator_mutex); > - > - /* Check that we''ve got a device that was accelerated */ > - if (np->accelerator == NULL) > - goto out; > - > - /* Find the vif_state from the accelerator''s list */ > - list_for_each_entry(accel_vif_state, &np->accelerator->vif_states, > - link) { > - if (accel_vif_state->dev == dev) { > - BUG_ON(accel_vif_state != &np->accel_vif_state); > - > - /* > - * Kick things off again to restore > - * acceleration as it was before suspend > - */ > - accelerator_probe_new_vif(np, dev, np->accelerator); > - > - break; > - } > - } > - > - out: > - mutex_unlock(&accelerator_mutex); > + /* > + * Setting the watch will cause it to fire and probe the > + * accelerator, so no need to call accelerator_probe_new_vif() > + * directly here > + */ > netfront_accelerator_add_watch(np); > return 0; > } > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel