linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Joel Fernandes <agnel.joel@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	uml-devel <user-mode-linux-devel@lists.sourceforge.net>,
	Jeff Dike <jdike@addtoit.com>
Subject: Re: [uml-devel] UML hangs with hrtimer test module
Date: Thu, 29 Mar 2018 00:35:11 +0200	[thread overview]
Message-ID: <6520656.Ns80NH9HyO@blindfold> (raw)
In-Reply-To: <CAD=GYpaBOgoWGW3F5kjk_0V8mUw1VeWLm7PnveNGejfehoE1Og@mail.gmail.com>

Am Donnerstag, 29. März 2018, 00:19:39 CEST schrieb Joel Fernandes:
> Thanks for the quick reply.
> 
> On Wed, Mar 28, 2018 at 6:19 AM, Richard Weinberger <richard@nod.at> wrote:
> > Am Mittwoch, 28. März 2018, 15:11:29 CEST schrieb Geert Uytterhoeven:
> >> On Wed, Mar 28, 2018 at 12:28 PM, Joel Fernandes <agnel.joel@gmail.com>
> > wrote:
> >> >         while(release_now == 0);
> >>
> >> while (release_now == 0)
> >>         cpu_relax();
> >
> > Not sure whether a cpu_relax() fixes the problem.
> > I guess the root of the problem is that UML is UP and non-preemptive.
> > Therefore the loop is never interrupted.
> > To verify I asked for the full source.
> >
> 
> cpu_relax actually worked!

Interesting.
 
> Any thoughts on why it helps? Even if its non-preemptive, I did
> receive the timer interrupt, so I expected the variable to be set.

Timers trigger also with preempt off, I forgot...
I think the cpu_relax() issues internally a barrier such that the
release_now variable is read again.
Can you try barrier() instead of cpu_relax()? I bet it works too.
Same if you mark release_now as volatile.

Thanks,
//richard


  reply	other threads:[~2018-03-28 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 10:28 [uml-devel] UML hangs with hrtimer test module Joel Fernandes
2018-03-28 11:04 ` Richard Weinberger
2018-03-28 13:11 ` Geert Uytterhoeven
2018-03-28 13:19   ` Richard Weinberger
2018-03-28 22:19     ` Joel Fernandes
2018-03-28 22:35       ` Richard Weinberger [this message]
2018-03-29  6:04         ` Geert Uytterhoeven
2018-03-29 20:20           ` Joel Fernandes
2018-03-29 20:34             ` Richard Weinberger

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=6520656.Ns80NH9HyO@blindfold \
    --to=richard@nod.at \
    --cc=agnel.joel@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).