On 2026/1/27 17:43, Kevin Brodsky wrote:
> On 27/01/2026 04:01, Jinjie Ruan wrote:
>>> I understand that you're gradually making the arch code more similar to
>>> the core code so that we can switch over to it, but I'm struggling to
>>> understand why syscall_trace_enter() takes the 'syscall' argument.
>>>
>>> Even the core code just seems to use it as a local variable, which it
>>> overrides before it ever uses it. What am I missing?
>> Hi,
>>
>> You're absolutely right. The 'syscall' parameter is indeed treated as a
>> local variable and gets overridden before any real use. Should we
>> refactor to remove the parameter entirely in generic entry?
> 
> I noticed this as well, removing it from the generic function would make
> sense. AFAICT that removal could be propagated quite far in fact:
> syscall_enter_from_user_mode_work(), syscall_enter_from_user_mode(),
> even arch implementation (do_syscall_64() on x86).

Not really, it is the default return value of
syscall_enter_from_user_mode_work() as below, so we only need to remove
the parameter in syscall_trace_enter().

static __always_inline long syscall_enter_from_user_mode_work(struct
pt_regs *regs, long syscall)
{
        unsigned long work = READ_ONCE(current_thread_info()->syscall_work);

       if (work & SYSCALL_WORK_ENTER)
            syscall = syscall_trace_enter(regs, work);

      return syscall;
}


> 
> - Kevin
> 

Reply via email to