From: Petr Machata <petrm@nvidia.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Petr Machata <petrm@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<netdev@vger.kernel.org>, Ido Schimmel <idosch@nvidia.com>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
<mlxsw@nvidia.com>
Subject: Re: [PATCH net-next v2 4/7] net: nexthop: Expose nexthop group stats to user space
Date: Mon, 4 Mar 2024 12:09:41 +0100 [thread overview]
Message-ID: <87a5nemahr.fsf@nvidia.com> (raw)
In-Reply-To: <CANn89iLDizzEKi7u0NssSXD_rB6c8EeL==ino-O0a2_BxUN5tw@mail.gmail.com>
Eric Dumazet <edumazet@google.com> writes:
> On Thu, Feb 29, 2024 at 7:20 PM Petr Machata <petrm@nvidia.com> wrote:
>> @@ -661,8 +663,77 @@ static int nla_put_nh_group_res(struct sk_buff *skb, struct nh_group *nhg)
>> return -EMSGSIZE;
>> }
>>
>> -static int nla_put_nh_group(struct sk_buff *skb, struct nh_group *nhg)
>> +static void nh_grp_entry_stats_read(struct nh_grp_entry *nhge,
>> + struct nh_grp_entry_stats *stats)
>> {
>> + int i;
>> +
>> + memset(stats, 0, sizeof(*stats));
>> + for_each_possible_cpu(i) {
>> + struct nh_grp_entry_stats *cpu_stats;
>> + unsigned int start;
>> + u64 packets;
>> +
>> + cpu_stats = per_cpu_ptr(nhge->stats, i);
>> + do {
>> + start = u64_stats_fetch_begin(&cpu_stats->syncp);
>> + packets = cpu_stats->packets;
>
> This is not safe, even on 64bit arches.
>
> You should use u64_stats_t, u64_stats_read(), u64_stats_add() ...
OK.
next prev parent reply other threads:[~2024-03-04 12:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 18:16 [PATCH net-next v2 0/7] Support for nexthop group statistics Petr Machata
2024-02-29 18:16 ` [PATCH net-next v2 1/7] net: nexthop: Adjust netlink policy parsing for a new attribute Petr Machata
2024-03-01 15:31 ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 2/7] net: nexthop: Add NHA_OP_FLAGS Petr Machata
2024-03-01 15:36 ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 3/7] net: nexthop: Add nexthop group entry stats Petr Machata
2024-03-01 15:36 ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 4/7] net: nexthop: Expose nexthop group stats to user space Petr Machata
2024-03-01 15:45 ` David Ahern
2024-03-01 17:17 ` Petr Machata
2024-03-01 17:28 ` Jakub Kicinski
2024-03-02 2:45 ` David Ahern
2024-03-03 3:36 ` Jakub Kicinski
2024-03-01 17:32 ` Eric Dumazet
2024-03-04 11:09 ` Petr Machata [this message]
2024-02-29 18:16 ` [PATCH net-next v2 5/7] net: nexthop: Add hardware statistics notifications Petr Machata
2024-03-01 15:46 ` David Ahern
2024-02-29 18:16 ` [PATCH net-next v2 6/7] net: nexthop: Add ability to enable / disable hardware statistics Petr Machata
2024-03-01 15:49 ` David Ahern
2024-03-01 17:18 ` Petr Machata
2024-02-29 18:16 ` [PATCH net-next v2 7/7] net: nexthop: Expose nexthop group HW stats to user space Petr Machata
2024-03-01 15:55 ` David Ahern
2024-03-01 17:22 ` Petr Machata
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=87a5nemahr.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).