netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: daniel@iogearbox.net, ast@fb.com, bpf@vger.kernel.org,
	netdev@vger.kernel.org, Xiumei Mu <xmu@redhat.com>,
	brouer@redhat.com
Subject: Re: [PATCH bpf] cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled
Date: Thu, 16 Apr 2020 10:23:29 +0200	[thread overview]
Message-ID: <87h7xjn8ji.fsf@toke.dk> (raw)
In-Reply-To: <20200416085537.65dde42e@carbon>

Jesper Dangaard Brouer <brouer@redhat.com> writes:

> On Wed, 15 Apr 2020 16:01:51 +0200
> Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
>> When the kernel is built with CONFIG_DEBUG_PER_CPU_MAPS, the cpumap code
>> can trigger a spurious warning if CONFIG_CPUMASK_OFFSTACK is also set. This
>> happens because in this configuration, NR_CPUS can be larger than
>> nr_cpumask_bits, so the initial check in cpu_map_alloc() is not sufficient
>> to guard against hitting the warning in cpumask_check().
>> 
>> Fix this by using the nr_cpumask_bits variable in the map creation code
>> instead of the NR_CPUS constant.
>
> Shouldn't you use 'nr_cpu_ids' instead of 'nr_cpumask_bits' ?
>
> Else this will still fail on systems with CONFIG_CPUMASK_OFFSTACK=n.

Jesper and I had an offlist discussion about this, and decided that it's
actually better to keep the check in cpu_map_alloc as-is, and instead
just check against nr_cpumask_bits in cpu_map_update_elem(). Otherwise,
the max-size of the map can vary between machines which can affect BPF
program portability.

I'll send a v2.

-Toke


      reply	other threads:[~2020-04-16  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 14:01 [PATCH bpf] cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled Toke Høiland-Jørgensen
2020-04-16  6:55 ` Jesper Dangaard Brouer
2020-04-16  8:23   ` Toke Høiland-Jørgensen [this message]

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=87h7xjn8ji.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=xmu@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).