From patchwork Thu Sep 19 23:29:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174109 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp1589211oce; Thu, 19 Sep 2019 16:30:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwn9/Ah6dmAtxrQntttIA/b+gduplwUVy9UhHi8zcEO8koS+CYqtzsHEMajHO7wRIw/1c9n X-Received: by 2002:a17:907:411d:: with SMTP id nw21mr16315000ejb.8.1568935836563; Thu, 19 Sep 2019 16:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568935836; cv=none; d=google.com; s=arc-20160816; b=OaolL0lRar3tiuYZGa0ydgpUdTPei4L/4sFYvYWoYyKUJCclBmEEEf/zCFascKAQG0 zDeblfgq8eDSnLUD0okacpg2pWRHfvQU5THnM2C8u+nFW8MeDjwWnwTCTisWJZGHJDgE fSEj6HwuyPmSHlc9haRdmAslFi887Iobs0pIHm2oOgHk5DoTuoEmYJnVu1Gr5u2x0RsJ qRcpmREE8Mv5leoAhWKs98LqIMGkSPatwvKkbWYBpiJZK5v3wfw26JNQj+x7DQHXWihl TPuQJGMP4xXl8+msrTeETRfGt3as5PEffZqkJeQbpLP0wvZ1AQPPTfFlsmDeEMp0qWa/ ppaA== 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:message-id:date:subject:to:from :dkim-signature; bh=+1oeXQseKrei+GHbOaidjKnLfGpU8gMtcIAwTzhYn3w=; b=geY2n6QMTwPp+kp8m7l4BNbNycerYPKGtHGgQR623RL55hFE6pJudXHhnk28O7Cs7U DG0MVaz+3+LSK3gbrYYZU2SMHp6V1nyAtj9YYkYx0ycSvL8XTflTbFFVhHhm3l7ySIDA tBLVfFaTWXrLYqXgvt3qZcEDPZIpGaCt69jKtja5gIAbgpAKZQhSDzF7dPfJL+ENPV1H ql0JxvPWi4+Mx9ps7V5+r1zHzv4KvrQdsWiolPMFPX1WquzUnYpbphltsuXIH9xIIQBE iuAjGN1qTENArDUHRJCx663vP9bs6pvlrzTDQyKFLVa9zCMdjXGK/wiT0coCpzwt1iN9 5AMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wp1vSx0p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ca7si41560ejb.319.2019.09.19.16.30.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2019 16:30:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wp1vSx0p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB5sg-0006I5-IR for patch@linaro.org; Thu, 19 Sep 2019 19:30:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39217) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB5s5-0006Cp-MD for qemu-devel@nongnu.org; Thu, 19 Sep 2019 19:29:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iB5s4-0000iP-A6 for qemu-devel@nongnu.org; Thu, 19 Sep 2019 19:29:57 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:40970) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iB5s4-0000i5-2N for qemu-devel@nongnu.org; Thu, 19 Sep 2019 19:29:56 -0400 Received: by mail-pl1-x642.google.com with SMTP id t10so2301376plr.8 for ; Thu, 19 Sep 2019 16:29:56 -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; bh=+1oeXQseKrei+GHbOaidjKnLfGpU8gMtcIAwTzhYn3w=; b=Wp1vSx0pcWXq2B/YX7BhgapehSwCo3wVfqzPoRnatNFECxxdPeg8hl0IMcyX7J9ehF TxoAlY8bSNIk8qXy6ClBqGlNGngI72+Z5tJ0ShqVuUNOQAumA0T4ROHH8tE3oSsY+81Q GUGKCrzFubNIRGwABTtThkIwbGrGz86A8JLcLw4YXLYskCi6GaxuAM618WdeZYfafPT4 5ABx4E3nheFFggL6lch4JbZsXA9quzjUUjBrislYqCcgxByq+fSCWYXrSlqVp0DMFATX cq7vMzXtsDLLI1gXDx7R28KJ4NSdZAVKcZ3wz4uGNJANjypTmaStPDSljWUIspX7v1SP Clnw== 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; bh=+1oeXQseKrei+GHbOaidjKnLfGpU8gMtcIAwTzhYn3w=; b=g9VblAXn9vUcJHdkei/L6cg386YSnU3WzKF1Cir7UxwyQ1Clwt7ByayU7eTIiiOPNF 51ZmLS0t9QiEYNN/cNnOW5KWHWvgAPMO3/ulmeL49ICSsHTZDrCrp9I402nnxNA+q+1d UrkUESiMVOLOjt0A8HvzkHpR1JJi3WBJkY0oDvAgusu8aW167C6aH6t8dDdg6goE9WGw azpJrREGVMUAC/J2VcybYcQIit4YeakGqCMVkaAXbLclbSFmLaMSMtbRWuvR3uM2QLL4 pFBdCCCBvz9oceqfLVtqsB33dlwuHg5AU3n9bbf9Cuw47FzdIbIkYmFUSfMnD5d1qtmF 7gXQ== X-Gm-Message-State: APjAAAUyqbGOqk7zI1KWLbl0xB7fKSRz8U+m7TFuhRURwCLF4qp8ooJJ uMywnnTxgIcBQgs5Lv5ifvizy/kJJYY= X-Received: by 2002:a17:902:9a88:: with SMTP id w8mr854023plp.129.1568935794336; Thu, 19 Sep 2019 16:29:54 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id h8sm103340pfo.64.2019.09.19.16.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 16:29:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 0/7] exec: Improve code for TARGET_PAGE_BITS_VARY Date: Thu, 19 Sep 2019 16:29:45 -0700 Message-Id: <20190919232952.6382-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There's currently a fair amount of overhead in the way we currently treat TARGET_PAGE_{BITS,SIZE,MASK} with TARGET_PAGE_BITS_VARY. We have assertions that TARGET_PAGE_BITS has been finalized. Which is fine, but the variable that controls the assertion may be assumed to be modified by any function call, which means that we have lots of duplicate assertions. This re-arranges things using a const symbol, which allows the compiler to assume that the variable is not modified across calls. In order to allow initialization of the variable during startup, use an alias that is non-const and controls the allocation into a read-write section. Remove the assertion for release builds. Precompute TARGET_PAGE_MASK. This removes a runtime shift and allows the variable to be used as a direct memory operand on x86. Size reductions vs master for qemu-system-aarch64 for various hosts: PPC64LE: debug-tcg: -32264 release: -44360 AARCH64: debug-tcg: -33304 relase: -77080 X86_64: debug-tcg: -6685 relase: -15597 r~ Richard Henderson (7): exec: Use TARGET_PAGE_BITS_MIN for TLB flags exec: Split out variable page size support to exec-vary.c exec: Use const alias for TARGET_PAGE_BITS_VARY exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG exec: Promote TARGET_PAGE_MASK to target_long exec: Tidy TARGET_PAGE_ALIGN exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY Makefile.target | 2 +- include/exec/cpu-all.h | 41 +++++++++++++------- include/qemu-common.h | 6 +++ exec-vary.c | 88 ++++++++++++++++++++++++++++++++++++++++++ exec.c | 34 ---------------- 5 files changed, 123 insertions(+), 48 deletions(-) create mode 100644 exec-vary.c -- 2.17.1 Reviewed-by: Paolo Bonzini