From patchwork Tue Mar 31 03:54:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 185079 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp3243851ilr; Mon, 30 Mar 2020 20:58:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvSxaOs0sNLKAn4GIYvA1HXWbC4yH9W3NfgcZYQHVndr0Y3oYd8ZfNHoZDA6fIhXNlFSRfr X-Received: by 2002:aed:39e4:: with SMTP id m91mr3345231qte.188.1585627121234; Mon, 30 Mar 2020 20:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585627121; cv=none; d=google.com; s=arc-20160816; b=ucHuzt7paoEIq38YIzlN38KivqoeqRO+1rLpWjp8YJ93jHsT0wdkwV77xW1XcGb8pE 8Cy1tdvJWDHs6ue5FJYSGqF4akuR4gaPRetmEfg1iIjgnK80j6GQFElKIPSvzvHfjlOh dOoUj9f5X+vVMyQIec56CyUi11vrR8KQ97Exav4Qyy6+zCC4UWuzqJBpj70b97MVOeBu a1cLwF+eg2lUlq4EMQP0sSc1L2iUgS7dwE+75lm9QOqTxX+oqDR6qDffYOJD/YONnJsK fYL85j4myofL/Nb8XAugtqFnt+vrgwe6uihgqTs0dEgcfQMltN3IOA8rBwmRnZh3/X6s Shvg== 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=AVWo3TkNC8dRck4gxr30FMdUL1YEqwhhQceYuT351jQ=; b=fMTFks0UBMXRY3B6yk6YtZu+wGzduT9mP2JhqchfsDKav8Cu/N9AKNwTjarlrhCWGK Eno3uByeKwcSepeyonyc9vzDCbkdgWJJHk2Xd1A+K6BNUspUHL9wjkyGDsrBYzl/hyno LUPW4Fi6UU9AKPN/zUk/EjfWOxy30fS+cA3Kle0kKysepxXcNPZHoL78zn0Ql/jrTi+D 3ipK1X8EpUErxLyzijux9+8iA0pzKHGA8O6+RScKR8onUFPFqruQ6yJ1E15Hbk+pEC7R jmW+j6ZaqCxSATRqM3QCLBHPvLJWynZHJWJ62WET5Jp+c2UxOmYCSAbugkfyHZj1vxPY tfTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bFf0kUgR; 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 r2si8958119qte.140.2020.03.30.20.58.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Mar 2020 20:58:41 -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=fail header.i=@linaro.org header.s=google header.b=bFf0kUgR; 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]:60058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ82y-0003Qx-Ot for patch@linaro.org; Mon, 30 Mar 2020 23:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60824) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJ7zV-0004Yz-BN for qemu-devel@nongnu.org; Mon, 30 Mar 2020 23:55:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJ7zU-0008Dd-7Z for qemu-devel@nongnu.org; Mon, 30 Mar 2020 23:55:05 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:45380) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJ7zU-0008Bu-2E for qemu-devel@nongnu.org; Mon, 30 Mar 2020 23:55:04 -0400 Received: by mail-pg1-x541.google.com with SMTP id o26so9721610pgc.12 for ; Mon, 30 Mar 2020 20:55:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=AVWo3TkNC8dRck4gxr30FMdUL1YEqwhhQceYuT351jQ=; b=bFf0kUgR2GoEiqNITsPTFpdjOaZesDn+wYad7Gh0iG49tzG5u2a2oEJQNnNhcTGX5B RyTqpddoBt4K2NCnDDl8Bnpvau+enrW5R2sP6RPrXFIH1kxVicUqy9nfeMZehHJHqMiW QB8RT4OJeJK5Nk8DLzvHNlOeomqP/Qg/TkxyZIQH+bMEu0Z1RH19ZQCgkKHN6BnSzs0k o0wcYBeW8qDwKlSL52l7aK+5p/46Zx+aHi3OgRyN2azTSdSmgT3LoJewLhg3b+E+K3gH 1KhKt2CRUG8ghS9/P/GshRIb0tuR3lvd/Ju+f3feq1oCznGP7bDTAOXyeBSFOsquczAx /3kQ== 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=AVWo3TkNC8dRck4gxr30FMdUL1YEqwhhQceYuT351jQ=; b=ZrQU5/0m2NqhzHs9tEmCzB3CswxDyrlxocu0gwGQliW0KMZbo3+FwAjzTfawMzg0Az sVIU2JVKjlLDFItEEtRP3vqP7b8qvirXsurtd9a5oYEI6UcGCXof2phoU+CwWK0ECIWe KsSX9Q8Jsr76hu9HLugWqmKULRC+gzF489dcxE8LDN14/dmstkC6uB3GEadmAIMlk61f vaV6SstssYXRDMuOuTeadZFInCgE/Cykesp5UJsqe+WCnN+heMyPkP9tDXTGfDqn6Cx1 6vSsHxLr3nVliRu+2YkSq32Hr8NK6ZA+ECOvOaGJpZIx6E+yBXIaikjnj7VD4SfO3FxE 44Rg== X-Gm-Message-State: ANhLgQ3ZtJdlZx8gc7Z1JWWpj4cwRhaGtLv6y7sPsPCLgalvXe0lIkn9 feSvUAjP1soSdcF8yxzE+DUIR3wNgy8= X-Received: by 2002:a62:7dd0:: with SMTP id y199mr15872936pfc.267.1585626902674; Mon, 30 Mar 2020 20:55:02 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id h11sm11386174pfq.56.2020.03.30.20.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 20:55:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL for-5.0 02/10] tcg: Remove softmmu code_gen_buffer fixed address Date: Mon, 30 Mar 2020 20:54:48 -0700 Message-Id: <20200331035456.6494-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200331035456.6494-1-richard.henderson@linaro.org> References: <20200331035456.6494-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::541 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: peter.maydell@linaro.org, Thomas Huth , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= 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: Alex Bennée 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 78914154bf..9924e66d1f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1043,47 +1043,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)) {