[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <26dba55c-eb09-4e9e-8460-8adbf75e32cd@efficios.com>
Date: Mon, 24 Feb 2025 15:40:31 -0500
From: Michael Jeanson <mjeanson@...icios.com>
To: Ingo Molnar <mingo@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rseq: update kernel fields in lockstep with
CONFIG_DEBUG_RSEQ
On 2025-02-22 09:12, Ingo Molnar wrote:
>
> * Mathieu Desnoyers <mathieu.desnoyers@...icios.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.
Would that be ok?
rseq_unsafe_put_user(t, value, field, error_label)
>
> Thanks,
>
> Ingo
Powered by blists - more mailing lists