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: <dad5f7fc-dfa8-3aa9-ec4f-9e220e6f400f@redhat.com>
Date:   Fri, 14 Apr 2023 10:45:44 +0200
From:   Jesper Dangaard Brouer <jbrouer@...hat.com>
To:     Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc:     brouer@...hat.com, netdev@...r.kernel.org, edumazet@...gle.com,
        pabeni@...hat.com, hawk@...nel.org, ilias.apalodimas@...aro.org,
        linyunsheng@...wei.com, alexander.duyck@...il.com,
        Tariq Toukan <tariqt@...dia.com>
Subject: Re: [PATCH net-next v2 2/3] page_pool: allow caching from safely
 localized NAPI


On 13/04/2023 06.26, Jakub Kicinski wrote:
> Recent patches to mlx5 mentioned a regression when moving from
> driver local page pool to only using the generic page pool code.
> Page pool has two recycling paths (1) direct one, which runs in
> safe NAPI context (basically consumer context, so producing
> can be lockless); and (2) via a ptr_ring, which takes a spin
> lock because the freeing can happen from any CPU; producer
> and consumer may run concurrently.
> 
> Since the page pool code was added, Eric introduced a revised version
> of deferred skb freeing. TCP skbs are now usually returned to the CPU
> which allocated them, and freed in softirq context. This places the
> freeing (producing of pages back to the pool) enticingly close to
> the allocation (consumer).
> 
> If we can prove that we're freeing in the same softirq context in which
> the consumer NAPI will run - lockless use of the cache is perfectly fine,
> no need for the lock.
> 
> Let drivers link the page pool to a NAPI instance. If the NAPI instance
> is scheduled on the same CPU on which we're freeing - place the pages
> in the direct cache.
> 
> With that and patched bnxt (XDP enabled to engage the page pool, sigh,
> bnxt really needs page pool work :() I see a 2.6% perf boost with
> a TCP stream test (app on a different physical core than softirq).
> 
> The CPU use of relevant functions decreases as expected:
> 
>    page_pool_refill_alloc_cache   1.17% -> 0%
>    _raw_spin_lock                 2.41% -> 0.98%
> 
> Only consider lockless path to be safe when NAPI is scheduled
> - in practice this should cover majority if not all of steady state
> workloads. It's usually the NAPI kicking in that causes the skb flush.
> 
> The main case we'll miss out on is when application runs on the same
> CPU as NAPI. In that case we don't use the deferred skb free path.
> 
> Reviewed-by: Tariq Toukan<tariqt@...dia.com>
> Signed-off-by: Jakub Kicinski<kuba@...nel.org>
> ---
> v1:
>   - s/in_napi/napi_safe/
> rfc v2:https://lore.kernel.org/all/20230405232100.103392-1-kuba@kernel.org/
>   - plumb thru "are we in NAPI" bool rather than guessing based
>     on softirq && !hardirq
> 
> CC:hawk@...nel.org
> CC:ilias.apalodimas@...aro.org
> ---
>   Documentation/networking/page_pool.rst |  1 +
>   include/linux/netdevice.h              |  3 +++
>   include/linux/skbuff.h                 | 20 +++++++++++++-------
>   include/net/page_pool.h                |  3 ++-
>   net/core/dev.c                         |  3 +++
>   net/core/page_pool.c                   | 15 +++++++++++++--
>   net/core/skbuff.c                      |  4 ++--
>   7 files changed, 37 insertions(+), 12 deletions(-)

Acked-by: Jesper Dangaard Brouer <brouer@...hat.com>

BTW, does it matter if I ack with <hawk@...nel.org> or <brouer@...hat.com> ?

e.g. does the patchwork automation scripts, need to maintainer email to 
match?

--Jesper

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