Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
El Mon, Apr 23, 2007 at 09:17:53AM +0100 Christoph Hellwig ha dit:

> On Sun, Apr 22, 2007 at 07:50:36PM -0400, Kyle Moffett wrote:
> > On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
> > >use spinlock instead of binary mutex in idt77252 driver
> > 
> > I think you really meant: "Use mutex instead of binary semaphore in  
> > idt77252 driver", since this is a binary semaphore (not a mutex,  
> > which are always binary):
> 
> And the binary semaphore terminology i a little confusing. struct
> semaphore is a full counting semaphore that is only used as a binary
> semaphore if we want to speak in CS terms.  Than everyone else just
> caled them semaphore before these patches started to show up :)

i'll take your suggestion into account for future patches. my
intention behind the usage of the term binary semaphore was to be more
precise, but i agree that it can be confusing

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

I am incapable of conceiving infinity, and yet I do not accept finity
  (Simone de Beauvoir)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Christoph Hellwig
On Sun, Apr 22, 2007 at 07:50:36PM -0400, Kyle Moffett wrote:
> On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
> >use spinlock instead of binary mutex in idt77252 driver
> 
> I think you really meant: "Use mutex instead of binary semaphore in  
> idt77252 driver", since this is a binary semaphore (not a mutex,  
> which are always binary):

And the binary semaphore terminology i a little confusing. struct
semaphore is a full counting semaphore that is only used as a binary
semaphore if we want to speak in CS terms.  Than everyone else just
caled them semaphore before these patches started to show up :)

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


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Satyam Sharma

Hi,

On 4/23/07, Eddie C. Dost <[EMAIL PROTECTED]> wrote:

