public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@kernel.org, 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, 08 Jul 2016 11:56:49 -0400	[thread overview]
Message-ID: <1467993409.13253.31.camel@redhat.com> (raw)
In-Reply-To: <4738023a-adcf-69b5-5856-12c4dc619363@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2223 bytes --]

On Fri, 2016-07-08 at 16:34 +0200, Paolo Bonzini wrote:
> 
> On 08/07/2016 15:19, Rik van Riel wrote:
> > On Fri, 2016-07-08 at 14:30 +0200, Frederic Weisbecker wrote:
> > > On Thu, Jun 30, 2016 at 03:35:50PM -0400, riel@redhat.com wrote:
> > > > From: Rik van Riel <riel@redhat.com>
> > > > 
> > > > 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 code at
> > > > any point in time, but it can check whether it got a
> > > > consistent snapshot of the timekeeping variables it wants,
> > > > and loop around in the unlikely case that it did not.
> > > > 
> > > > Signed-off-by: Rik van Riel <riel@redhat.com>
> > > 
> > > So the purpose is to get rid of local_irq_save/restore()?
> > > Is it really worth such complication?
> > 
> > local_irq_save/restore are quite slow, and look like the
> > largest source of overhead in irq time accounting.
> 
> I'm looking at an upstream tree, without your patches applied,
> but it seems to me that irqtime_account_irq is always called with
> interrupts disabled:
> 
> irqtime_account_irq
> 	-> account_irq_enter_time
> 		-> __irq_enter
> 			-> HARDIRQ_ENTER	[1]
> 			-> irq_enter		[3]
> 		-> __do_softirq			[1]
> 	-> account_irq_exit_time
> 		-> __do_softirq			[1]
> 		-> __irq_exit
> 			-> HARDIRQ_EXIT		[1]
> 		-> irq_exit			[2]
> 
> 	[1] = does local_irq_disable/enable
> 	[2] = contains WARN_ON_ONCE(!irqs_disabled())
> 	[3] = calls rcu_irq_enter(), which checks irqs_disabled()
> 
> I don't think your first two patches change this, so perhaps it's
> enough
> to remove that local_irq-save/restore?  Either this, or
> ENEEDWEEKEND...

I think you are right!

__do_softirq() calls account_irq_enter_time() with irqs
already disabled, and also has irqs disabled when it
calls account_irq_exit_time()

This appears to be true for both ksoftirqd and softirq
from irq context.

This could simplify my patch series a lot :)

-- 

All Rights Reversed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-07-08 15:56 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
2016-07-08 14:34       ` Paolo Bonzini
2016-07-08 15:56         ` Rik van Riel [this message]
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=1467993409.13253.31.camel@redhat.com \
    --to=riel@redhat.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=fweisbec@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --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