mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Izik Eidus <izik.eidus@ravellosystems.com>
Cc: linux-kernel@vger.kernel.org,
	Andrea Arcangeli <aarcange@redhat.com>,
	Leonid Shatz <leonid.shatz@ravellosystems.com>
Subject: Re: hrtimer possible issue
Date: Mon, 4 Feb 2013 11:12:56 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.02.1302041110160.11905@ionos> (raw)
In-Reply-To: <510E58C2.9010207@ravellosystems.com>

On Sun, 3 Feb 2013, Izik Eidus wrote:

> Hi,
> 
> it seems like hrtimer_enqueue_reprogram contain a race which could result in
> timer.base switch during unlock/lock sequence.
> 
> See the code at __hrtimer_start_range_ns where it calls
> hrtimer_enqueue_reprogram. The later is releasing lock protecting the timer
> base for a short time and timer base switch can occur from a different CPU
> thread. Later when __hrtimer_start_range_ns calls unlock_hrtimer_base, a base
> switch could have happened and this causes the bug
> 
> Try to start the same hrtimer from two different threads in kernel running
> each one on a different CPU. Eventually one of the calls will cause timer base
> switch while another thread is not expecting it.
> 
> This can happen in virtualized environment where one thread can be delayed by
> lower hypervisor, and due to time delay a different CPU is taking care of
> missed timer start and runs the timer start logic on its own.

Nice analysis.
 
> This simple patch (just to give example of a fix) refactor this function to
> get rid of unneeded lock which immediately was followed by the unlock (with
> possible undesired base switch).
> 
> (Both the bug and the fixed were found/patched by Leonid Shatz)

The patch got mangled by your mail client and it is missing the proper
Signed-off-by annotation in the patch description. See
Documentation/SubmittingPatches.

Can you please resend ?

Thanks,

	tglx



       reply	other threads:[~2013-02-04 10:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <510E58C2.9010207@ravellosystems.com>
2013-02-04 10:12 ` Thomas Gleixner [this message]
2013-02-04 11:22   ` Leonid Shatz
2013-02-05 10:20     ` Thomas Gleixner
2013-02-05 10:21       ` Izik Eidus
2013-02-05 10:34       ` Mike Rapoport

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=alpine.LFD.2.02.1302041110160.11905@ionos \
    --to=tglx@linutronix.de \
    --cc=aarcange@redhat.com \
    --cc=izik.eidus@ravellosystems.com \
    --cc=leonid.shatz@ravellosystems.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®