as long as mutexes are not converted to nop when CONFIG_SMP is not
defined (I don't know what current kernels do), this is of course
correct. You need to verify the headerfiles for the above.


Yes, even on UP different threads accessing the same data could race.
Mutexes (== binary semaphores) are *required* to synchronize access to
shared data.

You might be confusing mutexes with spinlocks. Spinlocks _are_
compiled away on UP (actually !CONFIG_SMP && !CONFIG_PREEMPT) kernels,
but that is still safe because spinlocks are busy-waiting loops
(unlike mutexes and semaphores that block) and hence no thread is
allowed to sleep when holding a spinlock.


On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
> El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
> > Please note that the semaphore is used to lock the idt77252 config
> > tables among multiple users including atmsigd even on single processor
> > machines. Does this work with mutexes?
>
> afaik mutexes have the same behaviour as binary semaphores that are
> used as mutexes (always locked and unlocked by the same
> process/thread):


Mutexes / binary semaphores / spinlocks are used to synchronize access
to shared data by *multiple* threads ... there is no meaning in
locking access to something if we know only one thread will ever touch
it.

Cheers,
S
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
hi,

El Mon, Apr 23, 2007 at 09:40:19AM +0200 Eddie C. Dost ha dit:

> as long as mutexes are not converted to nop when CONFIG_SMP is not
> defined (I don't know what current kernels do), this is of course
> correct. You need to verify the headerfiles for the above.

i just checked this, neither the mutex header nor implementation files
handle things different for CONFIG_SMP. 

thanks for your comments

> On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
> > El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
> >  
> > > Please note that the semaphore is used to lock the idt77252 config
> > > tables among multiple users including atmsigd even on single processor
> > > machines. Does this work with mutexes?
> > 
> > afaik mutexes have the same behaviour as binary semaphores that are
> > used as mutexes (always locked and unlocked by the same
> > process/thread):
> > 
> > ".. the semaphore type can officially be considered to be on its way
> > out. New code should not use semaphores, and old code which uses
> > semaphores as mutexes should be converted over when an opportunity
> > presents itself."
> > 
> > http://lwn.net/Articles/167034/
> > 
> > please correct me if i'm wrong, i'm just doing my first steps with
> > linux kernel development

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

 You must have a plan. If you don't have a plan,
   you'll become part of somebody else's plan
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Eddie C. Dost
Hi,

Please note that the semaphore is used to lock the idt77252 config
tables among multiple users including atmsigd even on single processor
machines. Does this work with mutexes?

Best regards,
Eddie

On Mon, Apr 23, 2007 at 08:55:20AM +0200, Matthias Kaehlcke wrote:
> El Sun, Apr 22, 2007 at 07:50:36PM -0400 Kyle Moffett ha dit:
> 
> > On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
> > >use spinlock instead of binary mutex in idt77252 driver
> > 
> > I think you really meant: "Use mutex instead of binary semaphore in  
> > idt77252 driver", since this is a binary semaphore (not a mutex,  
> > which are always binary):
> > >-  struct semaphoremutex;
> > 
> > and this is a mutex, not a spinlock:
> > >+  struct mutexmutex;
> > 
> > Everything else looks good though
> 
> you're totally right. like in another patch i sent at the same time i
> messed up the description. as you point out it should read "Use mutex
> instead of binary semaphore in idt77252 driver". in the last days i
> reported some spinlock related bugs, i suppose that made me write
> spinlock instead of mutex ...
> 
> thanks for your comments
> 
> -- 
> Matthias Kaehlcke
> Linux Application Developer
> Barcelona
> 
> If you don't know where you are going,
>you will probably end up somewhere else
>  (Laurence J. Peter)
>  .''`.
> using free software / Debian GNU/Linux | http://debian.org  : :'  :
> `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-

-- 
Christian Dost
Technical Director R

ATecoM realizing visions GmbH
Pascalstrasse 67
D-52076 Aachen
Germany
Fon: +49/2408/9596-0
Fax: +49/2408/9596-900
Email: [EMAIL PROTECTED]
URL: http://www.atecom.com

Amtsgericht Aachen, HRB# 5941, Sitz: Aachen
Geschaeftsfuehrer: Bernd Leister, Robert Bonnie
USt.-Id. Nr. / VATID: DE 811 66 99 76
Steuernummer/Tax-ID: 225/5775/0558
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Eddie C. Dost
Hi,

as long as mutexes are not converted to nop when CONFIG_SMP is not
defined (I don't know what current kernels do), this is of course
correct. You need to verify the headerfiles for the above.

Regards,
Eddie

On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
> El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
>  
> > Please note that the semaphore is used to lock the idt77252 config
> > tables among multiple users including atmsigd even on single processor
> > machines. Does this work with mutexes?
> 
> afaik mutexes have the same behaviour as binary semaphores that are
> used as mutexes (always locked and unlocked by the same
> process/thread):
> 
> ".. the semaphore type can officially be considered to be on its way
> out. New code should not use semaphores, and old code which uses
> semaphores as mutexes should be converted over when an opportunity
> presents itself."
> 
> http://lwn.net/Articles/167034/
> 
> please correct me if i'm wrong, i'm just doing my first steps with
> linux kernel development
> 
> regards
> 
> -- 
> Matthias Kaehlcke
> Linux Application Developer
> Barcelona
> 
> C treats you like a consenting adult. Pascal treats you like a
>   naughty child. Ada treats you like a criminal
>   (Bruce Powel Douglass)
>  .''`.
> using free software / Debian GNU/Linux | http://debian.org  : :'  :
> `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-

-- 
Christian Dost
Technical Director R

ATecoM realizing visions GmbH
Pascalstrasse 67
D-52076 Aachen
Germany
Fon: +49/2408/9596-0
Fax: +49/2408/9596-900
Email: [EMAIL PROTECTED]
URL: http://www.atecom.com

Amtsgericht Aachen, HRB# 5941, Sitz: Aachen
Geschaeftsfuehrer: Bernd Leister, Robert Bonnie
USt.-Id. Nr. / VATID: DE 811 66 99 76
Steuernummer/Tax-ID: 225/5775/0558
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
 
> Please note that the semaphore is used to lock the idt77252 config
> tables among multiple users including atmsigd even on single processor
> machines. Does this work with mutexes?

afaik mutexes have the same behaviour as binary semaphores that are
used as mutexes (always locked and unlocked by the same
process/thread):

".. the semaphore type can officially be considered to be on its way
out. New code should not use semaphores, and old code which uses
semaphores as mutexes should be converted over when an opportunity
presents itself."

http://lwn.net/Articles/167034/

please correct me if i'm wrong, i'm just doing my first steps with
linux kernel development

regards

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

C treats you like a consenting adult. Pascal treats you like a
  naughty child. Ada treats you like a criminal
  (Bruce Powel Douglass)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
El Sun, Apr 22, 2007 at 07:50:36PM -0400 Kyle Moffett ha dit:

> On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
> >use spinlock instead of binary mutex in idt77252 driver
> 
> I think you really meant: "Use mutex instead of binary semaphore in  
> idt77252 driver", since this is a binary semaphore (not a mutex,  
> which are always binary):
> >-struct semaphoremutex;
> 
> and this is a mutex, not a spinlock:
> >+struct mutexmutex;
> 
> Everything else looks good though

you're totally right. like in another patch i sent at the same time i
messed up the description. as you point out it should read "Use mutex
instead of binary semaphore in idt77252 driver". in the last days i
reported some spinlock related bugs, i suppose that made me write
spinlock instead of mutex ...

thanks for your comments

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

If you don't know where you are going,
   you will probably end up somewhere else
 (Laurence J. Peter)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
El Sun, Apr 22, 2007 at 07:50:36PM -0400 Kyle Moffett ha dit:

 On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
 use spinlock instead of binary mutex in idt77252 driver
 
 I think you really meant: Use mutex instead of binary semaphore in  
 idt77252 driver, since this is a binary semaphore (not a mutex,  
 which are always binary):
 -struct semaphoremutex;
 
 and this is a mutex, not a spinlock:
 +struct mutexmutex;
 
 Everything else looks good though

you're totally right. like in another patch i sent at the same time i
messed up the description. as you point out it should read Use mutex
instead of binary semaphore in idt77252 driver. in the last days i
reported some spinlock related bugs, i suppose that made me write
spinlock instead of mutex ...

thanks for your comments

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

If you don't know where you are going,
   you will probably end up somewhere else
 (Laurence J. Peter)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
 
 Please note that the semaphore is used to lock the idt77252 config
 tables among multiple users including atmsigd even on single processor
 machines. Does this work with mutexes?

afaik mutexes have the same behaviour as binary semaphores that are
used as mutexes (always locked and unlocked by the same
process/thread):

.. the semaphore type can officially be considered to be on its way
out. New code should not use semaphores, and old code which uses
semaphores as mutexes should be converted over when an opportunity
presents itself.

http://lwn.net/Articles/167034/

please correct me if i'm wrong, i'm just doing my first steps with
linux kernel development

regards

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

C treats you like a consenting adult. Pascal treats you like a
  naughty child. Ada treats you like a criminal
  (Bruce Powel Douglass)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Eddie C. Dost
Hi,

Please note that the semaphore is used to lock the idt77252 config
tables among multiple users including atmsigd even on single processor
machines. Does this work with mutexes?

Best regards,
Eddie

On Mon, Apr 23, 2007 at 08:55:20AM +0200, Matthias Kaehlcke wrote:
 El Sun, Apr 22, 2007 at 07:50:36PM -0400 Kyle Moffett ha dit:
 
  On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
  use spinlock instead of binary mutex in idt77252 driver
  
  I think you really meant: Use mutex instead of binary semaphore in  
  idt77252 driver, since this is a binary semaphore (not a mutex,  
  which are always binary):
  -  struct semaphoremutex;
  
  and this is a mutex, not a spinlock:
  +  struct mutexmutex;
  
  Everything else looks good though
 
 you're totally right. like in another patch i sent at the same time i
 messed up the description. as you point out it should read Use mutex
 instead of binary semaphore in idt77252 driver. in the last days i
 reported some spinlock related bugs, i suppose that made me write
 spinlock instead of mutex ...
 
 thanks for your comments
 
 -- 
 Matthias Kaehlcke
 Linux Application Developer
 Barcelona
 
 If you don't know where you are going,
you will probably end up somewhere else
  (Laurence J. Peter)
  .''`.
 using free software / Debian GNU/Linux | http://debian.org  : :'  :
 `. `'`
 gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-

-- 
Christian Dost
Technical Director RD

ATecoM realizing visions GmbH
Pascalstrasse 67
D-52076 Aachen
Germany
Fon: +49/2408/9596-0
Fax: +49/2408/9596-900
Email: [EMAIL PROTECTED]
URL: http://www.atecom.com

Amtsgericht Aachen, HRB# 5941, Sitz: Aachen
Geschaeftsfuehrer: Bernd Leister, Robert Bonnie
USt.-Id. Nr. / VATID: DE 811 66 99 76
Steuernummer/Tax-ID: 225/5775/0558
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Eddie C. Dost
Hi,

as long as mutexes are not converted to nop when CONFIG_SMP is not
defined (I don't know what current kernels do), this is of course
correct. You need to verify the headerfiles for the above.

Regards,
Eddie

On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
 El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
  
  Please note that the semaphore is used to lock the idt77252 config
  tables among multiple users including atmsigd even on single processor
  machines. Does this work with mutexes?
 
 afaik mutexes have the same behaviour as binary semaphores that are
 used as mutexes (always locked and unlocked by the same
 process/thread):
 
 .. the semaphore type can officially be considered to be on its way
 out. New code should not use semaphores, and old code which uses
 semaphores as mutexes should be converted over when an opportunity
 presents itself.
 
 http://lwn.net/Articles/167034/
 
 please correct me if i'm wrong, i'm just doing my first steps with
 linux kernel development
 
 regards
 
 -- 
 Matthias Kaehlcke
 Linux Application Developer
 Barcelona
 
 C treats you like a consenting adult. Pascal treats you like a
   naughty child. Ada treats you like a criminal
   (Bruce Powel Douglass)
  .''`.
 using free software / Debian GNU/Linux | http://debian.org  : :'  :
 `. `'`
 gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-

-- 
Christian Dost
Technical Director RD

ATecoM realizing visions GmbH
Pascalstrasse 67
D-52076 Aachen
Germany
Fon: +49/2408/9596-0
Fax: +49/2408/9596-900
Email: [EMAIL PROTECTED]
URL: http://www.atecom.com

Amtsgericht Aachen, HRB# 5941, Sitz: Aachen
Geschaeftsfuehrer: Bernd Leister, Robert Bonnie
USt.-Id. Nr. / VATID: DE 811 66 99 76
Steuernummer/Tax-ID: 225/5775/0558
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
hi,

El Mon, Apr 23, 2007 at 09:40:19AM +0200 Eddie C. Dost ha dit:

 as long as mutexes are not converted to nop when CONFIG_SMP is not
 defined (I don't know what current kernels do), this is of course
 correct. You need to verify the headerfiles for the above.

i just checked this, neither the mutex header nor implementation files
handle things different for CONFIG_SMP. 

thanks for your comments

 On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
  El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
   
   Please note that the semaphore is used to lock the idt77252 config
   tables among multiple users including atmsigd even on single processor
   machines. Does this work with mutexes?
  
  afaik mutexes have the same behaviour as binary semaphores that are
  used as mutexes (always locked and unlocked by the same
  process/thread):
  
  .. the semaphore type can officially be considered to be on its way
  out. New code should not use semaphores, and old code which uses
  semaphores as mutexes should be converted over when an opportunity
  presents itself.
  
  http://lwn.net/Articles/167034/
  
  please correct me if i'm wrong, i'm just doing my first steps with
  linux kernel development

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

 You must have a plan. If you don't have a plan,
   you'll become part of somebody else's plan
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Satyam Sharma

Hi,

On 4/23/07, Eddie C. Dost [EMAIL PROTECTED] wrote:

as long as mutexes are not converted to nop when CONFIG_SMP is not
defined (I don't know what current kernels do), this is of course
correct. You need to verify the headerfiles for the above.


Yes, even on UP different threads accessing the same data could race.
Mutexes (== binary semaphores) are *required* to synchronize access to
shared data.

You might be confusing mutexes with spinlocks. Spinlocks _are_
compiled away on UP (actually !CONFIG_SMP  !CONFIG_PREEMPT) kernels,
but that is still safe because spinlocks are busy-waiting loops
(unlike mutexes and semaphores that block) and hence no thread is
allowed to sleep when holding a spinlock.


On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
 El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
  Please note that the semaphore is used to lock the idt77252 config
  tables among multiple users including atmsigd even on single processor
  machines. Does this work with mutexes?

 afaik mutexes have the same behaviour as binary semaphores that are
 used as mutexes (always locked and unlocked by the same
 process/thread):


Mutexes / binary semaphores / spinlocks are used to synchronize access
to shared data by *multiple* threads ... there is no meaning in
locking access to something if we know only one thread will ever touch
it.

Cheers,
S
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Christoph Hellwig
On Sun, Apr 22, 2007 at 07:50:36PM -0400, Kyle Moffett wrote:
 On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
 use spinlock instead of binary mutex in idt77252 driver
 
 I think you really meant: Use mutex instead of binary semaphore in  
 idt77252 driver, since this is a binary semaphore (not a mutex,  
 which are always binary):

And the binary semaphore terminology i a little confusing. struct
semaphore is a full counting semaphore that is only used as a binary
semaphore if we want to speak in CS terms.  Than everyone else just
caled them semaphore before these patches started to show up :)

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


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-23 Thread Matthias Kaehlcke
El Mon, Apr 23, 2007 at 09:17:53AM +0100 Christoph Hellwig ha dit:

 On Sun, Apr 22, 2007 at 07:50:36PM -0400, Kyle Moffett wrote:
  On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:
  use spinlock instead of binary mutex in idt77252 driver
  
  I think you really meant: Use mutex instead of binary semaphore in  
  idt77252 driver, since this is a binary semaphore (not a mutex,  
  which are always binary):
 
 And the binary semaphore terminology i a little confusing. struct
 semaphore is a full counting semaphore that is only used as a binary
 semaphore if we want to speak in CS terms.  Than everyone else just
 caled them semaphore before these patches started to show up :)

i'll take your suggestion into account for future patches. my
intention behind the usage of the term binary semaphore was to be more
precise, but i agree that it can be confusing

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

I am incapable of conceiving infinity, and yet I do not accept finity
  (Simone de Beauvoir)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-22 Thread Satyam Sharma

On 4/23/07, Matthias Kaehlcke <[EMAIL PROTECTED]> wrote:

use spinlock instead of binary mutex in idt77252 driver

Signed-off-by: Matthias Kaehlcke <[EMAIL PROTECTED]>

--

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index b4b8014..e3cf141 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -2430,7 +2430,7 @@ idt77252_open(struct atm_vcc *vcc)

set_bit(ATM_VF_ADDR, >flags);

-   down(>mutex);
+   mutex_lock(>mutex);


Note that you're actually replacing a semaphore with a mutex here (and
not a mutex with a spinlock). I guess that should be fine and
desirable as long as the semaphore was indeed being used a mutex
(binary) in this code.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-22 Thread Kyle Moffett

On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:

use spinlock instead of binary mutex in idt77252 driver


I think you really meant: "Use mutex instead of binary semaphore in  
idt77252 driver", since this is a binary semaphore (not a mutex,  
which are always binary):

