From: Dmitry Safonov <dima@arista.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Bob Gilligan <gilligan@arista.com>,
"David S. Miller" <davem@davemloft.net>,
Dmitry Safonov <0x7f454c46@gmail.com>,
Francesco Ruggeri <fruggeri@arista.com>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Salam Noureddine <noureddine@arista.com>,
netdev@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
Jason Baron <jbaron@akamai.com>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v2 1/3] jump_label: Add static_key_fast_inc()
Date: Fri, 4 Nov 2022 16:27:13 +0000 [thread overview]
Message-ID: <89d05f19-ca8e-7906-e3ca-973225d8300f@arista.com> (raw)
In-Reply-To: <Y2Q1laQoklgDtVg9@hirez.programming.kicks-ass.net>
On 11/3/22 21:41, Peter Zijlstra wrote:
> On Thu, Nov 03, 2022 at 09:25:22PM +0000, Dmitry Safonov wrote:
>> A helper to add another user for an existing enabled static key.
>
> Utter lack of clue what for.
>
>> +/***
>> + * static_key_fast_inc - adds a user for a static key
>> + * @key: static key that must be already enabled
>> + *
>> + * The caller must make sure that the static key can't get disabled while
>> + * in this function. It doesn't patch jump labels, only adds a user to
>> + * an already enabled static key.
>> + */
>> +static inline void static_key_fast_inc(struct static_key *key)
>> +{
>> + STATIC_KEY_CHECK_USE(key);
>> + WARN_ON_ONCE(atomic_read(&key->enabled) < 1);
>> + atomic_inc(&key->enabled);
>> +}
>
> And no, that's racy as heck. We have things like atomic_inc_not_zero(),
> I suggest looking into it.
Thanks for the review, I'll look into that for v3.
Thanks,
Dmitry
next prev parent reply other threads:[~2022-11-04 16:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 21:25 [PATCH v2 0/3] net/tcp: Dynamically disable TCP-MD5 static key Dmitry Safonov
2022-11-03 21:25 ` [PATCH v2 1/3] jump_label: Add static_key_fast_inc() Dmitry Safonov
2022-11-03 21:41 ` Peter Zijlstra
2022-11-04 16:27 ` Dmitry Safonov [this message]
2022-11-03 23:46 ` kernel test robot
2022-11-03 23:46 ` kernel test robot
2022-11-03 21:25 ` [PATCH v2 2/3] net/tcp: Separate tcp_md5sig_info allocation into tcp_md5sig_info_add() Dmitry Safonov
2022-11-03 21:25 ` [PATCH v2 3/3] net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destruction Dmitry Safonov
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=89d05f19-ca8e-7906-e3ca-973225d8300f@arista.com \
--to=dima@arista.com \
--cc=0x7f454c46@gmail.com \
--cc=ardb@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fruggeri@arista.com \
--cc=gilligan@arista.com \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=noureddine@arista.com \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=yoshfuji@linux-ipv6.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