All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Arnd Bergmann <arnd@kernel.org>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alex Vesker <valex@nvidia.com>, Erez Shitrit <erezsh@nvidia.com>,
	Hamdan Igbaria <hamdani@nvidia.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] net/mlx5: pre-initialize sprintf buffers
Date: Tue, 20 Feb 2024 22:54:36 +0800	[thread overview]
Message-ID: <da3eefaf-a73a-4d7b-8bee-5a6c874cd071@linux.dev> (raw)
In-Reply-To: <2abe3279-ccba-4e1d-a04c-fd724e1660b6@nvidia.com>

在 2024/2/20 14:57, Yevgeny Kliteynik 写道:
> On 20-Feb-24 07:50, Zhu Yanjun wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> 在 2024/2/19 18:04, Arnd Bergmann 写道:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> The debugfs files always in this driver all use an extra round-trip
>>> through an snprintf() before getting put into a mlx5dr_dbg_dump_buff()
>>> rather than the normal seq_printf().
>>>
>>> Zhu Yanjun noticed that the buffers are not initialized before being
>>> filled or reused and requested them to always be zeroed as a
>>> preparation for having more reused between the buffers.
>>
>> I think that you are the first to find this.
> 
> The buffers are not initialized intentionally.
> The content is overwritten from the buffer's beginning.
> Initializing is not needed as it will only cause perf degradation.

If the mentioned functions are not in the critical path, this 
initialization will not make too much difference on the performance.

But if this function knows how many bytes are written and read, it is 
not necessary to initialize the buffer. Or else we should initialize the 
buffer before it is used again.

Zhu Yanjun

> 
> -- YK
> 
> 


      reply	other threads:[~2024-02-20 14:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 10:04 [PATCH 1/2] net/mlx5: pre-initialize sprintf buffers Arnd Bergmann
2024-02-19 10:04 ` [PATCH 2/2] [v2] net/mlx5: fix possible stack overflows Arnd Bergmann
2024-02-20  8:06   ` Simon Horman
2024-02-20  8:11     ` Arnd Bergmann
2024-02-20  8:21       ` Yevgeny Kliteynik
2024-02-21 10:34       ` Simon Horman
2024-02-20  5:50 ` [PATCH 1/2] net/mlx5: pre-initialize sprintf buffers Zhu Yanjun
2024-02-20  6:57   ` Yevgeny Kliteynik
2024-02-20 14:54     ` Zhu Yanjun [this message]

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=da3eefaf-a73a-4d7b-8bee-5a6c874cd071@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=erezsh@nvidia.com \
    --cc=hamdani@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=valex@nvidia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.