From nobody Tue Dec 24 13:41:49 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1734691463; cv=none; d=zohomail.com; s=zohoarc; b=XXjPKFmHJRvQbM8lS1x+aIVuz69lDQTpHtBtA8blufqx/iXE/ZLtHZprOteBjjBuflxAeqY6EqyiRTrDW0zf7pm0DOw27whzdQHL/RWpKgpE/BNU/C1S1+kDER3ZvJUMSA7GDYS3DZetuGkCk/XXob+lVNmexsLWO4KXCcdl7ZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734691463; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gK96j8dWCREGXgJwMGuVlSSEE1tC1GR6d2jBmPlZZVA=; b=Dkb2cGCzespwoOhOOpzOoMzdrY9SXnamttJ8TyN1fw6PbpaDLt1WWff9x+1I2wwc+N5pdkiSLjNK80rnh3oX+Pt7efAZDahXz9g00Qg0dzBcIiQlnQbwFuGstvnqZJHEzohNTjszm8dvhczHMYt7FTZaBtjvJZOIW3rdZ2UwPBQ= 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 1734691463449383.4261106500712; Fri, 20 Dec 2024 02:44:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOaUV-0007LA-SE; Fri, 20 Dec 2024 05:44:20 -0500 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 1tOaUU-0007CF-Hw; Fri, 20 Dec 2024 05:44:18 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOaUS-0005Rd-Tj; Fri, 20 Dec 2024 05:44:18 -0500 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7fd17f2312bso1312076a12.0; Fri, 20 Dec 2024 02:44:16 -0800 (PST) Received: from wheely.local0.net (14-200-18-130.tpgi.com.au. [14.200.18.130]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee06dfd3sm5376942a91.32.2024.12.20.02.44.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 02:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734691455; x=1735296255; 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; bh=gK96j8dWCREGXgJwMGuVlSSEE1tC1GR6d2jBmPlZZVA=; b=Td4f1Tv/JfnZL4Elus48aX0gwrTK+3D9BAR1rhG+S9ZDf5r+MbPpEej2OHWGQ9SE5q NX5tXU+yPVS14BSZv2j3Zzjtz80qT7PIsfs6YueG0QE57p0wgBENEKQRHOsJ1s1vYVjg kli6C0VgsCrdwdUGX5OonMoMPmx65TVMVCYnUDyOmVX3/06Ke6JUPxxUyoxiVy9oVzw7 S+rcgBa9KtXNHVoc/FXXNeiT2tkotVB3CnCKfD5Z5GgUMua6+GIKNKEPdYcZ+usKfkRF svcnv2yzPyqA1H94YfG0ct4ySqFQrCeM/DDB89dTcbMTq9Si1eHoal9NXOW5tWkGRikU 8SKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734691455; x=1735296255; 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=gK96j8dWCREGXgJwMGuVlSSEE1tC1GR6d2jBmPlZZVA=; b=Ahsmf0b4d2pVjYjf+e2Sh1VuV0AdmxQySgDFkh+iMuvp5/BhF0jR5r/OU8G88nwEaf AdU/XgE45NkfHpqDUUXY/aj2lHtYrwIIV3B77fCS/xKNQwjrIuzJViu9hPO9cBFvyLxq r/L+II3JqParF4+uC9TiRAC1oPrFEcNiCN82jdWKfH1+OtfAF6QAY9k9PfgrL2KWslcz 2bLJfwHFq8Go5G/wReOXJQlDicXu2Y6+WnOtu+N1Mqv/+ibzzC73FdDA0pNXE/CDmVVq Uu5YhBqBd4IqiwyVotsDtrCqu+EMf1x3F+wcnvNaYMVLRUwmdZeLhXN/IZSAx84esNuJ 4LKQ== X-Forwarded-Encrypted: i=1; AJvYcCWpuaqZyI4QlOFVqeC4+iIctq/SkI79apOe8eSZRS/pUeA23moMPCj6c8FbudjlpiEJ5Mw+pE8L6L5K@nongnu.org X-Gm-Message-State: AOJu0YyG5HUbnjwd68ewoFiT2WsWipkRa75IcOMuIGgHXDM0N20Hrw5C MhlzvJQTlb8ntTswDgtBwMnJ7que1YNBG9WGBjo/2xlxqaW23/BHi6KEzQ== X-Gm-Gg: ASbGnctQUD3J9C6quxt+dsm0jA+2MQNqntBnpBNWuj2Exg6Z2PlfBRYn1OC0DuTEY51 qTHygBFoL7S13cpuc/SiqxhgLUcPinKBFBOMQyzNC1hvJ9u3O/EwaUdVIq8ft3r/9bYSpyLZIDu GK9skYJ785Yrr8UamCHAr5QVtC48MecGSMN3+K7DxbcQ+nZJykfqw5QI6Isn4l/NsqO+NQ1zjXP uSzeiqdOb4oRBEeNxaReHGi6mtEY5YZNw/HzRHtvHQQVfKIdDDgRTBTIdJq66HhjiF/VHRc2r1c PQc8gTsNpw== X-Google-Smtp-Source: AGHT+IHZFHLin5x6wJnLdKPCeP9ORVvAm7tn/Fzr3fGVEOIA6Fdk4Fw0nxh1zvmUre6+GFtkqiZjSg== X-Received: by 2002:a17:90b:134d:b0:2ea:4c4f:bd20 with SMTP id 98e67ed59e1d1-2f452eed773mr3451099a91.32.1734691454890; Fri, 20 Dec 2024 02:44:14 -0800 (PST) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-block@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Kevin Wolf , Hanna Reitz , Pavel Dovgalyuk , Paolo Bonzini , Stefan Hajnoczi , Fam Zheng , Ronnie Sahlberg , John Snow , "Michael S. Tsirkin" , Jason Wang , Vladimir Sementsov-Ogievskiy , Peter Xu , Fabiano Rosas , "Dr. David Alan Gilbert" , Markus Armbruster , Michael Roth , Wainer dos Santos Moschetta Subject: [PATCH 13/17] hw/scsi: Convert to new bh API Date: Fri, 20 Dec 2024 20:42:15 +1000 Message-ID: <20241220104220.2007786-14-npiggin@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241220104220.2007786-1-npiggin@gmail.com> References: <20241220104220.2007786-1-npiggin@gmail.com> 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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=npiggin@gmail.com; helo=mail-pg1-x530.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, FREEMAIL_FROM=0.001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1734691463681116600 Content-Type: text/plain; charset="utf-8" Convert aio_bh_schedule_oneshot() to aio_bh_schedule_oneshot_event(), which can specify the clock type, making it compatible with record-replay. Operations on SCSI reqs do affect target machine state, so it should use QEMU_CLOCK_VIRTUAL to recorded and replay the bh. This fixes hangs in record/replay when using SCSI devices. Signed-off-by: Nicholas Piggin --- hw/scsi/scsi-bus.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 2f1678d51e7..16f294ce6b7 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -166,9 +166,17 @@ static void scsi_device_for_each_req_async(SCSIDevice = *s, =20 /* Paired with blk_dec_in_flight() in scsi_device_for_each_req_async_b= h() */ blk_inc_in_flight(s->conf.blk); - aio_bh_schedule_oneshot(blk_get_aio_context(s->conf.blk), - scsi_device_for_each_req_async_bh, - data); + + /* + * This is called by device reset and does not affect the observable s= tate + * of the target (because it is being reset), and by scsi_dma_restart_= cb + * to restart DMA on vmstate change which also should not affect the s= tate + * of the target (XXX is this really true?), so QEMU_CLOCK_REALTIME sh= ould + * be used to avoid record-replay of the bh event. + */ + aio_bh_schedule_oneshot_event(blk_get_aio_context(s->conf.blk), + scsi_device_for_each_req_async_bh, + data, QEMU_CLOCK_REALTIME); } =20 static void scsi_device_realize(SCSIDevice *s, Error **errp) --=20 2.45.2