-   struct semaphoremutex;


and this is a mutex, not a spinlock:

+   struct mutexmutex;


Everything else looks good though

Cheers,
Kyle Moffett
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-22 Thread Kyle Moffett

On Apr 22, 2007, at 17:39:59, Matthias Kaehlcke wrote:

use spinlock instead of binary mutex in idt77252 driver


I think you really meant: Use mutex instead of binary semaphore in  
idt77252 driver, since this is a binary semaphore (not a mutex,  
which are always binary):

-   struct semaphoremutex;


and this is a mutex, not a spinlock:

+   struct mutexmutex;


Everything else looks good though

Cheers,
Kyle Moffett
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] use spinlock instead of binary mutex in idt77252 driver

2007-04-22 Thread Satyam Sharma

On 4/23/07, Matthias Kaehlcke [EMAIL PROTECTED] wrote:

use spinlock instead of binary mutex in idt77252 driver

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]

--

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index b4b8014..e3cf141 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -2430,7 +2430,7 @@ idt77252_open(struct atm_vcc *vcc)

set_bit(ATM_VF_ADDR, vcc-flags);

-   down(card-mutex);
+   mutex_lock(card-mutex);


Note that you're actually replacing a semaphore with a mutex here (and
not a mutex with a spinlock). I guess that should be fine and
desirable as long as the semaphore was indeed being used a mutex
(binary) in this code.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/