From patchwork Tue Feb 24 23:07:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 5875781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB9F19F37F for ; Tue, 24 Feb 2015 23:12:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B1BA82024D for ; Tue, 24 Feb 2015 23:12:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB30D2022D for ; Tue, 24 Feb 2015 23:12:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YQOak-0000JC-Qp; Tue, 24 Feb 2015 23:08:38 +0000 Received: from mail-bn1bon0072.outbound.protection.outlook.com ([157.56.111.72] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YQOah-0008Vx-3D for linux-arm-kernel@lists.infradead.org; Tue, 24 Feb 2015 23:08:35 +0000 Received: from BN1BFFO11FD034.protection.gbl (10.58.144.33) by BN1BFFO11HUB011.protection.gbl (10.58.144.158) with Microsoft SMTP Server (TLS) id 15.1.99.6; Tue, 24 Feb 2015 23:08:06 +0000 Received: from xsj-tvapsmtpgw01 (149.199.60.96) by BN1BFFO11FD034.mail.protection.outlook.com (10.58.144.97) with Microsoft SMTP Server (TLS) id 15.1.99.6 via Frontend Transport; Tue, 24 Feb 2015 23:08:06 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:38563 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1YQOWP-00064z-2w; Tue, 24 Feb 2015 15:04:09 -0800 Received: from [127.0.0.1] (port=36138 helo=xsj-tvapsmtp02) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1YQOaD-0002Cd-5f; Tue, 24 Feb 2015 15:08:05 -0800 Received: from [172.19.74.49] (port=50970 helo=xsjsorenbubuntu.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1YQOaC-0002Ca-NG; Tue, 24 Feb 2015 15:08:04 -0800 From: Peter Crosthwaite To: , 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 Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 149.199.60.96 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.96; helo=xsj-tvapsmtpgw01; 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150224_150835_306617_FF56B93A X-CRM114-Status: UNSURE ( 4.17 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: catalin.marinas@arm.com, Peter Crosthwaite , michals@xilinx.com, will.deacon@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 */