From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 18 Nov 2010 13:43:46 -0500 To: lucio@proxima.alt.za, 9fans@9fans.net Message-ID: <51b322d6b85b82a50bdc787a90067330@coraid.com> In-Reply-To: <2c37a72c526cc8f79c2b35be1c96ec3d@proxima.alt.za> References: <2c37a72c526cc8f79c2b35be1c96ec3d@proxima.alt.za> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] That deadlock, again Topicbox-Message-UUID: 853bf18c-ead6-11e9-9d60-3106f5b1d025 > I suggest you fix ether82598: it is OK to call qlock() and qunlock() > without "up", but only if sure that the qlock() will succeed. If it > has to wait, it will panic. yes. that's it. > >If it has to wait, it will panic. Given that, why do the locking at all? > > i assume the intention is along these lines: > > it's to allow the use during reset of a given driver's > standard functions that normally must qlock, to avoid requiring two copies > of them, with and without the qlock. > > after reset, it's illegal to call qlock without a process (notably > in an interrupt function), as it previously was. i think lucio has stated the current restriction more exactly, but this is closer to the assumed intent. perhaps we should make this what qlock actually does with diff -c /n/dump/2010/1118/sys/src/9/pc/main.c pc/main.c /n/dump/2010/1118/sys/src/9/pc/main.c:201,206 - pc/main.c:201,207 poperror(); } kproc("alarm", alarmkproc, 0); + conf.postdawn = 1; touser(sp); } diff -c /n/dump/2010/1118/sys/src/9/pc/dat.h pc/dat.h /n/dump/2010/1118/sys/src/9/pc/dat.h:107,112 - pc/dat.h:107,113 ulong ialloc; /* max interrupt time allocation in bytes */ ulong pipeqsize; /* size in bytes of pipe queues */ int nuart; /* number of uart devices */ + int postdawn; /* mutiprogramming on */ }; /* diff -c /n/dump/2010/1118/sys/src/9/port/qlock.c port/qlock.c /n/dump/2010/1118/sys/src/9/port/qlock.c:18,23 - port/qlock.c:18,25 { Proc *p; + if(up == nil && conf.postdawn) + panic("qlock: %#p: postdawn up nil\n", getcallerpc(&q)); if(m->ilockdepth != 0) print("qlock: %#p: ilockdepth %d\n", getcallerpc(&q), m->ilockdepth); if(up != nil && up->nlocks.ref) a test kernel i've got does boot with this test. - erik