From patchwork Wed Mar 4 14:35:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 45424 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A078D21416 for ; Wed, 4 Mar 2015 14:40:22 +0000 (UTC) Received: by labhs14 with SMTP id hs14sf19398915lab.0 for ; Wed, 04 Mar 2015 06:40:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding:cc :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=FiGm/qCEJzBt2QBbpW1bg91ikm+b+XYedJVEUeTcGfw=; b=KIIJ2W2OovLw5b02a+QDbQ5AIzwkqT2+3BX2DCnmsee2Vv/ViY4my1+uj1wVRq2lJN yQN0xpPVUM07LL849vMaXxsYxeWN1mCmgbaNeP9ObjBieYcvBxLxztIuTt+MxEKoqm/Q bf9pKwAkCXLfkgMynS/g9WWBReb8+94Rr2HCIfjEol9yTPBm8voC9P8HkKEwoycUxMNR NYEQSYY0LExADmH4Inmk/xMtlRyTghIwjYgIx+MR8tLo8xM/MrEs5iTLSGIrV3Py10mh K6EndcLfPuBiGatbCpTg/+o/Dn993+PTfS6FJBr6OZHV9NWrTcMUA65BtAaWpZZCjxK8 UJhw== X-Gm-Message-State: ALoCoQmcteDlHCwHKJYDan7j4n7yv0dA3sRzR2daZE4H/AoFOmMyPPJ8GXVyaq9nGXPjWDhSq1LR X-Received: by 10.112.156.65 with SMTP id wc1mr749766lbb.7.1425480021514; Wed, 04 Mar 2015 06:40:21 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.172 with SMTP id dd12ls207773lad.20.gmail; Wed, 04 Mar 2015 06:40:21 -0800 (PST) X-Received: by 10.152.10.179 with SMTP id j19mr3880968lab.102.1425480021368; Wed, 04 Mar 2015 06:40:21 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id lm12si2574936lac.175.2015.03.04.06.40.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 06:40:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labgf13 with SMTP id gf13so20338873lab.10 for ; Wed, 04 Mar 2015 06:40:21 -0800 (PST) X-Received: by 10.112.130.39 with SMTP id ob7mr3955884lbb.32.1425480021243; Wed, 04 Mar 2015 06:40:21 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1260679lbj; Wed, 4 Mar 2015 06:40:20 -0800 (PST) X-Received: by 10.55.20.143 with SMTP id 15mr7900159qku.36.1425480019937; Wed, 04 Mar 2015 06:40:19 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j9si3598231qan.53.2015.03.04.06.40.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Mar 2015 06:40:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:44459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTATD-0000Sf-3P for patch@linaro.org; Wed, 04 Mar 2015 09:40:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTAPF-0002KA-8W for qemu-devel@nongnu.org; Wed, 04 Mar 2015 09:36:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTAP5-0007Kr-RR for qemu-devel@nongnu.org; Wed, 04 Mar 2015 09:36:13 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:57768 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTAP5-0007JB-M6 for qemu-devel@nongnu.org; Wed, 04 Mar 2015 09:36:03 -0500 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YTBOk-0007Xe-SQ; Wed, 04 Mar 2015 16:39:47 +0100 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 4 Mar 2015 14:35:50 +0000 Message-Id: <1425479753-18349-4-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1425479753-18349-1-git-send-email-alex.bennee@linaro.org> References: <1425479753-18349-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.198.71.155 Cc: kvm@vger.kernel.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org Subject: [Qemu-devel] [PATCH v2 3/6] hw/char: pl011 don't keep setting the IRQ if nothing changed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 While observing KVM traces I can see additional IRQ calls on pretty much every MMIO access which is just plain inefficient. Only update the QEMU IRQ level if something has actually changed from last time. Otherwise we may be papering over other failure modes. Signed-off-by: Alex Bennée diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 0a45115..bb554bc 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -36,6 +36,9 @@ typedef struct PL011State { CharDriverState *chr; qemu_irq irq; const unsigned char *id; + + /* not serialised, prevents pl011_update doing extra set_irqs */ + uint32_t current_irq; } PL011State; #define PL011_INT_TX 0x20 @@ -53,10 +56,11 @@ static const unsigned char pl011_id_luminary[8] = static void pl011_update(PL011State *s) { - uint32_t flags; - - flags = s->int_level & s->int_enabled; - qemu_set_irq(s->irq, flags != 0); + uint32_t flags = s->int_level & s->int_enabled; + if (flags != s->current_irq) { + s->current_irq = flags; + qemu_set_irq(s->irq, s->current_irq != 0); + } } static uint64_t pl011_read(void *opaque, hwaddr offset,