public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiaotian Feng <dfeng@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Magnus Damm <damm@igel.co.jp>,
	H Hartley Sweeten <hsweeten@visionengravers.com>
Subject: Re: [PATCH] clockevent: don't remove broadcast device when cpu is dead
Date: Wed, 13 Jan 2010 09:48:40 +0800	[thread overview]
Message-ID: <4B4D2678.5090601@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1001121300190.6420@localhost.localdomain>

On 01/12/2010 09:20 PM, Thomas Gleixner wrote:
> On Thu, 7 Jan 2010, Xiaotian Feng wrote:
>
>> Marc reported BUG during shutdown, after debugging, kernel is trying
>> to remove a broadcast device which mode is CLOCK_EVT_MODE_ONESHOT.
>>
>> The root cause for this bug is that in clockevents_notify,
>> "cpumask_weight(dev->cpumask) == 1" is always true even if dev is a
>
> Why is cpumask_weight(dev->cpumask) == 1 always true when we shutdown
> a non boot cpu ?
>
> The broadcast device is not a per cpu device and the cpumask should
> not only contain the CPU which is shut down !

At least for hpet broadcast dev, it's dev->cpumask is only contain the 
CPU which it is initialized from.
And for broadcast device, kernel is using tick_broadcast_mask not 
dev->cpumask, right?

>
> The patch is papering over the real problem.
>
> Marc, can you please apply the following debug patch and provide the
> dmesg outputs from boot and shutdown ?
>
> Thanks,
>
> 	tglx
> ---
>
> Index: linux-2.6-tip/kernel/time/clockevents.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/time/clockevents.c
> +++ linux-2.6-tip/kernel/time/clockevents.c
> @@ -186,7 +186,7 @@ void clockevents_register_device(struct
>   	BUG_ON(!dev->cpumask);
>
>   	raw_spin_lock_irqsave(&clockevents_lock, flags);
> -
> +	printk(KERN_ERR "CE register %p %s\n", dev, dev->name);
>   	list_add(&dev->list,&clockevent_devices);
>   	clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
>   	clockevents_notify_released();
> @@ -220,6 +220,7 @@ void clockevents_exchange_device(struct
>   	 * released list and do a notify add later.
>   	 */
>   	if (old) {
> +		printk(KERN_INFO "CE Release %p %s\n", old, old->name);
>   		clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED);
>   		list_del(&old->list);
>   		list_add(&old->list,&clockevents_released);
> @@ -260,6 +261,13 @@ void clockevents_notify(unsigned long re
>   		list_for_each_entry_safe(dev, tmp,&clockevent_devices, list) {
>   			if (cpumask_test_cpu(cpu, dev->cpumask)&&
>   			cpumask_weight(dev->cpumask) == 1) {
> +				if (dev->mode != CLOCK_EVT_MODE_UNUSED) {
> +					printk(KERN_INFO
> +					       "CE Remove %p %s bc: %d\n",
> +					       dev, dev->name,
> +					       tick_is_broadcast_device(dev));
> +					continue;
> +				}
>   				BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
>   				list_del(&dev->list);
>   			}
> Index: linux-2.6-tip/kernel/time/tick-broadcast.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/time/tick-broadcast.c
> +++ linux-2.6-tip/kernel/time/tick-broadcast.c
> @@ -72,6 +72,8 @@ int tick_check_broadcast_device(struct c
>   	     (dev->features&  CLOCK_EVT_FEAT_C3STOP))
>   		return 0;
>
> +	printk(KERN_INFO "CE set broadcast %p %s\n", dev, dev->name);
> +
>   	clockevents_exchange_device(NULL, dev);
>   	tick_broadcast_device.evtdev = dev;
>   	if (!cpumask_empty(tick_get_broadcast_mask()))
>


  parent reply	other threads:[~2010-01-13  1:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-07  3:22 [PATCH] clockevent: don't remove broadcast device when cpu is dead Xiaotian Feng
2010-01-12  2:24 ` Xiaotian Feng
2010-01-12 13:20 ` Thomas Gleixner
2010-01-13  1:28   ` Marc Dionne
2010-01-13  1:48   ` Xiaotian Feng [this message]
2010-01-13 22:08     ` Thomas Gleixner
2010-01-14 11:43       ` Xiaotian Feng
2010-01-14 11:52         ` Thomas Gleixner
2010-01-18 13:48 ` [tip:timers/urgent] clockevent: Don't " tip-bot for Xiaotian Feng

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=4B4D2678.5090601@redhat.com \
    --to=dfeng@redhat.com \
    --cc=damm@igel.co.jp \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --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