Re: [RFC PATCH] x86/syscalls: allow tracing of __do_sys_[syscall] functions
From: Nadav Amit
Date: Tue Sep 20 2022 - 21:31:31 EST
Just following my questions with the answers I figured out, just to save
others time.
On Sep 20, 2022, at 9:48 AM, Nadav Amit <nadav.amit@xxxxxxxxx> wrote:
> On Sep 20, 2022, at 4:02 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
>> On Mon, Sep 19, 2022 at 07:35:42PM -0700, Nadav Amit wrote:
>>
>>> 1. What is the reason that inline functions are marked with notrace?
>>
>> IIRC the concern is that a notrace function using an inline function;
>> GCC deciding to not inline and then still hitting tracing.
>>
>> For noinstr we've mandated __always_inline to avoid this problem. The
>> direct advantage is that those inlined into instrumented code get, well,
>> instrumented.
Commit 45959ee7aa645 (“ftrace: Do not function trace inlined functions”)
gives two reasons which correspond with what you were saying: (1)
consistency and (2) function that should not be traced are mostly marked as
inline.
I am not sure I fully agree with the arguments, specifically the consistency
(any function might be inlined and not traceable). But I am too afraid/lazy
to cause damage and fix it. I will remove the inline and play a bit with the
kernel to see how it behaves.
>>> 2. Is probing function that is called from do_idle() supposed to work, or
>>> should the kernel prevent it?
>>
>> Should work for some :-) Specifically it doesn't work for those that
>> disable RCU, and that's (largely) being fixed here:
>>
>> https://lore.kernel.org/all/20220919095939.761690562@xxxxxxxxxxxxx/T/#u
>>
>> Although looking at it just now, I think I missed a spot.. lemme go fix
>> ;-)
I did not try your patches, but I do think I figured out what’s wrong and
sent a patch.
https://lore.kernel.org/lkml/EECE6FD7-FC3D-40E2-A957-151A1BE2B2F9@xxxxxxxxxx/T/#t
Thanks again,
Nadav