From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755893AbcGHP47 (ORCPT ); Fri, 8 Jul 2016 11:56:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48674 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755457AbcGHP4x (ORCPT ); Fri, 8 Jul 2016 11:56:53 -0400 Message-ID: <1467993409.13253.31.camel@redhat.com> Subject: Re: [PATCH 4/4] irqtime: drop local_irq_save/restore from irqtime_account_irq From: Rik van Riel To: Paolo Bonzini , Frederic Weisbecker 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 Date: Fri, 08 Jul 2016 11:56:49 -0400 In-Reply-To: <4738023a-adcf-69b5-5856-12c4dc619363@redhat.com> References: <1467315350-3152-1-git-send-email-riel@redhat.com> <1467315350-3152-5-git-send-email-riel@redhat.com> <20160708123010.GD30200@lerouge> <1467983987.13253.25.camel@redhat.com> <4738023a-adcf-69b5-5856-12c4dc619363@redhat.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-WmmwEyWK5kITIywHl0qr" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 08 Jul 2016 15:56:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-WmmwEyWK5kITIywHl0qr Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2016-07-08 at 16:34 +0200, Paolo Bonzini wrote: >=20 > 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 > > > >=20 > > > > 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. > > > >=20 > > > > 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. > > > >=20 > > > > Signed-off-by: Rik van Riel > > >=20 > > > So the purpose is to get rid of local_irq_save/restore()? > > > Is it really worth such complication? > >=20 > > local_irq_save/restore are quite slow, and look like the > > largest source of overhead in irq time accounting. >=20 > 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: >=20 > 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] >=20 > [1] =3D does local_irq_disable/enable > [2] =3D contains WARN_ON_ONCE(!irqs_disabled()) > [3] =3D calls rcu_irq_enter(), which checks irqs_disabled() >=20 > I don't think your first two patches change this, so perhaps it's > enough > to remove that local_irq-save/restore?=C2=A0=C2=A0Either 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 :) --=20 All Rights Reversed. --=-WmmwEyWK5kITIywHl0qr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXf81BAAoJEM553pKExN6D1i0H/2CkdqUc6DuiHDDcsMuT6WkF 91LIRYJiqwgh6vClDBPYqjtN6BCSHLu8pKWrHM9dLMy3eY9jRlhNWhQccpm3jf2H nBrlRGK9D4R+0nEzx4yUuWIoSYKMZSedFTl5fTMS+BpHlgb29tuEpCha4AQuTyhp vWZmnOHhGPutR7IfTZnlT2HfY0fyQdd1PrhbHHRHBdpm80phT2ITtsX3syfkB28/ iy8gXeRmgGH2wY+SZux/T8xkCr/xRilh+SuU9QK5hMfzJwm6Xce8z8HduePErRvI 3v5jihuYN1bt7CFuT58g7nI/dyKCyZNC0iYr9nwaJN5cXnmLTTIoonrESkc3tyI= =xl5S -----END PGP SIGNATURE----- --=-WmmwEyWK5kITIywHl0qr--