From patchwork Mon Jul 10 14:28:49 2017 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: 107299 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3498042qge; Mon, 10 Jul 2017 07:30:50 -0700 (PDT) X-Received: by 10.237.47.39 with SMTP id l36mr4543306qtd.181.1499697050270; Mon, 10 Jul 2017 07:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499697050; cv=none; d=google.com; s=arc-20160816; b=oDPCtVbrcMamfRfCOC/gAjNEAV3imHpNmK0sUj6gLHRvXtyeHboERDVmBU6U9UKHi0 qmm6MiF8s9zzTPbxY/R0Eib2pAr0ZgGn4d45dHQUQdbeZrkzRLvc85gN0An7su+hr1h0 Ul8Ujiv5x6RmgXBjQ3hMN2nCNocXPT/ly7DBROMmFsGTWU1fI4knqeHfbAzyTyPsa5nY eLfy0HXLrBCQcripLuMZaylMxiokPZqWxVVj7IwUUetjbd9oCMTQbEEMBX9gsxS3XDw1 fZL5I86muaiotnMB55xvxU0wYFV25J1ryM4cRrmPBEc7yN1nj4tUxj06zw6jxz7aniBJ oLtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=9ghkIFhkGKX++ZLRubxIAyFqtuoLGJOCOd3QveV11vs=; b=nXDItdQ54u0+9ZZhrCoxLiHU8NdBIz0blNOnjxp1lwe4Mi+xrG/6JeJUmRXpMNNo8g vWzItsNjDoppFRVxTLnWqNN6c3g8TKf9m6A/+/nlM5Kuz1OODyBUQODK0Me/by/6h3M4 GSnPDZbXC3SYdGDjeOfGAUOmXxMGG59X1j1bcOCKd7nz2vyEYL79boltfHdHqN0Q4QiX hsDB9Q7565rsNlrTnl2zLURiQXG7svoXmRj0c5rlsFZIQjk5pO83Jr2tHuMI35CTBrH6 5tQ/EN8Jk0B4ik7XKU/dhQYpOXCnTvYqoMDM5CYUNytI4GtcQ7DQyN5p/Kj4uzQjVBo4 UsCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=aLLpu0KP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id m23si10971129qtb.270.2017.07.10.07.30.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 07:30:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=aLLpu0KP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUZi3-0008Lz-M0 for patch@linaro.org; Mon, 10 Jul 2017 10:30:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUZho-0008KW-J8 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 10:30:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUZhl-0006cN-HR for qemu-devel@nongnu.org; Mon, 10 Jul 2017 10:30:32 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:32937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUZhl-0006br-AR for qemu-devel@nongnu.org; Mon, 10 Jul 2017 10:30:29 -0400 Received: by mail-wr0-f180.google.com with SMTP id r103so141347350wrb.0 for ; Mon, 10 Jul 2017 07:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9ghkIFhkGKX++ZLRubxIAyFqtuoLGJOCOd3QveV11vs=; b=aLLpu0KPaYVmYR2C7BWnEnhGUE7RxNuD+IYs9iMxVn3ITVA5VgNrJfv0AB7VnQp5RO wHnJvf/NWeGZpEB9/+9fsAwcGOkL0U4UYwJWAjkyRHrPz5zolLjA7iXeYTZM6zQ3f4pd uJXPUCZuToCgt6s/TijNEXmPJHNeJDN7hoSUk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9ghkIFhkGKX++ZLRubxIAyFqtuoLGJOCOd3QveV11vs=; b=COxK+I1Bznk7bM05IOUKxNnRnk6WHyr29oum5kj+JJz90UX0IvzNNFvrFD+qnKgYMh E/FtW4dlgUGxW6DhGIBCM8saov0rDg+iZSkoTOEABTCdzbN57XdAQsz7drY32oSbHoKi Frf1HhuB3GhNHA5Ew+qlfQYl+/TZAqgk4qj5tfHSOa56MASI3sEx4uqZG4my8KeRF7uL TEHqxI1UH5awtkkTbOHHVbcQ7S7bTEOu8983Z+3MhJ2f8sUg9zx7KKFqKHQng0GLJ3z/ ylZOyfobON1+5+d/l6W8mv7eC70t/Y6fHlpqLC3MyRvDTkLSzysfmTM5KFGB6z0Twh7Y kcsw== X-Gm-Message-State: AIVw110Xb1YtuwmYh0iVbhO5SQsv3E5T8Sm7kPSoWFF24UKYpZEpdzlD IqdJRZZdFghbNb9j X-Received: by 10.28.128.67 with SMTP id b64mr8062379wmd.79.1499696967927; Mon, 10 Jul 2017 07:29:27 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 3sm5512727wrs.18.2017.07.10.07.29.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 07:29:26 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4E99F3E0157; Mon, 10 Jul 2017 15:29:26 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, bobby.prani@gmail.com Date: Mon, 10 Jul 2017 15:28:49 +0100 Message-Id: <20170710142850.10468-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.180 Subject: [Qemu-devel] [RFC PATCH] include/exec/cpu-defs.h: try and make SoftMMU page size match target X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , qemu-devel@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While the SoftMMU is not emulating the target MMU of a system there is a relationship between its page size and that of the target. If the target MMU is full featured the functions called to re-fill the entries in the SoftMMU entries start moving up the perf profiles. If we can we should try and prevent too much thrashing around by having the page sizes the same. Ideally we should use TARGET_PAGE_BITS_MIN but that potentially involves a fair bit of #include re-jigging so I went for 10 bits (1k pages) which I think is the smallest of all our emulated systems. Some quick numbers show a reasonable performance win on an x86_64 host: ./aarch64-softmmu/qemu-system-aarch64 -machine type=virt \ -display none -m 16384 -cpu cortex-a57 -serial mon:stdio \ -drive file=../jessie-arm64.qcow2,id=myblock,index=0,if=none \ -device virtio-blk-device,drive=myblock \ -append "console=ttyAMA0 root=/dev/vda1 systemd.unit=benchmark-build.service" \ -kernel ../aarch64-current-linux-kernel-only.img -machine gic-version=3 -smp 4 8 bit TLB: run 1: ret=0 (PASS), time=425.202797 (1/1) run 2: ret=0 (PASS), time=410.421742 (2/2) run 3: ret=0 (PASS), time=417.666752 (3/3) run 4: ret=0 (PASS), time=411.158793 (4/4) run 5: ret=0 (PASS), time=417.133068 (5/5) Results summary: 0: 5 times (100.00%), avg time 416.317 (35.70 varience/5.98 deviation) 10 bit TLB run 1: ret=0 (PASS), time=359.310380 (1/1) run 2: ret=0 (PASS), time=387.826981 (2/2) run 3: ret=0 (PASS), time=381.097123 (3/3) run 4: ret=0 (PASS), time=393.826197 (4/4) run 5: ret=0 (PASS), time=384.340781 (5/5) Results summary: 0: 5 times (100.00%), avg time 381.280 (173.08 varience/13.16 deviation) CC: Pranith Kumar Signed-off-by: Alex Bennée --- include/exec/cpu-defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.0 diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index bc8e7f848d..a0f9249752 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -89,7 +89,7 @@ typedef uint64_t target_ulong; * of tlb_table inside env (which is non-trivial but not huge). */ #define CPU_TLB_BITS \ - MIN(8, \ + MIN(10, \ TCG_TARGET_TLB_DISPLACEMENT_BITS - CPU_TLB_ENTRY_BITS - \ (NB_MMU_MODES <= 1 ? 0 : \ NB_MMU_MODES <= 2 ? 1 : \