Messages in this thread | | | Subject | Re: [PATCH][RFC] Spinlock-timeout | From | Benjamin Herrenschmidt <> | Date | Fri, 11 Jun 2004 10:49:36 -0500 |
| |
> 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
Ben.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/
| |