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: 1164955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Wp1vSx0p"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46ZCmC41wqz9s4Y for ; Fri, 20 Sep 2019 09:31:37 +1000 (AEST) Received: from localhost ([::1]:49682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB5td-0006I5-AV for incoming@patchwork.ozlabs.org; Thu, 19 Sep 2019 19:31:33 -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-Google-Smtp-Source: APXvYqxU/jMrGpkgzYANQIqjBCfFXSrE9rM0TplCW+xSuv147LXpStpGWfz/NentqXPnFRvcP5bYMQ== 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+incoming=patchwork.ozlabs.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 Reviewed-by: Paolo Bonzini