public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@meta.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Kernel Team <kernel-team@meta.com>, Tejun Heo <tj@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>
Subject: Re: [PATCH bpf-next v3 2/7] bpf: Enable cpumasks to be queried and used as kptrs
Date: Wed, 25 Jan 2023 10:13:26 -0600	[thread overview]
Message-ID: <Y9FVJjbBvIjwwd0S@maniforge> (raw)
In-Reply-To: <CAADnVQLtNJ7DYsvzZ0q3So-8PxywiCC4pmV0xKhkDZiw+jx=4A@mail.gmail.com>

On Wed, Jan 25, 2023 at 08:01:49AM -0800, Alexei Starovoitov wrote:
> On Wed, Jan 25, 2023 at 6:38 AM David Vernet <void@manifault.com> wrote:
> > +
> > +void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask)
> > +{
> > +       if (!cpu_valid(cpu))
> > +               return;
> > +
> > +       cpumask_set_cpu(cpu, (struct cpumask *)cpumask);
> 
> I was considering suggesting to use &cpumask->cpumask here and
> in other cases, but figured it's better to leave it as-is,
> since bpf prog will be doing this cast, so it matches.
> Maybe some build assertion is necessary to make sure it's the first member.
> Probably overkill as well.

IMO a build assertion is a good idea. Serves as documentation and a
sanity check. I'll send it out in a follow-on patch, unless you really
think it's overkill.

> 
> Applied.

  reply	other threads:[~2023-01-25 16:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 14:38 [PATCH bpf-next v3 0/7] Enable cpumasks to be used as kptrs David Vernet
2023-01-25 14:38 ` [PATCH bpf-next v3 1/7] bpf: Disallow NULLable pointers for trusted kfuncs David Vernet
2023-01-25 14:38 ` [PATCH bpf-next v3 2/7] bpf: Enable cpumasks to be queried and used as kptrs David Vernet
2023-01-25 16:01   ` Alexei Starovoitov
2023-01-25 16:13     ` David Vernet [this message]
2023-01-25 14:38 ` [PATCH bpf-next v3 3/7] selftests/bpf: Add nested trust selftests suite David Vernet
2023-01-25 14:38 ` [PATCH bpf-next v3 4/7] selftests/bpf: Add selftest suite for cpumask kfuncs David Vernet
2023-01-25 14:38 ` [PATCH bpf-next v3 5/7] bpf/docs: Document cpumask kfuncs in a new file David Vernet
2023-01-25 14:38 ` [PATCH bpf-next v3 6/7] bpf/docs: Document how nested trusted fields may be defined David Vernet
2023-01-25 14:38 ` [PATCH bpf-next v3 7/7] bpf/docs: Document the nocast aliasing behavior of ___init David Vernet
2023-01-25 16:10 ` [PATCH bpf-next v3 0/7] Enable cpumasks to be used as kptrs patchwork-bot+netdevbpf

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=Y9FVJjbBvIjwwd0S@maniforge \
    --to=void@manifault.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --cc=yhs@meta.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