From: Ingo Molnar <mingo@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>,
akpm@linuxfoundation.org, Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, Steven Rostedt <srostedt@redhat.com>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [raw v1 2/4] [NET] Use raw_cpu ops for SNMP stats
Date: Tue, 8 Oct 2013 09:21:14 +0200 [thread overview]
Message-ID: <20131008072114.GA4455@gmail.com> (raw)
In-Reply-To: <0000014194309205-d0af4d2d-a046-4189-b4f0-ffea37374988-000000@email.amazonses.com>
* Christoph Lameter <cl@linux.com> wrote:
> SNMP stats are not protected by preemption but by bh handling.
Most forms of bh exclusion work via the preemption count though, and
softirq contexts themselves are generally not preemptible [to other CPUs]
either.
So the warnings should, in most cases, not trigger.
> Since protection is provided outside of preemption raw_cpu_ops
> need to be used to avoid false positives.
Could you quote the warning that pops up? It might be better to annotate
the specific safe usages than to potentially hide bugs:
> --- linux.orig/include/net/snmp.h 2013-10-07 09:16:07.595206864 -0500
> +++ linux/include/net/snmp.h 2013-10-07 09:16:07.591206909 -0500
> @@ -126,7 +126,7 @@ struct linux_xfrm_mib {
> extern __typeof__(type) __percpu *name[SNMP_ARRAY_SZ]
>
> #define SNMP_INC_STATS_BH(mib, field) \
> - __this_cpu_inc(mib[0]->mibs[field])
> + raw_cpu_inc(mib[0]->mibs[field])
>
> #define SNMP_INC_STATS_USER(mib, field) \
> this_cpu_inc(mib[0]->mibs[field])
> @@ -141,7 +141,7 @@ struct linux_xfrm_mib {
> this_cpu_dec(mib[0]->mibs[field])
>
> #define SNMP_ADD_STATS_BH(mib, field, addend) \
> - __this_cpu_add(mib[0]->mibs[field], addend)
> + raw_cpu_add(mib[0]->mibs[field], addend)
>
> #define SNMP_ADD_STATS_USER(mib, field, addend) \
> this_cpu_add(mib[0]->mibs[field], addend)
Doing this will hide any true bugs if any of these primitives is used in
an unsafe context.
Thanks,
Ingo
next prev parent reply other threads:[~2013-10-08 7:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20131007183226.334180014@linux.com>
2013-10-07 18:31 ` [raw v1 2/4] [NET] Use raw_cpu ops for SNMP stats Christoph Lameter
2013-10-08 7:21 ` Ingo Molnar [this message]
2013-10-08 10:21 ` Peter Zijlstra
2013-10-08 10:26 ` Ingo Molnar
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=20131008072114.GA4455@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linuxfoundation.org \
--cc=cl@linux.com \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.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;
as well as URLs for NNTP newsgroup(s).