From patchwork Fri Nov 3 16:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Hfnjaplz; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=N9B3A9xj; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=pZj4yqX5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP24bhdz1yR6 for ; Sat, 4 Nov 2023 03:42:30 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SI/L3YRsAFjFOIz4KKk9sDKzSuaUcBho6ELXxHyPlwo=; b=HfnjaplzykRHF0 sYaOeG7jUesHp3f3K7qFbbrqlAK897Lq2r+f90fTwyS7qpBTUHt96Tva0QMoe76+Obd/FccyctJz5 9c0s04GrT7SOrMJLuTnkdQPltyYFsm85+FXzXOBtxfe966t9LAq3RhZ2T4snZR7CQ7QlS97JtGRrG vAFM+zqiKsUrhBMt3wvPXaIuuX5X3FMEo8C5Ba20Bx70QV4EbUPHv0zRQtLWc6A9l6RLp+cOtgEtg 7SoPQAm/uZUSp5Zm4KebxJdO6FUN1kaXKJ4Vj4raErK9HFCgjf6zYb+42ME5z0a8fkv7eupTgxBp4 O28ZvNYMhU5q1QXLXJgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFT-00Bnmr-25; Fri, 03 Nov 2023 16:42:19 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFJ-00BnjT-0i for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:17 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:00 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029720; bh=ku+pdHS1hzhBCoEm1LjBMLTCo9rq1iiLqvDYat5exh0=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= N9B3A9xjQU8i+rs7agFNlK2lPp88QgpNQ97wccSpjQvCpPHYqZCh/zMDwKurumC0iV/NNHDWtSGC25XxJmPyBw== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029720; bh=ku+pdHS1hzhBCoEm1LjBMLTCo9rq1iiLqvDYat5exh0=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= pZj4yqX59sdCmb2rRo7u31NhbBc/2rc6YlmByaDrIjC1RHgVOWB78E/7deXN2VubRK2mpd6esRvdrD4Mka/QmoyyZzLgkqH/DRYQKQNaIqlv42f/EPFlpKCwJ8IWdRLZ+xBh8NOpPtO5dZzNrxMtMjXEiX/nxCQTPNcnhbqdCpk= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:56 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:39 +0000 Subject: [PATCH RFC 01/11] um: Make UBD requests synchronous in TT ext/infcpu mode MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-1-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=4067; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=mHSC/EGIqAsNU/257dn5ioekUbBHZoYRsc6T5DoJHuA=; b=CnLAeGUOFYidPJ1tueSdtk8Bppb9fEbPOtnz8VnS2H7Sb7ysi1TminCft0G5Y5LLCJiHBTeeB aalx58/SM9pC6SsE5gGoevuC6PELZnGWKhXNjxIy9Lso4KTLRsKeIAW X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 52108EC476349399D14442841CF80F1F0342D8ADC61B484C816BD26B5AB0817C2000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094210_124290_5F9E9408 X-CRM114-Status: GOOD ( 16.13 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The UBD driver employs multiple threads to enhance block device accesses in userspace. These threads communicate via pipes and are triggered by interrupts that utilize the SIGIO handler. However, in TT mode, both inf-cpu and external modes, this asynchronous, multithreaded request processing lead to issues where requests are not processed. This occurs because there is no dedicated tim [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The UBD driver employs multiple threads to enhance block device accesses in userspace. These threads communicate via pipes and are triggered by interrupts that utilize the SIGIO handler. However, in TT mode, both inf-cpu and external modes, this asynchronous, multithreaded request processing lead to issues where requests are not processed. This occurs because there is no dedicated time travel handler for the UBD interrupt. Since asynchronous, multithreaded request processing does not provide substantial benefits in time travel mode and may even introduce additional overhead (as multiple threads are scheduled sequentially to execute requests in TT mode with infinite CPU power), this patch switches to synchronous request processing directly within the submit_request call for the respective TT modes. Signed-off-by: Benjamin Beichler --- arch/um/drivers/ubd_kern.c | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 50206feac577..cdad289d5032 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -44,6 +44,7 @@ #include "ubd.h" #include #include "cow.h" +#include "timetravel.h" /* Max request size is determined by sector mask - 32K */ #define UBD_MAX_REQUEST (8 * sizeof(long)) @@ -456,6 +457,17 @@ static int bulk_req_safe_read( return n; } +static void finalize_request(struct io_thread_req *io_req) +{ + if ((io_req->error == BLK_STS_NOTSUPP) && + (req_op(io_req->req) == REQ_OP_DISCARD)) { + blk_queue_max_discard_sectors(io_req->req->q, 0); + blk_queue_max_write_zeroes_sectors(io_req->req->q, 0); + } + blk_mq_end_request(io_req->req, io_req->error); + kfree(io_req); +} + /* Called without dev->lock held, and only in interrupt context. */ static void ubd_handler(void) { @@ -479,13 +491,7 @@ static void ubd_handler(void) } for (count = 0; count < n/sizeof(struct io_thread_req *); count++) { struct io_thread_req *io_req = (*irq_req_buffer)[count]; - - if ((io_req->error == BLK_STS_NOTSUPP) && (req_op(io_req->req) == REQ_OP_DISCARD)) { - blk_queue_max_discard_sectors(io_req->req->q, 0); - blk_queue_max_write_zeroes_sectors(io_req->req->q, 0); - } - blk_mq_end_request(io_req->req, io_req->error); - kfree(io_req); + finalize_request(io_req); } } } @@ -1136,6 +1142,17 @@ static int __init ubd_driver_init(void){ /* Letting ubd=sync be like using ubd#s= instead of ubd#= is * enough. So use anyway the io thread. */ } + +#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT + /* do not initialize asynchronous io-thread and corresponding irq + * in inf-cpu or ext time travel, as we need synchronous io logic + */ + + if (time_travel_mode == TT_MODE_INFCPU || + time_travel_mode == TT_MODE_EXTERNAL) + return 0; +#endif + stack = alloc_stack(0, 0); io_pid = start_io_thread(stack + PAGE_SIZE, &thread_fd); if(io_pid < 0){ @@ -1312,8 +1329,11 @@ static struct io_thread_req *ubd_alloc_req(struct ubd *dev, struct request *req, return io_req; } +static void do_io(struct io_thread_req *req, struct io_desc *desc); + static int ubd_submit_request(struct ubd *dev, struct request *req) { + int i; int segs = 0; struct io_thread_req *io_req; int ret; @@ -1334,6 +1354,17 @@ static int ubd_submit_request(struct ubd *dev, struct request *req) if (segs) ubd_map_req(dev, io_req, req); +#ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT + //do the request sychronous (bypass io_thread and ubd_handler) + if (time_travel_mode == TT_MODE_INFCPU || + time_travel_mode == TT_MODE_EXTERNAL) { + for (i = 0; !io_req->error && i < io_req->desc_cnt; i++) + do_io(io_req, &io_req->io_desc[i]); + finalize_request(io_req); + return 0; + } +#endif + ret = os_write_file(thread_fd, &io_req, sizeof(io_req)); if (ret != sizeof(io_req)) { if (ret != -EAGAIN) From patchwork Fri Nov 3 16:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858993 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QnkQB+7W; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=9gi42H4y; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=UiHXq7Mb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP14bP7z1yR4 for ; Sat, 4 Nov 2023 03:42:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5BrqhpkOHV+t+z8TcSbA6vM37g200HCSfb+LULFOjAs=; b=QnkQB+7WbQa7Dy +e7rqVR13zLlLm78FnjJV1PAzNpf8G3qZLoSzOaUCqa8VKr7tzQuJi0gsF9GUihCQ54wg+8odekuN cwUZyChw8vS1l1y3AtXMwbaqxWqimsL3AVupP8RkvVto4h8Z4u9Aa+vrjnxfHDVf4vNYivzKlPHJ/ qqQ70CSNM7gHNEPxOcrgEldY95bO+qKc2W//RpaJlR0fP/EqJCuLo5rP/X6gi1yADxtWkfVOWx15N SQxKB5mKwAipZ0B7ycBp7DNOrDrvqSgDl383zTB/3QzD3g3mIgO86M+ilJhH3L/j4xegyUBk0/A/1 eJ3dOIa27+mB/fZ1JyFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFP-00BnlB-1t; Fri, 03 Nov 2023 16:42:15 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFJ-00BnjU-0a for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:13 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:00 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029720; bh=1ZY7X92pnMnsIY19LFNUSrdcE8xl1BEfH2ls6ywy8nc=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= 9gi42H4yXqwIjbJp3gYPawgL5dLuIjQ/T8WTAoAY1ni3F4qmbKovYlinKKJPopCjd3KTnV2scWkSvE8UB5DEDA== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029720; bh=1ZY7X92pnMnsIY19LFNUSrdcE8xl1BEfH2ls6ywy8nc=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= UiHXq7MbqwvSi5/3CwngT2LJUbw6Dex/4fszw9XOjpjb6IHuwSrCqhOn0fXTNAFHOF2FneBz8OGBg+Vo9vNBSA5LVsg41oyUWcZUZq1EqCr7AUYHN02U678NofUcnrZKk+8xwtO5fkQFYQQUlwQrGvL/05B/TldmnGuMu97JNHQ= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:56 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:40 +0000 Subject: [PATCH RFC 02/11] um: add a simple time_travel_handler implementation MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-2-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=1083; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=AUx+GmuFvsd569qGGE08iczX/VPuDGvsieK9N3BcPA4=; b=kB4o1zawvSPZKbRiyyY/fmBuw6q00voRqvdrfm9fJA0FFPk9ga5kY3C3aBMhybcgJUwnFCA4U QE+SbDF5cPWCGEycbJOQz93lM2Uqbgxva2PHs0ptUSgpecnHfvop7Kd X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 4D8F6D2F97742BA6ABAA78C5B40DC353BFA3EEDE93D6A1B3AFBE2707EA010EDB2000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094210_125142_EA552153 X-CRM114-Status: UNSURE ( 7.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Use in uml drivers, which do not need more than scheduling the interrupt at the time of a follow up timetravel GET-Message. Signed-off-by: Benjamin Beichler --- arch/um/include/shared/irq_user.h | 7 +++++++ 1 file changed, 7 insertions(+) Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Use in uml drivers, which do not need more than scheduling the interrupt at the time of a follow up timetravel GET-Message. Signed-off-by: Benjamin Beichler --- arch/um/include/shared/irq_user.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/um/include/shared/irq_user.h b/arch/um/include/shared/irq_user.h index da0f6eea30d0..8c336c79ffb9 100644 --- a/arch/um/include/shared/irq_user.h +++ b/arch/um/include/shared/irq_user.h @@ -17,6 +17,13 @@ enum um_irq_type { struct siginfo; extern void sigio_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs); void sigio_run_timetravel_handlers(void); + +struct time_travel_event; +extern void time_travel_add_irq_event(struct time_travel_event *ev); +static inline void simple_timetravel_handler(int irq, int fd, void *data, + struct time_travel_event *ev) { + time_travel_add_irq_event(ev); +} extern void free_irq_by_fd(int fd); extern void deactivate_fd(int fd, int irqnum); extern int deactivate_all_fds(void); From patchwork Fri Nov 3 16:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=01CVBcDK; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=nQy1UTJt; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=ZZgULq9q; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP14Nnrz1yR2 for ; Sat, 4 Nov 2023 03:42:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+jvtFvr0gSrmwoP8+7sqSAaCVUA4OXSNAsQbLkULeY4=; b=01CVBcDK0gvkIu TnyYQ6adqxewWmEKU/qojULZxLqsFIOh0MwSTb0mbjeRJvbBV2xKDyUl02OOMU1hC2WwmKPsT2drg apt6W7bnSmc/0OnfnW33bh2yCeOn2k6XbobYoOLp+MEyYLZgPweeklBZ1vPIE1+p0/dIioNk/NP4q kJVrYaxx2/3YDFn+wDRkmf5Mk3mq3l16Fkn2Z5D/wPR/O+7llxMlYWU1vXXnlNExHNQK6TJXu/6eO 0JHFwJdjBNjJZrQjw4CYnW7N3GZjF5DW56l5FQ9tP8PcAUSJF1i3XKN5Va/D+IaDA7NAWGwwOqQVb JtRkDN5lP71TKVJI5DqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFP-00BnlG-2u; Fri, 03 Nov 2023 16:42:15 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFJ-00BnjX-0e for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:13 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:01 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029721; bh=kWrrIs3UtL45ZMJGNIGiwZAwEr1yJtlRhqWcnVdyS3M=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= nQy1UTJtmzTMXs7dnfMkPljyDyDKeco7iQq+AZmZ+WUrXR+2mW1P5phKshdtYG78VcMPiJnzcxpzsQpUEIABDg== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029721; bh=kWrrIs3UtL45ZMJGNIGiwZAwEr1yJtlRhqWcnVdyS3M=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= ZZgULq9qoyKlDIC+5CuNb++uKi+85nc9MXxlss3zdaZYK9CioT/JHVO6zO7a7j+9xETSDwRsVrjwPae2qM9WccShw27w4ml4Owk2Y8gJhsnGZ8wJ9y8Hi/m2/ofOb7LiMZnkGbgc95yj03ewtApOexMEIXH91mMIOtlhd3gkrhk= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:41 +0000 Subject: [PATCH RFC 03/11] um: Use a simple time travel handler for line interrupts MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-3-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=1390; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=oUWecdXr0IF2cOLtLivJrlkjjt6eZJH7/VVzHS9ciVE=; b=zaAuDZsKJxWnDBsc4lAjUI18JRDA5m5ST4ri+sTj7B9S2XCFJWJcE0oITsanJKYzTGGCciGrj 9JR5lgRmRnOCzz5YObV7jWv8LCcB9sagqxfehLTY0IZZFOPVUHUqr7g X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: A08383C23EFA02E0CC8E04C6DF65119EBAE7CC12EABFED830CCA4D2528192B8B2000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094210_125330_74D47C79 X-CRM114-Status: UNSURE ( 9.41 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This change permits interrupts on serial lines in time travel mode, especially in external mode. However, these interrupts are processed with the simple handler that does not provide any acknowledgmen [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This change permits interrupts on serial lines in time travel mode, especially in external mode. However, these interrupts are processed with the simple handler that does not provide any acknowledgment. Signed-off-by: Benjamin Beichler --- arch/um/drivers/line.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index b98545f3edb5..3cda0ae41824 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c @@ -260,9 +260,9 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data) int err; if (input) { - err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_READ, + err = um_request_irq_tt(UM_IRQ_ALLOC, fd, IRQ_READ, line_interrupt, 0, - driver->read_irq_name, data); + driver->read_irq_name, data, simple_timetravel_handler); if (err < 0) return err; @@ -270,9 +270,9 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data) } if (output) { - err = um_request_irq(UM_IRQ_ALLOC, fd, IRQ_WRITE, + err = um_request_irq_tt(UM_IRQ_ALLOC, fd, IRQ_WRITE, line_write_interrupt, 0, - driver->write_irq_name, data); + driver->write_irq_name, data, simple_timetravel_handler); if (err < 0) return err; From patchwork Fri Nov 3 16:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0b2vg6RB; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=3w+1bcYg; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=bbGEI+5f; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP14DbCz1yR1 for ; Sat, 4 Nov 2023 03:42:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gaw/XFMNC8H1y4CEvhsTN9/5WixLWjm0MU8RIDXj+t8=; b=0b2vg6RBSAePrb vr7gULf5pZoCHMppLDdYk9UMsV/sOH3+4B3GHpWDkrsIj9lkS/rhFau8IegBSEE0t8sWwGu1WQzn3 TknNd69Bmv6OEX1D350Kz0gzpyCxpF48p9lIfsUp0eFzDObOy0YSa1ls3UjJh0EiK1PvgSKfM3y4r wcO5j7ppSoP4z3Bj8DyFqw7mpoqZ0Z6J9aE8lXjNZ7oMnmDGYg1XYL5jvUh7evGY/vErmg0yyBUeE k4cj/z1W31P3+mGAJCI1oVNWgXl/m3UrpxKiMsGjSvSw9kJ8cCLiTuxMsbiYFmqqk5ks/Pl/KSCTd tuh50m71mcy38KmLYQYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFU-00Bnn4-04; Fri, 03 Nov 2023 16:42:20 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFO-00BnjU-1S for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:18 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:01 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029721; bh=jjwJeBNe5bbnB9KvKnjg9trRyvejsrwdh8jj/IFUpB0=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= 3w+1bcYg09YjF1fULpPck3fq8hHe6KF3miQQUMqB7zrPMl8pWPstsIy4Att0cWL51Y6p0CZQW7sPXI3zg7bKAQ== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029721; bh=jjwJeBNe5bbnB9KvKnjg9trRyvejsrwdh8jj/IFUpB0=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= bbGEI+5fOIPUe0TOHQl4o/Cl+XbHfEWqlnhvK/jtDv/4bj9cTcp/UDUsvB1JrdP4LooakLPw9tfqkySdrVs8xnrWGWhcuqJaA422U0GbRvTrT9TPmWlA5m5Iag65sl1sGlMb2DO/YNxVbv80z2xSQn3A2lAMtXokv3eEfoo6/1Y= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:42 +0000 Subject: [PATCH RFC 04/11] um: Handle UM_TIMETRAVEL_RUN only in idle loop, signal success in ACK MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-4-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=3277; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=68xaPxhF/gjlITnoUUTiX6mxysJibaWtipP09hmTvZY=; b=7eLrtotia2kss+e/X1cK8+HOJRxXKWTNQC5lNVU+Gph7I4B8veTibqlKj0mzIjLX6tVT3pu9f HZc+Y+v2+S2DKhdoR5jocSV+Wn56thvPBPSMbt6SB4NXyhFHdi2RlEr X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: AA8504E183ABEE817E3869628ED743540B1317AB9F0C7583C412BE14DF0C944D2000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094214_786871_8704DD26 X-CRM114-Status: GOOD ( 19.52 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The Timetravel socket can be read from the SIGIO handler, which may catch a RUN message that was expected to be received in the wait loop. It can happen that the device simulation only "created" one interrupt, but an uncertain (i.e., hard to predict by the calendar/device simulation) number of SIGIOs are emitted, with each SIGIO interrup [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The Timetravel socket can be read from the SIGIO handler, which may catch a RUN message that was expected to be received in the wait loop. It can happen that the device simulation only "created" one interrupt, but an uncertain (i.e., hard to predict by the calendar/device simulation) number of SIGIOs are emitted, with each SIGIO interrupt producing a GET message. The calendar might try to send a RUN message after the first GET message, which is then processed in the SIGIO handler, waiting for the response to a subsequent GET message. However, time is advanced by the received RUN message. Typically, this doesn't pose problems because the interrupt implies that the next RUN message should be at the current time (as sent by the calendar with the GET message). But there are corner cases, such as simultaneous other interrupts, which may desynchronize the current time in the UML instance from the expected time from the calendar. Since there is no real use case for advancing time in the SIGIO handler with RUN messages (in contrast to UPDATE messages), we logically only expect time to advance in the idle loop in TT-ext mode. Therefore, with this patch, we restrict time changes to the idle loop. Additionally, since both the idle loop and the signal/interrupt handlers do blocking reads from the TT socket, a deadlock can occur if a RUN message intended for the idle loop is received in the SIGIO handler. In this situation, the calendar expects the UML instance to run, but it actually waits for another message, either in the SIGIO handler (e.g., a second interrupt) or in a poll in the idle loop, as the previous message was handled by the signal handler, which returned execution to the main loop and ultimately entered the idle loop. Therefore, this patch also allows checking whether the current RUN message was handled by the idle loop or by the signal/interrupt handlers in the ACK of the RUN. With the information in the ACK of the RUN message, the calendar knows whether the RUN was answered in a signal handler and can act accordingly. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index fddd1dec27e6..ff5ef75bbb94 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -94,7 +94,10 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg, case UM_TIMETRAVEL_ACK: return; case UM_TIMETRAVEL_RUN: - time_travel_set_time(msg->time); + // the caller time_travel_handle_message will do the appropriate time advance + // return here 0, if we got RUN, but are not in idle/ext_wait, to + // actually do anything with the run + resp.time = (mode != TTMH_READ) ? 1 : 0; break; case UM_TIMETRAVEL_FREE_UNTIL: time_travel_ext_free_until_valid = true; @@ -238,7 +241,7 @@ static void time_travel_ext_wait(bool idle) */ while (msg.op != UM_TIMETRAVEL_RUN) time_travel_handle_message(&msg, idle ? TTMH_IDLE : TTMH_POLL); - + time_travel_set_time(msg.time); time_travel_ext_waiting--; /* we might request more stuff while polling - reset when we run */ From patchwork Fri Nov 3 16:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=noaKt+ic; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=J4805Dx/; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=psCf5uOo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP1450qz1yR0 for ; Sat, 4 Nov 2023 03:42:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9Gp7GpCdjhT7yJ32totTLE8q/enhiUqRyPoolax2FmA=; b=noaKt+icL1akus SdAbn+n+XV4GfeJvi3PnCSVXQH/FDYndynlWxLd7iSghBovhcgfXOQWnVKVKgfdLlKULxSCzsz3ao CIVLIABcSGu3B0MouXe6bdMe0SpQymfxFzGCPTjMhBN7nVAGBcqQH+TsNV/B68ATqLsMCca14pUwX 7plVDRd/Mq+vtCmaOa6TxmFhxYio8TjseSuyHj03aZ6TzYVOS2L/AoeevDL5hzorLmP8LVHhWyjlS 7wmrTEbVe9EfUkMq3c/UwK281QbE8oZlpm3Xe++nPIxHwgpSTTtEsgpHQn4OsluA6TPqcclWzAPl2 RswRlbVeKmjoc8WVrD9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFV-00Bno5-1H; Fri, 03 Nov 2023 16:42:21 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFS-00BnjS-0l for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:20 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:02 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029722; bh=5oUNntIsz42ye+cbkNuzUBfKHPkK2L8T7r9lTsxpiH4=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= J4805Dx/OmDjq8S8yaRkS8K4CfzUmeugydWNmdSvxcRxXyEzoozMfvwVg5jIMEzDAiuqsE8ANEn+QiEhTCp4DQ== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029722; bh=5oUNntIsz42ye+cbkNuzUBfKHPkK2L8T7r9lTsxpiH4=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= psCf5uOoNRj5o6KDnf1hJG9teYGBD8MoGgxXDgorteiY8qK/fvx8l/Y0YPY2GKY/g4z30Zup40W+kqGalRxAUuiLuFgrO05ahpUW5zb2k8TBDRWOX3/74eTrToSA26yga0TLP1ZurdnOOszeBN2JYcO7axcbD5YgcxGNlJOXlvs= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:43 +0000 Subject: [PATCH RFC 05/11] um: Add final request time to TT wait message MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-5-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=2438; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=cUx3FbldG98/2P5aQhm9/XrZgucPSi9rnu0lQ6fNFvM=; b=oD8qOm9vbsrzTMgmOLcFfxroUtYq8mUOYMPzJ+c4UMhlb3p0FBsHX9sTzfMnUd0GWfkHP6PWi pob4Mhxo+QgBomq2hTia2OlPmT4I52mPl0qRJvXvfJDG4Nx+GtLcw8Q X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 424959179161C38A1EFDF6737992251ABF54ABD2DA2DB807F91E2EFD2AB82AA32000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094218_570957_D6E08582 X-CRM114-Status: GOOD ( 13.65 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Although the information for the next requested time was already sent in a prior message, this change introduces the otherwise unused time variable in the TT message. This addition enables an extra co [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Although the information for the next requested time was already sent in a prior message, this change introduces the otherwise unused time variable in the TT message. This addition enables an extra consistency check and can otherwise be ignored. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 6 +++--- include/uapi/linux/um_timetravel.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index ff5ef75bbb94..abd5fd0f62ee 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -220,7 +220,7 @@ static bool time_travel_ext_request(unsigned long long time) return true; } -static void time_travel_ext_wait(bool idle) +static void time_travel_ext_wait(bool idle, unsigned long long ns) { struct um_timetravel_msg msg = { .op = UM_TIMETRAVEL_ACK, @@ -230,7 +230,7 @@ static void time_travel_ext_wait(bool idle) time_travel_ext_free_until_valid = false; time_travel_ext_waiting++; - time_travel_ext_req(UM_TIMETRAVEL_WAIT, -1); + time_travel_ext_req(UM_TIMETRAVEL_WAIT, ns); /* * Here we are deep in the idle loop, so we have to break out of the @@ -256,7 +256,7 @@ static void time_travel_ext_get_time(void) static void __time_travel_update_time(unsigned long long ns, bool idle) { if (time_travel_mode == TT_MODE_EXTERNAL && time_travel_ext_request(ns)) - time_travel_ext_wait(idle); + time_travel_ext_wait(idle, ns); else time_travel_set_time(ns); } diff --git a/include/uapi/linux/um_timetravel.h b/include/uapi/linux/um_timetravel.h index ca3238222b6d..3127f069d9dc 100644 --- a/include/uapi/linux/um_timetravel.h +++ b/include/uapi/linux/um_timetravel.h @@ -77,9 +77,9 @@ enum um_timetravel_ops { /** * @UM_TIMETRAVEL_WAIT: Indicate waiting for the previously requested * runtime, new requests may be made while waiting (e.g. due to - * interrupts); the time field is ignored. The calendar must process - * this message and later send a %UM_TIMETRAVEL_RUN message when - * the host can run again. + * interrupts); the time field contains the next requested runtime + * for consistency checks. The calendar must process this message and + * later send a %UM_TIMETRAVEL_RUN message when the host can run again. * (host -> calendar) */ UM_TIMETRAVEL_WAIT = 3, From patchwork Fri Nov 3 16:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=BXO51new; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=sUPspnMB; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=l3bvMEhn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP13Jb4z1yQx for ; Sat, 4 Nov 2023 03:42:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t+q3fzIyXlNuGEXf/6eFQp0cBwMzreUZV39G8b+dJ+0=; b=BXO51newTD16KN H2w4JM+djy0wsJ+4AvFDxngbrDSxazmrAGt6gZLC6dEPRLg3MbSDlqcg0gaXujSROEkfxn3SrhFCH 1fg6ICmJtgUYhBK0benONzVwwvaOsspyURIxsyJG4aF6rCWM2N+TSXbLhj6wG03wsy5gZ6ehlombD G55kgicMgUOeLwYCQfyeI1IyuaKOh92ksSLW/o39cTAzyBA30hS97iCH+s1T6lubi1fUIXL7b8T0R kEhcHMnCOc9sewOSXelZKFbV3Vga3HX3e2ByfYeQ/znTs3FgtuLBwJudoLpW7/3MWtlcgFUw27QH+ Q0yXcbfA9654vRhg//jQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFV-00BnoM-2P; Fri, 03 Nov 2023 16:42:21 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFS-00BnjT-0l for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:20 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:05 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029725; bh=+I6LfghT6UhHMk52j4tHBEBojG5M3F9dzwIC7tXxeOg=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= sUPspnMB0YDD4YCdxCidZXlXZ1iZ10pyV1fi/Q8zmy5EMdSMY5p6wWt0SW5Or+Yyh78/DK9GECDVNfd0fiSBBw== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029725; bh=+I6LfghT6UhHMk52j4tHBEBojG5M3F9dzwIC7tXxeOg=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= l3bvMEhn7bCyi6MCOzYwkIZcrNwfVo0avNCcs8uF7VVGbdRad5zqTzZtO+rkUJkxTjeNFdRBGylsSsoIDXDBWP+5CxX0Vo0z/EnHuzIclazTCXuA5YO0lz7t5R93ecBrKv38qvZSjhx/rfmEds57EbtLMkRj6znpUy6lABSpJ50= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:44 +0000 Subject: [PATCH RFC 06/11] um: always send UM_TIMETRAVEL_REQUEST from ISRs MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-6-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=1196; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=whauhw64hJbXS+FrcF3n/N+PPrSKvl+WxTmvMFoPidY=; b=bsFuqjsp6MeQtZnZEaW1L3412l43LuXj38wf1P+97Q8441yKn/Zh42TlI1MuRyPcK5OFd5btF XE+tH6FXOf6A+qAmrjAGjNIe5sRAjytihp4sxILyzaieRsQdkhBQbXa X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 5049AD6F7FC391B63B6EABB41DBA2FF2640FDFB035AC0548DE839B438844BDEF2000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094218_571054_481F6FD1 X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The number of UM_TIMETRAVEL_REQUEST msgs is tried to reduced, if they are redundant via the time_travel_ext_prev_request_valid flag. This can create a race condition, when an interrupt happens and the [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The number of UM_TIMETRAVEL_REQUEST msgs is tried to reduced, if they are redundant via the time_travel_ext_prev_request_valid flag. This can create a race condition, when an interrupt happens and the idle loop wants to wait. This means, sometimes the UM_TIMETRAVEL_REQUEST are sent(when the idle loop already started waiting) and sometimes not, which makes it harder to implement the other end of the scheduler. Therefore, this fix make the time travel protocol a bit more deterministic by always sending the UM_TIMETRAVEL_REQUEST msg. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index abd5fd0f62ee..54fc4a69cb59 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -446,6 +446,7 @@ void time_travel_add_irq_event(struct time_travel_event *e) BUG_ON(time_travel_mode != TT_MODE_EXTERNAL); time_travel_ext_get_time(); + time_travel_ext_prev_request_valid = false; /* * We could model interrupt latency here, for now just * don't have any latency at all and request the exact From patchwork Fri Nov 3 16:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=dJ281C9q; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=bCv2E3fk; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=TPj7JiP5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP14RxCz1yR3 for ; Sat, 4 Nov 2023 03:42:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2P70hoY/IebAR3mUR9Sg7kJp98dnvet9E5TgilXC8a8=; b=dJ281C9qrGvaoZ wouuNLRCZvAG8IILa+PMDnBBvOPeu1ibrhMroLl6M/RPFhP/goX/lxtGgjHm143vqHXjRxBvVUXcG P50aT6KL0ZRSQZ4m7rWdXa2Xnu9NpKaB1pFfOB7dXUREKBC536BnY2ZATALg7Qxag7xanGaVIJ+7/ wGZ+KTL17sk50rvRHTsxUY3LfnVjo+h/3pab4GHJ2PzFIGsj26G2WPtTtVGC08BRNDnWqZKAoIFRP /XVcUKBmvK5+0xuLlj1frbxPQ2H5pcIDt8YkCRqw2JgL2ncpFu7vqE+9kVPVJ1Yvduvqb9rXVHF81 DVGXn8zh0MZSBDwVEhow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFW-00Bnp1-0W; Fri, 03 Nov 2023 16:42:22 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFT-00BnjU-0Y for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:20 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:06 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029726; bh=fUEg05OpiHl405oisu7qrYfj0DwJua0tpNnW7igBs50=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= bCv2E3fkpMDo4G1Jm+kep4/wbUsVQ9HWR08sBZB6BQzb4RJnMQVXeww9AcnXLPP4VbdalVuazJSoWNsc9A4yDA== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029726; bh=fUEg05OpiHl405oisu7qrYfj0DwJua0tpNnW7igBs50=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= TPj7JiP5wUfln5FPFJ1OcjAzd/d6dgvIuqU/rdEacSrymZSVWOpLTF7awAehf17tXFGtuIcvtGcFAWMzK74NxDjyIUGagg3w/ETpX4G9xXGj6jxecF/tRpTEA2aAatNcYwmGdmZ+5BQCTTiUUAcmoRXEYwBtCSLIs9F7iRWys94= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:45 +0000 Subject: [PATCH RFC 07/11] um: add TIMETRAVEL_REQUEST handler to request latest event MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-7-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=1465; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=KH4ddAp2EGaPigbmgh2m0lGLX53d6Wn+CycqcrZ439M=; b=UDdrMOAiibfsaWrMYNcKv1ExW9ME7CiFhUcfuxQ3RtV+LHFXBWWTXi4vZ+ozT6skkLuoAm8kn uJD3r8u/YmVDLuBUBE3IVTXq3eE7YU0+IgZzLgpJQqQX7GmX2NHMPVJ X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 0FECC66DA8C54EA4FA4EAF56094332371BB6D70CE4A7DE73E7F2FA07F84D7F302000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094219_504307_8AB6422F X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Allow the so called Calendar (or simulation master) to request the latest timetravel event. This can be used in situations, where the former request message from UML to Calendar was missed. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 6 ++++++ 1 file changed, 6 insertions(+) Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Allow the so called Calendar (or simulation master) to request the latest timetravel event. This can be used in situations, where the former request message from UML to Calendar was missed. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 54fc4a69cb59..e513256eadfe 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -41,6 +41,7 @@ static bool time_travel_ext_prev_request_valid; static unsigned long long time_travel_ext_prev_request; static bool time_travel_ext_free_until_valid; static unsigned long long time_travel_ext_free_until; +static struct time_travel_event *time_travel_first_event(void); static void time_travel_set_time(unsigned long long ns) { @@ -66,6 +67,7 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg, .op = UM_TIMETRAVEL_ACK, }; int ret; + struct time_travel_event *event; /* * We can't unlock here, but interrupt signals with a timetravel_handler @@ -103,6 +105,10 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg, time_travel_ext_free_until_valid = true; time_travel_ext_free_until = msg->time; break; + case UM_TIMETRAVEL_REQUEST: + event = time_travel_first_event(); + resp.time = event->time; + break; } resp.seq = msg->seq; From patchwork Fri Nov 3 16:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=gC0SNJkY; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=UDAlGqjL; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=DEjhIXJS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP14lP7z1yR5 for ; Sat, 4 Nov 2023 03:42:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5gQA32BHWdgiO8Nfe1WUrOoz+NWHzuTRNv0lBPRomaw=; b=gC0SNJkYBjN+zB jmqZI9yq4LDYI60hzYi270BO4JolsOrd6nHsmGm7adYjbzvk2sId5Md0YeU0x/OTfERuw0DJH9rvw L76lGiiygdNIMqAq2fntY4MCoOTShUsMEw+JXQsIcMA+huG/koT80p55/KSkn/67PWjRr5jcKXM9b KBx6+h0Nv9cz4xlR7WvoRqP8fyvffOwYjIHJc/Ov7eCrT/akmT2tUtB2jhZ+O6r57oFKVauHtI5JK K41wFn7/9gVqRRxL2+jX7hwWV9nCqGLZdHS0W/McYRN+PErE7yW8jXZf2+dkxxjDUCF6xMuD3YHWj S+wir2qv3GE+y2ExXJUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFX-00Bnpq-2X; Fri, 03 Nov 2023 16:42:23 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFT-00BnjX-0Y for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:21 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:06 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029726; bh=x7wS4WGG6GPiuEEX7c7cCKioCWmfLx/hgOb+xsN5EIM=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= UDAlGqjLf4dVdADqK9Btosqlpbkg7BI8aJch1A09TgjvqZF6HjO/BBa5mSG0zqMd3Nbyzqbxr6QXA5mu10+VCA== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029726; bh=x7wS4WGG6GPiuEEX7c7cCKioCWmfLx/hgOb+xsN5EIM=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= DEjhIXJSm8VAVJ0fM+MfoGcAbLur3Pq8/y8EN2U4FEYY9hrOQgUJhvM+ohZEskICE+UyAkDl1x2eB9bWiZ+uQ9zDEe0uOsDpbh7328cNIt0XBz38/k+mQUQ+uATAxEcNBYb9B2jwn0Z4x7vBvwd0nShF0bRYKWYOKcPmEu1iS7o= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:46 +0000 Subject: [PATCH RFC 08/11] um: Protect accesses to the timetravel event list MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-8-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=2785; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=cScckTJnr4aeaowsPfVGYikHgA1H6YJtd9gFfj8TAoE=; b=UvRd7fTAfaq9jnYM/Ck2XwWe/wbs1YW0itXq8TXrGgVTIBIV7wTjEB/++ZnNrVAzvRBmWm693 b1MejuPOAcJBBUkaOCVQxxorrq6qZLiFkk64OOX2fnpau6iQ5ugzv2p X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 2449E7744075D006F2AE9A48A91343E8332FC8283F924601CBECDFFAED1D59422000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094219_506375_4677B64B X-CRM114-Status: GOOD ( 13.03 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: When the timetravel ext modus is used, accessing the timetravel event list can be interrupted by a message on the timetravel socket in the SIGIO signal handler. This interruption can potentially modif [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When the timetravel ext modus is used, accessing the timetravel event list can be interrupted by a message on the timetravel socket in the SIGIO signal handler. This interruption can potentially modify the event list, leading to race conditions that cause deadlocks in the timetravel protocol or disrupt the ordered nature of the list, triggering bugs. Previously, the normal irq-save function did not intentionally block the timetravel handlers. However, the additional (un)block_signals_hard functions do block them. Therefore, these functions have been added at the appropriate places to address the issue. It's worth noting that although the functions are named as blocking, they primarily defer the actual execution of the SIGIO handlers until the unblock call. If no signal was issued, this mainly results in a variable assignment and a memory barrier. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index e513256eadfe..f1b2ca45994d 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -288,6 +288,7 @@ static void __time_travel_add_event(struct time_travel_event *e, e->time = time; local_irq_save(flags); + block_signals_hard(); list_for_each_entry(tmp, &time_travel_events, list) { /* * Add the new entry before one with higher time, @@ -310,6 +311,7 @@ static void __time_travel_add_event(struct time_travel_event *e, tmp = time_travel_first_event(); time_travel_ext_update_request(tmp->time); time_travel_next_event = tmp->time; + unblock_signals_hard(); local_irq_restore(flags); } @@ -349,6 +351,7 @@ void deliver_time_travel_irqs(void) return; local_irq_save(flags); + block_signals_hard(); irq_enter(); while ((e = list_first_entry_or_null(&time_travel_irqs, struct time_travel_event, @@ -358,6 +361,7 @@ void deliver_time_travel_irqs(void) e->fn(e); } irq_exit(); + unblock_signals_hard(); local_irq_restore(flags); } @@ -370,7 +374,9 @@ static void time_travel_deliver_event(struct time_travel_event *e) */ e->fn(e); } else if (irqs_disabled()) { + block_signals_hard(); list_add_tail(&e->list, &time_travel_irqs); + unblock_signals_hard(); /* * set pending again, it was set to false when the * event was deleted from the original list, but @@ -395,8 +401,10 @@ bool time_travel_del_event(struct time_travel_event *e) if (!e->pending) return false; local_irq_save(flags); + block_signals_hard(); list_del(&e->list); e->pending = false; + unblock_signals_hard(); local_irq_restore(flags); return true; } From patchwork Fri Nov 3 16:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=i81PZ7HY; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=lCNTnk8M; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=fnUa6aGV; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP65l0Kz1yR3 for ; Sat, 4 Nov 2023 03:42:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vYElSr3WfrgySKgDYQ4q2XEi5pKgMlDcPB6yhyBfjuE=; b=i81PZ7HYGfDZOj cEZksXzXP75iN/aL3QslCzif+EkXgTS/WmJtuEMDWsteoz91ffjlW+KNJ4OiPsUxT49O6Rx4IBMwr fKNF5mWjxEqnJQfmuAB7bxb1hz15TWRGELjJkMPVTn2pFpkQIysTqcDcZ8N6TY8v7cD8J4kJz1lok RQ4cWKgf2KDhD4Maob0eimcVUOMo5yrPaQn6m8Wt7Z5ZxJEKVDDYWAW8SyIV/wuzyeYIjMGTUT9Qr HwxJKQHaGej+pPwADX5QHgmSua5MPS1g8KFmhsNiGMy/Of3TdwbT+TxIeFatY6RmkzmfCcNNiiRPn 1yqdtXl+mmv0dFYKYiCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFa-00BnrP-0h; Fri, 03 Nov 2023 16:42:26 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFU-00BnjS-2d for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:24 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:07 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029727; bh=/gQjcBz/Vi/HkJdzNEFOX47B7D0y/1xPFVbKVqFTHT8=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= lCNTnk8MlRlmM+OOZH3yyy4eYGkqFCnYMq1w5AGIjaaETgxY12kgMy/RSiV/yJY6/tHaPUAAPr8cEJpEVf30DA== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029727; bh=/gQjcBz/Vi/HkJdzNEFOX47B7D0y/1xPFVbKVqFTHT8=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= fnUa6aGVZgcSrr6u7V8fBk18aeDK1qOet3Fth6AznyCokUEX04bLiI8+zlWtj0qw2DfgHcNodb+DhVZr1nKT3UlQAjx+MbB1wxt/FjyhqQ4kh99Eb28ikwwuhB1ygEJPaLLUVgJM+3awOSL6Yfci0dDrCcOtl8D21tZLQw1EME8= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:57 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:47 +0000 Subject: [PATCH RFC 09/11] um: Delay timer_read in time travel mode only after consecutive reads MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-9-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=1732; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=gYYkPHoC/BeZdF3NsLFtZdipUoD67sIIs3zzuRe4EAc=; b=qNjT+9ZlfCCLI3bIOoqFaMJvEJky+Cv40dcx128vYi79Fi3YNm6HNvk/qqQU+2REB4TEFBGVO BIkY9AfsJDxCRmD3BMLup8xFcQUYLcZ0uxbHnPMlQgqFMn3gsm3vxkg X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 96CA85543203E8B74B9384DCEFB97B9F7ED42428D68DD10E594024F0F1764FD42000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094221_154636_CAE78C17 X-CRM114-Status: GOOD ( 11.64 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Given the presence of numerous timer_read calls in well-behaved code within the kernel and userspace, particularly those that do not employ busy loops, we introduce a delay in reading the timer only a [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Given the presence of numerous timer_read calls in well-behaved code within the kernel and userspace, particularly those that do not employ busy loops, we introduce a delay in reading the timer only after several consecutive attempts (currently set at 10). Unfortunately, it is challenging to differentiate between various callers and pinpoint specific misbehaving code, so this is only a mediocre heuristic. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index f1b2ca45994d..f76237cfc1ea 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -723,6 +723,9 @@ static irqreturn_t um_timer(int irq, void *dev) static u64 timer_read(struct clocksource *cs) { + static unsigned long long last_timer_read; + static int consecutive_calls_at_same_time; + if (time_travel_mode != TT_MODE_OFF) { /* * We make reading the timer cost a bit so that we don't get @@ -736,8 +739,14 @@ static u64 timer_read(struct clocksource *cs) * "what do I do next" and onstack event we use to know when * to return from time_travel_update_time(). */ + if (last_timer_read != time_travel_time) { + last_timer_read = time_travel_time; + consecutive_calls_at_same_time = 0; + } else { + consecutive_calls_at_same_time++; + } if (!irqs_disabled() && !in_interrupt() && !in_softirq() && - !time_travel_ext_waiting) + !time_travel_ext_waiting && consecutive_calls_at_same_time > 10) time_travel_update_time(time_travel_time + TIMER_MULTIPLIER, false); From patchwork Fri Nov 3 16:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1859000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ygqaKGas; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=ILOxrMrr; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=rwcldXZ3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP65p4dz1yR7 for ; Sat, 4 Nov 2023 03:42:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nvo52F5Oz+XqkKxCmGVEAm1/XszYpXexaW2hIwcBRUs=; b=ygqaKGas9k9z93 tF0fZ8N4NmC/zIbDDVOBbZ+lQsW/rBhOgd3jWo8zwtaupXFEYIVd0wxdfkRKoY4TP8FPXMfeZ/49m 3WkbmdxXn3bLrHx/z/E2f80zqCaSEVg8djRo4VgYzXv5QtS43uBK4qJC8wITsHu8acGvKDAkI/u7+ sdZWfce9YrSdmS9T3pXJ2l/HwXz8M24QeTOSkBmg/5b3p+2K4TJBUB0hIXb1mvVau4pWd92E+ZblM D26QWtlRIaxpbqJ+CCnCXbv5i2kJ16ELGx3zMqlJ/TyAZMLnOTFGPOhBZy1E0rpVYHo1qpxd8Pp0b qUp1fD0NfjBiwjrhMH2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFa-00Bnrm-1h; Fri, 03 Nov 2023 16:42:26 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFU-00BnjT-2d for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:24 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:07 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029727; bh=aVhHRRFi+roZCFzfRif/entxEHKD2Wu3EPB4vC2Fv2k=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= ILOxrMrrntgLUPsWYgPxEvTNzmvMMU30/uxyp75Xmlws9Pw/Y777/nRyfR+pP1ciO3cS0/kSEo0Aeif7D183Dw== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029727; bh=aVhHRRFi+roZCFzfRif/entxEHKD2Wu3EPB4vC2Fv2k=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= rwcldXZ3o6CHgV/Zo5FvCNMRvZXj3woC5Y6SAU41M9hl0aCvG3Oxyyb3pCuQ08VDYBN+51cR7HaXbzMsiILuQO9Gt7HKZUy9UjVcmK7UA7Vwpi1C3bd8JBV+di1QwVXzQdavWALGP8HYjGJGulJL79MSUSeUD958VMojpTCi2MM= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:58 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:48 +0000 Subject: [PATCH RFC 10/11] um: Delay timer_read only in possible busy loops in TT-mode MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-10-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=3006; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=U+S9ZFID575adxUoR7nXfmTvoTFGOo9vbLnuDpXNq3U=; b=KsPJf9v+osCd4P3+G4T2EeNtysH6oSBKFDd5ZJB3Cvhf3GdDgXXw8cC/dyFbiG8uEdYBbLypq 6mZkrWi3097AEE292WxRPp8KzlSZ3OjY7uL/A4ZYS5IicM3x02zLb+c X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: DDFAF6668E80B109A175BE4BD83D2C08DC79089DF2C85FF663D492029D1D369A2000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094221_153762_AB674213 X-CRM114-Status: GOOD ( 17.59 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Some userspace programs use the current timestamp as a looping condition (directly or indirectly), which can lead to infinite loops in TT-mode since the timestamp doesn't change until the next time st [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Some userspace programs use the current timestamp as a looping condition (directly or indirectly), which can lead to infinite loops in TT-mode since the timestamp doesn't change until the next time step. Commit 065038706f77 ("um: Support time travel mode") introduced a workaround by always inserting a time step when the current timestamp is read. However, this introduces delays, even in cases where such a loop doesn't exist, for example, in filesystem code that updates access timestamps. This slows down external TT-mode as more simulation roundtrips are required, and it unnecessarily affects the determinism and accuracy of the simulation. This patch attempts to detect potential busy loops by identifying the currently executed syscall that would return a timestamp. If 10 consecutive calls at the same timestamp occur, the timer_read is delayed. Since the patch does not consider the PID of the caller, it might be fooled by legitimate processes that take a single timestamp. However, the result is no worse than the original behavior. Signed-off-by: Benjamin Beichler --- arch/um/kernel/time.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index f76237cfc1ea..1782f1ed140e 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef CONFIG_UML_TIME_TRAVEL_SUPPORT enum time_travel_mode time_travel_mode; @@ -721,6 +722,27 @@ static irqreturn_t um_timer(int irq, void *dev) return IRQ_HANDLED; } +static const int suspicious_busy_loop_syscalls[] = { + 36, //sys_getitimer + 96, //sys_gettimeofday + 201, //sys_time + 224, //sys_timer_gettime + 228, //sys_clock_gettime + 287, //sys_timerfd_gettime +}; + +static bool suspicious_busy_loop(void) +{ + int i; + int syscall = syscall_get_nr(current, task_pt_regs(current)); + + for (i = 0; i < ARRAY_SIZE(suspicious_busy_loop_syscalls); i++) { + if (suspicious_busy_loop_syscalls[i] == syscall) + return true; + } + return false; +}; + static u64 timer_read(struct clocksource *cs) { static unsigned long long last_timer_read; @@ -742,11 +764,12 @@ static u64 timer_read(struct clocksource *cs) if (last_timer_read != time_travel_time) { last_timer_read = time_travel_time; consecutive_calls_at_same_time = 0; - } else { + } else if (suspicious_busy_loop()) { consecutive_calls_at_same_time++; } if (!irqs_disabled() && !in_interrupt() && !in_softirq() && - !time_travel_ext_waiting && consecutive_calls_at_same_time > 10) + !time_travel_ext_waiting && consecutive_calls_at_same_time > 10 && + suspicious_busy_loop()) time_travel_update_time(time_travel_time + TIMER_MULTIPLIER, false); From patchwork Fri Nov 3 16:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Beichler X-Patchwork-Id: 1858998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WXnZlmsZ; dkim=fail reason="signature verification failed" header.d=uni-rostock.de header.i=@uni-rostock.de header.a=ed25519-sha256 header.s=itmze header.b=hEgBIOQP; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=uni-rostock.de header.i=@uni-rostock.de header.a=rsa-sha256 header.s=itmz header.b=cwmwuece; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMRP65kxvz1yR1 for ; Sat, 4 Nov 2023 03:42:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References:Message-ID :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=237A+6I4WyB8jbNgd9Tfx4yfOPVjlQDagmaSDqNGNww=; b=WXnZlmsZwKgMBc p04qO8AuuoxBNWejqZCQkA7FoBvLX7cOV8785teyCC73Wsz1HTEceh0UnjXFCAGZlAItcKhAZrcVr 1tQWtaz5Aqxbi80BZ4FzsGB0vKwsVgrYw1/TCTDlEBJaQRm6RnJt407loctk59vObVSt0yQBudPPE bMcTrOLUUcaXmiz4LVh03Z+4+0byghU8g2IhPV8HQxwiwVo1mebFXKWM8wrHgFvUCvMR3i/+giXTE 9hUfzFrnINmiccky8UrtNjX6P1kpJil9d6YV/vUDl9EH1LUj5UGUwV8Sx6tBmtdv5beyPwxjbvp0J 6TaTUOVylWM4+FN2ddlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFc-00Bnsd-0Q; Fri, 03 Nov 2023 16:42:28 +0000 Received: from mx1.uni-rostock.de ([139.30.22.71]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qyxFV-00BnjU-1R for linux-um@lists.infradead.org; Fri, 03 Nov 2023 16:42:25 +0000 Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Fri, 03 Nov 2023 16:42:07 GMT DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1699029727; bh=LMMvyrqtbqFEhkufk/o5JrTwDgy68ORlN4vpGAREsec=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= hEgBIOQP+ETk6nk+EMguD3zmMvb3+ICyAERfvnnV9L5BQB8+yzgN25ZhBUgzkM74lNdBEtUbLvhA9WJw6e/QBw== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1699029727; bh=LMMvyrqtbqFEhkufk/o5JrTwDgy68ORlN4vpGAREsec=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= cwmwueceKMlq8MHrdSKKKXp2BV33FJFPX/7LKBS6IV5ICah4ba0kPTyvofF/x/TJSMBcpHeUju2WevOaaww/HjwjBFxTmwLoZm+HrjEc13UDdcxhrGJxh9KZPCBZQcp5uVimrgiz8iCnlhDRO5hchZTvIgKRiMyGKUXB2pgR5Xc= Received: from mininet-experimente.amd.e-technik.uni-rostock.de (139.30.201.3) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Fri, 3 Nov 2023 17:41:58 +0100 From: Benjamin Beichler Date: Fri, 3 Nov 2023 16:41:49 +0000 Subject: [PATCH RFC 11/11] um: Remove all TSC flags when using Time Travel Mode MIME-Version: 1.0 Message-ID: <20231103-bb-timetravel-patches-v1-11-e2c68efcf664@uni-rostock.de> References: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> In-Reply-To: <20231103-bb-timetravel-patches-v1-0-e2c68efcf664@uni-rostock.de> To: Richard Weinberger , Anton Ivanov , Johannes Berg CC: , Benjamin Beichler X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1699029716; l=1331; i=benjamin.beichler@uni-rostock.de; s=20231103; h=from:subject:message-id; bh=a1pxx5yM7G85+ua7gwOMOgNcOG3EHWYEgMlINwEg6YA=; b=aoYk9ZP9BEcxBOO09GqIsFUlw3PhWpKkP6huEzmon+A9KqF9YyGwpmb7t+VAmnWAe3PYWRI7o 4doD5MeOaJUBZ0xOVOYPvyRQEWm1+QjgV3uLU+DNXkgNeZycQjekP5Y X-Developer-Key: i=benjamin.beichler@uni-rostock.de; a=ed25519; pk=fla2/IRwqFWH5W+fACqQyDu/mTc6mEcSPQtqb/SoX8o= X-Originating-IP: [139.30.201.3] X-ClientProxiedBy: email3.uni-rostock.de (139.30.22.83) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: 040BC8943490D5F923B9FC337F883CC19014F798056282B10263A1824C9577212000:8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231103_094221_787995_96392B28 X-CRM114-Status: GOOD ( 11.82 ) X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In time travel mode, the internal time is only advanced at discrete synchronization points, while the TSC register continuously increases. Although the TSC registers remain accessible, we remove the T [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [139.30.22.71 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In time travel mode, the internal time is only advanced at discrete synchronization points, while the TSC register continuously increases. Although the TSC registers remain accessible, we remove the TSC flags to indicate to programs that properly check the TSC flag before reading that the CPU lacks a proper TSC register. This change is primarily cosmetic but may encourage some programs to use gettimeofday and similar calls for time measurement. Signed-off-by: Benjamin Beichler Acked-by: Anton Ivanov --- arch/um/kernel/um_arch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index b1bfed0c8528..6bfd531b5f87 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "um_arch.h" @@ -284,7 +285,8 @@ static void parse_host_cpu_flags(char *line) { int i; for (i = 0; i < 32*NCAPINTS; i++) { - if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i])) + if ((x86_cap_flags[i] != NULL) && strstr(line, x86_cap_flags[i]) && + !(time_travel_mode != TT_MODE_OFF && strstr("tsc", x86_cap_flags[i]))) set_cpu_cap(&boot_cpu_data, i); } }