Received: from mail.onstor.com ([66.201.51.107]) by onstor-exch02.onstor.net with Microsoft SMTPSVC(6.0.3790.3959);
	 Tue, 9 Sep 2008 14:43:22 -0700
Received: from chiesmta2-3.messageone.com ([216.203.30.55]) by mail.onstor.com with Microsoft SMTPSVC(6.0.3790.3959);
	 Tue, 9 Sep 2008 14:43:21 -0700
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])
	by chiesmta2-3.messageone.com (8.13.8/8.13.8) with ESMTP id m89LhHZs030082
	for <andy.sharp@onstor.com>; Tue, 9 Sep 2008 16:43:20 -0500
Received: from localhost.localdomain ([127.0.0.1]:12229 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP
	id S32726444AbYIIUcv (ORCPT <rfc822;andy.sharp@onstor.com>);
	Tue, 9 Sep 2008 21:32:51 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 09 Sep 2008 21:32:34 +0100 (BST)
Received: from aux-209-217-49-36.oklahoma.net ([209.217.49.36]:39436 "EHLO
	proteus.paralogos.com") by ftp.linux-mips.org with ESMTP
	id S28597845AbYIIUaq (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Tue, 9 Sep 2008 21:30:46 +0100
Received: from [217.109.65.213] ([217.109.65.213])
	by proteus.paralogos.com (8.9.3/8.9.3) with ESMTP id PAA23497
	for <linux-mips@linux-mips.org>; Tue, 9 Sep 2008 15:59:46 -0500
Message-ID: <48C6DCC7.6020705@paralogos.com>
Date: 	Tue, 09 Sep 2008 22:29:59 +0200
From: "Kevin D. Kissell" <kevink@paralogos.com>
User-Agent: Thunderbird 2.0.0.14 (X11/20080501)
MIME-Version: 1.0
To: Linux MIPS Org <linux-mips@linux-mips.org>
Subject: SMTC Patches [1 of 3]
Content-Type: multipart/mixed;
 boundary="------------040406000605030509060700"
X-archive-position: 20426
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: kevink@paralogos.com
Precedence: bulk
X-list: 	linux-mips
X-MessageOne-Virus-Version: vendor=fsecure engine=4.65.7161:2.4.4,1.2.40,4.0.164 definitions=2008-09-09_13:2008-09-02,2008-09-09,2008-09-09 signatures=0
X-MessageOne-Virus-Scanned: Clean
X-MessageOne-Envelope-Sender: linux-mips-bounce@linux-mips.org
X-MessageOne-Spam-Details: rule=m773emszm_notspam policy=m773emszm score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=3.1.0-0805090000 definitions=main-0809090158
X-MessageOne-Spam-Score: 0
X-MessageOne-Spam-Bar: 
Return-Path: linux-mips-bounce@linux-mips.org
X-OriginalArrivalTime: 09 Sep 2008 21:43:21.0900 (UTC) FILETIME=[1486B6C0:01C912C5]

This is a multi-part message in MIME format.
--------------040406000605030509060700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


--------------040406000605030509060700
Content-Type: text/x-patch;
 name="0001-Fixed-holes-in-SMTC-and-FPU-affinity-support.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0001-Fixed-holes-in-SMTC-and-FPU-affinity-support.patch"

From 7c2d12934d74cb5e97a4c3083b38e79d597e9b31 Mon Sep 17 00:00:00 2001
From: Kevin D. Kissell <kevink@paralogos.com>
Date: Tue, 9 Sep 2008 21:33:36 +0200
Subject: [PATCH] Fixed holes in SMTC and FPU affinity support.
 Signed-off-by: Kevin D. Kissell <kevink@paralogos.com>

---
 arch/mips/kernel/process.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 2c09a44..75277c8 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -55,7 +55,7 @@ void __noreturn cpu_idle(void)
 	while (1) {
 		tick_nohz_stop_sched_tick();
 		while (!need_resched()) {
-#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
+#ifdef CONFIG_MIPS_MT_SMTC
 			extern void smtc_idle_loop_hook(void);
 
 			smtc_idle_loop_hook();
@@ -155,14 +155,19 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 	clear_tsk_thread_flag(p, TIF_USEDFPU);
 
 #ifdef CONFIG_MIPS_MT_FPAFF
+	clear_tsk_thread_flag(p, TIF_FPUBOUND);
 	/*
-	 * FPU affinity support is cleaner if we track the
-	 * user-visible CPU affinity from the very beginning.
-	 * The generic cpus_allowed mask will already have
-	 * been copied from the parent before copy_thread
-	 * is invoked.
+	 * FPU affinity support requires that we be subtle.
+	 * The basic fork support code will have copied
+	 * the parent's cpus_allowed set, but what the child
+	 * needs to inherit is the "user" version, which
+	 * carries the program/user controlled CPU affinity
+	 * properties that are supposed to be inherited,
+	 * but not the transient, overlayed, hardware
+	 * affinity constraints.
 	 */
-	p->thread.user_cpus_allowed = p->cpus_allowed;
+	p->thread.user_cpus_allowed = current->thread.user_cpus_allowed;
+	p->cpus_allowed = current->thread.user_cpus_allowed;
 #endif /* CONFIG_MIPS_MT_FPAFF */
 
 	if (clone_flags & CLONE_SETTLS)
-- 
1.5.3.3


--------------040406000605030509060700--

