Re: How to do proper locking

2005-08-07 Thread Hans Petter Selasky
On Saturday 06 August 2005 18:02, Ian Dowse wrote: > In message <[EMAIL PROTECTED]>, Hans Petter Selasky writes: > >Yes, you are right, but the problem is, that for most callback systems in > > the kernel, there is no mechanism that will pre-lock some custom mutex > > before calling the callback.

Re: How to do proper locking

2005-08-06 Thread Ian Dowse
In message <[EMAIL PROTECTED]>, Hans Petter Selasky writes: >Yes, you are right, but the problem is, that for most callback systems in the >kernel, there is no mechanism that will pre-lock some custom mutex before >calling the callback. > >I am not speaking about adding lines to existing code, bu

Re: How to do proper locking

2005-08-06 Thread Julian Elischer
Hans Petter Selasky wrote: On Friday 05 August 2005 19:29, John Baldwin wrote: Yes, you are right, but the problem is, that for most callback systems in the kernel, there is no mechanism that will pre-lock some custom mutex before calling the callback. Not generally applicable to this ca

Re: How to do proper locking

2005-08-05 Thread Hans Petter Selasky
On Friday 05 August 2005 19:29, John Baldwin wrote: > On Thursday 04 August 2005 04:53 pm, Hans Petter Selasky wrote: > > On Thursday 04 August 2005 20:15, John Baldwin wrote: > > > On Thursday 04 August 2005 12:50 pm, Hans Petter Selasky wrote: > > > > On Thursday 04 August 2005 15:53, John Baldwi

Re: How to do proper locking

2005-08-05 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> John Baldwin <[EMAIL PROTECTED]> writes: : Maybe, but another thing you need to consider is "maintainenance" overhead. : Device drivers, especially, should be the simplest parts of the kernel to : implement because we want to minimize the potential for

Re: How to do proper locking

2005-08-05 Thread John Baldwin
On Thursday 04 August 2005 04:53 pm, Hans Petter Selasky wrote: > On Thursday 04 August 2005 20:15, John Baldwin wrote: > > On Thursday 04 August 2005 12:50 pm, Hans Petter Selasky wrote: > > > On Thursday 04 August 2005 15:53, John Baldwin wrote: > > > > On Thursday 04 August 2005 07:40 am, Hans P

Re: How to do proper locking

2005-08-04 Thread Hans Petter Selasky
On Thursday 04 August 2005 20:15, John Baldwin wrote: > On Thursday 04 August 2005 12:50 pm, Hans Petter Selasky wrote: > > On Thursday 04 August 2005 15:53, John Baldwin wrote: > > > On Thursday 04 August 2005 07:40 am, Hans Petter Selasky wrote: > > > > On Wednesday 03 August 2005 19:21, John Bal

Re: How to do proper locking

2005-08-04 Thread David Malone
On Thu, Aug 04, 2005 at 06:50:12PM +0200, Hans Petter Selasky wrote: > 2) nonblocking: increment some other refcount that the >callback checks before accessing any data. I think people usually call this something like a "generation count". This sort of scheme used to be used for vnodes in Free

Re: How to do proper locking

2005-08-04 Thread John Baldwin
On Thursday 04 August 2005 12:50 pm, Hans Petter Selasky wrote: > On Thursday 04 August 2005 15:53, John Baldwin wrote: > > On Thursday 04 August 2005 07:40 am, Hans Petter Selasky wrote: > > > On Wednesday 03 August 2005 19:21, John Baldwin wrote: > > > > On Tuesday 02 August 2005 06:23 pm, Hans P

Re: How to do proper locking

2005-08-04 Thread Hans Petter Selasky
On Thursday 04 August 2005 15:53, John Baldwin wrote: > On Thursday 04 August 2005 07:40 am, Hans Petter Selasky wrote: > > On Wednesday 03 August 2005 19:21, John Baldwin wrote: > > > On Tuesday 02 August 2005 06:23 pm, Hans Petter Selasky wrote: > > > > Hi, > > > > > > > > I am looking for a safe

Re: How to do proper locking

2005-08-04 Thread Hans Petter Selasky
On Thursday 04 August 2005 14:08, Max Laier wrote: > On Thursday 04 August 2005 13:40, Hans Petter Selasky wrote: > > This is a copy and paste from the kernel sources: > > > > struct ucred * > > crhold(struct ucred *cr) > > { > > The problem is, what happens if the kernel switches thread right here

Re: How to do proper locking

2005-08-04 Thread John Baldwin
On Thursday 04 August 2005 07:40 am, Hans Petter Selasky wrote: > On Wednesday 03 August 2005 19:21, John Baldwin wrote: > > On Tuesday 02 August 2005 06:23 pm, Hans Petter Selasky wrote: > > > Hi, > > > > > > I am looking for a safe way to access structures that can be freed. The > > > solution I

Re: How to do proper locking

2005-08-04 Thread Max Laier
On Thursday 04 August 2005 13:40, Hans Petter Selasky wrote: > This is a copy and paste from the kernel sources: > > struct ucred * > crhold(struct ucred *cr) > { > The problem is, what happens if the kernel switches thread right here, and > then the other thread calls "crfree()" on this structure,

Re: How to do proper locking

2005-08-04 Thread Hans Petter Selasky
On Wednesday 03 August 2005 19:21, John Baldwin wrote: > On Tuesday 02 August 2005 06:23 pm, Hans Petter Selasky wrote: > > Hi, > > > > I am looking for a safe way to access structures that can be freed. The > > solution I am looking for must not: > > > > - hinder scaleability > > - lead to use of

Re: How to do proper locking

2005-08-03 Thread John Baldwin
On Tuesday 02 August 2005 06:23 pm, Hans Petter Selasky wrote: > Hi, > > I am looking for a safe way to access structures that can be freed. The > solution I am looking for must not: > > - hinder scaleability > - lead to use of a single lock > - lead to lock order reversal These aren't a very clea

How to do proper locking

2005-08-02 Thread Hans Petter Selasky
Hi, I am looking for a safe way to access structures that can be freed. The solution I am looking for must not: - hinder scaleability - lead to use of a single lock - lead to lock order reversal Here is the solution I have landed on so far: First I plan to make a reference count manager that