public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gabriel C <crazy@frugalware.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Gabriel C <nix.or.die@googlemail.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	LKML <linux-kernel@vger.kernel.org>,
	Adrian Bunk <bunk@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Natalie Protasevich <protasnb@gmail.com>,
	andi-bz@firstfloor.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: 2.6.25-rc5-git6: Reported regressions from 2.6.24
Date: Sat, 22 Mar 2008 23:41:10 +0100	[thread overview]
Message-ID: <47E58B06.8020905@frugalware.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0803222113541.3781@apollo.tec.linutronix.de>

Thomas Gleixner wrote:
> On Sat, 22 Mar 2008, Thomas Gleixner wrote:
>> On Sat, 22 Mar 2008, Gabriel C wrote:
>>> With this one TSC is fine but now I get a warning on boot :
>> Good. It confirms my assumptions about the root cause.
>>
>>> [    0.041037] ------------[ cut here ]------------
>>> [    0.041052] WARNING: at arch/x86/kernel/smp_32.c:562 native_smp_call_function_mask+0x23/0x11e()
>> Grr. I'll work out a solution for that one.
> 
> Gabriel,
> 
> I'm happy to rack your nerves some more.

No worries :) 

> 
> After discussing the issue with Peter and Ingo the following solution
> seems to be the one which is the least intrusive. 
> 
> Can you please give it a test ride ?

Done , git head + Andi's patch + this version of your patch does work here.

Also time-warp-test is just fine and everything else seems to work.


