From patchwork Wed Jun 12 15:35:04 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: 803475 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:e87:b0:35b:5a80:51b4 with SMTP id dz7csp852371wrb; Wed, 12 Jun 2024 08:36:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUpwsNjbuWZPnEek6Y7toW6DCe81XLdZU9Zpi8I0br7xT9wzjmfj30z3byGa5MEg1LM73ByzEK8lQFlaplTZJJT X-Google-Smtp-Source: AGHT+IFlk4ROn17VNHlUIXhmoDc+qTma79HTT+lH2FBWdg/jbSud6xxHixGjCBGqZ714wiZKBewR X-Received: by 2002:a05:6830:3112:b0:6f9:90ba:6646 with SMTP id 46e09a7af769-6fa1c22e8c0mr2541514a34.26.1718206592222; Wed, 12 Jun 2024 08:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718206592; cv=none; d=google.com; s=arc-20160816; b=Lor598pVUc8Qv84gJOCIhUsSexlRsork0bQ3o+Gb5EZ1MH0CaSAbPYOTIBdbGvIy1S hB9Jis0GJ/IThsBvZN2d56mZ8mlRado8Yab44veNCghDqdd1lC+VnbFbP4cwXwpnw905 4iZSj19tVULUjrdeyr+hGm/3DOGlk4UITqvC8ijHdTwicU5VCpyNkRX1Z6Kb27plO09m 5kDuWfjKDo/iRDTNPvcNQ6nVrzC8TJxr9tKvek/1AgziKjDJds1rNK54ulWhfvh6ZUmB 82wwKlRwlSDnVOzToSPpP+NXffbFmiXPJaD0d3QjcnE7sLvRI73AVPk35IpwWzgMyIjw 14cQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bRGnfZngJdWMgOcvZ7TtStbP9AmubDNWr9Hu5lfqXOc=; fh=czkAeDwyirGU0fHfBYIxDl8vJdhA5eGOYVGOtFKrHIY=; b=SodHNFzFt2im6NfT3EKUD8UnTsDNtqumvg6FIX+TaitqgKUdHsuZP7oglGTf5X0EjY 35y8iAi5phumATNmMbvEDVzS3pvOEJCh7RLLXQuW5hBlW9qb6wdn5ynbQ4XyxZZ+x344 jcvK6GhqnT4KlOcQ6CohB6VPKRDj0mYoq0TK+pvD+XAHYwEkagRWagICG+LDXgXSvo6r fNAyKZnSelwLRWgk4N25fT23uH1uZ26EpH6wRNhUSI3D04lwM0lnchMSvCs3NjvZYwnW gIEWjfgscdzyxT8xv40JEUcvW17auJ4YkhjcZXc536mC80fAyFfEgkx8M9vM2/mGL/H5 8EyQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oKvC8Ade; 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 af79cd13be357-7956b8d5f3asi792758385a.526.2024.06.12.08.36.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Jun 2024 08:36:32 -0700 (PDT) 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=oKvC8Ade; 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 1sHQ0P-0000sH-Rc; Wed, 12 Jun 2024 11:35:21 -0400 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 1sHQ0N-0000kF-EJ for qemu-devel@nongnu.org; Wed, 12 Jun 2024 11:35:19 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHQ0H-0004Kc-OT for qemu-devel@nongnu.org; Wed, 12 Jun 2024 11:35:19 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-57ca578ce8dso1811451a12.2 for ; Wed, 12 Jun 2024 08:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718206512; x=1718811312; 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=bRGnfZngJdWMgOcvZ7TtStbP9AmubDNWr9Hu5lfqXOc=; b=oKvC8AdeLmiC8PTVtve2tjctTToR307gknJFJBqaOEnvyGRFaTqhcGg54pW5wHoIYI 90GSWpteZaRcqqxYNimPd0CWc4+ncNibjv3CUL/E3r3XXWRzuTSZABIDg54i0mRLcriy L92cRBTw8jxm/VizS+patrYN0q5Lm45MPplsba4Cl/yHSnJMCfG+BjD2w5xNyHUCo+dI jOrzL8R6574XtzZZW0IGnNzXIK/1FJd6gk+MN/JDaI4mlYpE6XKjN81TR9K/SpfxIjAG /3jhKjyW8rGCaMK/v1r7sDwz/PsVhGD9KDvYqZCdWY+tUcGzSQIRFy1FobWhAEKSgZuT 2IZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718206512; x=1718811312; 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=bRGnfZngJdWMgOcvZ7TtStbP9AmubDNWr9Hu5lfqXOc=; b=I0CPlcd/O65plRU5bXPOPJB7hdpnz6efK6NSz1//kvnZ9yooHnEzunxdpYZPJREFLH GS/c4wHDTYoaGkX9hoQTVbp6QMj5KtGkyW7Nkq0JKqA6X5+4yjO1wDzAw/tAlZDoCYfb EAZTyHMxRrjPhAQGwh1hMpt3txoYbiVb/5+DpdqF4p4r+xzybz71W8G7F3b95DQN1U8Z A4ij+2eh9krxu1F9Sz+r69TM8KPhFUwhyBCWHl71pNqBOfR8IfGIm5lB8GCULf+ylu2w xp7XXJIe7taEVIxRasdtTtQ8islm2Oyxh0dzLNWWsCs5M7t1HuctucloegAnncXscrXo VJHQ== X-Gm-Message-State: AOJu0Yz+Bka+0iQcRAK+IfSh4hwjntpTI4Rhm6Wa7qnuClonBw1g2pKO nMSNGX8kdyxYIbkjTQ5cYlCVOJiLoNHLoVbGL12gQsXQiInX8jeyfEH4YvyQGjg= X-Received: by 2002:a50:aac8:0:b0:579:e6d1:d38b with SMTP id 4fb4d7f45d1cf-57ca97562b0mr1891081a12.2.1718206512236; Wed, 12 Jun 2024 08:35:12 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57ca472956bsm1950484a12.29.2024.06.12.08.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 08:35:11 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id ABA8F5F944; Wed, 12 Jun 2024 16:35:08 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Ilya Leoshkevich , Daniel Henrique Barboza , Marcelo Tosatti , Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Mark Burton , qemu-s390x@nongnu.org, Peter Maydell , kvm@vger.kernel.org, Laurent Vivier , Halil Pasic , Christian Borntraeger , Alexandre Iooss , qemu-arm@nongnu.org, Alexander Graf , Nicholas Piggin , =?utf-8?q?Alex_Benn=C3=A9e?= , Marco Liebel , Thomas Huth , Roman Bolshakov , qemu-ppc@nongnu.org, Mahmoud Mandour , Cameron Esfahani , Jamie Iles , "Dr. David Alan Gilbert" , Richard Henderson Subject: [PATCH 5/9] qtest: use cpu interface in qtest_clock_warp Date: Wed, 12 Jun 2024 16:35:04 +0100 Message-Id: <20240612153508.1532940-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240612153508.1532940-1-alex.bennee@linaro.org> References: <20240612153508.1532940-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52e.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This generalises the qtest_clock_warp code to use the AccelOps handlers for updating its own sense of time. This will make the next patch which moves the warp code closer to pure code motion. From: Alex Bennée Acked-by: Thomas Huth Signed-off-by: Pierrick Bouvier Signed-off-by: Alex Bennée Message-Id: <20240530220610.1245424-3-pierrick.bouvier@linaro.org> --- include/sysemu/qtest.h | 1 + accel/qtest/qtest.c | 1 + system/qtest.c | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index b5d5fd3463..45f3b7e1df 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -36,6 +36,7 @@ void qtest_server_set_send_handler(void (*send)(void *, const char *), void qtest_server_inproc_recv(void *opaque, const char *buf); int64_t qtest_get_virtual_clock(void); +void qtest_set_virtual_clock(int64_t count); #endif #endif diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index f6056ac836..53182e6c2a 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -52,6 +52,7 @@ static void qtest_accel_ops_class_init(ObjectClass *oc, void *data) ops->create_vcpu_thread = dummy_start_vcpu_thread; ops->get_virtual_clock = qtest_get_virtual_clock; + ops->set_virtual_clock = qtest_set_virtual_clock; }; static const TypeInfo qtest_accel_ops_type = { diff --git a/system/qtest.c b/system/qtest.c index 507a358f3b..5be66b0140 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -332,14 +332,14 @@ int64_t qtest_get_virtual_clock(void) return qatomic_read_i64(&qtest_clock_counter); } -static void qtest_set_virtual_clock(int64_t count) +void qtest_set_virtual_clock(int64_t count) { qatomic_set_i64(&qtest_clock_counter, count); } static void qtest_clock_warp(int64_t dest) { - int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + int64_t clock = cpus_get_virtual_clock(); AioContext *aio_context; assert(qtest_enabled()); aio_context = qemu_get_aio_context(); @@ -348,7 +348,7 @@ static void qtest_clock_warp(int64_t dest) QEMU_TIMER_ATTR_ALL); int64_t warp = qemu_soonest_timeout(dest - clock, deadline); - qtest_set_virtual_clock(qtest_get_virtual_clock() + warp); + cpus_set_virtual_clock(cpus_get_virtual_clock() + warp); qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]);