[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef52449d-7ae0-11d0-c8a9-2ca572454425@huawei.com>
Date: Thu, 29 Jan 2026 21:11:33 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: Kevin Brodsky <kevin.brodsky@....com>, <catalin.marinas@....com>,
<will@...nel.org>, <oleg@...hat.com>, <tglx@...utronix.de>,
<peterz@...radead.org>, <luto@...nel.org>, <shuah@...nel.org>,
<kees@...nel.org>, <wad@...omium.org>, <deller@....de>,
<akpm@...ux-foundation.org>, <charlie@...osinc.com>, <mark.rutland@....com>,
<anshuman.khandual@....com>, <song@...nel.org>, <ryan.roberts@....com>,
<thuth@...hat.com>, <ada.coupriediaz@....com>, <broonie@...nel.org>,
<pengcan@...inos.cn>, <liqiang01@...inos.cn>, <kmal@...k.li>,
<dvyukov@...gle.com>, <reddybalavignesh9979@...il.com>,
<richard.weiyang@...il.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH v11 09/14] entry: Rework syscall_exit_to_user_mode_work()
for arch reuse
On 2026/1/29 20:06, Kevin Brodsky wrote:
> On 28/01/2026 04:19, Jinjie Ruan wrote:
>> In the generic entry code, the beginning of
>> syscall_exit_to_user_mode_work() can be reused on arm64 so it makes
>> sense to rework it.
>>
>> In preparation for moving arm64 over to the generic entry
>> code, as nothing calls syscall_exit_to_user_mode_work() except for
>> syscall_exit_to_user_mode(), move local_irq_disable_exit_to_user() and
>> syscall_exit_to_user_mode_prepare() out from
>> syscall_exit_to_user_mode_work() to the only one caller.
>>
>> Also update the comment and no functional changes.
>>
>> Reviewed-by: Kevin Brodsky <kevin.brodsky@....com>
>> Reviewed-by: Thomas Gleixner <tglx@...utronix.de>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
>> ---
>> include/linux/entry-common.h | 16 ++++++++--------
>> 1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
>> index e4a8287af822..c4fea642d931 100644
>> --- a/include/linux/entry-common.h
>> +++ b/include/linux/entry-common.h
>> @@ -125,14 +125,14 @@ void syscall_exit_work(struct pt_regs *regs, unsigned long work);
>> * syscall_exit_to_user_mode_work - Handle work before returning to user mode
>> * @regs: Pointer to currents pt_regs
>> *
>> - * Same as step 1 and 2 of syscall_exit_to_user_mode() but without calling
>> + * Same as step 1 of syscall_exit_to_user_mode() but without calling
>> + * local_irq_disable(), syscall_exit_to_user_mode_prepare() and
>> * exit_to_user_mode() to perform the final transition to user mode.
>> *
>> - * Calling convention is the same as for syscall_exit_to_user_mode() and it
>> - * returns with all work handled and interrupts disabled. The caller must
>> - * invoke exit_to_user_mode() before actually switching to user mode to
>> - * make the final state transitions. Interrupts must stay disabled between
>> - * return from this function and the invocation of exit_to_user_mode().
>> + * Calling convention is the same as for syscall_exit_to_user_mode(). The
>> + * caller must invoke local_irq_disable(), __exit_to_user_mode_prepare() and
>
> Shouldn't it be syscall_exit_to_user_mode_prepare() rather than
> __exit_to_user_mode_prepare()? The former has extra calls (e.g. rseq).
Perhaps we can just delete these comments — at present only generic
entry and arm64 use it, and nowhere else needs it; after the refactoring
the comments now seem rather unclear.
>
> - Kevin
>
>> + * exit_to_user_mode() before actually switching to user mode to
>> + * make the final state transitions.
>> */
>> static __always_inline void syscall_exit_to_user_mode_work(struct pt_regs *regs)
>> {
>> @@ -155,8 +155,6 @@ static __always_inline void syscall_exit_to_user_mode_work(struct pt_regs *regs)
>> */
>> if (unlikely(work & SYSCALL_WORK_EXIT))
>> syscall_exit_work(regs, work);
>> - local_irq_disable_exit_to_user();
>> - syscall_exit_to_user_mode_prepare(regs);
>> }
>>
>> /**
>> @@ -192,6 +190,8 @@ static __always_inline void syscall_exit_to_user_mode(struct pt_regs *regs)
>> {
>> instrumentation_begin();
>> syscall_exit_to_user_mode_work(regs);
>> + local_irq_disable_exit_to_user();
>> + syscall_exit_to_user_mode_prepare(regs);
>> instrumentation_end();
>> exit_to_user_mode();
>> }
>
Powered by blists - more mailing lists