From patchwork Tue May 13 15:31:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 30064 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C163B20369 for ; Tue, 13 May 2014 15:33:04 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id q9sf944875ykb.11 for ; Tue, 13 May 2014 08:33:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references: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=g1yPlBiUahk9yecKiCOQ28MD/SaxG8TzmK1MUCDsb6Y=; b=PreUwzwai3Xvs9qzgRAPrUQsjf13XL5Cs01BwgA2plH0sMJdp+1gbnVk6y5O2WJr1S cRw1/ugqfZS9l2bbqw2gBPHXQZbX7KwTOdGbtSOU4m7PegOXo9BZZc2yf1pvtw+TkAXp Zy7GB6Xirko1ePjgVO/7QD6OO/EMJrIdPoQrGx8FuZD2dFiEwj5ZaawxY5FKm0YubsZW n96twTdcHJSlIxVNTxH5eGk4Wj00ciwe5S6EYH2IHSb9C8KLjNM2cAwGT5DzKioSPMld FmhO6Alxp5t+dlzeBBZXa0oN4Pok+KRN4DIMtDwdOOIfK3ECPHTW7ntBoFa3y/8HpDk1 rLgw== X-Gm-Message-State: ALoCoQmV3pXjRnMmskVyhQcZ8qOPza9Y4ElPCLuRkJC0jQmkyDCl7e33NgcIy9s1jF2dSA6iSpqA X-Received: by 10.236.128.195 with SMTP id f43mr14977095yhi.45.1399995184570; Tue, 13 May 2014 08:33:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.37 with SMTP id u34ls1989589qgu.4.gmail; Tue, 13 May 2014 08:33:04 -0700 (PDT) X-Received: by 10.221.59.194 with SMTP id wp2mr845768vcb.59.1399995184438; Tue, 13 May 2014 08:33:04 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id tj4si2696106vdc.195.2014.05.13.08.33.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 08:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lg15so668229vcb.7 for ; Tue, 13 May 2014 08:33:04 -0700 (PDT) X-Received: by 10.58.38.40 with SMTP id d8mr664013vek.61.1399995184373; Tue, 13 May 2014 08:33:04 -0700 (PDT) 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.220.221.72 with SMTP id ib8csp160467vcb; Tue, 13 May 2014 08:33:03 -0700 (PDT) X-Received: by 10.14.87.201 with SMTP id y49mr6228346eee.62.1399995183294; Tue, 13 May 2014 08:33:03 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v2si13451679eel.76.2014.05.13.08.33.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 08:33:03 -0700 (PDT) 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]:45857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEhR-0000uS-Ri for patch@linaro.org; Tue, 13 May 2014 11:33:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEgJ-00080D-D2 for qemu-devel@nongnu.org; Tue, 13 May 2014 11:31:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkEgI-00069x-G3 for qemu-devel@nongnu.org; Tue, 13 May 2014 11:31:51 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkEgI-00066p-A5 for qemu-devel@nongnu.org; Tue, 13 May 2014 11:31:50 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WkEg7-0006wz-Kl; Tue, 13 May 2014 16:31:39 +0100 From: Peter Maydell To: Anthony Liguori Date: Tue, 13 May 2014 16:31:32 +0100 Message-Id: <1399995099-26635-11-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399995099-26635-1-git-send-email-peter.maydell@linaro.org> References: <1399995099-26635-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 10/17] target-arm/helper.c: Don't flush the TLB if SCTLR is rewritten unchanged 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: peter.maydell@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.220.176 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 Linux makes a habit of writing the same value to the SCTLR that it already holds. In a sample boot of the kernel to a shell prompt it wrote the SCTLR with the value it already held 325465 times, and wrote different values just 3 times. Skip flushing the TLB if the SCTLR value isn't actually being changed; this speeds up my sample boot by 3-5%. Reported-by: Laurent Desnogues Reviewed-by: Laurent Desnogues Signed-off-by: Peter Maydell Message-id: 1399560029-19007-1-git-send-email-peter.maydell@linaro.org --- target-arm/helper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target-arm/helper.c b/target-arm/helper.c index 3be917c..417161e 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2081,6 +2081,13 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, { ARMCPU *cpu = arm_env_get_cpu(env); + if (env->cp15.c1_sys == value) { + /* Skip the TLB flush if nothing actually changed; Linux likes + * to do a lot of pointless SCTLR writes. + */ + return; + } + env->cp15.c1_sys = value; /* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */