From patchwork Mon Mar 2 19:19:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 5916831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CF7E3BF440 for ; Mon, 2 Mar 2015 19:22:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBE3820225 for ; Mon, 2 Mar 2015 19:22:11 +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 1C5AD20221 for ; Mon, 2 Mar 2015 19:22:11 +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 1YSVsz-0003yA-Dz; Mon, 02 Mar 2015 19:20:13 +0000 Received: from mail-by2on0602.outbound.protection.outlook.com ([2a01:111:f400:fc0c::602] helo=na01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YSVst-0002l5-8w for linux-arm-kernel@lists.infradead.org; Mon, 02 Mar 2015 19:20:10 +0000 Received: from BL2FFO11HUB022.protection.gbl (10.173.161.46) by BL2FFO11SHT006.protection.gbl (10.173.160.255) with Microsoft SMTP Server (TLS) id 15.1.99.6; Mon, 2 Mar 2015 19:19:44 +0000 Received: from BL2FFO11FD047.protection.gbl (10.173.160.32) by BL2FFO11HUB022.protection.gbl (10.173.161.46) with Microsoft SMTP Server (TLS) id 15.1.99.6; Mon, 2 Mar 2015 19:19:22 +0000 Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2FFO11FD047.mail.protection.outlook.com (10.173.161.209) with Microsoft SMTP Server (TLS) id 15.1.99.6 via Frontend Transport; Mon, 2 Mar 2015 19:19:22 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:59539 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1YSVkj-0003Ny-S7; Mon, 02 Mar 2015 11:11:41 -0800 From: Peter Crosthwaite To: , Subject: [PATCH] arm64: Implement cpu_relax as yield Date: Mon, 2 Mar 2015 11:19:14 -0800 X-Mailer: git-send-email 2.3.0.1.g27a12f1 X-TM-AS-Product-Ver: IMSS-7.1.0.1224-7.5.0.1018-21366.005 X-TM-AS-User-Approved-Sender: Yes;Yes;Yes Message-ID: X-EOPAttributedMessage: 0 Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Authentication-Results: spf=pass (sender IP is 149.199.60.100) 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.100; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(199003)(189002)(86362001)(48376002)(92566002)(106466001)(104016003)(50986999)(53416004)(46102003)(19580405001)(19580395003)(229853001)(50466002)(92726002)(74316001)(87936001)(62966003)(47776003)(50226001)(6806004)(108616004)(77156002)(107986001)(24736002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2FFO11HUB022; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2FFO11HUB022; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006); SRVR:BL2FFO11HUB022; BCL:0; PCL:0; RULEID:; SRVR:BL2FFO11HUB022; X-Forefront-PRVS: 0503FF9A3E X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2015 19:19:22.6373 (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.100] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2FFO11HUB022 X-OriginatorOrg: xilinx.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150302_112007_415014_F9451B54 X-CRM114-Status: UNSURE ( 4.73 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: catalin.marinas@arm.com, peter.crosthwaite@xilinx.com, 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 Acked-by: Will Deacon --- 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 */