public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vbus-enet: fix l4ro pool non-atomic allocations in softirq context
@ 2009-10-27  2:17 Patrick Mullaney
  2009-10-27 21:37 ` [Alacrityvm-devel] " Gregory Haskins
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Mullaney @ 2009-10-27  2:17 UTC (permalink / raw)
  To: linux-kernel, alacrityvm-devel

The current code exhibits odd behavior in the guest when receiving L4RO
packets. This was tracked down to the improper allocation of
GFP_KERNEL memory from softirq context


Signed-off-by: Patrick Mullaney <pmullaney@novell.com>
---

 drivers/net/vbus-enet.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/vbus-enet.c b/drivers/net/vbus-enet.c
index 228c366..6aaee1c 100644
--- a/drivers/net/vbus-enet.c
+++ b/drivers/net/vbus-enet.c
@@ -182,11 +182,11 @@ rxdesc_alloc(struct vbus_enet_priv *priv, struct ioq_ring_desc *desc, size_t len
 }
 
 static void
-rx_pageq_refill(struct vbus_enet_priv *priv)
+rx_pageq_refill(struct vbus_enet_priv *priv, gfp_t gfp_mask)
 {
 	struct ioq *ioq = priv->l4ro.pageq.queue;
 	struct ioq_iterator iter;
-	int ret;
+	int ret, added = 0;
 
 	if (ioq_full(ioq, ioq_idxtype_inuse))
 		/* nothing to do if the pageq is already fully populated */
@@ -202,11 +202,14 @@ rx_pageq_refill(struct vbus_enet_priv *priv)
 	 * Now populate each descriptor with an empty page
 	 */
 	while (!iter.desc->sown) {
-		struct page *page;
+		struct page *page = NULL;
+
+		page = alloc_page(gfp_mask);
 
-		page = alloc_page(GFP_KERNEL);
-		BUG_ON(!page);
+		if (!page)
+			break;
 
+		added = 1;
 		iter.desc->cookie = (u64)page;
 		iter.desc->ptr    = (u64)__pa(page_address(page));
 		iter.desc->len    = PAGE_SIZE;
@@ -215,7 +218,8 @@ rx_pageq_refill(struct vbus_enet_priv *priv)
 		BUG_ON(ret < 0);
 	}
 
-	ioq_signal(ioq, 0);
+	if (added)
+		ioq_signal(ioq, 0);
 }
 
 static void
@@ -271,7 +275,7 @@ rx_setup(struct vbus_enet_priv *priv)
 	}
 
 	if (priv->l4ro.available)
-		rx_pageq_refill(priv);
+		rx_pageq_refill(priv, GFP_KERNEL);
 }
 
 static void
@@ -602,7 +606,7 @@ vbus_enet_l4ro_import(struct vbus_enet_priv *priv, struct ioq_ring_desc *desc)
 	struct skb_shared_info *sinfo = skb_shinfo(skb);
 	int i;
 
-	rx_pageq_refill(priv);
+	rx_pageq_refill(priv, GFP_ATOMIC);
 
 	if (!vsg->len)
 		/*


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Alacrityvm-devel] [PATCH] vbus-enet: fix l4ro pool non-atomic allocations in softirq context
  2009-10-27  2:17 [PATCH] vbus-enet: fix l4ro pool non-atomic allocations in softirq context Patrick Mullaney
@ 2009-10-27 21:37 ` Gregory Haskins
  0 siblings, 0 replies; 2+ messages in thread
From: Gregory Haskins @ 2009-10-27 21:37 UTC (permalink / raw)
  To: Patrick Mullaney; +Cc: linux-kernel, alacrityvm-devel

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

Patrick Mullaney wrote:
> The current code exhibits odd behavior in the guest when receiving L4RO
> packets. This was tracked down to the improper allocation of
> GFP_KERNEL memory from softirq context
> 

Applied, thanks!

-Greg



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 267 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-27 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-27  2:17 [PATCH] vbus-enet: fix l4ro pool non-atomic allocations in softirq context Patrick Mullaney
2009-10-27 21:37 ` [Alacrityvm-devel] " Gregory Haskins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox