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 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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 9261EC433E2 for ; Mon, 14 Sep 2020 22:38:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D09820732 for ; Mon, 14 Sep 2020 22:38:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (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 2D09820732 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AE2B6E7EA; Mon, 14 Sep 2020 22:38:13 +0000 (UTC) Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id B332F6E7EA for ; Mon, 14 Sep 2020 22:38:11 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id w3so1076354ljo.5 for ; Mon, 14 Sep 2020 15:38:11 -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=MJGw7pjXoYxp7u7mQ5rjq517LssNSlMcAtEsGICik+V7NsNkTpDtRbHmb2ZWDY1ndc gqYhepqI1RKQ2ZnRb+YNderPcEzdRsvPDpVhc2Ju9EqpbJL/+a08MzB4RrVNagvh7xdf OwCACzXJMBEoOrhP05R/JhJBz6SpE0QcJPBV1TLPwD1hqDuQHet7VajemQenl/W7Bhv9 i79Mio2RVHlz3/kPxZj5NHGomSAUSb98NYtek2vS233il5BXv63D4FTyvCfHxQ2x3nOj EKdz/Os5sC+jb3UpzBOxz7XR5dIn/q4LUie3owrG4y9/lIM0HwDFIQZQmcKXbdHLnbQ+ ujqA== X-Gm-Message-State: AOAM532jYFAlCePZfzwzTJWrQwW5Cffl8LW5+jjO16rb1isR/q4SGGXx NSuP+OdRW2LVu2eNxfa+vsRpqTHecfjelg== X-Google-Smtp-Source: ABdhPJwMiUqxFUK7mstrD/8W7EdOczcmcZm3bIti9PLBd740rD/Rwcp77UTYsycUZ/PJCV9OVolB+A== X-Received: by 2002:a2e:5c89:: with SMTP id q131mr5438809ljb.352.1600123089613; Mon, 14 Sep 2020 15:38:09 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id 73sm3529374lff.118.2020.09.14.15.38.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 15:38:08 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id y17so984744lfa.8 for ; Mon, 14 Sep 2020 15:38:07 -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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , Lai Jiangshan , dri-devel , Ben Segall , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , linux-hexagon@vger.kernel.org, Will Deacon , Ingo Molnar , Anton Ivanov , linux-arch , Vincent Guittot , Brian Cain , Richard Weinberger , Russell King , David Airlie , Ingo Molnar , Geert Uytterhoeven , Mel Gorman , intel-gfx , Matt Turner , Valentin Schneider , linux-xtensa@linux-xtensa.org, Shuah Khan , "Paul E. McKenney" , Jeff Dike , linux-um , Josh Triplett , Steven Rostedt , rcu@vger.kernel.org, linux-m68k , Ivan Kokshaysky , Rodrigo Vivi , Dietmar Eggemann , Linux ARM , Richard Henderson , Chris Zankel , Max Filippov , LKML , alpha , Mathieu Desnoyers , Andrew Morton , Daniel Bristot de Oliveira Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 24055C2BBD1 for ; Mon, 14 Sep 2020 22:44:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD3AE21D1B for ; Mon, 14 Sep 2020 22:44:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (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 CD3AE21D1B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 711B76E804; Mon, 14 Sep 2020 22:44:53 +0000 (UTC) Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id A31FC6E804 for ; Mon, 14 Sep 2020 22:44:52 +0000 (UTC) Received: by mail-ej1-x641.google.com with SMTP id u21so2272074eja.2 for ; Mon, 14 Sep 2020 15:44:52 -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=We925tp+w1KgQLGL+WnlzW4Qp75+OoxkVb9de+ZDaJbdvPV2YTfqT9oTXyFpaMaeHz tml4bOnz2Nheo52U/tdO3PwrlmK+asuSyDOtOzfLFCyaHe/dLrAtup+hjfY+E9puaM99 qZkLeWbyk9CJIUHeBRBNnfLK2N1IKGVfSlP/38pUgrwdOqDRpXTG0qgwjGfIW063/kE7 e5JvJipoTg2h4wDvCIwbCn6veqlvmWlNHM6XmWD6eCfD6zWlwmjGoclwY8UtDea2QAwC 6GBnSQ/EbRY9CqjWuYJKBzI4kX642c7vs4qhXWCjx6kFu9jyDVh+HhW7eYjVTz3XCbRY 5FQw== X-Gm-Message-State: AOAM532qOEHCm62wIIHPyPJXmmqz1Ohh5sSuqlqWXzgFyzm8O+ll7wao 2imTzpiQ2kwLMblabksqj6T4B9xIA6D60A== X-Google-Smtp-Source: ABdhPJxmlFkqMFZ4E8DCiLaSJkR+QB0Fy3Mii7C1IQBegnUsXeA1PUaOv1TiHgN3m+kW6bWiihtP/A== X-Received: by 2002:a17:906:d7a2:: with SMTP id pk2mr16764057ejb.149.1600123491050; Mon, 14 Sep 2020 15:44:51 -0700 (PDT) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com. [209.85.221.48]) by smtp.gmail.com with ESMTPSA id cf7sm10152974edb.78.2020.09.14.15.44.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 15:44:50 -0700 (PDT) Received: by mail-wr1-f48.google.com with SMTP id k15so1234758wrn.10 for ; Mon, 14 Sep 2020 15:44:50 -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: To: Thomas Gleixner , Ard Biesheuvel , Herbert Xu Subject: Re: [Intel-gfx] [patch 00/13] preempt: Make preempt count unconditional X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , Lai Jiangshan , dri-devel , Ben Segall , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , linux-hexagon@vger.kernel.org, Will Deacon , Ingo Molnar , Anton Ivanov , linux-arch , Brian Cain , Richard Weinberger , Russell King , David Airlie , Ingo Molnar , Geert Uytterhoeven , Mel Gorman , intel-gfx , Matt Turner , Valentin Schneider , linux-xtensa@linux-xtensa.org, Shuah Khan , "Paul E. McKenney" , Jeff Dike , linux-um , Josh Triplett , Steven Rostedt , rcu@vger.kernel.org, linux-m68k , Ivan Kokshaysky , Dietmar Eggemann , Linux ARM , Richard Henderson , Chris Zankel , Max Filippov , LKML , alpha , Mathieu Desnoyers , Andrew Morton , Daniel Bristot de Oliveira Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [patch 00/13] preempt: Make preempt count unconditional Date: Mon, 14 Sep 2020 15:37:49 -0700 Message-ID: References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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= In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Thomas Gleixner , Ard Biesheuvel , Herbert Xu Cc: Juri Lelli , Peter Zijlstra , Sebastian Andrzej Siewior , Lai Jiangshan , dri-devel , Ben Segall , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , linux-hexagon@vger.kernel.org, Will Deacon , Ingo Molnar , Anton Ivanov , linux-arch , Brian Cain , Richard Weinberger , Russell King , David Airlie , Ingo Molnar , Geert Uytterhoeven , Mel Gorman , intel-gfx , Matt Turner , Valentin Schneider 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