Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Thomas Gleixner
On Thu, 23 Mar 2017, Nicolas Pitre wrote: > Is there a need for 64 bits of relative time stamps? > And 32 bits of IRQ number? No. > I'd say that 48 bit time stamp and 16 bit IRQ number is way sufficient. > Who cares if we mispredict an IRQ after 78 hours of idle time? > > Hence: > > u64

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Thomas Gleixner
On Thu, 23 Mar 2017, Nicolas Pitre wrote: > Is there a need for 64 bits of relative time stamps? > And 32 bits of IRQ number? No. > I'd say that 48 bit time stamp and 16 bit IRQ number is way sufficient. > Who cares if we mispredict an IRQ after 78 hours of idle time? > > Hence: > > u64

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Nicolas Pitre
On Thu, 23 Mar 2017, Thomas Gleixner wrote: > On Thu, 23 Mar 2017, Nicolas Pitre wrote: > > > On Thu, 23 Mar 2017, Daniel Lezcano wrote: > > > > > +#define IRQ_TIMINGS_SHIFT5 > > > +#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT) > > > +#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1)

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Nicolas Pitre
On Thu, 23 Mar 2017, Thomas Gleixner wrote: > On Thu, 23 Mar 2017, Nicolas Pitre wrote: > > > On Thu, 23 Mar 2017, Daniel Lezcano wrote: > > > > > +#define IRQ_TIMINGS_SHIFT5 > > > +#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT) > > > +#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1)

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Thomas Gleixner
On Thu, 23 Mar 2017, Nicolas Pitre wrote: > On Thu, 23 Mar 2017, Daniel Lezcano wrote: > > > +#define IRQ_TIMINGS_SHIFT 5 > > +#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT) > > +#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1) > > + > > +struct irq_timing { > > + u32 irq; > > + u64

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Thomas Gleixner
On Thu, 23 Mar 2017, Nicolas Pitre wrote: > On Thu, 23 Mar 2017, Daniel Lezcano wrote: > > > +#define IRQ_TIMINGS_SHIFT 5 > > +#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT) > > +#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1) > > + > > +struct irq_timing { > > + u32 irq; > > + u64

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Nicolas Pitre
On Thu, 23 Mar 2017, Daniel Lezcano wrote: > +#define IRQ_TIMINGS_SHIFT5 > +#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT) > +#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1) > + > +struct irq_timing { > + u32 irq; > + u64 ts; > +}; > + > +struct irq_timings { > + struct

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Nicolas Pitre
On Thu, 23 Mar 2017, Daniel Lezcano wrote: > +#define IRQ_TIMINGS_SHIFT5 > +#define IRQ_TIMINGS_SIZE (1 << IRQ_TIMINGS_SHIFT) > +#define IRQ_TIMINGS_MASK (IRQ_TIMINGS_SIZE - 1) > + > +struct irq_timing { > + u32 irq; > + u64 ts; > +}; > + > +struct irq_timings { > + struct

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Nicolas Pitre
On Thu, 23 Mar 2017, Daniel Lezcano wrote: > On Thu, Mar 23, 2017 at 07:35:42PM +0100, Peter Zijlstra wrote: > > On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote: > > > +void irq_timings_enable(void) > > > +{ > > > + static_branch_inc(_timing_enabled); > > > > Do you really need

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Nicolas Pitre
On Thu, 23 Mar 2017, Daniel Lezcano wrote: > On Thu, Mar 23, 2017 at 07:35:42PM +0100, Peter Zijlstra wrote: > > On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote: > > > +void irq_timings_enable(void) > > > +{ > > > + static_branch_inc(_timing_enabled); > > > > Do you really need

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Daniel Lezcano
On Thu, Mar 23, 2017 at 07:35:42PM +0100, Peter Zijlstra wrote: > On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote: > > +/* > > + * The function record_irq_time is only called in one place in the > > + * interrupts handler. We want this function always inline so the code > > + *

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Daniel Lezcano
On Thu, Mar 23, 2017 at 07:35:42PM +0100, Peter Zijlstra wrote: > On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote: > > +/* > > + * The function record_irq_time is only called in one place in the > > + * interrupts handler. We want this function always inline so the code > > + *

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Peter Zijlstra
On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote: > +/* > + * The function record_irq_time is only called in one place in the > + * interrupts handler. We want this function always inline so the code > + * inside is embedded in the function and the static key branching > + * code can

Re: [PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Peter Zijlstra
On Thu, Mar 23, 2017 at 06:42:02PM +0100, Daniel Lezcano wrote: > +/* > + * The function record_irq_time is only called in one place in the > + * interrupts handler. We want this function always inline so the code > + * inside is embedded in the function and the static key branching > + * code can

[PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Daniel Lezcano
The interrupt framework gives a lot of information about each interrupt. It does not keep track of when those interrupts occur though. This patch provides a mean to record the timestamp for each interrupt occurrences in a per-CPU circular buffer to help with the prediction of the next occurrence

[PATCH V8 2/3] irq: Track the interrupt timings

2017-03-23 Thread Daniel Lezcano
The interrupt framework gives a lot of information about each interrupt. It does not keep track of when those interrupts occur though. This patch provides a mean to record the timestamp for each interrupt occurrences in a per-CPU circular buffer to help with the prediction of the next occurrence