From: Patrick Mullaney <pmullaney@novell.com>
To: linux-kernel@vger.kernel.org, alacrityvm-devel@lists.sourceforge.net
Subject: [PATCH] vbus-enet: fix l4ro pool non-atomic allocations in softirq context
Date: Mon, 26 Oct 2009 22:17:01 -0400 [thread overview]
Message-ID: <20091027021701.20826.67034.stgit@mimic.site> (raw)
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)
/*
next reply other threads:[~2009-10-27 2:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 2:17 Patrick Mullaney [this message]
2009-10-27 21:37 ` [Alacrityvm-devel] " Gregory Haskins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091027021701.20826.67034.stgit@mimic.site \
--to=pmullaney@novell.com \
--cc=alacrityvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome