Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9523BC3DA7F for ; Mon, 12 Aug 2024 17:42:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdZ3O-0002tN-Cu; Mon, 12 Aug 2024 13:41: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 1sdZ3K-0002lq-Rk for qemu-riscv@nongnu.org; Mon, 12 Aug 2024 13:41:54 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdZ3I-0006Qo-1k for qemu-riscv@nongnu.org; Mon, 12 Aug 2024 13:41:54 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2cb55ff1007so3306575a91.0 for ; Mon, 12 Aug 2024 10:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1723484510; x=1724089310; darn=nongnu.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UyfrC6TVBoSvo347EZwXiALcTgGA11Jejacv8YIRml0=; b=nlsSJbvXp20l0Oi+wLdTDsPyNrlojdncSYK+0hElnJNHtKfDPV7RiKBPBO5l5GBY+c qxeAK7TSpHMQGtUDxxp0eSAQpsYaiVE/RzayY+b6rpOnaNzsZJavB2U9rXfWiIRlcoEO VrRnPU6e1I/CHiuKOinKGPkgZJo7hawKeuTV4tjZsSNXhmx7DzlW3biI4WoXVvuFyBCm 5+3PItkEhpE2YPB59PcE1BREikyhdXxzZTPdmsbTyG7QOrYVgJpWuAUVTmQjHmLE23r0 CZIiGv0dT7SvXf5KFlvocGUfk0hgrjdpVVgBYcuJbZ2vxlmlmzGmjalDgmc9S4fQvalj Krwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723484510; x=1724089310; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UyfrC6TVBoSvo347EZwXiALcTgGA11Jejacv8YIRml0=; b=AMoJI/yj8DnzPYpXcE/E/fgpfGMTh+fkMYw7XqI3xCK0iOXVn04JOR+K7qjIqzcG2N 8J6qWQoaJA+oEaOCVObNsV7a35HkX02eo3o8l8yrsh20yfH7Fok2VOw09BZqj+79NH8h etbnpsVViTOfqfd13xMioXrte92BxE6nIF1XI4TGUwgS/Cx1X1Jwm9NAXBgGqugUeArV vcEAV4W8QdYlwA5uGQhQ21bfye/GbA1HvmTxdnqS6dfgHI7Fi/t2BqzFsEWHdzE0TXR9 kjSkMpHXyqj633qtflrsZHE8J0F0ub4t0q1A23je/JfvsARP15x0Us4oiuiuFm4Fg53s tZ8Q== X-Forwarded-Encrypted: i=1; AJvYcCWDW3WW6OeTCFNKnnOueUSw6jFrvuTTbu6c9GaqMf6ichPr8bPxrPWsTf1e7eewOTU3cO1S/dcX0WL+KE+Nq9nGyNOxCmM= X-Gm-Message-State: AOJu0YzHtPg1VcGxRSzXkmEsCqLc7dH56eGfJfJ92v3PgZmMKs2l3wpC iO54Xg0wM2VEAYL//qk3SwDHFgFoDCrlqdlJ4HfDU7A0JL8C/C6DxTDW/wn8U+k= X-Google-Smtp-Source: AGHT+IEUUdMWhGsl/q/z/wSZoE9xn+uALzz2OUNVV+zxQmpzdlaMNFeAiGFg5N3/NFY2u0Cq6nVjDg== X-Received: by 2002:a17:90a:f18d:b0:2cf:cc13:471a with SMTP id 98e67ed59e1d1-2d3926b8937mr919719a91.43.1723484510003; Mon, 12 Aug 2024 10:41:50 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d1fcfe487esm5405683a91.42.2024.08.12.10.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 10:41:49 -0700 (PDT) Date: Mon, 12 Aug 2024 10:41:47 -0700 From: Deepak Gupta To: Richard Henderson Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com, palmer@dabbelt.com, Alistair.Francis@wdc.com, laurent@vivier.eu, bmeng.cn@gmail.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com Subject: Re: [PATCH v3 01/20] accel/tcg: restrict assert on icount_enabled to qemu-system Message-ID: References: <20240807000652.1417776-1-debug@rivosinc.com> <20240807000652.1417776-2-debug@rivosinc.com> <9c987cbf-f702-4e1f-88d8-82a149c98007@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <9c987cbf-f702-4e1f-88d8-82a149c98007@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=debug@rivosinc.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org On Wed, Aug 07, 2024 at 10:48:56AM +1000, Richard Henderson wrote: >On 8/7/24 10:06, Deepak Gupta wrote: >>commit 16ad9788 [1] restricted icount to qemu-system only. Although >>assert in `cpu_loop_exec_tb` is on `icount_enabled()` which is 0 when >>its qemu-user and debug build starts asserting. >>Move assert for qemu-system. >> >>[1] - https://lists.gnu.org/archive/html/qemu-riscv/2024-01/msg00608.html >> >>Signed-off-by: Deepak Gupta >>--- >> accel/tcg/cpu-exec.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >>diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c >>index 245fd6327d..8cc2a6104f 100644 >>--- a/accel/tcg/cpu-exec.c >>+++ b/accel/tcg/cpu-exec.c >>@@ -927,9 +927,9 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, >> return; >> } >>+#ifndef CONFIG_USER_ONLY >> /* Instruction counter expired. */ >> assert(icount_enabled()); >>-#ifndef CONFIG_USER_ONLY >> /* Ensure global icount has gone forward */ >> icount_update(cpu); >> /* Refill decrementer and continue execution. */ > >No, this is a real bug. > >Just above we handled > > (1) exit for tcg (non-)chaining (!= TB_EXIT_REQUESTED), > (2) exit for exception/interrupt (cpu_loop_exit_requested). > >The only thing that is left is exit for icount expired. >And for that we *must* have icount enabled. > >How did you encounter this? I spent last week incorporating your suggestions. And during the flux of it, I started seeing this issue again. As soon as I switch to branch from where I sent the patches out, this icount assert issue disappears. So something definitley is triggering the issue. It happens only when zicfilp and zicfiss are enabled. I am still trying to root cause and in a fog right now. Although I am not very well versed with tcg internals. So any pointer here which could help me debug it faster would be well appreciated. Thanks. > > >r~