Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-23 Thread Rik van Riel
On Thu, 2016-06-23 at 15:52 +0200, Paolo Bonzini wrote: > > On 22/06/2016 23:55, Rik van Riel wrote: > > > > > > > > > > > > > + hardirq_time = > > > > READ_ONCE(per_cpu(cpu_hardirq_time, > > > > cpu)); > > > Which makes this per_cpu(,cpu) usage somewhat curious. What's > > >

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-23 Thread Rik van Riel
On Thu, 2016-06-23 at 15:52 +0200, Paolo Bonzini wrote: > > On 22/06/2016 23:55, Rik van Riel wrote: > > > > > > > > > > > > > + hardirq_time = > > > > READ_ONCE(per_cpu(cpu_hardirq_time, > > > > cpu)); > > > Which makes this per_cpu(,cpu) usage somewhat curious. What's > > >

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-23 Thread Paolo Bonzini
On 22/06/2016 23:55, Rik van Riel wrote: > > > + hardirq_time = READ_ONCE(per_cpu(cpu_hardirq_time, > > > cpu)); > > Which makes this per_cpu(,cpu) usage somewhat curious. What's wrong > > with __this_cpu_read() ? > > I played around with it a bit, and it seems that > __this_cpu_read

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-23 Thread Paolo Bonzini
On 22/06/2016 23:55, Rik van Riel wrote: > > > + hardirq_time = READ_ONCE(per_cpu(cpu_hardirq_time, > > > cpu)); > > Which makes this per_cpu(,cpu) usage somewhat curious. What's wrong > > with __this_cpu_read() ? > > I played around with it a bit, and it seems that > __this_cpu_read

[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-22 Thread riel
From: Rik van Riel Drop local_irq_save/restore from irqtime_account_irq. Instead, have softirq and hardirq track their time spent independently, with the softirq code subtracting hardirq time that happened during the duration of the softirq run. The softirq code can be

[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-22 Thread riel
From: Rik van Riel Drop local_irq_save/restore from irqtime_account_irq. Instead, have softirq and hardirq track their time spent independently, with the softirq code subtracting hardirq time that happened during the duration of the softirq run. The softirq code can be interrupted by hardirq

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-22 Thread Rik van Riel
On Tue, 2016-06-21 at 23:49 +0200, Peter Zijlstra wrote: > On Thu, Jun 16, 2016 at 12:06:07PM -0400, r...@redhat.com wrote: > > > > @@ -53,36 +56,72 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq); > >   * softirq -> hardirq, hardirq -> softirq > >   * > >   * When exiting hardirq or softirq time,

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-22 Thread Rik van Riel
On Tue, 2016-06-21 at 23:49 +0200, Peter Zijlstra wrote: > On Thu, Jun 16, 2016 at 12:06:07PM -0400, r...@redhat.com wrote: > > > > @@ -53,36 +56,72 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq); > >   * softirq -> hardirq, hardirq -> softirq > >   * > >   * When exiting hardirq or softirq time,

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Peter Zijlstra
On Tue, Jun 21, 2016 at 06:23:34PM -0400, Rik van Riel wrote: > > >   cpu = smp_processor_id(); > > Per this smp_processor_id() usage, preemption is disabled. > > This code is called from the timer code. Surely preemption > is already disabled? That's what I said. > > > > > > + /* > > > +  *

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Peter Zijlstra
On Tue, Jun 21, 2016 at 06:23:34PM -0400, Rik van Riel wrote: > > >   cpu = smp_processor_id(); > > Per this smp_processor_id() usage, preemption is disabled. > > This code is called from the timer code. Surely preemption > is already disabled? That's what I said. > > > > > > + /* > > > +  *

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Peter Zijlstra
On Thu, Jun 16, 2016 at 12:06:07PM -0400, r...@redhat.com wrote: > @@ -53,36 +56,72 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq); > * softirq -> hardirq, hardirq -> softirq > * > * When exiting hardirq or softirq time, account the elapsed time. > + * > + * When exiting softirq time, subtract

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Peter Zijlstra
On Thu, Jun 16, 2016 at 12:06:07PM -0400, r...@redhat.com wrote: > @@ -53,36 +56,72 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq); > * softirq -> hardirq, hardirq -> softirq > * > * When exiting hardirq or softirq time, account the elapsed time. > + * > + * When exiting softirq time, subtract

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Rik van Riel
On Wed, 2016-06-22 at 00:28 +0200, Peter Zijlstra wrote: > On Tue, Jun 21, 2016 at 06:23:34PM -0400, Rik van Riel wrote: > >  > > > > + /* > > > > +  * Softirq context may get interrupted by hardirq > > > > context, > > > > +  * on the same CPU. At softirq entry time the amount >

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Rik van Riel
On Wed, 2016-06-22 at 00:28 +0200, Peter Zijlstra wrote: > On Tue, Jun 21, 2016 at 06:23:34PM -0400, Rik van Riel wrote: > >  > > > > + /* > > > > +  * Softirq context may get interrupted by hardirq > > > > context, > > > > +  * on the same CPU. At softirq entry time the amount >

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Rik van Riel
On Tue, 2016-06-21 at 23:49 +0200, Peter Zijlstra wrote: > On Thu, Jun 16, 2016 at 12:06:07PM -0400, r...@redhat.com wrote: > > > > @@ -53,36 +56,72 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq); > >   * softirq -> hardirq, hardirq -> softirq > >   * > >   * When exiting hardirq or softirq time,

Re: [PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-21 Thread Rik van Riel
On Tue, 2016-06-21 at 23:49 +0200, Peter Zijlstra wrote: > On Thu, Jun 16, 2016 at 12:06:07PM -0400, r...@redhat.com wrote: > > > > @@ -53,36 +56,72 @@ DEFINE_PER_CPU(seqcount_t, irq_time_seq); > >   * softirq -> hardirq, hardirq -> softirq > >   * > >   * When exiting hardirq or softirq time,

[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-16 Thread riel
From: Rik van Riel Drop local_irq_save/restore from irqtime_account_irq. Instead, have softirq and hardirq track their time spent independently, with the softirq code subtracting hardirq time that happened during the duration of the softirq run. The softirq code can be

[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-16 Thread riel
From: Rik van Riel Drop local_irq_save/restore from irqtime_account_irq. Instead, have softirq and hardirq track their time spent independently, with the softirq code subtracting hardirq time that happened during the duration of the softirq run. The softirq code can be interrupted by hardirq

[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-07 Thread riel
From: Rik van Riel Drop local_irq_save/restore from irqtime_account_irq. Instead, have softirq and hardirq track their time spent independently, with the softirq code subtracting hardirq time that happened during the duration of the softirq run. The softirq code can be

[PATCH 5/5] irqtime: drop local_irq_save/restore from irqtime_account_irq

2016-06-07 Thread riel
From: Rik van Riel Drop local_irq_save/restore from irqtime_account_irq. Instead, have softirq and hardirq track their time spent independently, with the softirq code subtracting hardirq time that happened during the duration of the softirq run. The softirq code can be interrupted by hardirq