public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH rc4-mm2 2/2] posix-timers: use try_to_del_timer_sync()
Date: Tue, 24 May 2005 08:27:54 -0700	[thread overview]
Message-ID: <429347FA.8060203@mvista.com> (raw)
In-Reply-To: <4292F5FF.1A92086C@tv-sign.ru>

Oleg Nesterov wrote:
> George Anzinger wrote:
> 
>>Oleg Nesterov wrote:
>>
>>>This patch removes timer_active/set_timer_inactive which plays with
>>>timer_list's internals in favour of using try_to_del_timer_sync(),
>>>which was introduced in the previous patch.
>>
>>Is there a particular reason for this, like it does not work, for example, or
>>are you just trying to clean up code?
> 
> 
> It's a cleanup, I think that current code is correct.
> 
> 
>>If this currently works, please leave it alone.
> 
> 
> Ok.
> 
> 
>>We also note that this code is the subject of a patch to the RT patch to cover
>>the same issue when softirqs are run from threads and therefor allow
>>posix_timer_fn to be preempted.  (That fix being mainly to expand usage from
>>just SMP to SMP || SOFTIRQ_PREEMPT.)
> 
> 
> I guess you are talking about this patch:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=111566867218576
> 
> 
>>Also, I think that del_timer_sync and friends need to be turned on if soft_irq
>>is preemptable.
> 
> 
> I agree completely.
> 
> 
>>+ * For RT the timer call backs are preemptable.  This means that folks
>>+ * trying to delete timers may run into timers that are "active" for
>>+ * long times.  To help out with this we provide a wake up function to
>>+ * wake up a caller who wants waking when a timer clears the call back.
>>+ * This is the same sort of thing that the del_timer_sync does, but we
>>+ * need (in the HRT case) to cover two lists and not just the one.
>>+ */
>>+#ifdef CONFIG_PREEMPT_SOFTIRQS
>>+#include <linux/wait.h>
>>+static DECLARE_WAIT_QUEUE_HEAD(timer_wake_queue);
>>+#define wake_timer_waiters() wake_up(&timer_wake_queue)
>>+#define wait_for_timer(timer) wait_event(timer_wake_queue, !timer_active(timer))
> 
> 
> I'm not an expert at all, so I may be wrong, but I don't think
> it's a good idea.
> 
> I think it is bad if __run_timers() could be preempted while
> ->running_timer != NULL. This will interact badly with __mod_timer,
> del_timer_sync. I think that __run_timers() should do:
> 
> 	set_running_timer(base, timer);
> 	preempt_disable();
> 	spin_unlock_irq(&base->lock);
> 
> 	timer->function();
> 
> 	set_running_timer(base, NULL);
> 	preempt_enable();
> 	spin_lock_irq(&base->lock);
> 
> What do you think?

First, I think we need to get Ingo in the discussion. :)

Second, the RT patch has been running this way with little problems, save a 
REALLY intense test we (Monta Vista) have run that, from time to time, shows 
this to be a problem in the posix-timer code that is fixed by including 
SOFTIRQ_PREEMPT as well as SMP in the timer ifdefs.

One thing I do see there (in the RT patch) is a change to del_timer_sync to wait 
for the timer call back to complete rather than to loop...
> 
-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/

  reply	other threads:[~2005-05-24 15:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-22 14:57 [PATCH rc4-mm2 2/2] posix-timers: use try_to_del_timer_sync() Oleg Nesterov
2005-05-24  0:04 ` George Anzinger
2005-05-24  0:29   ` Andrew Morton
2005-05-24  0:52     ` George Anzinger
2005-05-24  9:38   ` Oleg Nesterov
2005-05-24 15:27     ` George Anzinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-05-26 16:16 George Anzinger
2005-05-26 17:22 ` Oleg Nesterov

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=429347FA.8060203@mvista.com \
    --to=george@mvista.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    /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