Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1160206rdg; Fri, 11 Aug 2023 11:39:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbW8g4ARGW5fLQXKqu80/JFjcJ+mr9snF6zwn1I/xS6Qq+EDFfZAR9DF0lZvzCD4xYibuu X-Received: by 2002:ac2:597a:0:b0:4fd:faf0:6591 with SMTP id h26-20020ac2597a000000b004fdfaf06591mr1947273lfp.10.1691779170273; Fri, 11 Aug 2023 11:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691779170; cv=none; d=google.com; s=arc-20160816; b=KuzAm0OFcz9A/5Se1PqSCEjJZXqTIZofjz9WOW/a04WKK8DZ40SvXoEQ/bGUpl38lm ma9p73BUjH7qRY4iOkn+PCHI9zDPbDKC1N8c1UL7/gm3G0SAKKDHmgBtaYNPc4sBL3xd dSy4hc6QcZm/2Kqvf+o+I+EQLIJ2XefeNLXwzu2XEfilhiYWmZ+UOFmtBZF3pR4+m5nC Ow1BsgqRwSylD1XkDEG2E/X3UNckyn9iAL9GMLqdQUo1wy7PktUEc5tgE7NKaoqscKB2 giRxKZwSUqXAimpTjx0xKCtpYQj2odg3m843kS2ApTPsUOOAgS8/pJNSohU1YhmL8kT7 W5ag== 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=9ZCYbnTqw/kxu8Rd+oNyaQx0aWlptK55YkCQLei5JFg=; fh=/Y18xNWUttouAMjVNFqEmA4QNUH5lx1QBjwGirVQNz0=; b=pq8ZpEp87C8IFjzRlaYjlODzUYDA6x5SPqI+9QebCfWVFr7nDD3iwAm6PD2Fcu2vsH n73pxrT/ptQjHXRExrjy8/OY2Y0PSMMy0if284BveKAIayblZotHXBhgFpS1l+cjS8i3 YFpx6FVRPA9DG9r04fZI0nG3bXsCfJUxNCIzwtml0/FSXXo1b9kpKDbumUieFflmi0WF nreRuYLiWEaG7U7MaoOJ5WLT5SXc2IHDS+oOkJE++FVNUI0jJNJ0+a5dEq88JsWNVO4a MdZ7wB/IjTGWTeCSo2pUUCVq68dh9YnFD16hEx5yLFOLYdhvwXENu2+Ip5iO11z4ggli cV8g== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020aa7d3c4000000b005236ada2eaasi3919296edr.310.2023.08.11.11.39.04; Fri, 11 Aug 2023 11:39:30 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbjHKRiI convert rfc822-to-8bit (ORCPT + 99 others); Fri, 11 Aug 2023 13:38:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236066AbjHKRiI (ORCPT ); Fri, 11 Aug 2023 13:38:08 -0400 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F5E115 for ; Fri, 11 Aug 2023 10:38:07 -0700 (PDT) Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-56ddf189fa0so309331eaf.1 for ; Fri, 11 Aug 2023 10:38:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691775487; x=1692380287; 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=BoZZv2wRN+gZLmzDHKQSshNvNLFeOauwtaSCVx28bRE=; b=MFrWiK/E6ymjenjCD0jUFFXesqq5OijIrDh1yLxFLTZkKZX4paInHhCPKizL0zid3H QrcilPMHe1KltH6JAVxSTqXZ2rKo/8titxBcjH5pMhQZVArZcRf40IWkBgOIFMYnX+vl wNMm3AuifZpaQ2ndWv6A03MQj42MBSFN1+/RRlkBao1RqxrB3Hy85GORH7dYqvPChd9B AHv4hE2pEjdrxDTKsV2gD3IGmgjdrefEJIAEY9k48MiWsX/6B1+wbmonRnhb6nca5dBL MSfX/9M1jD7oxw21NoQsmLa8wB49bJYsiPxqSVUm5zNQC+tWrdsUmGuKn+/Z02aVkoAM PMDg== X-Gm-Message-State: AOJu0YwvJbjKfYccpOhvFZ1dPHkCUIA01PjkxgqfMAcalMJtCFNpur1O XrbWV4c9SggAWRrdGRsalyNq88xfphmjB/ObzOo= X-Received: by 2002:a05:6820:1687:b0:566:951e:140c with SMTP id bc7-20020a056820168700b00566951e140cmr2434293oob.1.1691775486770; Fri, 11 Aug 2023 10:38:06 -0700 (PDT) MIME-Version: 1.0 References: <20230811170049.308866-1-frederic@kernel.org> <20230811170049.308866-4-frederic@kernel.org> In-Reply-To: <20230811170049.308866-4-frederic@kernel.org> From: "Rafael J. Wysocki" Date: Fri, 11 Aug 2023 19:37:55 +0200 Message-ID: Subject: Re: [PATCH 03/10] cpuidle: Report illegal tick stopped while polling To: Frederic Weisbecker Cc: LKML , Peter Zijlstra , "Rafael J . Wysocki" , Daniel Lezcano , Thomas Gleixner , Anna-Maria Behnsen 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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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 On Fri, Aug 11, 2023 at 7:01 PM Frederic Weisbecker wrote: > > poll_idle() can't be called while the tick is stopped because it enables > interrupts and only polls on TIF_NEED_RESCHED, which doesn't tell if an > interrupt queues a timer that would require a tick re-programming. > > There is no point anyway to poll with the tick stopped so add a check > to make sure it never happens. I'd rather update governors so they never use polling states when the tick has been stopped and then add the WARN_ON(). > Signed-off-by: Frederic Weisbecker > --- > drivers/cpuidle/poll_state.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c > index 9b6d90a72601..009f46f121ae 100644 > --- a/drivers/cpuidle/poll_state.c > +++ b/drivers/cpuidle/poll_state.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > > #define POLL_IDLE_RELAX_COUNT 200 > > @@ -19,6 +20,13 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, > > dev->poll_time_limit = false; > > + /* > + * This re-enables IRQs and only polls on TIF_NEED_RESCHED. > + * A timer queued by an interrupt here may go unnoticed if > + * the tick is stopped. > + */ > + WARN_ON_ONCE(tick_nohz_tick_stopped()); > + > raw_local_irq_enable(); > if (!current_set_polling_and_test()) { > unsigned int loop_count = 0; > -- > 2.34.1 >