From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 From: Giacomo Tesio Date: Mon, 24 Jul 2017 18:03:04 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary="001a113f2a0c9db1c20555125911" Subject: [9fans] double lock in proc.c Topicbox-Message-UUID: bfd2d75e-ead9-11e9-9d60-3106f5b1d025 --001a113f2a0c9db1c20555125911 Content-Type: text/plain; charset="UTF-8" In /sys/src/9/port/proc.c a comment state: /* * Expects that only one process can call wakeup for any given Rendez. * We hold both locks to ensure that r->p and p->r remain consistent. * Richard Miller has a better solution that doesn't require both to * be held simultaneously, but I'm a paranoid - presotto. */ (see https://github.com/0intro/plan9/blob/master/sys/src/9/port/proc.c#L882-L887) I'd like to know a bit more about Miller's solution as I'd like to simplify postnote. Any hint or source code? Giacomo --001a113f2a0c9db1c20555125911 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
In /sys/src/9/port/proc.c a comment state:
/*
* Expects that only one process can call wakeup for any given Rende= z.
* We hold both locks to ensure that r->p and p->r remain consis= tent.
* Richard Miller has a better solution that doesn't require bo= th to
* be held simultaneously, but I'm a paranoid - presotto.
*/=

(see https://github.com/0intro/plan9/blob/master/sys/s= rc/9/port/proc.c#L882-L887)

I'd like to know a bit mor= e about Miller's solution as I'd like to simplify postnote.
Any hint or source code?


Giacomo
--001a113f2a0c9db1c20555125911-- From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 24 Jul 2017 09:39:58 -0700 Message-ID: In-Reply-To: From: Erik Quanstrom To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 Subject: Re: [9fans] double lock in proc.c Topicbox-Message-UUID: bfdf6ee2-ead9-11e9-9d60-3106f5b1d025 PGRpdiBkaXI9J2F1dG8nPkkgaGFkIGEgZGlzY3Vzc2lvbiB3aXRoIFJpY2hh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JiMzOTt0IHJlcXVpcmUgYm90aCB0 bzxiciAvPiogYmUgaGVsZCBzaW11bHRhbmVvdXNseSwgYnV0IEkmIzM5O20gYSBwYXJhbm9pZCAt IHByZXNvdHRvLjxiciAvPiovPGJyIC8+PGJyIC8+KHNlZSA8YSBocmVmPSJodHRwczovL2dpdGh1 Yi5jb20vMGludHJvL3BsYW45L2Jsb2IvbWFzdGVyL3N5cy9zcmMvOS9wb3J0L3Byb2MuYyNMODgy LUw4ODciPmh0dHBzOi8vZ2l0aHViLmNvbS8waW50cm8vcGxhbjkvYmxvYi9tYXN0ZXIvc3lzL3Ny Yy85L3BvcnQvcHJvYy5jI0w4ODItTDg4NzwvYT4pPGJyIC8+PGJyIC8+PC9kaXY+SSYjMzk7ZCBs aWtlIHRvIGtub3cgYSBiaXQgbW9yZSBhYm91dCBNaWxsZXImIzM5O3Mgc29sdXRpb24gYXMgSSYj Mzk7ZCBsaWtlIHRvIHNpbXBsaWZ5IHBvc3Rub3RlLjxiciAvPjwvZGl2PjxkaXY+QW55IGhpbnQg b3Igc291cmNlIGNvZGU/PGJyIC8+PC9kaXY+PGRpdj48YnIgLz48YnIgLz48L2Rpdj5HaWFjb21v PGJyIC8+PC9kaXY+DQoNCjwvYmxvY2txdW90ZT48L2Rpdj48YnI+PC9kaXY+ From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/alternative; boundary=Apple-Mail-734EEC2D-D002-4B40-A7E4-9CD984CFDC87 Mime-Version: 1.0 (1.0) From: "Fran. J Ballesteros" In-Reply-To: Date: Mon, 24 Jul 2017 21:13:04 +0200 Content-Transfer-Encoding: 7bit Message-Id: <431F6692-904D-4424-9036-C74FAB969B7C@lsub.org> References: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] double lock in proc.c Topicbox-Message-UUID: c05dac3a-ead9-11e9-9d60-3106f5b1d025 --Apple-Mail-734EEC2D-D002-4B40-A7E4-9CD984CFDC87 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable do you remember the proposal? thanks > El 24 jul 2017, a las 18:39, Erik Quanstrom escrib= i=C3=B3: >=20 > I had a discussion with Richard about this a few years ago. Richard was n= o longer convinced of the solution. at the time I agreed with his reasoning= . the comment should be changed. >=20 > - erik >=20 >=20 > On Jul 24, 2017 9:03 AM, Giacomo Tesio wrote: > In /sys/src/9/port/proc.c a comment state: >=20 > /* > * Expects that only one process can call wakeup for any given Rendez. > * We hold both locks to ensure that r->p and p->r remain consistent. > * Richard Miller has a better solution that doesn't require both to > * be held simultaneously, but I'm a paranoid - presotto. > */ >=20 > (see https://github.com/0intro/plan9/blob/master/sys/src/9/port/proc.c#L88= 2-L887) >=20 > I'd like to know a bit more about Miller's solution as I'd like to simplif= y postnote. > Any hint or source code? >=20 >=20 > Giacomo >=20 --Apple-Mail-734EEC2D-D002-4B40-A7E4-9CD984CFDC87 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
do you remember the proposa= l?
thanks

El 24 jul 2017, a las 18:39, Erik Quanstro= m <quanstro@quanstro.net>= escribi=C3=B3:

I had a discussion with Richard about this a few years ago.  Richard w= as no longer convinced of the solution.  at the time I agreed with his r= easoning.  the comment should be changed.

- erik


On Jul 24, 2017 9:03 AM, Giacomo= Tesio <giacomo@tesio.it> wrot= e:
In /sys/src/9/port/proc.c a comment state:

/*
* Expects that onl= y one process can call wakeup for any given Rendez.
* We hold both locks t= o ensure that r->p and p->r remain consistent.
* Richard Miller has= a better solution that doesn't require both to
* be held simultaneously,= but I'm a paranoid - presotto.
*/

(see https://github= .com/0intro/plan9/blob/master/sys/src/9/port/proc.c#L882-L887)

I'd like to know a bit more about Miller's solution as I'd like to simpl= ify postnote.
Any hint or source code?


<= /div>Giacomo

= --Apple-Mail-734EEC2D-D002-4B40-A7E4-9CD984CFDC87-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <431F6692-904D-4424-9036-C74FAB969B7C@lsub.org> References: <431F6692-904D-4424-9036-C74FAB969B7C@lsub.org> From: Richard Miller <9fans@hamnavoe.com> Date: Tue, 25 Jul 2017 19:51:24 +0100 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary="001a113e7f84764b68055528d1ab" Subject: Re: [9fans] double lock in proc.c Topicbox-Message-UUID: c08ba2b6-ead9-11e9-9d60-3106f5b1d025 --001a113e7f84764b68055528d1ab Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'm not convinced that I recall not being convinced ... :) Essentially I changed the order of lock acquire/release so that the canlock() loop in proc.c:/^postnote could be eliminated. Not significant for performance, but it seemed more elegant and I think it also avoided looking at any shared data outside code regions protected by a lock. This was many years ago (when my now-white beard was still merely grey). Not worth going back to reconstruct the arguments, but I'll send Giacomo and Nemo a copy of my proc.c to examine for themselves. On 24 July 2017 at 20:13, Fran. J Ballesteros wrote: > do you remember the proposal? > thanks > > El 24 jul 2017, a las 18:39, Erik Quanstrom > escribi=C3=B3: > > I had a discussion with Richard about this a few years ago. Richard was > no longer convinced of the solution. at the time I agreed with his > reasoning. the comment should be changed. > > - erik > > --001a113e7f84764b68055528d1ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm not convinced that I recall not being convinced ..= . :)

Essentially I changed the order of lock acquire/release s= o that the canlock() loop in proc.c:/^postnote could be eliminated.=C2=A0 N= ot significant for performance, but it seemed more elegant and I think it a= lso avoided looking at any shared data outside code regions protected by a = lock.

This was many years ago (when my now-w= hite beard was still merely grey).=C2=A0 Not worth going back to reconstruc= t the arguments, but I'll send Giacomo and Nemo a copy of my proc.c to = examine for themselves.
--001a113e7f84764b68055528d1ab-- From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <431F6692-904D-4424-9036-C74FAB969B7C@lsub.org> From: David du Colombier <0intro@gmail.com> Date: Wed, 26 Jul 2017 00:23:43 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary="94eb2c0c440ec72c6705552bc86d" Subject: Re: [9fans] double lock in proc.c Topicbox-Message-UUID: c094e0f6-ead9-11e9-9d60-3106f5b1d025 --94eb2c0c440ec72c6705552bc86d Content-Type: text/plain; charset="UTF-8" This was many years ago (when my now-white beard was still merely grey). Not worth going back to reconstruct the arguments, but I'll send Giacomo and Nemo a copy of my proc.c to examine for themselves. I'd also be interested by your copy if proc.c. Thanks. -- David du Colombier --94eb2c0c440ec72c6705552bc86d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
<= div>This was many years ago (when my now-white beard was still merely grey)= .=C2=A0 Not worth going back to reconstruct the arguments, but I'll sen= d Giacomo and Nemo a copy of my proc.c to examine for themselves.

I&= #39;d also be interested by your copy if proc.c.
Thanks.

--=C2=A0
David du Colombier
--94eb2c0c440ec72c6705552bc86d--