From patchwork Tue Aug 13 20:23:25 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: 818864 Delivered-To: patch@linaro.org Received: by 2002:adf:cd01:0:b0:367:895a:4699 with SMTP id w1csp432190wrm; Tue, 13 Aug 2024 13:31:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVryOtdPAfvWqMY89ui5axUK6v+hbA1G6iWZ/vd62RlaPwGio2LvCCKlk4WKL4Y0nnVz2WTS+W4d3ICgwBiQDqV X-Google-Smtp-Source: AGHT+IE3TlfTp1fVGpJPs0t9M9vp6MaxLsaU7AHS+NGZR4CyQVkyt+O/GwxZwqrYLrRMMF/j/8DD X-Received: by 2002:a5d:4bc4:0:b0:367:f05a:8f6c with SMTP id ffacd0b85a97d-37177825e35mr429615f8f.57.1723581092300; Tue, 13 Aug 2024 13:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723581092; cv=none; d=google.com; s=arc-20160816; b=eG1nwgYlavybEGIORoCiowlqiepKNjDWg4DDMfp0WodnpqG7rRT33MwN1bEjl2TteZ VI+3w+6CcbqaG5dOmtDMuhzhKDkl3NatvnoTvc3Vab8bo8GVYXel2ygJdjL7sTNkrxY8 pSJf1pANYYrzbOQ3PKGYyzzAMyq4Shhe03bKCKIt4zRwRsYJ4K8DXl4sr6XHC46EGowI 7nyh50vm2RJU5+7dBBH1zGnqcjCs4bs5X6uIcOJU8yPwHpPp9cO6lbv26AP/37RvH6I5 vewKj0mXGbWs6aC/OELyVSa1JjQC9P5KNlOIocVQpnDTW/4PrQ1XsIhvi7h9IiFkd6B/ kJ1w== 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=h8VJVqwOU+3OnI+KhTAsjide89+CrsOHDPq/j9RwzJ8=; fh=2Uj2tGQCTXopsDH26iMBTwdsgctwEBjqGya0Hcf7oYs=; b=F494e8tnfgn961WPGjO9fanKOi4Z7l/2vCL5dqxBVCkqlIFUp49lvESd5+K2kR2cXK cdqDrqw1h+VUvccNe2onqOEnKzULkpetRHj03IB0eSzFOFHGYuTPeRjlZbvqqPcmFZyS Cwua/4O9BtBU1MGtUL/4dKRg6ppao093sOj1aRimVN7IfcuQzin31y2TPmjL3jwCzIrv sX0MDp4FY36ls9BIejgknAudRlN0tlH5IY1G9LrGWl+xNF0urIXPi3JzICoDMRQJI2/b sRVATdMkNdqogDRPgqEC96iiVVJXaD+IHbVXEhdapvZ+n5faOXFrsCmNJVatcvosCc62 VWzQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4jddG6P; 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 ffacd0b85a97d-36e720b3a47si4295434f8f.301.2024.08.13.13.31.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Aug 2024 13:31: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=B4jddG6P; 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 1sdy9y-000813-0q; Tue, 13 Aug 2024 16:30:26 -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 1sdy9t-0007rF-UC for qemu-devel@nongnu.org; Tue, 13 Aug 2024 16:30:21 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdy9o-0007hF-05 for qemu-devel@nongnu.org; Tue, 13 Aug 2024 16:30:20 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5af6a1afa63so6927491a12.0 for ; Tue, 13 Aug 2024 13:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723581009; x=1724185809; 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=h8VJVqwOU+3OnI+KhTAsjide89+CrsOHDPq/j9RwzJ8=; b=B4jddG6PtgQVd/JlRN2Dn7Dy97dgxuHR32ymDUrNpiOAgog27C186v7MMS76wpdNdi iiCPa3akNprKBIVs8XySt0Ryri3mM5yeyjVQtOf2BVruPjg+Qf11B4X5itzVKcyowMJv gc7LaEQLYiEhdWDF6B+58KMZduusE/HPHnG5/sz3mkFTAGr4uCBPDeHxg3RyDlwuOMNy jZxXLQdccXhIH8asVKww6TPJFSZZ8LgneHPW+kCIWRBJEQOQyn3RVrmtUiMEtw/vDiVF lHcZ3F9WMTh8+H9/l5f0xI26DL0fDQ6vahjMWd+tGNec0svFqDe5CuIJV2B9E4P1kvny m2AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723581009; x=1724185809; 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=h8VJVqwOU+3OnI+KhTAsjide89+CrsOHDPq/j9RwzJ8=; b=BsY2qr9wXCU6rdfqG3ugKUv0yFp4xIBmRIxAMkn1FbHUfQhMI7n1hLRpQGfkdEYXQ0 WO4Gk5G3h81sv6U8TDfynO+3slC0nhMDvegVmtf6nJ3C21NqhiyuHhEFw82BRwdHEH6Q bnhRwlYjS3UPKEtKxp8VB/aeWKWMA06RvBB8EWeZlrMzth+O4ooyK0t3vx4FvTekSmPL ci+odM5WH4cITTU/WxtjdLXjGATMljhk1/tt+Qggc2BHyaqxINvLCYCmWm9ZJVE0Cpm0 FzfSDitmDY+dMIimfGR6rvv0jo439QOBXSl4fehS5BidD0OvUta4YmeWZDFast6mYySs jg+A== X-Gm-Message-State: AOJu0YwRTfzQzBWTZxwHVIVaeZOL4VpjaqqMEnEqDtQ6H6AXfKUUBCan oF6IngySi8/kswyFpPDCcRMQ5e3CdZZej397n8LSAoHCBn8MfH8mw/WCyd/+yu4= X-Received: by 2002:a17:907:f704:b0:a72:80b8:ba64 with SMTP id a640c23a62f3a-a8366d552ccmr40115966b.25.1723581009064; Tue, 13 Aug 2024 13:30:09 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a80f3f48ed5sm96719366b.29.2024.08.13.13.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 13:30:08 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0D7465F8BB; Tue, 13 Aug 2024 21:23:31 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alistair Francis , Michael Roth , Palmer Dabbelt , Mahmoud Mandour , Pavel Dovgalyuk , Yoshinori Sato , Weiwei Li , Eduardo Habkost , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Markus Armbruster , David Hildenbrand , Beraldo Leal , Liu Zhiwei , Eric Auger , Song Gao , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, Peter Xu , Jiri Pirko , Eric Blake , Fabiano Rosas , qemu-s390x@nongnu.org, Peter Maydell , "Michael S. Tsirkin" , Daniel Henrique Barboza , John Snow , Alexandre Iooss , Konstantin Kostiuk , Pierrick Bouvier , Cleber Rosa , Ilya Leoshkevich , qemu-riscv@nongnu.org, Thomas Huth , Paolo Bonzini , Richard Henderson , Jason Wang , Bin Meng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Nicholas Piggin Subject: [PATCH v2 17/21] virtio-net: Use virtual time for RSC timers Date: Tue, 13 Aug 2024 21:23:25 +0100 Message-Id: <20240813202329.1237572-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240813202329.1237572-1-alex.bennee@linaro.org> References: <20240813202329.1237572-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x536.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=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 From: Nicholas Piggin Receive coalescing is visible to the target machine, so its timers should use virtual time like other timers in virtio-net, to be compatible with record-replay. Signed-off-by: Nicholas Piggin Message-Id: <20240813050638.446172-10-npiggin@gmail.com> Signed-off-by: Alex Bennée Acked-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 10ebaae5e2..ed33a32877 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2124,7 +2124,7 @@ static void virtio_net_rsc_purge(void *opq) chain->stat.timer++; if (!QTAILQ_EMPTY(&chain->buffers)) { timer_mod(chain->drain_timer, - qemu_clock_get_ns(QEMU_CLOCK_HOST) + chain->n->rsc_timeout); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + chain->n->rsc_timeout); } } @@ -2360,7 +2360,7 @@ static size_t virtio_net_rsc_do_coalesce(VirtioNetRscChain *chain, chain->stat.empty_cache++; virtio_net_rsc_cache_buf(chain, nc, buf, size); timer_mod(chain->drain_timer, - qemu_clock_get_ns(QEMU_CLOCK_HOST) + chain->n->rsc_timeout); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + chain->n->rsc_timeout); return size; } @@ -2598,7 +2598,7 @@ static VirtioNetRscChain *virtio_net_rsc_lookup_chain(VirtIONet *n, chain->max_payload = VIRTIO_NET_MAX_IP6_PAYLOAD; chain->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; } - chain->drain_timer = timer_new_ns(QEMU_CLOCK_HOST, + chain->drain_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, virtio_net_rsc_purge, chain); memset(&chain->stat, 0, sizeof(chain->stat));