Skip to contentSkip to conversation

include/linux: Fix outdated comment on entry-common.h

PATCH In review Khalid Ali 2 participants 2 messages Jun 8, 2025 – Jun 13, 2025 Generic entry code

lore
Share & tools
lore

Khalid Ali

author
#0 lore raw

PATCH 1/1 include/linux: Fix outdated comment on entry-common.h

From: Khalid Ali <[email protected]>

On most calls to this function, syscall_enter_from_user_mode_prepare() never get called as the comment indicates.

Privious kernel version i used to see things happen as the function documentation indicated (syscall_enter_from_user_mode_prepare() called before syscall_enter_from_user_mode_work), however it seems now some things have changed which makes that point irrevelant. Most preparations that function does is handled manually by enter_from_user_mode() and
some other places. So this makes it misleading.

The point is remove strict function call indication on documentation as might be outdated one day in the future. There multiple places currently called syscall_enter_from_user_mode_work() without syscall_enter_from_user_mode_prepare() get called so that will make it condition not met.

---
 include/linux/entry-common.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/entry-common.h +1 -2
index f94f3fdf15fc..8b52551600cf 100644
@@ -146,8 +146,7 @@ long syscall_trace_enter(struct pt_regs *regs, long syscall,
  * @syscall:	The syscall number
  *
  * Invoked from architecture specific syscall entry code with interrupts
- * enabled after invoking syscall_enter_from_user_mode_prepare() and extra
- * architecture specific work.
+ * enabled and extra architecture specific work.
  *
  * Returns: The original or a modified syscall number
  *
Signature · 1 line
2.49.0
#1 lore raw

On Sun, Jun 08 2025 at 19:48, Khalid Ali wrote:

'include/linux:' is not a valid prefix. See the documentation I pointed you to in the other reply.

Quoted 12 lines

From: Khalid Ali <[email protected]>

On most calls to this function, syscall_enter_from_user_mode_prepare() never get called as the comment indicates.

Privious kernel version i used to see things happen as the function documentation indicated (syscall_enter_from_user_mode_prepare() called before syscall_enter_from_user_mode_work), however it seems now some things have changed which makes that point irrevelant. Most preparations that function does is handled manually by enter_from_user_mode() and
some other places. So this makes it misleading.

Quoted 5 lines

The point is remove strict function call indication on documentation as might be outdated one day in the future. There multiple places currently called syscall_enter_from_user_mode_work() without syscall_enter_from_user_mode_prepare() get called so that will make it condition not met.

That's again incomprehensible word salad.

You are right that the comment is not longer accurate, but your fixup makes it even worse.

The real condition for calling this function is:

1) enter_from_user_mode() has been invoked

2) interrupts have been enabled

3) Architecture specific work has been done

#1 must be the first thing. #2 and #3 have no ordering requirements.

syscall_enter_from_user_mode_prepare() does #1 and #2 together and in the original implementation this was used in more places. So yes, the comment is outdated, but it needs to describe the above requirements and not something pulled out of thin air.

Thanks,

tglx