From patchwork Thu Mar 29 13:13:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10315423 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DEAC46055B for ; Thu, 29 Mar 2018 13:15:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D28BF2A364 for ; Thu, 29 Mar 2018 13:15:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C73072A36B; Thu, 29 Mar 2018 13:15:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29A482A364 for ; Thu, 29 Mar 2018 13:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=20mVkjJxSJKvnHW6uzg+LJjiWz4SauQiDfz5ggcIl4E=; b=ut23RYiDnl/Sr9673t+7+IxX6L 43twkyCELG9UgP2IcFjEVZi8KzwWL31cLpVkE3XnzqV0YJjODkl1nQ4oU7t9SlIyIL86S8edi01zx 6J3oIs0A4QSwdNnZt9lZWJ99OcsO5MCAPSKY9bkIqATdLzkJMPINadPR7QViOELFSHBYDlqWEOo0O A12jLBxAQ9HqPcVQFz9SvI73+dANei3U3RsOqzalydFRtMniKDF/Hq23Qkp6CuTV2rToqEu43aAnB qtWKL7YZ4E4msOY8XFj2ECgcWxXrV3bgN8fKlBrTjSB+FfsgTbFc9npLxrJclv2UASBInhpLo5aF3 rIZAp4pQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1XOS-0003O9-IV; Thu, 29 Mar 2018 13:15:04 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1XNI-0002jR-2z for linux-arm-kernel@lists.infradead.org; Thu, 29 Mar 2018 13:13:58 +0000 Received: by mail-wm0-x242.google.com with SMTP id l201so10725811wmg.0 for ; Thu, 29 Mar 2018 06:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WEaw7VPMgZCEU25X8qN6FpOt0GbRw4TFVnzER1vRqZw=; b=dRN7KO8qENj+2MpdLFLb4flR4/i/dsZHbE9K3CIdbmeFYYrpWTdoR7xZFvyUe85nav wtMgvaI3yajq9UF5ZhkwI7kwm/1F7g63aPXktpIOIKM9B9CghRPZ3veDho0rEpo0L/VF JM9D3J1X2HZUIW5yTS0rM4XHJEF/7w3Iq9WWg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WEaw7VPMgZCEU25X8qN6FpOt0GbRw4TFVnzER1vRqZw=; b=t0D3IiuXQFkWbboipmdku7oBbf+GM0fSVQM9LFrKWcJVw391BO9z9IL9c2ietu8gSA 9+NDfolGRDI04R1gFZmweoDZJ2obiMOommXIIg/NB1mEbk8ekjjMHyFMoQd7ncfzGqco 7Ts91SzI0iEX//nDoLdOSnLGfSfiaYnrXpwDya3Fhp+WFuswQ6zd8v0CQITvN+4btNF4 RKyrNMXLY4f01gC/CFR/rc1Dd2476QnpDwSkKU17aLylvxnI7ZFhDs1Zg2jg5A6oGQ5q dQcW1v8C/0ssJI6ZVLxrhelKRvBRhNAh3h7S8OEYXsG5TKL32GyBJd5SjCYUqhEFgKyU OOXw== X-Gm-Message-State: AElRT7EQ72o/DtAcGq93y80Rzz9DlTDA3Gvv7qY71avvVICIKG0YoPRu rNPCpoeH/zPhBE1x9JhEg1QiAT2Niww= X-Google-Smtp-Source: AIpwx49m2yQdAWV0u7zMIxUuGnlyGJ/7yWylqwva4n/s2/qHlJn8fHlpcFRy1B88WtPEbWPwCRd39g== X-Received: by 10.28.212.84 with SMTP id l81mr4792182wmg.151.1522329220112; Thu, 29 Mar 2018 06:13:40 -0700 (PDT) Received: from localhost.localdomain (187.14.136.77.rev.sfr.net. [77.136.14.187]) by smtp.gmail.com with ESMTPSA id l131sm4166526wmb.36.2018.03.29.06.13.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 06:13:39 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH resend v2 2/2] arm64: assembler: add macros to conditionally yield the NEON under PREEMPT Date: Thu, 29 Mar 2018 15:13:23 +0200 Message-Id: <20180329131323.15881-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180329131323.15881-1-ard.biesheuvel@linaro.org> References: <20180329131323.15881-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180329_061352_152734_08770BF8 X-CRM114-Status: GOOD ( 18.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: will.deacon@arm.com, dave.martin@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support macros to conditionally yield the NEON (and thus the CPU) that may be called from the assembler code. In some cases, yielding the NEON involves saving and restoring a non trivial amount of context (especially in the CRC folding algorithms), and so the macro is split into three, and the code in between is only executed when the yield path is taken, allowing the context to be preserved. The third macro takes an optional label argument that marks the resume path after a yield has been performed. Signed-off-by: Ard Biesheuvel Reviewed-by: Dave Martin --- arch/arm64/include/asm/assembler.h | 73 ++++++++++++++++++++ arch/arm64/kernel/asm-offsets.c | 3 + 2 files changed, 76 insertions(+) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index fe2ff3efe1f0..0bcc98dbba56 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -628,4 +628,77 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU .endif .endm +/* + * Check whether to yield to another runnable task from kernel mode NEON code + * (which runs with preemption disabled). + * + * if_will_cond_yield_neon + * // pre-yield patchup code + * do_cond_yield_neon + * // post-yield patchup code + * endif_yield_neon