lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFnufp2HP1e7hg_bKpWwASDLhK+jgAtZX+mQGJg08nSVzxgioA@mail.gmail.com>
Date:   Fri, 14 May 2021 01:52:58 +0200
From:   Matteo Croce <mcroce@...ux.microsoft.com>
To:     "Russell King (Oracle)" <linux@...linux.org.uk>
Cc:     netdev@...r.kernel.org, linux-mm@...ck.org,
        Ayush Sawal <ayush.sawal@...lsio.com>,
        Vinay Kumar Yadav <vinay.yadav@...lsio.com>,
        Rohit Maheshwari <rohitm@...lsio.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Marcin Wojtas <mw@...ihalf.com>,
        Mirko Lindner <mlindner@...vell.com>,
        Stephen Hemminger <stephen@...workplumber.org>,
        Tariq Toukan <tariqt@...dia.com>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        Ilias Apalodimas <ilias.apalodimas@...aro.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        John Fastabend <john.fastabend@...il.com>,
        Boris Pismenny <borisp@...dia.com>,
        Arnd Bergmann <arnd@...db.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Vlastimil Babka <vbabka@...e.cz>, Yu Zhao <yuzhao@...gle.com>,
        Will Deacon <will@...nel.org>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Roman Gushchin <guro@...com>, Hugh Dickins <hughd@...gle.com>,
        Peter Xu <peterx@...hat.com>, Jason Gunthorpe <jgg@...pe.ca>,
        Jonathan Lemon <jonathan.lemon@...il.com>,
        Alexander Lobakin <alobakin@...me>,
        Cong Wang <cong.wang@...edance.com>, wenxu <wenxu@...oud.cn>,
        Kevin Hao <haokexin@...il.com>,
        Jakub Sitnicki <jakub@...udflare.com>,
        Marco Elver <elver@...gle.com>,
        Willem de Bruijn <willemb@...gle.com>,
        Miaohe Lin <linmiaohe@...wei.com>,
        Yunsheng Lin <linyunsheng@...wei.com>,
        Guillaume Nault <gnault@...hat.com>,
        linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
        bpf@...r.kernel.org, Matthew Wilcox <willy@...radead.org>,
        Eric Dumazet <edumazet@...gle.com>,
        David Ahern <dsahern@...il.com>,
        Lorenzo Bianconi <lorenzo@...nel.org>,
        Saeed Mahameed <saeedm@...dia.com>,
        Andrew Lunn <andrew@...n.ch>, Paolo Abeni <pabeni@...hat.com>,
        Sven Auhagen <sven.auhagen@...eatech.de>
Subject: Re: [PATCH net-next v5 4/5] mvpp2: recycle buffers

On Thu, May 13, 2021 at 8:21 PM Russell King (Oracle)
<linux@...linux.org.uk> wrote:
>
> On Thu, May 13, 2021 at 06:58:45PM +0200, Matteo Croce wrote:
> > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> > index b2259bf1d299..9dceabece56c 100644
> > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> > @@ -3847,6 +3847,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
> >       struct mvpp2_pcpu_stats ps = {};
> >       enum dma_data_direction dma_dir;
> >       struct bpf_prog *xdp_prog;
> > +     struct xdp_rxq_info *rxqi;
> >       struct xdp_buff xdp;
> >       int rx_received;
> >       int rx_done = 0;
> > @@ -3912,15 +3913,15 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
> >               else
> >                       frag_size = bm_pool->frag_size;
> >
> > +             if (bm_pool->pkt_size == MVPP2_BM_SHORT_PKT_SIZE)
> > +                     rxqi = &rxq->xdp_rxq_short;
> > +             else
> > +                     rxqi = &rxq->xdp_rxq_long;
> >
> > +             if (xdp_prog) {
> > +                     xdp.rxq = rxqi;
> >
> > +                     xdp_init_buff(&xdp, PAGE_SIZE, rxqi);
> >                       xdp_prepare_buff(&xdp, data,
> >                                        MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM,
> >                                        rx_bytes, false);
> > @@ -3964,7 +3965,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
> >               }
> >
> >               if (pp)
> > +                     skb_mark_for_recycle(skb, virt_to_page(data), pp);
> >               else
> >                       dma_unmap_single_attrs(dev->dev.parent, dma_addr,
> >                                              bm_pool->buf_size, DMA_FROM_DEVICE,
>
> Looking at the above, which I've only quoted the _resulting_ code after
> your patch above, I don't see why you have moved the
> "bm_pool->pkt_size == MVPP2_BM_SHORT_PKT_SIZE" conditional outside of
> the test for xdp_prog - I don't see rxqi being used except within that
> conditional. Please can you explain the reasoning there?
>

Back in v3, skb_mark_for_recycle() was accepting an xdp_mem_info*, so
I needed rxqi out of that conditional scope to get that pointer.
Now we just need a page_pool*, so I can restore the original chunk.
Nice catch.

Thanks,
-- 
per aspera ad upstream

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