mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	George Anzinger <george@mvista.com>,
	"Paul E. McKenney" <paulmck@us.ibm.com>
Subject: Re: [PATCH] ktimers subsystem
Date: Wed, 21 Sep 2005 15:28:01 +0400	[thread overview]
Message-ID: <433143C1.8D1C6F9C@tv-sign.ru> (raw)

Thomas Gleixner wrote:
>
> +static int internal_restart_ktimer(struct ktimer *timer, nsec_t *tim,
> +				   int mode)
> +{
> +	struct ktimer_base *base, *new_base;
> +  	unsigned long flags;
> +	int ret;
> +
> +	BUG_ON(!timer->function);
> +
> + retry:
> +	base = lock_ktimer_base(timer, &flags);
> +
> +	/* Remove an active timer from the queue */
> +	ret = remove_ktimer(timer, base);
> +
> +	/* Switch the timer base, if necessary */
> +	new_base = switch_ktimer_base(timer, base);
> +
> +	/* SMP  */
> +	if (ktimer_base_can_change && unlikely(!new_base)){
> +		spin_unlock_irqrestore(&base->lock, flags);
> +		wait_for_ktimer(timer);
> +		goto retry;
> +	}

This is deadlockable.

The caller of modify_ktimer()->internal_restart_ktimer() can hold locks
which would prevent the completion of the ktimer->function().

Also, I don't understand why the timer is deleted _before_ checking that
new_base != NULL. This way you can delete the timer (ret == 1), then goto
retry, then get ret == 0.

Oleg.

             reply	other threads:[~2005-09-21 11:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-21 11:28 Oleg Nesterov [this message]
2005-09-21 18:20 ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19 16:48 [ANNOUNCE] " tglx
2005-09-19 16:48 ` [PATCH] " tglx

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=433143C1.8D1C6F9C@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@us.ibm.com \
    --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

Powered by JetHome