public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Denys Fedoryschenko <denys@visp.net.lb>,
	Chris Caputo <ccaputo@alt.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Badalian Vyacheslav <slavon@bigtelecom.ru>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: deadlocks if use htb
Date: Thu, 15 Jan 2009 10:54:17 +0000	[thread overview]
Message-ID: <20090115105417.GG5461@ff.dom.local> (raw)
In-Reply-To: <1232016408.8870.43.camel@laptop>

On Thu, Jan 15, 2009 at 11:46:48AM +0100, Peter Zijlstra wrote:
> On Thu, 2009-01-15 at 09:01 +0000, Jarek Poplawski wrote:
...
> > spin_lock
> > (not this hrtimer's anymore)
> > __remove_hrtimer
> > list_add_tail			enqueue_hrtimer
> > 
> 
> (looking at .28 code)
> 
> run_hrtimer_pending() reads like:
> 
> while (pending timers) {
>   __remove_hrtimer(timer, HRTIMER_STATE_CALLBACK);
>   spin_unlock(&cpu_base->lock);
> 
>   fn(timer);
> 
>   spin_lock(&cpu_base->lock);
>   timer->state &= ~HRTIMER_STATE_CALLBACK; // _should_ result in HRTIMER_STATE_INACTIVE
>   if (HRTIMER_RESTART)
>     re-queue
>   else if (timer->state != INACTIVE) {
>     // so another cpu re-queued this timer _while_ we were executing it.
>     if (timer is first && !reprogramm) {
>       __remove_hrtimer(timer, HRTIMER_STATE_PENDING);
>       list_add_tail(timer, &cb_pending);
>     }
>   } 
> }
> 
> So in the window where we drop the lock, one can, as you said, have
> another cpu requeue the timer, but the rb_entry and list_entry are free,
> so it should not cause the data corruption we're seeing.
> 

Can't they be enqueued to the list (without a lock) and rbtree at the
same time? Then removing is done for the list only?

Jarek P. 

  reply	other threads:[~2009-01-15 10:54 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081010075640.GA5204@ff.dom.local>
     [not found] ` <48EF17EA.5020306@bigtelecom.ru>
     [not found]   ` <20081010090426.GA6054@ff.dom.local>
     [not found]     ` <20081010095129.GB6054@ff.dom.local>
     [not found]       ` <48F6FB3E.7060903@bigtelecom.ru>
     [not found]         ` <20081016084027.GA17632@ff.dom.local>
     [not found]           ` <48FEC302.5090707@bigtelecom.ru>
2008-10-22  7:02             ` deadlocks if use htb Jarek Poplawski
2008-12-10 15:14               ` Badalian Vyacheslav
2008-12-11  8:46                 ` Jarek Poplawski
2008-12-15 11:13                   ` Jarek Poplawski
2008-12-16  7:37                     ` Badalian Vyacheslav
2008-12-18  6:43                     ` Badalian Vyacheslav
2008-12-18  8:17                       ` Jarek Poplawski
2008-12-18 11:23                         ` Badalian Vyacheslav
2008-12-18 11:37                           ` Jarek Poplawski
2009-01-14  2:43                         ` Chris Caputo
2009-01-14  6:39                           ` Jarek Poplawski
2009-01-14 12:17                             ` Denys Fedoryschenko
2009-01-14 12:36                               ` Jarek Poplawski
2009-01-14 12:41                                 ` Denys Fedoryschenko
2009-01-14 12:50                               ` Peter Zijlstra
2009-01-14 13:04                                 ` Jarek Poplawski
2009-01-14 13:05                                 ` Denys Fedoryschenko
2009-01-14 13:12                                   ` Jarek Poplawski
2009-01-14 13:15                                     ` Peter Zijlstra
2009-01-14 13:19                                       ` Denys Fedoryschenko
2009-01-14 13:26                                       ` Jarek Poplawski
2009-01-14 13:32                                         ` Peter Zijlstra
2009-01-14 13:57                                           ` Jarek Poplawski
2009-01-14 14:13                                           ` Jarek Poplawski
2009-01-14 14:28                                             ` Peter Zijlstra
2009-01-14 14:39                                               ` Jarek Poplawski
2009-01-15  9:01                                               ` Jarek Poplawski
2009-01-15 10:46                                                 ` Peter Zijlstra
2009-01-15 10:54                                                   ` Jarek Poplawski [this message]
2009-01-14 18:02                                 ` Chris Caputo
2009-01-15  6:53                                   ` Jarek Poplawski
2009-01-15  7:12                                     ` Badalian Vyacheslav
2009-01-15  8:09                                       ` Jarek Poplawski
2009-01-15  9:01                                         ` Denys Fedoryschenko
2009-01-15  9:06                                           ` Jarek Poplawski
2009-01-15  9:40                                             ` Badalian Vyacheslav
2009-01-15  9:54                                               ` Jarek Poplawski
2009-01-15  9:57                                                 ` Denys Fedoryschenko
2009-01-15 10:06                                                   ` Jarek Poplawski
2009-01-15 10:10                                                   ` Jarek Poplawski
2009-01-15 10:40                                                     ` Denys Fedoryschenko
2009-01-15  7:26                                     ` Chris Caputo
2009-01-15  7:54                                       ` Jarek Poplawski
2009-01-15  9:45                                         ` Jarek Poplawski
2009-01-15 12:00                                           ` Chris Caputo
2009-01-15 12:18                                             ` Jarek Poplawski
2009-01-15 13:53                                               ` Chris Caputo
2009-01-16  6:51                                                 ` Badalian Vyacheslav
2009-01-19  5:46                                     ` David Miller
2009-01-19  6:57                                       ` [PATCH] " Jarek Poplawski
2009-01-19  7:42                                         ` Badalian Vyacheslav
2009-01-19  7:57                                           ` Jarek Poplawski
2009-01-20  1:29                                             ` David Miller

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=20090115105417.GG5461@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ccaputo@alt.net \
    --cc=denys@visp.net.lb \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=slavon@bigtelecom.ru \
    --cc=tglx@linutronix.de \
    /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