public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Teoh <htmldeveloper@gmail.com>
To: Sol Kavy <skavy@ubicom.com>
Cc: linux-newbie@vger.kernel.org
Subject: Re: IRQ Tracing Problem in Linux 2.6.28 Kernel
Date: Wed, 15 Apr 2009 03:06:49 +0000	[thread overview]
Message-ID: <804dabb00904142006l101fc13ai3fd38b4e30b4081a@mail.gmail.com> (raw)
In-Reply-To: <CB2DD11991B27C4F99935E6229450D32042AAB29@STORK.scenix.com>

Just my guess......

On Tue, Apr 14, 2009 at 10:58 PM, Sol Kavy <skavy@ubicom.com> wrote:
>
> I have discovered why other architectures do not have the same problem.   The back trace indicates a real defect (i.e. deadlock) in the generic code.
>
> Most architectures override sched_clock() with their own version.  Kernel/sched_clock.c:38 is a weak alias that will be overridden if an arch directory supplies its own.
>
> Most of the arch directories provide an implementation that directly access the jiffies_64 variable "without" acquiring the xtime_lock.
>
> Some of the implementations provide a "poor" implementation in that the value of the jiffies_64 during a 32 rollover is not taken into account.  If sched_clock() is to be called while holding xtime_lock, the core implementation should be modified not to call get_jiffies_64() (which requires the xlock) but to use something like the following:
>
> unsigned long long sched_clock(void)
> {
>        unsigned long long my_jiffies;
>        unsigned long jiffies_top;
>        unsigned long jiffies_bottom;
>
>        do {
>                jiffies_top = jiffies_64 >> 32;
>                jiffies_bottom = jiffies_64 & 0xffffffff;

in general this type of operation is only done when u are in 32bit
mode.   In 64bit mode, u can do it in ONE atomic assembly
instruction.....so no locking needed.

>        } while(unlikely(jiffies_top != (unsigned long)(jiffies_64 >> 32)));
>
>        my_jiffies = ((unsigned long long)jiffies_top << 32) | (jiffies_bottom);
>        return (my_jiffies - INITIAL_JIFFIES) * (NSEC_PER_SEC / HZ);
> }

-- 
Regards,
Peter Teoh
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

  reply	other threads:[~2009-04-15  3:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 22:00 IRQ Tracing Problem in Linux 2.6.28 Kernel Sol Kavy
2009-04-14 12:51 ` Gedare Bloom
2009-04-14 16:53   ` Sol Kavy
2009-04-14 22:58 ` Sol Kavy
2009-04-15  3:06   ` Peter Teoh [this message]
2009-04-24 15:50 ` Jeffrey Cao

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=804dabb00904142006l101fc13ai3fd38b4e30b4081a@mail.gmail.com \
    --to=htmldeveloper@gmail.com \
    --cc=linux-newbie@vger.kernel.org \
    --cc=skavy@ubicom.com \
    /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