From patchwork Fri Jan 13 12:31:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 43258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp244332wrt; Fri, 13 Jan 2023 04:37:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtCMfNhlPHWf1trFr84d0hirSSj49qlbenrrhbNBSXrbMEuisea+zk50Zvi7iePKYCzB+cc X-Received: by 2002:a17:907:cbc9:b0:7ad:b6d8:c9d0 with SMTP id vk9-20020a170907cbc900b007adb6d8c9d0mr75340669ejc.53.1673613476684; Fri, 13 Jan 2023 04:37:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673613476; cv=none; d=google.com; s=arc-20160816; b=PUuLi6SO0yyFQYLtEtsA/NfOhDtcrRyGvBrD3NgLh9+L81qzInqubhENLDKzd4oJhs r3qHx4h87K6R+4yfa+3EO92IOMjKzbURfEc37R+gIg2l4VcZptAgS2crbbWzVpXk8Gw/ p7kYTQOPVBG+WYril5zF+zkJZm2EVZhayydQEhsFRDF/cuk7ULBXKl6DWridiHa8orXk OAcG5S1oTxqvP2JE8NvB+hQP4EMG6rdW6CBUoDqV4VSzoHrfkGf7W8H63UzYCIHpYf15 tx+HazGI9XsSq6vr8icpslJ8v2aOVrZMjxZEJEYuZJlw6c+b6MmjS8DLgdbGCtkz9d4b 1x8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=qowk5/cfBp9qATPKoT1XNKjUFDs9nOoPIpwnqyyR6Qw=; b=Ttw1SEpy1TaVVN/g1vgYHYqqCS0pjb2cWsXjIP6T6XqoCUZ+wE4Tjk+U+cDPnErsI0 lxy8uuwSRKivmSnP/vragJsnAfRMOoIF9z2r0KBi8qsafOBwhpKJhmIM2TXPAAAuumkT Ct9eteeS76TXeWU6nt/IWZ6eZmsx13MkEn8kXVpLwqXYposfY9Q1+AcM9vf6Q5HRlK4S x0CQX8ROtDFNcPdw4sFe38S0ihw+t5/nBCwCioM+iJH3PlZ2nUE0d4cP3dcX4sA5Q47y /b/k68BMxSHxGAkNTgdYs+TJ206nZ2tWckrU4O6tz0MYUY1DHfiBg0jk+Ui4ZVXQVQBT XeTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bDOXNtYT; dkim=neutral (no key) header.i=@linutronix.de header.b="0qGSF/v1"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du4-20020a17090772c400b007b889a69895si24296590ejc.589.2023.01.13.04.37.32; Fri, 13 Jan 2023 04:37:56 -0800 (PST) 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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bDOXNtYT; dkim=neutral (no key) header.i=@linutronix.de header.b="0qGSF/v1"; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241696AbjAMMgR (ORCPT + 99 others); Fri, 13 Jan 2023 07:36:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjAMMcS (ORCPT ); Fri, 13 Jan 2023 07:32:18 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8089A564D3; Fri, 13 Jan 2023 04:31:15 -0800 (PST) Date: Fri, 13 Jan 2023 12:31:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673613074; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qowk5/cfBp9qATPKoT1XNKjUFDs9nOoPIpwnqyyR6Qw=; b=bDOXNtYTsQ2u7MVDgqEerz9KXbpo8AS0nRauNc2tckrsTp5kg52WevI1Jl4ml1wirGhbop hvbmEBCQId8ZuBqGPiKLQeSMAl+DxzrdbuVogOuUB3Rcdxf01zQiEp6aQVl2nKCBn1jt/w 8JNRrGZmQmLhWAKSjwk3GKFUQ7n7YeXRdJFgloCAdKauY/9F6lTGNiCmlKwcF6RgGHgVQL Q5xR9ELzriHio8p0EmW5ytVQhNwi7SzeLlPaNSuHtcVXVBXjENb4YsoCpckH7qSVDj9icQ 7LzV/g60n7XWSYq5sPBhn4H5SRQIMj8eQ2jDsg7bng1OjHEhIRrO3vCTbRArBQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673613074; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qowk5/cfBp9qATPKoT1XNKjUFDs9nOoPIpwnqyyR6Qw=; b=0qGSF/v1emHgzu35VLM0ZHBGo2VIzxinOnz3LswLRkBJtIkUMRAYGjiSQBUV4SKJLBFgax l6jMhv/W0QrrOtDQ== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] cpuidle, dt: Push RCU-idle into driver Cc: "Peter Zijlstra (Intel)" , Ingo Molnar , Tony Lindgren , Ulf Hansson , "Rafael J. Wysocki" , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230112195540.068981667@infradead.org> References: <20230112195540.068981667@infradead.org> MIME-Version: 1.0 Message-ID: <167361307384.4906.11699791727961459252.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754848468192215836?= X-GMAIL-MSGID: =?utf-8?q?1754910925102627252?= The following commit has been merged into the sched/core branch of tip: Commit-ID: 0c5ffc3d7b15978c6b184938cd6b8af06e436424 Gitweb: https://git.kernel.org/tip/0c5ffc3d7b15978c6b184938cd6b8af06e436424 Author: Peter Zijlstra AuthorDate: Thu, 12 Jan 2023 20:43:26 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 13 Jan 2023 11:48:00 +01:00 cpuidle, dt: Push RCU-idle into driver Doing RCU-idle outside the driver, only to then temporarily enable it again before going idle is suboptimal. Notably: this converts all dt_init_idle_driver() and __CPU_PM_CPU_IDLE_ENTER() users for they are inextrably intertwined. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Tested-by: Tony Lindgren Tested-by: Ulf Hansson Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20230112195540.068981667@infradead.org --- drivers/acpi/processor_idle.c | 2 ++ drivers/cpuidle/cpuidle-big_little.c | 8 ++++++-- drivers/cpuidle/dt_idle_states.c | 2 +- include/linux/cpuidle.h | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 7bf882f..566f7db 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1219,6 +1219,8 @@ static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) state->target_residency = lpi->min_residency; if (lpi->arch_flags) state->flags |= CPUIDLE_FLAG_TIMER_STOP; + if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH) + state->flags |= CPUIDLE_FLAG_RCU_IDLE; state->enter = acpi_idle_lpi_enter; drv->safe_state_index = i; } diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c index abe5118..fffd4ed 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c @@ -64,7 +64,8 @@ static struct cpuidle_driver bl_idle_little_driver = { .enter = bl_enter_powerdown, .exit_latency = 700, .target_residency = 2500, - .flags = CPUIDLE_FLAG_TIMER_STOP, + .flags = CPUIDLE_FLAG_TIMER_STOP | + CPUIDLE_FLAG_RCU_IDLE, .name = "C1", .desc = "ARM little-cluster power down", }, @@ -85,7 +86,8 @@ static struct cpuidle_driver bl_idle_big_driver = { .enter = bl_enter_powerdown, .exit_latency = 500, .target_residency = 2000, - .flags = CPUIDLE_FLAG_TIMER_STOP, + .flags = CPUIDLE_FLAG_TIMER_STOP | + CPUIDLE_FLAG_RCU_IDLE, .name = "C1", .desc = "ARM big-cluster power down", }, @@ -124,11 +126,13 @@ static int bl_enter_powerdown(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx) { cpu_pm_enter(); + ct_idle_enter(); cpu_suspend(0, bl_powerdown_finisher); /* signals the MCPM core that CPU is out of low power state */ mcpm_cpu_powered_up(); + ct_idle_exit(); cpu_pm_exit(); diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index 7ca3d7d..02aa0b3 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -77,7 +77,7 @@ static int init_state_node(struct cpuidle_state *idle_state, if (err) desc = state_node->name; - idle_state->flags = 0; + idle_state->flags = CPUIDLE_FLAG_RCU_IDLE; if (of_property_read_bool(state_node, "local-timer-stop")) idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP; /* diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index fce4762..0ddc11e 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -289,7 +289,9 @@ extern s64 cpuidle_governor_latency_req(unsigned int cpu); if (!is_retention) \ __ret = cpu_pm_enter(); \ if (!__ret) { \ + ct_idle_enter(); \ __ret = low_level_idle_enter(state); \ + ct_idle_exit(); \ if (!is_retention) \ cpu_pm_exit(); \ } \