From: Mohamed Khalfella <mkhalfella@purestorage.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
yzhong@purestorage.com, Tariq Toukan <tariqt@nvidia.com>,
Shay Drori <shayd@nvidia.com>, Moshe Shemesh <moshe@nvidia.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] net/mlx5: Added cond_resched() to crdump collection
Date: Wed, 4 Sep 2024 20:36:57 -0700 [thread overview]
Message-ID: <ZtknWffvKCy6JjXS@ceto> (raw)
In-Reply-To: <519a5d22-9e0c-43eb-9710-9ccd6c78bfe3@intel.com>
On 2024-09-03 14:14:58 +0200, Alexander Lobakin wrote:
> From: Mohamed Khalfella <mkhalfella@purestorage.com>
> Date: Fri, 30 Aug 2024 11:01:19 -0700
>
> > On 2024-08-30 15:07:45 +0200, Alexander Lobakin wrote:
> >> From: Mohamed Khalfella <mkhalfella@purestorage.com>
> >> Date: Thu, 29 Aug 2024 15:38:56 -0600
> >>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c
> >>> index 6b774e0c2766..bc6c38a68702 100644
> >>> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c
> >>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.c
> >>> @@ -269,6 +269,7 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
> >>> {
> >>> unsigned int next_read_addr = 0;
> >>> unsigned int read_addr = 0;
> >>> + unsigned int count = 0;
> >>>
> >>> while (read_addr < length) {
> >>> if (mlx5_vsc_gw_read_fast(dev, read_addr, &next_read_addr,
> >>> @@ -276,6 +277,9 @@ int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
> >>> return read_addr;
> >>>
> >>> read_addr = next_read_addr;
> >>> + /* Yield the cpu every 128 register read */
> >>> + if ((++count & 0x7f) == 0)
> >>> + cond_resched();
> >>
> >> Why & 0x7f, could it be written more clearly?
> >>
> >> if (++count == 128) {
> >> cond_resched();
> >> count = 0;
> >> }
> >>
> >> Also, I'd make this open-coded value a #define somewhere at the
> >> beginning of the file with a comment with a short explanation.
>
> This is still valid.
Done. See <1>.
>
> >
> > What you are suggesting should work also. I copied the style from
> > mlx5_vsc_wait_on_flag() to keep the code consistent. The comment above
> > the line should make it clear.
>
> I just don't see a reason to make the code less readable.
<1> Now I am looking at mlx5_vsc_wait_on_flag() again, I realized the
code does not want to reset retries to 0 because it needs to check when
it reaches VSC_MAX_RETRIES. This is not the case here. I will update the
code as suggested.
>
> >
> >>
> >> BTW, why 128? Not 64, not 256 etc? You just picked it, I don't see any
> >> explanation in the commitmsg or here in the code why exactly 128. Have
> >> you tried different values?
> >
> > This mostly subjective. For the numbers I saw in the lab, this will
> > release the cpu after ~4.51ms. If crdump takes ~5s, the code should
> > release the cpu after ~18.0ms. These numbers look reasonable to me.
>
> So just mention in the commit message that you tried different values
> and 128 gave you the best results.
I will update the commit message in v3.
next prev parent reply other threads:[~2024-09-05 3:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 21:38 [PATCH v2 0/1] net/mlx5: Added cond_resched() to crdump collection Mohamed Khalfella
2024-08-29 21:38 ` [PATCH v2 1/1] " Mohamed Khalfella
2024-08-30 13:07 ` Alexander Lobakin
2024-08-30 18:01 ` Mohamed Khalfella
2024-09-03 12:14 ` Alexander Lobakin
2024-09-05 3:36 ` Mohamed Khalfella [this message]
2024-08-29 23:58 ` [PATCH v2 0/1] " Mohamed Khalfella
2024-08-30 7:08 ` Przemek Kitszel
2024-08-30 9:51 ` Moshe Shemesh
2024-09-05 3:38 ` Mohamed Khalfella
2024-09-19 17:24 ` Mohamed Khalfella
2024-09-19 17:40 ` Moshe Shemesh
2024-09-19 17:54 ` Mohamed Khalfella
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=ZtknWffvKCy6JjXS@ceto \
--to=mkhalfella@purestorage.com \
--cc=aleksander.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=shayd@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=yzhong@purestorage.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).