From patchwork Wed Feb 25 16:02:35 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: 45087 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B55C72142A for ; Wed, 25 Feb 2015 16:05:15 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id r20sf4158680wiv.3 for ; Wed, 25 Feb 2015 08:05:15 -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=JMB/lnggPSmlW8LlcGRlY4ivl+gnLAT1SaMtFrllaHk=; b=gV8YEinoidQmzWqqqSmmC9HsMtj2FeKE4mOWk/kXcoY2E5t4760kdaKZ+jjf6mMm7b 3eae9/BV98bo0dMXI1rYdvZU9YecO5VfXY9DEpX1X9J0uf0M1PO0snGAlaW3Tg1U60mS LroDAUjP4jNBk5HqZkpmJWuX8NRPlan0Zj0YCgeAjp2vVZA8PNLCgkJHE5Ax6Ik1iXBY +LODElj01X8cO2sEG6SNlEa2KxdT3Zphe/jqFU0jTje22YL9OmziAj79578ec818v48y JZetf/E7+1DvvG2ICRniQzcfLBLQgU9jREPPHbr93CJ9s6J0JdHtB/spEgnIC9aqTxES X5BA== X-Gm-Message-State: ALoCoQnZhAKYEqjxj3vSK49zhHlBqOgMdIQKdfNlN2/WBcwPFi2BPtbb7rOCRDrSAvaK0Qnb30QP X-Received: by 10.180.160.176 with SMTP id xl16mr2136044wib.6.1424880315026; Wed, 25 Feb 2015 08:05:15 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.137 with SMTP id dw9ls60770lac.85.gmail; Wed, 25 Feb 2015 08:05:14 -0800 (PST) X-Received: by 10.152.7.162 with SMTP id k2mr3333385laa.92.1424880314862; Wed, 25 Feb 2015 08:05:14 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id yi11si18360499lab.138.2015.02.25.08.05.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 08:05:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbiz11 with SMTP id z11so4823565lbi.8 for ; Wed, 25 Feb 2015 08:05:14 -0800 (PST) X-Received: by 10.112.14.196 with SMTP id r4mr3469480lbc.86.1424880314718; Wed, 25 Feb 2015 08:05:14 -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 h5csp2713351lbj; Wed, 25 Feb 2015 08:05:14 -0800 (PST) X-Received: by 10.140.192.133 with SMTP id n127mr8679663qha.1.1424880313465; Wed, 25 Feb 2015 08:05:13 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e37si42777848qgd.75.2015.02.25.08.05.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 25 Feb 2015 08:05:13 -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]:54769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQeSW-0005t5-I1 for patch@linaro.org; Wed, 25 Feb 2015 11:05:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQeQA-0002PY-9g for qemu-devel@nongnu.org; Wed, 25 Feb 2015 11:02:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQeQ8-0006pN-Lo for qemu-devel@nongnu.org; Wed, 25 Feb 2015 11:02:46 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:47128 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQeQ8-0006oV-G6 for qemu-devel@nongnu.org; Wed, 25 Feb 2015 11:02:44 -0500 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YQfO9-0007hX-Sa; Wed, 25 Feb 2015 18:04:46 +0100 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 25 Feb 2015 16:02:35 +0000 Message-Id: <1424880159-29348-4-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1424880159-29348-1-git-send-email-alex.bennee@linaro.org> References: <1424880159-29348-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 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.217.170 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,