From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81EE8C433E0 for ; Thu, 4 Feb 2021 10:36:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4AA6664DDE for ; Thu, 4 Feb 2021 10:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235394AbhBDKf6 (ORCPT ); Thu, 4 Feb 2021 05:35:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:42628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235611AbhBDKef (ORCPT ); Thu, 4 Feb 2021 05:34:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 896B164E43; Thu, 4 Feb 2021 10:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612434833; bh=qUSmXmDQ2dLtxjBzj2Gr0CFZ0JoPsDW59/wmRF9PWbM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Pyoh2quCGRQ1SdeW0ydtU4oO5R/2DhENYpkdimSTLbbiURuq0cvRqrHdvISaveDZg mudjhfFURkSeUchQJLaC+bUnL2aFx40D9ToZGiol4zasM2bC48dmtvwxrHJyg6SlnR 94Q1LnqQROIp3+V4lqcBTkDBD26cQpr+ndIuG6gbb8lrs0qKq73m3tT3sRpXxkArO/ fwsTIJhFNIXNIUSdbA+bgD9JMESDYpN+mAMqogkCMUg0Gz7HooJ3PsmzrHMP/9CXE5 opx4P3fOoJGoBz5ZEv5d9xgUBowCtDdVY4q+QXGC6d5lukO02H0643mmRTqp2zsdU+ sbvsKeX7G16qQ== Date: Thu, 4 Feb 2021 10:33:48 +0000 From: Will Deacon To: Ard Biesheuvel , linux-crypto@vger.kernel.org Cc: catalin.marinas@arm.com, kernel-team@android.com, mark.rutland@arm.com, Dave Martin , Eric Biggers , herbert@gondor.apana.org.au, linux-arm-kernel@lists.infradead.org Subject: Re: (subset) Re: [PATCH v2 0/9] arm64: rework NEON yielding to avoid scheduling from asm code Message-ID: <20210204103347.GA20410@willie-the-truck> References: <20210203113626.220151-1-ardb@kernel.org> <161238528350.1984862.12324465919265084208.b4-ty@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161238528350.1984862.12324465919265084208.b4-ty@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Feb 03, 2021 at 09:31:31PM +0000, Will Deacon wrote: > On Wed, 3 Feb 2021 12:36:17 +0100, Ard Biesheuvel wrote: > > Given how kernel mode NEON code disables preemption (to ensure that the > > FP/SIMD register state is protected without having to context switch it), > > we need to take care not to let those algorithms operate on unbounded > > input data, or we may end up with excessive scheduling blackouts on > > CONFIG_PREEMPT kernels. > > > > This is currently handled by the cond_yield_neon macros, which check the > > preempt count and the TIF_NEED_RESCHED flag from assembler code, and call > > into kernel_neon_end()+kernel_neon_begin(), triggering a reschedule. > > This works as expected, but is a bit messy, given how much of the state > > preserve/restore code in the algorithm needs to be duplicated, as well as > > causing the need to manage the stack frame explicitly. All of this is better > > handled by the compiler, especially now that we have enabled features such > > as the shadow call stack and BTI, and are working to improve call stack > > validation. > > > > [...] > > Applied first patch only to arm64 (for-next/crypto), thanks! Oops, looks like I typo'd the external branch (for-next/crypo). No offense intended! I'll rename it now; SHAs will stay the same. Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 043F6C433DB for ; Thu, 4 Feb 2021 10:35:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 944BA64DDE for ; Thu, 4 Feb 2021 10:35:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 944BA64DDE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FadexPe7LzgZhpxoRVihuwp/oFlY+qylESou1MNKHBM=; b=Ovatf+XfHJI/4IR5AdvnqB7kg iHLa0mwLOOEJhTQBRr9LFssFa0mw3hY5smxFpprafmBNxuz+B1QYYI69ILz2uDjSdFlo9aPvq3E33 6i1Kehbrva1AQ4LuxARAAK67Qr29ZhjleaFmSkqH6EzWTr2sJLlFVXmB0LXJpxBwv1JIpUJvZlByC VnCsMBQqL3mFQRFXaNyhxHo5s7SnwAlshC4p1vx4K9LWGHsYIqCcvZoCy1eAkT+lIQLSCRl4CrFFY GF/JWllQtqtUT0Jbc6ENYq3PyL1YrxJhoOfipvY3ft2X2bkUNxJ91buplsvZsPBmeja/uzBS5QCUV bzQUfiBNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7bxW-0006ge-Pb; Thu, 04 Feb 2021 10:33:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7bxT-0006fK-4X for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2021 10:33:56 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 896B164E43; Thu, 4 Feb 2021 10:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612434833; bh=qUSmXmDQ2dLtxjBzj2Gr0CFZ0JoPsDW59/wmRF9PWbM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Pyoh2quCGRQ1SdeW0ydtU4oO5R/2DhENYpkdimSTLbbiURuq0cvRqrHdvISaveDZg mudjhfFURkSeUchQJLaC+bUnL2aFx40D9ToZGiol4zasM2bC48dmtvwxrHJyg6SlnR 94Q1LnqQROIp3+V4lqcBTkDBD26cQpr+ndIuG6gbb8lrs0qKq73m3tT3sRpXxkArO/ fwsTIJhFNIXNIUSdbA+bgD9JMESDYpN+mAMqogkCMUg0Gz7HooJ3PsmzrHMP/9CXE5 opx4P3fOoJGoBz5ZEv5d9xgUBowCtDdVY4q+QXGC6d5lukO02H0643mmRTqp2zsdU+ sbvsKeX7G16qQ== Date: Thu, 4 Feb 2021 10:33:48 +0000 From: Will Deacon To: Ard Biesheuvel , linux-crypto@vger.kernel.org Subject: Re: (subset) Re: [PATCH v2 0/9] arm64: rework NEON yielding to avoid scheduling from asm code Message-ID: <20210204103347.GA20410@willie-the-truck> References: <20210203113626.220151-1-ardb@kernel.org> <161238528350.1984862.12324465919265084208.b4-ty@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <161238528350.1984862.12324465919265084208.b4-ty@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210204_053355_302870_F7942A3B X-CRM114-Status: GOOD ( 17.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, herbert@gondor.apana.org.au, Eric Biggers , catalin.marinas@arm.com, kernel-team@android.com, Dave Martin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 03, 2021 at 09:31:31PM +0000, Will Deacon wrote: > On Wed, 3 Feb 2021 12:36:17 +0100, Ard Biesheuvel wrote: > > Given how kernel mode NEON code disables preemption (to ensure that the > > FP/SIMD register state is protected without having to context switch it), > > we need to take care not to let those algorithms operate on unbounded > > input data, or we may end up with excessive scheduling blackouts on > > CONFIG_PREEMPT kernels. > > > > This is currently handled by the cond_yield_neon macros, which check the > > preempt count and the TIF_NEED_RESCHED flag from assembler code, and call > > into kernel_neon_end()+kernel_neon_begin(), triggering a reschedule. > > This works as expected, but is a bit messy, given how much of the state > > preserve/restore code in the algorithm needs to be duplicated, as well as > > causing the need to manage the stack frame explicitly. All of this is better > > handled by the compiler, especially now that we have enabled features such > > as the shadow call stack and BTI, and are working to improve call stack > > validation. > > > > [...] > > Applied first patch only to arm64 (for-next/crypto), thanks! Oops, looks like I typo'd the external branch (for-next/crypo). No offense intended! I'll rename it now; SHAs will stay the same. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel