From patchwork Thu May 16 22:20:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 797266 Delivered-To: patch@linaro.org Received: by 2002:adf:e68e:0:b0:351:d90a:5487 with SMTP id r14csp500951wrm; Thu, 16 May 2024 15:21:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnUAUQUlGPeXXXVL0hqR9xU+PUfpBhL0nqK4dvy9fzu153WoejMYpBIQ56FjOC8LbA4TuZVgd5e+2NtjroE5fa X-Google-Smtp-Source: AGHT+IFfdRIwMCNaioQxgxa5VDldTKCJUxcZ/QJVMsG/ZViqBJtV1a9oyYuoxy6N2l71qsEY1+BI X-Received: by 2002:a05:620a:2a08:b0:793:c53:8ee5 with SMTP id af79cd13be357-7930c539303mr347238585a.26.1715898112295; Thu, 16 May 2024 15:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715898112; cv=none; d=google.com; s=arc-20160816; b=x7xTOKVJT7kmaKkGKicpMlufB9LX9jorJle/+BZvseth/CODRY4HuE2Ay2d4PEHeuZ VkSRTfVOO8FBE4sJ+BUhV5KiiKPHs8OgHAksBLRpixFTCJ3CjvstEBeudnOKwBvSSrZ5 Jey9qykM5gCfZKP5U2siz+OvR1eoetP+7Iz6IF7YzcGYM/DC8bK9a4iOBFQpl0Nj0PTN 5nuvJf7GnbceBWN/MuaA020gEKq+jzZE9sHA0eR8hXeQ/EX3Ug8zeTNmYg5fdLNUA1N0 HkUoi9BAB+D0kAtLjbBdo3hjwRcsEfT1ofRu1yGGTF+O890XHPv0DqSmt7s+F4L6dt/D ZoIQ== 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=K9/6iNsaG2WmKJUo8RO+PQUPavM6bWCYZObihw+51LY=; fh=dnKm9ic91IyE2znXvQafF3QZhC6YRQTIuif9qSthU6U=; b=tg+4+344Ex9KcUOieMWmR2wZVGKQilKxBYFmy77rIPI7lbPLB7MctIESFeCG0t9N/j BqGEZ5jL0XAt3jw3GKcsY8yMDZKvMnNPO2bkTe/HrkvireCr6btIY3reu2uUh78CqhSC RADTHxvWQd7l87xeAiIv8t5hPKGRX1S/mKX3zhUAIzgEariPCucGHbaL36NR2gRPHxee M0Sz5r9+ChWfdi+AVrq0kKm1PGODIOY9CI0k87wIFdCzO11bGe17G+XzasNuxeUuanWR J3kSC44iP4uhuD9IymcOTRT6oLBF/5FMmDtOdKRTU/dazfwtPmZ66CwWorHLhMFUiLzt HLtg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bM1XhnVZ; 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-79301186c5esi377830485a.731.2024.05.16.15.21.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2024 15:21:52 -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=bM1XhnVZ; 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 1s7jTV-0006m8-Ex; Thu, 16 May 2024 18:21: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 1s7jTK-0006bs-90 for qemu-devel@nongnu.org; Thu, 16 May 2024 18:21:13 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7jTH-0003Bd-Lp for qemu-devel@nongnu.org; Thu, 16 May 2024 18:21:09 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6f4302187c0so539314b3a.1 for ; Thu, 16 May 2024 15:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715898065; x=1716502865; 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=K9/6iNsaG2WmKJUo8RO+PQUPavM6bWCYZObihw+51LY=; b=bM1XhnVZMu4DzAv3fuvdrU6BxX3bDE3KRJNkpJRkH0CH+xfcEjaXnxzu2RXljndi+v bhYbel0LFlrJDaFWejvhEL+eyE2Tmv6os3k3lbb3yOFVUgT/H6Nd7xI0cRK+wb+1SK+c VUDKxqh3Fhm5GPvNn7cf5ZMlXBrhU/apv1U1ONn30XlJ1EsLjRiOQomJ3yvrD/uRlFoD OV+e0DIQCb9K+r3xlgzU1yuau9szazxm2vJt0R977LiQVPa/0Gn+0b7Do5xeM4wgkwL3 VyB0ikUvrg6JOzmVCNRhhkakuWaW+oJjOI44RbRV4GW/la7VQei/c0TnBEDHGeS753xQ 3Xcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715898065; x=1716502865; 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=K9/6iNsaG2WmKJUo8RO+PQUPavM6bWCYZObihw+51LY=; b=GcIAToTlQaIVzc/MgjOxQvt4qR9VEYYH3p0S6ocq0IJQeRq6M0AG2LBf0L694LlXxl gAfVO/Ohz7H8qrJlE0hrBnumeDcddyoxNbLFl/vM/NeylnGs1ykZr23nCrHd1Z3CCc0Q n9K9TCLhM6PKm2abPrct83hMsdHeprLivlz0SADyS0/QjbVnldBfC7Bujxx2U8wpwX4o q3DmrRelWVFalk2wVRUs1tmjnwjtFrBYQ3dxM6JNragtVujLDlVqbT6ZKfdSXiBPc8FV jAeRfZ9QwxVKv9qa2+paLqgXhZbgUSUFs6gz8Ear523OploQX0oheCAYNoIWd9JTz7PA K9xA== X-Gm-Message-State: AOJu0YwIq60eVXnbM8f/LwlgrEeALqwfZlt37vQzynesccz0qswq70Tb 8Hvw00naltA2vH5y+lvIFmf8Fv1eqKZieb1JaWznDddpONzrZT+o5JOTim5p2q0VQTmIflEu5+z j148= X-Received: by 2002:a05:6a20:914f:b0:1a8:2cd1:e493 with SMTP id adf61e73a8af0-1afde1c576amr30444273637.29.1715898065079; Thu, 16 May 2024 15:21:05 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::e697]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a66476sm13589219b3a.28.2024.05.16.15.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 15:21:04 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Thomas Huth , Laurent Vivier , Mahmoud Mandour , =?utf-8?q?Alex_Benn=C3=A9e?= , Alexandre Iooss , Richard Henderson , Pierrick Bouvier , Paolo Bonzini Subject: [PATCH 2/5] qtest: use cpu interface in qtest_clock_warp Date: Thu, 16 May 2024 15:20:44 -0700 Message-Id: <20240516222047.1853459-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240516222047.1853459-1-pierrick.bouvier@linaro.org> References: <20240516222047.1853459-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x432.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 From: Alex Bennée 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 Signed-off-by: Alex Bennée Acked-by: Thomas Huth --- 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 b5d5fd34637..45f3b7e1df5 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 f6056ac8361..53182e6c2ae 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 6da58b3874e..ee8b139e982 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]);