Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1439487
| From | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq |
| Date | 2016-07-08 16:10 +0200 |
| Message-ID | <rSEDE-5P7-25@gated-at.bofh.it> (permalink) |
| References | <rPPYB-58Z-9@gated-at.bofh.it> <rPPYB-58Z-11@gated-at.bofh.it> <rSDex-4Mm-5@gated-at.bofh.it> <rSE0V-5l8-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jul 08, 2016 at 09:19:47AM -0400, Rik van Riel wrote:
> On Fri, 2016-07-08 at 14:30 +0200, Frederic Weisbecker wrote:
> > > + if (irqtype == HARDIRQ_OFFSET) {
> > > + bool leaving_hardirq = hardirq_count();
> > > + delta = sched_clock_cpu(cpu) -
> > > __this_cpu_read(hardirq_start_time);
> > > + __this_cpu_add(hardirq_start_time, delta);
> > > + if (leaving_hardirq) {
> > > + hardirq_time_write_begin();
> > > + __this_cpu_add(cpu_hardirq_time, delta);
> > > + hardirq_time_write_end();
> > > + }
> >
> > This doesn't seem to work with nesting hardirqs.
> >
> > Thanks.
>
> Where does it break?
>
> enter hardirq A -> hardirq_start_time = now
>
> enter hardirq B -> hardirq_start_time = now,
> account already elapsed time
>
> leave hardirq B -> account elapsed time, set
> hardirq_start_time = now
>
> leave hardirq A -> account elapsed time
>
> What am I missing, except a softirq-style do-while
> loop to account for hardirq A being interrupted by
> hardirq B while updating the statistics?
How about:
enter hardirq A -> delta = sched_clock_cpu(cpu) - __this_cpu_read(hardirq_start_time);
enter hardirq B -> delta = sched_clock_cpu(cpu) - __this_cpu_read(hardirq_start_time);
__this_cpu_add(hardirq_start_time, delta);
...
exit hardirq B
__this_cpu_add(hardirq_start_time, delta);
Also seqcount writers can't nest.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq riel@redhat.com - 2016-06-30 21:40 +0200
Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-08 14:40 +0200
Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq Rik van Riel <riel@redhat.com> - 2016-07-08 15:30 +0200
Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-08 16:10 +0200
Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq Paolo Bonzini <pbonzini@redhat.com> - 2016-07-08 16:40 +0200
Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq Rik van Riel <riel@redhat.com> - 2016-07-08 18:00 +0200
Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq Frederic Weisbecker <fweisbec@gmail.com> - 2016-07-09 02:00 +0200
csiph-web