From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 4750 invoked from network); 21 Jun 1999 19:42:36 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 21 Jun 1999 19:42:36 -0000 Received: from mail11.digital.com (mail11.digital.com [192.208.46.10]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id OAA19147 for ; Mon, 21 Jun 1999 14:48:31 -0400 Received: from flume.zk3.dec.com (yflume.zk3.dec.com [16.140.16.14]) by mail11.digital.com (8.9.2/8.9.2/WV2.0g) with ESMTP id OAA22431; Mon, 21 Jun 1999 14:52:24 -0400 (EDT) Received: from zk3.dec.com by flume.zk3.dec.com (8.8.8/1.1.8.2/16Jan95-0946AM) id OAA0000029132; Mon, 21 Jun 1999 14:48:27 -0400 (EDT) Sender: frival@zk3.dec.com Message-ID: <376E88FA.9D75E4DD@zk3.dec.com> Date: Mon, 21 Jun 1999 14:48:26 -0400 From: Peter Rival Organization: Tru64 UNIX Release Engineering Systems X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.2.9 alpha) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com CC: jmartin@pdgsrv.hlo.dec.com, jestabro@pdgsrv.hlo.dec.com, torvalds@transmeta.com Subject: Re: instability References: <376BCE96.8CACBF27@ma.ultranet.com> <19990619125843.A8357@twiddle.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Richard Henderson wrote: > On Sat, Jun 19, 1999 at 01:08:38PM -0400, Jay Estabrook wrote: > > Any progress on the ASN/TLB stuff we were discussing? > > Yes. I sent a message to axp-list in the wee hours Friday morning, but > sent it from the wrong account and it bounced. > > It's because we made no effort to validate p->tss.asn, only p->mm->context. > This is a mistake whenever there exist multiple processes that share VM, as > with threads or vfork. > > Consider two processes A and B sharing a VM. Allow that both have slept > across the asn rollover. Process A gets scheduled first, notes that > A->mm->context is out of date, allocates a new one, and updates A->tss.asn > and A->mm->context. Process B gets scheduled, notes that B->mm->context > is up to date, and proceeds to use an out of date asn, causing all sorts > of havok. > > A similar problem occurs on SMP when a pair of threads migrates to a > different processor. > > I've played around with a couple of variations on a patch. Attached > is my favourite so far. > > A variant that I'm considering relies on the fact that the PALcode only > reads tss.asn, and that the hardware ignores bits outside the supported > range. As it is, we have to also keep a shadow field in tss with the > full context. > > One problem that variant is that it narrows the context from 64 bits > to 32 bits, due to the field width of tss.asn. Which means there are > now only 19 instead of 51 bits of serial number, which means that the > possibility of a process sleeping through serial number rollover and > running with an invalid asn is real. > > I'm half convinced that the cure (detecting serial number rollover and > walking the process list to reset everyone's context) is worse than > just keeping a second field in the tss. > > (Linus, this is different from the patch I sent Friday -- that one > had a silly thinko that allocated asn contexts more often than needed, > and in the SMP case where two threads run on different processors > would allocate new contexts every time they are scheduled.) > > In addition to solving this problem, the patch also fixes EV4, which > was broken when the tbia was removed from alpha_switch_to. Also, > the SMP last_asn array is dispersed into per-cpu local data to avoid > fighting over cache lines. Also, __reload_tss is cleaned up to > properly use virt_to_phys instead of doing some silly masking thing. > Grabbed the patch, applied it, got the following when compiling for rawhide. I'll look into it as soon as I have a chance (hopefully today...). .... /usr/src/linux/arch/alpha/lib/lib.a /usr/src/linux/lib/lib.a /usr/src/linux/arch/alpha/lib/lib.a \ --end-group \ -o vmlinux arch/alpha/kernel/kernel.o: In function `exit_thread': process.c(.text.init+0x216c): undefined reference to `mcpcia_srm_readb' arch/alpha/kernel/kernel.o: In function `flush_thread': process.c(.text.init+0x2184): undefined reference to `mcpcia_srm_readw' process.c(.text.init+0x2190): undefined reference to `mcpcia_srm_writeb' process.c(.text.init+0x21a0): undefined reference to `mcpcia_srm_writew' arch/alpha/kernel/kernel.o: In function `get_irq_list': irq.c(.data+0x5e00): undefined reference to `mcpcia_virt_to_bus' irq.c(.data+0x5e08): undefined reference to `mcpcia_bus_to_virt' irq.c(.data+0x5e10): undefined reference to `mcpcia_inb' irq.c(.data+0x5e18): undefined reference to `mcpcia_inw' irq.c(.data+0x5e20): undefined reference to `mcpcia_inl' irq.c(.data+0x5e28): undefined reference to `mcpcia_outb' irq.c(.data+0x5e30): undefined reference to `mcpcia_outw' irq.c(.data+0x5e38): undefined reference to `mcpcia_outl' irq.c(.data+0x5e40): undefined reference to `mcpcia_readb' irq.c(.data+0x5e48): undefined reference to `mcpcia_readw' irq.c(.data+0x5e50): undefined reference to `mcpcia_readl' irq.c(.data+0x5e58): undefined reference to `mcpcia_readq' irq.c(.data+0x5e60): undefined reference to `mcpcia_writeb' irq.c(.data+0x5e68): undefined reference to `mcpcia_writew' irq.c(.data+0x5e70): undefined reference to `mcpcia_writel' irq.c(.data+0x5e78): undefined reference to `mcpcia_writeq' irq.c(.data+0x5e80): undefined reference to `mcpcia_dense_mem' make: *** [vmlinux] Error 1