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,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 6458CC43461 for ; Mon, 14 Sep 2020 22:32:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D6487208DB for ; Mon, 14 Sep 2020 22:32:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="XFttBOpQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6487208DB 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 0ED2890000A; Mon, 14 Sep 2020 18:32:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 076CE8E0001; Mon, 14 Sep 2020 18:32:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E58F390000A; Mon, 14 Sep 2020 18:32:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id CC88A8E0001 for ; Mon, 14 Sep 2020 18:32:53 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 81A468249980 for ; Mon, 14 Sep 2020 22:32:53 +0000 (UTC) X-FDA: 77263118226.22.toes60_400efb52710c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 4F40C18038E67 for ; Mon, 14 Sep 2020 22:32:53 +0000 (UTC) X-HE-Tag: toes60_400efb52710c X-Filterd-Recvd-Size: 6937 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Sep 2020 22:32:52 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id c2so1025899ljj.12 for ; Mon, 14 Sep 2020 15:32: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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=XFttBOpQLvqvIRVeSi6uJbTlvU6SlD5mRsF0dJOTawed/ahybFXu96kFFWmQERfAs5 uWk/oLz9DrNGHszMiHMxoNqcLliSwLYwqi8cuttKuqm5YKsnPsoT05HyVh7UvUs3bSkf Wa6vYuwCrOJ+5ggzCPNzgdilcNNnHeeOAvJeA= 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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=uAQHwemBMWmfBk88QY2inFGs2JsRzATwq6arNMWvK0TXhFqNyyCyeh3/MvJW/95IAe zZJjiA8aQutISKfPtKeZItb7UDBL8oZsV7teKRxN8uaviLXZ22BOVPUR5+zopfONDKnQ 6VqGBohXInYlGPeewK8OVJe5sHjCctEMxBkHlpGfqn4MGkKUL2QpudEfpOR80jTA+eRY rRwNUwaWUrpI0QXtqUuN5K7XMjrdvYHdE9NBf2L3q9jou1xvoO3UlJts8BCPvzidQkM8 ZaDaMUonmnAwaC3AyUP8aswXoyth3cD1MYsxB//OHKiB1u/MhZ+laANEhYB6p+KApEZm UwMA== X-Gm-Message-State: AOAM532P1RQQe25LQUnleAvo0tRifQWOXPseVaw5hqnYhclYLHYf92c5 xqRzqlTwVa/CQ50hpkRFw4LBUu6z9qKubw== X-Google-Smtp-Source: ABdhPJwhhk2ixMtd8vuEv9JlQNCdkxpgTeZpCPOHplxFK+EYn4oy6gTGPyOqm1//g/gTKq1OTS3GGg== X-Received: by 2002:a05:651c:cb:: with SMTP id 11mr6015778ljr.2.1600122770931; Mon, 14 Sep 2020 15:32:50 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id b197sm3570093lfd.251.2020.09.14.15.32.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 15:32:50 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id v23so1095729ljd.1 for ; Mon, 14 Sep 2020 15:32:50 -0700 (PDT) X-Received: by 2002:a2e:91cd:: with SMTP id u13mr5174538ljg.421.1600122308748; Mon, 14 Sep 2020 15:25:08 -0700 (PDT) MIME-Version: 1.0 References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> In-Reply-To: <871rj4owfn.fsf@nanos.tec.linutronix.de> From: Linus Torvalds Date: Mon, 14 Sep 2020 15:24:52 -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: 4F40C18038E67 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 2:55 PM Thomas Gleixner wrote: > > Yes it does generate better code, but I tried hard to spot a difference > in various metrics exposed by perf. It's all in the noise and I only > can spot a difference when the actual preemption check after the > decrement I'm somewhat more worried about the small-device case. That said, the diffstat certainly has its very clear charm, and I do agree that it makes things simpler. I'm just not convinced people should ever EVER do things like that "if (preemptible())" garbage. It sounds like somebody is doing seriously bad things. The chacha20poly1305 code does look fundamentally broken. But no, the fix is not to make "preemptible" work with spinlocks, the fix is to not *do* that kind of broken things. Those things would be broken even if you changed the semantics of preemptible. There's no way that it's valid to say "use this debug flag to decide if we should do atomic allocations or not". It smells like "I got a debug failure, so I'm papering it over by checking the thing the debug code checks for". The debug check is to catch the obvious bad cases. It's not the _only_ bad cases, so copying the debug check test is just completely wrong. 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"). You *fundamentally* cannot do that. Seriously. It's completely wrong. Pick one or the other, or have the caller *tell* you what the context is. 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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 80502C433E2 for ; Mon, 14 Sep 2020 22:30:51 +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 101472065E for ; Mon, 14 Sep 2020 22:30:50 +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="XFttBOpQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 101472065E 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 3055A6E7D4; Mon, 14 Sep 2020 22:30:50 +0000 (UTC) Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F5786E7D4 for ; Mon, 14 Sep 2020 22:30:49 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id z19so994362lfr.4 for ; Mon, 14 Sep 2020 15:30:49 -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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=XFttBOpQLvqvIRVeSi6uJbTlvU6SlD5mRsF0dJOTawed/ahybFXu96kFFWmQERfAs5 uWk/oLz9DrNGHszMiHMxoNqcLliSwLYwqi8cuttKuqm5YKsnPsoT05HyVh7UvUs3bSkf Wa6vYuwCrOJ+5ggzCPNzgdilcNNnHeeOAvJeA= 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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=ikQ8a6Qgdhx0wzqI/bt/yBWi3DL4XN5SoBjRVhiuFpf9t9Bf8Kwcdaf8OTfI3tXyax SadMad2SWTrLjC6f+nCwiOD/Y4HVEJFLQZCb3NZbIk1dJGaj65BNNXZxml2A2yEEdATq y9+zEJrHpbcL/wC7jvIPsjHLe6dql6X5JRGPWA7Zw0E6LJl6QtHcKUcVTX1rJKZAghrA XludZ8PIjlThqQ7x/LT+zW5ffHB9HbZRcXpiJaDpujcEK7gQDVNMEVCxQIoi98sS/Fwe /i1sWHBHox+CwmyKQhI3DfjiX5FNJqHLhe178ULeJ44knq1Bu6xi7zDrqWNSBRZzttsz EnGA== X-Gm-Message-State: AOAM531ksI1EBGs2K0ktNd0MwOe1Rj59A3wIKIbQapqUQuxcY37/9XHr D7ks+ubHUK5NlfYOp212T87k00u+e24iJA== X-Google-Smtp-Source: ABdhPJxNS8srRRXOH+ENINcGwLojTlzSxKSu+Ic+vG8iNedDr8nuSIYTnIOCtST9odZ2WlkXspKO1Q== X-Received: by 2002:a19:610a:: with SMTP id v10mr5388501lfb.414.1600122647528; Mon, 14 Sep 2020 15:30:47 -0700 (PDT) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id d28sm3594505lfn.277.2020.09.14.15.30.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 15:30:47 -0700 (PDT) Received: by mail-lj1-f175.google.com with SMTP id w3so1064404ljo.5 for ; Mon, 14 Sep 2020 15:30:47 -0700 (PDT) X-Received: by 2002:a2e:91cd:: with SMTP id u13mr5174538ljg.421.1600122308748; Mon, 14 Sep 2020 15:25:08 -0700 (PDT) MIME-Version: 1.0 References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> In-Reply-To: <871rj4owfn.fsf@nanos.tec.linutronix.de> From: Linus Torvalds Date: Mon, 14 Sep 2020 15:24:52 -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 2:55 PM Thomas Gleixner wrote: > > Yes it does generate better code, but I tried hard to spot a difference > in various metrics exposed by perf. It's all in the noise and I only > can spot a difference when the actual preemption check after the > decrement I'm somewhat more worried about the small-device case. That said, the diffstat certainly has its very clear charm, and I do agree that it makes things simpler. I'm just not convinced people should ever EVER do things like that "if (preemptible())" garbage. It sounds like somebody is doing seriously bad things. The chacha20poly1305 code does look fundamentally broken. But no, the fix is not to make "preemptible" work with spinlocks, the fix is to not *do* that kind of broken things. Those things would be broken even if you changed the semantics of preemptible. There's no way that it's valid to say "use this debug flag to decide if we should do atomic allocations or not". It smells like "I got a debug failure, so I'm papering it over by checking the thing the debug code checks for". The debug check is to catch the obvious bad cases. It's not the _only_ bad cases, so copying the debug check test is just completely wrong. 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"). You *fundamentally* cannot do that. Seriously. It's completely wrong. Pick one or the other, or have the caller *tell* you what the context is. 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 BEA33C433E2 for ; Mon, 14 Sep 2020 22:33:25 +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 68767208DB for ; Mon, 14 Sep 2020 22:33:25 +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="XFttBOpQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68767208DB 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 B2DA16E7DA; Mon, 14 Sep 2020 22:33:24 +0000 (UTC) Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id B07D96E7D9 for ; Mon, 14 Sep 2020 22:33:23 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id n25so1076219ljj.4 for ; Mon, 14 Sep 2020 15:33:23 -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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=XFttBOpQLvqvIRVeSi6uJbTlvU6SlD5mRsF0dJOTawed/ahybFXu96kFFWmQERfAs5 uWk/oLz9DrNGHszMiHMxoNqcLliSwLYwqi8cuttKuqm5YKsnPsoT05HyVh7UvUs3bSkf Wa6vYuwCrOJ+5ggzCPNzgdilcNNnHeeOAvJeA= 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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=bG89ABzXo7VhTn7pcqqTMKSG0+fqGJrGlKdS+m59Z33t2clBYblvwXKzKP5ynBAAaV s9PcUScYGDR9sw3RoGK7zcHFpNXpwoxdg+7NEK4VBhO1tweZxla6aZp1nnXNu5B3bFtW C8h6h03QrVC3K+urdX5EIbNDfE+ZmiHJCRZR6X3h5R3BECHCATfIjOJ+LpzXD+xzRazQ okrA2Fu2Vo91oF+4LNN3++1eLdze5RksuYwb61NlDR2bv4s5adtV1zA7UCcK30Q5207T Zk42alK98L1TbRzsYDbyGxjfvzrv0zvWK1VcvOqLHWg7WlBLnqMDzga4gZqdik9Ln+bv 9iOg== X-Gm-Message-State: AOAM5337kSFkS2GDSRuGLZojm7JaxOIoZ5e/98Adc4VjyRb/o8e5//Ag v8mH1Fk4QkisDkk3NZHmW/zZd9vjCz9Uyw== X-Google-Smtp-Source: ABdhPJxq2NwRqVPiZNB+e6jtNDJSB1VGZj9KHjnkGs4bfnGl8njcKZcUSCKXPGDHdcZ7uUvMZIuNhw== X-Received: by 2002:a05:651c:1352:: with SMTP id j18mr5322723ljb.343.1600122801769; Mon, 14 Sep 2020 15:33:21 -0700 (PDT) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id b13sm3964121lfa.92.2020.09.14.15.33.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 15:33:21 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id x69so1007579lff.3 for ; Mon, 14 Sep 2020 15:33:21 -0700 (PDT) X-Received: by 2002:a2e:91cd:: with SMTP id u13mr5174538ljg.421.1600122308748; Mon, 14 Sep 2020 15:25:08 -0700 (PDT) MIME-Version: 1.0 References: <20200914204209.256266093@linutronix.de> <871rj4owfn.fsf@nanos.tec.linutronix.de> In-Reply-To: <871rj4owfn.fsf@nanos.tec.linutronix.de> From: Linus Torvalds Date: Mon, 14 Sep 2020 15:24:52 -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 2:55 PM Thomas Gleixner wrote: > > Yes it does generate better code, but I tried hard to spot a difference > in various metrics exposed by perf. It's all in the noise and I only > can spot a difference when the actual preemption check after the > decrement I'm somewhat more worried about the small-device case. That said, the diffstat certainly has its very clear charm, and I do agree that it makes things simpler. I'm just not convinced people should ever EVER do things like that "if (preemptible())" garbage. It sounds like somebody is doing seriously bad things. The chacha20poly1305 code does look fundamentally broken. But no, the fix is not to make "preemptible" work with spinlocks, the fix is to not *do* that kind of broken things. Those things would be broken even if you changed the semantics of preemptible. There's no way that it's valid to say "use this debug flag to decide if we should do atomic allocations or not". It smells like "I got a debug failure, so I'm papering it over by checking the thing the debug code checks for". The debug check is to catch the obvious bad cases. It's not the _only_ bad cases, so copying the debug check test is just completely wrong. 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"). You *fundamentally* cannot do that. Seriously. It's completely wrong. Pick one or the other, or have the caller *tell* you what the context is. 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:24:52 -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=FYq5Ck3jxQlGA/9U/OgNyRBwFyvhqjGeOq2xChwQGbM=; b=XFttBOpQLvqvIRVeSi6uJbTlvU6SlD5mRsF0dJOTawed/ahybFXu96kFFWmQERfAs5 uWk/oLz9DrNGHszMiHMxoNqcLliSwLYwqi8cuttKuqm5YKsnPsoT05HyVh7UvUs3bSkf Wa6vYuwCrOJ+5ggzCPNzgdilcNNnHeeOAvJeA= In-Reply-To: <871rj4owfn.fsf@nanos.tec.linutronix.de> 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 2:55 PM Thomas Gleixner wrote: > > Yes it does generate better code, but I tried hard to spot a difference > in various metrics exposed by perf. It's all in the noise and I only > can spot a difference when the actual preemption check after the > decrement I'm somewhat more worried about the small-device case. That said, the diffstat certainly has its very clear charm, and I do agree that it makes things simpler. I'm just not convinced people should ever EVER do things like that "if (preemptible())" garbage. It sounds like somebody is doing seriously bad things. The chacha20poly1305 code does look fundamentally broken. But no, the fix is not to make "preemptible" work with spinlocks, the fix is to not *do* that kind of broken things. Those things would be broken even if you changed the semantics of preemptible. There's no way that it's valid to say "use this debug flag to decide if we should do atomic allocations or not". It smells like "I got a debug failure, so I'm papering it over by checking the thing the debug code checks for". The debug check is to catch the obvious bad cases. It's not the _only_ bad cases, so copying the debug check test is just completely wrong. 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"). You *fundamentally* cannot do that. Seriously. It's completely wrong. Pick one or the other, or have the caller *tell* you what the context is. Linus