From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0ACDC2B9F8 for ; Tue, 25 May 2021 17:03:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5377061408 for ; Tue, 25 May 2021 17:03:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5377061408 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bugs.launchpad.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llaSh-0000nz-6T for qemu-devel@archiver.kernel.org; Tue, 25 May 2021 13:03:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llaLS-0003CO-2I for qemu-devel@nongnu.org; Tue, 25 May 2021 12:55:54 -0400 Received: from indium.canonical.com ([91.189.90.7]:38828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llaLL-00077h-Su for qemu-devel@nongnu.org; Tue, 25 May 2021 12:55:53 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.93 #5 (Debian)) id 1llaLJ-0004v7-OA for ; Tue, 25 May 2021 16:55:45 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id B56022E805B for ; Tue, 25 May 2021 16:55:45 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 25 May 2021 16:45:41 -0000 From: =?utf-8?q?Alex_Benn=C3=A9e?= <1896298@bugs.launchpad.net> To: qemu-devel@nongnu.org X-Launchpad-Notification-Type: bug X-Launchpad-Bug: product=qemu; status=Expired; importance=Undecided; assignee=None; X-Launchpad-Bug-Tags: tcg X-Launchpad-Bug-Information-Type: Public X-Launchpad-Bug-Private: no X-Launchpad-Bug-Security-Vulnerability: no X-Launchpad-Bug-Commenters: ajbennee mslade th-huth X-Launchpad-Bug-Reporter: Michael Slade (mslade) X-Launchpad-Bug-Modifier: =?utf-8?q?Alex_Benn=C3=A9e_=28ajbennee=29?= References: <160046874518.13612.4861858859499751315.malonedeb@gac.canonical.com> Message-Id: <20210525164541.17985-1-alex.bennee@linaro.org> Subject: [Bug 1896298] [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu X-Launchpad-Message-Rationale: Subscriber (QEMU) @qemu-devel-ml X-Launchpad-Message-For: qemu-devel-ml Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="30919b71da718d7d3f6b69e715e9fe95f7c3c5de"; Instance="production" X-Launchpad-Hash: b9b06d0fafe597db301232e569565f4d7374b3c4 Received-SPF: none client-ip=91.189.90.7; envelope-from=bounces@canonical.com; helo=indium.canonical.com X-Spam_score_int: -65 X-Spam_score: -6.6 X-Spam_bar: ------ X-Spam_report: (-6.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Bug 1896298 <1896298@bugs.launchpad.net> Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" There are two justifications for making this change. The first is that i386 emulation is typically for smaller machines where having a 1gb of generated code is overkill for basic emulation. The second is the propensity of self-modifying code (c.f. Doom/edit) utilised on i386 systems can trigger a rapid growth in invalidated and re-translated buffers. This is seen in bug #283. Execution is still inefficient but at least the host memory isn't so aggressively used up. That said it's still really just a sticking plaster for user convenience. Signed-off-by: Alex Benn=C3=A9e Cc: Thomas Huth Cc: 1896298@bugs.launchpad.net --- accel/tcg/translate-all.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 640ff6e3e7..f442165674 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_= addr_t phys1, * Users running large scale system emulation may want to tweak their * runtime setup via the tb-size control on the command line. */ +#ifdef TARGET_I386 +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB) +#else #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB) #endif #endif +#endif = #define DEFAULT_CODE_GEN_BUFFER_SIZE \ (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \ -- = 2.20.1 -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1896298 Title: TCG memory leak with FreeDOS 'edit' Status in QEMU: Expired Bug description: qemu trunk as of today leaks memory FAST when freedos' edit is running. To reproduce, download: https://www.ibiblio.org/pub/micro/pc- stuff/freedos/files/repositories/1.3/cdrom.iso Then run: $ qemu-system-i386 -cdrom cdrom.iso select your language then select "return to DOS", then type > edit it will consume memory at ~10MB/s This does NOT happen when adding -enable-kvm To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1896298/+subscriptions From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE949C47084 for ; Tue, 25 May 2021 17:28:32 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1C07761059 for ; Tue, 25 May 2021 17:28:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C07761059 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llar1-0003Zm-9Q for qemu-devel@archiver.kernel.org; Tue, 25 May 2021 13:28:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llaBr-0007mM-4W for qemu-devel@nongnu.org; Tue, 25 May 2021 12:45:59 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:35441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llaBo-0002Ac-7C for qemu-devel@nongnu.org; Tue, 25 May 2021 12:45:58 -0400 Received: by mail-wm1-x32d.google.com with SMTP id z19-20020a7bc7d30000b029017521c1fb75so3884464wmk.0 for ; Tue, 25 May 2021 09:45:55 -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:mime-version :content-transfer-encoding; bh=ZCZkSawTq/K1ESwNlFiwj94hkyAoVe2OoqNjqGGhrSA=; b=SV5wPCzKYfHZKJGnW/fTtNc+lUw8WRXKBcAOGtYCvIDnX7bB9z4pAPs1oVMyYzJ8eO 6qQ2bF1Hqmb2gzfv/w6668c4WweomosDl5DeSXa+vw6Bn0lY37NXOYcdwcYRBEDbdIhg 0JEBsDU+uWjQm6o0/xjucL6XgJL7fA+g4QW1htiHVRWNWtEaLZ70TPj+AA9pF8WKZuos pgqxPmR/cIM96pv2+GVP5xdVMsTB80dFNL/kKcLgdqfpCiuf7m08PauOxDZOlon1SiB8 rGmc3plPk0CVY4LtvqWoQv/cQ383AQWbKO91rSS82m88kTM3gZTyNaQkH/ROCIHw213W 1IBA== 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:mime-version :content-transfer-encoding; bh=ZCZkSawTq/K1ESwNlFiwj94hkyAoVe2OoqNjqGGhrSA=; b=Ob3ee/m+fovZPv/1rNIFaQ+Ufbf7nTpXnqaADFL2+mLGrpHSWRHu0XrC2QILWkThVW 3RvghGPQFp0nDT6h6gs3XOllnGKeuGBZ1ccWBaI74Hnx9TeDW/Suguc7jtqW1QTrXkQj xTHF8GpFzkUnp9V9eba1t84K7/OzCc3Fz6S+6TlPq9QZ3QwdWV0LZGWZNRxc0vEfFZZu oCvyXTRh8lFrdW7DCRmUPIAb3Vz1tmr7AdoTAf3q7G1eWbCaxjlGKLHXYYz1QLZtPU+e yK9+QBfTzmcUoAHMXKLqVu7anELouYkw+NEGmOF/wivwT/JWs4WHYaGy7EpSbFp+mWsX 92PA== X-Gm-Message-State: AOAM531hnYPMl93B7U8hOqqBR6NH5tAokGmSveR9TLdnfYnKhhuFV4vp F05zOvhhdexSu0G8uiWYtw2VHw== X-Google-Smtp-Source: ABdhPJwLBYPOTTATl/2YGNi+sKle5LSkD8mMxbiFdOhioCstCtQihmF748dKNDePOmjVH3PHmB1/8g== X-Received: by 2002:a1c:7c03:: with SMTP id x3mr24838782wmc.122.1621961154424; Tue, 25 May 2021 09:45:54 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h9sm11621706wmb.35.2021.05.25.09.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 09:45:53 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AC4101FF7E; Tue, 25 May 2021 17:45:52 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [RFC PATCH] accel/tcg: change default codegen buffer size for i386-softmmu Date: Tue, 25 May 2021 17:45:41 +0100 Message-ID: <20210525164541.17985-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Richard Henderson , Thomas Huth , 1896298@bugs.launchpad.net, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Message-ID: <20210525164541.kazTlnJ4DdwXdSBGBgHgsdaySA6Hz2t8pnQMo26UDcY@z> There are two justifications for making this change. The first is that i386 emulation is typically for smaller machines where having a 1gb of generated code is overkill for basic emulation. The second is the propensity of self-modifying code (c.f. Doom/edit) utilised on i386 systems can trigger a rapid growth in invalidated and re-translated buffers. This is seen in bug #283. Execution is still inefficient but at least the host memory isn't so aggressively used up. That said it's still really just a sticking plaster for user convenience. Signed-off-by: Alex Bennée Cc: Thomas Huth Cc: 1896298@bugs.launchpad.net --- accel/tcg/translate-all.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 640ff6e3e7..f442165674 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -951,9 +951,13 @@ static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1, * Users running large scale system emulation may want to tweak their * runtime setup via the tb-size control on the command line. */ +#ifdef TARGET_I386 +#define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (32 * MiB) +#else #define DEFAULT_CODE_GEN_BUFFER_SIZE_1 (1 * GiB) #endif #endif +#endif #define DEFAULT_CODE_GEN_BUFFER_SIZE \ (DEFAULT_CODE_GEN_BUFFER_SIZE_1 < MAX_CODE_GEN_BUFFER_SIZE \ -- 2.20.1