From patchwork Sun Dec 27 13:23:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 561168 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 8D3DF140C88 for ; Mon, 28 Dec 2015 00:32:05 +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 1aDBQa-0002Or-2z; Sun, 27 Dec 2015 13:32:04 +0000 Received: from mail-am1on0057.outbound.protection.outlook.com ([157.56.112.57] helo=emea01-am1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aDBQX-0002M0-PF for linux-snps-arc@lists.infradead.org; Sun, 27 Dec 2015 13:32:02 +0000 Received: from AM3PR02CA0074.eurprd02.prod.outlook.com (10.163.180.42) by HE1PR02MB1451.eurprd02.prod.outlook.com (10.169.116.149) with Microsoft SMTP Server (TLS) id 15.1.361.13; Sun, 27 Dec 2015 13:31:36 +0000 Received: from DB3FFO11FD004.protection.gbl (2a01:111:f400:7e04::183) by AM3PR02CA0074.outlook.office365.com (2a01:111:e400:5365::42) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Sun, 27 Dec 2015 13:31:36 +0000 Authentication-Results: spf=fail (sender IP is 212.179.42.66) smtp.mailfrom=ezchip.com; arm.com; dkim=none (message not signed) header.d=none; arm.com; 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 DB3FFO11FD004.mail.protection.outlook.com (10.47.216.93) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Sun, 27 Dec 2015 13:31:35 +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; Sun, 27 Dec 2015 15:31:21 +0200 From: Noam Camus To: Subject: [PATCH v5 18/20] ARC: [plat-eznps] Use dedicated cpu_relax() Date: Sun, 27 Dec 2015 15:23:37 +0200 Message-ID: <1451222619-3610-19-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1451222619-3610-1-git-send-email-noamc@ezchip.com> References: <1451222619-3610-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22026.007 X-TM-AS-Result: No-0.947000-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; DB3FFO11FD004; 1:8mCulMc528SlWl7gdkvt7EVkoa7ZIddp7mweVmypOEuRdIuy62IajoyQh6FiEojikgL7txabi3bBUpjFUbnAb1Jc19AEEh/G1D8T3XPhuBrwlkEC7VJVXk8V+Z1Ziu70gLACJ8V0RM7FT4Veo1G4nsDwqaqKSpoedsJGh1KcVqiixLoPJ/vwEXLMwjY3jc0Cl8iNu0Q5SVtek1MvnHq52tjfbAgA4il4jaTUyqzgN62/6t//ljfzF8XJNj87YwQtBX673lHqGPMB8H5mra2XJQAFbZiEZHYXhS5xINNbyOueaqMEdCBRxrGJsXgmGYgQGfdiBTh/4l/AU/k0xd1RHQcZmeKxKxRhB+f0aKkq2J+8dVJvfJhzH5nSPvCeE/GqzRBTmXmb9c9MiyL2YL10ziAzxr1uweFm3+GC/8cDJDd42v3+VweryHpFqsjFFV1X X-Forefront-Antispam-Report: CIP:212.179.42.66; CTRY:IL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(3190300001)(339900001)(189002)(199003)(105606002)(229853001)(77096005)(5008740100001)(106466001)(36756003)(47776003)(104016004)(5001970100001)(5003940100001)(11100500001)(1220700001)(1096002)(6806005)(110136002)(189998001)(586003)(86362001)(85426001)(87936001)(19580405001)(50986999)(48376002)(33646002)(2950100001)(50226001)(2351001)(92566002)(50466002)(49486002)(19580395003)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR02MB1451; H:ezex10.ezchip.com; FPR:; SPF:Fail; PTR:ezmail.ezchip.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1451; 2:K0CMqz/PoddN3gHG1e+1MmV23GWN6Gvdl+GMCg/DVy6LSc9J2H149igu1XPl/mghJAv08eZxolRGcgkzRak1m7BN7n/s9Iy4eGqmRW8LHyP3/wG11F5JRj/ukjdp3jlxDYopvG8T9XgMvr/nfZ8ttg==; 3:G9zQEZfLjAsNV3168I1p6wtOqHPtPxrfepvK7vW9ol1GEczNcH8JKCX4N6F70l3huis83b8RB2FngIFv9t+4Oj97SEX8WeLhLwtdlwgO03I6aw+IdhIIEhpy/CSqTK2CZ3Q333hcQSDXLOxJ2WrwCBqvrkpwuoxauXe20AmDUgriN2Kd2naO3fLf/fFgPHN8XYbsfzpdjmfaZHt8WB5HIgRcWhut9jLVsgE3nY9GlpY=; 25:yED2Op+tHnsDBG0QT1ckBF6v3jW76jvRBW329vmaaptDBhtzByjIs77Wsds5QOAcGkk7SdUjRP2dfy+8vN9qN3VcCMStC0LLSCLO/7Lcd+HxX59jMClQUpzVcYSlx05Y/AsURONNS/03B5dhTctMtrX9I/gx6vEeGEuSDsRIw97W2Mjzj+/zNbcGl3FmqZDMJaB6vbAr8GWzf9FIwyiPZcat31koJx12spQWgwOybnIDXtgPPKblWrh1lHSBfrgQ; 20:YcYc9HCUOtX8T+4cq3rL2Ylyuncn/cTn23rdfQm7MHl/B4iSp7QL/X5h1ez34aSDv1oKJMVE0nMM8/LOc/gXDBUJP9o0BKXzYvFgVG8V5ob0Sfo9V2vGErVy5j8jsis+pZwZdH0AOJdhYRmaaxmUSFmXjD2m6SPca8+eFx4/jss= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB1451; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:HE1PR02MB1451; BCL:0; PCL:0; RULEID:; SRVR:HE1PR02MB1451; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1451; 4:J2xQjCiuhSqZQvaFQjkyhl5OxzhLDQ9YEUT2lVXdtE7hL29Dqb76UFwIih3xbms3ALlmjoo/kW3F++L7RjjabkFrQPaNLhLNRiw0oXLPpK9mfQykF+aJ8b1HWEMnIqWKuM8Vy7MK16uIW7/gwVwGQqoSjceOPMzSDzlEnNDaqLZ2Mz+ORynmAUEHH0d9NoCasvYOPegC1+1dODWmt4oN/3vyCGhWLvyxC9FLv7rEFis+DiMR8qbgdosawLvsGU1ztaOjjSj3xfDyIeXNo+BuQCklHO+KSEHaYCuAIgKtxyAvq2wMTGOOXv6vVq4qpav1Rk0b1iVzpxwCgTozH7HU6yloDfseSbMdG3urHXvBKNTOSW54bn5RbKnJF3FdoSEUuMe3ufAmfYOOfuoneIM52bhvTtsXw1szwBGGdjlZ7ho= X-Forefront-PRVS: 0803A0241F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR02MB1451; 23:V4+vBKxIWEZQACBBZ2ggzPDlZenfNFUijwx7qM1YP?= =?us-ascii?Q?Po7BIYNOK6WTLw4WpmaV6c0OXXqBcKKUxK0mR8nVB+NbPMIgn1QFnwAAfPnM?= =?us-ascii?Q?xLzxo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Xpx25lcdwm8GBxjWuL4xt?= =?us-ascii?Q?VEUFdK+86FAckkqBMEOhx6XJglyWf486M+ruxe3r/dbdt4JEteNO67yMGlbc?= =?us-ascii?Q?6Rl0Y0=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1451; 5:h8Ab/DNr2p3j6qjpO3WYZoFgxrO9lr/6QLvt4e3CyRncLftg5Oeyz6jyxH8PUy2O8jjuuOY4bZy5V5moDOzJ4gXyEJe+Gj/vPqf544o5cX0a9u6UPl36H5S+h228rea62Wwwqh9bp50ql+B6lS4BDQ==; 24:35LE0gjR5aD38385acDl500KgEB2DksWL8m4rl+gpA21FzRYUh93kP1B3RMbuMQs7PGVAIONlwLVkF78J0LZbo2iWrnBavsAFpvvJVzlj6M= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2015 13:31:35.9618 (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: HE1PR02MB1451 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151227_053202_274633_8AEA37E1 X-CRM114-Status: UNSURE ( 6.90 ) 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.56.112.57 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [157.56.112.57 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender 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: marc.zyngier@arm.com, daniel.lezcano@linaro.org, Tal Zilcer , linux-kernel@vger.kernel.org, Peter Zijlstra , 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 41142ab..974b878 100644 --- a/arch/arc/include/asm/processor.h +++ b/arch/arc/include/asm/processor.h @@ -57,9 +57,18 @@ struct task_struct; * A lot of busy-wait loops in SMP are based off of non-volatile data otherwise * get optimised away by gcc */ +#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 +#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)