From patchwork Tue Dec 10 20:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 848893 Delivered-To: patch@linaro.org Received: by 2002:adf:ec08:0:b0:385:e875:8a9e with SMTP id x8csp542445wrn; Tue, 10 Dec 2024 12:51:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXqYVlC/TPEOsVz1O3Bylr1RNVZQBDtuboG1CV8LxnABOuf2PmaGERxRZ0BY/yfMscupV1Zrg==@linaro.org X-Google-Smtp-Source: AGHT+IHkXi5C3IKeK95VG7x5VekAEay+hHB7PRZld/8DCP4OBdnLAQNp2Gna8yuu4fI9zNneDtFr X-Received: by 2002:ad4:5c6b:0:b0:6d8:a591:fb8 with SMTP id 6a1803df08f44-6d934bc735fmr6803216d6.37.1733863875459; Tue, 10 Dec 2024 12:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733863875; cv=none; d=google.com; s=arc-20240605; b=F7nRQHH6b/zU+x5Imr1ld7e2QGJzo4UrYk+IKfziKQ4fgJrWfX5BK304mTZoE24P4F k4U/HXRKu1CM2OHV0H0XIpZIaSvbP2jAUTHo6kq5r5f1we10utzbOhm3oqTHBTuscklQ q2ZIhAsiBovXhyHpPiQ/tTAnsz6OyKL0wTv1rXOT63N4rm8Efa9MMaSIplOInZ8s6cOX 8tHIkn6r7ZA1NrYRcXrkv/ZfMKrpXdyQs6juX2G0sqAPRJD5mxn6/7gOCa6NOsronk4F zGhFUKkrf1Hz8BDG73EPRvWcJvMAAyVc1TWMx8s5/TQaZ6+VnOaSfasAOJG5PqsTcDma /Ebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8zpB1ID89GrvPttzETXvX6+8YD37TqJ7koaKt36/QMg=; fh=FC288pp5j0mnGELUTZ0Lqjt/J7y8NvB/BPvTKfRC7hs=; b=X4rOvaqdgKB6PEJclnHkYEfB2PjtEvCyzHMIw0wb0hMDrsGOisq2+KzWCWTarDmI/Q IcWSWP2UFQ2VZvJCmjcCN4r51N2zQN9k5I2nAH+Yp6UVD9Wgt/UunNhAuO7NUYLM6fOk P75mEy/cxWLHgFY8s1/3vDoyPmg3rQrPAOgKH9qpl7dU9X4eJrBo6p7O+BgluzW9BCBG zjezXLuO46W1re1H7NqVo7aAjsBTdO5rAUpx7F1LPrhjwipatJtZA6csdUELlogbfMws ot8ogVBZGnP2xwgA63+NgBQHQ7VPr20Wkt6k43t9H35iUUFEw54jXgx2didGj5TWnFdt xhuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=atDuuNMG; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d8dac478d7si150510216d6.555.2024.12.10.12.51.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Dec 2024 12:51:15 -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=atDuuNMG; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL7C5-0004ev-MQ; Tue, 10 Dec 2024 15:50:59 -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 1tL7Bp-0003o4-TH for qemu-devel@nongnu.org; Tue, 10 Dec 2024 15:50:42 -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 1tL7Bm-00036l-Sa for qemu-devel@nongnu.org; Tue, 10 Dec 2024 15:50:41 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-434fe0a8cceso19789305e9.1 for ; Tue, 10 Dec 2024 12:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733863837; x=1734468637; 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=8zpB1ID89GrvPttzETXvX6+8YD37TqJ7koaKt36/QMg=; b=atDuuNMGw6vq7t5gLgia0E0cUJd+hSFGhK/BKG1EroUKmOaotw6WG9uCJ5kZQTTx7N a+4d0w3E5H6UyMSLJBWM+kLodNVG3uTAPdXIf+avvGpx6OFoDWsnLCrzxOu41c59joGa jRZ1Tpge+Wql03Cun6r3bOMRCoKTZjGtdH2+4+14yqjmZJqnqnuTyst9kWV3iFWI7bsH 0c73oSw7S+hARwd9sgMEqfJoZJ9fnrmtFtMONuIqn1ywDUNaVyN45Z3V0Gwll5NgbAlM 3bcQuTfGSrCCsaa6FxNQ1Lf6Os2z6RzrDm3orZg6E31j7RdnoeF4T8XL0Szj2v6t44Zj L92Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733863837; x=1734468637; 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=8zpB1ID89GrvPttzETXvX6+8YD37TqJ7koaKt36/QMg=; b=nFkTSPYQMvzd0J1/wTZqKOjK7O5M5e65zdK7qAUWBgPw9JlcE33z9QO5RflUN6Vb0+ gShCpsi0So2ETeP7GGI3Z4+NaX/SwiPQjM3DYZlp1gCYTiHSBj/CH08l/clEJe7IqcSO 5i9YtoLXZuopTAVN17p8lmgOpBI9q/6G81MnIf00elZaZROXj1UQvr3EXJVtAbNMGR0O LqswRu5v7jOOxYc/n681TL41nAimTrM9Ze/+uwZwF118LPjgJ2+imPopah9lS1LXbevq Xf2GrGoS4ECUZbalZFHtRl4/nhhZsyMO3XUY88YI/jIaTHjr/97GmS3x8r6CUmUbfft0 K5nQ== X-Gm-Message-State: AOJu0YyQvCtN45gariCILQ/BZU5MmdyiLt5besL8g29WFhs065YQ4/np GxeCAs7bsHhk1KWodIT3wLcg7rvi1RfHspw69tehiV4fncmgzi6jw2ttdGi/FPQ= X-Gm-Gg: ASbGncuOWSQZsEevLy0qEgh2c/gjTI4jsc0PCaQpgjrjv3bum99uAXMWFnDkNlKggY1 wa2bOtGlKPSKht1BBohrzMXYN6c/HLrr+qpX1bvf9SKAN5iDTir+d4fo+hbSiZaQvWhfeTBxGmZ +GPbXv9QvEuEL125kZQ98DHNf9H5h2/zqYKtNbeaD0AuDE4E7C6j+A97zGh0UGIi+CRXGlW8mx7 Z3Je5XEaytJCGS9pPo5pYpZDcYI67aveFcAjN7XVPy8sOxubsmW X-Received: by 2002:a05:600c:3151:b0:435:1b:65ee with SMTP id 5b1f17b1804b1-4361c42c81fmr1674215e9.24.1733863837032; Tue, 10 Dec 2024 12:50:37 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434ef283e87sm127814445e9.39.2024.12.10.12.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 12:50:35 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D2146604EC; Tue, 10 Dec 2024 20:43:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , qemu-s390x@nongnu.org, Halil Pasic , Jiaxun Yang , Weiwei Li , Liu Zhiwei , Cleber Rosa , Palmer Dabbelt , Leif Lindholm , Eric Farman , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , John Snow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Harsh Prateek Bora , Aurelien Jarno , Paolo Bonzini , Joel Stanley , Bernhard Beschow , qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, Daniel Henrique Barboza , Thomas Huth , Laurent Vivier , qemu-arm@nongnu.org, Wainer dos Santos Moschetta , Fabiano Rosas , Markus Armbruster , Bin Meng , Pavel Dovgalyuk , Marcel Apfelbaum , Richard Henderson , Marcin Juszkiewicz , Christian Borntraeger , Beraldo Leal , Peter Maydell , Radoslaw Biernacki , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= , Nicholas Piggin , Mark Cave-Ayland , "Michael S. Tsirkin" , Alistair Francis Subject: [PATCH 17/20] tests/qtest: move clock_steps to after checks Date: Tue, 10 Dec 2024 20:43:46 +0000 Message-Id: <20241210204349.723590-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210204349.723590-1-alex.bennee@linaro.org> References: <20241210204349.723590-1-alex.bennee@linaro.org> MIME-Version: 1.0 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 autolearn=unavailable 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 the qtest environment time will not step forward if the system is paused (timers disabled) or we have no timer events to fire. As a result VirtIO events are responded to directly and we don't need to step time forward. Potentially the clock_step calls could be removed all together but as we may implement async behaviour later lets just move them to after the principle check for now. Future qtest patches will assert that time actually changes with a step is requested. Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Reviewed-by: Fabiano Rosas --- tests/qtest/libqos/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c index a21b6eee9c..64682e66b8 100644 --- a/tests/qtest/libqos/virtio.c +++ b/tests/qtest/libqos/virtio.c @@ -170,10 +170,10 @@ void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d, gint64 start_time = g_get_monotonic_time(); for (;;) { - qtest_clock_step(qts, 100); if (d->bus->get_queue_isr_status(d, vq)) { return; } + qtest_clock_step(qts, 100); g_assert(g_get_monotonic_time() - start_time <= timeout_us); } } @@ -192,8 +192,8 @@ uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts, QVirtioDevice *d, uint8_t val; while ((val = qtest_readb(qts, addr)) == 0xff) { - qtest_clock_step(qts, 100); g_assert(!d->bus->get_queue_isr_status(d, vq)); + qtest_clock_step(qts, 100); g_assert(g_get_monotonic_time() - start_time <= timeout_us); } return val; @@ -219,7 +219,6 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDevice *d, for (;;) { uint32_t got_desc_idx; - qtest_clock_step(qts, 100); if (d->bus->get_queue_isr_status(d, vq) && qvirtqueue_get_buf(qts, vq, &got_desc_idx, len)) { @@ -227,6 +226,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDevice *d, return; } + qtest_clock_step(qts, 100); g_assert(g_get_monotonic_time() - start_time <= timeout_us); } }