The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Michael Jeanson <mjeanson@efficios.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rseq: update kernel fields in lockstep with CONFIG_DEBUG_RSEQ
Date: Sat, 22 Feb 2025 15:12:49 +0100	[thread overview]
Message-ID: <Z7nbYcdRKXspX8o2@gmail.com> (raw)
In-Reply-To: <974359d5-43f3-483a-89cf-79e9b4965785@efficios.com>


* Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:

> > > -	unsafe_put_user(cpu_id, &rseq->cpu_id_start, efault_end);
> > > -	unsafe_put_user(cpu_id, &rseq->cpu_id, efault_end);
> > > -	unsafe_put_user(node_id, &rseq->node_id, efault_end);
> > > -	unsafe_put_user(mm_cid, &rseq->mm_cid, efault_end);
> > > +
> > > +	unsafe_rseq_set_field(t, cpu_id_start, cpu_id, efault_end);
> > > +	unsafe_rseq_set_field(t, cpu_id, cpu_id, efault_end);
> > > +	unsafe_rseq_set_field(t, node_id, node_id, efault_end);
> > > +	unsafe_rseq_set_field(t, mm_cid, mm_cid, efault_end);
> > 
> > Could we please name the new wrapper rseq_unsafe_put_user(), to make it
> > clear it's a wrapper around unsafe_put_user()?
> 
> If we do this then need to make sure the order of arguments becomes
> similar to unsafe_put_user for consistency.

Absolutely.

> I always find it odd that the "source" argument comes first and
> the "destination" argument comes second in all put_user() APIs,
> compared to memcpy, WRITE_ONCE() and all assignments (e.g.
> operator "=" LHS vs RHS). Choosing a different argument order
> therefore made sense with a naming different from "*put_user",
> but not so much if we use a derived naming.

Yeah, put_user()'s oddity is a random historic idiosyncrasy that we 
want to preserve in derived naming to reduce the potential for 
confusion.

Thanks,

	Ingo

  reply	other threads:[~2025-02-22 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 19:13 [PATCH] rseq: update kernel fields in lockstep with CONFIG_DEBUG_RSEQ Michael Jeanson
2025-02-22 13:27 ` Ingo Molnar
2025-02-22 13:56   ` Mathieu Desnoyers
2025-02-22 14:12     ` Ingo Molnar [this message]
2025-02-24 20:40       ` Michael Jeanson
2025-02-25  9:12         ` 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=Z7nbYcdRKXspX8o2@gmail.com \
    --to=mingo@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mjeanson@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.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