From patchwork Mon May 27 14:25:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EB72C25B79 for ; Mon, 27 May 2024 14:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MBwQuQX3zs1BAIAiu1G2SE7AyA+gcgc1pqE89vYMu+g=; b=tCmKqo7QlDiwdv E/5gZeTkqo1gkCx0lY8jMXfXCxcr1nzcvKOAbSyhzdICvrEAsNjTv4jX7PvxRHNRFN97BYUCWHDco NH2VODAUr/HHUimLdnAcC9qMK+R6Ht3h4sxaYwQiByDzq9AUtcOeJcJsO6VtOaIY9kl+Wq66UGBDf byg1ntV0rj8n80GdF09ULI+x3DbxDJhoFpuiLh5vHLKNzGSYAiLnyvxvbbEZFUlMHytv3/VqeFOcp Jv1DFp3ynjwKz7gMucafsW5RCy4nKjuxtkZPm9/aN6B9/rOi2gC+O4KXPGnLhQZ+IUo5WbEZ1O0W1 wWdabNQKXQqjhiwjRzcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIl-0000000FM47-203j; Mon, 27 May 2024 14:26:15 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIh-0000000FM0u-2a6Y for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:12 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5295dada905so2658157e87.1 for ; Mon, 27 May 2024 07:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819970; x=1717424770; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PZoaMc6WifhZ+fBwKL5gwIEFdMUp0oaX6j5v8OfXh20=; b=eingCQzdAeXYE6hi7SSIE+rQDfKLsJvTciacOJdAQb8XVYusVzrj8BuC/x8hFC83M3 OH/EuWJ/kVYvRnW6IbHZtw/sz723bVW0I7yhLQmS1q1yQm8JBYTjF0ZT9I+03G0Q0o4/ FpJ6QGjj13NAuAREGrmUj9mBjVjIh9Px8KYpKCh1oXBT27yYFDaYLVbvRdsOIuya3e1R lI+gNyFwJwNpjV5KN5gej56tmcbS0Y7i1CrSmynbna4yz8HJgQP9Y7KKOvliBsaikzt2 9vTVDJzc6N1NR4z4Ut9GNDncmvAUHAvgo+Z7HRliP70JjtXyekXOzstwhA+w9OEZBKgd TF8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819970; x=1717424770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PZoaMc6WifhZ+fBwKL5gwIEFdMUp0oaX6j5v8OfXh20=; b=hHTgY4flWkmBxGN0kk/VMv9dxsJrhupKnQx/b1kQnArkT7MJuEi6fU+JVYQ+Ow94FI 4TkFEflriVD/e4YQvP6WrzG3JUyYw0O1Qgu3oidUkMeqKAy+EkaJh/6OmWjbI/6APHHx xSTQdIhga8TbM68Eexan9cvG0DMEpQdK40/3Tp8GV3aigiFz3no+Z+794LE3XIHsa9xy gtlASimJ40qFoaMLbCl6Wfo8Pd8KZYqpQc806Cuwt5pVLDdtJ17eMFAUqmySu9y7oowa gguaO8roG9/DyqP5Llfy5xNDnZGq9kg0oZnrtABiSfUt/RsnG0SKy0aSMfZuz2OatUm+ 363w== X-Forwarded-Encrypted: i=1; AJvYcCVMf7u1FYG5TIEGPpfRa2OZqLxznb4RJ2r0EtM7q4bJQFkZ1fosVf/a5hTEVMVlPVv/TFwjPZKXiHjHhVUsvtegLYJ1mgA1i3tekQvCoY3eXlYcuJ8= X-Gm-Message-State: AOJu0YzUqT31MN072gAfl70J4tJ+0P35tmKOmyNEfwsmTY3piTc6GY4W b5q3egsuG7xoAbExsTD/sP+rcgd0wTbC1thTl79Kcb7KWi6EhoioDVG7ctbBnvI= X-Google-Smtp-Source: AGHT+IE/McdjIB2db+Ta75EpAOuo80HDc4szOTHxbQY1a3UNLxB5stFeNpM3m1xKFPzyrfs8FAVxmA== X-Received: by 2002:a19:5e10:0:b0:51f:c38b:149c with SMTP id 2adb3069b0e04-527ef3ff4d1mr4004099e87.10.1716819970021; Mon, 27 May 2024 07:26:10 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:09 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/7] pmdomain: core: Enable s2idle for CPU PM domains on PREEMPT_RT Date: Mon, 27 May 2024 16:25:51 +0200 Message-Id: <20240527142557.321610-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072611_688888_A2781FF7 X-CRM114-Status: GOOD ( 18.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To allow a genpd provider for a CPU PM domain to enter a domain-idle-state during s2idle on a PREEMPT_RT based configuration, we can't use the regular spinlock, as they are turned into sleepable locks on PREEMPT_RT. To address this problem, let's convert into using the raw spinlock, but only for genpd providers that have the GENPD_FLAG_CPU_DOMAIN bit set. In this way, the lock can still be acquired/released in atomic context, which is needed in the idle-path for PREEMPT_RT. Do note that the genpd power-on/off notifiers may also be fired during s2idle, but these are already prepared for PREEMPT_RT as they are based on the raw notifiers. However, consumers of them may need to adopt accordingly to work properly on PREEMPT_RT. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/pmdomain/core.c | 47 ++++++++++++++++++++++++++++++++++++++- include/linux/pm_domain.h | 5 ++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 623d15b68707..072e6bdb6ee6 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -117,6 +117,48 @@ static const struct genpd_lock_ops genpd_spin_ops = { .unlock = genpd_unlock_spin, }; +static void genpd_lock_raw_spin(struct generic_pm_domain *genpd) + __acquires(&genpd->raw_slock) +{ + unsigned long flags; + + raw_spin_lock_irqsave(&genpd->raw_slock, flags); + genpd->raw_lock_flags = flags; +} + +static void genpd_lock_nested_raw_spin(struct generic_pm_domain *genpd, + int depth) + __acquires(&genpd->raw_slock) +{ + unsigned long flags; + + raw_spin_lock_irqsave_nested(&genpd->raw_slock, flags, depth); + genpd->raw_lock_flags = flags; +} + +static int genpd_lock_interruptible_raw_spin(struct generic_pm_domain *genpd) + __acquires(&genpd->raw_slock) +{ + unsigned long flags; + + raw_spin_lock_irqsave(&genpd->raw_slock, flags); + genpd->raw_lock_flags = flags; + return 0; +} + +static void genpd_unlock_raw_spin(struct generic_pm_domain *genpd) + __releases(&genpd->raw_slock) +{ + raw_spin_unlock_irqrestore(&genpd->raw_slock, genpd->raw_lock_flags); +} + +static const struct genpd_lock_ops genpd_raw_spin_ops = { + .lock = genpd_lock_raw_spin, + .lock_nested = genpd_lock_nested_raw_spin, + .lock_interruptible = genpd_lock_interruptible_raw_spin, + .unlock = genpd_unlock_raw_spin, +}; + #define genpd_lock(p) p->lock_ops->lock(p) #define genpd_lock_nested(p, d) p->lock_ops->lock_nested(p, d) #define genpd_lock_interruptible(p) p->lock_ops->lock_interruptible(p) @@ -2079,7 +2121,10 @@ static void genpd_free_data(struct generic_pm_domain *genpd) static void genpd_lock_init(struct generic_pm_domain *genpd) { - if (genpd->flags & GENPD_FLAG_IRQ_SAFE) { + if (genpd->flags & GENPD_FLAG_CPU_DOMAIN) { + raw_spin_lock_init(&genpd->raw_slock); + genpd->lock_ops = &genpd_raw_spin_ops; + } else if (genpd->flags & GENPD_FLAG_IRQ_SAFE) { spin_lock_init(&genpd->slock); genpd->lock_ops = &genpd_spin_ops; } else { diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index f24546a3d3db..0d7fc47de3bc 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -194,8 +194,11 @@ struct generic_pm_domain { spinlock_t slock; unsigned long lock_flags; }; + struct { + raw_spinlock_t raw_slock; + unsigned long raw_lock_flags; + }; }; - }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) From patchwork Mon May 27 14:25:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 551A4C25B79 for ; Mon, 27 May 2024 14:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IAAIDd6Kj9/gtXUHeoECM4/xag+1SQKKIhervk69kQw=; b=e45PXrM1HMNOEi tZBxEe4VLKl92MiTogmvPld8l9F/T9Hy5YrQ0zIgpPu7udCz3RuK8JUEgyTETTUBbox42W7xeFo6o wPV0tUv75N6deh6v3DtVT3/6THb/sNN6LSUjOQ8ABwg+t0ph4Fbk5k2otxk83EltdIj269sQA5wkp t4V7QLjnRiXpW7pbtQMFhUasuvYsTDIgwOPFH42O8i+CP28olmftManNm9K4JPeG/AvCbXRUoBDLK qLI0HSzM4HZ2OnKm7mTpcx34qKB85SlclM7ySqtezK1jE61sfibeZPEbZwAadvtrQZPEc5JyKOg+2 WA7CHj+ONFR4mi1tvChw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIz-0000000FMCF-0RNO; Mon, 27 May 2024 14:26:29 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIj-0000000FM1Q-3Q0i for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:15 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5238b5c080cso13159991e87.1 for ; Mon, 27 May 2024 07:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819971; x=1717424771; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5Ajlq1staYQWjI54ZRvjbkTZMy5GI2GeZyK3MIpoEkc=; b=B/Sp375wg0XKPssiKnvkOKRmBRHaqxvgaKuzKb5ds1U1O01tBhuHGVQgvRQWVDpvmf j8Z9FyXDtL0VA0FP47Z9jBy2mgi8asmIfHAL5hBnDQXoOS9WsHFbpHkyqFQ4zXtW7yBU lKQJdg1cYN+ctpO0Z6TKmXNo3b3x8XnkROijMOG9hwlHdnPwRlCKmyipUe+hOaPWktRq qFsj9Sq8cWqFnzBtmYEjVLa35yMLd58xCIq2mPLPNtj0VqFWGCZZTvOnHuXHekGqlDTv X9V9j8514pWaRchn+t3Oq5AckBaD3eU+BuZfsZ1K22RLI/OFeh/tThGzRXLc1Gy4qmH1 q0cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819971; x=1717424771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Ajlq1staYQWjI54ZRvjbkTZMy5GI2GeZyK3MIpoEkc=; b=XGZuaOmiaLDM9ZRj7De7SjCvhnOIwjbA2fZdhcgJ/gDa0fg9HaosSQgEepzg0Owqej qbqL5iVxvojofT4dLQFEP9YRGPmGX8eyLS/cREETIHjsVOtdtpF2Y6LGEPOQPxy97TV9 KlrXAydtzjmZf5eSSxI+SaJxLzgwy38HcMSSGhvTWUyY4VUYSkmw+SgA8MaqnPVlqBP0 6npnsV5fUfTKFlzDxJJBFRq2vrI0JtL6atqDR9uaWqXj8mTw0PgiwDCDUA2X0zE202hm NIbSUHjpyTeyNHgjH1GASIqgfbW3E66ZJ87KsunmnVPOCpbfiPKBV9FYRFSQ8tjDstG5 NO+A== X-Forwarded-Encrypted: i=1; AJvYcCUrVlFeIptAFUy975cWL5DlzOJFMpF3YZPIVB3kMeNR8a7r8G8Ec1pSprtXw/upqbs1CJChI/EqD9ZLytygLn8ADczZu/Wn5Gej71KcZyJCOJt0o50= X-Gm-Message-State: AOJu0YxdQjYMfndRjhGvWLxcwkeUxjkI27oDTV3g3yIbf0+7XdX+9bGM eZ6JficMof5uIWypmqHm2+ajuvkxa0yWgiuweYnyPhsA4eBhFc7PPCOv9cQgejM= X-Google-Smtp-Source: AGHT+IHWRypJfff5qBHtAk5lsZ8/wFX/161EBjl7n9TAWLIPrFWtZ+0qN16FQcGUnCCHIR2OZDLIJQ== X-Received: by 2002:ac2:5a09:0:b0:51f:5853:14e3 with SMTP id 2adb3069b0e04-529647d8360mr5535854e87.25.1716819971096; Mon, 27 May 2024 07:26:11 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:10 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/7] pmdomain: core: Don't hold the genpd-lock when calling dev_pm_domain_set() Date: Mon, 27 May 2024 16:25:52 +0200 Message-Id: <20240527142557.321610-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072613_881288_4A621967 X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is no need to hold the genpd-lock, while assigning the dev->pm_domain. In fact, it becomes a problem on a PREEMPT_RT based configuration as the genpd-lock may be a raw spinlock, while the lock acquired through the call to dev_pm_domain_set() is a regular spinlock. To fix the problem, let's simply move the calls to dev_pm_domain_set() outside the genpd-lock. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/pmdomain/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 072e6bdb6ee6..454fccc38df1 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -1736,7 +1736,6 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, genpd_lock(genpd); genpd_set_cpumask(genpd, gpd_data->cpu); - dev_pm_domain_set(dev, &genpd->domain); genpd->device_count++; if (gd) @@ -1745,6 +1744,7 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); genpd_unlock(genpd); + dev_pm_domain_set(dev, &genpd->domain); out: if (ret) genpd_free_dev_data(dev, gpd_data); @@ -1801,12 +1801,13 @@ static int genpd_remove_device(struct generic_pm_domain *genpd, genpd->gd->max_off_time_changed = true; genpd_clear_cpumask(genpd, gpd_data->cpu); - dev_pm_domain_set(dev, NULL); list_del_init(&pdd->list_node); genpd_unlock(genpd); + dev_pm_domain_set(dev, NULL); + if (genpd->detach_dev) genpd->detach_dev(genpd, dev); From patchwork Mon May 27 14:25:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5F77C25B79 for ; Mon, 27 May 2024 14:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IuxB/3rEjEhEbfcPce1IUmIKWNHnyB7NMb0tzJ+U1OA=; b=uOkqaw8Wy0GV7R nH7REgpuqguVk80mwZX4dlI/7VQpZfnxI48YZp5cGcNBQLGKylgYXQHwc7wp4SPO+VB4mUSR7CYsV 4p0QRLdTg5Yse/g+aTHZxtx+yiPact0S1o9mr7aJqntdjpHEf2gMK6wV8YBMUcoKunbkyTSYZMG9i YFKUQzzpSrWH/Qk/DZOnR5S43wEJNkCdJVnLDlJQ3gT9KlHF0tbI9+S/pnhftSWXudj/ljSWv6gyJ S0XTBJoEKMWdUL5cMk/GH8rtHatq8NLw7BO9CXLFYSdwCbck+1EboSzozHdX9a6BABj9E13nyRWlL YeXv55TkBYQ3xpaiDrgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIz-0000000FMCf-3ZxR; Mon, 27 May 2024 14:26:29 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIk-0000000FM2B-3WaC for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:16 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5295c65d3fdso2875328e87.0 for ; Mon, 27 May 2024 07:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819972; x=1717424772; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p4GCCTlIOT/1pc4oKXuIbqiN9A8llTw5QQ9hWjk7xes=; b=h9D89tzn0zgkCKdot2BVNYcLeM1H1PSCLqRVu2gfxxS6o9z3RPR5OI8OqGojg2RGTF URvvWRATGCSVIcyjkpl9m5XcXy3vSeuyGdCt+CTnUm5SnJJ0BEq1Kaz7gXGMgp/ViuQL c8b0uHjEE4D5VHX4WnPgAizHLD/AwQV8A9cqOvoK/fVnK7fxwocnll20RT12rgoaXkNY u13r/tnkEeeEh3iIPNzTFRxcl4/q7Y95mE29BWn5mPC1qVllQtC6aqsakk+VUrGfmdJS 7Rhucp62CQMw85oAd/4/8tZ+6pXnCKq7KSk3XsnG/8f/254f/RhkCMzn2Q38J98ggNoj dw0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819972; x=1717424772; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p4GCCTlIOT/1pc4oKXuIbqiN9A8llTw5QQ9hWjk7xes=; b=cDtOLelmV46RJQVkfnwONy7E8qprKmLqY5YeekUjjfKUo1IWV8YVrAjNgCfwSLSCLH pyxyNFwDWQRjLe3PyNRP8jLf3tlMrr4uAV/BfkeJ8ci6zNGcxtqq/BsvT3b0VO3vTg/U fAhwoOkgunKwBXeoe9F2jA1qU2MTuGjuwvo2AdtKL3nFPLIcyIY8AtgWIlbT3bN5fsZu pGMWMx6Haz99Bp6VRHBq2xaCZY+P/qzxMoC09nyG9I8TuKDxhKwbbi4WxIWitf9SLFsR nzhaqlD2ahQFslXPcAwe++9AjqvTdnNhtAXLv9IroL9bPs+abSz8xrs1nS+QB5ybQ5Mn BqPA== X-Forwarded-Encrypted: i=1; AJvYcCV8blMQB3hpctSga3XdPOTs8pmKKtwyUnPntHntnfZIvQtXwWP5fN0S8j74EYydomKu2pX21Yg6O6dZdxiCdo5/1nL9OlrJaT2JHQ24WOZ0BUn+CUU= X-Gm-Message-State: AOJu0YxFqKJ0sQCHshbMbORJhkxHtn5xu2YBHTZmGi8ElmnQgou7Lkss IEhgleuYaMXldxGp7TgGXRIaR1U2/Xlz0p+rTfhB+1vFILbSldrLq3l0DvlEucg= X-Google-Smtp-Source: AGHT+IGBURZMgZ64X0UKam0G5PlXXXeQ2dC+7S7QNY89ucqJb86w8XI5Zqsgk9t8jyaoT8/KyxTQXg== X-Received: by 2002:a19:5e10:0:b0:51f:c38b:149c with SMTP id 2adb3069b0e04-527ef3ff4d1mr4004141e87.10.1716819972310; Mon, 27 May 2024 07:26:12 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:11 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/7] pmdomain: core: Use dev_name() instead of kobject_get_path() in debugfs Date: Mon, 27 May 2024 16:25:53 +0200 Message-Id: <20240527142557.321610-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072614_944076_F363FC23 X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Using kobject_get_path() means a dynamic memory allocation gets done, which doesn't work on a PREEMPT_RT based configuration while holding genpd's raw spinlock. To fix the problem, let's convert into using the simpler dev_name(). This means the information about the path doesn't get presented in debugfs, but hopefully this shouldn't be an issue. Signed-off-by: Ulf Hansson --- Changes in v2: - New patch. --- drivers/pmdomain/core.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 454fccc38df1..90a65bd09d52 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -3182,7 +3182,6 @@ static int genpd_summary_one(struct seq_file *s, [GENPD_STATE_OFF] = "off" }; struct pm_domain_data *pm_data; - const char *kobj_path; struct gpd_link *link; char state[16]; int ret; @@ -3215,16 +3214,9 @@ static int genpd_summary_one(struct seq_file *s, } list_for_each_entry(pm_data, &genpd->dev_list, list_node) { - kobj_path = kobject_get_path(&pm_data->dev->kobj, - genpd_is_irq_safe(genpd) ? - GFP_ATOMIC : GFP_KERNEL); - if (kobj_path == NULL) - continue; - - seq_printf(s, "\n %-50s ", kobj_path); + seq_printf(s, "\n %-50s ", dev_name(pm_data->dev)); rtpm_status_str(s, pm_data->dev); perf_status_str(s, pm_data->dev); - kfree(kobj_path); } seq_puts(s, "\n"); @@ -3393,23 +3385,14 @@ static int devices_show(struct seq_file *s, void *data) { struct generic_pm_domain *genpd = s->private; struct pm_domain_data *pm_data; - const char *kobj_path; int ret = 0; ret = genpd_lock_interruptible(genpd); if (ret) return -ERESTARTSYS; - list_for_each_entry(pm_data, &genpd->dev_list, list_node) { - kobj_path = kobject_get_path(&pm_data->dev->kobj, - genpd_is_irq_safe(genpd) ? - GFP_ATOMIC : GFP_KERNEL); - if (kobj_path == NULL) - continue; - - seq_printf(s, "%s\n", kobj_path); - kfree(kobj_path); - } + list_for_each_entry(pm_data, &genpd->dev_list, list_node) + seq_printf(s, "%s\n", dev_name(pm_data->dev)); genpd_unlock(genpd); return ret; From patchwork Mon May 27 14:25:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675436 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5792AC25B74 for ; Mon, 27 May 2024 14:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P2ZwfjYwYAEW9T7pAXGqcZF81/zE7M5nsglXGEmxFAw=; b=wnHNMrN6sR2xon 3IwqdCETVi27IgBF75xcMlUD8m8DCK4RrhlSTFxcWU8snCS6L2jP3iYDddonKO4BEnONfry9mpF1G 44brysT7Sdlx1KdaUDGTZ7EtpgXj/j+jToBegPBzn8oRXHobFvYcfNzSwAKyy5HZ+lALAavNh0f7u F5dIOBVSG8K3tedYNXSW4Mf5KX059RUch/qCesFfOiuMd3uAvTBfdkwhDX6K+CXWNe4zPn3UgqfrP ZY6lEv3Ve6fE/oXYSBwyDbv3LEqufvYLyYULMXYCHfUBj4fDzt3q6reGAs1ys+m3IpqZZ2IKd05yM QosTqG3dFSNncISFhUCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbJ0-0000000FMDO-3rUv; Mon, 27 May 2024 14:26:30 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIl-0000000FM3E-3zjn for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:17 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-529aa4e988aso2026607e87.0 for ; Mon, 27 May 2024 07:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819974; x=1717424774; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XR5PKdQ2iHKXMf6EJDdAOgUvQYES8E8gefpFvCEDCJQ=; b=mjpJbkzS5q/bcuVgS65VR8CH5J8XEygMfwgHRu5kxXN+9Vzfs3GjRBH5TwAYal7cY5 o4nKuJPkd4SsjLpBk9/BcgOr+7CGZEK+X1EFb2LJwRuYflreoemYud78bdy0U7WXvRyz Z/m/PKA00N1gTaFit0HgmFTPDp/DyZwDyOV+cdebZ8dkRC+XRoZKpm31bIhqTAk1KHan g4JEbhFZHcxIGT/Cn+ABxmKCaD1sIz23FxFd1KGJCI98ZFuucTpGSSPAcwsVVvrLxK8v v+yW8/hAhoxPWJIVP6ACuB6sGz72EugJK9y8pzJHVW5agiubny+/rxOgaE90cMHAEGgA 7U6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819974; x=1717424774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XR5PKdQ2iHKXMf6EJDdAOgUvQYES8E8gefpFvCEDCJQ=; b=G0RTBgQ+t9xnO3uFL+UpWHdGXTOGGYc12LXW8MZC0XEfO74+v6o6Lb4CJpc7nK/cq/ JuPLe/08R454BCqjK0Gc8kn4C6DkQbLoZ3Ne7XR89b8NVFWG4v9YVkPQW5fB1CPGOEyO iXTWcUBq8OSAzWA45vHPjK6h+TWMMMmNT1U5PtS0kN5JSyed3rl5ORXfGjlHjKj2TBhE UYMHHxD7X1RCwpBOqZBa7rnacJBnVzffOVZVl79cX93HPEo7ruerI9Et+2P57i3jMOrn uSdq4nNzzDYn8Qgo2u3zQ86LMuQUjKdjPg44iCWlef+SnrevEIisSvxr+O5OqkGyfPaL 5P+g== X-Forwarded-Encrypted: i=1; AJvYcCXOaszVuaE7+Zi8vUI8aezA2nm3eitYNTWuxpzm1GdT855BuJqwgDgOMaib54owkt+ZwOQ20X3NmpudiUvM0IK68sob+ncTq4LW24cJtjWP7VTj/BQ= X-Gm-Message-State: AOJu0YxyHfYA2rc579dRG4tP5ZltYvwPFFzZY0bKXDNEYvDuCGEQTqkK GEuqDfiGQsVaTmt9KrJYhqvFcxW+CS2LEhathtYIWRGB6pAiyE7+51oA5ZJQvDU= X-Google-Smtp-Source: AGHT+IHN6I0KgOI+mMpRmfv9UvFiyCmUDcI287s6FVISxsXFeKqa2fx6vLJsUQQYAYOYjuyf/gP2Aw== X-Received: by 2002:ac2:5a09:0:b0:523:88e9:9cd2 with SMTP id 2adb3069b0e04-529667cf983mr4822493e87.67.1716819973713; Mon, 27 May 2024 07:26:13 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:13 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] cpuidle: psci-domain: Enable system-wide suspend on PREEMPT_RT Date: Mon, 27 May 2024 16:25:54 +0200 Message-Id: <20240527142557.321610-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072616_065759_03CA0B81 X-CRM114-Status: GOOD ( 16.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The domain-idle-states are currently disabled on a PREEMPT_RT based configuration for the cpuidle-psci-domain. To enable them to be used for system-wide suspend and in particular during s2idle, let's set the GENPD_FLAG_RPM_ALWAYS_ON instead of GENPD_FLAG_ALWAYS_ON for the corresponding genpd provider. In this way, the runtime PM path remains disabled in genpd for its attached devices, while powering-on/off the PM domain during system-wide suspend becomes allowed. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpuidle/cpuidle-psci-domain.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c index fae958794339..ea28b73ef3fb 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -67,12 +67,16 @@ static int psci_pd_init(struct device_node *np, bool use_osi) /* * Allow power off when OSI has been successfully enabled. - * PREEMPT_RT is not yet ready to enter domain idle states. + * On a PREEMPT_RT based configuration the domain idle states are + * supported, but only during system-wide suspend. */ - if (use_osi && !IS_ENABLED(CONFIG_PREEMPT_RT)) + if (use_osi) { pd->power_off = psci_pd_power_off; - else + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + pd->flags |= GENPD_FLAG_RPM_ALWAYS_ON; + } else { pd->flags |= GENPD_FLAG_ALWAYS_ON; + } /* Use governor for CPU PM domains if it has some states to manage. */ pd_gov = pd->states ? &pm_domain_cpu_gov : NULL; From patchwork Mon May 27 14:25:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675438 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1053FC25B7D for ; Mon, 27 May 2024 14:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EmNoOy/3uCr1LjrsTb+3nxp064f6ro+4mUVyYtGUl20=; b=bzC/lKi/TF0R/7 jee065rSq2K3SGb9z44kUnCHJSBxN6gUd/9dDJjCwgDcIjf6Ah7TNwbmj+290ge/bBzHLrQKG7z1C 9hSIBc2hjcSs1PU4k11jTGApBjZadY+ueYg1IPK4hoSQSymdD60/RvtbkSXXcj+jkR/blft7bZug0 MaR1uVBzTlXXx1h023l1kD9+79AmMZep3TANxC/Ip6APTGYV2ymCVyZ6uT2fE2nmr+32MmEtd+Sod VHlXwALW+st7eaMMarnWJQse90rAkMc9BVNOxkUOPdjOJiWMbSN3hSfNBgEalg2BJC40jLZkNevmD PSUcQftjjqKQ1Y54IKbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbJ1-0000000FMEF-2qdR; Mon, 27 May 2024 14:26:31 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIm-0000000FM44-0cKS for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:18 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5295bcb9bc1so2928531e87.0 for ; Mon, 27 May 2024 07:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819974; x=1717424774; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KjTbB47lhtg0PaxHpHSV+ev3VLrPkOO85FcCwtdMOr8=; b=eq4u9sK25bTHCCgNN1d+mwNPGjDwonwy2zWQqYjloaX+Sg5vYulQnco4gGKIeoqZcX aM1jI4KyOpp1Tq7zTP0uAZF/URe300Nvki2E0T8K2neskNJbRGxY8Twl0cVPP0YTX/7s 7bYvciZaCZRl8EdLXu2lMOwAyCdR3T9pGFhodjjAncf/z6FEWUdQwDNilWHfhixQIC6m VmiwWO2bZQ4/sqcJ4UK1r16SX+R3K7lMvTKAVy55VNirGK8Gc9Clvt/X3ok0tJZax7Ro kktw4TRSaplY9GJdt1kQdPSZC9lxV6EPvquYN5SkKAcUEn+d63uidATwb64fRBemS+GW P/sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819974; x=1717424774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KjTbB47lhtg0PaxHpHSV+ev3VLrPkOO85FcCwtdMOr8=; b=FSWi5tL3xEuu8XarBHFEYEzD6b94eExF0p7lEv9qyVQB6yqkPkJI7N9Q6SZinBvvKo EOHfHaz43OOv3T88tsThSbCo9V+1+eeJ7kIZMnydVgopFOKWyO2Q0gMSwkREeIKeohhS rUqHiMfb03t5WcCEhl5Yjt6bXwwHzgHbiSXKSn9OSBaaqsnxKMTwHufhMOQmD4Uu+iwC g5xjSZMu0bPim463Ol5GYLw7C616sDeiVnNKz1KkMgi0ZyGiVg3tAlXeaBthHPtfAsjl sSCW03AmFeZEg99FLrAVoz/1n2eWflifqfdJbVKOfVXfgNo+ydYlAlArUd2SjRviNaMB k3PA== X-Forwarded-Encrypted: i=1; AJvYcCXIxb3O8vfri5RWnfvvQ3plrnnrd3NK8PrvDua/luk4DOS2zTe4r1MlGJSPkVcpn36Z7gegL5r9OrQrMQiUcXEUpuZO4DBE7bgqvaylXxoYPhboP8Y= X-Gm-Message-State: AOJu0YxGLxrM+WlEFX+YE33+7Tutf04fzbgpmt4OSy/Xnz5MWwCKIgKZ +1SZbv0ceqpQO9GyOcDIsovXfzRlJ4yXi1i+gUra9cw1bXOdAoFsqN/SYb8tUJ4= X-Google-Smtp-Source: AGHT+IHROwLUTMrWjmP0xh3ZK9H8kROHkOyC9/3gwwdjBZr0Ond0GgOAOqXLU1YQx0oMT2Wjx7S+wA== X-Received: by 2002:a19:5f07:0:b0:51f:3cb3:48a4 with SMTP id 2adb3069b0e04-529646e3b70mr5388521e87.1.1716819974755; Mon, 27 May 2024 07:26:14 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:14 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/7] cpuidle: psci: Drop redundant assignment of CPUIDLE_FLAG_RCU_IDLE Date: Mon, 27 May 2024 16:25:55 +0200 Message-Id: <20240527142557.321610-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072616_256376_0F69BA0E X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When using the hierarchical topology and PSCI OSI-mode we may end up overriding the deepest idle-state's ->enter|enter_s2idle() callbacks, but there is no point to also re-assign the CPUIDLE_FLAG_RCU_IDLE for the idle-state in question, as that has already been set when parsing the states from DT. See init_state_node(). Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpuidle/cpuidle-psci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index 782030a27703..d82a8bc1b194 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -234,7 +234,6 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv, * of a shared state for the domain, assumes the domain states are all * deeper states. */ - drv->states[state_count - 1].flags |= CPUIDLE_FLAG_RCU_IDLE; drv->states[state_count - 1].enter = psci_enter_domain_idle_state; drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state; psci_cpuidle_use_cpuhp = true; From patchwork Mon May 27 14:25:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90810C25B7E for ; Mon, 27 May 2024 14:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=33jvznGdS65qVZrUy8bELaW10niFCJO4Lp+oTMbVJcw=; b=S2NJiBHnMyQtwG ZvW8eLvsJPSi6ieIcd554F3nsj0dvsLczpBqxU8M1Y+ggT9AZKSYkWaFoJQxbxJ3jE8DFaow7BNmL xLsSGgpIGr1OLjVVvMn8f/URmRaMgeuTzJ7cD0ZttepjAd++25R+bztQYavWEJzTrf11ySlUAD27E +UNAUAcxSIGK9zVEx2eBOcGMI+li7hxnKnMscObQrGsE3afH8QAbMbeOX34/mYePAMebLjjNLI/eg NfNRRHcp4hW8Rctt0C9WqKykzrXaJg4EEXUxZwJYukUpoieQ9wqeEuKr2GA4LurD0tOvqSWAx3iQY Vtu9RSEPPOfqbAWP4qYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbJ2-0000000FMEq-2U5E; Mon, 27 May 2024 14:26:32 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIo-0000000FM5r-24fa for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:20 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-529682e013dso3428040e87.3 for ; Mon, 27 May 2024 07:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819976; x=1717424776; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LljiSusVSLaQvLa3fMIpBprCm3Nn7mYz+K0yIBAx5Q8=; b=PHZrRyt5xxt2OUUw+Yils0Z6uLNIBbKr5CRPysgO+5YjQvP4yE08WCuLWPxQr9k4zI GJ4awt6P4NJuidLl0SGUuxhh5qDQbAnX1DV5a9OAA/YQJrAUievaWWWsbFwOsnEgA3IW nWv/cP0foSxK5kG24FvCv7awVZ8wR68wGBhQIzR/xeYEUpsQqBu3FS6s3wda1zpep+xd hJwh88GpB019vFzgztDRERbExlCMSV1G56QWZAbdm4FJMVjPnRfpFSbhMPDJzMUz6/Bc S0p4I1LHi+je/u1vXIjTKOOVdGRFUlkQEXb+A4/NhG2v/8rsQhB+UMS/pEwboVa/I7n+ a03A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819976; x=1717424776; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LljiSusVSLaQvLa3fMIpBprCm3Nn7mYz+K0yIBAx5Q8=; b=bFPzp9eNQ7P/fIPmphFCllXoExjcA5C9hhqjpiYSH9gAUPbjdfJWXbgt19pFkEpEme xxkt2CI17tX7JnhMTMQcQdz6IcIiFGLXyOiWv7JE7aW8OZ1UF/CfN5Y2NQctqX2siof7 yee3sIOg4xVBwRLq4+nuZ1FGAvWU8eM07mZaZTo1SGZIPcbFHev2Vg4tV1w626OFCR6Q UyZNvoyk5C6VQ7wi02E9yREZTh0hbUPp3IRe8EPKZu6rD5ckQkjVogErwUZ/BLyo21XR +ecSgGmutXK5GIuvjFEKm/eABQZ7bsyJTUDSRII1wP2gZ9rCMFnqS5IZWPihPLmnJP1o 8+kw== X-Forwarded-Encrypted: i=1; AJvYcCVGRkTPi+x5KWbSCRL25InNUOASV+52HV2PDtwMcvifKZkfVs/V0jE7wgEB94bAKRmjrrMNhXJbmmjwU47DGQr+J2OQDydDV5DOT9rkSZM7zxn1C3M= X-Gm-Message-State: AOJu0YySs4FPuYrPVXq6vxvX9hZ6W85pjAni/5V84O6r4LXVDBBgu+Sc M9Nom/g57W2ho9Q06MDlqP1s7YV21pxrGjIkRxwntgR+WHi+vm58wT2+n6CaoongiWWAHduy7eA J X-Google-Smtp-Source: AGHT+IHda/pxt1Ko7UnJfUcRRPdZ4toQLHtsmBjmcxqQ5f4apt+9Z4qbCKGMZXNL6CMfnbUjmtCv8g== X-Received: by 2002:a19:ee0b:0:b0:518:a9bf:73ec with SMTP id 2adb3069b0e04-5296519899emr5678201e87.35.1716819976367; Mon, 27 May 2024 07:26:16 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:15 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/7] cpuidle: psci: Enable the hierarchical topology for s2ram on PREEMPT_RT Date: Mon, 27 May 2024 16:25:56 +0200 Message-Id: <20240527142557.321610-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072618_729856_B728EDC5 X-CRM114-Status: GOOD ( 18.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The hierarchical PM domain topology are currently disabled on a PREEMPT_RT based configuration. As a first step to enable it to be used, let's try to attach the CPU devices to their PM domains on PREEMPT_RT. In this way the syscore ops becomes available, allowing the PM domain topology to be managed during s2ram. For the moment let's leave the support for CPU hotplug outside PREEMPT_RT, as it's depending on using runtime PM. For s2ram, this isn't a problem as all CPUs are managed via the syscore ops. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpuidle/cpuidle-psci.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index d82a8bc1b194..ad6ce9fe12b4 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -37,6 +37,7 @@ struct psci_cpuidle_data { static DEFINE_PER_CPU_READ_MOSTLY(struct psci_cpuidle_data, psci_cpuidle_data); static DEFINE_PER_CPU(u32, domain_state); +static bool psci_cpuidle_use_syscore; static bool psci_cpuidle_use_cpuhp; void psci_set_domain_state(u32 state) @@ -166,6 +167,12 @@ static struct syscore_ops psci_idle_syscore_ops = { .resume = psci_idle_syscore_resume, }; +static void psci_idle_init_syscore(void) +{ + if (psci_cpuidle_use_syscore) + register_syscore_ops(&psci_idle_syscore_ops); +} + static void psci_idle_init_cpuhp(void) { int err; @@ -173,8 +180,6 @@ static void psci_idle_init_cpuhp(void) if (!psci_cpuidle_use_cpuhp) return; - register_syscore_ops(&psci_idle_syscore_ops); - err = cpuhp_setup_state_nocalls(CPUHP_AP_CPU_PM_STARTING, "cpuidle/psci:online", psci_idle_cpuhp_up, @@ -222,13 +227,16 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv, if (!psci_has_osi_support()) return 0; - if (IS_ENABLED(CONFIG_PREEMPT_RT)) - return 0; - data->dev = dt_idle_attach_cpu(cpu, "psci"); if (IS_ERR_OR_NULL(data->dev)) return PTR_ERR_OR_ZERO(data->dev); + psci_cpuidle_use_syscore = true; + + /* The hierarchical topology is limited to s2ram on PREEMPT_RT. */ + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + return 0; + /* * Using the deepest state for the CPU to trigger a potential selection * of a shared state for the domain, assumes the domain states are all @@ -312,6 +320,7 @@ static void psci_cpu_deinit_idle(int cpu) struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu); dt_idle_detach_cpu(data->dev); + psci_cpuidle_use_syscore = false; psci_cpuidle_use_cpuhp = false; } @@ -408,6 +417,7 @@ static int psci_cpuidle_probe(struct platform_device *pdev) goto out_fail; } + psci_idle_init_syscore(); psci_idle_init_cpuhp(); return 0; From patchwork Mon May 27 14:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13675450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5E73C25B74 for ; Mon, 27 May 2024 14:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nzU4+XdHoS4UGvvP6XBa4fSmOOb5MCxKQ0ar1CC69RQ=; b=L4nwPQRt3cjrci HiA+nFM5jRgw6l+mL3aTO32VJ+6+2o/e7/e2mT2ng4ZD/alj/ahjVdwGvDIDMgJlACrGbqh9ff9XG TfT/8rVy/en2NSZvqYI6Oksz5V86gibX3AK4ifAxnXkTLVJ0KNWGExRVzA6M+rSl3YKv8Sta8Tj2f QgwzdohjFxZw/UvaVwEvMXpPV8MjsggtqPD47Qg5KjZXVAh5NY9dMXsTrzL8g9kYEOgZ2KAAM95zG lEIphiw99B2gCblHCbhuf3ByewZPS/X1FgHpw8GQ5TiDlCf8WLXiH8AqyyIm7zSVrw6GIHxRlM6mK /EvejSpFMmtCqiFL9O8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbJ4-0000000FMFn-0HSv; Mon, 27 May 2024 14:26:34 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBbIp-0000000FM6l-0UXb for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2024 14:26:21 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-52388d9ca98so16948734e87.0 for ; Mon, 27 May 2024 07:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819977; x=1717424777; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/GR2SPI55DeqkFqYqinmHi2Z3WjfSQZFZ8NPV3Q+VMg=; b=MyoEQEKQ/EM4/v66Weo99NOif7CpbvOiigEkIcYe6O/NCQRSBC0fWbRgbgNLfChvMk ddBNJ4BIzHTi5JxacTo/iEwMrgFmaea97sT923mcBEyvSLfjp+3XCW52hocaZIs1ZEtx ETV6VALJWl+kPqhKUIadk8dhS3ktMQmmOGQMOHosl6UVyCQwrEOMSQ9BagavK9rup7fE fEwkcW0EMt/9Rh9rd3Fr9sNZmrXleNAa4yXkMW2lTwNMNR/vuNIyBuuQIaSZO1M9E0Ze Tm+4OE52daN6BLQa2k3QXSRyI6mnOx5cayqYxhh00sCz8khUTK11FQ2xWoz/xnhX0Q+E bGDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716819977; x=1717424777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/GR2SPI55DeqkFqYqinmHi2Z3WjfSQZFZ8NPV3Q+VMg=; b=a9SkmcFC5x51jCfv5Y0HYeZ4gtuAk24V4+eBUJUo8qJ0ZIxibZMKPAvRVs1y0Z6+Bn 9DHC2+gXTpvqoF/hx5d3obfgMuPHtyTtX9BKmzLaswmDJwj3O8WljOQvNJW9eqNYflTC mANvtcBQtxUHRadI3cXockTNiLa4VQmUfODbn//keGa21c5J9yRQ5WMB9kY8as/rBJk0 ehZhV8ceHv7Nj6tesaCACL6f0qp0eEaf6YGjOAU5WowsqiE6okie9KVNXecIHbwhze2P i6YV9oOuhDIhuYvC1LxSkcY2RX8pUuPvVvVK2TKqwUB2sw85/C8ZpYZXdTWEMsznOcNP AKdw== X-Forwarded-Encrypted: i=1; AJvYcCXx+FmEIO8hfQXuLglaImsqfQDEXE4xCm8vH+XT2j22JV5BnT5GwrCJtJIeEDcszCHcKQpX41MEqWgfDE+9+6tWFJ2WvmjJ5NPiVTROrz4PCi+rH08= X-Gm-Message-State: AOJu0YwsLyimsbhU/TKMxAic9C9kYKEftKZHdQgoh+A8OiERHbX/Zqz5 GE9O8VV6ES3OP2uSAIinA+waqw3b4IVbHwsvvp4IzWIqgA/Ym71hUoEH+WvsVQ8= X-Google-Smtp-Source: AGHT+IGA/P2FW8XpPqzZeELvPdtjcyg+OYc+xsv0HaG5JN5DSLqw1uWa/8UhB3bobcPBPC4oZ82dnw== X-Received: by 2002:a05:6512:3107:b0:51b:528e:ce7d with SMTP id 2adb3069b0e04-52966005b6emr7056095e87.34.1716819977519; Mon, 27 May 2024 07:26:17 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-529711fa7f3sm562002e87.258.2024.05.27.07.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:26:17 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , linux-pm@vger.kernel.org Cc: Lorenzo Pieralisi , Nikunj Kela , Prasad Sodagudi , Maulik Shah , Daniel Lezcano , Krzysztof Kozlowski , Ulf Hansson , linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] cpuidle: psci: Enable the hierarchical topology for s2idle on PREEMPT_RT Date: Mon, 27 May 2024 16:25:57 +0200 Message-Id: <20240527142557.321610-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527142557.321610-1-ulf.hansson@linaro.org> References: <20240527142557.321610-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_072619_303267_736AB5AA X-CRM114-Status: GOOD ( 15.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To enable the domain-idle-states to be used during s2idle on a PREEMPT_RT based configuration, let's allow the re-assignment of the ->enter_s2idle() callback to psci_enter_s2idle_domain_idle_state(). Similar to s2ram, let's leave the support for CPU hotplug outside PREEMPT_RT, as it's depending on using runtime PM. For s2idle, this means that an offline CPU's PM domain will remain powered-on. In practise this may lead to that a shallower idle-state than necessary gets selected, which shouldn't be an issue (besides wasting power). Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/cpuidle/cpuidle-psci.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index ad6ce9fe12b4..2562dc001fc1 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -233,18 +233,17 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv, psci_cpuidle_use_syscore = true; - /* The hierarchical topology is limited to s2ram on PREEMPT_RT. */ - if (IS_ENABLED(CONFIG_PREEMPT_RT)) - return 0; - /* * Using the deepest state for the CPU to trigger a potential selection * of a shared state for the domain, assumes the domain states are all - * deeper states. + * deeper states. On PREEMPT_RT the hierarchical topology is limited to + * s2ram and s2idle. */ - drv->states[state_count - 1].enter = psci_enter_domain_idle_state; drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state; - psci_cpuidle_use_cpuhp = true; + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) { + drv->states[state_count - 1].enter = psci_enter_domain_idle_state; + psci_cpuidle_use_cpuhp = true; + } return 0; }