Fix double-probe of accelerator on suspend_cancel
PATCH 1/1 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.
drivers/xen/netfront/accel.c +5 -26
@@ -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 ; }
Quoted 5 lines · Kieran Mansley
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_cancelhandler, and once when the watch on the accel configuration option fired after being reinstated. This patch fixes it.
Forgot the:
Quoted 48 lines
diff -r
0c1a374e9fcbdrivers/xen/netfront/accel.cdrivers/xen/netfront/accel.c +5
-26@@ -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
[email protected]
http://lists.xensource.com/xen-devel