From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF30B161906 for ; Mon, 27 May 2024 14:26:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819973; cv=none; b=AnisvRN8GtihYT2M/51uP5LkoIyIJt82Q8qhb8R905NmZceXlb2+ciY/JoKlpAy3vIAcbUgKFy9WESLSHC+Xvz5gzUFwPu1zFAgNbQszI9zWB2BrdjrnAy4rGNFp8ERKutCb8oYYiWyzc0XrJa7bjZB9rBAqVK/C/xADpddxkis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819973; c=relaxed/simple; bh=XKLaI74qjA22QeAsWI8Ln1246wnUj1/8uIXA+l/FzQk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L9YYqtN4+LEEozRYb/vfK7VY6SuD6pgEb2BGdotlMUzfAkiO2aEdxcL6Fyw1K+8+GHDu7TiGtoIBy4OqWTIX3zligWlqDf8yyW7fqshfp7xmtQzHKttJR1J7oa6Q7MQ/7uP39FdfkshYp8AP8sjdzXNYYmKQD7ybvJcgJNO2Pkk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MB+Qa57g; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MB+Qa57g" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-51fcb7dc722so5088075e87.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=vger.kernel.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=MB+Qa57g/N7vGhiTnBqeOdPr2vrn3NUueqPQQ1Cj2S9JeTDVEVYKown+p3pkV1/rnz 2fdKR7s0KH8PLV6H7cqPf/nbWkIBZM4RAAEb8ujyrliHHUxgFs36RiT7aCnqeKIfGoIL V1HY731aMyAVRbVhkXsr/6dXHuWynzkwFmUTXL+ug3jsUqPampMfQfxYLbzDVxJdrpbb gTUTLo0o4x9Ne+RxMEeEKxbTsC2Wod91QWafaMdpzINvF1BpSlgNzNaV215B2i+dzhJK lDoLTcmsZ2YF57TJAyaamMFaD8Uc0NUU9vq+bPBqAruMedGXVwU22A3ZxhvfPC5OciKB Nw9Q== 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=jkfUOsZ0FCbyDgaul6sqXOhXiLC4vRiq3dCyFZx/P38o2dgzJru1FHqUlvkcOIQxms UfpPUm4q1B5h9E+DgRzFWpe1JZneOsdmc9PQhiQAb5L+9R5VD5shr37WmuSJ1NvX367t nJ/2UPOCB9GBhpY3IZH/y49DWblNVn7H1ipuPBJSLkxvOrwNmPEYuUKn/mjS5XXLYe9T D+rt+FMp60jcv4W0pXRGYLr3PhCEjVvkayWsynXGvT5uFCNQzcL1XgSONa5Ja6JybH9t +uYwXesPstUV+DqT8K7xMAJR/DnuWQPhZvovSv42bp/BGvzKqUC6dcj8fUezb7hv6dea tRZw== X-Forwarded-Encrypted: i=1; AJvYcCU9a9uZ0QtUvaR15SksLJ7t0cfVNYZErYaFNiqXUK+USu3JjHkgdrZoMe6SICSfMItkQMTl2k3tTb5bpzVoo1V1U4NEMbmOtkq4CSPQ X-Gm-Message-State: AOJu0Yy1QG3h9S1LtZ3ypXjpzcRAIwhB/UDZn2Wfy5tiIsOCUNyoFJo8 GPWoV63+S8VvesJ/mz5hqe24OnTGa6LqFU1VYDJ1Z14Mj/Z6MKCc5AF/4u1r9v8= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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 =3D { .unlock =3D genpd_unlock_spin, }; =20 +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 =3D 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 =3D flags; +} + +static int genpd_lock_interruptible_raw_spin(struct generic_pm_domain *gen= pd) + __acquires(&genpd->raw_slock) +{ + unsigned long flags; + + raw_spin_lock_irqsave(&genpd->raw_slock, flags); + genpd->raw_lock_flags =3D 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 =3D { + .lock =3D genpd_lock_raw_spin, + .lock_nested =3D genpd_lock_nested_raw_spin, + .lock_interruptible =3D genpd_lock_interruptible_raw_spin, + .unlock =3D 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) =20 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 =3D &genpd_raw_spin_ops; + } else if (genpd->flags & GENPD_FLAG_IRQ_SAFE) { spin_lock_init(&genpd->slock); genpd->lock_ops =3D &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; + }; }; - }; =20 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *= pd) --=20 2.34.1 From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10E94161920 for ; Mon, 27 May 2024 14:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819975; cv=none; b=EGOugi3sCZFFZ/KvJCC7YwRegOMpAB5FfSEQTFbAveL5p41obCgMeYGb2TURhnvBlgn718SdUO/T1LAPoSCH5/VGMCgFtarv0IBznJhmos8nGrQg867qDIqNSr79pmYKTtJsxqX9zIH+mQNgzHV/FygrvlEaZNw8KjD2EID+QGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819975; c=relaxed/simple; bh=YcCK16hCcedyEDxCm8Q4x8DZte4hLECUoktYNDUh8Ig=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NxouO5PkhjXAYN54a4e0R56lwa48DNT+717H/LUEclDBb/zpr3M00RAzdaki7iF9ftmK+HoUfVTR/9Yg7Z3UHXHBLPdGC7cuWWkY7wO8ET7bBI1zc5W3hHYepkLggo2eil7HV5qlNJriYSGbQcvwXUjoSIYxg1zSFu+Ug8HwkBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Ywo3EySX; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ywo3EySX" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5238b5c080cso13159990e87.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=vger.kernel.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=Ywo3EySXtnPb3AlIxCagFsDBfd9qXwHIEmFczq4ALhGvX6HgW+Wjmi+dgHqOcj2AFw WEYmpY9UesrETHK6BrDf0Lc5/p70EcyQq46s1DHpM5CZC8ncbm0GHFVjOTXkQR+bKDGq Zg7+fIxixtQyANaJMdeQsjqPhGD9eG+iUsm8I6QnQ97WJrpiGYF0tyUq49soXThZbRpL VAumhoQmuhc7yTEZjX8cwpLv05lYtWFHcYKM+rX7k5Rp++jLcQ8gcwUPPUQaV6lAZzLw ljYkIlp/KBoJpEt0rO5vW0bDre4POVDvHQZQAB1m2rgvn18YWfrWlSYTd67xpXd0UOeu TZpA== 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=MZdp9YFBT+I0jCc7NdQxGZUMXihHucBo4VFXqCfh4Cnwea1GBmsJpb14jvOt77XZUB JE/AGxU2pV23ATQUQWj4umTwyv8nVBR6JZgqKSIhfh2fms57h371ugTInKlz5VJVLQ6o BKA+1ap4HnhCl7u+4Acz00QjvsR1ckzTPXM2I23X+zeBfDKgR8dhIYRFPw2Ss59qJcta NNoQJ4UOnbHn3VkqPAR60UFQrfhznbY2OpDBScPv5KSBytEthjM/+EA6C5hpH1D+/hO2 F3mMOJex4Wb3yIkq7MZliQRH5clkDioUADTANLkD4XlXoLTEpWSWWjrldLsJOPUvO9R+ K96A== X-Forwarded-Encrypted: i=1; AJvYcCVz398CZifJzalCu0p1cSkd3GEOqhB4fjFXTX3x3L5EdwlEhk8MrTUvMmjvaCkJH+J8bNRFMAbVeQlC6JUVirt2JJb8NoJRwnn60EH3 X-Gm-Message-State: AOJu0YwIyg9ZbgO2iPIrwmTeCxoM5ckA6wx5ZkiueqdQrEz4y7j/gCm8 iszYyYcgH70G2vikce+uR7Cuwi4a1X9GUtkHXYRHm/A45BQhEFLB4IYpeXEwyns= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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); =20 genpd_set_cpumask(genpd, gpd_data->cpu); - dev_pm_domain_set(dev, &genpd->domain); =20 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); =20 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_do= main *genpd, genpd->gd->max_off_time_changed =3D true; =20 genpd_clear_cpumask(genpd, gpd_data->cpu); - dev_pm_domain_set(dev, NULL); =20 list_del_init(&pdd->list_node); =20 genpd_unlock(genpd); =20 + dev_pm_domain_set(dev, NULL); + if (genpd->detach_dev) genpd->detach_dev(genpd, dev); =20 --=20 2.34.1 From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D71616F914 for ; Mon, 27 May 2024 14:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819976; cv=none; b=o8ywMIXf4DzHWIB7tt/NYM7jg5dUmGvsWKO7l3gHa0M0cDrJ2cCjbz2OlZkLZr3S795jKPUApz9G/Gph6pECXD9qcUSm8RsYYI97dS/r0dJGbl+1LcEyk9svDmJGzqUH/1GTlyPOCVDYZ3vY8mIgJ/hOWJOwmEpwo1TYD2gtXkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819976; c=relaxed/simple; bh=pVa/c7bjkzXR/HPoXDkq9hzau6IgX+Petquna3Ia5vI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TH/OYUVIYPTledfF1w32DioeXOLSvmOm8E9AbThTiFcDiisDaoAqR28Fa6ESrol6uvF53PRV8BU4RIyCzyXG2N3PS+j7o3XrvmUOebAps9Y/BBpaBx2+ixFdm90V8MEofAQCSU6+Ef4FvhNu1J5pSwa5Qm9JUk4INNxoktdMFfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=k40r6NRU; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="k40r6NRU" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5295dada905so2658185e87.1 for ; Mon, 27 May 2024 07:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819972; x=1717424772; darn=vger.kernel.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=k40r6NRUDBENIKez7hzrCxWWEDP3/XjlJR1btJO4VZlzav0eH++gFzeOe875QuFE5l xn6MtImvBnOfGIi7tm6vTHd0NEr0YDUL+xcQ5hjd8cBh1DNcAXuxcUCVimwp/cbJ/nCb jD8+uuBws7qWiuuoSQwuw14aDG0c7KnshjfHdlCAkgv78/fnhh5wYETJC7+VWfcLBbmy QZukE37sho/H86UFyezP9/OWfTP2wV/OWQ40E2BYd/W4HPa2lFE2nLcHU4Lu2IUICJGb CVmk5qo+bonKruklyrfBXWAo0VgaQpV6m3vsCMF0k8JZ3syVlQpCRE5BhlPEdkKywuja H4aw== 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=kw6YXCPMgzkBrPoAf5UBrykpbTffGK0NHF1kzohpgnPCXetK1hXxf9ZSQq0HQj1rHp 68Ova91KHVVEjWmimgnjG0RZN3QRlTZGvL4yqUZ+eHjNZMDJM3qaD5uID1Cle1NsnWUG OwLjbaBj5XnuEsJCnZrhwWtlQLyaV764Xjqzsr7IuAuZTj02gj7bhnXVKie8MCvcva+x FE1w2kdzfB1JaTC6u2ceD4ZSoWHZJO2vTQysr57lltpqTWpvYTihllNkDk5hbFbLh01I NTyZanboOhaC/ac0Y6h0kG63xjyQeYBBNPUgRBEFXWL2dRhgeGC4ic/jKKfHamHj6OlD w2Pg== X-Forwarded-Encrypted: i=1; AJvYcCXn/Np3IWcZXhxuE8TPIhU8iPOgljgm1uyIvb0pHoXNRIMKEkqwYLu9KFK7msfnYd8vgkhziM7SdBtLoM4Nl3ExhCN/dSbOMHu36cxW X-Gm-Message-State: AOJu0Yx0K3ooFXxRFbzHjNbb+b+b0TsCBtl5xhzHJbXWR/2bZWBtziVv VmW7tBob4XEy4xkUMXRRIP2iMPwN14Uh9crZWS1gR/JodrBXYVf831tp0WbXoEc= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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] =3D "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, } =20 list_for_each_entry(pm_data, &genpd->dev_list, list_node) { - kobj_path =3D kobject_get_path(&pm_data->dev->kobj, - genpd_is_irq_safe(genpd) ? - GFP_ATOMIC : GFP_KERNEL); - if (kobj_path =3D=3D 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); } =20 seq_puts(s, "\n"); @@ -3393,23 +3385,14 @@ static int devices_show(struct seq_file *s, void *d= ata) { struct generic_pm_domain *genpd =3D s->private; struct pm_domain_data *pm_data; - const char *kobj_path; int ret =3D 0; =20 ret =3D genpd_lock_interruptible(genpd); if (ret) return -ERESTARTSYS; =20 - list_for_each_entry(pm_data, &genpd->dev_list, list_node) { - kobj_path =3D kobject_get_path(&pm_data->dev->kobj, - genpd_is_irq_safe(genpd) ? - GFP_ATOMIC : GFP_KERNEL); - if (kobj_path =3D=3D 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)); =20 genpd_unlock(genpd); return ret; --=20 2.34.1 From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 828BA16FF45 for ; Mon, 27 May 2024 14:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819977; cv=none; b=GcX5zD/NWZ80bevXpXa8tK536wTqAxpQNnEO9ZkCdjUGWnBAvocPGGofB/xrbfq+TdMG7eU8YMkCeU590GywjozLcwExZoGq12HuZyi52OUfkKc0Q0Cv5A5jzRkZnNJoZRd6GH406D4+kfzpj8nyG1YCqZJW+Fq/ayeq1iGxJ9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819977; c=relaxed/simple; bh=hXWGDXaJCWWQtdpRlOhBueY5IthUY27xAjhv6lNOX6o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S9KDBGyAEM06HY+NAN9EI5kgwIRPXnSoWa2qTbdhIDLzhHJrGK3GERSypYiXsdXDhZD29gLtOA50l4qcvh+yHoHeERuZdM6LdhSkOW2T+fAz9qoxBheF81TOH0hVIGSmHu886+9sKAaD5DVh1Cfj6StzTBHgpm3klyj40Hx62XY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nWAQus0f; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nWAQus0f" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5296232e00bso3500404e87.3 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=vger.kernel.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=nWAQus0fy9L+dETwgVGRt95Fd/HyGy80hSyhzzMfSJdW2QCAp8wiNgbCeICilwPrP8 uz/XXb0NJFviVZy62KY9akehNUDak2MCYByhNTdfiTm3rNFeHFYnc3mFnIoZEcoR05Qk j9bRyn9To56pt62qlsrAYzv7HvClbA4M0/S1WtD6w+JhpzC2F/jtQdKTTFK0PpZs9IoK GsK2SZzJ8X7ibJ/CgNMu2uzZ2NE44k6/rSFSzGMU0m6vZzVFOcMskZ8aQX/9++GRpaT9 /NkdhLZhr6YskrD5A6VYc6QOXglUhoWHLyFsOtWMnWdt1tnHbBBCRsUk2QEUe6+pzQwd W4eQ== 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=mSa15D6HPXnDK3kIX/LcNr3MxfSiaC+7S0mCINVME72D4emxqDvhZ3Se40lIrFwpvf gzUq0Yh6DD491eGNsmmQCf2Y3USuouk3XwHXs3RVa8nL6UV9HRO5xQeuB3HH5c9NjzCY jrUVuT9nvEgmKDHd6iyreV/SogVyUps4D7PDpcSLHkc+BfZ/bAVs333+oT3YIfMqaOVH Rdy2ZQwk3nB0lQPx0rQfP4G+nawdw1a3ggQzydUrrkCLoiQ/prV2rU7+xrPAnJJG9vnh qoe2/309Wj5MZhdA73xeR3VHxhWW9nVuBMmIZQUqHiB9wMi423s41EPap0PaLwyIdiJD SZ+w== X-Forwarded-Encrypted: i=1; AJvYcCVr8Sn21JDMfV0qXSYFQnB3ixbS4Dw/MDyxwGbD2x1kQFL15ioW2a+mjewiDlGSPofm1ugtI3Jq7vKmdFdBJQj5odYTW/tcA7KCGRLz X-Gm-Message-State: AOJu0YzsapoUfv+VanukEK/U9uJSNyOUlIkOPspIvpDiy/AayKz98SlW AgZp8JiroINEV13rmmDnm777u0cmdHl0yPQsWsrpANjP8Q/tT2aFSkHTEJxGIwY= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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/cpuidl= e-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 us= e_osi) =20 /* * 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 =3D psci_pd_power_off; - else + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + pd->flags |=3D GENPD_FLAG_RPM_ALWAYS_ON; + } else { pd->flags |=3D GENPD_FLAG_ALWAYS_ON; + } =20 /* Use governor for CPU PM domains if it has some states to manage. */ pd_gov =3D pd->states ? &pm_domain_cpu_gov : NULL; --=20 2.34.1 From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F94F170828 for ; Mon, 27 May 2024 14:26:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819978; cv=none; b=M7T11HE4fPDaexRq5xSVvcihbqkkR3nvydEN6Qgb54RcUwji79YpI/Kcyh99CBRxhsRZff5VT4y5Tt8LwBH7L8FNnEp8/vWxCUDrgqYUUzELrOnIQT6Wh1xMKcGO40eUFWFxntG5Zs3b6ugYRyy9L+1ounAwScWxKUSS4MLCV2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819978; c=relaxed/simple; bh=Th6flGQrgEICY4BFAb32zGR1x8yV5aU/F10SCLnIldA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tusNdArninmPx2fSOllGuXq5r4eODnFWSpgpWKaGCczo59DNwOjaPexM0HgHNIFEuY5G4dKX5VNPQYcySoi5cU17KY0Ae0Sxi6sYsj5wcfROgvPMu3gaOdFGxyiDypP/djWrgCjM+82gSb73LfGJr7ZFgBpe+7bIMs1357Ln4S8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WdcOzz9I; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WdcOzz9I" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5295f012748so3685927e87.1 for ; Mon, 27 May 2024 07:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819974; x=1717424774; darn=vger.kernel.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=WdcOzz9IhLaz5Mo4VEzpUGRMS+C608dF3VrdPzlgkAdqW8RVlCvrUStcF64LIfPXrR sKsUTuvBIOESdJXZL4hDd0y4Vbd+oHoAAblxVZtfcZcOW3zWESz273lNsXLdAbXDC2Gl TKcOVzagaRTMrvH/jtUtP3q71ez/8Luu3MNw+JCi0fUzimzFzRlZ5mwvo6BwdmeCvwhA ygRDwTIoUxuJ73AnIZ9FxF//cI46hK34HEU9ylNmPCn/g+DcIkGTYG4u9aD0c9+PEQaE RXc7Y/gVyd0aSlt2ABkI6LfD2r99xSD5dfsx2zQO9X9BalusczlIzuAwkKHMRxs8qhuc qURg== 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=GS4xi+RZWE18p0YJk8O9ue+fCV1XQnhRFHsUewRhCtodPGKjqswS8nedhIW7uZnh3t nhAJfE1Idlfxcum82wsBZw+9Fp/imBCRQySZ9y+3mSGfcdgDdnRgN0sEBndgfyY+n7sk 2r6JcTNkLEMKuUpho2nQoiG1maEG3zgUF4mWg7seMh243VqqF/bHtbmJxLMsrTyp3OhT 2eciyztVMIwv/S93zBwcSlWGdaRc27lI6PF486C4iy6msq2SrjIxq1zuIodR96rQK+2W JNQvEHKAt/8T/p5+dKQJ2IyrEm3R7p75rS8D+gVqapRMDB8XugLiL6q099gfb46Jj7Kk N1LQ== X-Forwarded-Encrypted: i=1; AJvYcCVk0d9cZaotr73GyZXeO4K4QIBo8VdhPNva1p3yyzNSXOBSYMnstdYQmVtnDtKCQ5CpDRMIpApgGig/SAivpaBj5YIOmIbKltBX8DRy X-Gm-Message-State: AOJu0YzeMfQOjgK+eBVbp0t3LZ8ouyoeiWVXPC1VdRk3myXjFXplhHw9 eCzWger57fH+H8k4242ZGlLjbQod8utwlc5ElBFmvGV8L/rZwq8f8R7CX0b7db0= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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_dri= ver *drv, * of a shared state for the domain, assumes the domain states are all * deeper states. */ - drv->states[state_count - 1].flags |=3D CPUIDLE_FLAG_RCU_IDLE; drv->states[state_count - 1].enter =3D psci_enter_domain_idle_state; drv->states[state_count - 1].enter_s2idle =3D psci_enter_s2idle_domain_id= le_state; psci_cpuidle_use_cpuhp =3D true; --=20 2.34.1 From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09A68171081 for ; Mon, 27 May 2024 14:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819980; cv=none; b=ApkTjMlcpqpDCNcuisTRUN5YF1KErkvdPMAP/cgqZJNosdn2v/gA+lkS9eQHrZ6/dANHELDjT6mDJ6d3NiuQ/1tSkMAR3yC8+YUafowATCq9VwEQSo7Bovjd9SwDQVddSTq/CuOyo4usJDOb2WpW7vFmUF38Y7/DuwQb3jjYtPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819980; c=relaxed/simple; bh=Dqf4iQmXp0zK19p1+7qhaTomO3Kpy2CqPOAV3dW0uXE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SUdi0t7qGdPCYbtaJnhvGxxlmWJyJkKyKf06xK8+OJhfvn70+u9RfTKzwJAqNFfNg/Hrg2EmPRGQjNJ9UNk4/ZzkzJRt18GLreV+LkixPoFuGPM9TC1V+PkL4AbBr3L3UPKB7RPVZqnMK0C7v7+loPpV6YOMTOoj/mmOM0Scz5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lgof/2C2; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lgof/2C2" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5295dadce7fso4184388e87.1 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=vger.kernel.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=lgof/2C2IrfR8Y7zaAeMVr/gRnZfYETQoJbmAMIUJr7dMRqU2LYgvCZXIhZPlBjUa1 3zQCaUH+XHmrSeJucMiZMkl6VB0R8iizmztVAjC7tiTvAkUhEHqQmkRzTGWvHriQspoM Nihi758/77c1m3UbQ+AUVxMPtBn6DkvuMmp9C5BjkOi/Ec3qvYx4yWmpvUU7jPRk0BvG VZyyyBabHeYoNy54D9qeFgaabyJvLJLKwY9+qgpt7EhvYrXF5wG0rws9teCn056jF7bC tmtFABRIJLXJExFJ1M+9vRCykropcRBGpokUiZ9eOT56oCtZszfml9pkHfQIfKgMOMBj +QNQ== 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=Pz+WYg9fVAPV5Tvqf+TgydqHRR4QQ/tQZ+NR2sRElENll3/c57Q8x2yK0EYA6heNZe Oh1zn0e7Nd1pNsNcxH8aAdoZ0vZthd/+ZLfMWG/WRnSKoPQy9El4ilkYk1hffd9DQVZD FeoB/sZp8UeYh60/QcCBYxL2swhawWbKnRBCtWXYOa7wwpy77z3fCbIAQ/SibAIDQuzZ xnpVgHieKEeODo9I0QAw/sdeOPPq7d52TDuwoSxtWp32Gnn/qz/jZWMSTcvFDCI0d6fS kZlaQSXJIyyeBsjrHv1C7BwfAkZ1YNYEXNPFAAzU2mSbvjvjxNvzXeeAZoVQQGeH+Aio LowQ== X-Forwarded-Encrypted: i=1; AJvYcCWYLsbEFcP+Y17lR+CXlr7D5p6jjbrin8S8flK4IZ4j6XGVmTPHNiG0+66csAX0z04sHeBojzn7J6wLnW9OKgwkAIITCOZNqTUpow1N X-Gm-Message-State: AOJu0YxyoYVDNQ4/xmaSs8W/FI8blUeX9Mz78b5ok98P/754Enx1OAHt Ln+MEaPSGo/xBpBc10yTJwmTU+96GqhOTp41PfQr2dX/Cp3SfA/lteo0HAHLvR8= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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 { =20 static DEFINE_PER_CPU_READ_MOSTLY(struct psci_cpuidle_data, psci_cpuidle_d= ata); static DEFINE_PER_CPU(u32, domain_state); +static bool psci_cpuidle_use_syscore; static bool psci_cpuidle_use_cpuhp; =20 void psci_set_domain_state(u32 state) @@ -166,6 +167,12 @@ static struct syscore_ops psci_idle_syscore_ops =3D { .resume =3D psci_idle_syscore_resume, }; =20 +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; =20 - register_syscore_ops(&psci_idle_syscore_ops); - err =3D 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_d= river *drv, if (!psci_has_osi_support()) return 0; =20 - if (IS_ENABLED(CONFIG_PREEMPT_RT)) - return 0; - data->dev =3D dt_idle_attach_cpu(cpu, "psci"); if (IS_ERR_OR_NULL(data->dev)) return PTR_ERR_OR_ZERO(data->dev); =20 + psci_cpuidle_use_syscore =3D 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 =3D per_cpu_ptr(&psci_cpuidle_data, cpu); =20 dt_idle_detach_cpu(data->dev); + psci_cpuidle_use_syscore =3D false; psci_cpuidle_use_cpuhp =3D false; } =20 @@ -408,6 +417,7 @@ static int psci_cpuidle_probe(struct platform_device *p= dev) goto out_fail; } =20 + psci_idle_init_syscore(); psci_idle_init_cpuhp(); return 0; =20 --=20 2.34.1 From nobody Thu Dec 18 19:06:31 2025 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43E9C171660 for ; Mon, 27 May 2024 14:26:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819982; cv=none; b=Doqj3pbpgA5ouabeOTfXhvXpJ/oIb8UWncBJjI85rf4XXHlg6sWEqhayL3Vxm99PPr2xgieC67mM5wl1L6CGfyuBg2UDsa4WL3xxQHAhgLe24XENNU+b+bldEx0EouJc7WD1hITdYSREdwkILIIo0DHmtXwtdhaA6tDIv/sSbpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716819982; c=relaxed/simple; bh=sz5by33IERLM5zwiJFy9mJ1MJ8cDhLszCDyK9tAyqqs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=An7ngLZydzwCpVfpDe5dVZ8GUavfFQIkT7JKLedI5kHPXdESZxng13JPtszHAYpH4D4RlIH+GKEX3kHVOsXvUz2CXbbj4OTz+ktqDNdQibhpnf8NozqMPZ58ZxSKCx5UZRoyZy6Qa5RjIqEL3nbMWJDegr38QJmGr9nDVMCdT9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=b0mg4Z0x; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="b0mg4Z0x" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-529644ec0ebso4381240e87.3 for ; Mon, 27 May 2024 07:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716819977; x=1717424777; darn=vger.kernel.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=b0mg4Z0xdl7v29H92uBbvl0HkpfgAKp1wdAFy3MO13XRMb9IrbXEu1DIavjcc2LFoT DSSSXD5tl3gXxZhdv/jOH32h2YTG1JrfAZ3lddtLHDGnPDrk8cwXqxK+L2uB9kgfZWIz NDEr7TPFg1+fYRfpGkCasrGmLH5O1vWSibYXPzf3OP8R7m8T6OAuQUJ9QF2XeH6jV5p4 gfC71z1SUgTE2/WdPCXgA8qR8vmOKslCqrZ3f7l0b/HEQLqwy2aWmFkOBSqPlZ2FAL9N h7HYmlIwkDP3/Ed8M57vTCSf8HK6quVp3cJOxTq5ElKCjujVH7hR/X6Qhf7JOzmpvsX3 wydA== 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=GgbXXAcVtTe6zeAbVqR071Oi1An6rFY20OSURgWwPJFAuz9jj7d9CGKvY3OTB82wBv 7V8oqA2gcOP7rp5ObQPGvFQFvU6JedcevPZLeN9MoVuCdd1ZMqWe0MQ2XRTxhM1f3aog ti69/IVU7wHhnnqAblNtUU9Y9n4PI2qPso5JLFq5sFsbUEn4MGncIsCTuyzYy6hstwpU p7NQT+Eog9ZOszr65DBw5/PHWCoX/TFLOoR8+gsTlDN3v/DVKtxwSOzB2JUQ4fhJbwNd I9hH7n1E5FirkRWcwCuhbyEPxgzAYYGhLsW+r3sLZ6c/45NTqv2J54LPmzjY1UM8WlaJ WeKA== X-Forwarded-Encrypted: i=1; AJvYcCWCAco28qml6zFhRpsUpjX7GAhTpwn3zq7Au+QUIcBrsQHtdZ6NpiTT+cywmvJwl+SUrfQ5tKaNaXb+2m5BNC2sMlMzbVMmnL91mqj6 X-Gm-Message-State: AOJu0YwK/gHwZRwcWMYLXvK4fk8tX6ZzFYEm73h03ytapjwoH78d2HcQ unut5P9dLxQeP8GRfzrIQEZE0OXuMBoWNaAGWUGtaT1huNZMesTtOpAn5spO/18= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Raghavendra Kakarla # qcm6490=20 --- 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_d= river *drv, =20 psci_cpuidle_use_syscore =3D true; =20 - /* 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 =3D psci_enter_domain_idle_state; drv->states[state_count - 1].enter_s2idle =3D psci_enter_s2idle_domain_id= le_state; - psci_cpuidle_use_cpuhp =3D true; + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) { + drv->states[state_count - 1].enter =3D psci_enter_domain_idle_state; + psci_cpuidle_use_cpuhp =3D true; + } =20 return 0; } --=20 2.34.1