From patchwork Fri Jan 13 12:31:14 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: 43264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp244589wrt; Fri, 13 Jan 2023 04:38:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXuvER2HSjo1aDT9QXZAJReE97375zvrAV5fCgP4ezAyjRoT3M2z2Nj3hrLGshA/cvVwSmpG X-Received: by 2002:a17:906:2489:b0:7c0:fa2d:9af3 with SMTP id e9-20020a170906248900b007c0fa2d9af3mr73261447ejb.45.1673613513778; Fri, 13 Jan 2023 04:38:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673613513; cv=none; d=google.com; s=arc-20160816; b=VHd/9REnx8VGIJdgvoKu6opTZV5uOVx40FYwj7viNHtwjd6uwlsqcwetOLw8KiXBRg KU44fHy4fRoArsFvltS12w0XalTNVBNq8zcV7stIRrDnh4mR8vHO2WzLW4gLu0yHgdGd 8UQ0xtY76XCYED7GwbKBUc0EXJ4207fhpJjboyl/tvfvTwmXklys/VGy58x5sL+U8Wcl 4qMGnMOyaDdxu9wemwVRUUpS/bOLDj+myrZzWT4c901Y3ed3IEHOoGkRp4a+pxgcTKKU NSVxyU9elgzcvZnY0PoljE2f6aQJ/egOPl8dK9Qxx428cN2Tak7ATIB+BGQxHscUOW7i AanQ== 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=+Em/upRwf6NflqJlzTFO6BPlqz+xZRZUvqFMgMDGUHM=; b=VGit5JlzrM7yk60n5fNgohRhJaHwibJrqdbvRNMhAhhyxjv5hAIJn+OFgCjSSAkj7n jgqhQXa+W7AFYmnHc7OQLVmLGPx3N+WNJYACHad2KbQJu+Edc2S5DuSG5SUX5NISos+4 dnn7Z6v5RZwDXB4TDua1Qumlyl8mtEXO1mvuwUTFdPDQA+W4IC/213iOGVLfxsfnW573 Efy7C5pO5OaKekGfuTbAiFJMZldGF404+wh5PSa1G0v9lj3ubbUTzvcplPneuhraU3eC k0DuftDwBsQkBFgBTfuionx0rQtw/R2acaY9CaQ/lK/FrMeuY5wtrbPXJex87M72fM3M C8lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MW1kIx9C; dkim=neutral (no key) header.i=@linutronix.de; 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 va28-20020a17090711dc00b0077156c9124esi14662628ejb.1001.2023.01.13.04.38.08; Fri, 13 Jan 2023 04:38:33 -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=MW1kIx9C; dkim=neutral (no key) header.i=@linutronix.de; 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 S241238AbjAMMg4 (ORCPT + 99 others); Fri, 13 Jan 2023 07:36:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234305AbjAMMcU (ORCPT ); Fri, 13 Jan 2023 07:32:20 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A59BB568B4; Fri, 13 Jan 2023 04:31:16 -0800 (PST) Date: Fri, 13 Jan 2023 12:31:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673613075; 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=+Em/upRwf6NflqJlzTFO6BPlqz+xZRZUvqFMgMDGUHM=; b=MW1kIx9CCA/fhCq5GHyTGytCWTRaYnoc+ZRDhNLnrq2Ok3fsF6l2tzUt6ufJI3uFCAJY1s DRgr4GPZEhnYyEyy0ytIMg/zvZdMBWu1jgqfiHE/KGlfeOj4G1IErSKvoUey91xj4ZN6U7 VUkbKN1o72+Vh7BY9IY8TYF2tXscKMjg7/ptNt76qyHbulJhca6yrgFN3c+IIGgmsdr3y6 33hNKKSWWnCty7/h4oglFg+EBiuw7X5geufoMZn08+kKymUuY99xbH3nMPNpr/BmpUu2gU oZly01NYfauGT+Q1tz1D1fQNph5Ht+Nxyf5MU+9Yc7dQPS2Xbz+HjcYpOksQRQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673613075; 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=+Em/upRwf6NflqJlzTFO6BPlqz+xZRZUvqFMgMDGUHM=; b=vTOf1bGOXMFrl8pGWApIwPp0WpN+g8hFXmbGV24rZvkzVkioJmJ38boFC9CF1vT1mAqWX9 OWdyZXhRouj+VjCg== 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, tegra: Push RCU-idle into driver Cc: "Peter Zijlstra (Intel)" , Ingo Molnar , Tony Lindgren , Ulf Hansson , Frederic Weisbecker , "Rafael J. Wysocki" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230112195539.699546331@infradead.org> References: <20230112195539.699546331@infradead.org> MIME-Version: 1.0 Message-ID: <167361307498.4906.17470136901910908116.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?1754848417508820846?= X-GMAIL-MSGID: =?utf-8?q?1754910963792567986?= The following commit has been merged into the sched/core branch of tip: Commit-ID: 5fca0d9f5d76664786ca6c09076341def165a677 Gitweb: https://git.kernel.org/tip/5fca0d9f5d76664786ca6c09076341def165a677 Author: Peter Zijlstra AuthorDate: Thu, 12 Jan 2023 20:43:20 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 13 Jan 2023 11:03:22 +01:00 cpuidle, tegra: Push RCU-idle into driver Doing RCU-idle outside the driver, only to then temporarily enable it again, at least twice, before going idle is suboptimal. Notably once implicitly through the cpu_pm_*() calls and once explicitly doing RCU_NONIDLE(). Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Tested-by: Tony Lindgren Tested-by: Ulf Hansson Reviewed-by: Frederic Weisbecker Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/r/20230112195539.699546331@infradead.org --- drivers/cpuidle/cpuidle-tegra.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c index 9845629..3ca5cfb 100644 --- a/drivers/cpuidle/cpuidle-tegra.c +++ b/drivers/cpuidle/cpuidle-tegra.c @@ -180,9 +180,11 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev, } local_fiq_disable(); - RCU_NONIDLE(tegra_pm_set_cpu_in_lp2()); + tegra_pm_set_cpu_in_lp2(); cpu_pm_enter(); + ct_idle_enter(); + switch (index) { case TEGRA_C7: err = tegra_cpuidle_c7_enter(); @@ -197,8 +199,10 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev, break; } + ct_idle_exit(); + cpu_pm_exit(); - RCU_NONIDLE(tegra_pm_clear_cpu_in_lp2()); + tegra_pm_clear_cpu_in_lp2(); local_fiq_enable(); return err ?: index; @@ -226,6 +230,7 @@ static int tegra_cpuidle_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { + bool do_rcu = drv->states[index].flags & CPUIDLE_FLAG_RCU_IDLE; unsigned int cpu = cpu_logical_map(dev->cpu); int ret; @@ -233,9 +238,13 @@ static int tegra_cpuidle_enter(struct cpuidle_device *dev, if (dev->states_usage[index].disable) return -1; - if (index == TEGRA_C1) + if (index == TEGRA_C1) { + if (do_rcu) + ct_idle_enter(); ret = arm_cpuidle_simple_enter(dev, drv, index); - else + if (do_rcu) + ct_idle_exit(); + } else ret = tegra_cpuidle_state_enter(dev, index, cpu); if (ret < 0) { @@ -285,7 +294,8 @@ static struct cpuidle_driver tegra_idle_driver = { .exit_latency = 2000, .target_residency = 2200, .power_usage = 100, - .flags = CPUIDLE_FLAG_TIMER_STOP, + .flags = CPUIDLE_FLAG_TIMER_STOP | + CPUIDLE_FLAG_RCU_IDLE, .name = "C7", .desc = "CPU core powered off", }, @@ -295,6 +305,7 @@ static struct cpuidle_driver tegra_idle_driver = { .target_residency = 10000, .power_usage = 0, .flags = CPUIDLE_FLAG_TIMER_STOP | + CPUIDLE_FLAG_RCU_IDLE | CPUIDLE_FLAG_COUPLED, .name = "CC6", .desc = "CPU cluster powered off",