Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221AbbBXXko (ORCPT ); Tue, 24 Feb 2015 18:40:44 -0500 Received: from mail-by2on0064.outbound.protection.outlook.com ([207.46.100.64]:59584 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752769AbbBXXkm (ORCPT ); Tue, 24 Feb 2015 18:40:42 -0500 X-Greylist: delayed 1587 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Feb 2015 18:40:42 EST From: Peter Crosthwaite To: , CC: , , , Peter Crosthwaite Subject: [RFC PATCH] arm64: Implement cpu_relax as yield Date: Tue, 24 Feb 2015 15:07:37 -0800 Message-ID: <1424819257-22664-1-git-send-email-peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 2.3.0.1.g27a12f1 X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-7.5.0.1018-21354.006 X-TM-AS-Result: No--2.107-7.0-31-10 X-imss-scan-details: No--2.107-7.0-31-10 X-TMASE-MatchedRID: vlRzGnA4bgQe4uO5F9xV2duT7QQBFxJ3JDAZBInjo2bWgeiceig+bRl5 McgO0IVkRHLRFcKKZXfbCHv011Gy9Q2OK6Kq0xOR4pdq9sdj8LWk2H/b/X5aJZsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNWLMt3UJjPQvCQQ/SvV3kIkgWGSgHz2sUUODUKNvuLaFwnO77H59DXiiLY rSutuYeZ612t+gZmxH8o0EqS/oR4qI14BtOolRiDKgHg/t0KH2U8mdcvbI1h2S6jzjuXTm0MTMz ICazP4UehYtaVdyxm8= X-EOPAttributedMessage: 0 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=peter.crosthwaite@xilinx.com; lists.infradead.org; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:149.199.60.96;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(339900001)(189002)(199003)(16796002)(50986999)(33646002)(87936001)(86362001)(62966003)(64026002)(46102003)(77156002)(71366001)(64706001)(47776003)(36756003)(77096005)(19580395003)(92566002)(19580405001)(50226001)(6806004)(85426001)(105606002)(229853001)(48376002)(106466001)(50466002)(107986001)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1BFFO11HUB011;H:xsj-tvapsmtpgw01;FPR:;SPF:Fail;PTR:unknown-60-96.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB011; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004);SRVR:BN1BFFO11HUB011;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB011; X-Forefront-PRVS: 04976078F0 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2015 23:08:06.1690 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.96] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1BFFO11HUB011 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1322 Lines: 38 ARM64 has the yield nop hint which has the intended semantics of cpu_relax. Implement. The immediate application is ARM CPU emulators. An emulator can take advantage of the yield hint to de-prioritise an emulated CPU in favor of other emulation tasks. QEMU A64 SMP emulation has yield awareness, and sees a significant boot time performance increase with this change. Signed-off-by: Peter Crosthwaite --- arch/arm64/include/asm/processor.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index f9be30e..ac2381d 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -126,7 +126,11 @@ extern void release_thread(struct task_struct *); unsigned long get_wchan(struct task_struct *p); -#define cpu_relax() barrier() +static inline void cpu_relax(void) +{ + asm volatile("yield" ::: "memory"); +} + #define cpu_relax_lowlatency() cpu_relax() /* Thread switching */ -- 2.3.0.1.g27a12f1 -- 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/