Re: [patch 4/8] x86/entry: Move irq tracing on syscall entry to C-code

From: Andy Lutomirski
Date: Wed Feb 26 2020 - 06:20:30 EST




> On Feb 26, 2020, at 12:17 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> ïOn Tue, Feb 25, 2020 at 09:43:46PM -0800, Andy Lutomirski wrote:
>>> On 2/25/20 2:08 PM, Thomas Gleixner wrote:
>>> Now that the C entry points are safe, move the irq flags tracing code into
>>> the entry helper.
>>
>> I'm so confused.
>>
>>>
>>> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>>> ---
>>> arch/x86/entry/common.c | 5 +++++
>>> arch/x86/entry/entry_32.S | 12 ------------
>>> arch/x86/entry/entry_64.S | 2 --
>>> arch/x86/entry/entry_64_compat.S | 18 ------------------
>>> 4 files changed, 5 insertions(+), 32 deletions(-)
>>>
>>> --- a/arch/x86/entry/common.c
>>> +++ b/arch/x86/entry/common.c
>>> @@ -57,6 +57,11 @@ static inline void enter_from_user_mode(
>>> */
>>> static __always_inline void syscall_entry_fixups(void)
>>> {
>>> + /*
>>> + * Usermode is traced as interrupts enabled, but the syscall entry
>>> + * mechanisms disable interrupts. Tell the tracer.
>>> + */
>>> + trace_hardirqs_off();
>>
>> Your earlier patches suggest quite strongly that tracing isn't safe
>> until enter_from_user_mode(). But trace_hardirqs_off() calls
>> trace_irq_disable_rcuidle(), which looks [0] like a tracepoint.
>>
>> Did you perhaps mean to do this *after* enter_from_user_mode()?
>
> aside from the fact that enter_from_user_mode() itself also has a
> tracepoint, the crucial detail is that we must not trace/kprobe the
> function calling this.
>
> Specifically for #PF, because we need read_cr2() before this. See later
> patches.

Indeed. Iâm fine with this patch, but I still donât understand what the changelog is about. And Iâm still rather baffled by most of the notrace annotations in the series.