> ---
>  include/linux/sched.h |    6 ++++++
>  kernel/sched.c        |   42 ++++++++++++++++++++++++++++++++++++++++++
>  kernel/timer.c        |   10 +++++++++-
>  3 files changed, 57 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/include/linux/sched.h
> ===================================================================
> --- linux-2.6.orig/include/linux/sched.h
> +++ linux-2.6/include/linux/sched.h
> @@ -1541,6 +1541,12 @@ static inline void idle_task_exit(void) 
>  
>  extern void sched_idle_next(void);
>  
> +#ifdef CONFIG_NO_HZ
> +extern void wake_up_idle_cpu(int cpu);
> +#else
> +static inline void wake_up_idle_cpu(int cpu) { }
> +#endif
> +
>  #ifdef CONFIG_SCHED_DEBUG
>  extern unsigned int sysctl_sched_latency;
>  extern unsigned int sysctl_sched_min_granularity;
> Index: linux-2.6/kernel/sched.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched.c
> +++ linux-2.6/kernel/sched.c
> @@ -848,6 +848,48 @@ static inline void resched_task(struct t
>  	__resched_task(p, TIF_NEED_RESCHED);
>  }
>  
> +#ifdef CONFIG_NO_HZ
> +/*
> + * When add_timer_on() enqueues a timer into the timer wheel of an
> + * idle CPU then this timer might expire before the next timer event
> + * which is scheduled to wake up that CPU. In case of a completely
> + * idle system the next event might even be infinite time into the
> + * future. wake_up_idle_cpu() ensures that the CPU is woken up and
> + * leaves the inner idle loop so the newle added timer is taken into
> + * account when the CPU goes back to idle and evaluates the timer
> + * wheel for the next timer event.
> + */
> +void wake_up_idle_cpu(int cpu)
> +{
> +	struct rq *rq = cpu_rq(cpu);
> +
> +	if (cpu == smp_processor_id())
> +		return;
> +
> +	/*
> +	 * This is safe, as this function is called with the timer
> +	 * wheel base lock of (cpu) held. When the CPU is on the way
> +	 * to idle and has not yet set rq->curr to idle then it will
> +	 * be serialized on the timer wheel base lock and take the new
> +	 * timer into account automatically.
> +	 */
> +	if (rq->curr != rq->idle)
> +		return;
> +
> +	/*
> +	 * We can set TIF_RESCHED on the idle task of the other CPU
> +	 * lockless. The worst case is that the other CPU runs the
> +	 * idle task through an additional NOOP schedule()
> +	 */
> +	set_tsk_thread_flag(rq->idle, TIF_NEED_RESCHED);
> +
> +	/* NEED_RESCHED must be visible before we test polling */
> +	smp_mb();
> +	if (!tsk_is_polling(rq->idle))
> +		smp_send_reschedule(cpu);
> +}
> +#endif
> +
>  #ifdef CONFIG_SCHED_HRTICK
>  /*
>   * Use HR-timers to deliver accurate preemption points.
> Index: linux-2.6/kernel/timer.c
> ===================================================================
> --- linux-2.6.orig/kernel/timer.c
> +++ linux-2.6/kernel/timer.c
> @@ -451,10 +451,18 @@ void add_timer_on(struct timer_list *tim
>  	spin_lock_irqsave(&base->lock, flags);
>  	timer_set_base(timer, base);
>  	internal_add_timer(base, timer);
> +	/*
> +	 * Check whether the other CPU is idle and needs to be
> +	 * triggered to reevaluate the timer wheel when nohz is
> +	 * active. We are protected against the other CPU fiddling
> +	 * with the timer by holding the timer base lock. This also
> +	 * makes sure that a CPU on the way to idle can not evaluate
> +	 * the timer wheel.
> +	 */
> +	wake_up_idle_cpu(cpu);
>  	spin_unlock_irqrestore(&base->lock, flags);
>  }
>  
> -
>  /**
>   * mod_timer - modify a timer's timeout
>   * @timer: the timer to be modified

  reply	other threads:[~2008-03-22 22:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 23:18 2.6.25-rc5-git6: Reported regressions from 2.6.24 Rafael J. Wysocki
2008-03-16 23:33 ` Linus Torvalds
2008-03-16 23:38   ` Rafael J. Wysocki
2008-03-17  0:20 ` Gabriel C
2008-03-17 16:17   ` Thomas Gleixner
2008-03-17 18:20     ` Gabriel C
2008-03-18  4:01       ` Gabriel C
2008-03-18  4:24         ` Gabriel C
2008-03-21 15:24         ` Gabriel C
2008-03-21 16:26           ` Thomas Gleixner
2008-03-21 16:46             ` Gabriel C
2008-03-21 18:11               ` Gabriel C
2008-03-21 18:49                 ` Thomas Gleixner
2008-03-21 19:23                   ` Gabriel C
2008-03-21 20:55                     ` Gabriel C
2008-03-21 21:15                       ` Thomas Gleixner
2008-03-21 21:59                         ` Gabriel C
2008-03-21 22:09                           ` Thomas Gleixner
2008-03-22 11:21                             ` Thomas Gleixner
2008-03-22 13:34                               ` Gabriel C
2008-03-22 14:30                                 ` Thomas Gleixner
2008-03-22 15:13                                   ` Gabriel C
2008-03-22 16:32                                     ` Thomas Gleixner
2008-03-22 21:55                                       ` Thomas Gleixner
2008-03-22 22:41                                         ` Gabriel C [this message]
2008-03-23 11:00                                           ` Gabriel C
2008-03-23 23:31                                             ` Gabriel C
2008-03-24 10:24                                               ` Thomas Gleixner
2008-03-24 22:33                                                 ` Gabriel C
2008-03-25  8:06                                                   ` Thomas Gleixner
2008-03-26 12:43                                                     ` Gabriel C
2008-03-26 14:51                                                       ` Thomas Gleixner
2008-03-22 14:25                               ` Andi Kleen
2008-03-22 14:41                                 ` Thomas Gleixner
2008-03-17  6:47 ` Jason Wu
2008-03-17 21:36   ` Rafael J. Wysocki
2008-03-23 19:01 ` Christian Kujau
2008-03-23 19:06   ` Rafael J. Wysocki
2008-03-23 19:40     ` Chr
2008-03-23 21:17 ` Christian Kujau
2008-03-23 21:29   ` Rafael J. Wysocki

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=47E58B06.8020905@frugalware.org \
    --to=crazy@frugalware.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi-bz@firstfloor.org \
    --cc=bunk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nix.or.die@googlemail.com \
    --cc=protasnb@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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