Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7000217imu; Mon, 3 Dec 2018 06:16:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/VowQQ2VfWD1nf2NaslP+SbGXF7a/TVewYvxNPCr/DrPh9pknjqVVF3Ko6H0MQRA5Kxh+Je X-Received: by 2002:a17:902:32c3:: with SMTP id z61mr16061493plb.114.1543846590825; Mon, 03 Dec 2018 06:16:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543846590; cv=none; d=google.com; s=arc-20160816; b=jJI7so+Yp2Ut2+f7rt7gz93NkEnWhRVAUCQtT81ojh1TCLHokCbKfITbtT/NCOJckC Q/wmH7sVzAXnML/+qldKuPF/B41jN+TT9eVu64P3OO6adQW3YWTRLx581s9FQnwFyjFO tm1u7keWdh3/ZO9WxjRcIlB6PagFWmPVGX9lzoD1zT0Hm8nrUQoXaqSV4S1v7nz9b43x 02/SZ+LApI0sFR8GuyWk5P7jq91YlFq+RlDvPrpE+Wg5B8IjVKE9s+JvEI4fImlseH90 rBTByZzxL4rOnDYK5q9OECo5vKtpEkgvX5vM0NCkMBPVoyASnl0zf84mMwdNfrmObIb6 fEpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rOAp832YU39L1SFpsJBacojfl0uFYgFOIfzrHiBHEL8=; b=V8sQUkB6HvwBSPaWczd/NAsGNjwE+DmUW1Hnb4GQQLQnmbppmXPAggdsg18CabTpA/ S3ReUxNlLVTjG5LqnbaHi4Cy26ocI8tAtPuGL6m812ADM69+sBjfawvude2H5sDCyCEF 7KzPrY/SAAGrMEs3tfMgPH+MACT1bmwPpfYIwXd2JUzUAQQGRHViqCRn20/4J5TVWJFV lGkCVwPKhRoyTU/WYoziG+wIAJChQ6PsOrWbxpiN2zlBErQskbh+dBaPGeE4G4LZQRkL Vid3djyUqsmHNGVx2++LcPaVQevHkMIZKxbIIeNJkpAnO6UudkEj0iiZht/536TxXN77 p9Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P6RgvDhs; 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 t20si13454777ply.359.2018.12.03.06.16.15; Mon, 03 Dec 2018 06:16:30 -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=P6RgvDhs; 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 S1726548AbeLCOPA (ORCPT + 99 others); Mon, 3 Dec 2018 09:15:00 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:36038 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbeLCOPA (ORCPT ); Mon, 3 Dec 2018 09:15:00 -0500 Received: by mail-io1-f67.google.com with SMTP id m19so10582240ioh.3 for ; Mon, 03 Dec 2018 06:13:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rOAp832YU39L1SFpsJBacojfl0uFYgFOIfzrHiBHEL8=; b=P6RgvDhsluF6FVojEfnCPpcxaRNKpP56V0pIDOdN9dVlz9ms9E+BimPHfna4pRrnAt miL8K5FM70ZjrYC5wOa7pdpn3a1ny9D0wjVYqUPR67Imq9CKQnqL+VNMSJTuLYZ0pfNI uADB5dNhxBtgt1rvuOQbMiNttleHFwol8kGnM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rOAp832YU39L1SFpsJBacojfl0uFYgFOIfzrHiBHEL8=; b=qcWsYQFIuQA6y5vK/GUBxQWUHM3T2g00b0ETLsK9ESpt1NGSFkwOjaogQUotOY8Kwo VBND4UiicCn+lXCALeJnzRQQQBGYhoNdlJU1hUpqon+oLMd/06ZDSxoIVRHO9C/RVLd8 PcxPCwLnwaCtbBiaU3CAVGLhxK0aP7K4aE+Q8D3G17F+XDUxOkzxMuX2JyC7WcgzsbIe 0mSDsrFaOft0j8QtQLthX0vPSbJomLga9kukJzY7kEC5GuIrsu0FLT/vbYcQJg89eaiz wvzUL1sTAGMz3LHTcUU428ILRBFIDitcQFBwOjTzTWKwRpBcYWyNtZafmdT2tXgxT9Pp rraQ== X-Gm-Message-State: AA+aEWaQh5YXyX6gIOTbZ1CzYkXcoWp0LEsCvebOq/C0FmJsfzWYr2cK vw5BSTusEILfSz35Slca7PeliMbxxEFnMR+MiGrOy0W0yqc= X-Received: by 2002:a5e:cb42:: with SMTP id h2mr7987761iok.60.1543846429531; Mon, 03 Dec 2018 06:13:49 -0800 (PST) MIME-Version: 1.0 References: <20181129230217.158038-1-ebiggers@kernel.org> <20181129230217.158038-4-ebiggers@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Mon, 3 Dec 2018 15:13:37 +0100 Message-ID: Subject: Re: [PATCH v2 3/6] crypto: x86/chacha20 - limit the preemption-disabled section To: Martin Willi Cc: Eric Biggers , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Paul Crowley , Milan Broz , "Jason A. Donenfeld" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2 Dec 2018 at 11:47, Martin Willi wrote: > > > > 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. > At Jason's Zinc talk at plumbers, this came up, and apparently someone is working on this, i.e., to ensure that on x86, the FPU restore only occurs lazily, when returning to userland rather than every time you call kernel_fpu_end() [like we do on arm64 as well] Not sure what the ETA for that work is, though, nor did I get the name of the guy working on it.