public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Yunsheng Lin <linyunsheng@huawei.com>,
	Mina Almasry <almasrymina@google.com>
Cc: ilias.apalodimas@linaro.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next] page_pool: add a test module for page_pool
Date: Tue, 10 Sep 2024 13:27:02 +0200	[thread overview]
Message-ID: <fda4dfdc-7ef8-4c75-8d29-a33a621fd703@kernel.org> (raw)
In-Reply-To: <b438256d-a233-4708-9a82-e4f5f4b86a63@huawei.com>



On 10/09/2024 12.46, Yunsheng Lin wrote:
> On 2024/9/10 1:28, Mina Almasry wrote:
>> On Mon, Sep 9, 2024 at 2:25 AM Yunsheng Lin <linyunsheng@huawei.com> wrote:
>>>
>>> The testing is done by ensuring that the page allocated from
>>> the page_pool instance is pushed into a ptr_ring instance in
>>> a kthread/napi binded to a specified cpu, and a kthread/napi
>>> binded to a specified cpu will pop the page from the ptr_ring
>>> and free it back to the page_pool.
>>>
>>> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
>>
>> It seems this test is has a correctness part and a performance part.
>> For the performance test, Jesper has out of tree tests for the
>> page_pool:
>> https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/bench_page_pool_simple.c
>>
>> I have these rebased on top of net-next and use them to verify devmem
>> & memory-provider performance:
>> https://github.com/mina/linux/commit/07fd1c04591395d15d83c07298b4d37f6b56157f
> 
> Yes, I used that testing ko too when adding frag API support for
> page_pool.
> 
> The main issue I remembered was that it only support x86:(
> 

Yes, because I've added ASM code for reading TSC counter in a very
precise manor. Given we run many iterations, then I don't think we
need this precise reading.  I guess it can simply be replaced with
get_cycles() or get_cycles64().  Then it should work on all archs.

The code already supports wall-clock time via ktime_get() (specifically
ktime_get_real_ts64()).


>>
>> My preference here (for the performance part) is to upstream the
>> out-of-tree tests that Jesper (and probably others) are using, rather
>> than adding a new performance test that is not as battle-hardened.
> 
> I looked through the out-of-tree tests again, it seems we can take the
> best of them.
> For Jesper' ko:
> It seems we can do prefill as something that pp_fill_ptr_ring() does
> in bench_page_pool_simple.c to avoid the noise from the page allocator.
> 
> 
> For the ko in this patch:
> It uses NAPI instead of tasklet mimicking the NAPI context, support
> PP_FLAG_DMA_MAP flag testing, and return '-EAGAIN' in module_init()
> to use perf stat for collecting and calculating performance data.
> 
My bench don't return minus-number on module load, because I used perf
record, and to see symbols decoded with perf report, I needed the module
to be loaded.

I started on reading the PMU counters[1] around the bench loop, it works
if enabling PMU counters yourself/manually, but I never finished that work.

  [1] 
https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/include/linux/time_bench.h#L195-L209


> Is there other testcase or better practicing that we can learn from
> Jesper' out of tree ko?
> 

I created a time_bench.c [2] module that other modules [3] can use to
easier reuse the benchmarking code in other modules.

  [2] 
https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/time_bench.c

  [3] 
https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/bench_page_pool_simple.c

--Jesper

  reply	other threads:[~2024-09-10 11:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09  9:19 [PATCH net-next] page_pool: add a test module for page_pool Yunsheng Lin
2024-09-09 17:28 ` Mina Almasry
2024-09-10 10:46   ` Yunsheng Lin
2024-09-10 11:27     ` Jesper Dangaard Brouer [this message]
2024-09-11 11:32       ` Yunsheng Lin

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=fda4dfdc-7ef8-4c75-8d29-a33a621fd703@kernel.org \
    --to=hawk@kernel.org \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@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