From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Linus Walleij <linusw@kernel.org>
Cc: <catalin.marinas@arm.com>, <will@kernel.org>, <kees@kernel.org>,
<oleg@redhat.com>, <luto@amacapital.net>, <wad@chromium.org>,
<thuth@redhat.com>, <peterz@infradead.org>,
<mark.rutland@arm.com>, <ada.coupriediaz@arm.com>,
<kevin.brodsky@arm.com>, <yeoreum.yun@arm.com>,
<anshuman.khandual@arm.com>, <james.morse@arm.com>,
<tglx@kernel.org>, <broonie@kernel.org>, <pengcan@kylinos.cn>,
<ryan.roberts@arm.com>, <liqiang01@kylinos.cn>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH v17 11/15] arm64: syscall: Simplify el0_svc_common() syscall exit path
Date: Tue, 21 Jul 2026 17:30:38 +0800 [thread overview]
Message-ID: <e674b355-b4a9-4205-9a60-a1c49aca6758@huawei.com> (raw)
In-Reply-To: <CAD++jL=D1S7HE9dVwHeOyAmu-6g+BGq+f2=2=BUX-4tzp88NOQ@mail.gmail.com>
On 7/21/2026 4:51 PM, Linus Walleij wrote:
> On Tue, Jul 21, 2026 at 10:19 AM Jinjie Ruan <ruanjinjie@huawei.com> wrote:
>
>> Remove the redundant nested conditional check within the system call
>> exit path of el0_svc_common() to streamline the exit sequence.
>>
>> When entering this fast-path block, CONFIG_DEBUG_RSEQ is guaranteed to be
>> disabled so the call of rseq_syscall() is a no-op.
>
> Please explain why this is guaranteed.
Yes, there is a little unclear.
The expression "!IS_ENABLED(CONFIG_DEBUG_RSEQ)" evaluates to true only
when CONFIG_DEBUG_RSEQ is not set; with the guarantee that it is
disabled, the condition is always satisfied.
>
>> Under this constraint,
>> the code logic inside the block becomes completely identical to what
>> the arm64_syscall_exit_to_user_mode_work() helper already does. Replace
>> that nested logic with a direct invocation of the helper, eliminating
>> redundant code.
>>
>> Before:
>>
>> | if (... && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) {
>> | flags = read_thread_flags();
>> | if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP)
>> | arm64_syscall_exit_to_user_mode_work(regs);
>> | return;
>> | }
>> | trace_exit:
>> | arm64_syscall_exit_to_user_mode_work(regs);
>>
>> After simplify:
>>
>> | if (... && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) {
>> | arm64_syscall_exit_to_user_mode_work(regs);
>> | return;
>> | }
>> | trace_exit:
>> | arm64_syscall_exit_to_user_mode_work(regs);
>>
>> Furthermore, Since both the conditional fast-path and the fallback
>> slow-path now uniformly invoke arm64_syscall_exit_to_user_mode_work(),
>> this explicit conditional branch is entirely redundant regardless of
>> whether the evaluation is true or false. Removing it collapses
>> the duplicated logic into a single, unconditional path.
>>
>> No functional changes.
>>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Ada Couprie Diaz <ada.coupriediaz@arm.com>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>
> After looking at it for a while I conclude you are right, provided
> the reasoning about !CONFIG_DEBUG_RSEQ holds. So with
> that explained:
> Reviewed-by: Linus Walleij <linusw@kernel.org>
>
> Yours,
> Linus Walleij
next prev parent reply other threads:[~2026-07-21 9:30 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 8:18 [PATCH v17 00/15] arm64: entry: Convert to Generic Entry Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 01/15] arm64: ptrace: Skip syscall exit reporting for PTRACE_SYSEMU_SINGLESTEP Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 02/15] arm64: ptrace: Rework audit_syscall_entry() Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 03/15] arm64: ptrace: Open-code seccomp check in syscall_trace_enter() Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 04/15] arm64: ptrace: Rename and clean up syscall_trace_enter() Jinjie Ruan
2026-07-21 8:39 ` Linus Walleij
2026-07-21 8:18 ` [PATCH v17 05/15] arm64: ptrace: Protect rseq_syscall() from tracer PC modifications Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 06/15] arm64: syscall: Rework the syscall exit path in el0_svc_common() Jinjie Ruan
2026-07-21 8:43 ` Linus Walleij
2026-07-21 8:45 ` Linus Walleij
2026-07-21 8:18 ` [PATCH v17 07/15] arm64: ptrace: Pass thread flags to trace enter/exit Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 08/15] arm64: ptrace: Extract arm64_syscall_exit_to_user_mode_work() helper Jinjie Ruan
2026-07-21 8:45 ` Linus Walleij
2026-07-21 8:18 ` [PATCH v17 09/15] arm64: ptrace: Align syscall exit work semantics with generic entry Jinjie Ruan
2026-07-21 8:46 ` Linus Walleij
2026-07-21 8:18 ` [PATCH v17 10/15] arm64: syscall: Use exit-specific flags check in el0_svc_common() Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 11/15] arm64: syscall: Simplify el0_svc_common() syscall exit path Jinjie Ruan
2026-07-21 8:51 ` Linus Walleij
2026-07-21 9:30 ` Jinjie Ruan [this message]
2026-07-21 8:18 ` [PATCH v17 12/15] arm64: ptrace: Make return type of arm64_syscall_trace_enter() bool Jinjie Ruan
2026-07-21 8:52 ` Linus Walleij
2026-07-21 8:18 ` [PATCH v17 13/15] arm64: entry: Convert to generic entry Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 14/15] arm64: Inline el0_svc_common() Jinjie Ruan
2026-07-21 8:18 ` [PATCH v17 15/15] arm64: vdso: Expose sigreturn address on vdso to the kernel Jinjie Ruan
2026-07-21 8:51 ` Thomas Weißschuh
2026-07-21 9:23 ` Jinjie Ruan
2026-07-21 9:55 ` Thomas Weißschuh
2026-07-21 8:55 ` Linus Walleij
2026-07-21 9:27 ` Jinjie Ruan
2026-07-22 18:18 ` Mark Rutland
2026-07-23 1:54 ` Jinjie Ruan
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=e674b355-b4a9-4205-9a60-a1c49aca6758@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=ada.coupriediaz@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kees@kernel.org \
--cc=kevin.brodsky@arm.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liqiang01@kylinos.cn \
--cc=luto@amacapital.net \
--cc=mark.rutland@arm.com \
--cc=oleg@redhat.com \
--cc=pengcan@kylinos.cn \
--cc=peterz@infradead.org \
--cc=ryan.roberts@arm.com \
--cc=tglx@kernel.org \
--cc=thuth@redhat.com \
--cc=wad@chromium.org \
--cc=will@kernel.org \
--cc=yeoreum.yun@arm.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
all inboxes | Powered by JetHome®