From: Vincent Whitchurch <Vincent.Whitchurch@axis.com>
To: "johannes@sipsolutions.net" <johannes@sipsolutions.net>,
Vincent Whitchurch <Vincent.Whitchurch@axis.com>,
"anton.ivanov@cambridgegreys.com"
<anton.ivanov@cambridgegreys.com>,
"richard@nod.at" <richard@nod.at>
Cc: "linux-um@lists.infradead.org" <linux-um@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
kernel <kernel@axis.com>
Subject: Re: [PATCH] um: time-travel: fix time going backwards
Date: Mon, 23 Oct 2023 07:08:58 +0000 [thread overview]
Message-ID: <4a75c40636be267163dc30b5a6a2442089628e57.camel@axis.com> (raw)
In-Reply-To: <20231020-uml-time-backwards-v1-1-90b776fc6dfd@axis.com>
On Fri, 2023-10-20 at 16:47 +0200, Vincent Whitchurch wrote:
> In basic time travel mode, I sometimes see "time goes backwards" panics
> like the one below:
>
> Kernel panic: time-travel: time goes backwards 161689340000492 -> 161689339869814
> Call Trace:
> panic+0x1a1/0x3d7
> time_travel_update_time.cold+0xe9/0x133
> timer_read+0xc1/0x100
> ktime_get+0x10c/0x200
> copy_process+0x1899/0x2230
> kernel_clone+0x57/0x7a0
> kernel_thread+0x4a/0x50
> kthreadd+0x116/0x190
>
> The problem is a race between time_travel_handle_real_alarm() and
> timer_read(). time_travel_handle_real_alarm() changes the time after
> time_read() reads the current time but before time_travel_update_time()
> has had a chance to add the end event.
>
> Fix this by doing the time read and event add atomically with respect to
> time_travel_handle_real_alarm().
Further testing resulted in hitting the BUG_ON(time_travel_time !=
e->time) so looks like this needs some more work.
BUG: failure at arch/um/kernel/time.c:409/time_travel_update_to_event()!
Kernel panic - not syncing: BUG!
CPU: 0 PID: 1 Comm: swapper Not tainted 6.5.0+ #13
Stack:
624db908 60a06c60 41b58ab3 60ae2398
6003fb90 10000c1e577c 41b58ab3 60b419ae
607f0dc0 00000000 00000000 6005b270
Call Trace:
[<607fad5d>] show_stack.cold+0xc0/0x149
[<60841364>] dump_stack_lvl+0x75/0x94
[<6084139d>] dump_stack+0x1a/0x1c
[<607fca1d>] panic+0x27e/0x490
[<607fb093>] time_travel_update_to_event.cold+0x89/0x18b
[<60041317>] time_travel_forward_time.constprop.0+0xf7/0x160
[<600414f1>] timer_read+0x171/0x1b0
[<60140652>] random_get_entropy_fallback+0x42/0x60
[<60545943>] add_device_randomness+0x73/0xf0
[<6003a685>] do_one_initcall+0x145/0x3b0
[<60002598>] 0x60002598
[<60843ac5>] kernel_init+0x4a/0x195
[<6003d111>] new_thread_handler+0x141/0x1a0
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
next prev parent reply other threads:[~2023-10-23 7:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 14:47 [PATCH] um: time-travel: fix time going backwards Vincent Whitchurch
2023-10-23 7:08 ` Vincent Whitchurch [this message]
2023-10-23 7:33 ` Johannes Berg
2023-10-25 11:55 ` Vincent Whitchurch
2023-10-25 19:51 ` Johannes Berg
2023-10-25 20:02 ` Johannes Berg
2023-10-25 20:41 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a75c40636be267163dc30b5a6a2442089628e57.camel@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox