Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Feb 2011 16:57:39 +0530
From:      "Jayachandran C." <c.jayachandran@gmail.com>
To:        freebsd-mips@freebsd.org, Juli Mallett <jmallett@freebsd.org>,  Warner Losh <imp@freebsd.org>
Subject:   [PATCH] stack usage of pmap_activate in cpu_switch()
Message-ID:  <AANLkTikmw7L0bePiEQKawUwKhPqCE9qj4JXzd9-y1r44@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--001636832e48f9b305049d2dbb8e
Content-Type: text/plain; charset=ISO-8859-1

In the cpu_switch code, pmap_activate is called with the stack of the
old thread even after the thread was switched out. This seems to be
the cause of a crash I see here (on XLP) under stress.

Seems like a bug to me, any thoughts?

The attached patch restores the SP from the new thread from its PCB
before calling pmap_activate().

JC.

--001636832e48f9b305049d2dbb8e
Content-Type: application/octet-stream; name="swtch.S.diff"
Content-Disposition: attachment; filename="swtch.S.diff"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gkmfwp5s0

SW5kZXg6IHN5cy9taXBzL21pcHMvc3d0Y2guUwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvbWlwcy9taXBz
L3N3dGNoLlMJKHJldmlzaW9uIDIxNzkyMikKKysrIHN5cy9taXBzL21pcHMvc3d0Y2guUwkod29y
a2luZyBjb3B5KQpAQCAtMTk1LDExICsxOTUsNiBAQAogCVNBVkVfVV9QQ0JfQ09OVEVYVChyYSwg
UFJFR19QQywgYTApCiAJbW92ZQlyYSwgdjAJCQkvKiByZXN0b3JlICdyYScgYmVmb3JlIHJldHVy
bmluZyAqLwogCi0JLyoKLQkgKiBGUkVFQlNEX0RFVkVMT1BFUlNfRklYTUU6Ci0JICogSW4gY2Fz
ZSB0aGVyZSBhcmUgQ1BVLXNwZWNpZmljIHJlZ2lzdGVycyB0aGF0IG5lZWQKLQkgKiB0byBiZSBz
YXZlZCB3aXRoIHRoZS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w
KQkjIHJlc3RvcmUga2VybmVsIGNvbnRleHQKIAlSRVNUT1JFX1VfUENCX0NPTlRFWFQocmEsIFBS
RUdfUkEsIGEwKQpAQCAtMzQ2LDEzICszMzgsOCBAQAogCVJFU1RPUkVfVV9QQ0JfQ09OVEVYVChz
NSwgUFJFR19TNSwgYTApCiAJUkVTVE9SRV9VX1BDQl9DT05URVhUKHM2LCBQUkVHX1M2LCBhMCkK
IAlSRVNUT1JFX1VfUENCX0NPTlRFWFQoczcsIFBSRUdfUzcsIGEwKQotCVJFU1RPUkVfVV9QQ0Jf
Q09OVEVYVChzcCwgUFJFR19TUCwgYTApCiAJUkVTVE9SRV9VX1BDQl9DT05URVhUKHM4LCBQUkVH
X1M4LCBhMCkKLQkvKgotCSAqIEZSRUVCU0RfREVWRUxPUEVSU19GSVhNRToKLQkgKiBJbiBjYXNl
IHRoZXJlIGFyZSBDUFUtc3BlY2lmaWMgcmVnaXN0ZXJzIHRoYXQgbmVlZAotCSAqIHRvIGJlIHJl
c3RvcmVkIHdpdGggdGhlIG90aGVyIHJlZ2lzdGVycyBkbyBzbyBoZXJlLgotCSAqLworCiAJbWZj
MAl0MCwgTUlQU19DT1BfMF9TVEFUVVMKIAlhbmQJdDAsIHQwLCBNSVBTX1NSX0lOVF9NQVNLCiAJ
YW5kCXYwLCB2MCwgfk1JUFNfU1JfSU5UX01BU0sK
--001636832e48f9b305049d2dbb8e--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikmw7L0bePiEQKawUwKhPqCE9qj4JXzd9-y1r44>