Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-05-10 14:13:58 +0200
committerJiri Slaby <jslaby@suse.cz>2019-05-16 08:30:28 +0200
commitdbe44699702d33a34417938f74a052bddc740208 (patch)
tree49476eb27fb43ac39ee6a80b94033d0a1b908737
parentaa5f3a0eb7b584ed0759ff41d3fc8b59f02834e0 (diff)
thunderx: eliminate extra calls to put_page() for pages held
for recycling (networking-stable-19_03_28).
-rw-r--r--patches.suse/thunderx-eliminate-extra-calls-to-put_page-for-pages.patch62
-rw-r--r--series.conf1
2 files changed, 63 insertions, 0 deletions
diff --git a/patches.suse/thunderx-eliminate-extra-calls-to-put_page-for-pages.patch b/patches.suse/thunderx-eliminate-extra-calls-to-put_page-for-pages.patch
new file mode 100644
index 0000000000..b0a1ab4525
--- /dev/null
+++ b/patches.suse/thunderx-eliminate-extra-calls-to-put_page-for-pages.patch
@@ -0,0 +1,62 @@
+From: Dean Nelson <dnelson@redhat.com>
+Date: Tue, 26 Mar 2019 11:53:26 -0400
+Subject: thunderx: eliminate extra calls to put_page() for pages held for
+ recycling
+Git-commit: cd35ef91490ad8049dd180bb060aff7ee192eda9
+Patch-mainline: v5.1-rc4
+References: networking-stable-19_03_28
+
+For the non-XDP case, commit 773225388dae15e72790 ("net: thunderx: Optimize
+page recycling for XDP") added code to nicvf_free_rbdr() that, when releasing
+the additional receive buffer page reference held for recycling, repeatedly
+calls put_page() until the page's _refcount goes to zero. Which results in
+the page being freed.
+
+This is not okay if the page's _refcount was greater than 1 (in the non-XDP
+case), because nicvf_free_rbdr() should not be subtracting more than what
+nicvf_alloc_page() had previously added to the page's _refcount, which was
+only 1 (in the non-XDP case).
+
+This can arise if a received packet is still being processed and the receive
+buffer (i.e., skb->head) has not yet been freed via skb_free_head() when
+nicvf_free_rbdr() is spinning through the aforementioned put_page() loop.
+
+If this should occur, when the received packet finishes processing and
+skb_free_head() is called, various problems can ensue. Exactly what, depends on
+whether the page has already been reallocated or not, anything from "BUG: Bad
+page state ... ", to "Unable to handle kernel NULL pointer dereference ..." or
+"Unable to handle kernel paging request...".
+
+So this patch changes nicvf_free_rbdr() to only call put_page() once for pages
+held for recycling (in the non-XDP case).
+
+Fixes: 773225388dae ("net: thunderx: Optimize page recycling for XDP")
+Signed-off-by: Dean Nelson <dnelson@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+index 55dbf02c42af..e246f9733bb8 100644
+--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
++++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+@@ -364,11 +364,10 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr)
+ while (head < rbdr->pgcnt) {
+ pgcache = &rbdr->pgcache[head];
+ if (pgcache->page && page_ref_count(pgcache->page) != 0) {
+- if (!rbdr->is_xdp) {
+- put_page(pgcache->page);
+- continue;
++ if (rbdr->is_xdp) {
++ page_ref_sub(pgcache->page,
++ pgcache->ref_count - 1);
+ }
+- page_ref_sub(pgcache->page, pgcache->ref_count - 1);
+ put_page(pgcache->page);
+ }
+ head++;
+--
+2.21.0
+
diff --git a/series.conf b/series.conf
index 5f76402202..a1e478a1f4 100644
--- a/series.conf
+++ b/series.conf
@@ -21660,6 +21660,7 @@
patches.drivers/HID-input-add-mapping-for-Assistant-key.patch
patches.fixes/0001-net-datagram-fix-unbounded-loop-in-__skb_try_recv_da.patch
patches.suse/thunderx-enable-page-recycling-for-non-XDP-case.patch
+ patches.suse/thunderx-eliminate-extra-calls-to-put_page-for-pages.patch
patches.fixes/batman-adv-Reduce-claim-hash-refcnt-only-for-removed.patch
patches.fixes/batman-adv-Reduce-tt_local-hash-refcnt-only-for-remo.patch
patches.fixes/batman-adv-Reduce-tt_global-hash-refcnt-only-for-rem.patch