Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3967068rwd; Tue, 23 May 2023 00:46:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60PhURZO8TJaPHCFcS9/80mpcwWtlghHaKkTY494weROBrtrP6C4OgL1GImORQsE3U63L0 X-Received: by 2002:a05:6a20:7346:b0:104:a053:12dd with SMTP id v6-20020a056a20734600b00104a05312ddmr14333573pzc.10.1684827978661; Tue, 23 May 2023 00:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684827978; cv=none; d=google.com; s=arc-20160816; b=mzle1M/iiYqirIgwq7k69PFggFeqLsNOGnaok+O3U5FXZ/UbAa0QGLME4kCGbCClv7 /kxK6Fqrw7vC5Y1at4LQYzsNYw8m/LHidkFuq5+4naNsGlgR7lAevfUD9UWg94zTu80r QVyA79ryDUeMqDrKXLMCocMlgdPqg8EhQLljbKjWk+rerG1j2tOuwv4OhxxOfwfmDBlX ODQOEB3Cl1W4tYAnvHh4jE8YC3vvrkIlZXoTPkP2aQw1GEE6kSwIWEG3JkqcPQSRyW68 pnvQ1RsSR1NVw/7rRD/JuuC4DIkvcA/p+MLLObG0VY9B/2rnP2A2jCagyFi35EhWOkjO gH1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=VFa9s7C/bTip1zX3xZLei00QA72RROEfnF0E1lyoIwQ=; b=LHjEfOmePk68OGzcOBRL9csrAhEm0SodMRUQf5kB4E1jFLxR0ehEWNsLcqBsB0zfBg YxoH2A2vwdaZMjLekar8nHnhqsicCKYD76mkWg/0CajwFMWO15L5QpR5kYuTDqSRz1zq 9XI0lO29joxq40Tqpv0X2WbBzG9c8vmyh30rURYckCUB81f9VZaCxZb5huNt2yWWI6LY oyILDctrWk5qxG+atSZvBfEVrYQIla9lxTWSy0Dtj6HK1O13OOBbCirN8snV0Kqc5rB6 1fZx7qvnga5vJXHuUmnOjYzpUcSnNFnPWGfCO9vqwS7zdYWiphE8S8upWwhomCrQiRUg U3Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a193-20020a6390ca000000b00528cea36032si6246171pge.10.2023.05.23.00.46.03; Tue, 23 May 2023 00:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235632AbjEWHhN convert rfc822-to-8bit (ORCPT + 99 others); Tue, 23 May 2023 03:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235583AbjEWHgn (ORCPT ); Tue, 23 May 2023 03:36:43 -0400 Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6051BB; Tue, 23 May 2023 00:35:36 -0700 (PDT) Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-ba82956d3e0so6567097276.0; Tue, 23 May 2023 00:35:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684827335; x=1687419335; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5+dC08pX0/tIIqa2IQ59EpZ+jAMVvJj02nvq1d4VL18=; b=X9ZHL/bniT61HdavOItx+T1WIquKJrexE+DFjGxu/p6nlPWX3NuBK3onVOvHX8sNW1 hs+KmnluB2DuJBlZg5BGRYPDKalmMA+k7GRhj8nKYXdbj3AG5KcDxEmL5oboc7XW5tHB X1wpDylGO6k7A69xLe7gg6w9UZEUw6E6L5+DoO3pIdifvXNaalj2FeR+GbegYS8M8m2E a6HA2lQoplGz0uXwfaxIYmHBJYWZpWYD6SYZ87wKjDOc0cG8b1sbiGiRBP0TdpnXQy5X 8U41Yw+bltCQlEoQ7WZuopOU5PWnzZQSsCLvEL9KSUkdMK2jC+UmLomb9RQyH8R0U8/S dUxA== X-Gm-Message-State: AC+VfDxjRd0JEXdsnnguebfWS6VZwDc02Jt3GIcfezn9s4wyFbEmWzYW S7zOfVGW/Pa1E+iRubBi0sJSyQj0R/U/dg== X-Received: by 2002:a25:328e:0:b0:b9d:88a7:dbf with SMTP id y136-20020a25328e000000b00b9d88a70dbfmr14953535yby.4.1684827335335; Tue, 23 May 2023 00:35:35 -0700 (PDT) Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com. [209.85.219.182]) by smtp.gmail.com with ESMTPSA id c12-20020a25880c000000b00ba7da8f72ebsm1946195ybl.0.2023.05.23.00.35.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 May 2023 00:35:34 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-ba8cf3cb34fso6554631276.1; Tue, 23 May 2023 00:35:34 -0700 (PDT) X-Received: by 2002:a25:211:0:b0:b25:a1e1:5b65 with SMTP id 17-20020a250211000000b00b25a1e15b65mr13676838ybc.5.1684827004960; Tue, 23 May 2023 00:30:04 -0700 (PDT) MIME-Version: 1.0 References: <20230511064839.GG14287@atomide.com> <494a000774b546e4aae00ae0a7dfeae4@AcuMS.aculab.com> In-Reply-To: <494a000774b546e4aae00ae0a7dfeae4@AcuMS.aculab.com> From: Geert Uytterhoeven Date: Tue, 23 May 2023 09:29:53 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] iopoll: Call cpu_relax() in busy loops To: David Laight Cc: Tony Lindgren , Stephen Boyd , Tomasz Figa , Sylwester Nawrocki , Will Deacon , Arnd Bergmann , Wolfram Sang , Dejin Zheng , Kai-Heng Feng , Nicholas Piggin , Heiko Carstens , Peter Zijlstra , Russell King , John Stultz , Thomas Gleixner , Krzysztof Kozlowski , Tero Kristo , Ulf Hansson , "Rafael J . Wysocki" , Vincent Guittot , "linux-arm-kernel@lists.infradead.org" , "linux-renesas-soc@vger.kernel.org" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, On Thu, May 11, 2023 at 12:49 PM David Laight wrote: > > * Geert Uytterhoeven [230510 13:23]: > > > It is considered good practice to call cpu_relax() in busy loops, see > > > Documentation/process/volatile-considered-harmful.rst. This can not > > > only lower CPU power consumption or yield to a hyperthreaded twin > > > processor, but also allows an architecture to mitigate hardware issues > > > (e.g. ARM Erratum 754327 for Cortex-A9 prior to r2p0) in the > > > architecture-specific cpu_relax() implementation. > > Don't you also need to call cond_resched() (at least some times). > Otherwise the process can't be pre-empted and a RT process > that last ran on that cpu will never be scheduled. According to [1], cond_resched() must be called at least once per few tens of milliseconds. read_poll_timeout() uses usleep_range(), which calls schedule_hrtimeout_range(). read_poll_timeout_atomic() should not be used with multi-ms timeouts anyway. So I guess we're OK? [1] https://elixir.bootlin.com/linux/latest/source/Documentation/RCU/Design/Requirements/Requirements.rst#L2348 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds