[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <64eab1fc-c46f-7e1f-39ec-523d8183b878@efficios.com>
Date: Fri, 23 Sep 2022 09:00:51 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...nel.org>,
Boqun Feng <boqun.feng@...il.com>,
"H . Peter Anvin" <hpa@...or.com>, Paul Turner <pjt@...gle.com>,
linux-api@...r.kernel.org, Christian Brauner <brauner@...nel.org>,
Florian Weimer <fw@...eb.enyo.de>, David.Laight@...lab.com,
carlos@...hat.com, Peter Oskolkov <posk@...k.io>,
Alexander Mikhalitsyn <alexander@...alicyn.com>
Subject: Re: [PATCH v4 03/25] rseq: Extend struct rseq with numa node id
On 2022-09-23 07:13, Peter Zijlstra wrote:
> On Thu, Sep 22, 2022 at 06:59:18AM -0400, Mathieu Desnoyers wrote:
>> diff --git a/include/trace/events/rseq.h b/include/trace/events/rseq.h
>> index a04a64bc1a00..6bd442697354 100644
>> --- a/include/trace/events/rseq.h
>> +++ b/include/trace/events/rseq.h
>> @@ -16,13 +16,15 @@ TRACE_EVENT(rseq_update,
>>
>> TP_STRUCT__entry(
>> __field(s32, cpu_id)
>> + __field(s32, node_id)
>> ),
>>
>> TP_fast_assign(
>> __entry->cpu_id = raw_smp_processor_id();
>> + __entry->node_id = cpu_to_node(raw_smp_processor_id());
>
> Very minor nit: perhaps:
>
> _entry->node_id = cpu_to_node(__entry->cpu_id);
>
> just in case it does a reload and finds a different value.
I agree with your proposed change, but I don't think it will have any
effect, nor that it matters, for the following reasons:
1) Tracepoint probes are executed with preemption disabled, therefore
preventing preemption and migration within the probe callback. So
reloading the processor ID should not matter.
2) trace_rseq_update is done in the __rseq_handle_notify_resume() called
from the exit to usermode loop. If a preemption/migration happens at any
point in this code called from the exit to usermode loop, the loop will
observe that the thread flags have been set again, and iterate on the
loop once more before going back to userspace. So indeed, even if we
*could* observe inconsistent cpu_id vs node_id in the trace, it would
not matter because it would never be observable by user-space.
But nevertheless, I agree with the change you propose, just not the
justification. :)
Thanks,
Mathieu
>
>> ),
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Powered by blists - more mailing lists