Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3702174pxb; Mon, 24 Jan 2022 15:48:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQGtoHl2Sit9P7IUQtLrjl0iaTQFCXkjFpgJilyLiiSMwvnwhWPlVPRIu5l9tMRuKZt3Kf X-Received: by 2002:a17:90a:b791:: with SMTP id m17mr692599pjr.239.1643068085941; Mon, 24 Jan 2022 15:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068085; cv=none; d=google.com; s=arc-20160816; b=gVrAeqCG3BlkWRtUtWuNq63xfY/+ASMAAUSjl6YdfXDll3egyaNVxHVOH+175YQumk w+3ZubyPFJG4T57MEOLVd/k/N3oMf7eCRI2amCIej+k27VV62//PthVCSrV6RFGCGu9P CmPjnVcNDSKTItHuCUdMo26simBehxVugeKpnaxdkMAiU6ArM2B+728fE/vU77DBOaVk DDyWBDqjkUdJONupYwFCpMdB5+576mXwUV2judxeOkQi8fNzPdIr9hR47i6eiPmwVdNn bGRdYwx8yMmpeUoQ9KcDArZ/ZzqsQ4wjOFthAAHniflh02OPWxWOOMKKPR1zPaYTrYjH D55w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dn2RZ6wjrP7xyVWLnOy99pqWkvA40gm/J22EzGWKAWI=; b=pRgKcMRhW8NLcQlPNV7KmcWX1e5diqw+Aze9w4Rdxwj0lPJyZYhCmO3Km7bS+/1qXy 70RqMi8uq8N4zx6/f9LVR0CevqH43D6VC2mAZ8DkWHKTxTacyZiyseglP0C9Rmy4qLxi Aoofv/7mq2kJP02EYgjUC7Fe8ug9GjWJM25rp7WKDoKSa3LzcFRU0racTwt7TIXzjgGL zHC4ZzVDMIlfxrTkjNVKvz3J57DW67xA9EGcs3D0RFygwDMYyLF13lM6rKpGpsi82Cmt ab6fnDHEqQssZ7lxhc5rCY8IfOFCib5WjHZY7lwb8QaZ+wWFcBwy1/9kJumxc6I1d/ZK 6tOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=weFOZsnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b32si15159942pgm.146.2022.01.24.15.47.54; Mon, 24 Jan 2022 15:48:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=weFOZsnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2361831AbiAXXlB (ORCPT + 99 others); Mon, 24 Jan 2022 18:41:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841065AbiAXW5a (ORCPT ); Mon, 24 Jan 2022 17:57:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BC77C055ABC; Mon, 24 Jan 2022 13:11:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4E80B80FA1; Mon, 24 Jan 2022 21:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF70C340E5; Mon, 24 Jan 2022 21:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058699; bh=Sg3S3kOi4mnZWSbiDwAh4Yx1tel3YqVXV3twfkoYhCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=weFOZsnREhwfgzXBXPrv7aMj61kRjFHkEPLKH2h6jXl0G5vjkoJS7mW1X8b9RMsY7 BPR/y37a8nuTU8G2Cmaj7m/rv/IcMEMibaiGb+GpErIqtUQ7dkwgX0QSgDmjgdmY94 y9hNaP7ecURwW8qleK7z5GVfe2+/W/ZeJqFlHmrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Richard Weinberger , Sasha Levin Subject: [PATCH 5.16 0341/1039] um: virtio_uml: Fix time-travel external time propagation Date: Mon, 24 Jan 2022 19:35:30 +0100 Message-Id: <20220124184136.768068556@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 85e73968a040c642fd38f6cba5b73b61f5d0f052 ] When creating an external event, the current time needs to be propagated to other participants of a simulation. This is done in the places here where we kick a virtq etc. However, it must be done for _all_ external events, and that includes making the initial socket connection and later closing it. Call time_travel_propagate_time() to do this before making or closing the socket connection. Apparently, at least for the initial connection creation, due to the remote side in my use cases using microseconds (rather than nanoseconds), this wasn't a problem yet; only started failing between 5.14-rc1 and 5.15-rc1 (didn't test others much), or possibly depending on the configuration, where more delays happen before the virtio devices are initialized. Fixes: 88ce64249233 ("um: Implement time-travel=ext") Signed-off-by: Johannes Berg Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/drivers/virtio_uml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index d51e445df7976..7755cb4ff9fc6 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -1090,6 +1090,8 @@ static void virtio_uml_release_dev(struct device *d) container_of(d, struct virtio_device, dev); struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev); + time_travel_propagate_time(); + /* might not have been opened due to not negotiating the feature */ if (vu_dev->req_fd >= 0) { um_free_irq(vu_dev->irq, vu_dev); @@ -1136,6 +1138,8 @@ static int virtio_uml_probe(struct platform_device *pdev) vu_dev->pdev = pdev; vu_dev->req_fd = -1; + time_travel_propagate_time(); + do { rc = os_connect_socket(pdata->socket_path); } while (rc == -EINTR); -- 2.34.1