From nobody Wed Apr 9 17:03:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1582944314; cv=none; d=zohomail.com; s=zohoarc; b=YTg7XDo1OaRKwjQre9Cc7B4jL4l138TS1jiwq8iwHb1RneEZjJeVaur1qxEnF36/qJlIgygz169FMgsfroVGSnfwneonIfEi+NLa2kY/yH7c+vydSizXJT/ynL/0HBwrQ/GU5bWb/zP/jQs+3ByK59C1g9mc/4DzMRb9T6D5NJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582944314; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VlxVvw9Nxub+F/a7czDjW6LNfb9GxIjz3UCnfFm+v5Q=; b=NA7qBhMc3m73AX48EH7nttRR7fF3FCWoDdu7Wt+uv7Vf2QM0NCYmhjQqu5TqeclX4T3GGIJT07aedLrv9sHFGcJKeCi/H54oPx4QlEkY4WZtj9rONl+pCGUqNnYnwqeYvHn+dTVlAaYImDdT8zhTeW40BWCPOjl+ZflTpj3Bwgs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582944314397754.2191416843717; Fri, 28 Feb 2020 18:45:14 -0800 (PST) Received: from localhost ([::1]:56498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7s7t-0000fN-0J for importer@patchew.org; Fri, 28 Feb 2020 21:45:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42769) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7s6l-0007A3-4K for qemu-devel@nongnu.org; Fri, 28 Feb 2020 21:44:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7s6k-0003I9-2B for qemu-devel@nongnu.org; Fri, 28 Feb 2020 21:44:03 -0500 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:41219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j7s6j-0003GO-S9 for qemu-devel@nongnu.org; Fri, 28 Feb 2020 21:44:02 -0500 Received: by mail-pg1-x536.google.com with SMTP id b1so2454210pgm.8 for ; Fri, 28 Feb 2020 18:44:01 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id k9sm3649321pjo.19.2020.02.28.18.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 18:43:59 -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=VlxVvw9Nxub+F/a7czDjW6LNfb9GxIjz3UCnfFm+v5Q=; b=wJgvO2M9voJAm3Ydd5wUA9lnxPBEBL1Q2ejMnIk70UHL1CL5a5zMFW5TNkOW8igFS+ ky+ScSqWxtaLN2NYww8rAlA6zMTljABd/rDUvYP2FbFu7UnoBRiKLsBVw24TuRKWv8xL mK9g4iojiFoi9yEdK1uh0ZZZHDeR7Pbr4nok94JV7bLDEYeAnLd3s+vPwokZF6zCJ3gP Kp4ITdaw6j0guFoq9ZfiNiwblSYuuOsSayw3Ao1jtL34QgaIAr3Ce40ODpE8wQdBLGC2 rCzl2a3V0Br7KHdAtQ9vlUPIiYTCn5NJwJg6oUdDXV+g9VCqvD6iDtCmhL4Y0X/BxJDa 4yxw== 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=VlxVvw9Nxub+F/a7czDjW6LNfb9GxIjz3UCnfFm+v5Q=; b=nkKx6E/ZQRiRkZdia85eP9cAjHw7mTNdgmN+hSHp5ednXRF4e1kBB7p4G+GcpYu7IL ztnsCt3t4j9//MoF3iRL6uyKJxUcejxmBGfEgaILabHhQGbfbIyrRKciZjSHG4uHzk3p DGxkMbbfWjWQB2tYm10O91VvI4Xn1+xyWcC6Af6HwOzizp8QiqxudRvQ2PbPQfMPC8Vf 5x8a6Bl1ZPiRYE3LGsleBxo/e4GTIA7mtloNSwu0+P3q4jd83kiK9A31lEglsAXCSXKG /2GkVwCzgb0vcqNyWBh97nDbnPedyN6yWEM1C+87eSp7Y17fAFegBhlNWAFaVddlPLpe A0hA== X-Gm-Message-State: APjAAAX9CfXYlI4TJAeezIG5AsW6iFFRPkxfiAdyw1cWh5UCntsWYiuk b3omWC4L4sEfsrsLdl5F14lTk9g+SkM= X-Google-Smtp-Source: APXvYqyIdmEi+uWeXPTuAwabJYNuamrmjnlK2whuuk2R6G29sylVc586dgw+oGpqNXeclMDtMqCEFQ== X-Received: by 2002:a63:5522:: with SMTP id j34mr6715600pgb.97.1582944240355; Fri, 28 Feb 2020 18:44:00 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 8/8] accel/tcg: increase default code gen buffer size for 64 bit Date: Fri, 28 Feb 2020 18:43:47 -0800 Message-Id: <20200229024347.22826-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200229024347.22826-1-richard.henderson@linaro.org> References: <20200229024347.22826-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::536 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, Niek Linnenbank , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Alex Benn=C3=A9e While 32mb is certainly usable a full system boot ends up flushing the codegen buffer nearly 100 times. Increase the default on 64 bit hosts to take advantage of all that spare memory. After this change I can boot my tests system without any TB flushes. As we usually run more CONFIG_USER binaries at a time in typical usage we aren't quite as profligate for user-mode code generation usage. We also bring the static code gen defies to the same place to keep all the reasoning in the comments together. Signed-off-by: Alex Benn=C3=A9e Tested-by: Niek Linnenbank Reviewed-by: Niek Linnenbank Message-Id: <20200228192415.19867-5-alex.bennee@linaro.org> Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 4ce5d1b393..78914154bf 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -892,15 +892,6 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_= addr_t phys1, } } =20 -#if defined(CONFIG_USER_ONLY) && TCG_TARGET_REG_BITS =3D=3D 32 -/* - * For user mode on smaller 32 bit systems we may run into trouble - * allocating big chunks of data in the right place. On these systems - * we utilise a static code generation buffer directly in the binary. - */ -#define USE_STATIC_CODE_GEN_BUFFER -#endif - /* Minimum size of the code gen buffer. This number is randomly chosen, but not so small that we can't have a fair number of TB's live. */ #define MIN_CODE_GEN_BUFFER_SIZE (1 * MiB) @@ -929,7 +920,33 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_= addr_t phys1, # define MAX_CODE_GEN_BUFFER_SIZE ((size_t)-1) #endif =20 +#if TCG_TARGET_REG_BITS =3D=3D 32 #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB) +#ifdef CONFIG_USER_ONLY +/* + * For user mode on smaller 32 bit systems we may run into trouble + * allocating big chunks of data in the right place. On these systems + * we utilise a static code generation buffer directly in the binary. + */ +#define USE_STATIC_CODE_GEN_BUFFER +#endif +#else /* TCG_TARGET_REG_BITS =3D=3D 64 */ +#ifdef CONFIG_USER_ONLY +/* + * As user-mode emulation typically means running multiple instances + * of the translator don't go too nuts with our default code gen + * buffer lest we make things too hard for the OS. + */ +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (128 * MiB) +#else +/* + * We expect most system emulation to run one or two guests per host. + * Users running large scale system emulation may want to tweak their + * runtime setup via the tb-size control on the command line. + */ +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB) +#endif +#endif =20 #define DEFAULT_CODE_GEN_BUFFER_SIZE \ (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \ --=20 2.20.1