From patchwork Wed Dec 18 22:34:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182031 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1280799ile; Wed, 18 Dec 2019 14:35:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwBnZ/DIMoxQWMfw8+CETLua2qGxPcDPgjjWGzIsn1EgAmqPvEsiMwRRa0XPszaSasWK+HL X-Received: by 2002:a9d:461b:: with SMTP id y27mr5596632ote.280.1576708510638; Wed, 18 Dec 2019 14:35:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576708510; cv=none; d=google.com; s=arc-20160816; b=Gqkb7wS9qw0VbNkdCxQk9dTeeYY39RFH9f4+giLLii2uDlcmo4NSkC7laOVARnceQV 6I4+DSeY5K5VGnMZWld6kWuE3RWdjZXMI8jU7Gz9puKhCPSb8yvn3RPo9Je7yzcZ5vdF AEIrpBtrrabgeLateWALmoGRxCKaG/Bw2z4kLhccngfgAu9qMbhl0vRpkK32MNJ0bK1P zekp+mo4FnrVuhLEHYjDoXHs490okD6KTncyl2sgXJo3xJehh3Pg9I5YISnFRGZgC1yI EgyysNuxfklhI52uZkEPWQvTcccSnBurOx2T0PzWaYkwx8L8oMkCBdVJaYPBtMYHZIy7 iU8w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=M89NR5346hcsRB2SUkQwEfQ5idMR/OARU10zt8sGydk=; b=GIDS/1BCj05icegTJ0WlVAessStEeIwoO4AQCQTEA3WuN03CrG9XPR4mc5j7zVd5kv ifiXjRJp5R2BFn6C2TV8fZn4nuBhhIiwS6VnWRDQojs3J2fnpg8s4h3wRq26b46Opd/1 83G6JtHNVfflzMc61G/tPqkaWZHsfPAX0SBXwT+q5nD7jCjALoF2bBlXxFrGDvYsLYPS o6Q+rg7n8kTBpVcPxl57v9cUVKWccMQ8wD1yFr2JkK0ojtq6eYZJrQwPSj6HaxYRequL 5UuvhLbIBILoZmV+r72LRbLPTGJJnY7YZ6C/eyJ/NYmNX2n4s2Fw4zdgacLXqyKfwmwW q96g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x3aoTvBd; 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=fail (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 x26si2359994oto.1.2019.12.18.14.35.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Dec 2019 14:35:10 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=x3aoTvBd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhuP-0001UO-Oe for patch@linaro.org; Wed, 18 Dec 2019 17:35:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54291) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihhu7-0001TH-3c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihhu5-0003ub-G1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:51 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:37919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihhu5-0003ty-A8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 17:34:49 -0500 Received: by mail-pg1-x543.google.com with SMTP id a33so2030337pgm.5 for ; Wed, 18 Dec 2019 14:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M89NR5346hcsRB2SUkQwEfQ5idMR/OARU10zt8sGydk=; b=x3aoTvBdaO578ZgCkCRuB0yRK+lJgM0k+ebUU7JwVoU4ixYOvNbAWMgor1/uLQAY0y KCTJ0bFqjEiUyvgGigEGFc2YQcBFNCBJoLKR4Z9sk23zCtrUS2FWwx06YGflycnJiMHp ZcdtxB/iXP+mHiA9mJR9tF0FpLjLgAbPvpYXX4yOTAK+C7no+yBIBCenwYbVr5ZK2Kwc qcqsSVIVG8FQX19MJSJvyTUwuQAuo8rQznCoyHVUTmuwMNcO+oQRcEyFyUuqJRWxvcRO Dh7NgorLwbJYrZyTEwYuMcrDbCKUfTW4wPtZqg+QzpGoxVTesitF4yk3vYDpwNRdSGH0 DkTw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=M89NR5346hcsRB2SUkQwEfQ5idMR/OARU10zt8sGydk=; b=kbRl3pJrHIKkCfKxLpeNVymRTEFWuONTdwcuVs+kqPz2FP5xqK4BBrHrVAb9kKj2Pz mx9bzx5tdJlDUP2WSyVknZOmeY71ctkPR1shFOnU7FycNN6Ou/EzzNimwpJi4dUxET9P BdpCQgiepy3QZAFQVYP4smrbGJj8bt0jLKPVeiaUGqIZZfXhf2acpqHf46RA10OTo9AW OOH26oaDUZZYYMVt32LKoGeKRh0G6PVyzJ2k7C9/t0o9t+1dgHA3XzDKi73XEnTHOnsL To4QE9uJuzV5SELSCxY4tG/ItQFB04wFwMuZMvzIAS6us3IhWZBhtj5Edyaswj4oG2LH hZhQ== X-Gm-Message-State: APjAAAV15zbH6O/afwIk+PM9Zcwvkbx7A7/jHpLvGLxk/081vlI51QN1 ba40ICJb/IFt+09rFy/abnvFdQ0+CSY= X-Received: by 2002:a63:d047:: with SMTP id s7mr5495335pgi.81.1576708487922; Wed, 18 Dec 2019 14:34:47 -0800 (PST) Received: from localhost.localdomain ([2605:e000:c74f:dc00:6838:d2b2:17e2:8445]) by smtp.gmail.com with ESMTPSA id j1sm4627779pff.107.2019.12.18.14.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 14:34:47 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 2/7] tcg: Remove softmmu code_gen_buffer fixed address Date: Wed, 18 Dec 2019 12:34:36 -1000 Message-Id: <20191218223441.23852-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191218223441.23852-1-richard.henderson@linaro.org> References: <20191218223441.23852-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 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: philmd@redhat.com, Thomas Huth , i@maskray.me, berrange@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The commentary talks about "in concert with the addresses assigned in the relevant linker script", except there is no linker script for softmmu, nor has there been for some time. (Do not confuse the user-only linker script editing that was removed in the previous patch, because user-only does not use this code_gen_buffer allocation method.) Reviewed-by: Thomas Huth Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9f48da9472..88468a1c08 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1032,47 +1032,20 @@ static inline void *alloc_code_gen_buffer(void) { int prot = PROT_WRITE | PROT_READ | PROT_EXEC; int flags = MAP_PRIVATE | MAP_ANONYMOUS; - uintptr_t start = 0; size_t size = tcg_ctx->code_gen_buffer_size; void *buf; - /* Constrain the position of the buffer based on the host cpu. - Note that these addresses are chosen in concert with the - addresses assigned in the relevant linker script file. */ -# if defined(__PIE__) || defined(__PIC__) - /* Don't bother setting a preferred location if we're building - a position-independent executable. We're more likely to get - an address near the main executable if we let the kernel - choose the address. */ -# elif defined(__x86_64__) && defined(MAP_32BIT) - /* Force the memory down into low memory with the executable. - Leave the choice of exact location with the kernel. */ - flags |= MAP_32BIT; - /* Cannot expect to map more than 800MB in low memory. */ - if (size > 800u * 1024 * 1024) { - tcg_ctx->code_gen_buffer_size = size = 800u * 1024 * 1024; - } -# elif defined(__sparc__) - start = 0x40000000ul; -# elif defined(__s390x__) - start = 0x90000000ul; -# elif defined(__mips__) -# if _MIPS_SIM == _ABI64 - start = 0x128000000ul; -# else - start = 0x08000000ul; -# endif -# endif - - buf = mmap((void *)start, size, prot, flags, -1, 0); + buf = mmap(NULL, size, prot, flags, -1, 0); if (buf == MAP_FAILED) { return NULL; } #ifdef __mips__ if (cross_256mb(buf, size)) { - /* Try again, with the original still mapped, to avoid re-acquiring - that 256mb crossing. This time don't specify an address. */ + /* + * Try again, with the original still mapped, to avoid re-acquiring + * the same 256mb crossing. + */ size_t size2; void *buf2 = mmap(NULL, size, prot, flags, -1, 0); switch ((int)(buf2 != MAP_FAILED)) {