Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2881316ybn; Thu, 26 Sep 2019 19:55:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRI9U+ndkI0jxhti5Yyb4d27bnX0m1XPF06tsefODZpb7Gn88MZ2yORF4DZzJY2i3thsSi X-Received: by 2002:a50:aa8e:: with SMTP id q14mr2175220edc.155.1569552908759; Thu, 26 Sep 2019 19:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569552908; cv=none; d=google.com; s=arc-20160816; b=qB4ejVZXCI76Vpp9i0A0pas5aoFycBgWZzSrJUB80vuj7FCtdXtGhhRCz5ta0c33xY f09vexzDNb7+RKygBD2e7sFX5RZp8QKuVOm2V6LGdHcddnfS3lH/iSnbRqXRpL/A0SQ9 pg1HRDeFHYkDMAeJlsnCw6PBSZlLTcI9m5yXsgzR28yv945U5iPN6Zx4rYRq5gv8MiWp /HoND+xSNwIJgsbfhvrJr1vjfvB0oMWclB6WuBQj0t+8nGnEq00kUkFGb9UaWeXGYahG LfT3ow9BCt6gwLDLcWMqmtNJ5/u5/t482BtDGb4p4nEyASKH4+05G6pKlm0+ZXJIdS6i bXTg== 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=izprtTacDNeg/U0ozkxIJBmawaAbDPW9muDV/dWzvVY=; b=PfsZ+8g3n8mhEiF6BVy0iUZf8rNfVHMRI2YKt75xhZ4fIw3Ut32sjBSEhfIkjVgbA1 f9IgOcld8muEFp//6mCBwKLQtYwOScXNilV1jt/33gEuoWYaIJrJxuzVav0FnSzZkYCt Rx9JtwVaJ1EkeGUJCRvL/qQ+ZuGvtq6HwfbqGZ9UgeusytiyVzNRgVJLiZAeR0ZF1jwv X8kus9mGz4p2pyp3eHmuoq2wtN8uoV/qTo3MEJ64NW38kswvwy8qo6CZFUjQSFQ+hfqr 3SJzlLYLNQRXTlUSwU2VJ00Jkvr+MDfZqqKg4Y3td+GCrb3nj6r6Dcr1tp0Av9xRahbS Zo/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=abf33mtR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si2006387ejx.236.2019.09.26.19.54.32; Thu, 26 Sep 2019 19:55:08 -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=@linux-foundation.org header.s=google header.b=abf33mtR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728270AbfI0CyZ (ORCPT + 99 others); Thu, 26 Sep 2019 22:54:25 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44092 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727631AbfI0CyZ (ORCPT ); Thu, 26 Sep 2019 22:54:25 -0400 Received: by mail-lj1-f195.google.com with SMTP id m13so923785ljj.11 for ; Thu, 26 Sep 2019 19:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=izprtTacDNeg/U0ozkxIJBmawaAbDPW9muDV/dWzvVY=; b=abf33mtRxt+TnpRpol1admztTaB2ANRYfIf06LL3Lr5koIfkLhJoEtK3jZumD3RuBH +P5INGOa46VPzThQlBpDZ+cAIYDeY46piId4HdvRTTg8h+eXIwNd0L7mRaO4GW+QPPeg PGX9Jug0rJHzno8LLPHlzUdGMzpETpO937XFw= 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=izprtTacDNeg/U0ozkxIJBmawaAbDPW9muDV/dWzvVY=; b=c4YsrgOC8H1COcz9j8huk9ct3vteKP1yuaos213a5YaffC5+xqey5N+5Qb4nolOSxr p1i89TLqqDTe/C/Tas0EPUVeUUBUqnBFJtSr918MevgQvWEc1PnNctpGSm0/B2E6/s15 aZ44baFcVJFRjKA9Q72MwVNQICYgMGAcvJWqDsGbeHKzFinkB3BzBQrgoy486Jxix673 QpMhg9taVAqAy9eFJPXyytrNnUzBEK+jQP68vGcTFIFt1ZBtlbWU4JHWXhbFEmDRxZL2 FvkDEZiYTSGbViupobUV4mH9vseMWMw7c0vNuwfO8j+y1QpRO0dSZk2+Nwfa9+Gno/zd 5Bdw== X-Gm-Message-State: APjAAAWGt4kwtlWmdxaVR5R4tGTTr34m2zw4xPuAEbWj0KSDi6SSkZK1 XUgNglW/awMw3JEaYqCC8vYUGTfiCew= X-Received: by 2002:a2e:9708:: with SMTP id r8mr1120882lji.58.1569552861219; Thu, 26 Sep 2019 19:54:21 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id r19sm195001ljd.95.2019.09.26.19.54.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Sep 2019 19:54:20 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id m13so923736ljj.11 for ; Thu, 26 Sep 2019 19:54:20 -0700 (PDT) X-Received: by 2002:a2e:2c02:: with SMTP id s2mr1146724ljs.156.1569552859807; Thu, 26 Sep 2019 19:54:19 -0700 (PDT) MIME-Version: 1.0 References: <20190925161255.1871-1-ard.biesheuvel@linaro.org> <20190925161255.1871-19-ard.biesheuvel@linaro.org> In-Reply-To: From: Linus Torvalds Date: Thu, 26 Sep 2019 19:54:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 18/18] net: wireguard - switch to crypto API for packet encryption To: Pascal Van Leeuwen Cc: Ard Biesheuvel , Linux Crypto Mailing List , Linux ARM , Herbert Xu , David Miller , Greg KH , "Jason A . Donenfeld" , Samuel Neves , Dan Carpenter , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Will Deacon , Marc Zyngier , Catalin Marinas 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 Thu, Sep 26, 2019 at 6:30 PM Linus Torvalds wrote: > > And once you have that cookie, and you see "ok, I didn't get the > answer immediately" only THEN do you start filling in things like > callback stuff, or maybe you set up a wait-queue and start waiting for > it, or whatever". Side note: almost nobody does this. Almost every single async interface I've ever seen ends up being "only designed for async". And I think the reason is that everybody first does the simply synchronous interfaces, and people start using those, and a lot of people are perfectly happy with them. They are simple, and they work fine for the huge majority of users. And then somebody comes along and says "no, _we_ need to do this asynchronously", and by definition that person does *not* care for the synchronous case, since that interface already existed and was simpler and already was mostly sufficient for the people who used it, and so the async interface ends up being _only_ designed for the new async workflow. Because that whole new world was written with just that case is mind, and the synchronous case clearly didn't matter. So then you end up with that kind of dichotomous situation, where you have a strict black-and-white either-synchronous-or-async model. And then some people - quite reasonably - just want the simplicity of the synchronous code and it performs better for them because the interfaces are simpler and better suited to their lack of extra work. And other people feel they need the async code, because they can take advantage of it. And never the twain shall meet, because the async interface is actively _bad_ for the people who have sync workloads and the sync interface doesn't work for the async people. Non-crypto example: [p]read() vs aio_read(). They do the same thing (on a high level) apart from that sync/async issue. And there's no way to get the best of both worlds. Doing aio_read() on something that is already cached is actively much worse than just doing a synchronous read() of cached data. But aio_read() _can_ be much better if you know your workload doesn't cache well and read() blocks too much for you. There's no "read_potentially_async()" interface that just does the synchronous read for any cached portion of the data, and then delays just the IO parts and returns a "here, I gave you X bytes right now, use this cookie to wait for the rest". Maybe nobody would use it. But it really should be possibly to have interfaces where a good synchronous implementation is _possible_ without the extra overhead, while also allowing async implementations. Linus