From: Simon Horman <horms@kernel.org>
To: Cosmin Ratiu <cratiu@nvidia.com>
Cc: Tariq Toukan <tariqt@nvidia.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Gal Pressman <gal@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
Saeed Mahameed <saeedm@nvidia.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH net-next 03/10] net/mlx5: hw counters: Replace IDR+lists with xarray
Date: Tue, 27 Aug 2024 16:20:41 +0100 [thread overview]
Message-ID: <20240827152041.GN1368797@kernel.org> (raw)
In-Reply-To: <20240827150130.GM1368797@kernel.org>
On Tue, Aug 27, 2024 at 04:01:30PM +0100, Simon Horman wrote:
> + Dan
>
> On Tue, Aug 27, 2024 at 11:14:10AM +0000, Cosmin Ratiu wrote:
> > On Thu, 2024-08-15 at 14:44 +0100, Simon Horman wrote:
> > > On Thu, Aug 15, 2024 at 08:46:49AM +0300, Tariq Toukan wrote:
> > [...]
> > > > + u32 last_bulk_id = 0;
> > > > + u64 bulk_query_time;
> > > > u32 bulk_base_id;
> > [...]
> > > > + xas_for_each(&xas, counter, U32_MAX) {
> > [...]
> > > > + if (unlikely(counter->id >= last_bulk_id)) {
> > > > + /* Start new bulk query. */
> > > > + /* First id must be aligned to 4 when using bulk query. */
> > > > + bulk_base_id = counter->id & ~0x3;
> > [...]
> > > > + bulk_query_time = jiffies;
> > [...]
> > > > }
> > >
> > > Hi Cosmin and Tariq,
> > >
> > > It looks like bulk_query_time and bulk_base_id may be uninitialised or
> > > stale - from a previous loop iteration - if the condition above is not met.
> > >
> > > Flagged by Smatch.
> >
> > I believe this is a false positive. I snipped parts from the reply
> > above to focus on the relevant parts:
> > - last_bulk_id always starts at 0 so
> > - the if branch will always be executed in the first iteration and
> > - it will set bulk_query_time and bulk_base_id for future iterations.
>
> Thanks,
>
> I will look over this a second time with that in mind, my base assumption
> being that you are correct.
Thanks,
as both counter->id and last_bulk_id are unsigned I agree with your
analysis above, and that this is a false positive.
I don't think any further action is required at this time.
Sorry for the noise.
>
> > I am not familiar with Smatch, is there a way to convince it to
> > interpret the code correctly (some annotations perhaps)?
> > The alternatives are to accept the false positive or explicitly
> > initialize those vars to something, which is suboptimal and would be
> > working around a tooling failure.
>
> I think that if it is a false positive it can simply be ignored.
> I CCed Dan in case he has any feedback on that.
>
>
next prev parent reply other threads:[~2024-08-27 15:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 5:46 [PATCH net-next 00/10] net/mlx5: hw counters refactor and misc Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 01/10] net/mlx5: hw counters: Make fc_stats & fc_pool private Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 02/10] net/mlx5: hw counters: Use kvmalloc for bulk query buffer Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 03/10] net/mlx5: hw counters: Replace IDR+lists with xarray Tariq Toukan
2024-08-15 13:44 ` Simon Horman
2024-08-27 11:14 ` Cosmin Ratiu
2024-08-27 15:01 ` Simon Horman
2024-08-27 15:20 ` Simon Horman [this message]
2024-08-29 23:20 ` Saeed Mahameed
2024-08-30 2:20 ` Jakub Kicinski
2024-08-27 15:27 ` Dan Carpenter
2024-08-15 5:46 ` [PATCH net-next 04/10] net/mlx5: hw counters: Drop unneeded cacheline alignment Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 05/10] net/mlx5: hw counters: Don't maintain a counter count Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 06/10] net/mlx5: hw counters: Remove mlx5_fc_create_ex Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 07/10] net/mlx5: Allow users to configure affinity for SFs Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 08/10] net/mlx5: Add NOT_READY command return status Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 09/10] net/mlx5e: SHAMPO, Add no-split ethtool counters for header/data split Tariq Toukan
2024-08-15 5:46 ` [PATCH net-next 10/10] net/mlx5e: Match cleanup order in mlx5e_free_rq in reverse of mlx5e_alloc_rq Tariq Toukan
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=20240827152041.GN1368797@kernel.org \
--to=horms@kernel.org \
--cc=cratiu@nvidia.com \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@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.