Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457177

Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector

From Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector
Date 2016-08-05 17:50 +0200
Message-ID <s2PxL-YZ-17@gated-at.bofh.it> (permalink)
References <s2srw-2sp-9@gated-at.bofh.it> <s2u9Z-3yY-65@gated-at.bofh.it> <s2utk-3Xj-9@gated-at.bofh.it> <s2Os2-i5-9@gated-at.bofh.it> <s2OLo-ph-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 08/05/2016 04:52 PM, Steven Rostedt wrote:
>>> --- a/kernel/trace/trace_hwlat.c
>>> +++ b/kernel/trace/trace_hwlat.c
>>> @@ -64,6 +64,15 @@ static struct dentry *hwlat_sample_window;	/* sample window us */
>>> /* Save the previous tracing_thresh value */
>>> static unsigned long save_tracing_thresh;
>>>
>>> +/* NMI timestamp counters */
>>> +static u64 nmi_ts_start;
>>> +static u64 nmi_total_ts;
>>> +static int nmi_count;
>>> +static int nmi_cpu;  
>>
>> and this is always limited to one CPU at a time?
> 
> Yes. Hence the "nmi_cpu".

I was just confused. So we check one CPU at a time. Okay.

>>> @@ -125,6 +138,19 @@ static void trace_hwlat_sample(struct hwlat_sample *sample)
>>> #define init_time(a, b)	(a = b)
>>> #define time_u64(a)	a
>>>
>>> +void trace_hwlat_callback(bool enter)
>>> +{
>>> +	if (smp_processor_id() != nmi_cpu)
>>> +		return;
>>> +
>>> +	if (enter)
>>> +		nmi_ts_start = time_get();  
>>
>> but more interestingly: trace_clock_local() -> sched_clock()
>> and of kernel/time/sched_clock.c we do raw_read_seqcount(&cd.seq) which
>> means we are busted if the NMI triggers during update_clock_read_data().
> 
> Hmm, interesting. Because this is true for general tracing from an NMI.
> 
> /me looks at code.
> 
> Ah, this is when we have GENERIC_SCHED_CLOCK, which would break tracing
> if any arch that has this also has NMIs. Probably need to look at arm64.

arm64 should use the generic code as they don't provide sched_clock()
(and I doubt they go for the weak jiffy version).

> For x86, it has its own NMI safe sched_clock. I could make this "NMI"
> code depend on:
> 
> #ifndef CONFIG_GENERIC_SCHED_CLOCK

that would be nice. That would be disable approx $(git grep
sched_clock_register | wc -l) users but better than a lock up I guess.

> 
> -- Steve

Sebastian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 0/3] tracing: Add Hardware Latency detector tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 17:10 +0200
  [RFC][PATCH 3/3] tracing: Have hwlat trace migrate across tracing_cpumask CPUs Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 17:10 +0200
  [RFC][PATCH 1/3] tracing: Added hardware latency tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 17:10 +0200
    Re: [RFC][PATCH 1/3] tracing: Added hardware latency tracer Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-05 16:30 +0200
      Re: [RFC][PATCH 1/3] tracing: Added hardware latency tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 16:50 +0200
        Re: [RFC][PATCH 1/3] tracing: Added hardware latency tracer Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-05 17:30 +0200
          Re: [RFC][PATCH 1/3] tracing: Added hardware latency tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 17:40 +0200
  [RFC][PATCH 2/3] tracing: Add documentation for hwlat_detector tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 17:10 +0200
    Re: [RFC][PATCH 2/3] tracing: Add documentation for hwlat_detector  tracer Jon Masters <jcm@redhat.com> - 2016-08-10 21:30 +0200
  Re: [RFC][PATCH 0/3] tracing: Add Hardware Latency detector tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 17:40 +0200
    Re: [RFC][PATCH 0/3] tracing: Add Hardware Latency detector tracer Clark Williams <williams@redhat.com> - 2016-08-09 20:20 +0200
      Re: [RFC][PATCH 0/3] tracing: Add Hardware Latency detector tracer Steven Rostedt <rostedt@goodmis.org> - 2016-08-09 20:40 +0200
  [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 19:00 +0200
    Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Steven Rostedt <rostedt@goodmis.org> - 2016-08-04 19:20 +0200
      Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-05 16:40 +0200
        Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 17:00 +0200
          Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-08-05 17:50 +0200
            Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 18:20 +0200
            Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Steven Rostedt <rostedt@goodmis.org> - 2016-08-09 19:30 +0200
          Re: [RFC][PATCH 4/3] tracing: Add NMI tracing in hwlat detector Jon Masters <jcm@redhat.com> - 2016-08-10 21:00 +0200
  [RFC][PATCH 5/3] tracing: Add smi counting to HWLAT Steven Rostedt <rostedt@goodmis.org> - 2016-08-09 20:10 +0200
    Re: [RFC][PATCH 5/3] tracing: Add smi counting to HWLAT Daniel Bristot de Oliveira <bristot@redhat.com> - 2016-08-09 20:30 +0200
      Re: [RFC][PATCH 5/3] tracing: Add smi counting to HWLAT Steven Rostedt <rostedt@goodmis.org> - 2016-08-09 20:40 +0200
    Re: [RFC][PATCH 5/3] tracing: Add smi counting to HWLAT Peter Zijlstra <peterz@infradead.org> - 2016-08-09 23:30 +0200

csiph-web