Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1006257imm; Wed, 19 Sep 2018 10:22:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ9QPVjZltEOM0wrvymO26ZDkg6WdrSnEmpnrJ3dGL7axLJfBKr2Pgx7OD9DRcMBVewLato X-Received: by 2002:a17:902:b492:: with SMTP id y18-v6mr35582625plr.208.1537377720641; Wed, 19 Sep 2018 10:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537377720; cv=none; d=google.com; s=arc-20160816; b=WqWBBLJ8Uzf499K0Qf/XjXISZ7ICArLpEfJOB1TTya5W+TM3KPxVDo17de/ZoBLY7D wbBEdKpF4HdZvqklMAuH2CDGVTcRGP43hTXijlhBRU4vn8P3E3t14k8hGKtLlIdsyod3 PLMubxqgti13E+tBqJH79UzJFSEizySQ3txh1PXIjKLchTNWwRPBjTk098ZPoW1n97h8 XU4cm14hq2zHAlH1oPsxch+RKrfFt7qi74Uhx85QqQ7G3F2xKODPYyHYmpEyHFXN8n1z ctUruL91esBZpz/ReA0ezf7YxCt14tazUCLlXiDnHcMup5g2u9XENapKa2QB1vGW4C06 hIOQ== 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 :references:in-reply-to:mime-version:dkim-signature; bh=Qx6NJC2v/9AuvBpYoCol3poZhrOp9FfJwrOHdmd5Ak0=; b=srbH758Inggf9lcJgHBvAptFRc47hAjfXgJLibDMJcZ0A9drz1STzuQkckrdofipjw Xyex5tLgJCNkjm3Gq3MsPOhcn/95RVBo/tAbGpJd3kc5Cjc5Ns3CCDc9i+UkZmzf/Qex W3dKpnvpGxKMx6aPHYWRk+kEwZhSOyUF/ECtpvS9kmMN5tnttvFaXy6yjXyqTNRQKIMc CVsBEphamiWTtgt8l/7TY6rsDETRn34O3f3BSySjZ0Mv/v+zISHmpiyAmMHmiNuOXA5h C0c6UzDf9IsAFDC204CLUYCuYq62kBVpPbV2rA6jG26DsU87BeFTZj8G4zBuTlDmKgfK jPfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JcWdFjBG; 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 d36-v6si22083789pla.446.2018.09.19.10.21.44; Wed, 19 Sep 2018 10:22:00 -0700 (PDT) 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=JcWdFjBG; 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 S1732819AbeISXAQ (ORCPT + 99 others); Wed, 19 Sep 2018 19:00:16 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:44205 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731056AbeISXAQ (ORCPT ); Wed, 19 Sep 2018 19:00:16 -0400 Received: by mail-io1-f67.google.com with SMTP id u12-v6so99135ioc.11 for ; Wed, 19 Sep 2018 10:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Qx6NJC2v/9AuvBpYoCol3poZhrOp9FfJwrOHdmd5Ak0=; b=JcWdFjBGrwlEW8inXww05p5RWnTVPcWJ5v/k8s0ENylVW8/3bjmjWRtxTb07SSA8Ts JlX4tv48pAas9tqj77/u2viQOeYNtD2a5y8qtL0JtsQr0qAoyIYU7Vq7XoRiNVkf5Epd OMv+Z0b68bzsUEm5uWj0gBOveE//sbIg/UDPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Qx6NJC2v/9AuvBpYoCol3poZhrOp9FfJwrOHdmd5Ak0=; b=KrefppqqdLArh1TGF1cgsWXAyjmBK85jraG7DgV2CWM5iKA74Rx6PmIaJJZxXcPdR0 /vCTSLodLcd7ZPEYAtnUjF21Xzgeld5a3S8TeQ/oTnU62R/tfCQdcChnnn3r1pY0dNPN Uhlz+xa5xLea/QrIL3i9AtjmdMbbg9SJddlwqT9Lz5bVM45UuZcJNmpCwm/DVnvR44L3 eUSzBcbV/c4cuzDxrC+CEY9P62yVGx4v9cpQf4rB7REu9tT795OQ2IBBlQ52ewhWpR0J +SIahK02ZXDMMuYjU+wTIqCK4fcYEmr8HUsbC5BM0pByLa7fw/L/97N6hxJlN43wJxAT sINQ== X-Gm-Message-State: APzg51CsVnoh7xg89xHaAT4LKUsdsxEVf91HB+Gb0PcZfSYcU6DJr/wY m9CZOwFUh+pWD7B1gPw4yoLeqjriBjQJw8OW4X8IKqP2 X-Received: by 2002:a6b:4516:: with SMTP id s22-v6mr31472949ioa.60.1537377682150; Wed, 19 Sep 2018 10:21:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:2848:0:0:0:0:0 with HTTP; Wed, 19 Sep 2018 10:21:21 -0700 (PDT) In-Reply-To: <20180918210120.GA29812@zx2c4.com> References: <20180918161646.19105-1-Jason@zx2c4.com> <20180918210120.GA29812@zx2c4.com> From: Ard Biesheuvel Date: Wed, 19 Sep 2018 10:21:21 -0700 Message-ID: Subject: Re: [PATCH net-next v5 00/20] WireGuard: Secure Network Tunnel To: "Jason A. Donenfeld" Cc: Linux Kernel Mailing List , "" , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "David S. Miller" , Greg Kroah-Hartman 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 18 September 2018 at 14:01, Jason A. Donenfeld wrote: > Hi Ard, > > On Tue, Sep 18, 2018 at 11:28:50AM -0700, Ard Biesheuvel wrote: >> On 18 September 2018 at 09:16, Jason A. Donenfeld wrote: >> > - While I initially wasn't going to do this for the initial >> > patchset, it was just so simple to do: now there's a nosimd >> > module parameter that can be used to disable simd instructions >> > for debugging and testing, or on weird systems. >> > >> >> I was going to respond in the other thread but it is probably better >> to move the discussion here. >> >> My concern about the monolithic nature of each algo module is not only >> about SIMD, and it has nothing to do with weird systems. It has to do >> with micro-architectural differences which are more common on ARM than >> on other architectures *, I suppose. But generalizing from that, it >> has to do with policy which is currently owned by userland and not by >> the kernel. This will also be important for choosing between the time >> variant but less safe table based scalar AES and the much slower time >> invariant version (which is substantially slower, especially on >> decryption) once we move AES into this library. >> >> So a command line option for the kernel is not the solution here. If >> we can't have separate modules, could we at least have per-module >> options that put the policy decisions back into userland? >> >> * as an example, the SHA256 NEON code I collaborated on with Andy >> Polyakov 2 years ago is significantly faster on some cores and not on >> others > > Interesting concern. There are micro-architectural quirks on x86 too > that the current code actually already considers. Notably, we use an > AVX-512VL path for Skylake-X but an AVX-512F path for Knights Landing > and Coffee Lake and others, due to thermal throttling when touching the > zmm registers on Skylake-X. So, in the code, we have it automatically > select the right thing based on the micro-architecture. > > Is the same thing not possible with ARM? Do you not have access to this > information already, such that the module can just always do the right > thing and not require any user intervention? > That depends on what the right thing is. 'Fastest' does not necessarily mean 'optimal', and I guess the thermal throttling on Skylake-X may still result in the most power efficient implementation, which may be the preferred one in some contexts. The point is that this is a policy decision, and those belong in userland not in the kernel. > If so, that would be ideal. If not (and I'm curious to learn why not > exactly), then indeed we could add some runtime nobs in /sys/module/ > {algo}/parameters/{nob}, or the like. This would be super easy to do, > should we ever encounter a situation where we're unable to auto-detect > the correct thing. > > Regards, > Jason