linux-um archives
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: 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 09:33:09 +0200	[thread overview]
Message-ID: <4dbed8896c94a347dcb58b3a83792c52fdc1c04a.camel@sipsolutions.net> (raw)
In-Reply-To: <4a75c40636be267163dc30b5a6a2442089628e57.camel@axis.com>

On Mon, 2023-10-23 at 07:08 +0000, Vincent Whitchurch wrote:
> 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

Ouch.

> >  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.  
> 

Yeah this is a tricky area, I fought with it for quite a while too,
seems we're not done yet ;-)

We mostly use time-travel=ext mode these days, so our system may not be
as susceptible to it? But not sure, in some cases it runs with just a
single instance, and that should be pretty much the same due to the
free-until information.

Do you have a specific workload that tends to reproduce this?

johannes

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

  reply	other threads:[~2023-10-23  7:33 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
2023-10-23  7:33   ` Johannes Berg [this message]
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=4dbed8896c94a347dcb58b3a83792c52fdc1c04a.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=Vincent.Whitchurch@axis.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --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