From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CVk2HWkuhGpMrS4AWB0awg (envelope-from ) for ; Tue, 18 Aug 2026 06:05:29 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PZIsM8dc; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 742891E033; Tue, 18 Aug 2026 06:05:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,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 0BFB81E033 for ; Tue, 18 Aug 2026 06:05:29 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6001A4BA79B9 for ; Tue, 18 Aug 2026 10:05:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6001A4BA79B9 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PZIsM8dc Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 116F54BA798A for ; Tue, 18 Aug 2026 10:04:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 116F54BA798A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 116F54BA798A Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787047455; cv=none; b=I+RT2Z2M2SUf53G3TVC8eH/1tWElbMDH7WWBAVLIHc46UzeMIGHn2U0y9bxcMvARulnTnOGAWdPqQOasBlE/nILLp2ShSRw50cOcLq+2QbeVgSP1jA+O0JxoUC/yDYroa/Fvn+HPCRpHoMqsVrzM0obwZjpKGIX8Ve29kTWdAwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787047455; c=relaxed/simple; bh=zDwXEU829CtjNvyJqPjUrm9243hkrGCp4657TMyMwrY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=O1lia+ZRGx8tHG313nLjZGlGos5NyuFJOfF3hE1GWf0yQfuGaWLT9codfeUOO7/L96vafiqNLr3w1idFeg5DawM2Adw8oV4SQeZ4EFIHTRsXSKKxarAK/voiS0lSbNS4kG9mc1uDgoruEsxLxx6SzQ/vxIC4wNoTjfziRqckpvg= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PZIsM8dc DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 116F54BA798A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787047454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jrKS+SnZPgAVFxxMLczmRxw4Q4/LrZXAKKDV2DN2Npw=; b=PZIsM8dc0D6QJUGLMCgCzlb5iTtRWnbtSMy7INnzHWqf7ftDFUFhcrFnlhJsMyo0cwSfh1 nz1Ndr5p3FIA23fkEX6YZP45/4Y1IP5F1mTKSWs8w9R/YFN50as/v01SOrEI8E09Fn5ab8 UdM59A/s/+20mKrhNOZZiTe2axq4I48= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-367-b9SlEgHcMfSmBMpRARWPHg-1; Tue, 18 Aug 2026 06:04:03 -0400 X-MC-Unique: b9SlEgHcMfSmBMpRARWPHg-1 X-Mimecast-MFC-AGG-ID: b9SlEgHcMfSmBMpRARWPHg_1787047442 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4954a93c565so23564285e9.2 for ; Tue, 18 Aug 2026 03:04:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787047442; x=1787652242; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jrKS+SnZPgAVFxxMLczmRxw4Q4/LrZXAKKDV2DN2Npw=; b=I4Gi5K+r/pZ3HM4zmrp6hFM4PioPWs2NCIPsJTTz8ZVFRKc7c5XUSNEZiF+ZlWrGKX 7q/xlyZjS5RsT4LXAjL0vz5vuu+pB/XfXKAkTzXWBLHA6noG1bgjA3E/iDRRv1vu35Ez BNCaE6lJym8JL06kAuWeHc6FDPCMnIxjY190buw4+ys6sjy9Cdj1coGSTlBtuA/inVpY /GlNa4jCKzqPGeqZ7cTrmQFfs83feTO1D/Krze/S70VpH2OOe7Ro7j7J129dLYi/wdBe CvDuYQA505nvxYABHO2KzNsZM+lxq1slFqRdOa4bNkUie2mIO+EhD+SloTqscm04ydQR VRmQ== X-Forwarded-Encrypted: i=1; AHgh+RqoQILyJW9fcMIoIlq45oHsy/BxRG/1+RWSr39tszveP6C8MCZBA3v4KOodADZFKRIiJkawZ4Vn+EuXzQ==@sourceware.org X-Gm-Message-State: AOJu0YwCObXuqsR3S/8aPovCNrQKgu3ZJnNJpKT/GdQLGV1bXnkMmU1y MUagv8cpczesiRws8CUDYo1E71vaqyEaBqeHOE/SK258xIp5sPin2xWitqgBtlafu8Ypemn+bts hTrzXCJ8vCGUJ3euVj+2jJFEPKGnQVERBghgFktXZ4489EiBHvoxMPf41FKohczGmkCxXQGw= X-Gm-Gg: AR+sD13LGKs4LeUvb0tj++X+fbqVdzuHlQm5g7yg1jRz4YxiLuNWvNqOEk3xflpQG9Z C4A8EYGa8fky6F5WL+19YRicijGF3vRhfyfLl/iI8zBp8i1vBwIfZIQQ3m3gZN9We2R0oNd6x9Q sS4ZQ1bYLuwFLy4dH3DDerbyJ64nA1Jlx/o9LKpiM+ac1go43w6rygfRD4Aph3b0bPRIJVgtAvV E5pWO/C44AKRI6AKM3Zawp0WzS6A+s1xBiYPTbcrf9evzNB9HhtZg53UeCPlB+yDXwsJLU9aTuM rj+cppd1CpniwX5ruvJddK8AAqutDVQ9oBzJ8mpk1N9qQrpFuT2W264chzhnNyTe/kGlPY8uzJj OEuB8x3iSa8NBHx1YaxU= X-Received: by 2002:a05:600c:4f52:b0:493:f5bf:4dc6 with SMTP id 5b1f17b1804b1-4998793dafcmr507680635e9.7.1787047441907; Tue, 18 Aug 2026 03:04:01 -0700 (PDT) X-Received: by 2002:a05:600c:4f52:b0:493:f5bf:4dc6 with SMTP id 5b1f17b1804b1-4998793dafcmr507679305e9.7.1787047441408; Tue, 18 Aug 2026 03:04:01 -0700 (PDT) Received: from localhost (67.72.115.87.dyn.plus.net. [87.115.72.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4999610966dsm295984355e9.5.2026.08.18.03.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 03:04:01 -0700 (PDT) From: Andrew Burgess To: Sebastian Huber , gdb-patches@sourceware.org Subject: Re: [PATCH 2/4] sim/mips: Do not abort on a HI/LO hazard In-Reply-To: <20260816234357.278358-3-sebastian.huber@embedded-brains.de> References: <20260816234357.278358-1-sebastian.huber@embedded-brains.de> <20260816234357.278358-3-sebastian.huber@embedded-brains.de> Date: Tue, 18 Aug 2026 11:04:00 +0100 Message-ID: <87wltn219r.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: AaIhmdsVZKUMUBHGmRVDyCG2o3fLb64Wc6EIB1TI37A_1787047442 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Sebastian Huber writes: > 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 restores them 'restores' -> 'restore' please. > 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. > > Signed-off-by: Sebastian Huber > --- > sim/mips/mips.igen | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen > index 8203d19f8c4..fc2f81f85d0 100644 > --- a/sim/mips/mips.igen > +++ b/sim/mips/mips.igen > @@ -411,12 +411,17 @@ > && peer->mf.timestamp < peer->mt.timestamp)) > { > /* 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 restores them unchanged, so it Same here: 'restores' -> 'restore' please. > + 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. */ > + 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); This is fine, but is there not a risk that this is going to end up spamming stderr (or whatever) with these warnings? Would it not be worth adding some kind of counter: { static warning_count = 0; if (warning_count < 10) { ++warning_count; sim_io_eprintf (SD, "....."); if (warning_count == 10) sim_io_eprintf (SD, "Future warnings about .... are now silenced\n"); } } But I'll leave this up to you, I'm happy with the change as is. Approved-By: Andrew Burgess Thanks, Andrew > ok = 0; > } > history->mf.timestamp = time; > -- > 2.51.0