On 17/12/13 21:49, Konrad Rzeszutek Wilk wrote:
On Thu, Dec 12, 2013 at 11:48:10PM +0000, Zoltan Kiss wrote:
@@ -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?
Yep, schedule_timeout() would be nicer indeed


+                       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?
But then what would you answer to the guest? You can't shoot the shared ring until there is an outstanding slot. On the other hand, doing a copy would just move the memory leak into the backend, which could be problematic if a guest figures out how to make a packet which can get stucked somewhere in the backend.

Zoli
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to