freebsd-skq/sys/dev/xen
Roger Pau Monné 59adbba20f xen: fix blkback pushing responses before releasing internal resources
Fix a problem where the blockback driver could run out of requests,
despite the fact that we allocate enough request and reqlist
structures to satisfy the maximum possible number of requests.

The problem was that we were sending responses back to the other
end (blockfront) before freeing resources. The Citrix Windows
driver is pretty agressive about queueing, and would queue more I/O
to us immediately after we sent responses to it. We would run into
a resource shortage and stall out I/O until we freed resources.

It isn't clear whether the request shortage condition was an
indirect cause of the I/O hangs we've been seeing between Windows
with the Citrix PV drivers and FreeBSD's blockback, but the above
problem is certainly a bug.

Sponsored by: Spectra Logic
Submitted by: ken
Reviewed by: royger

dev/xen/blkback/blkback.c:
 - Break xbb_send_response() into two sub-functions,
   xbb_queue_response() and xbb_push_responses().
   Remove xbb_send_response(), because it is no longer
   used.

 - Adjust xbb_complete_reqlist() so that it calls the
   two new functions, and holds the mutex around both
   calls.  The mutex insures that another context
   can't come along and push responses before we've
   freed our resources.

 - Change xbb_release_reqlist() so that it requires
   the mutex to be held instead of acquiring the mutex
   itself.  Both callers could easily hold the mutex
   while calling it, and one really needs to hold the
   mutex during the call.

 - Add two new counters, accessible via sysctl
   variables.  The first one counts the number of
   I/Os that are queued and waiting to be pushed
   (reqs_queued_for_completion).  The second one
   (reqs_completed_with_error) counts the number of
   requests we've completed with an error status.
2014-09-30 17:41:16 +00:00
..
balloon xen/balloon: fix accounting of current memory pages on PVH 2014-09-30 17:38:21 +00:00
blkback xen: fix blkback pushing responses before releasing internal resources 2014-09-30 17:41:16 +00:00
blkfront Revert r269814: blkfront: add support for unmapped IO 2014-09-04 14:56:24 +00:00
console xen: Dom0 console fixes 2014-08-04 09:02:49 +00:00
control xen: unify gnttab initialization for PVHVM and PVH 2014-06-16 08:48:42 +00:00
netback Mechanically convert to if_inc_counter(). 2014-09-19 03:51:26 +00:00
netfront Improve transmit sending offload, TSO, algorithm in general. 2014-09-22 08:27:27 +00:00
pcifront More BUS_PROBE_NOWILDCARD sweeping. Some devices here (if_ath_ahb and siba) 2013-10-29 14:19:42 +00:00
pvcpu xen: add missing files 2014-06-16 08:54:04 +00:00
timer xen: introduce xenpv bus 2014-06-16 08:44:33 +00:00
xenpci xen: unify gnttab initialization for PVHVM and PVH 2014-06-16 08:48:42 +00:00
xenstore xen: add xenstored user-space device 2014-09-30 17:37:26 +00:00