From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id p9mWCMrEh2qgDjMAWB0awg (envelope-from ) for ; Thu, 20 Aug 2026 23:23:54 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=embedded-brains.de header.i=@embedded-brains.de header.a=rsa-sha256 header.s=34EE5404-8E36-11F0-B577-2ECCAB4968F5 header.b=lomT+F66; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 052D01E09B; Thu, 20 Aug 2026 23:23:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5AF101E09B for ; Thu, 20 Aug 2026 23:23:49 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 600D54BB1C04 for ; Fri, 21 Aug 2026 03:23:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 600D54BB1C04 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=embedded-brains.de header.i=@embedded-brains.de header.a=rsa-sha256 header.s=34EE5404-8E36-11F0-B577-2ECCAB4968F5 header.b=lomT+F66 Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id E92E34BA900F for ; Fri, 21 Aug 2026 03:23:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E92E34BA900F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E92E34BA900F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=85.10.215.148 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787282597; cv=none; b=sH14RBBY4cOHhmryPSC4jB9r3R2bwhrTAw3j8vOVrbgcaAN+BtSbySgpxwFoYyyy3d6bSDS9J+jt5GUiI8tLzEx4szbA0WFTJOIe6+5WlMGN4lz/n/IPtcTHcoJQgdPTEaQx1CyTAxXWvt9oqppqglToWwwhEqG+8eEdc/FatxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787282597; c=relaxed/simple; bh=G7fTXDLxFHdx9j2Pbk5zHpOpd6Ls4ZzcWPgD9pK1Yps=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NJU4WDYoAng1OwHYJ9rHezxROXsUwiSwRsJhpfQYXvPeqrYZRZHUAR/Mefw16nMkCz3Kx2i9A9gCtdp4Tom2BErIyg/btswKZdY0R9gBCYUHXd0aUyI9RKN/FSjYBlaNNwRNUvxasoHVHzU5MuLeTDXoafaxHznJC3taIjO07wE= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=embedded-brains.de header.i=@embedded-brains.de header.a=rsa-sha256 header.s=34EE5404-8E36-11F0-B577-2ECCAB4968F5 header.b=lomT+F66 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E92E34BA900F Received: from sslproxy08.your-server.de ([78.47.166.52]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1wxFqd-000LXa-0Z; Fri, 21 Aug 2026 05:23:15 +0200 Received: from localhost ([127.0.0.1]) by sslproxy08.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wxFqd-0005Co-2u; Fri, 21 Aug 2026 05:23:15 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 21983480061; Fri, 21 Aug 2026 05:23:15 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10032) with ESMTP id SUtMECBX-XY3; Fri, 21 Aug 2026 05:23:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id C3C9C480052; Fri, 21 Aug 2026 05:23:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.embedded-brains.de C3C9C480052 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embedded-brains.de; s=34EE5404-8E36-11F0-B577-2ECCAB4968F5; t=1787282594; bh=IGbxAAiXIcHLgtuc0YBlnWZYN8N03J7UkkmUCRfHVuo=; h=From:To:Date:Message-ID:MIME-Version; b=lomT+F66BDNkLphEv5PYVdVpC1ZLSWEad6wD3Ts9iJ4TqkGrz2P/UjsFwjXf3GXoL bH99AEydcrqPAqOLG9eXdDokOO8B1bWtQp01O1PB7XRmWk8I7f5jm05Jz4hFna4OGW OQxdfh3FS1j4x0hJWEml48kMNGR4XG7klfCJCTgTiw2+xauSs966FYq+RPR/m+lOk9 2Fzp7ARuWagtP53V4cU8kU/8PoWNNMP0w+Dq/0F0VU5kk2PdSaG60s7bJbJAde9OcG p+//9MTYOz2UYu77wUZpiSShVatw7PyI5UMB8JvtfwI44SvD39OWk+hr7ix1Bh4hrt ofyp8ypp0PjWg== X-Virus-Scanned: amavis at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10026) with ESMTP id AYA1qvu-_3W3; Fri, 21 Aug 2026 05:23:14 +0200 (CEST) Received: from zimbra.eb.localhost (unknown [10.10.171.10]) by mail.embedded-brains.de (Postfix) with ESMTPSA id C9BFD480047; Fri, 21 Aug 2026 05:23:13 +0200 (CEST) From: Sebastian Huber To: gdb-patches@sourceware.org Cc: "Maciej W . Rozycki" , Andrew Burgess Subject: [PATCH v2 2/6] sim/mips: Do not abort on a HI/LO hazard Date: Fri, 21 Aug 2026 05:23:00 +0200 Message-ID: <20260821032304.293603-3-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260821032304.293603-1-sebastian.huber@embedded-brains.de> References: <20260821032304.293603-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-DKIM-Status: pass [(embedded-brains.de) - 78.47.166.52] X-Virus-Scanned: Clear (ClamAV 1.4.3/28098/Thu Aug 20 08:24:22 2026) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org check_mf_hilo() calls sim_engine_abort() when a mfhi or mflo reads a value which the ISA leaves UNPREDICTABLE. The comment above the helper states the rule correctly: the result is UNPREDICTABLE, not an error. Reading an undefined value is not a fault, and the return value of the helper is discarded at both call sites, so the abort is its only effect. The abort halts the client and the run loop resumes it on the faulting instruction, which reads the same register again and aborts again. An operating system may save HI and LO on interrupt entry and restore them unchanged, so it reads them at an arbitrary instruction boundary where the last writer is whatever the interrupted program did. Every clock tick landing in multiply or divide heavy code then deadlocks it. Warn instead. The warning repeats for every hazard. Print it at most ten times. Approved-By: Andrew Burgess --- sim/mips/mips.igen | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen index 8203d19f8c4..3b52f2df43f 100644 --- a/sim/mips/mips.igen +++ b/sim/mips/mips.igen @@ -410,13 +410,26 @@ && ! (peer->mf.timestamp > history->op.timestamp && peer->mf.timestamp < peer->mt.timestamp)) { + static int warning_count =3D 0; + /* The peer has been written to since the last OP yet we have - not */ - sim_engine_abort (SD, CPU, CIA, "HILO: %s: MF at 0x%08lx following= OP at 0x%08lx corrupted by MT at 0x%08lx\n", - itable[MY_INDEX].name, - (long) CIA, - (long) history->op.cia, - (long) peer->mt.cia); + not. The ISA makes the result of this MF UNPREDICTABLE, it does not + make it an error. An operating system may save HI and LO + unconditionally on interrupt entry and restore them unchanged, so it + reads whatever the interrupted program left behind. Aborting the + simulation here deadlocks such a system, since the run loop resumes at + the faulting instruction and the MF is executed again. */ + if (warning_count < 10) + { + ++warning_count; + sim_io_eprintf (SD, "HILO: %s: MF at 0x%08lx following OP at 0x%08lx = corrupted by MT at 0x%08lx\n", + itable[MY_INDEX].name, + (long) CIA, + (long) history->op.cia, + (long) peer->mt.cia); + if (warning_count =3D=3D 10) + sim_io_eprintf (SD, "HILO: further warnings are silenced\n"); + } ok =3D 0; } history->mf.timestamp =3D time; --=20 2.51.0