From patchwork Tue Dec 20 17:46:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 635478 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3079897pvb; Tue, 20 Dec 2022 10:29:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5BAY4oUXXVXfEI6XWKXHk5DlnWJRl0nJrc+ZKBunCP00NtIo8tnrWg5kMAwNBEcbMiNqM+ X-Received: by 2002:a0c:ed2d:0:b0:4c7:658a:a7c7 with SMTP id u13-20020a0ced2d000000b004c7658aa7c7mr65231683qvq.34.1671560965077; Tue, 20 Dec 2022 10:29:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671560965; cv=none; d=google.com; s=arc-20160816; b=nXr754zBNNMz4fshu4q/IFtpjjOcZ3vEf9HhsoXvF60pqCFGVBaLGDrbkQzqBaAhsn TjQI8l1bLqv/UQ6UH20nSLNNGCBUOCzp72q91a54EmW3CI4zfTDQJHUNncioKz69tZ2H I+YsKt/hMq63x+3S0cKn/X12GA44AR5nmoJ8pwYrH09oNJAHht6VFT2SUfcMP61gxzsz 4Cfat7ogLzTtdQROO7KNyp5wOgGUNLglNblH0gdy2dLzvgvpYo97gywr+kFHfuAaSJDk 3mn4A/1vGJ+JMrZBjyzqLJekrhYPmej5tCBGvVBosEq/24wcCoBM8VvFbZi3inbGHxzi 0EHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=wFikyosjlVj+KI769mCTL7Gw6h5RtUTnkPfi/ObNwEY=; b=LDRC3rO7pt5dK3SAheA1+idIIF8RNKhOUKAYjCz1+T0dFKgKuBfJFw0s93FxzPyvWY pi1+jofaB3ed0q+Jft4RI/3Hbty0kXlGA37u2z937jTHFuJOHqugFnxQQD//QM507iW+ S0t6W6wrrn9BMn/Ui1CuOeMMDu7zDq/IDXMkkmOAU2/oEH6KGX0kq9HGqJkloK7JAhL6 oykMUT2QwHONkvkPzgZ1zLLQvcQ+nO8S9iCplv9ofVyi6q89fybuKAKR3gBKp5J6+gVA iWyby+85yY4B06jdVdnTb2+QXD6/HtP2yvo8rBzYjtMOKXMKtsB4emiZMw1T4eXUoOrr 9A6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UianpQAX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t27-20020a05620a035b00b007049d89b119si834350qkm.164.2022.12.20.10.29.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Dec 2022 10:29:25 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UianpQAX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7ghP-0003Kw-Qj; Tue, 20 Dec 2022 12:46:43 -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 1p7ghP-0003Kg-2A for qemu-devel@nongnu.org; Tue, 20 Dec 2022 12:46:43 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7ghN-00005k-HA for qemu-devel@nongnu.org; Tue, 20 Dec 2022 12:46:42 -0500 Received: by mail-wm1-x332.google.com with SMTP id ay40so9325981wmb.2 for ; Tue, 20 Dec 2022 09:46:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wFikyosjlVj+KI769mCTL7Gw6h5RtUTnkPfi/ObNwEY=; b=UianpQAXg6/7EdW92ZSFEXtF4/lRoAXukkYEa66VVXxvrMhsZq7ZFklhs38cMmlRPl BXsYx1djefVXmKQV3qUsg5M5RbBiyyXdDsKMgvlgHDp6yvvo+RzjE4Ps678wdLA7OAj1 63FP1Qo+ukRimrwfPzcAyed/4L6PD4c/1qWJ/GvWgboyTe6Ny7Mk27jgTzGzLXsI0VGe JZYGM//0yUEASB7ruPiwNq/3/sMC0EoADhvX34v0cWVhgaKYoX1kKv9cj8UHoillq3Hw B0mbK00yNFH3T94eEbcF0893t2DW+a5EMLggmqGO5f8mb2swza6R0w5jj2eepB1Kb4J6 MfkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wFikyosjlVj+KI769mCTL7Gw6h5RtUTnkPfi/ObNwEY=; b=xCCiwjg+aVNmSHeLMfWVKqNkaUBrnhx1xNf8qQma/Ss+WQjzduu5S5yHOusITkLWwS P7WUvJRj9kKBUeFCcRK44efWGHbAX14LTVTRtA7zmlJweQW4/PlxZJ1hgMcHvf0Rp0WT xpbBa1lKGB3IsMR66jTOSjvkSS3p6kEOAx6CnwsDtAlOpebCQrEMbxEX/2Lj8czImoJm xVFhsIH4xahhlfyI3e723TWcebGd2Ku0yJ84syQO5AacFeLAPvEjJJRs1Db6pRd6tgP7 aksYgL6Er7s58vyBdn5CczVNK14l5NA9a8DUzyYdI+GotMA5JZU9Qa65eTB6JvGhXq1u 6GKg== X-Gm-Message-State: ANoB5pmPGzRPgJ8f6XG+vdb9y2ycM/0YQq3L+I25sJ/98j5Bmcfl5wJu 3gKYkusEs54kwrFefd9hgSVHWVa5OpfqmrpP X-Received: by 2002:a05:600c:3c9a:b0:3c6:c6c9:d75e with SMTP id bg26-20020a05600c3c9a00b003c6c6c9d75emr48053386wmb.0.1671558400080; Tue, 20 Dec 2022 09:46:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f22-20020a05600c43d600b003cf6e1df4a8sm15998512wmn.15.2022.12.20.09.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 09:46:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf , Hanna Reitz , Fam Zheng , Stefan Hajnoczi , Fabiano Rosas Subject: [PATCH] block/io: Check for replay-enabled in bdrv_drain_all_begin() Date: Tue, 20 Dec 2022 17:46:38 +0000 Message-Id: <20221220174638.2156308-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In commit da0bd74434 we refactored bdrv_drain_all_begin() to pull out the non-polling part into bdrv_drain_all_begin_nopoll(). This change broke record-and-replay, because the "return early if replay enabled" check is now in the sub-function bdrv_drain_all_begin_nopoll(), and so it only causes us to return from that function, and not from the calling bdrv_drain_all_begin(). Fix the regression by checking whether replay is enabled in both functions. The breakage and fix can be tested via 'make check-avocado': the tests/avocado/reverse_debugging.py:ReverseDebugging_X86_64.test_x86_64_pc tests/avocado/reverse_debugging.py:ReverseDebugging_AArch64.test_aarch64_virt tests were both broken by this. Fixes: da0bd744344adb1f285 ("block: Factor out bdrv_drain_all_begin_nopoll()") Signed-off-by: Peter Maydell Tested-by: Fabiano Rosas --- Thanks to Fabiano for doing the bisect on this. --- block/io.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/io.c b/block/io.c index d87788dfbbf..a09b1b34abf 100644 --- a/block/io.c +++ b/block/io.c @@ -506,6 +506,15 @@ void bdrv_drain_all_begin(void) return; } + /* + * bdrv queue is managed by record/replay, + * waiting for finishing the I/O requests may + * be infinite + */ + if (replay_events_enabled()) { + return; + } + bdrv_drain_all_begin_nopoll(); /* Now poll the in-flight requests */