Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp302768ybi; Fri, 24 May 2019 04:10:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSfBVhKrr/5r6SHl4Eg8ImEnuVoHhPddq1cPjydfr8pZCZ1IwPj9h2C7yZerSZ2pCc8Pv4 X-Received: by 2002:a17:902:5ac9:: with SMTP id g9mr105572732plm.134.1558696220518; Fri, 24 May 2019 04:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558696220; cv=none; d=google.com; s=arc-20160816; b=lvxuPF7nr3znDslV1kFW/RUVb8vv3TDgy1q2EAfZMXK+3UTlv5w9zN8SjCXilC5Ary EROYro4UEtyZLe02MBGX8q7gtkLBgM0ssRnxKljvL4QkbAFoAbJfa88/xmipUSONynzh 6PKTkgjFlPC5Nf7mxrUSDxOdYKO8Qbp04iUxXNJaFvNJT6radQO+my11oWlcEtdKDWCf NJ7BfT4xiiICFCDznq1a62QCNbPSDN6mOLh5U0QG2sDmP7PPgMDK345dzlD5t1haNauY vUIxSNgSFEXrx51z+uyiNDGRFlAn0XTGJ85NW/9Phun4UIwrBUJ83tedWHfO5+jKMYhW yNNA== 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=ecWAffExgMOh6fC4F5DAN6LdGHJhegyGR6+xIjTg6/0=; b=IrXqnPdWy60rWqPVNms9lg19nsdJRJz5sQMrrBmLo6DZal5R1QjvbyxXK2xVNYmzWd O/Ootj3F+qYQgbrsKM7x6pwdLpbUVbeA8kocovKDQtWAZtQXLRibf7kV4XkovcbJOWe6 ZtebhDMrmaKi9I7Hy/YmV1hye9aHEiznT5PtUfgO0zevvm8qgNsWsL3e4o/sxPpjKIPX cR+HQToWA5ItP+PYmyTJ0QEOH3w7YLhEHLmfbjfbVzpnvkR3bRaUxZXdM3ci7rzwCA0U 61nO7ov81LBEkT36I60Wal71sl165fR1QPBCMFaviox2def/B+fD5a5T/GTbtAgvhWlO O7PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zMjNHVLR; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 y37si3578939pgl.71.2019.05.24.04.10.00; Fri, 24 May 2019 04:10:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=zMjNHVLR; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S2390699AbfEXLJs (ORCPT + 99 others); Fri, 24 May 2019 07:09:48 -0400 Received: from mail-it1-f179.google.com ([209.85.166.179]:51516 "EHLO mail-it1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390565AbfEXLJs (ORCPT ); Fri, 24 May 2019 07:09:48 -0400 Received: by mail-it1-f179.google.com with SMTP id m3so15090045itl.1 for ; Fri, 24 May 2019 04:09:48 -0700 (PDT) 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=ecWAffExgMOh6fC4F5DAN6LdGHJhegyGR6+xIjTg6/0=; b=zMjNHVLR/aohuUbPkGZFTQDiCuPn8zxdNXuisoVVgcDRJtxmYvOjWOA/8HZ/e9AYsj eqR22yqzFeqAovZVTzYaXTcPEV8A2XGx8xx8iNK32AkviXqBlM2RIfxgx3bsJIuIKiVU xp2Mr+dXBVt51y5xGJgP7RoZ3A7+LePlIlPUSiXJ4UQ68DrN6XyP+gUhPzN3hKsI+Fd4 iZSHZ9BzqifahH+3mCftK1vLTk8ngxDMwsm3fQwo9F6PtHiWhoQGwROrR67+P2SiLg5a Fdif4FTS1T/7uKOn/O3leXg5P5QqN06SDkLnbpc9823jA/0oItUm6bEKVjZzgRDb221Z yDng== 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=ecWAffExgMOh6fC4F5DAN6LdGHJhegyGR6+xIjTg6/0=; b=V4lnJdErKnEQvvkW0t520BnjY/mBc/B2lOc3kQHFnJJsWHCaZu6i2/0i7k/VuTwYLK kMEiPi8RmlzEypQcCneFvBqnnk51oMcumDhKy0EyG4lzgP8SlJl6aK1dxUUX8JVuA8El 3r7jcoQPEBhhde3UcN+K/3FhRQHigE4D0EZN4XzHBPb7lVVq8cRUMyFz6Lc4fEcKVCwm nL1jC0IiUDxcci5fLuAo20YdSOBRx6vs42UDuBOP/IRSjDtksMFY3BQZ/PztzKlyddi+ CY7xXR0PDHRC+lM+UyGlV9pkcxnJkJCWC/ubalc5eww0g87gztZ/elyd1nJQ1SOtVaKd Pm2g== X-Gm-Message-State: APjAAAXaxEd5TFutCGraJixWdW9FMfqbwn+4SJ2CCZUyUc2l1gzUV85K d+rPH7GOcnzmqsdkuu4If4PSn13ap49bB3tROYNUOw== X-Received: by 2002:a02:9381:: with SMTP id z1mr28171025jah.130.1558696187418; Fri, 24 May 2019 04:09:47 -0700 (PDT) MIME-Version: 1.0 References: <20190523185833.GA243994@google.com> <20190523200557.GA248378@gmail.com> <20190523234853.GC248378@gmail.com> <907eb6a5-dc76-d5ee-eccf-e7bd426a0868@c-s.fr> In-Reply-To: From: Ard Biesheuvel Date: Fri, 24 May 2019 13:09:35 +0200 Message-ID: Subject: Re: another testmgr question To: Pascal Van Leeuwen Cc: Christophe Leroy , "linux-crypto@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, 24 May 2019 at 11:57, Pascal Van Leeuwen wrote: > > > Again, you are making assumptions here that don't always hold. Note that > > - a frozen process frees up the CPU to do other things while the > > crypto is in progress; > > - h/w crypto is typically more power efficient than CPU crypto; > > > True. Those are the "other" reasons - besides acceleration - to use hardware > offload which we often use to sell our IP. > But the honest story there is that that only works out for situations > where there's enough work to do to make the software overhead for actually > starting and managing that work insignificant. > > And even then, it's only a valid use case if that is your *intention*. > If you *just* needed the highest performance, you don't want to go through > the HW in this case (unless you have a *very* weak CPU perhaps, or a > huge amount of data to process in one go). > > The catch is in the "always". But how do you make an informed decision > here? The current Crypto API does not really seem to provide a mechanism > for doing so. In which case MY approach would be "if I'm not SURE that > the HW can do it better, then I probably shouldn't be doing in on the HW". > It becomes even more complicated to reason about if you take into account that you may have 10s or 100s of instances of the CPU crypto logic (one for each CPU) while the number of h/w IP blocks and/or parallel processing queues typically doesn't scale in the same way. But we are going down a rabbit hole here: even if you and I would agree that it never makes any sense whatsoever to use h/w accelerators from userland, the reality is that this is happening today, and so we have to ensure that all drivers expose an interface that produces the correct result for all imaginable corner cases. > > - several userland programs and in-kernel users may be active at the > > same time, so the fact that a single user sleeps doesn't mean the > > hardware is used inefficiently > > > I'm not worried about the *HW* being used inefficiently. > I'm worried about using the HW not being an improvement. > Evidently, it requires some care to use the AF_ALG interface meaningfully. But that does not mean it cannot ever be used in the right way.