From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yoann Padioleau To: Yoann Padioleau Date: Sun, 22 Jun 2014 22:25:29 +0000 Message-ID: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> References: In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-ID: <568A5A1CE9C143428192EFF8A56BEFDC@fb.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fc8e88ce-ead8-11e9-9d60-3106f5b1d025 The code should be if(up !=3D p && (p->wired =3D=3D nil || p->wired =3D=3D MACHP(m->machno)) m->readied =3D p; no? >=20 > if(up !=3D p && (p->wired =3D=3D nil || p->wired =3D=3D m)) > m->readied =3D p; /* group scheduling */ On Jun 22, 2014, at 10:20 AM, yoann padioleau wrote: > Hi, >=20 > Looking at the scheduler code I think I've found a bug related to the > customized affinity one can set for a process. >=20 > In ready() there is: >=20 > if(up !=3D p && (p->wired =3D=3D nil || p->wired =3D=3D m)) > m->readied =3D p; /* group scheduling */ >=20 > but on x86 'm' is actually set to a fixed address, MACHADDR. Each cpu act= ually > have a different mapping in its pagetable to then translate MACHADDR virt= ual address to a different > physical address. >=20 > in procwired() there is: > p->wired =3D MACHP(bm); >=20 > MACHP is an array of addresses of all Mach in memory but not using this > MACHADDR fixed virtual address. Each entry corresponds to a different Mac= h virtual > address.=20 >=20 > So there is no way the test in ready() p->wired =3D=3D m can even return = true.=20 >=20 From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5887184581ba753b15d0cd7ba461f08e@felloff.net> Date: Mon, 23 Jun 2014 01:20:59 +0200 From: cinap_lenrek@felloff.net To: 9fans@9fans.net In-Reply-To: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fc93f3ea-ead8-11e9-9d60-3106f5b1d025 correct. :-) -- cinap From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> References: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> Date: Mon, 23 Jun 2014 00:25:53 +0100 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d043c7e1e440ccf04fc750c46 Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fca01080-ead8-11e9-9d60-3106f5b1d025 --f46d043c7e1e440ccf04fc750c46 Content-Type: text/plain; charset=UTF-8 On 22 June 2014 23:25, Yoann Padioleau wrote: > if(up != p && (p->wired == nil || p->wired == MACHP(m->machno)) > m->readied = p; > yes, because on 386 m is effectively a constant. the code was written with extern register Mach *m in mind. --f46d043c7e1e440ccf04fc750c46 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On 22 June 2014 23:25, Yoann Padioleau <pad@fb.com> wrote:
if(up !=3D p &= & (p->wired =3D=3D nil || p->wired =3D=3D MACHP(m->machno)) =C2=A0 =C2=A0m->readied =3D p;

yes, beca= use on 386 m is effectively a constant. the code was written with extern re= gister Mach *m in mind.
--f46d043c7e1e440ccf04fc750c46-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sun, 22 Jun 2014 20:57:44 -0400 To: 9fans@9fans.net Message-ID: <77de0edfefe533821fb5106a4d24052b@mikro.quanstro.net> In-Reply-To: References: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fca5a7fc-ead8-11e9-9d60-3106f5b1d025 > On 22 June 2014 23:25, Yoann Padioleau wrote: > > > if(up != p && (p->wired == nil || p->wired == MACHP(m->machno)) > > m->readied = p; > > > > yes, because on 386 m is effectively a constant. the code was written with > extern register Mach *m in mind. > 9atom has had it as if(up != p && (p->wired == nil || p->wired->machno == m->machno)) which i believe is equivalent, and less obnoxious. the pc kernel should be rewritten with the GS extern register bit, and then we could get rid of MACHP. - erik From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Mon, 23 Jun 2014 10:08:24 +0200 From: cinap_lenrek@felloff.net To: 9fans@9fans.net In-Reply-To: <77de0edfefe533821fb5106a4d24052b@mikro.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fcb092ca-ead8-11e9-9d60-3106f5b1d025 if(up != p && (p->wired == nil || p->wired->machno == m->machno)) dereferencing p->wired can fault when another processor rewires the proc temporarily setting p->wired to nil. -- cinap From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yoann Padioleau To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Mon, 23 Jun 2014 16:20:53 +0000 Message-ID: References: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> <77de0edfefe533821fb5106a4d24052b@mikro.quanstro.net> In-Reply-To: <77de0edfefe533821fb5106a4d24052b@mikro.quanstro.net> Content-Type: text/plain; charset="us-ascii" Content-ID: <2C2F4618C64C9E4AAE7FAA65811B3E31@fb.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fcc07d84-ead8-11e9-9d60-3106f5b1d025 Yes I agree, it's better that way. Is there a list somewhere on the web wit= h all those 9atom patches? On Jun 22, 2014, at 5:57 PM, erik quanstrom wrote: >> On 22 June 2014 23:25, Yoann Padioleau wrote: >>=20 >>> if(up !=3D p && (p->wired =3D=3D nil || p->wired =3D=3D MACHP(m->machno= )) >>> m->readied =3D p; >>>=20 >>=20 >> yes, because on 386 m is effectively a constant. the code was written wi= th >> extern register Mach *m in mind. >>=20 >=20 >=20 > 9atom has had it as >=20 > if(up !=3D p && (p->wired =3D=3D nil || p->wired->machno =3D=3D m->machn= o)) >=20 > which i believe is equivalent, and less obnoxious. the pc kernel should = be rewritten > with the GS extern register bit, and then we could get rid of MACHP. >=20 > - erik >=20 From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Mon, 23 Jun 2014 12:39:22 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: References: <1AE8E693-C840-4E40-BB19-6DF52A98E578@fb.com> <77de0edfefe533821fb5106a4d24052b@mikro.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] bug in procwired() for x86 scheduler? Topicbox-Message-UUID: fcd6738c-ead8-11e9-9d60-3106f5b1d025 On Mon Jun 23 12:22:23 EDT 2014, pad@fb.com wrote: > Yes I agree, it's better that way. Is there a list somewhere on the web with all > those 9atom patches? > 9fs atom then look in /n/atom/patch, or /n/atom/patch/applied, or /n/atom/patch/applied$year. - erik ps. for 9fs .... case atom srv -n -q tcp!atom.9atom.org atom && mount $nflag /srv/atom /n/atom atom