From patchwork Sat Nov 7 10:52:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 541261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 09BFF1402B4 for ; Sat, 7 Nov 2015 22:00:51 +1100 (AEDT) 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 1Zv1En-0000KK-JW; Sat, 07 Nov 2015 11:00:49 +0000 Received: from mail-db3on0057.outbound.protection.outlook.com ([157.55.234.57] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zv1El-0000Em-16 for linux-snps-arc@lists.infradead.org; Sat, 07 Nov 2015 11:00:47 +0000 Received: from AM3PR02CA0046.eurprd02.prod.outlook.com (10.242.240.46) by AM3PR02MB1140.eurprd02.prod.outlook.com (10.163.183.142) with Microsoft SMTP Server (TLS) id 15.1.318.15; Sat, 7 Nov 2015 11:00:23 +0000 Received: from AM1FFO11FD026.protection.gbl (2a01:111:f400:7e00::161) by AM3PR02CA0046.outlook.office365.com (2a01:111:e400:8800::46) with Microsoft SMTP Server (TLS) id 15.1.318.15 via Frontend Transport; Sat, 7 Nov 2015 11:00:24 +0000 Authentication-Results: spf=fail (sender IP is 212.179.42.66) smtp.mailfrom=ezchip.com; infradead.org; dkim=none (message not signed) header.d=none; infradead.org; dmarc=none action=none header.from=ezchip.com; Received-SPF: Fail (protection.outlook.com: domain of ezchip.com does not designate 212.179.42.66 as permitted sender) receiver=protection.outlook.com; client-ip=212.179.42.66; helo=ezex10.ezchip.com; Received: from ezex10.ezchip.com (212.179.42.66) by AM1FFO11FD026.mail.protection.outlook.com (10.174.64.215) with Microsoft SMTP Server (TLS) id 15.1.325.5 via Frontend Transport; Sat, 7 Nov 2015 11:00:23 +0000 Received: from localhost.localdomain (10.1.3.132) by ezex10.ezchip.com (10.1.1.4) with Microsoft SMTP Server (TLS) id 14.3.224.2; Sat, 7 Nov 2015 12:59:59 +0200 From: Noam Camus To: Subject: [PATCH v2 16/19] ARC: [plat-eznps] Use dedicated cpu_relax() Date: Sat, 7 Nov 2015 12:52:34 +0200 Message-ID: <1446893557-29748-17-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1446297327-16298-1-git-send-email-noamc@ezchip.com> References: <1446297327-16298-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-21926.006 X-TM-AS-Result: No--0.478000-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD026; 1:EbMixPzNHnBss2puvQmLk6h+1kseme3vNGNXKrYxOvL9fnbGh6xlUbx2qkiRx5BBQbQuKnw+04KBc2O7+jM+ZV1DOAAbjwEJf0Ruw+tWLVG8sFG2VR0OMzOWstD1uQ0LbCuEqfu6UsAVM1VQSdnPxpy8hB/o+/vGn03naZYuKB/rdjmoKSECLiU8YsvlBiiHbpb3PQNcZne7FTdKwTq//g1dhJPudanlDVSmCylvNEIb2a1MhPuNuB4TIBbLBjegY70ELjA96faZybEJXQYqlftJL2Jr0Fh4SyVA/zMzmQc/veRHSbjBFD3Nq2XU/9DcuI/F4LMop19Rj1LeOG4tH03xcsi0VUs99lk6rsL5yG6Ug3/vpQFgMcHErgPXCpWnT4/yn6D3u96yp0IMXlF0GQ== X-Forefront-Antispam-Report: CIP:212.179.42.66; CTRY:IL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(6806005)(5003940100001)(36756003)(49486002)(5007970100001)(50466002)(2351001)(5008740100001)(189998001)(48376002)(2950100001)(77096005)(229853001)(19580395003)(110136002)(33646002)(87936001)(104016004)(50226001)(106466001)(85426001)(19580405001)(92566002)(47776003)(50986999)(5001970100001)(76176999)(86362001)(105606002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR02MB1140; H:ezex10.ezchip.com; FPR:; SPF:Fail; PTR:ezmail.ezchip.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 2:Gvktl9yU9NPm2uUuvhYXl8GqO/a9hOs8XHgeo8vsnnOLINfJv8Zb9iuosvdPprecDLDbHPBiLC2XOwY1XcmH7EkitqBqmF3tULyU+34jv6j8ba/DHRZ0Y++XFVsC5JLo0rI/g3UK4U56Pl/duDRj23zF79QR9NDPC2qw39TX2mg=; 3:2N8R8qVxSrghurAAq6HbTOBaVu559LN9yFFk/x6K5mlzx5Q5L0dWOQ/FMhJgbvjusMWjrRzV68fBSTmurEjvT/AVJ2WaYKKEMKbhx6K2nEZM/hJ5KdpZ6aRMQDmGzV8iaeosMShF7gXMxy0EOp7NWHkGZd3GDnML/k/dnPIS22x13E1PEHv8JBTaWEbNw/1Ep9RhsoGKhNxnRUlFHfpaxiBAShyOkNR73g1G133A1EY=; 25:RoLbdYMTdrD7/6wphxQg6tkerr++JDq/6lBLf95jizGLQcXp1Es1CIYIELxXtFAN6td031BtyBLbOP8HQzu4TDjix4MEggQs8NWFrQTN/DrD8m+PwM2pY4W0VANF9C+mkLAupmmu+I7GLv58mpg/JOQLurQjFLgJPzjoV7jbLaX/iUnHWE5nOdcJPgCEeAP4NzLLUOSK31hTiHIeYMeWfcZq3g2liVl/Xy20iQ+pUbSfecnoAUMI9fF8UWYmeDe5; 20:QwU/dtM3CZAMAeZtyNCkssIxAhgZP2MsCojrGHyJ29wPsla92hnl6c2k3hfWNSCQFKSkGuP0VgivdmLuOi6K4fIZHRKB5uHVGA4KOpfUZppsJwQ1pzSm9d7dOcnUz8kdydymATjKCmXq0Xz6BNTnr54OVeiTgCUA5Kr3vA777aw= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR02MB1140; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001); SRVR:AM3PR02MB1140; BCL:0; PCL:0; RULEID:; SRVR:AM3PR02MB1140; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 4:O7act3LhhY7mgx2Rf7H8y321IuJkLR4txrDtsMr8CZOWcrbmf4lCKB9tRO5CyX+Tq6c4ioSKISt2L6uYdBLRBUqevS9OTJYorz62t4OcXu/U+RNCkISG2yk8OfysGQDSuG1pltZNYWTWkQEyg95QOgsEa0uvFuHzx3q1vi2ZEYS/hU3h/gmCmZl6RHWEybYNgEwmEYxfFauNIiuX2WjJlAYwcpQHrZAbMbxcZleW+30zniGVFyBaHkAeaqUVXagz0SEbHsF/Xyl+kJ9vK0JXC1OXVsLtetreD40VrggQ1xlMSsuO4xQVyBuTKREXk+jKQ6uxE20h/GyRNLfQQ+1bNlRmg77vLZHio1dyHJiieCKZB4j/WYQdSApLaQhqXCIM X-Forefront-PRVS: 0753EA505A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR02MB1140; 23:akfh/WATX1mNbVydFus65xSkgul68esT5pY19OWvp?= =?us-ascii?Q?COzUqD3dJbpLN85XKk6qEhraLz3WJGhu/pbW5OyC54+ynv4ZOSXj6RJCGYps?= =?us-ascii?Q?Wz3ctI7YviEIwLM15QS9ESB8GDTYGQDzBPWv0waMFDAaUT55XtZJfm2KGz2z?= =?us-ascii?Q?j9z2IJbmM/CTlciGInUmrzb1atuFPzcQaNoXYsu6lbZ/36WaT4TyXJSfVbtN?= =?us-ascii?Q?ro4waKnzunPel3D9knnTa6w9fHVR+mtkKOq5glc+2ufpd2jxeuDPs7qpMZpI?= =?us-ascii?Q?jtmloIHByKUk09qYbz3XThUpEllV5OIb+X+l0kW9rmY93lTYBRd0+LiDsYHj?= =?us-ascii?Q?y0cBYdGdPyDPAwkO9GU9JV/UkoUOCl97rV4g3noMUsAydBgfPch6T/nIaSUG?= =?us-ascii?Q?zPL7sd7qfA2qw/9apyAuKGwr7lOi88uX/AoTNq6tzm1pwZhrC5ogu1J+Rzm2?= =?us-ascii?Q?AyzgKNpDj2HarDCBpudDEy6qb6Vf3MImudukpgfJsHHUq0VbSinf1VvXEdeS?= =?us-ascii?Q?n+0FeqFK50GIauoiQYeI86pLRndaOarmHo/bD/UzYxuDXoDnw7qYcgBW6ZCb?= =?us-ascii?Q?6y0UoyKRJP5mZoESiEiL+RV6ac9xBCfveZpGTMaIfK/i//azCKXiJlx2sWCT?= =?us-ascii?Q?mE0pMXTSpWEv8EiUuzEWJFt8fGhcDl3SR8IjLD3JAvW/vAIhYUFoBidHPBri?= =?us-ascii?Q?yHM+zkgNi4SwfOIEWrrebcfKfwEZIINw9wgsnG2nFgDvcIhn8hqIqjitwwNw?= =?us-ascii?Q?nHM0Q7BbWGJjTQy+xWa7WkYOZwaVEGIzBSJc3RKT8u0IgtqSZGQUZ6nY7y0Q?= =?us-ascii?Q?IeRGLnvBhv/IOfFW1MQXyGVntXKUCELceyjxZOhUm7b75jirSi2iUF6CUYlJ?= =?us-ascii?Q?wEIAtOOtJeKKTSpguvD1upLWQsLaxae01OyFlxvqhwU4qOGp/FybNDEEiuop?= =?us-ascii?Q?7SOQijKnRDkxc2iyoJEkcVyn9sMyqaczIVMuDXq51RGCttmDTrs/hV9t0Qp8?= =?us-ascii?Q?Ic=3D?= X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 5:3yDl+nBC0V/9QiQbGYSUZqqmn/SFqNypTBhEojm9LZT5027i/8OyEnkMZ6XN0aRiT4tHvop7vssNgUZG92L5H0mQ3CmPQxMqQGmtstKT5/LF5Ij8ON1lSFUH5UOGYka/xxK+LHYjTJ/3Wc2wnLjmRw==; 24:yprcwlnBV3ILnRtOB4J6KD+E8ybw045M8EHHDIIuxSiOk3SG2qyQfOJuFKyx+7A8MwGRioG4hedOpYPnlFFPrsEVLFA7eshoEeowNScz5xk=; 20:Fozo7dZrlg8oTUC6PvCPxLlieWI4CMQHSx+eTa9vhJey/eKcBAlqzUdgAjq4ICfL5p7LMtTVJH7VHXu1v9SOXw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2015 11:00:23.4395 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3; Ip=[212.179.42.66]; Helo=[ezex10.ezchip.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR02MB1140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151107_030047_415737_EF4A715A X-CRM114-Status: UNSURE ( 5.56 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [157.55.234.57 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.55.234.57 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gilf@ezchip.com, Peter Zijlstra , talz@ezchip.com, linux-kernel@vger.kernel.org, cmetcalf@ezchip.com, Noam Camus Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Tal Zilcer Since the CTOP is SMT hardware multi-threaded, we need to hint the HW that now will be a very good time to do a hardware thread context switching. This is done by issuing the schd.rw instruction (binary coded here so as to not require specific revision of GCC to build the kernel). sched.rw means that Thread becomes eligible for execution by the threads scheduler after all pending read/write transactions were completed. Implementing cpu_relax_lowlatency() with barrier() Since with current semantics of cpu_relax() it may take a while till yielded CPU will get back. Signed-off-by: Noam Camus Cc: Peter Zijlstra Acked-by: Vineet Gupta --- arch/arc/include/asm/processor.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h index 7266ede..50f9bae 100644 --- a/arch/arc/include/asm/processor.h +++ b/arch/arc/include/asm/processor.h @@ -58,12 +58,21 @@ struct task_struct; * get optimised away by gcc */ #ifdef CONFIG_SMP +#ifndef CONFIG_EZNPS_MTM_EXT #define cpu_relax() __asm__ __volatile__ ("" : : : "memory") #else +#define cpu_relax() \ + __asm__ __volatile__ (".word %0" : : "i"(CTOP_INST_SCHD_RW) : "memory") +#endif +#else #define cpu_relax() do { } while (0) #endif +#ifndef CONFIG_EZNPS_MTM_EXT #define cpu_relax_lowlatency() cpu_relax() +#else +#define cpu_relax_lowlatency() barrier() +#endif #define copy_segments(tsk, mm) do { } while (0) #define release_segments(mm) do { } while (0)