From owner-freebsd-mips@FreeBSD.ORG Sat Feb 26 11:27:41 2011 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2464106566B; Sat, 26 Feb 2011 11:27:41 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id E20E88FC0A; Sat, 26 Feb 2011 11:27:40 +0000 (UTC) Received: by wwb31 with SMTP id 31so3238570wwb.31 for ; Sat, 26 Feb 2011 03:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=URU7MDD+Gx4fqXPxKmmgAGdUOJLj8uRVpmUDBHwdnVY=; b=KxchaBlk6nH33gavr00/BBsL0l2SaCgvcToPHtULDFkvvYBk/roH7itBmn0S1bAEUW /5X9haEqZa+TFaMFoMKKh8ggYhrDj6u/9+ZogYI3FCkfJ4zNEavEnjJUNd7boIjdSfv/ jmBi9U6sTeQ1zJdIakfYY2fsf9McPYkvjS9Zc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sAH28tPIXRiJ4fHDx9QIO0z1hmh9sDn1kngONX26+BKe0wKbI8GYWeV5YIg2dt/Rj1 cokI51vHzMIf+RjnlN4pPauzeDZdIv09wtDEAY0teZH1yXUwAFytbUC/xcnc1Os5hZhy TQGOoxVDcrdFhxXNf/P5i+VQqroL9HI/z+E40= MIME-Version: 1.0 Received: by 10.227.137.140 with SMTP id w12mr3109452wbt.40.1298719659635; Sat, 26 Feb 2011 03:27:39 -0800 (PST) Received: by 10.227.132.144 with HTTP; Sat, 26 Feb 2011 03:27:39 -0800 (PST) Date: Sat, 26 Feb 2011 16:57:39 +0530 Message-ID: From: "Jayachandran C." To: freebsd-mips@freebsd.org, Juli Mallett , Warner Losh Content-Type: multipart/mixed; boundary=001636832e48f9b305049d2dbb8e Cc: Subject: [PATCH] stack usage of pmap_activate in cpu_switch() X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Feb 2011 11:27:41 -0000 --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 YXZlZCB3aXRoIHRoZSBvdGhlci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