Re: [PATCH][RFC] Spinlock-timeout

From: Benjamin Herrenschmidt
Date: Fri Jun 11 2004 - 17:14:12 EST


On Fri, 2004-06-11 at 16:19, moilanen@xxxxxxxxxxxxxx wrote:
> > > Here's a revision to the patch that uses a HAVE_ARCH_GET_TB to allow
> > > archs use their timebases if they have one, and if they don't, it uses
> > > jiffies. time_after_eq() is used to do the jiffy checking.
> > >
> > > I also left all of the arch/*/Kconfig changes in until a debug Kconfig
> > > is done. I pretty much added in the spinlock timeout on all archs that
> > > have CONFIG_DEBUG_SPINLOCK. If I missed your arch, I'm sorry.
> >
> > Nah, that's not how the abstraction should be done. Much simpler in
> > fact. Just do something like this in the generic code:
> >
> > #ifndef ARCH_HAS_SPINLOCK_TIMEOUT
> > #define get_spinlock_timeout() (jiffies + (SPINLOCK_TIMEOUT * HZ))
> > #define check_spinlock_timeout(timeout) (time_after_eq(jiffies, timeout))
> > #endif
> >
> > That's all. Then, any arch who has it's own implementation of these 2
> > function will #define ARCH_HAS_SPINLOCK_TIMEOUT and implement them the
> > way it wants. We shouldn't let anything like get_tb() slip into a common
> > file, it's totally PPC specific. Other archs may have different counters
> > they can use to impement the same thing. That part should be entirely
> > self contained in asm-xxx
>
> That's much better. Here's hopefully a version that could be merged.

Hehe, almost ;) There's a bit of non-unified diff at the end ...

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/