From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85557C433E2 for ; Mon, 14 Sep 2020 22:44:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DE2DB20732 for ; Mon, 14 Sep 2020 22:44:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Cd9Si1L6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE2DB20732 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB3E390000D; Mon, 14 Sep 2020 18:44:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E65B58E0001; Mon, 14 Sep 2020 18:44:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D523890000D; Mon, 14 Sep 2020 18:44:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id BC27A8E0001 for ; Mon, 14 Sep 2020 18:44:14 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7B49A362E for ; Mon, 14 Sep 2020 22:44:14 +0000 (UTC) X-FDA: 77263146828.24.land75_0814a972710c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 542F21A4A5 for ; Mon, 14 Sep 2020 22:44:14 +0000 (UTC) X-HE-Tag: land75_0814a972710c X-Filterd-Recvd-Size: 7147 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Sep 2020 22:44:13 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id n22so1168853edt.4 for ; Mon, 14 Sep 2020 15:44:13 -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=HByVscULZ1aCzKEsNJOaDk74v0AyftSy1pTwuoj93qw=; b=Cd9Si1L6gfURzpvvo99txBSmG4fycZzpI1K602Rqdgokf4YjHKM5bshv0gBeRPoKoq S07+pMee3ja0pLLEif7+5dTcJ55cbbmX1a0rjsvg02GjZzwr0ekBVDISdAQ1ceTpPczJ 7r3vx/CHsgdJU8GacJiTsbr8oX1ECzkK1quPE= 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=HByVscULZ1aCzKEsNJOaDk74v0AyftSy1pTwuoj93qw=; b=j0+FUbitSCs5NaovMEVcZFnfTLGjQQCGquHcmAFpkTMJX9v6RLBjaNfiZ22Ehzvi3s ynujLeQumQfC+UQ9svGjaVA/9U2Lpu5d2ZIwhtU6WfWttnE0J/RKl7QpaVTbTrLP7vhF U/hWmAal6pB6ARm8M9jJHoeOyQYx4lCHyXJ+6gLTl+/CppPGzaqVsYApMGfn/VZbzck4 WtG8zps4yfZ71i2z53KZQEjJYmouUKa3XOf9nRV8rBqawZHVSQthRZpCjhYLE8RKJxJh fITmrK3KUl/rJe8nEbqHxYZ4N+zqJ7tNde+PIiWBmoTyi80WhwRVU8pRELqdoe+Goub+ /Phg== X-Gm-Message-State: AOAM533psskJN4AOYgkNbpnj0LBwyIly4AYIwCbfCqcaMWpQUlbjzE00 SCcoRGUgi2NyYRqybtYXuq4rSkGg+c54nA== X-Google-Smtp-Source: ABdhPJxPxwbCwHclFsI+pYMrjxzm8dOOLjiUqqyq1beNrT0tKcwuweTLkW8upOCmAy7R3j330Gwlow== X-Received: by 2002:aa7:c256:: with SMTP id y22mr18886751edo.16.1600123452284; Mon, 14 Sep 2020 15:44:12 -0700 (PDT) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com. [209.85.221.51]) by smtp.gmail.com with ESMTPSA id q17sm8595359ejd.90.2020.09.14.15.44.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 15:44:12 -0700 (PDT) Received: by mail-wr1-f51.google.com with SMTP id k15so1233699wrn.10 for ; Mon, 14 Sep 2020 15:44:11 -0700 (PDT) X-Received: by 2002:ac2:5594:: with SMTP id v20mr5351814lfg.344.1600123085147; Mon, 14 Sep 2020 15:38:05 -0700 (PDT) MIME-Version: 1.0 References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> In-Reply-To: From: Linus Torvalds Date: Mon, 14 Sep 2020 15:37:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 00/13] preempt: Make preempt count unconditional To: Thomas Gleixner , Ard Biesheuvel , Herbert Xu Cc: LKML , linux-arch , Sebastian Andrzej Siewior , Valentin Schneider , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Jeff Dike , Richard Weinberger , Anton Ivanov , linux-um , Brian Cain , linux-hexagon@vger.kernel.org, Geert Uytterhoeven , linux-m68k , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Andrew Morton , Linux-MM , Ingo Molnar , Russell King , Linux ARM , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx , dri-devel , "Paul E. McKenney" , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , Shuah Khan , rcu@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 542F21A4A5 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Sep 14, 2020 at 3:24 PM Linus Torvalds wrote: > > Ard and Herbert added to participants: see > chacha20poly1305_crypt_sg_inplace(), which does > > flags = SG_MITER_TO_SG; > if (!preemptible()) > flags |= SG_MITER_ATOMIC; > > introduced in commit d95312a3ccc0 ("crypto: lib/chacha20poly1305 - > reimplement crypt_from_sg() routine"). As far as I can tell, the only reason for this all is to try to use "kmap()" rather than "kmap_atomic()". And kmap() actually has the much more complex "might_sleep()" tests, and apparently the "preemptible()" check wasn't even the proper full debug check, it was just a complete hack to catch the one that triggered. >From a quick look, that code should probably just get rid of SG_MITER_ATOMIC entirely, and alwayse use kmap_atomic(). kmap_atomic() is actually the faster and proper interface to use anyway (never mind that any of this matters on any sane hardware). The old kmap() and kunmap() interfaces should generally be avoided like the plague - yes, they allow sleeping in the middle and that is sometimes required, but if you don't need that, you should never ever use them. We used to have a very nasty kmap_atomic() that required people to be very careful and know exactly which atomic entry to use, and that was admitedly quite nasty. So it _looks_ like this code started using kmap() - probably back when kmap_atomic() was so cumbersome to use - and was then converted (conditionally) to kmap_atomic() rather than just changed whole-sale. Is there actually something that wants to use those sg_miter functions and sleep? Because if there is, that choice should come from the outside, not from inside lib/scatterlist.c trying to make some bad guess based on the wrong thing entirely. Linus