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 From: Peter Maydell Date: Tue, 13 May 2014 16:31:32 +0100 Message-Id: <1399995099-26635-11-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1399995099-26635-1-git-send-email-peter.maydell@linaro.org> References: <1399995099-26635-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 10/17] target-arm/helper.c: Don't flush the TLB if SCTLR is rewritten unchanged List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org 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. */ -- 1.9.2