mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Colin Ian King <colin.king@canonical.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] softlockup: stop spurious softlockup messages due to overflow
Date: Mon, 15 Mar 2010 15:29:48 +0100	[thread overview]
Message-ID: <1268663388.3154.30.camel@edumazet-laptop> (raw)
In-Reply-To: <1268661673-21638-1-git-send-email-colin.king@canonical.com>

Le lundi 15 mars 2010 à 14:01 +0000, Colin Ian King a écrit :
> Ensure additions on touch_ts do not overflow.  This can occur when
> the top 32 bits of the TSC reach 0xffffffff causing additions to
> touch_ts to overflow and this in turn generates spurious softlockup
> warnings.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  kernel/softlockup.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/softlockup.c b/kernel/softlockup.c
> index 0d4c789..90d9aa0 100644
> --- a/kernel/softlockup.c
> +++ b/kernel/softlockup.c
> @@ -111,10 +111,10 @@ int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
>  void softlockup_tick(void)
>  {
>  	int this_cpu = smp_processor_id();
> -	unsigned long touch_ts = per_cpu(softlockup_touch_ts, this_cpu);
> +	unsigned long long touch_ts = per_cpu(softlockup_touch_ts, this_cpu);
>  	unsigned long print_ts;
>  	struct pt_regs *regs = get_irq_regs();
> -	unsigned long now;
> +	unsigned long long now;
>  
>  	/* Is detection switched off? */
>  	if (!per_cpu(softlockup_watchdog, this_cpu) || softlockup_thresh <= 0) {
> @@ -165,7 +165,7 @@ void softlockup_tick(void)
>  	per_cpu(softlockup_print_ts, this_cpu) = touch_ts;
>  
>  	spin_lock(&print_lock);
> -	printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
> +	printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %llus! [%s:%d]\n",
>  			this_cpu, now - touch_ts,
>  			current->comm, task_pid_nr(current));
>  	print_modules();

This looks wrong, touch_ts is a long, not a long long.

You probably want to change the comparisons instead.

if (now > touch_ts + softlockup_thresh/2)
	wake_up_process(per_cpu(softlockup_watchdog, this_cpu));
if (now <= (touch_ts + softlockup_thresh))
	return;
	
->

if ((long)(now - touch_ts) > softlockup_thresh/2)
	wake_up_process(per_cpu(softlockup_watchdog, this_cpu));
if ((long)(now - touch_ts) <= softlockup_thresh))
	return;

Or use standard time_after()/time_before() macros.



  reply	other threads:[~2010-03-15 14:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15 14:01 Colin Ian King
2010-03-15 14:29 ` Eric Dumazet [this message]
2010-03-16 10:12   ` Ingo Molnar
2010-03-18 13:22     ` Colin Ian King
2010-03-18 15:25       ` Ingo Molnar
2010-03-18 20:45         ` Eric Dumazet
2010-03-19 10:28           ` Colin Ian King
2010-03-22  7:45             ` [tip:core/urgent] softlockup: Stop " tip-bot for Colin Ian King

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=1268663388.3154.30.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=colin.king@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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

all inboxes | Powered by JetHome®