From: Richard Henderson <rth@twiddle.net>
To: The Estabrooks <estabro@ma.ultranet.com>
Cc: jmartin@pdgsrv.hlo.dec.com, jestabro@pdgsrv.hlo.dec.com,
axp-list@redhat.com, torvalds@transmeta.com
Subject: Re: instability
Date: Sat, 19 Jun 1999 12:58:43 -0700 [thread overview]
Message-ID: <19990619125843.A8357@twiddle.net> (raw)
In-Reply-To: <376BCE96.8CACBF27@ma.ultranet.com>; from The Estabrooks on Sat, Jun 19, 1999 at 01:08:38PM -0400
[-- Attachment #1: Type: text/plain, Size: 2311 bytes --]
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.
r~
[-- Attachment #2: d-asn-2.gz --]
[-- Type: application/x-gunzip, Size: 3300 bytes --]
next parent reply other threads:[~1999-06-19 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <376BCE96.8CACBF27@ma.ultranet.com>
1999-06-19 19:58 ` Richard Henderson [this message]
1999-06-20 23:30 ` instability (patch) Darren Breeze
1999-06-21 18:48 ` instability Peter Rival
1999-06-22 4:45 ` instability Richard Henderson
1999-06-22 12:07 ` instability Peter Rival
1999-06-22 17:00 ` instability Richard Henderson
1999-06-22 18:42 ` instability Peter Rival
1999-06-22 4:45 ` instability Michael Ivanov
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox