From patchwork Tue Dec 26 10:29:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 122730 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp779434qgn; Tue, 26 Dec 2017 02:31:23 -0800 (PST) X-Google-Smtp-Source: ACJfBoubP59yNtokedlFSrMzmth5xvApFObUkHYaQ+Qem7W6oMWoV2ZWRrMfNFoV2I9RHH++i0PT X-Received: by 10.98.242.67 with SMTP id y3mr24885641pfl.82.1514284282924; Tue, 26 Dec 2017 02:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514284282; cv=none; d=google.com; s=arc-20160816; b=v1+2Offv26CzJgYksE2m4HX9Cht1MKZbAFtL5CyYyJJBJFOEOoIWxsstr9lCF0w+zU WLIT2xA4bLXZRdzMr1XkS2+4LTMumR8fDcbtIHwGlLFCu2pLA7N/tNp+/InPkm2WF35F GirX+3h7XHbLTBJp4boaKAeROeDwLh7cCFagrlKBbTa30mTAgB8CgIMix0baFHwxZ7TW 3WtBhVp2JDCPgrtVUIqAXovSSGJNawH1W2EB+EsLi6D8NxeAZ8b6IGtxXDpCEHRZsgjq 5dgKW0A/oYZGFVSADkmvscLqf0E8phzFtmYUo2k1gdafEAHB7lYs1VusAgAcnnh0I5ne OgAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=pUlM6bflLg2O458f4GTJCNwhz/sR/9fYScn2QAM5ApM=; b=NvBqPEtuOICwp50A4/LMRKrxYTBgDPYl3t+HoVD7UspVuJ3eQKjShHz5/QVLgW7Oxi PUuv3KexxWamjry42EjXRYQ5vl/NLXTflJsrGUzNioUkhMhTsYXPaQEyLtLt82ck1O9D 3vvk7c19qs0miODO9XBwEqx4QWrCYGdpOyhCFxHDOr5Rsd4HXHnqr0X3d4nr1Nt/4NMT Hfahfq+KS7iJvTta6LbfOkBf09MeEnqkefwYnTOmDsQNqGiS8JDZweka6OLfxmyMlDTN 9NwNv7kBFcaMmHcnT9lrqq2T0oAIUsuooyITHwTClTBn7GEj/jSrA2IIx2bzMFGo3ZII ictQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzGpfaZT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a90si22682509plc.137.2017.12.26.02.31.22; Tue, 26 Dec 2017 02:31:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzGpfaZT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751287AbdLZKbS (ORCPT + 28 others); Tue, 26 Dec 2017 05:31:18 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45159 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949AbdLZKbN (ORCPT ); Tue, 26 Dec 2017 05:31:13 -0500 Received: by mail-wr0-f194.google.com with SMTP id o15so2113342wrf.12 for ; Tue, 26 Dec 2017 02:31:12 -0800 (PST) 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=pUlM6bflLg2O458f4GTJCNwhz/sR/9fYScn2QAM5ApM=; b=QzGpfaZTdDSoVv85u5z44wd8mm9qD+sjZG1XauTy9ZGPg2cn9mf5Wj5QXIyHn95OTE NlLjQa/+l0lakYLHjRHi1KT9jqwEK5Tw9wvkLmQ2AV/4Nf2O45KUAS19zDL3BhjrT8SO kCbzikXDS52PkU/0kdmMAZ0DUpUQhHp3QY1gE= 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=pUlM6bflLg2O458f4GTJCNwhz/sR/9fYScn2QAM5ApM=; b=CfkYLvG/Yu7Qr32E4/UzoW+Suy52JTjw9hxT62tUbactlVk4SV9dRxXRuIY+ICtW3E AmQlJ/4oueAdMAtzCl16NLun7gGpQuQgj8WkWaIFKwiytlcRYJ5JMvBxabkaFnJwgj89 dSUPbY6EWxKZSxOW5MqFQxUQtTUF2aflEZMzjixEa55ish4v2ZdH4ZUr91Ln7CS9Ig+1 dLZ+lSJEDQL0RnWmAkpvGM8KrHzdoGMQERlx/GTJX4LPvj/M/EWf5dX8V6WOC1ZiZE1m eU0sA0wLivXr5jq6CG4Nsae8t8xCKyoNKvXtSWczaycjmaBr9UdO19VcPGDu3nYC224y Jceg== X-Gm-Message-State: AKGB3mJl7G1hnD+0DzA9Nd38d3D8bYdG1pSu1JKqUzuypX4uiemTsvdK 32Ddt/p6jgkPW1Osfn/u7yY4SmztZXY= X-Received: by 10.223.136.13 with SMTP id d13mr25156641wrd.76.1514284270716; Tue, 26 Dec 2017 02:31:10 -0800 (PST) Received: from localhost.localdomain ([160.171.216.245]) by smtp.gmail.com with ESMTPSA id l142sm13974036wmb.43.2017.12.26.02.31.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Dec 2017 02:31:10 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Dave Martin , Russell King - ARM Linux , Sebastian Andrzej Siewior , Mark Rutland , linux-rt-users@vger.kernel.org, Peter Zijlstra , Catalin Marinas , Will Deacon , Steven Rostedt , Thomas Gleixner Subject: [PATCH v4 11/20] arm64: assembler: add macros to conditionally yield the NEON under PREEMPT Date: Tue, 26 Dec 2017 10:29:31 +0000 Message-Id: <20171226102940.26908-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171226102940.26908-1-ard.biesheuvel@linaro.org> References: <20171226102940.26908-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/arm64/include/asm/assembler.h | 64 ++++++++++++++++++++ arch/arm64/kernel/asm-offsets.c | 2 + 2 files changed, 66 insertions(+) -- 2.11.0 diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 9130be742a32..575d0f065d28 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -579,4 +579,68 @@ alternative_else_nop_endif #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