Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5757038imu; Sun, 2 Dec 2018 02:49:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/X2gF8WTLBI/lHlg7kvdtPNfVGWm/aetWPatRpKZUG2QBAw4I+WzS2mai3Po9KmskOWo5wP X-Received: by 2002:a62:528e:: with SMTP id g136mr12497071pfb.111.1543747794082; Sun, 02 Dec 2018 02:49:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543747794; cv=none; d=google.com; s=arc-20160816; b=dPw8ybn1HrBkAPiDxwfKOUfPdt5axRR91aJSTR20s78QJMkc7dJvb8nNlaAdYQ3ISL mt845ABQcv+bipH6kqht5CngUaMBNqLNtc8P8zQiPQluBHPpQp9TRQcZF6wHMzpPpVnr vCRHRRxIcNdAp7yaPTtyOD/FQ6WmfBt7+lonB4f3KvZH5Ir674PMbEp9xA3pgD4FFCmT gvKeCl6No88LzlsrVdoNh0ayeu/3xB4/e+oYzWGDQGzK9oVZU8E1z8BeUNo2ujsc2KZb lJSHaz320ww+/kDAx5UEo8QeFsLIkZ/wPOq1gztSSLFa6eHSVoDCez94EFnksXO0FWQQ ZjKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=mK2m4pRkzORrtSlCmYcIZMGd7DTIjNlPILDPgZrkoEM=; b=lpInzSdnibHdtvzl5AZiIPhmFhsmq63cVIGd06aazIpKaeadCnqlAG4DYe8oWINXAX HInKdhKWvVJ5ndchyZuyEa/d65T5Oye8aO3IqoaFlXa1D2QgZEHDQR2tFQaI34SDNv0D Twu/KpZV4y3VuXlVsG2bd3j80dLc+4Mp68+mbvbZPYrNIy/6XArCMsEUcnl85DFbZFI7 +piV+6BBRC/+7CI+IHQYoVVZNAJ92EOBrbHWs8LMxFpe+imG7yvFDgrnfw2JsURHS2MY kYMvlhuMYaOdh1LsZ/zpM7E8bqenfqhsHMmzCIsqJCg6iuySwGKMhvI3Xpe6LrwnzpVc r22A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si10992159plp.183.2018.12.02.02.49.39; Sun, 02 Dec 2018 02:49:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725812AbeLBKrr (ORCPT + 99 others); Sun, 2 Dec 2018 05:47:47 -0500 Received: from sitav-80046.hsr.ch ([152.96.80.46]:47538 "EHLO mail.strongswan.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbeLBKrr (ORCPT ); Sun, 2 Dec 2018 05:47:47 -0500 Received: from book (unknown [IPv6:2a01:2a8:8506:9001:6fd1:b471:395b:f578]) by mail.strongswan.org (Postfix) with ESMTPSA id 5B28D40403; Sun, 2 Dec 2018 11:47:42 +0100 (CET) Message-ID: Subject: Re: [PATCH v2 3/6] crypto: x86/chacha20 - limit the preemption-disabled section From: Martin Willi To: Eric Biggers , linux-crypto@vger.kernel.org Cc: Paul Crowley , Milan Broz , "Jason A . Donenfeld" , linux-kernel@vger.kernel.org Date: Sun, 02 Dec 2018 11:47:42 +0100 In-Reply-To: <20181129230217.158038-4-ebiggers@kernel.org> References: <20181129230217.158038-1-ebiggers@kernel.org> <20181129230217.158038-4-ebiggers@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > To improve responsiveness, disable preemption for each step of the > walk (which is at most PAGE_SIZE) rather than for the entire > encryption/decryption operation. It seems that it is not that uncommon for IPsec to get small inputs scattered over multiple blocks. Doing FPU context saving for each walk step then can slow down things. An alternative approach could be to re-enable preemption not based on the walk steps, but on the amount of bytes processed. This would satisfy both users, I guess. In the long run we probably need a better approach for FPU context saving, as this really hurts performance-wise. For IPsec we should find a way to avoid the (multiple) per-packet FPU save/restores in softirq context, but I guess this requires support from process context switching. Best regards Martin