Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753825AbbHEODs (ORCPT ); Wed, 5 Aug 2015 10:03:48 -0400 Received: from mail-am1on0055.outbound.protection.outlook.com ([157.56.112.55]:4247 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751712AbbHEODp (ORCPT ); Wed, 5 Aug 2015 10:03:45 -0400 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Chris Metcalf To: Ingo Molnar CC: Chris Metcalf , , , , , , , Subject: [PATCH v2] tile: Remove finish_arch_switch Date: Wed, 5 Aug 2015 10:03:32 -0400 Message-ID: <1438783412-10990-1-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <20150805074308.GA11651@gmail.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD050;1:ZwBCTfRYFIWErh+p87iU7Xkote8a4Y1OXK3mMzcu575dTdrtlgXYxaLTfa8XHC5WobT1BGGIH9qrxnqhzImljuG4h4a5X22ALy3mfxZz1u9s7ltNu7hoBT4QEx2b3rXgiAe63TGRujHreLvISn6MYnTS4jPCxMQl0VAjQNTpUE2rf63tZ4PUG2T/vc/YOK6WwSou1lCIbcgcmH1+Fhii6FEX+DZXk+M5HvEpCy4o5CwT+jFshYcIy4vYKpkmDWsPNADs1YWpVMm5+6PnO0+7+gHbViv/0RpT5v5ka2TX1f4c4agDaPf4wBYe7IrlmVxjbMNt7uYUAYCOkrIN5UoUPg== X-Forefront-Antispam-Report: CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(339900001)(199003)(189002)(106476002)(81156007)(19580395003)(19580405001)(106466001)(77156002)(6806004)(4001540100001)(64706001)(86362001)(42186005)(50466002)(92566002)(68736005)(104016003)(87936001)(85426001)(47776003)(229853001)(5003940100001)(36756003)(2950100001)(46102003)(5001960100002)(110136002)(50226001)(5001860100001)(62966003)(105606002)(50986999)(33646002)(97736004)(5001830100001)(106356001)(189998001)(48376002)(9376004)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR02MB0777;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;PTR:InfoNoRecords;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;HE1PR02MB0777;2:wRRmtYZAp3tbrK6PtvXrfQRfVJyPnP6r6rTC2IUFJgYYYgsAKYuXHWE8xB+WqvS2cNAQG95lWID6SYIy4iTQRs3l/6CUK2Yts9PM7Cls+nVMSg61qar/P0zzX1QzMlNvNX+XN1OE8k/JkxFcfvGOjiT6olSj1Qz7/1aoDzUUs9k=;3:bzfto7wXxqkXSZXh+bl7zAjE3nAWCf8OOQFT/a0pC7+5jX37+NTFE9XrXSITQ8BKmKTyarqotm5vgI+TQ/r4ZuOzwLwDDz33SWcF6hiUWSZYJxjwAkMZOaOg3KavO3UDA6AeA7G3Bmi7KmELsaP5EzMQVRtPSJabVcHBA2Cy5kWV9q5IEsnaPioWiTs6gl/9qMzdiPQc043qhCopqJ493bKHCoW4KPeANJv1bjfDNe2v+xvve6hoL7YaW6jcXiQe;25:VmWO3buOm4AhSgrZnyU2UJdtI0jCqhRC9uvwFheyv6hVu8sin1L8hCjyUE53lDwAnmXCHeKkR+l39Y1o9Punpel0z4dBgywtaXxQ/Ur5EjSlZNoA9yWHX6SfkJ2EB4C7fU15ZfHDLd+q7SGpGvQfSKv+f4vwRDfmBLqGUCFZ+WoO+gEa3+gxr6NqmnN7mhn0D3XRcRMycm0WiX5JZpaauu6sYRM/EQt7lNQttCWqk/+gpKyIchGn7RzflrR2g3pF9EW/4Uh3cjfphaGcUc/QnQ==;20:kl8g/jTEK6sFyC7NQIPOrEpgBIZWYW1bJLJ+cbvCZHKlHEZ/f9xRpb0oyK3SybVVzoS5lciaieCUX9WH6qXWUouOp0EPPdER9x7378+3lk6UteegHhPtcAIlEZ/T4kffvmGhxowzhfEo+yiAFhNB0uQb2aFlUsRRvD3dtBc5PbQ= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0777; HE1PR02MB0777: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:HE1PR02MB0777;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0777; X-Microsoft-Exchange-Diagnostics: 1;HE1PR02MB0777;4:cShj0joLBM/WksfmFY9Op1WFJ/9NpOQ1Abrv6Q+XU0IN9CuR+ft/caiRof+JvDzdRfyIptYzG93QR6cIHRU3FpezYdAImCiB4lDF5ocx5s/tg6ZGvyF41fF/hxgqO8uE+B3VEKIGSxKorhpsy0m92n3hqq7aqd6TT3ZiHLhGIHExZ9rV6x1N01jgTf0FS0FeIecFPg42jrPRN8Kg44g7mxq+N64toMJN/0n9mPNQ/SnU1XHF+fvSCXxzIB8NYQHYcgrPq7d5VHxB6yuxixfAj2pm8laqFGdOTaltB1PGGlA= X-Forefront-PRVS: 06592CCE58 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR02MB0777;23:dF9nDBqMe0Uja3Z+MdlGxkBuFmZmbzkk/P0DMlDz7?= =?us-ascii?Q?DBlXpv+VxLMsfYd4G1y7mNMaIQho7yTNLC4mCQaro0aYpFp/KS9i8UE+QD8o?= =?us-ascii?Q?CSwcbpBR8MQ74w69pUD7qtSNPTIbMJD/iroB1urVsCet9xLjV+YBCZTzzN4t?= =?us-ascii?Q?ptYRjd/H6EnUut3qw3lID1VuMeQXVjBTuOgnpLf9Wd1EL1aQYzrO+xH5CW2y?= =?us-ascii?Q?i6/3LZEFV6pxU1WOYsvKUECNFBmX35T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?Q?tx6XTOazPVfFeUVJbuMs5D854zxB7t0?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR02MB0777;5:R18Z/QFnSDYWKeS+60XYLUnzeIVHYpovoDhcn5xqY9gG+Qzd/CgcY7Id21AN1mwV7lH7K0k+1/N1MfTFUC2wvgaw7OKv2LttmXJxb+wuZe9WKukkYlBbrbjB8vYkG4VcpXb1WX72oT3FuSxBjZ8syg==;24:qmJwy0GxhWVxQhh9JrSXpvt5Tp+hZWIPTqj9pAS71Z7bLCefiPkWOFLPcPo2qT4o+zcTBKQmD3C6MPx8OERIFrOQhxqi1BeUWLk5wadBHxE=;20:ANk4Fm+tkpHFEN4XmQ6myYNoHWvXDui6S97kEXCoH/gHJ24eQeqU5N0hrWM2yFpawmLMwAUs6RHx75L9e1H8DQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2015 14:03:40.0265 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB0777 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2554 Lines: 57 Move the simulator bits into switch_to() and use finish_arch_post_lock_switch() for the homecache migration bits. Acked-by: Peter Zijlstra (Intel) Signed-off-by: Chris Metcalf --- arch/tile/include/asm/switch_to.h | 8 +++----- arch/tile/kernel/process.c | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/tile/include/asm/switch_to.h b/arch/tile/include/asm/switch_to.h index b8f888cbe6b0..34ee72705521 100644 --- a/arch/tile/include/asm/switch_to.h +++ b/arch/tile/include/asm/switch_to.h @@ -53,15 +53,13 @@ extern unsigned long get_switch_to_pc(void); * Kernel threads can check to see if they need to migrate their * stack whenever they return from a context switch; for user * threads, we defer until they are returning to user-space. + * We defer homecache migration until the runqueue lock is released. */ -#define finish_arch_switch(prev) do { \ - if (unlikely((prev)->state == TASK_DEAD)) \ - __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_EXIT | \ - ((prev)->pid << _SIM_CONTROL_OPERATOR_BITS)); \ +#define finish_arch_post_lock_switch() do { \ __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_SWITCH | \ (current->pid << _SIM_CONTROL_OPERATOR_BITS)); \ if (current->mm == NULL && !kstack_hash && \ - current_thread_info()->homecache_cpu != smp_processor_id()) \ + current_thread_info()->homecache_cpu != raw_smp_processor_id()) \ homecache_migrate_kthread(); \ } while (0) diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index a45213781ad0..7d5769310bef 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c @@ -446,6 +446,11 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, hardwall_switch_tasks(prev, next); #endif + /* Notify the simulator of task exit. */ + if (unlikely(prev->state == TASK_DEAD)) + __insn_mtspr(SPR_SIM_CONTROL, SIM_CONTROL_OS_EXIT | + (prev->pid << _SIM_CONTROL_OPERATOR_BITS)); + /* * Switch kernel SP, PC, and callee-saved registers. * In the context of the new task, return the old task pointer -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/