Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-30 Thread Tony Lindgren
* Ohad Ben-Cohen o...@wizery.com [101123 07:27]: Add a common, platform-independent, hwspinlock framework. Hardware spinlock devices are needed, e.g., in order to access data that is shared between remote processors, that otherwise have no alternative mechanism to accomplish synchronization

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-30 Thread Ohad Ben-Cohen
On Tue, Nov 30, 2010 at 11:00 AM, Tony Lindgren t...@atomide.com wrote: Do we even need the hwspin_lock variants, I personally don't have any specific use case in mind. It's just a simple wrapper over the _timeout variants, provided for API completeness, but - why can't we always use the

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-30 Thread Tony Lindgren
* Ohad Ben-Cohen o...@wizery.com [101130 14:10]: On Tue, Nov 30, 2010 at 11:00 AM, Tony Lindgren t...@atomide.com wrote: Do we even need the hwspin_lock variants, I personally don't have any specific use case in mind. It's just a simple wrapper over the _timeout variants, provided for

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-29 Thread Ohad Ben-Cohen
On Sat, Nov 27, 2010 at 12:53 AM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Sat, Nov 27, 2010 at 12:18:55AM +0200, Ohad Ben-Cohen wrote: But then there's the other (quite reasonable) claim that says we shouldn't crash the machine because of a non fatal bug: if a crappy driver

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-29 Thread Ohad Ben-Cohen
On Sat, Nov 27, 2010 at 3:24 AM, David Brownell davi...@pacbell.net wrote: Your intent generic is fine, but you've not achieved it and thus I think you shouldn't imply that you have.   Dropping the word generic should  suffice; it _is_ a framework, and maybe the next person working with

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-29 Thread Ohad Ben-Cohen
Hi Olof, On Sat, Nov 27, 2010 at 12:51 AM, Olof Johansson o...@lixom.net wrote: +int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) +{ +     int ret; + +     if (unlikely(!hwlock)) { +             pr_err(invalid hwlock\n); These kind of errors can

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Ohad Ben-Cohen
On Fri, Nov 26, 2010 at 6:59 AM, Olof Johansson o...@lixom.net wrote: +#define pr_fmt(fmt)    %s: fmt, __func__ Not used. Yes, it is, check out how the pr_* macros are implemented: #define pr_info(fmt, ...) \ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) I use it to ensure that the

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Russell King - ARM Linux
On Fri, Nov 26, 2010 at 10:53:10AM +0200, Ohad Ben-Cohen wrote: +int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) +{ +     int ret; + +     if (unlikely(!hwlock)) { +             pr_err(invalid hwlock\n); These kind of errors can get very spammy

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Ohad Ben-Cohen
On Fri, Nov 26, 2010 at 11:18 AM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Fri, Nov 26, 2010 at 10:53:10AM +0200, Ohad Ben-Cohen wrote: +int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) +{ +     int ret; + +     if (unlikely(!hwlock)) {

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Russell King - ARM Linux
On Fri, Nov 26, 2010 at 12:16:39PM +0200, Ohad Ben-Cohen wrote: On Fri, Nov 26, 2010 at 11:18 AM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Fri, Nov 26, 2010 at 10:53:10AM +0200, Ohad Ben-Cohen wrote: +int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Olof Johansson
On Fri, Nov 26, 2010 at 12:18:49AM -0700, Grant Likely wrote: On Thu, Nov 25, 2010 at 9:59 PM, Olof Johansson o...@lixom.net wrote: On Tue, Nov 23, 2010 at 05:38:57PM +0200, Ohad Ben-Cohen wrote: +#define pr_fmt(fmt)    %s: fmt, __func__ Not used. pr_fmt() is a magic #define that

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Ohad Ben-Cohen
On Fri, Nov 26, 2010 at 12:45 PM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Fri, Nov 26, 2010 at 12:16:39PM +0200, Ohad Ben-Cohen wrote: On Fri, Nov 26, 2010 at 11:18 AM, Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Fri, Nov 26, 2010 at 10:53:10AM +0200, Ohad

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread Russell King - ARM Linux
On Sat, Nov 27, 2010 at 12:18:55AM +0200, Ohad Ben-Cohen wrote: But then there's the other (quite reasonable) claim that says we shouldn't crash the machine because of a non fatal bug: if a crappy driver messes up, the user (not the developer) will most probably prefer the machine to keep

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-26 Thread David Brownell
On Fri, 2010-11-26 at 09:34 +0200, Ohad Ben-Cohen wrote: On Thu, Nov 25, 2010 at 10:22 PM, David Brownell davi...@pacbell.net wrote: So there's no strong reason to think this is actually ggeneric. Function names no longer specify OMAP, but without other hardware under the interface,

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-25 Thread Ohad Ben-Cohen
On Thu, Nov 25, 2010 at 8:05 AM, Kamoolkar, Mugdha mug...@ti.com wrote: Consider a software module on top of the hwspinlock, which provides a generic way for multi-core critical section, say GateMP. This module enables users to create critical section objects by name. Any other client can open

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-25 Thread David Brownell
On Thu, 2010-11-25 at 08:40 +0200, Ohad Ben-Cohen wrote: On Thu, Nov 25, 2010 at 5:59 AM, David Brownell davi...@pacbell.net wrote: My rule of thumb is that nothing is generic until at least three whatever-it-is instances plug in to it. Sometimes this is called the Rule of Three.

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-25 Thread Olof Johansson
Hi, In addition to other comments from others, here are a few on the implementation. There's a fair amount of potentially spammy and redundant debug code left in the generic code. I've commented on some of them below, but the same comments would apply to other locations as well. On Tue, Nov

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-25 Thread Grant Likely
On Thu, Nov 25, 2010 at 9:59 PM, Olof Johansson o...@lixom.net wrote: On Tue, Nov 23, 2010 at 05:38:57PM +0200, Ohad Ben-Cohen wrote: +#define pr_fmt(fmt)    %s: fmt, __func__ Not used. pr_fmt() is a magic #define that changes the behaviour of the pr_*() macros. See include/linux/kernel.h

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-25 Thread Ohad Ben-Cohen
On Thu, Nov 25, 2010 at 10:22 PM, David Brownell davi...@pacbell.net wrote: So there's no strong reason to think this is actually ggeneric.  Function names no longer specify OMAP, but without other hardware under the interface, calling it generic reflects more optimism than reality.  (That

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-24 Thread Ohad Ben-Cohen
Hi Mugdha, On Wed, Nov 24, 2010 at 9:44 AM, Kamoolkar, Mugdha mug...@ti.com wrote: How do multiple clients get a handle that they can use? Are they expected to share the handle they get from the call above? Currently, yes. What if they are independent clients with no means of communication

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-24 Thread David Brownell
My rule of thumb is that nothing is generic until at least three whatever-it-is instances plug in to it. Sometimes this is called the Rule of Three. Other than OMAP, what's providing hardware spinlocks that plug into this framework? - Dave -- To unsubscribe from this list: send the line

RE: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-24 Thread Kamoolkar, Mugdha
Lindgren; Cousson, Benoit; Grant Likely; Kanigeri, Hari; Anna, Suman; Kevin Hilman; Arnd Bergmann Subject: Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework Hi Mugdha, On Wed, Nov 24, 2010 at 9:44 AM, Kamoolkar, Mugdha mug...@ti.com wrote: How do multiple clients get a handle

Re: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-24 Thread Ohad Ben-Cohen
On Thu, Nov 25, 2010 at 5:59 AM, David Brownell davi...@pacbell.net wrote: My rule of thumb is that nothing is generic until at least three whatever-it-is instances plug in to it.  Sometimes this is called the Rule of Three. Other than OMAP, what's providing hardware spinlocks that plug

[PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-23 Thread Ohad Ben-Cohen
Add a common, platform-independent, hwspinlock framework. Hardware spinlock devices are needed, e.g., in order to access data that is shared between remote processors, that otherwise have no alternative mechanism to accomplish synchronization and mutual exclusion operations. Signed-off-by: Ohad

RE: [PATCH v2 1/4] drivers: hwspinlock: add generic framework

2010-11-23 Thread Kamoolkar, Mugdha
: a...@linux-foundation.org; Greg KH; Tony Lindgren; Cousson, Benoit; Grant Likely; Kanigeri, Hari; Anna, Suman; Kevin Hilman; Arnd Bergmann; Ohad Ben-Cohen Subject: [PATCH v2 1/4] drivers: hwspinlock: add generic framework Add a common, platform-independent, hwspinlock framework. Hardware