On Thu, Dec 12, 2013 at 11:48:10PM +0000, Zoltan Kiss wrote:Yep, schedule_timeout() would be nicer indeed@@ -485,6 +520,22 @@ void xenvif_disconnect(struct xenvif *vif)
void xenvif_free(struct xenvif *vif)
{
+ int i, unmap_timeout = 0;
+
+ for (i = 0; i < MAX_PENDING_REQS; ++i) {
+ if (vif->grant_tx_handle[i] != NETBACK_INVALID_HANDLE) {
+ i = 0;
+ unmap_timeout++;
+ msleep(1000);
You don't want to use schedule() and a wakeup here to allow other threads
to do their work?
But then what would you answer to the guest? You can't shoot the shared ring until there is an outstanding slot.
+ if (unmap_timeout > 9 &&
+ net_ratelimit())
+ netdev_err(vif->dev,
+ "Page still granted! Index: %x\n", i);
+ }
+ }
+
+ free_xenballooned_pages(MAX_PENDING_REQS, vif->mmap_pages);
How about just stashing those pages on a 'I can't free them' list that will
keep them forever. And if that list gets truly large then switch back to
grant_copy?