From: Frederic Weisbecker <fweisbec@gmail.com>
To: Rik van Riel <riel@redhat.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@kernel.org, pbonzini@redhat.com, fweisbec@redhat.com,
wanpeng.li@hotmail.com, efault@gmx.de, tglx@linutronix.de,
rkrcmar@redhat.com
Subject: Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq
Date: Fri, 8 Jul 2016 16:01:41 +0200 [thread overview]
Message-ID: <20160708140139.GF30200@lerouge> (raw)
In-Reply-To: <1467983987.13253.25.camel@redhat.com>
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.
next prev parent reply other threads:[~2016-07-08 14:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-30 19:35 [PATCH v3 0/4] sched,time: fix irq time accounting with nohz_idle riel
2016-06-30 19:35 ` [PATCH 1/4] sched,time: count actually elapsed irq & softirq time riel
2016-07-05 12:40 ` Frederic Weisbecker
2016-07-05 13:08 ` Rik van Riel
2016-07-05 14:00 ` Frederic Weisbecker
2016-07-05 16:47 ` [PATCH v3 " Rik van Riel
2016-07-06 14:15 ` Frederic Weisbecker
2016-06-30 19:35 ` [PATCH 2/4] nohz,cputime: replace VTIME_GEN irq time code with IRQ_TIME_ACCOUNTING code riel
2016-06-30 19:35 ` [PATCH 3/4] irqtime: add irq type parameter to irqtime_account_irq riel
2016-06-30 19:35 ` [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq riel
2016-07-08 12:30 ` Frederic Weisbecker
2016-07-08 13:19 ` Rik van Riel
2016-07-08 14:01 ` Frederic Weisbecker [this message]
2016-07-08 14:34 ` Paolo Bonzini
2016-07-08 15:56 ` Rik van Riel
2016-07-08 23:58 ` Frederic Weisbecker
2016-07-05 13:02 ` [PATCH v3 0/4] sched,time: fix irq time accounting with nohz_idle Nikolay Borisov
2016-07-05 13:09 ` Rik van Riel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160708140139.GF30200@lerouge \
--to=fweisbec@gmail.com \
--cc=efault@gmx.de \
--cc=fweisbec@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox