From nobody Tue Nov 26 22:35:57 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1704727025; cv=none; d=zohomail.com; s=zohoarc; b=WayuZCIfLx6Z2PBr5zgA25UqEuA/rfGitZrZ+28YFqcajUtEykxYzyjleODUbeESUUZ5w4tMp1sZkEBeZLij1p0G63pu1mXpTujcko9VhgPhEWY6OLZz6gZMmBMeemjAf+CejHggX7hy4sZvDdlXf4CAOpb0ClX5s+YrqAbmRic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704727025; h=Content-Type: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=/3f/gZt7kuZhNsGlk9QFjConVSBhlieoHxarURcJ0oU=; b=ezIxEXObnN3iqGAADlD9EytLdDMeZekBblzHvkWs8+NMr1rg3yAtxBtOtRjdk7310FLAYO7oe61USOxK1l2UcmBceDt3YRT9lcHgM0/uTt0QdNuDFNph9McdPcLnEwB+yGqR3L3tyjHiBAoYprHHDImuPaMzqTilzMUtjlFgfi8= 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 1704727025873417.3517284248884; Mon, 8 Jan 2024 07:17:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMrKN-0004J9-An; Mon, 08 Jan 2024 10:14:11 -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 1rMrKL-0004Gj-Ms for qemu-devel@nongnu.org; Mon, 08 Jan 2024 10:14:09 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMrKF-0001c2-MQ for qemu-devel@nongnu.org; Mon, 08 Jan 2024 10:14:08 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40e4b20a52bso2169005e9.3 for ; Mon, 08 Jan 2024 07:14:03 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id k25-20020a05600c1c9900b0040d87b9eec7sm11452358wms.32.2024.01.08.07.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 07:14:01 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CD36F5F950; Mon, 8 Jan 2024 15:13:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704726842; x=1705331642; 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=/3f/gZt7kuZhNsGlk9QFjConVSBhlieoHxarURcJ0oU=; b=I/LFI0BL5RQe6weroZ1gezUBYUaosPFCVYGZUnqcUcmZPJngqqw62jmJtT88Hypvl9 pwPrhRrUucZwTdbFk1ph0Bq9LUEJN9tNBXWEiSJf5e+FneiF7X53V62uqHhAZfUjJKaD a3v9whsDxjCTTL/AmISoxwXtFrQkcCwVaq/h4DT2QxDn7fafbT2s+XR9AUefjBWHyIPq 9I7h9EwyAa0CKLDTRokHTVwOPIAN/MTEl7QXfD4x+3JwvjQJLopJkCCIiR/Oqu8qcXjC /1h3JC8MIBNbXPoLv6KW/Zk3ekc+ArpZKx//ObdfTHhyR7ZIXIggVIOhh74K60VBPbzq Ql2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704726842; x=1705331642; 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=/3f/gZt7kuZhNsGlk9QFjConVSBhlieoHxarURcJ0oU=; b=VltuFMbzxdKQop/ypg35ii8BwOKhmwMv+QVED/euvGdPDZme2qFDuS00t9cvOPd54z kJolC4AJDvDO5ui4fY+ebS+rUGSEsFbyP1cp6n7XVl6U/N4fOEPndL/wVc4kuCXmYq0Z PR4zU+bNe3GGmxFYQGbZJUB9mqryNmsWZCxBhyuDEI6SjXQS4i1Z8quMFLzAijT3a1Gl 2YsecVBkMtBggOk034KSdD5yGAg/zZ8i4sW1TaVK0k9BFu0L86sKSZypRU3ezByxdKNJ 9L3j4UGWd27ivlhkEta9dTRnckfkhYxKps+R8Cvicnj4jwCewTV5xNY0OsktNhTElc+Q gq5A== X-Gm-Message-State: AOJu0YyMadkkO3AyJq2SI1PqWAef5+SIq9LG/C//8zIyTYK1vVxfQmXK In2cj44aqr9Oc3swuUKUkm9VctiJwMjLwA== X-Google-Smtp-Source: AGHT+IH4ed5oIIydyYvlM/aTrzFpYYXIb19bG6WCEp6jHrwcz+wH2DdAvLIjtlNN8ycxoPkT+WRr8g== X-Received: by 2002:a7b:c4c5:0:b0:40e:4a75:e6c8 with SMTP id g5-20020a7bc4c5000000b0040e4a75e6c8mr410391wmk.116.1704726842222; Mon, 08 Jan 2024 07:14:02 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pavel Dovgalyuk , Richard Henderson , Paolo Bonzini Subject: [PULL 11/13] replay: stop us hanging in rr_wait_io_event Date: Mon, 8 Jan 2024 15:13:50 +0000 Message-Id: <20240108151352.2199097-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240108151352.2199097-1-alex.bennee@linaro.org> References: <20240108151352.2199097-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.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, T_SCC_BODY_TEXT_LINE=-0.01 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 @linaro.org) X-ZM-MESSAGEID: 1704727028245100003 A lot of the hang I see are when we end up spinning in rr_wait_io_event for an event that will never come in playback. As a new check functions which can see if we are in PLAY mode and kick us us the wait function so the event can be processed. This fixes most of the failures in replay_kernel.py Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2013 Cc: Pavel Dovgalyuk Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Message-Id: <20231211091346.14616-12-alex.bennee@linaro.org> diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 08aae5869fc..83995ae4bd4 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -70,6 +70,11 @@ int replay_get_instructions(void); /*! Updates instructions counter in replay mode. */ void replay_account_executed_instructions(void); =20 +/** + * replay_can_wait: check if we should pause for wait-io + */ +bool replay_can_wait(void); + /* Processing clocks and other time sources */ =20 /*! Save the specified clock */ diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 611932f3c3a..825e35b3dc4 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -109,7 +109,7 @@ static void rr_wait_io_event(void) { CPUState *cpu; =20 - while (all_cpu_threads_idle()) { + while (all_cpu_threads_idle() && replay_can_wait()) { rr_stop_kick_timer(); qemu_cond_wait_iothread(first_cpu->halt_cond); } diff --git a/replay/replay.c b/replay/replay.c index ff197f436bf..3fd241a4fcc 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -449,6 +449,27 @@ void replay_start(void) replay_enable_events(); } =20 +/* + * For none/record the answer is yes. + */ +bool replay_can_wait(void) +{ + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + /* + * For playback we shouldn't ever be at a point we wait. If + * the instruction count has reached zero and we have an + * unconsumed event we should go around again and consume it. + */ + if (replay_state.instruction_count =3D=3D 0 && replay_state.has_un= read_data) { + return false; + } else { + replay_sync_error("Playback shouldn't have to iowait"); + } + } + return true; +} + + void replay_finish(void) { if (replay_mode =3D=3D REPLAY_MODE_NONE) { --=20 2.39.2