From nobody Wed Apr 16 22:43:32 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1666751080; cv=none; d=zohomail.com; s=zohoarc; b=CHpLY4Ek1g9WB2OXJqO+xv5NEDBaNtYhKMGxuqAM2IaE960Njqr4m84yMNKiRRoqw3QSzJauWo7CBZHSWluadPzLyd7pKycBbN8bpgPsGW/LxtabjaqMBCZhokFYQe41g4fBpN04r1GAeganFZ2E5DbiB+AxSXw13k5Znzj6FLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666751080; 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=BPiDOXuJlTG0AgncYY09MVfeOS94NwO0enHpea3qlzk=; b=BGT+eejog1fc9Dn5NrXkauCBzFH6NWx/AagdHluVYq+rBWzcM9nz+bY8Fdo1eabR07kpYWtXXvfUw5FOnmoGzOZmaGPsLd6KDIQHpukQs0YD6YJ43RjBFTl8DL1wXXjfUliDn5hZnkgj0IPHR30DgXL7WGpVQwbSezriM/2cC7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666751080211470.20953787939357; Tue, 25 Oct 2022 19:24:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onVte-0004sV-MJ; Tue, 25 Oct 2022 22:11:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1onVtZ-0004s5-EM for qemu-devel@nongnu.org; Tue, 25 Oct 2022 22:11:53 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onVtX-00019J-NW for qemu-devel@nongnu.org; Tue, 25 Oct 2022 22:11:53 -0400 Received: by mail-pg1-x531.google.com with SMTP id 20so13456423pgc.5 for ; Tue, 25 Oct 2022 19:11:51 -0700 (PDT) Received: from stoup.hotspotlogin.services ([103.100.225.182]) by smtp.gmail.com with ESMTPSA id o29-20020a635d5d000000b0043c9da02729sm1897833pgm.6.2022.10.25.19.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 19:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BPiDOXuJlTG0AgncYY09MVfeOS94NwO0enHpea3qlzk=; b=EmUxRxvV3dM6zYeIvTPiWxmehQUySmF4Eow8itRUX4BPO8AXhCauBjysF9qpwJvpW7 bWh72I+eWCVxV+qZgV4JvNFLX8lRss0gYBGRaEBXoH+BVsRFHzlMYK6Gt9ZEm6raXzek pqQVa7iM+SFXxYwldqldxitm1ivHYvosgt+KrwzBrmaBGcZJp+dWkEllsT9/xsOUUGUi HGsFQ2vXsi8Z42uJq2Wu4OhMpOvoN/9pZkcg3ag9qAk+TDa/4dZiy5iIRIssnJj+GWQh 9bPmp3nk7xaDKz+Dr1Gazrm9B4MwtEf0Z3n7i6UnAmKTYzMHue24PMcLNx5BmGU2M2f9 z/JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BPiDOXuJlTG0AgncYY09MVfeOS94NwO0enHpea3qlzk=; b=QeLxXmobquO+zpYQa3bvgHW3bodFZo5QWTouFa8Dm/8+Klr2dlzhGUz1RIz1itkGiY inbf03lMU32IGLP5qHfCdmiBhx1ad6oqMkLXVt+jYSv043//+dXGlClCeNrMbNxW/hCG 3xuz4TPQA3dI+IK2Qpac+ngLStqZEBXtn6A1e14R3OEqcApoe/6gMCr33B5lGlBhZJt7 R4DqlpcaiqDWifaBTe8Fli6/7PxBUluqudMN0SAs1875IAz8wsPto0qF4ixicK76pVFP fGBl1jbDvITicxKegNuNL5T6/GGF081r+Gali3AD5fc1an/XvyvvpxJAofZpFKVHLYho QFVg== X-Gm-Message-State: ACrzQf3NBsmKZ1edGe3HawbyE/7TL8+SOkeRI3chkFGJZRQZB5znaSGD mLo4sq88lk3MPumQwaMYXXTiRBoQ+vFVZT3u X-Google-Smtp-Source: AMsMyM4LsgTciDZGrim6Z5NyovjTD1Xy8H8TwLjVOOak175g2uY3P9dqmUq2wQtQji4ofs0ZFAQKhw== X-Received: by 2002:a63:5b53:0:b0:462:7149:2c54 with SMTP id l19-20020a635b53000000b0046271492c54mr34642091pgm.527.1666750310201; Tue, 25 Oct 2022 19:11:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 09/47] accel/tcg: Remove disabled debug in translate-all.c Date: Wed, 26 Oct 2022 12:10:38 +1000 Message-Id: <20221026021116.1988449-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221026021116.1988449-1-richard.henderson@linaro.org> References: <20221026021116.1988449-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1666751081289100001 These items printf, and could be replaced with proper tracepoints if we really cared. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 109 -------------------------------------- 1 file changed, 109 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 64a2601f9f..42385fa032 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -63,33 +63,7 @@ #include "tb-context.h" #include "internal.h" =20 -/* #define DEBUG_TB_INVALIDATE */ -/* #define DEBUG_TB_FLUSH */ /* make various TB consistency checks */ -/* #define DEBUG_TB_CHECK */ - -#ifdef DEBUG_TB_INVALIDATE -#define DEBUG_TB_INVALIDATE_GATE 1 -#else -#define DEBUG_TB_INVALIDATE_GATE 0 -#endif - -#ifdef DEBUG_TB_FLUSH -#define DEBUG_TB_FLUSH_GATE 1 -#else -#define DEBUG_TB_FLUSH_GATE 0 -#endif - -#if !defined(CONFIG_USER_ONLY) -/* TB consistency checks only implemented for usermode emulation. */ -#undef DEBUG_TB_CHECK -#endif - -#ifdef DEBUG_TB_CHECK -#define DEBUG_TB_CHECK_GATE 1 -#else -#define DEBUG_TB_CHECK_GATE 0 -#endif =20 /* Access to the various translations structures need to be serialised via= locks * for consistency. @@ -940,15 +914,6 @@ static void page_flush_tb(void) } } =20 -static gboolean tb_host_size_iter(gpointer key, gpointer value, gpointer d= ata) -{ - const TranslationBlock *tb =3D value; - size_t *size =3D data; - - *size +=3D tb->tc.size; - return false; -} - /* flush all the translation blocks */ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) { @@ -963,15 +928,6 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data= tb_flush_count) } did_flush =3D true; =20 - if (DEBUG_TB_FLUSH_GATE) { - size_t nb_tbs =3D tcg_nb_tbs(); - size_t host_size =3D 0; - - tcg_tb_foreach(tb_host_size_iter, &host_size); - printf("qemu: flush code_size=3D%zu nb_tbs=3D%zu avg_tb_size=3D%zu= \n", - tcg_code_size(), nb_tbs, nb_tbs > 0 ? host_size / nb_tbs : = 0); - } - CPU_FOREACH(cpu) { tcg_flush_jmp_cache(cpu); } @@ -1005,57 +961,6 @@ void tb_flush(CPUState *cpu) } } =20 -/* - * Formerly ifdef DEBUG_TB_CHECK. These debug functions are user-mode-only, - * so in order to prevent bit rot we compile them unconditionally in user-= mode, - * and let the optimizer get rid of them by wrapping their user-only calle= rs - * with if (DEBUG_TB_CHECK_GATE). - */ -#ifdef CONFIG_USER_ONLY - -static void do_tb_invalidate_check(void *p, uint32_t hash, void *userp) -{ - TranslationBlock *tb =3D p; - target_ulong addr =3D *(target_ulong *)userp; - - if (!(addr + TARGET_PAGE_SIZE <=3D tb_pc(tb) || - addr >=3D tb_pc(tb) + tb->size)) { - printf("ERROR invalidate: address=3D" TARGET_FMT_lx - " PC=3D%08lx size=3D%04x\n", addr, (long)tb_pc(tb), tb->siz= e); - } -} - -/* verify that all the pages have correct rights for code - * - * Called with mmap_lock held. - */ -static void tb_invalidate_check(target_ulong address) -{ - address &=3D TARGET_PAGE_MASK; - qht_iter(&tb_ctx.htable, do_tb_invalidate_check, &address); -} - -static void do_tb_page_check(void *p, uint32_t hash, void *userp) -{ - TranslationBlock *tb =3D p; - int flags1, flags2; - - flags1 =3D page_get_flags(tb_pc(tb)); - flags2 =3D page_get_flags(tb_pc(tb) + tb->size - 1); - if ((flags1 & PAGE_WRITE) || (flags2 & PAGE_WRITE)) { - printf("ERROR page flags: PC=3D%08lx size=3D%04x f1=3D%x f2=3D%x\n= ", - (long)tb_pc(tb), tb->size, flags1, flags2); - } -} - -/* verify that all the pages have correct rights for code */ -static void tb_page_check(void) -{ - qht_iter(&tb_ctx.htable, do_tb_page_check, NULL); -} - -#endif /* CONFIG_USER_ONLY */ - /* * user-mode: call with mmap_lock held * !user-mode: call with @pd->lock held @@ -1339,12 +1244,6 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t ph= ys_pc, page_unlock(p2); } page_unlock(p); - -#ifdef CONFIG_USER_ONLY - if (DEBUG_TB_CHECK_GATE) { - tb_page_check(); - } -#endif return tb; } =20 @@ -2400,9 +2299,6 @@ void page_protect(tb_page_addr_t page_addr) } mprotect(g2h_untagged(page_addr), qemu_host_page_size, (prot & PAGE_BITS) & ~PAGE_WRITE); - if (DEBUG_TB_INVALIDATE_GATE) { - printf("protecting code page: 0x" TB_PAGE_ADDR_FMT "\n", page_= addr); - } } } =20 @@ -2458,11 +2354,6 @@ int page_unprotect(target_ulong address, uintptr_t p= c) /* and since the content will be modified, we must invalid= ate the corresponding translated code. */ current_tb_invalidated |=3D tb_invalidate_phys_page(addr, = pc); -#ifdef CONFIG_USER_ONLY - if (DEBUG_TB_CHECK_GATE) { - tb_invalidate_check(addr); - } -#endif } mprotect((void *)g2h_untagged(host_start), qemu_host_page_size, prot & PAGE_BITS); --=20 2.34.1