From nobody Mon Nov 23 04:38:02 2026 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=1794240652; cv=none; d=zohomail.com; s=zohoarc; b=ONhyKI4z/dgZLf6TCD0G3KTYSiO3eIxy4JYjdiVxsdd5IqII+B+cy5NwpcEbzQou8f0LxVeAxB9PDq61ocA6D0unP+fwj4Vn+06I0UVKAwywBQ+83ZOYpcXx0znUaRnTjexHzGnpB1IHuBoO1DwGsKio8fKVps2URux7eNgZkIo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794240652; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=adk1JsPeBW4+Kfln6py+xXiqLaz3hQIK2Unr5QU7qjE=; b=F7+BY6kJhABbHjx39BRPsUuVUgfkjKcufYcl9oEgfixuPKviz2z01Virvd6J6bF3ALGmQkVVtvGn2H88W1CbdY9vAHaZPkBhxPVCGAuBULrcqk0ojeOI4PEiqgunTnwWrDxT+umbNCxUMLhtB/ovBb4f/NK9HiKLeAw9JehSoRk= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179424065260771.6927855122351; Mon, 9 Nov 2026 08:10:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xQRx3-00009v-3G; Mon, 09 Nov 2026 11:10:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQRwv-00007y-TG for qemu-devel@nongnu.org; Mon, 09 Nov 2026 11:10:26 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xQRws-0005pO-HF for qemu-devel@nongnu.org; Mon, 09 Nov 2026 11:10:25 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-8b6a88e4341so489530b3a.1 for ; Mon, 09 Nov 2026 08:10:20 -0800 (PST) Received: from stoup (174-21-68-150.tukw.qwest.net. [174.21.68.150]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8b648e55e85sm1598946b3a.17.2026.11.09.08.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2026 08:10:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794240620; x=1794845420; darn=nongnu.org; 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:content-type; bh=adk1JsPeBW4+Kfln6py+xXiqLaz3hQIK2Unr5QU7qjE=; b=lpBzgE983bXiMRorEWArwERM1WI+yhh3conLVkyebY7Fau8WpafamRXVNdw3QxNX2G i4WFiB3asMouNoPvSXhrLUPmpfdZHBhSAmWDLIHH22NHn2sCGvF2TcxWFFQinhj4xZl8 obzOhQMlmgoGQtxZv18bKkatSym777UdjtfpH074uyGPkGgYn894GKrtNzXZ9JfY3wJE gAs3GYO7y083OyShjUySFeicW1M0ML7oMcrTP8TTK3ySYaqdIyXNwqpanuNRlJl0tCxH 9soSpkuGGDMo/Ycy8d2Ciewvk2sEES43rTerwONnHTHwoQYWacRzvKO1U37Ih4EJ2nxE dmBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794240620; x=1794845420; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=adk1JsPeBW4+Kfln6py+xXiqLaz3hQIK2Unr5QU7qjE=; b=m3OSVi/p1bBjGfDEsQZwoyZ7q5vy3/CKIPaGfrpKep1a6WmvbqVkj0cv5zk8nzUB/n hR1ELmTIDFEafQVzJc3iVAYkr2QZq/uVWLS0QOxBzll7tKRtlnvwa+xgJo8tddwp/qGZ ZsEy9nuKMXXd9WKDJUxh39IIwPsmOz/OZ8HWv4AfCL3bQbz+iiloNDxbwOJiUOuhqbWm a+Fxx9NfBvVPNiOybqEGJZIVuI+jG4WM0IDjsofeynWjAQDA+28LcLXHPDPOQPKbUVv/ xVP0yY8ZUHAzqdSxB/QlAM3+eW5LSTDF2tIAhX6+7bsla0Wk9UbB8Pz0IhrBclsyju9v dQmA== X-Gm-Message-State: APuU4Z+p3ol/Fng4tWQFFcjUd5LFbeLPXCdCLoSsgA2EcEJNSdrWiMjo HXcPhEnygwT7UzT90b4xIm55RB/rVe2/myrFU6wFnI77KLioD05zu7Utv+VXA+gIqLJReDZ+Qp5 kdKp2 X-Gm-Gg: AYBFou3Z49boIHfJjecZ7wO9HjfGkWoS83LMoZI9lfAAUN/w7E5wmJxDyIh4vm0VU3i mQyfsGoIDX3oAlFkTaxDB0EMyzXkNZ8HkWm6nPi6vDD6aihzrIJKTYW+4OPVwegNqRa6tsfHNoc rOB39mNSxrMo70YIqzkA+ZWYnJClA1qgDoo8N2XDpyeBIwec+/ohfC8qa/E1TFuMMtKCw8nL2Am BCsSGm5cFde0cQsKSKyuIvIrATSu1+xhUNLHlfViAr6VfXq/utVPGpU9vAqywH5DyuVvJBQa7rM v83Oq7vYOtpALgrL7pC/GcCmzgfQGrou/E7OkcDX/FoiEkHv3GZIC7XbXAYCs457O89NHdgAijQ Jxuk8+aPR6TOMTAkZElBLiUFtG9uDqXb0I38sPg8MB0RY4RrkwW/fJ9IXsxFB8pG9yuGmVXR1DQ L8dzNRfvG9wvcbmieXF/1sdhShT+ffYfONGn3ki5FCNGCLQDimmGh3ZnJ71gBdVi5wdw2jyTMOF IKFmHki1qPsg5t6sdlHISLDBqxFYhD9fOxixCYKcYK/obcp2+6sIiInmc6pvXB+Yxtrk/3NpTod uN1va6MO1ayTUk5Un+/TKKCRWP5vE77owf7fgpl71FO4SoR6J4Q2See3eGwV X-Received: by 2002:a05:6a00:1d92:b0:8b5:bd06:7aa with SMTP id d2e1a72fcca58-8ba83bd0431mr104883b3a.6.1794240619624; Mon, 09 Nov 2026 08:10:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 1/2] accel/tcg: Drop DEBUG_TLB_LOG_GATE Date: Mon, 9 Nov 2026 08:10:15 -0800 Message-ID: <20261109161016.43218-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261109161016.43218-1-richard.henderson@linaro.org> References: <20261109161016.43218-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794240654728158500 Content-Type: text/plain; charset="utf-8" These disabled logs could be transformed to trace events needed at at later date. Just delete them for now. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/cputlb.c | 48 ++-------------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index dc83f3bad8..efb8fb1f57 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -55,31 +55,15 @@ #include "backend-ldst.h" =20 =20 -/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ -/* #define DEBUG_TLB */ -/* #define DEBUG_TLB_LOG */ +/* DEBUG defines */ +#define DEBUG_TLB =20 #ifdef DEBUG_TLB # define DEBUG_TLB_GATE 1 -# ifdef DEBUG_TLB_LOG -# define DEBUG_TLB_LOG_GATE 1 -# else -# define DEBUG_TLB_LOG_GATE 0 -# endif #else # define DEBUG_TLB_GATE 0 -# define DEBUG_TLB_LOG_GATE 0 #endif =20 -#define tlb_debug(fmt, ...) do { \ - if (DEBUG_TLB_LOG_GATE) { \ - qemu_log_mask(CPU_LOG_MMU, "%s: " fmt, __func__, \ - ## __VA_ARGS__); \ - } else if (DEBUG_TLB_GATE) { \ - fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \ - } \ -} while (0) - #define assert_cpu_is_self(cpu) do { \ if (DEBUG_TLB_GATE) { \ g_assert(!(cpu)->created || qemu_cpu_is_self(cpu)); \ @@ -375,8 +359,6 @@ static void tlb_flush_by_mmuidx_async_work(CPUState *cp= u, run_on_cpu_data data) =20 assert_cpu_is_self(cpu); =20 - tlb_debug("mmu_idx:0x%04" PRIx16 "\n", asked); - qemu_spin_lock(&cpu->neg.tlb.c.lock); =20 all_dirty =3D cpu->neg.tlb.c.dirty; @@ -409,8 +391,6 @@ static void tlb_flush_by_mmuidx_async_work(CPUState *cp= u, run_on_cpu_data data) =20 void tlb_flush_by_mmuidx(CPUState *cpu, MMUIdxMap idxmap) { - tlb_debug("mmu_idx: 0x%" PRIx16 "\n", idxmap); - assert_cpu_is_self(cpu); =20 tlb_flush_by_mmuidx_async_work(cpu, RUN_ON_CPU_HOST_INT(idxmap)); @@ -425,8 +405,6 @@ void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *src_= cpu, MMUIdxMap idxmap) { const run_on_cpu_func fn =3D tlb_flush_by_mmuidx_async_work; =20 - tlb_debug("mmu_idx: 0x%"PRIx16"\n", idxmap); - flush_all_helper(src_cpu, fn, RUN_ON_CPU_HOST_INT(idxmap)); async_safe_run_on_cpu(src_cpu, fn, RUN_ON_CPU_HOST_INT(idxmap)); } @@ -507,9 +485,6 @@ static void tlb_flush_page_locked(CPUState *cpu, int mi= dx, vaddr page) =20 /* Check if we need to flush due to large pages. */ if ((page & lp_mask) =3D=3D lp_addr) { - tlb_debug("forcing full flush midx %d (%016" - VADDR_PRIx "/%016" VADDR_PRIx ")\n", - midx, lp_addr, lp_mask); tlb_flush_one_mmuidx_locked(cpu, midx, get_clock_realtime()); } else { if (tlb_flush_entry_locked(tlb_entry(cpu, midx, page), page)) { @@ -536,8 +511,6 @@ static void tlb_flush_page_by_mmuidx_async_0(CPUState *= cpu, =20 assert_cpu_is_self(cpu); =20 - tlb_debug("page addr: %016" VADDR_PRIx " mmu_map:0x%x\n", addr, idxmap= ); - qemu_spin_lock(&cpu->neg.tlb.c.lock); for (mmu_idx =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { if ((idxmap >> mmu_idx) & 1) { @@ -600,8 +573,6 @@ static void tlb_flush_page_by_mmuidx_async_2(CPUState *= cpu, =20 void tlb_flush_page_by_mmuidx(CPUState *cpu, vaddr addr, MMUIdxMap idxmap) { - tlb_debug("addr: %016" VADDR_PRIx " mmu_idx:%" PRIx16 "\n", addr, idxm= ap); - assert_cpu_is_self(cpu); =20 /* This should already be page aligned */ @@ -619,8 +590,6 @@ void tlb_flush_page_by_mmuidx_all_cpus_synced(CPUState = *src_cpu, vaddr addr, MMUIdxMap idxmap) { - tlb_debug("addr: %016" VADDR_PRIx " mmu_idx:%"PRIx16"\n", addr, idxmap= ); - /* This should already be page aligned */ addr &=3D TARGET_PAGE_MASK; =20 @@ -680,9 +649,6 @@ static void tlb_flush_range_locked(CPUState *cpu, int m= idx, * test all of the entries in the TLB than it will to flush it all. */ if (mask < f->mask || len > f->mask) { - tlb_debug("forcing full flush midx %d (" - "%016" VADDR_PRIx "/%016" VADDR_PRIx "+%016" VADDR_PRIx = ")\n", - midx, addr, mask, len); tlb_flush_one_mmuidx_locked(cpu, midx, get_clock_realtime()); return; } @@ -693,9 +659,6 @@ static void tlb_flush_range_locked(CPUState *cpu, int m= idx, * we only need to test the end of the range. */ if (((addr + len - 1) & d->large_page_mask) =3D=3D d->large_page_addr)= { - tlb_debug("forcing full flush midx %d (" - "%016" VADDR_PRIx "/%016" VADDR_PRIx ")\n", - midx, d->large_page_addr, d->large_page_mask); tlb_flush_one_mmuidx_locked(cpu, midx, get_clock_realtime()); return; } @@ -725,9 +688,6 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUState = *cpu, =20 assert_cpu_is_self(cpu); =20 - tlb_debug("range: %016" VADDR_PRIx "/%u+%016" VADDR_PRIx " mmu_map:0x%= x\n", - d.addr, d.bits, d.len, d.idxmap); - qemu_spin_lock(&cpu->neg.tlb.c.lock); for (mmu_idx =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { if ((d.idxmap >> mmu_idx) & 1) { @@ -1053,10 +1013,6 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx, &xlat, &sz, full->attrs, &= prot); assert(sz >=3D TARGET_PAGE_SIZE); =20 - tlb_debug("vaddr=3D%016" VADDR_PRIx " paddr=3D0x" HWADDR_FMT_plx - " prot=3D%x idx=3D%d\n", - addr, full->phys_addr, prot, mmu_idx); - read_flags =3D full->tlb_fill_flags; if (full->lg_page_size < TARGET_PAGE_BITS) { /* Repeat the MMU check and TLB fill on every access. */ --=20 2.53.0 From nobody Mon Nov 23 04:38:02 2026 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=1794240658; cv=none; d=zohomail.com; s=zohoarc; b=mUeLvkFHFvdc326xAZFAJOdtAHdsXVmi0v58Lv8FV81TXVUQjup6bqOgxwnVDniekd4L4xzaP7J2YzY7PmKEYWOeFZTcXiggLsc0j8BCZk4GsB9BzERBA7Ap30QiPnaM0NiHtU/K+TpmDH8emceZOyEdPipjLxxaDaSms53sClE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794240658; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y5hNN5e5dzg1FCTjhO65YVXMn+heooTu+Udt9f79p3U=; b=LBD6qZVEA6kTOyEC3URF2N2asXGTUmiItTFih61uRIRvaMFtvJTC87skwJLee21rWzmsDrnlvo9NLU5dRW79yDIekXOi3HhRtvJcIBDQUzDkeD4yBspL8ZnI9d4fKucA8c303RUC65bigiDnYbsFYbQJ1lMnnPfjVcCzb+uhRUg= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794240658783171.85805187450478; Mon, 9 Nov 2026 08:10:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xQRx4-0000AI-TU; Mon, 09 Nov 2026 11:10:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQRwv-00007z-T4 for qemu-devel@nongnu.org; Mon, 09 Nov 2026 11:10:26 -0500 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xQRws-0005pT-Hg for qemu-devel@nongnu.org; Mon, 09 Nov 2026 11:10:25 -0500 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-8b2382bf051so562358b3a.3 for ; Mon, 09 Nov 2026 08:10:21 -0800 (PST) Received: from stoup (174-21-68-150.tukw.qwest.net. [174.21.68.150]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8b648e55e85sm1598946b3a.17.2026.11.09.08.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2026 08:10:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1794240621; x=1794845421; darn=nongnu.org; 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:content-type; bh=Y5hNN5e5dzg1FCTjhO65YVXMn+heooTu+Udt9f79p3U=; b=Mjg2eq9x9C3PjY4EQsljVUb9Ljw9/4fqy8tvRhcmIFjN2k/yCaZ/EDxpBQbWr4Rqvs dYo76Wqo6/fKzw3FW/uIR8eyJW5Pan4vb3brcP3tvyOtwt0Sh+yyaKG+U9qK0iTLQUrj 3lHOpE0UuHnRDcj9aYUs1patmOJvnxZiTw32WULe90/ogl/yObtS+4vlZvjMrgmblQPf HLg/DA9G8RQdJf+GbtFydxefK8ragO/X52fxMB73pUqjhje8d9nVo18DDRRr9CDDyuF3 G86lcV7IMZ1/uYR21N3MCJndaYtNTqs3fGY0WNede7zLb2lnawt7/3uOjU8le0O56WpZ J/CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794240621; x=1794845421; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Y5hNN5e5dzg1FCTjhO65YVXMn+heooTu+Udt9f79p3U=; b=04XgYwpFJ7OGDlEYF8yz0Nq+7kD41+S34JY0qQXIfrCO9ua6NO8VtuB3fTgtHQ6d0m eHCzhcTSObckeJXJmD4qOg+xt5fyptZD2a42zorneCGkr2NCWeZKlP/1oXeq2Jyhq5G/ 4yV1WS/1YxYGMtRPEYi/EUyrBwDQxCAOooHcVzVj/lyV6dAjFZYiHBOnRNMu0G3WQIXY r9F9BdQ6cFrKdNpiPtXqBEhAbsld703KaUPkDC1n5EDPopTHozQpWmW5GeD7QvnZYNKc NbXpA22yevr5xfDKrUC85dZ8ot3nk6PyvuG7LfazpK+v+ra0pwTY6GelpwzfQ4NbiTCI g1uQ== X-Gm-Message-State: APuU4Z/bmcoitbRUnGvqDClBcHNuQMJiuK/KKybWxWkEiTog0Gv+DH+h V0ORU+rGUe2l2H2IUQfCba1PV/+uLqdsCsGY3itw/hxxXfsHsHjJ25QaVAxzZXDFfkBWPfxJkAT jWYbD X-Gm-Gg: AYBFou25I4cMUZhLWZbkT+qz+19mP8RGJfd3Ou/gugPlIQn08BJfOv3dDOkxFma4Z4p C9XiHVbzW6y4i0GF4YP9peb4uWKfEet8c+7PWkoL1kshr/erNBDsSCyE5fQZzuI1PWiyXqPlgvP niJVi89SUSkS2UIXstiWroiIl3TQf/oGm4GMqzAoDYaVHbmw/jaGXyffD8UHF4fCbaCUvfkTTPZ 0uAceOEf8E5EfvR5gVgxnze995N2UkqgGGjLFTRgrGyHvsGl/tfLxrFpeJ4zTqIm8SfGatESsk5 OEqT5VS1Cju4yftGmVbr9RL2Tp2whHH+p4sDNkK/dpq0DzkmQdcUf9ZDJECCl/4hvnHLURSztTy 1XcwohaWGgJLvMPPtiFtGngb1FN6A91r85evHJHRazTzF8L0DlrAyWzFlMQ4MO8UbhX90eFltvz SBteZT5gcOe5zLaOvu2XH4NO0CsDAgkfwSRn8A4f8XfWGY7VDW5oXjZbZGqODFT42ffRovTKdeY DwRSkVFekzJrSvcaaP9B7kbNoGFVTAjpJCeXvQKQEdUikv0HLdhtHfy3vuyDL2qMKdpp5SEm5M5 ES6DjyTzU+I0cnRukAML4Zr91jpIesddiDr2AbLDchmfUG9ORDFDbqiactJu X-Received: by 2002:a05:6a20:da14:b0:3eb:2f53:bdc6 with SMTP id adf61e73a8af0-3eed2022137mr4479377637.23.1794240620819; Mon, 09 Nov 2026 08:10:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH 2/2] accel/tcg: Adjust tlb assertions to allow stopped cpus Date: Mon, 9 Nov 2026 08:10:16 -0800 Message-ID: <20261109161016.43218-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261109161016.43218-1-richard.henderson@linaro.org> References: <20261109161016.43218-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1794240660974158500 Content-Type: text/plain; charset="utf-8" The intent of the assert has always been to prevent operating on a foreign running cpu -- we must use run_on for that. Not created is certainly one condition for not running but there are others, including case at issue here of reset. Rename the assert and expand the condition to all stopped cpus. Enable the assertion with --enable-debug-tcg, not a private define that is never enabled in practice. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3092 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/cputlb.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index efb8fb1f57..3ca484b039 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -55,20 +55,14 @@ #include "backend-ldst.h" =20 =20 -/* DEBUG defines */ -#define DEBUG_TLB - -#ifdef DEBUG_TLB -# define DEBUG_TLB_GATE 1 +#ifdef CONFIG_DEBUG_TCG +#define assert_cpu_is_self_or_stopped(cpu) \ + assert(qemu_cpu_is_self(cpu) || cpu_is_stopped(cpu)) #else -# define DEBUG_TLB_GATE 0 +#define assert_cpu_is_self_or_stopped(cpu) \ + do { (void)(cpu); } while (0) #endif =20 -#define assert_cpu_is_self(cpu) do { \ - if (DEBUG_TLB_GATE) { \ - g_assert(!(cpu)->created || qemu_cpu_is_self(cpu)); \ - } \ - } while (0) =20 /* run_on_cpu_data.target_ptr should always be big enough for a * vaddr even on 32 bit builds @@ -357,7 +351,7 @@ static void tlb_flush_by_mmuidx_async_work(CPUState *cp= u, run_on_cpu_data data) MMUIdxMap all_dirty, work, to_clean; int64_t now =3D get_clock_realtime(); =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 qemu_spin_lock(&cpu->neg.tlb.c.lock); =20 @@ -391,7 +385,7 @@ static void tlb_flush_by_mmuidx_async_work(CPUState *cp= u, run_on_cpu_data data) =20 void tlb_flush_by_mmuidx(CPUState *cpu, MMUIdxMap idxmap) { - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 tlb_flush_by_mmuidx_async_work(cpu, RUN_ON_CPU_HOST_INT(idxmap)); } @@ -464,7 +458,7 @@ static void tlb_flush_vtlb_page_mask_locked(CPUState *c= pu, int mmu_idx, CPUTLBDesc *d =3D &cpu->neg.tlb.d[mmu_idx]; int k; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); for (k =3D 0; k < CPU_VTLB_SIZE; k++) { if (tlb_flush_entry_mask_locked(&d->vtable[k], page, mask)) { tlb_n_used_entries_dec(cpu, mmu_idx); @@ -509,7 +503,7 @@ static void tlb_flush_page_by_mmuidx_async_0(CPUState *= cpu, { int mmu_idx; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 qemu_spin_lock(&cpu->neg.tlb.c.lock); for (mmu_idx =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { @@ -573,7 +567,7 @@ static void tlb_flush_page_by_mmuidx_async_2(CPUState *= cpu, =20 void tlb_flush_page_by_mmuidx(CPUState *cpu, vaddr addr, MMUIdxMap idxmap) { - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 /* This should already be page aligned */ addr &=3D TARGET_PAGE_MASK; @@ -686,7 +680,7 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUState = *cpu, { int mmu_idx; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 qemu_spin_lock(&cpu->neg.tlb.c.lock); for (mmu_idx =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { @@ -730,7 +724,7 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, vaddr add= r, { TLBFlushRangeData d; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 /* If no page bits are significant, this devolves to tlb_flush. */ if (bits < TARGET_PAGE_BITS) { @@ -915,7 +909,7 @@ static void tlb_set_dirty(CPUState *cpu, vaddr addr) { int mmu_idx; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 addr &=3D TARGET_PAGE_MASK; qemu_spin_lock(&cpu->neg.tlb.c.lock); @@ -996,7 +990,7 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx, int asidx, wp_flags, prot; bool is_ram, is_romd; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); =20 if (full->lg_page_size <=3D TARGET_PAGE_BITS) { sz =3D TARGET_PAGE_SIZE; @@ -1265,7 +1259,7 @@ static bool victim_tlb_hit(CPUState *cpu, size_t mmu_= idx, size_t index, { size_t vidx; =20 - assert_cpu_is_self(cpu); + assert_cpu_is_self_or_stopped(cpu); for (vidx =3D 0; vidx < CPU_VTLB_SIZE; ++vidx) { CPUTLBEntry *vtlb =3D &cpu->neg.tlb.d[mmu_idx].vtable[vidx]; uint64_t cmp =3D tlb_read_idx(vtlb, access_type); --=20 2.53.0