Linux Power Management development
 help / color / mirror / Atom feed
* Re: [PATCH v3 0/6] thermal: More separation between the core and drivers
From: Lukasz Luba @ 2024-04-04 11:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Srinivas Pandruvada, Daniel Lezcano,
	AngeloGioacchino Del Regno, Rafael J. Wysocki, Linux PM
In-Reply-To: <CAJZ5v0iSyTP4SbGBYESNy9NynMCQn8dojCFoOtQU4Q305ZKGTQ@mail.gmail.com>



On 4/2/24 20:42, Rafael J. Wysocki wrote:
> On Tue, Apr 2, 2024 at 9:04 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>
>> Hi Everyone,
>>
>> This is an update of
>>
>> https://lore.kernel.org/linux-pm/4558384.LvFx2qVVIh@kreacher/
>>
>> and
>>
>> https://lore.kernel.org/linux-pm/2331888.ElGaqSPkdT@kreacher/
>>
>> which rebases the first patch on top of 6.9-rc2, adds 3 patches and adjusts
>> the third patch from v2.
>>
>> The original description of the first two patches still applies:
>>
>>> Patch [1/2] is based on the observation that the threshold field in struct
>>> thermal_trip really should be core-internal and to make that happen it
>>> introduces a wrapper structure around struct thermal_trip for internal
>>> use in the core.
>>>
>>> Patch [2/2] moves the definition of the new structure and the struct
>>> thermal_zone_device one to a local header file in the core to enforce
>>> more separation between the core and drivers.
>>>
>>> The patches are not expected to introduce any observable differences in
>>> behavior, so please let me know if you see any of that.
>>
>> Note that these patches were first sent before the merge window and have not
>> really changed since then (except for a minor rebase of the first patch in
>> this series).  Moreover, no comments regarding the merit of these patches
>> have been made shared, so if this continues, I will be considering them as
>> good to go by the end of this week.
>>
>> Patch [3/6] is a rewrite of comments regarding trip crossing and threshold
>> computations.
>>
>> Patch [4/6] updates the trip crossing detection code to consolidate the
>> threshold initialization with trip crossing on the way up.
>>
>> Patch [5/6] ([3/3] in v2) adds a mechanism to sort notifications and debug
>> calls taking place during one invocation of __thermal_zone_device_update() so
>> they always go in temperature order.
>>
>> Patch [6/6] relocates the critical and trip point handling to avoid a
>> redundant temperature check.
>>
>> The series applies on top of 6.9-rc2 and I'm planning to create a test
>> branch containing it.
> 
> As promised:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=thermal-core-testing

Thanks Rafael for the handy branch. I'll play with it today.

Regards,
Lukasz

^ permalink raw reply

* Re: [PATCH v1 2/2] thermal: gov_step_wise: Simplify checks related to passive trips
From: Lukasz Luba @ 2024-04-04 11:26 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Daniel Lezcano, Linux PM
In-Reply-To: <2318465.ElGaqSPkdT@kreacher>



On 4/3/24 19:12, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Make it more clear from the code flow that the passive polling status
> updates only take place for passive trip points.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/thermal/gov_step_wise.c |   14 ++++++--------
>   1 file changed, 6 insertions(+), 8 deletions(-)
> 
> Index: linux-pm/drivers/thermal/gov_step_wise.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/gov_step_wise.c
> +++ linux-pm/drivers/thermal/gov_step_wise.c
> @@ -92,15 +92,13 @@ static void thermal_zone_trip_update(str
>   		if (instance->initialized && old_target == instance->target)
>   			continue;
>   
> -		if (old_target == THERMAL_NO_TARGET &&
> -		    instance->target != THERMAL_NO_TARGET) {
> -			/* Activate a passive thermal instance */
> -			if (trip->type == THERMAL_TRIP_PASSIVE)
> +		if (trip->type == THERMAL_TRIP_PASSIVE) {
> +			/* If needed, update the status of passive polling. */
> +			if (old_target == THERMAL_NO_TARGET &&
> +			    instance->target != THERMAL_NO_TARGET)
>   				tz->passive++;
> -		} else if (old_target != THERMAL_NO_TARGET &&
> -			   instance->target == THERMAL_NO_TARGET) {
> -			/* Deactivate a passive thermal instance */
> -			if (trip->type == THERMAL_TRIP_PASSIVE)
> +			else if (old_target != THERMAL_NO_TARGET &&
> +				 instance->target == THERMAL_NO_TARGET)
>   				tz->passive--;
>   		}
>   
> 
> 
> 

The patch looks good, although I got some warning while applying with
my b4 tool:
BADSIG: DKIM/rjwysocki.net

Anyway, it looks like false warning IMO.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

^ permalink raw reply

* Re: [PATCH v1 1/2] thermal: gov_step_wise: Simplify get_target_state()
From: Lukasz Luba @ 2024-04-04 11:15 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Daniel Lezcano, Linux PM
In-Reply-To: <4907519.31r3eYUQgx@kreacher>

Hi Rafael,

On 4/3/24 19:11, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The step-wise governor's get_target_state() function contains redundant
> braces, redundant parens and a redundant next_target local variable, so
> get rid of all that stuff.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/thermal/gov_step_wise.c |   27 ++++++++++-----------------
>   1 file changed, 10 insertions(+), 17 deletions(-)
> 
> Index: linux-pm/drivers/thermal/gov_step_wise.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/gov_step_wise.c
> +++ linux-pm/drivers/thermal/gov_step_wise.c
> @@ -32,7 +32,6 @@ static unsigned long get_target_state(st
>   {
>   	struct thermal_cooling_device *cdev = instance->cdev;
>   	unsigned long cur_state;
> -	unsigned long next_target;
>   
>   	/*
>   	 * We keep this instance the way it is by default.
> @@ -40,32 +39,26 @@ static unsigned long get_target_state(st
>   	 * cdev in use to determine the next_target.
>   	 */
>   	cdev->ops->get_cur_state(cdev, &cur_state);
> -	next_target = instance->target;
>   	dev_dbg(&cdev->device, "cur_state=%ld\n", cur_state);
>   
>   	if (!instance->initialized) {
> -		if (throttle) {
> -			next_target = clamp((cur_state + 1), instance->lower, instance->upper);
> -		} else {
> -			next_target = THERMAL_NO_TARGET;
> -		}
> +		if (throttle)
> +			return clamp(cur_state + 1, instance->lower, instance->upper);
>   
> -		return next_target;
> +		return THERMAL_NO_TARGET;
>   	}
>   
>   	if (throttle) {
>   		if (trend == THERMAL_TREND_RAISING)
> -			next_target = clamp((cur_state + 1), instance->lower, instance->upper);
> -	} else {
> -		if (trend == THERMAL_TREND_DROPPING) {
> -			if (cur_state <= instance->lower)
> -				next_target = THERMAL_NO_TARGET;
> -			else
> -				next_target = clamp((cur_state - 1), instance->lower, instance->upper);
> -		}
> +			return clamp(cur_state + 1, instance->lower, instance->upper);
> +	} else if (trend == THERMAL_TREND_DROPPING) {
> +		if (cur_state <= instance->lower)
> +			return THERMAL_NO_TARGET;
> +
> +		return clamp(cur_state - 1, instance->lower, instance->upper);
>   	}
>   
> -	return next_target;
> +	return instance->target;
>   }
>   
>   static void thermal_zone_trip_update(struct thermal_zone_device *tz,
> 
> 
> 

LGTM,

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz

^ permalink raw reply

* Re: [PATCH 1/2] soc: qcom: Update init level to core_initcall() for cmd-db and rpmh-rsc
From: Ulf Hansson @ 2024-04-04 11:06 UTC (permalink / raw)
  To: Maulik Shah
  Cc: Bjorn Andersson, Konrad Dybcio, Rafael J. Wysocki, Daniel Lezcano,
	linux-arm-msm, linux-kernel, linux-pm, linux-arm-kernel,
	quic_lsrao
In-Reply-To: <20240217-init_level-v1-1-bde9e11f8317@quicinc.com>

On Sat, 17 Feb 2024 at 14:57, Maulik Shah <quic_mkshah@quicinc.com> wrote:
>
> cmd-db and rpmh-rsc are used by clients like regulators, interconnects and
> clocks for resource voting. These clients are in core_initcall() while
> cmd-db and rpmh-rsc are in arch_initcall(). Update init level for these
> drivers also to core_initcall() to avoid unnecessary probe defer during
> boot up.
>
> Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>

I have picked up patch2, leaving this one for Bjorn/Konrad to manage.

Kind regards
Uffe


> ---
>  drivers/soc/qcom/cmd-db.c   | 2 +-
>  drivers/soc/qcom/rpmh-rsc.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
> index a5fd68411bed..c344107bc36c 100644
> --- a/drivers/soc/qcom/cmd-db.c
> +++ b/drivers/soc/qcom/cmd-db.c
> @@ -362,7 +362,7 @@ static int __init cmd_db_device_init(void)
>  {
>         return platform_driver_register(&cmd_db_dev_driver);
>  }
> -arch_initcall(cmd_db_device_init);
> +core_initcall(cmd_db_device_init);
>
>  MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Command DB Driver");
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index a021dc71807b..c4c7aad957e6 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -1154,7 +1154,7 @@ static int __init rpmh_driver_init(void)
>  {
>         return platform_driver_register(&rpmh_driver);
>  }
> -arch_initcall(rpmh_driver_init);
> +core_initcall(rpmh_driver_init);
>
>  MODULE_DESCRIPTION("Qualcomm Technologies, Inc. RPMh Driver");
>  MODULE_LICENSE("GPL v2");
>
> --
> 2.22.0
>

^ permalink raw reply

* Re: [PATCH 2/2] cpuidle: psci: Update init level to core_initcall()
From: Ulf Hansson @ 2024-04-04 11:06 UTC (permalink / raw)
  To: Maulik Shah
  Cc: Bjorn Andersson, Konrad Dybcio, Rafael J. Wysocki, Daniel Lezcano,
	linux-arm-msm, linux-kernel, linux-pm, linux-arm-kernel,
	quic_lsrao
In-Reply-To: <20240217-init_level-v1-2-bde9e11f8317@quicinc.com>

On Sat, 17 Feb 2024 at 14:57, Maulik Shah <quic_mkshah@quicinc.com> wrote:
>
> Clients like regulators, interconnects and clocks depend on rpmh-rsc to
> vote on resources and rpmh-rsc depends on psci power-domains to complete
> probe. All of them are in core_initcall().
>
> Change psci domain init level to core_initcall() to avoid probe defer from
> all of the above.
>
> Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>

Queued up for next via my linux-pm.git (pmdomain), thanks!

Kind regards
Uffe


> ---
>  drivers/cpuidle/cpuidle-psci-domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index b88af1262f1a..3e5b1150f75b 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -200,4 +200,4 @@ static int __init psci_idle_init_domains(void)
>  {
>         return platform_driver_register(&psci_cpuidle_domain_driver);
>  }
> -subsys_initcall(psci_idle_init_domains);
> +core_initcall(psci_idle_init_domains);
>
> --
> 2.22.0
>

^ permalink raw reply

* Re: [PATCH] cpuidle: psci: Drop superfluous wrappers psci_dt_attach|detach_cpu()
From: Ulf Hansson @ 2024-04-04 11:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, Sudeep Holla, linux-pm
  Cc: Lorenzo Pieralisi, Daniel Lezcano, Maulik Shah, linux-arm-kernel
In-Reply-To: <20240228151139.2650258-1-ulf.hansson@linaro.org>

On Wed, 28 Feb 2024 at 16:11, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> To simplify the code, let's drop psci_dt_attach|detach_cpu() and use the
> common dt_idle_attach|detach_cpu() directly instead.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Queued up for next via my linux-pm.git (pmdomain), thanks!

Kind regards
Uffe


> ---
>  drivers/cpuidle/cpuidle-psci-domain.c |  1 +
>  drivers/cpuidle/cpuidle-psci.c        |  5 +++--
>  drivers/cpuidle/cpuidle-psci.h        | 20 --------------------
>  3 files changed, 4 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index b88af1262f1a..2b47811d986f 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -20,6 +20,7 @@
>  #include <linux/string.h>
>
>  #include "cpuidle-psci.h"
> +#include "dt_idle_genpd.h"
>
>  struct psci_pd_provider {
>         struct list_head link;
> diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c
> index bf68920d038a..782030a27703 100644
> --- a/drivers/cpuidle/cpuidle-psci.c
> +++ b/drivers/cpuidle/cpuidle-psci.c
> @@ -28,6 +28,7 @@
>
>  #include "cpuidle-psci.h"
>  #include "dt_idle_states.h"
> +#include "dt_idle_genpd.h"
>
>  struct psci_cpuidle_data {
>         u32 *psci_states;
> @@ -224,7 +225,7 @@ static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv,
>         if (IS_ENABLED(CONFIG_PREEMPT_RT))
>                 return 0;
>
> -       data->dev = psci_dt_attach_cpu(cpu);
> +       data->dev = dt_idle_attach_cpu(cpu, "psci");
>         if (IS_ERR_OR_NULL(data->dev))
>                 return PTR_ERR_OR_ZERO(data->dev);
>
> @@ -311,7 +312,7 @@ static void psci_cpu_deinit_idle(int cpu)
>  {
>         struct psci_cpuidle_data *data = per_cpu_ptr(&psci_cpuidle_data, cpu);
>
> -       psci_dt_detach_cpu(data->dev);
> +       dt_idle_detach_cpu(data->dev);
>         psci_cpuidle_use_cpuhp = false;
>  }
>
> diff --git a/drivers/cpuidle/cpuidle-psci.h b/drivers/cpuidle/cpuidle-psci.h
> index 4e132640ed64..ef004ec7a7c5 100644
> --- a/drivers/cpuidle/cpuidle-psci.h
> +++ b/drivers/cpuidle/cpuidle-psci.h
> @@ -3,29 +3,9 @@
>  #ifndef __CPUIDLE_PSCI_H
>  #define __CPUIDLE_PSCI_H
>
> -struct device;
>  struct device_node;
>
>  void psci_set_domain_state(u32 state);
>  int psci_dt_parse_state_node(struct device_node *np, u32 *state);
>
> -#ifdef CONFIG_ARM_PSCI_CPUIDLE_DOMAIN
> -
> -#include "dt_idle_genpd.h"
> -
> -static inline struct device *psci_dt_attach_cpu(int cpu)
> -{
> -       return dt_idle_attach_cpu(cpu, "psci");
> -}
> -
> -static inline void psci_dt_detach_cpu(struct device *dev)
> -{
> -       dt_idle_detach_cpu(dev);
> -}
> -
> -#else
> -static inline struct device *psci_dt_attach_cpu(int cpu) { return NULL; }
> -static inline void psci_dt_detach_cpu(struct device *dev) { }
> -#endif
> -
>  #endif /* __CPUIDLE_PSCI_H */
> --
> 2.34.1
>

^ permalink raw reply

* Re: [PATCH] PM:EM: fix wrong utilization estimation in em_cpu_energy()
From: Lukasz Luba @ 2024-04-04 11:05 UTC (permalink / raw)
  To: Vincent Guittot
  Cc: rui.zhang, amit.kucheria, amit.kachhap, daniel.lezcano,
	viresh.kumar, len.brown, pavel, mhiramat, qyousef, wvw,
	xuewen.yan94, rafael, linux-kernel, linux-pm, dietmar.eggemann
In-Reply-To: <20240404104200.1672208-1-vincent.guittot@linaro.org>

Hi Vincent,

On 4/4/24 11:42, Vincent Guittot wrote:
> Commit 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
> has added back map_util_perf() in em_cpu_energy() computation which has
> been removed with the rework of scheduler/cpufreq interface.
> This is wrong because sugov_effective_cpu_perf() already takes care of
> mapping the utilization to a performance level.
> 
> Fixes: 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>   include/linux/energy_model.h | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
> index 770755df852f..70cd7258cd29 100644
> --- a/include/linux/energy_model.h
> +++ b/include/linux/energy_model.h
> @@ -245,7 +245,6 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
>   	 * max utilization to the allowed CPU capacity before calculating
>   	 * effective performance.
>   	 */
> -	max_util = map_util_perf(max_util);
>   	max_util = min(max_util, allowed_cpu_cap);
>   
>   	/*

LGTM. It was developed in parallel IIRC and that change which removes
the extra margin to the util was lost from my radar. I can see it
landed first.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Regards,
Lukasz

^ permalink raw reply

* [PATCH] MAINTAINERS: Add a git for the DT IDLE PM DOMAIN
From: Ulf Hansson @ 2024-04-04 11:00 UTC (permalink / raw)
  To: Rafael J . Wysocki, Daniel Lezcano, linux-pm
  Cc: Ulf Hansson, linux-arm-kernel, linux-kernel

Let' make it clear that we have git to manage the corresponding patches for
for the DT IDLE PM DOMAIN.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7fb5b93dfbfe..c40c580f6df2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5586,6 +5586,7 @@ CPUIDLE DRIVER - DT IDLE PM DOMAIN
 M:	Ulf Hansson <ulf.hansson@linaro.org>
 L:	linux-pm@vger.kernel.org
 S:	Supported
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
 F:	drivers/cpuidle/dt_idle_genpd.c
 F:	drivers/cpuidle/dt_idle_genpd.h
 
-- 
2.34.1


^ permalink raw reply related

* [PATCH] MAINTAINERS: Add a git for the ARM PSCI PM DOMAIN
From: Ulf Hansson @ 2024-04-04 10:59 UTC (permalink / raw)
  To: Rafael J . Wysocki, Daniel Lezcano, linux-pm
  Cc: Ulf Hansson, linux-arm-kernel, linux-kernel, Sudeep Holla

Let' make it clear that we have git to manage the corresponding patches for
the ARM PSCI PM DOMAIN.

Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c121493f43d..7fb5b93dfbfe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5578,6 +5578,7 @@ M:	Ulf Hansson <ulf.hansson@linaro.org>
 L:	linux-pm@vger.kernel.org
 L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:	Supported
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
 F:	drivers/cpuidle/cpuidle-psci-domain.c
 F:	drivers/cpuidle/cpuidle-psci.h
 
-- 
2.34.1


^ permalink raw reply related

* Re: [PATCH v2] pmdomain: mediatek: Add MT8188 buck isolation setting
From: Ulf Hansson @ 2024-04-04 10:46 UTC (permalink / raw)
  To: Fei Shao
  Cc: Johnson Wang, AngeloGioacchino Del Regno, Matthias Brugger,
	linux-arm-kernel, linux-kernel, linux-mediatek, linux-pm
In-Reply-To: <20240329044142.3095193-1-fshao@chromium.org>

On Fri, 29 Mar 2024 at 05:43, Fei Shao <fshao@chromium.org> wrote:
>
> From: Johnson Wang <johnson.wang@mediatek.com>
>
> From: Johnson Wang <johnson.wang@mediatek.com>
>
> Add buck isolation setting to ADSP_AO, CAM_VCORE and IMG_VCORE power
> domains in MT8188 for proper buck isolation control in power domain
> on/off.
>
> Signed-off-by: Johnson Wang <johnson.wang@mediatek.com>
> Signed-off-by: Fei Shao <fshao@chromium.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>
> Changes in v2:
> [1] was reviewed but didn't get accepted at the time.
> This rebases [1] on next-20240327 with revised commit message.
>
> [1]: https://lore.kernel.org/all/20230315114505.25144-1-johnson.wang@mediatek.com/
>
>  drivers/pmdomain/mediatek/mt8188-pm-domains.h | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pmdomain/mediatek/mt8188-pm-domains.h b/drivers/pmdomain/mediatek/mt8188-pm-domains.h
> index 06834ab6597c..007235be9efe 100644
> --- a/drivers/pmdomain/mediatek/mt8188-pm-domains.h
> +++ b/drivers/pmdomain/mediatek/mt8188-pm-domains.h
> @@ -175,6 +175,8 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
>                 .ctl_offs = 0x35C,
>                 .pwr_sta_offs = 0x16C,
>                 .pwr_sta2nd_offs = 0x170,
> +               .ext_buck_iso_offs = 0x3EC,
> +               .ext_buck_iso_mask = BIT(10),
>                 .bp_cfg = {
>                         BUS_PROT_WR(INFRA,
>                                     MT8188_TOP_AXI_PROT_EN_2_ADSP_AO_STEP1,
> @@ -187,7 +189,7 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
>                                     MT8188_TOP_AXI_PROT_EN_2_CLR,
>                                     MT8188_TOP_AXI_PROT_EN_2_STA),
>                 },
> -               .caps = MTK_SCPD_ALWAYS_ON,
> +               .caps = MTK_SCPD_ALWAYS_ON | MTK_SCPD_EXT_BUCK_ISO,
>         },
>         [MT8188_POWER_DOMAIN_ADSP_INFRA] = {
>                 .name = "adsp_infra",
> @@ -524,6 +526,8 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
>                 .ctl_offs = 0x3A4,
>                 .pwr_sta_offs = 0x16C,
>                 .pwr_sta2nd_offs = 0x170,
> +               .ext_buck_iso_offs = 0x3EC,
> +               .ext_buck_iso_mask = BIT(12),
>                 .bp_cfg = {
>                         BUS_PROT_WR(INFRA,
>                                     MT8188_TOP_AXI_PROT_EN_MM_IMG_VCORE_STEP1,
> @@ -541,7 +545,8 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
>                                     MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
>                                     MT8188_TOP_AXI_PROT_EN_MM_2_STA),
>                 },
> -               .caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
> +               .caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY |
> +                       MTK_SCPD_EXT_BUCK_ISO,
>         },
>         [MT8188_POWER_DOMAIN_IMG_MAIN] = {
>                 .name = "img_main",
> @@ -591,6 +596,8 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
>                 .ctl_offs = 0x3A0,
>                 .pwr_sta_offs = 0x16C,
>                 .pwr_sta2nd_offs = 0x170,
> +               .ext_buck_iso_offs = 0x3EC,
> +               .ext_buck_iso_mask = BIT(11),
>                 .bp_cfg = {
>                         BUS_PROT_WR(INFRA,
>                                     MT8188_TOP_AXI_PROT_EN_MM_CAM_VCORE_STEP1,
> @@ -618,7 +625,8 @@ static const struct scpsys_domain_data scpsys_domain_data_mt8188[] = {
>                                     MT8188_TOP_AXI_PROT_EN_MM_2_CLR,
>                                     MT8188_TOP_AXI_PROT_EN_MM_2_STA),
>                 },
> -               .caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY,
> +               .caps = MTK_SCPD_KEEP_DEFAULT_OFF | MTK_SCPD_DOMAIN_SUPPLY |
> +                       MTK_SCPD_EXT_BUCK_ISO,
>         },
>         [MT8188_POWER_DOMAIN_CAM_MAIN] = {
>                 .name = "cam_main",
> --
> 2.44.0.478.gd926399ef9-goog
>

^ permalink raw reply

* Re: [PATCH] pmdomain: mediatek: scpsys: drop driver owner assignment
From: Ulf Hansson @ 2024-04-04 10:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-pm,
	linux-kernel, linux-arm-kernel, linux-mediatek
In-Reply-To: <20240330211036.100956-1-krzysztof.kozlowski@linaro.org>

On Sat, 30 Mar 2024 at 22:10, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> Core in platform_driver_register() already sets the .owner, so driver
> does not need to.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/pmdomain/mediatek/mtk-scpsys.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pmdomain/mediatek/mtk-scpsys.c b/drivers/pmdomain/mediatek/mtk-scpsys.c
> index 59a7a8c261ed..1a80c1537a43 100644
> --- a/drivers/pmdomain/mediatek/mtk-scpsys.c
> +++ b/drivers/pmdomain/mediatek/mtk-scpsys.c
> @@ -1138,7 +1138,6 @@ static struct platform_driver scpsys_drv = {
>         .driver = {
>                 .name = "mtk-scpsys",
>                 .suppress_bind_attrs = true,
> -               .owner = THIS_MODULE,
>                 .of_match_table = of_scpsys_match_tbl,
>         },
>  };
> --
> 2.34.1
>

^ permalink raw reply

* [PATCH] PM:EM: fix wrong utilization estimation in em_cpu_energy()
From: Vincent Guittot @ 2024-04-04 10:42 UTC (permalink / raw)
  To: lukasz.luba, rafael, linux-kernel, linux-pm, dietmar.eggemann
  Cc: rui.zhang, amit.kucheria, amit.kachhap, daniel.lezcano,
	viresh.kumar, len.brown, pavel, mhiramat, qyousef, wvw,
	xuewen.yan94, Vincent Guittot

Commit 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
has added back map_util_perf() in em_cpu_energy() computation which has
been removed with the rework of scheduler/cpufreq interface.
This is wrong because sugov_effective_cpu_perf() already takes care of
mapping the utilization to a performance level.

Fixes: 1b600da51073 ("PM: EM: Optimize em_cpu_energy() and remove division")
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---
 include/linux/energy_model.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index 770755df852f..70cd7258cd29 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -245,7 +245,6 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd,
 	 * max utilization to the allowed CPU capacity before calculating
 	 * effective performance.
 	 */
-	max_util = map_util_perf(max_util);
 	max_util = min(max_util, allowed_cpu_cap);
 
 	/*
-- 
2.34.1


^ permalink raw reply related

* Re: [PATCH v2 2/3] dt-bindings: power: Add mediatek larb definition
From: Ulf Hansson @ 2024-04-04 10:02 UTC (permalink / raw)
  To: Yu-chang Lee (李禹璋)
  Cc: amergnat@baylibre.com, krzysztof.kozlowski@linaro.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	MandyJH Liu (劉人僖), conor+dt@kernel.org,
	Project_Global_Chrome_Upstream_Group, robh@kernel.org,
	Xiufeng Li (李秀峰),
	linux-arm-kernel@lists.infradead.org,
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	Fan Chen (陳凡),
	angelogioacchino.delregno@collabora.com
In-Reply-To: <3b04c5344435cdb941b5d132e8f5fbfdf9188d67.camel@mediatek.com>

On Thu, 28 Mar 2024 at 07:06, Yu-chang Lee (李禹璋)
<Yu-chang.Lee@mediatek.com> wrote:
>
> On Wed, 2024-03-27 at 12:55 +0100, Alexandre Mergnat wrote:
> >
> > External email : Please do not click links or open attachments until
> > you have verified the sender or the content.
> >  Hello Yu-chang Lee,
> >
> > SMI LARB must have a power domain, according to "mediatek,smi-
> > larb.yaml"
> > Now you try to create a link from power domain to larb.
> >
> > Here is my understanding: when you enable/disable power domain, the
> > larb linked to this power domain may have an issue. Then you want to
> > retrieve de LARB linked to the power domain though the dts to manage
> > the LARB.
>
> Yes, this is what I am trying to do.
>
> > IMHO, using the dts to have this information into the power
> > driver isn't necessary and may introduce some bugs if the LARB node
> > and power node in the DTS aren't aligned.
> >
> > It seems not implemented today but during the LARB probe, it should
> > "subscribe" to the linked power domain. Then, when the power domain
> > status is changing, it is able to "notify" (callback) the LARB, then
> > implement the good stuff to handle this power domain status change
> > into LARB driver.
> >
>
> The problem with this method and why "smi clamp" is in power domain
> driver is that our HW designer gave us a programming guide strictly
> states the sequence of what we need to do to power on/off power domain.
> Using callback, this sequence is no longer guaranteed and the side
> effect is unknown...

In most cases, using the runtime PM callbacks in the consumer driver
(LARB driver) is sufficient to deal with resets. For some special
cases drivers are making use of the genpd on/off notifiers
(GENPD_NOTIFY_*), as they really need to know when their devices have
been power collapsed. Have you tried both these options?

[...]

Kind regards
Uffe

^ permalink raw reply

* Re: [PATCH v3 6/6] thermal: core: Relocate critical and hot trip handling
From: Rafael J. Wysocki @ 2024-04-04  9:03 UTC (permalink / raw)
  To: Linux PM
  Cc: LKML, Srinivas Pandruvada, Daniel Lezcano, Lukasz Luba,
	AngeloGioacchino Del Regno, Rafael J. Wysocki
In-Reply-To: <3556878.iIbC2pHGDl@kreacher>

On Tue, Apr 2, 2024 at 9:04 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Modify handle_thermal_trip() to call handle_critical_trips() only after
> finding that the trip temperature has been crossed on the way up and
> remove the redundant temperature check from the latter.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

This change is premature, as it will cause handle_non_critical_trips()
to be called for hot/critical trips which is questionable, so I'm
withdrawing it for now.

The rest of the series is still applicable, though.


> ---
>  drivers/thermal/thermal_core.c |   15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -349,10 +349,6 @@ void thermal_zone_device_critical_reboot
>  static void handle_critical_trips(struct thermal_zone_device *tz,
>                                   const struct thermal_trip *trip)
>  {
> -       /* If we have not crossed the trip_temp, we do not care. */
> -       if (trip->temperature <= 0 || tz->temperature < trip->temperature)
> -               return;
> -
>         trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, trip), trip->type);
>
>         if (trip->type == THERMAL_TRIP_CRITICAL)
> @@ -404,12 +400,15 @@ static void handle_thermal_trip(struct t
>                 list_add_tail(&td->notify_list_node, way_up_list);
>                 td->notify_temp = trip->temperature;
>                 td->threshold -= trip->hysteresis;
> +
> +               if (trip->type == THERMAL_TRIP_CRITICAL ||
> +                   trip->type == THERMAL_TRIP_HOT) {
> +                       handle_critical_trips(tz, trip);
> +                       return;
> +               }
>         }
>
> -       if (trip->type == THERMAL_TRIP_CRITICAL || trip->type == THERMAL_TRIP_HOT)
> -               handle_critical_trips(tz, trip);
> -       else
> -               handle_non_critical_trips(tz, trip);
> +       handle_non_critical_trips(tz, trip);
>  }
>
>  static void update_temperature(struct thermal_zone_device *tz)
>
>
>
>

^ permalink raw reply

* Re: [PATCH v7 1/5] dt-bindings: interconnect: Add Qualcomm IPQ9574 support
From: Varadarajan Narayanan @ 2024-04-04  8:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: andersson, konrad.dybcio, mturquette, sboyd, robh, krzk+dt,
	conor+dt, djakov, dmitry.baryshkov, quic_anusha, linux-arm-msm,
	linux-clk, devicetree, linux-kernel, linux-pm
In-Reply-To: <58c9b754-b9a7-444d-9545-9e6648010630@kernel.org>

On Wed, Apr 03, 2024 at 04:59:40PM +0200, Krzysztof Kozlowski wrote:
> On 03/04/2024 12:42, Varadarajan Narayanan wrote:
> > Add interconnect-cells to clock provider so that it can be
> > used as icc provider.
> >
> > Add master/slave ids for Qualcomm IPQ9574 Network-On-Chip
> > interfaces. This will be used by the gcc-ipq9574 driver
> > that will for providing interconnect services using the
> > icc-clk framework.
> >
> > Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
> > ---
> > v7:
> > Fix macro names to be consistent with other bindings
> > v6:
> > Removed Reviewed-by: Krzysztof Kozlowski
> > Redefine the bindings such that driver and DT can share them
> >
> > v3:
> > Squash Documentation/ and include/ changes into same patch
> >
> > qcom,ipq9574.h
> > 	Move 'first id' to clock driver
> >
> > ---
> >  .../bindings/clock/qcom,ipq9574-gcc.yaml      |  3 +
> >  .../dt-bindings/interconnect/qcom,ipq9574.h   | 87 +++++++++++++++++++
> >  2 files changed, 90 insertions(+)
> >  create mode 100644 include/dt-bindings/interconnect/qcom,ipq9574.h
> >
> > diff --git a/Documentation/devicetree/bindings/clock/qcom,ipq9574-gcc.yaml b/Documentation/devicetree/bindings/clock/qcom,ipq9574-gcc.yaml
> > index 944a0ea79cd6..824781cbdf34 100644
> > --- a/Documentation/devicetree/bindings/clock/qcom,ipq9574-gcc.yaml
> > +++ b/Documentation/devicetree/bindings/clock/qcom,ipq9574-gcc.yaml
> > @@ -33,6 +33,9 @@ properties:
> >        - description: PCIE30 PHY3 pipe clock source
> >        - description: USB3 PHY pipe clock source
> >
> > +  '#interconnect-cells':
> > +    const: 1
> > +
> >  required:
> >    - compatible
> >    - clocks
> > diff --git a/include/dt-bindings/interconnect/qcom,ipq9574.h b/include/dt-bindings/interconnect/qcom,ipq9574.h
> > new file mode 100644
> > index 000000000000..0b076b0cf880
> > --- /dev/null
> > +++ b/include/dt-bindings/interconnect/qcom,ipq9574.h
> > @@ -0,0 +1,87 @@
> > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> > +#ifndef INTERCONNECT_QCOM_IPQ9574_H
> > +#define INTERCONNECT_QCOM_IPQ9574_H
> > +
> > +#define ICC_ANOC_PCIE0		0
> > +#define ICC_SNOC_PCIE0		1
> > +#define ICC_ANOC_PCIE1		2
> > +#define ICC_SNOC_PCIE1		3
> > +#define ICC_ANOC_PCIE2		4
> > +#define ICC_SNOC_PCIE2		5
> > +#define ICC_ANOC_PCIE3		6
> > +#define ICC_SNOC_PCIE3		7
> > +#define ICC_SNOC_USB		8
> > +#define ICC_ANOC_USB_AXI	9
> > +#define ICC_NSSNOC_NSSCC	10
> > +#define ICC_NSSNOC_SNOC_0	11
> > +#define ICC_NSSNOC_SNOC_1	12
> > +#define ICC_NSSNOC_PCNOC_1	13
> > +#define ICC_NSSNOC_QOSGEN_REF	14
> > +#define ICC_NSSNOC_TIMEOUT_REF	15
> > +#define ICC_NSSNOC_XO_DCD	16
> > +#define ICC_NSSNOC_ATB		17
> > +#define ICC_MEM_NOC_NSSNOC	18
> > +#define ICC_NSSNOC_MEMNOC	19
> > +#define ICC_NSSNOC_MEM_NOC_1	20
> > +
> > +#define ICC_NSSNOC_PPE		0
> > +#define ICC_NSSNOC_PPE_CFG	1
> > +#define ICC_NSSNOC_NSS_CSR	2
> > +#define ICC_NSSNOC_IMEM_QSB	3
> > +#define ICC_NSSNOC_IMEM_AHB	4
> > +
> > +#define MASTER_ANOC_PCIE0		(ICC_ANOC_PCIE0 * 2)
> > +#define SLAVE_ANOC_PCIE0		((ICC_ANOC_PCIE0 * 2) + 1)
>
> Which existing Qualcomm platform has such code?

Existing Qualcomm platforms don't use icc-clk. They use icc-rpm
or icc-rpmh. clk-cbf-msm8996.c is the only driver that uses icc-clk.

The icc_clk_register automatically creates master & slave nodes
for each clk entry provided as input with the node-ids 'n' and
'n+1'. Since clk-cbf-msm8996.c has only one entry, it could just
define MASTER_CBF_M4M and SLAVE_CBF_M4M with 0 and 1 and avoid these
calculations.

However, ipq9574 gives an array of clock entries as input to
icc_clk_register. To tie the order/sequence of these clock
entries correctly with the node-ids, this calculation is needed.

> This is the third time I am asking for consistent headers. Open
> existing, recently added headers and look how it is done there. Why?
> Because I am against such calculations and see no reason for them.

Apologies. Regret that I have to trouble you.

In this ipq9574 case, have to reconcile between the following
feedbacks.

1. https://lore.kernel.org/linux-arm-msm/fe40b307-26d0-4b2a-869b-5d093415b9d1@linaro.org/
   We could probably use indexed identifiers here to avoid confusion:
   [ICC_BINDING_NAME] = CLK_BINDING_NAME

2. https://lore.kernel.org/linux-arm-msm/95f4e99a60cc97770fc3cee850b62faf.sboyd@kernel.org/
   Are these supposed to be in a dt-binding header?

3. https://lore.kernel.org/linux-arm-msm/031d0a35-b192-4161-beef-97b89d5d1da6@linaro.org/
   Do you use them as well in the DTS?

Having the defines (with the calculations) seemed to to comply
with the above three feedbacks.

Please let me know if this can be handled in a different way that
would be consistent with other Qualcomm platforms.

Thanks
Varada

^ permalink raw reply

* Re: [PATCH v4 0/8] cpufreq: sun50i: Add Allwinner H616 support
From: Ryan Walklin @ 2024-04-04  7:44 UTC (permalink / raw)
  To: Viresh Kumar, Andre Przywara
  Cc: Yangtao Li, Viresh Kumar, Nishanth Menon, Stephen Boyd,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Rafael J . Wysocki, linux-pm,
	devicetree, linux-sunxi, linux-arm-kernel, Brandon Cheo Fusi,
	Martin Botka, Martin Botka, Chris Morgan, Mark Rutland,
	Lorenzo Pieralisi, Sudeep Holla
In-Reply-To: <20240404064027.shjqvqih7s5rnv2i@vireshk-i7>

On Thu, 4 Apr 2024, at 7:40 PM, Viresh Kumar wrote:
> Is it okay to merge all the changes via the cpufreq tree ?

I have tested this series with an H700-based board, and have at least one speed-bin (1.032GHz) is not supported although the governor attempts to enable it based on the opp-supported-hw bitmask, and I am unable to reach the 1.5GHz bin at 1.16v (or higher) despite it working on the vendor BSP (kernel panic at boot if enabled), so this may need some slight rework.

I have reached out to Andre on IRC to debug.

Ryan

^ permalink raw reply

* Re: [PATCH v4 0/8] cpufreq: sun50i: Add Allwinner H616 support
From: Viresh Kumar @ 2024-04-04  6:40 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Yangtao Li, Viresh Kumar, Nishanth Menon, Stephen Boyd,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Rafael J . Wysocki, linux-pm,
	devicetree, linux-sunxi, linux-arm-kernel, Brandon Cheo Fusi,
	Martin Botka, Martin Botka, Chris Morgan, Ryan Walklin,
	Mark Rutland, Lorenzo Pieralisi, Sudeep Holla
In-Reply-To: <20240329141311.27158-1-andre.przywara@arm.com>

On 29-03-24, 14:13, Andre Przywara wrote:
> This series adds cpufreq support to the Allwinner H616 SoC.
> v4 allows compilation outside of arm/arm64, by making the SMCCC call
> optional, the rest of the changes are added tags and cosmetic fixes.
> This is based on Martin's original series from about half a year ago[1].
> Thanks for the comments on the list!
> See below for a changelog.

Is it okay to merge all the changes via the cpufreq tree ?

-- 
viresh

^ permalink raw reply

* pm/testing build: 7 builds: 0 failed, 7 passed, 33 warnings (v6.9-rc2-35-g731369c312d5e)
From: kernelci.org bot @ 2024-04-04  6:11 UTC (permalink / raw)
  To: rafael, linux-pm, kernel-build-reports, kernelci-results

pm/testing build: 7 builds: 0 failed, 7 passed, 33 warnings (v6.9-rc2-35-g731369c312d5e)

Full Build Summary: https://kernelci.org/build/pm/branch/testing/kernel/v6.9-rc2-35-g731369c312d5e/

Tree: pm
Branch: testing
Git Describe: v6.9-rc2-35-g731369c312d5e
Git Commit: 731369c312d5e5b9da28ed5bd0e13664563a0de1
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
Built: 7 unique architectures

Warnings Detected:

arc:
    haps_hs_smp_defconfig (gcc-10): 4 warnings

arm:

i386:

mips:
    32r2el_defconfig (gcc-10): 3 warnings

riscv:

sparc:
    sparc64_defconfig (gcc-10): 26 warnings

x86_64:


Warnings summary:

    2    WARNING: modpost: EXPORT symbol "_mcount" [vmlinux] version generation failed, symbol will not be versioned.
    2    <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
    1    arch/sparc/vdso/vma.c:246:12: warning: no previous prototype for ‘init_vdso_image’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vdso32/../vclock_gettime.c:343:1: warning: no previous prototype for ‘__vdso_gettimeofday_stick’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vdso32/../vclock_gettime.c:307:1: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vdso32/../vclock_gettime.c:282:1: warning: no previous prototype for ‘__vdso_clock_gettime_stick’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vdso32/../vclock_gettime.c:254:1: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vclock_gettime.c:343:1: warning: no previous prototype for ‘__vdso_gettimeofday_stick’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vclock_gettime.c:307:1: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vclock_gettime.c:282:1: warning: no previous prototype for ‘__vdso_clock_gettime_stick’ [-Wmissing-prototypes]
    1    arch/sparc/vdso/vclock_gettime.c:254:1: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
    1    arch/sparc/prom/p1275.c:52:6: warning: no previous prototype for ‘prom_cif_init’ [-Wmissing-prototypes]
    1    arch/sparc/prom/misc_64.c:165:5: warning: no previous prototype for ‘prom_get_mmu_ihandle’ [-Wmissing-prototypes]
    1    arch/sparc/mm/init_64.c:2644:6: warning: no previous prototype for ‘vmemmap_free’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/uprobes.c:237:17: warning: no previous prototype for ‘uprobe_trap’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/traps_64.c:253:6: warning: no previous prototype for ‘is_no_fault_exception’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/traps_64.c:2153:6: warning: no previous prototype for ‘sun4v_nonresum_error_user_handled’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/traps_64.c:2035:6: warning: no previous prototype for ‘do_mcd_err’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/time_64.c:880:20: warning: no previous prototype for ‘sched_clock’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/setup_64.c:602:13: warning: no previous prototype for ‘alloc_irqstack_bootmem’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/pci_sun4v.c:259:15: warning: no previous prototype for ‘dma_4v_iotsb_bind’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/adi_64.c:299:6: warning: no previous prototype for ‘del_tag_store’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/adi_64.c:156:21: warning: no previous prototype for ‘alloc_tag_store’ [-Wmissing-prototypes]
    1    arch/sparc/kernel/adi_64.c:124:21: warning: no previous prototype for ‘find_tag_store’ [-Wmissing-prototypes]
    1    arch/mips/boot/dts/img/boston.dts:136.23-177.6: Warning (interrupt_provider): /pci@14000000/pci2_root@0,0/eg20t_bridge@1,0,0: '#interrupt-cells' found, but node is not an interrupt provider
    1    arch/mips/boot/dts/img/boston.dts:128.17-178.5: Warning (interrupt_provider): /pci@14000000/pci2_root@0,0: '#interrupt-cells' found, but node is not an interrupt provider
    1    arch/mips/boot/dts/img/boston.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'
    1    arch/arc/kernel/ptrace.c:342:16: warning: no previous prototype for 'syscall_trace_enter' [-Wmissing-prototypes]
    1    arch/arc/kernel/kprobes.c:193:15: warning: no previous prototype for 'arc_kprobe_handler' [-Wmissing-prototypes]
    1    arch/arc/boot/dts/haps_hs_idu.dts:68.16-72.5: Warning (interrupt_provider): /fpga/pct: '#interrupt-cells' found, but node is not an interrupt provider
    1    arch/arc/boot/dts/haps_hs_idu.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'

================================================================================

Detailed per-defconfig build reports:

--------------------------------------------------------------------------------
32r2el_defconfig (mips, gcc-10) — PASS, 0 errors, 3 warnings, 0 section mismatches

Warnings:
    arch/mips/boot/dts/img/boston.dts:128.17-178.5: Warning (interrupt_provider): /pci@14000000/pci2_root@0,0: '#interrupt-cells' found, but node is not an interrupt provider
    arch/mips/boot/dts/img/boston.dts:136.23-177.6: Warning (interrupt_provider): /pci@14000000/pci2_root@0,0/eg20t_bridge@1,0,0: '#interrupt-cells' found, but node is not an interrupt provider
    arch/mips/boot/dts/img/boston.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'

--------------------------------------------------------------------------------
defconfig (riscv, gcc-10) — PASS, 0 errors, 0 warnings, 0 section mismatches

--------------------------------------------------------------------------------
haps_hs_smp_defconfig (arc, gcc-10) — PASS, 0 errors, 4 warnings, 0 section mismatches

Warnings:
    arch/arc/boot/dts/haps_hs_idu.dts:68.16-72.5: Warning (interrupt_provider): /fpga/pct: '#interrupt-cells' found, but node is not an interrupt provider
    arch/arc/boot/dts/haps_hs_idu.dtb: Warning (interrupt_map): Failed prerequisite 'interrupt_provider'
    arch/arc/kernel/ptrace.c:342:16: warning: no previous prototype for 'syscall_trace_enter' [-Wmissing-prototypes]
    arch/arc/kernel/kprobes.c:193:15: warning: no previous prototype for 'arc_kprobe_handler' [-Wmissing-prototypes]

--------------------------------------------------------------------------------
i386_defconfig (i386, gcc-10) — PASS, 0 errors, 0 warnings, 0 section mismatches

--------------------------------------------------------------------------------
multi_v7_defconfig (arm, gcc-10) — PASS, 0 errors, 0 warnings, 0 section mismatches

--------------------------------------------------------------------------------
sparc64_defconfig (sparc, gcc-10) — PASS, 0 errors, 26 warnings, 0 section mismatches

Warnings:
    <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
    arch/sparc/kernel/traps_64.c:253:6: warning: no previous prototype for ‘is_no_fault_exception’ [-Wmissing-prototypes]
    arch/sparc/kernel/traps_64.c:2035:6: warning: no previous prototype for ‘do_mcd_err’ [-Wmissing-prototypes]
    arch/sparc/kernel/traps_64.c:2153:6: warning: no previous prototype for ‘sun4v_nonresum_error_user_handled’ [-Wmissing-prototypes]
    arch/sparc/kernel/setup_64.c:602:13: warning: no previous prototype for ‘alloc_irqstack_bootmem’ [-Wmissing-prototypes]
    arch/sparc/kernel/time_64.c:880:20: warning: no previous prototype for ‘sched_clock’ [-Wmissing-prototypes]
    arch/sparc/kernel/adi_64.c:124:21: warning: no previous prototype for ‘find_tag_store’ [-Wmissing-prototypes]
    arch/sparc/kernel/adi_64.c:156:21: warning: no previous prototype for ‘alloc_tag_store’ [-Wmissing-prototypes]
    arch/sparc/kernel/adi_64.c:299:6: warning: no previous prototype for ‘del_tag_store’ [-Wmissing-prototypes]
    arch/sparc/kernel/pci_sun4v.c:259:15: warning: no previous prototype for ‘dma_4v_iotsb_bind’ [-Wmissing-prototypes]
    arch/sparc/kernel/uprobes.c:237:17: warning: no previous prototype for ‘uprobe_trap’ [-Wmissing-prototypes]
    arch/sparc/mm/init_64.c:2644:6: warning: no previous prototype for ‘vmemmap_free’ [-Wmissing-prototypes]
    arch/sparc/vdso/vma.c:246:12: warning: no previous prototype for ‘init_vdso_image’ [-Wmissing-prototypes]
    arch/sparc/vdso/vclock_gettime.c:254:1: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
    arch/sparc/vdso/vclock_gettime.c:282:1: warning: no previous prototype for ‘__vdso_clock_gettime_stick’ [-Wmissing-prototypes]
    arch/sparc/vdso/vclock_gettime.c:307:1: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
    arch/sparc/vdso/vclock_gettime.c:343:1: warning: no previous prototype for ‘__vdso_gettimeofday_stick’ [-Wmissing-prototypes]
    arch/sparc/vdso/vdso32/../vclock_gettime.c:254:1: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
    arch/sparc/vdso/vdso32/../vclock_gettime.c:282:1: warning: no previous prototype for ‘__vdso_clock_gettime_stick’ [-Wmissing-prototypes]
    arch/sparc/vdso/vdso32/../vclock_gettime.c:307:1: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
    arch/sparc/vdso/vdso32/../vclock_gettime.c:343:1: warning: no previous prototype for ‘__vdso_gettimeofday_stick’ [-Wmissing-prototypes]
    arch/sparc/prom/misc_64.c:165:5: warning: no previous prototype for ‘prom_get_mmu_ihandle’ [-Wmissing-prototypes]
    arch/sparc/prom/p1275.c:52:6: warning: no previous prototype for ‘prom_cif_init’ [-Wmissing-prototypes]
    WARNING: modpost: EXPORT symbol "_mcount" [vmlinux] version generation failed, symbol will not be versioned.
    <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
    WARNING: modpost: EXPORT symbol "_mcount" [vmlinux] version generation failed, symbol will not be versioned.

--------------------------------------------------------------------------------
x86_64_defconfig (x86_64, gcc-10) — PASS, 0 errors, 0 warnings, 0 section mismatches

---
For more info write to <info@kernelci.org>

^ permalink raw reply

* [rafael-pm:bleeding-edge] BUILD SUCCESS ec7c9cb7f43d11580085bd9d98189295f54b6638
From: kernel test robot @ 2024-04-04  3:57 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, devel, linux-pm

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git bleeding-edge
branch HEAD: ec7c9cb7f43d11580085bd9d98189295f54b6638  Merge branch 'pm-sleep' into bleeding-edge

elapsed time: 732m

configs tested: 180
configs skipped: 3

The following configs have been built successfully.
More configs may be tested in the coming days.

tested configs:
alpha                             allnoconfig   gcc  
alpha                            allyesconfig   gcc  
alpha                               defconfig   gcc  
arc                              allmodconfig   gcc  
arc                               allnoconfig   gcc  
arc                              allyesconfig   gcc  
arc                                 defconfig   gcc  
arc                   randconfig-001-20240404   gcc  
arc                   randconfig-002-20240404   gcc  
arm                              alldefconfig   gcc  
arm                              allmodconfig   gcc  
arm                               allnoconfig   clang
arm                              allyesconfig   gcc  
arm                                 defconfig   clang
arm                        mvebu_v5_defconfig   gcc  
arm                          pxa3xx_defconfig   clang
arm                   randconfig-001-20240404   gcc  
arm                   randconfig-002-20240404   gcc  
arm                   randconfig-003-20240404   clang
arm                   randconfig-004-20240404   clang
arm                         s3c6400_defconfig   gcc  
arm                         wpcm450_defconfig   gcc  
arm64                            allmodconfig   clang
arm64                             allnoconfig   gcc  
arm64                               defconfig   gcc  
arm64                 randconfig-001-20240404   gcc  
arm64                 randconfig-002-20240404   gcc  
arm64                 randconfig-003-20240404   clang
arm64                 randconfig-004-20240404   gcc  
csky                             allmodconfig   gcc  
csky                              allnoconfig   gcc  
csky                             allyesconfig   gcc  
csky                                defconfig   gcc  
csky                  randconfig-001-20240404   gcc  
csky                  randconfig-002-20240404   gcc  
hexagon                          allmodconfig   clang
hexagon                           allnoconfig   clang
hexagon                          allyesconfig   clang
hexagon                             defconfig   clang
hexagon               randconfig-001-20240404   clang
hexagon               randconfig-002-20240404   clang
i386                             allmodconfig   gcc  
i386                              allnoconfig   gcc  
i386                             allyesconfig   gcc  
i386         buildonly-randconfig-001-20240404   gcc  
i386         buildonly-randconfig-002-20240404   clang
i386         buildonly-randconfig-003-20240404   clang
i386         buildonly-randconfig-004-20240404   gcc  
i386         buildonly-randconfig-005-20240404   clang
i386         buildonly-randconfig-006-20240404   gcc  
i386                                defconfig   clang
i386                  randconfig-001-20240404   gcc  
i386                  randconfig-002-20240404   clang
i386                  randconfig-003-20240404   clang
i386                  randconfig-004-20240404   gcc  
i386                  randconfig-005-20240404   clang
i386                  randconfig-006-20240404   clang
i386                  randconfig-011-20240404   gcc  
i386                  randconfig-012-20240404   clang
i386                  randconfig-013-20240404   gcc  
i386                  randconfig-014-20240404   clang
i386                  randconfig-015-20240404   gcc  
i386                  randconfig-016-20240404   gcc  
loongarch                        allmodconfig   gcc  
loongarch                         allnoconfig   gcc  
loongarch                           defconfig   gcc  
loongarch             randconfig-001-20240404   gcc  
loongarch             randconfig-002-20240404   gcc  
m68k                             allmodconfig   gcc  
m68k                              allnoconfig   gcc  
m68k                             allyesconfig   gcc  
m68k                                defconfig   gcc  
m68k                        m5407c3_defconfig   gcc  
microblaze                       allmodconfig   gcc  
microblaze                        allnoconfig   gcc  
microblaze                       allyesconfig   gcc  
microblaze                          defconfig   gcc  
mips                              allnoconfig   gcc  
mips                             allyesconfig   gcc  
mips                        bcm63xx_defconfig   clang
mips                     cu1000-neo_defconfig   gcc  
mips                     loongson1b_defconfig   clang
nios2                            allmodconfig   gcc  
nios2                             allnoconfig   gcc  
nios2                            allyesconfig   gcc  
nios2                               defconfig   gcc  
nios2                 randconfig-001-20240404   gcc  
nios2                 randconfig-002-20240404   gcc  
openrisc                          allnoconfig   gcc  
openrisc                         allyesconfig   gcc  
openrisc                            defconfig   gcc  
parisc                           allmodconfig   gcc  
parisc                            allnoconfig   gcc  
parisc                           allyesconfig   gcc  
parisc                              defconfig   gcc  
parisc                randconfig-001-20240404   gcc  
parisc                randconfig-002-20240404   gcc  
parisc64                            defconfig   gcc  
powerpc                          allmodconfig   gcc  
powerpc                           allnoconfig   gcc  
powerpc                          allyesconfig   clang
powerpc                        cell_defconfig   gcc  
powerpc                     powernv_defconfig   gcc  
powerpc               randconfig-001-20240404   gcc  
powerpc               randconfig-002-20240404   gcc  
powerpc               randconfig-003-20240404   clang
powerpc                     skiroot_defconfig   clang
powerpc64             randconfig-001-20240404   gcc  
powerpc64             randconfig-002-20240404   clang
powerpc64             randconfig-003-20240404   clang
riscv                            allmodconfig   clang
riscv                             allnoconfig   gcc  
riscv                            allyesconfig   clang
riscv                               defconfig   clang
riscv                    nommu_virt_defconfig   clang
riscv                 randconfig-001-20240404   clang
riscv                 randconfig-002-20240404   clang
s390                             allmodconfig   clang
s390                              allnoconfig   clang
s390                             allyesconfig   gcc  
s390                                defconfig   clang
s390                  randconfig-001-20240404   gcc  
s390                  randconfig-002-20240404   gcc  
sh                               allmodconfig   gcc  
sh                                allnoconfig   gcc  
sh                               allyesconfig   gcc  
sh                                  defconfig   gcc  
sh                    randconfig-001-20240404   gcc  
sh                    randconfig-002-20240404   gcc  
sh                          sdk7786_defconfig   gcc  
sh                           se7619_defconfig   gcc  
sh                           sh2007_defconfig   gcc  
sparc                            allmodconfig   gcc  
sparc                             allnoconfig   gcc  
sparc                               defconfig   gcc  
sparc64                          allmodconfig   gcc  
sparc64                          allyesconfig   gcc  
sparc64                             defconfig   gcc  
sparc64               randconfig-001-20240404   gcc  
sparc64               randconfig-002-20240404   gcc  
um                               allmodconfig   clang
um                                allnoconfig   clang
um                               allyesconfig   gcc  
um                                  defconfig   clang
um                             i386_defconfig   gcc  
um                    randconfig-001-20240404   clang
um                    randconfig-002-20240404   clang
um                           x86_64_defconfig   clang
x86_64                            allnoconfig   clang
x86_64                           allyesconfig   clang
x86_64       buildonly-randconfig-001-20240404   gcc  
x86_64       buildonly-randconfig-002-20240404   gcc  
x86_64       buildonly-randconfig-003-20240404   gcc  
x86_64       buildonly-randconfig-004-20240404   clang
x86_64       buildonly-randconfig-005-20240404   clang
x86_64       buildonly-randconfig-006-20240404   clang
x86_64                              defconfig   gcc  
x86_64                randconfig-001-20240404   clang
x86_64                randconfig-002-20240404   gcc  
x86_64                randconfig-003-20240404   clang
x86_64                randconfig-004-20240404   gcc  
x86_64                randconfig-005-20240404   gcc  
x86_64                randconfig-006-20240404   gcc  
x86_64                randconfig-011-20240404   clang
x86_64                randconfig-012-20240404   clang
x86_64                randconfig-013-20240404   clang
x86_64                randconfig-014-20240404   clang
x86_64                randconfig-015-20240404   gcc  
x86_64                randconfig-016-20240404   gcc  
x86_64                randconfig-071-20240404   gcc  
x86_64                randconfig-072-20240404   clang
x86_64                randconfig-073-20240404   clang
x86_64                randconfig-074-20240404   gcc  
x86_64                randconfig-075-20240404   clang
x86_64                randconfig-076-20240404   gcc  
x86_64                          rhel-8.3-rust   clang
xtensa                            allnoconfig   gcc  
xtensa                       common_defconfig   gcc  
xtensa                randconfig-001-20240404   gcc  
xtensa                randconfig-002-20240404   gcc  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* Re: [RFC PATCH] therm_throt: test bits as we build therm_intr_core_clear_mask
From: srinivas pandruvada @ 2024-04-04  1:15 UTC (permalink / raw)
  To: Kyle McMartin, Rafael J. Wysocki; +Cc: linux-pm, kernel-team, linux-kernel
In-Reply-To: <Zg3GhhTZotBNvlRR@merlin.infradead.org>

Hi Kyle,

On Wed, 2024-04-03 at 17:13 -0400, Kyle McMartin wrote:
> X86_FEATURE_HWP appears to be insufficient on some platforms, and
> writing 1 to BIT(13)|BIT(15) results in the wrmsrl trapping and
> failing
> to clear PROCHOT_LOG.
> 
> Instead, also try to wrmsrl_safe with those bits set in the mask, and
> check if we get -EIO back. If so, those bits will trap and prevent us
> from writing to THERM_STATUS.
> 
> Signed-off-by: Kyle McMartin <jkkm@fb.com>
> 
> ---
> 
> We noticed a problem on some of our production hosts while rolling
> out
> 6.4 kernels where we were seeing PROCHOT_LOG set but never cleared,
> along with a warn on once in wrmsr.
> 
> I tracked this down to:
> 
> commit 930d06bf071aa746db11d68d2d75660b449deff3
> Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Date:   Tue Nov 15 18:54:17 2022 -0800
> 
>     thermal: intel: Protect clearing of thermal status bits
> 
> which started setting some unexpected bits in THERM_STATUS on our
> platform. Previously, the mask had these bits set, but we were
> masking
> with the MSR which was resulting in them not being written to 1.
> 
> Starting with 117e4e5bd9d47b89777dbf6b37a709dcfe59520f, these bits
> were
> protected by the HWP CPUID flag, but on some of our platforms, this
> doesn't seem sufficient.
> 
> On Broadwell and Broadwell-DE, the HWP flag is not set, but writing
> these bits does not trap.
> 
> On our Skylake-DE, Skylake, and Cooper Lake platforms, the HWP flag
> is
> set in CPUID, and writing 1 to these bits traps attempting to write
> 0xAAA8 to MSR 0x19C (THERM_STATUS). Writing 0xAA8 from userspace
> works
> as expected to un-stick PROCHOT_LOG.

I think this issue happens only on Skylake, Cascade Lake, Cooper Lake
and not on any other systems.

Please verify:
GP# happens only when bit13 (Current Limit Log) or bit15 (Cross Domain
Limit Log) is 1.

Basically writing 0x2000 or 0x8000  or A000 will cause this issue.
Are you using the latest BIOS with microcode?
Please confirm your microcode version, I can check internally.

Thanks,
Srinivas


> 
> On our Sapphire Rapids platforms, the HWP flag is set, and writing 1
> to
> these bits is successful.
> 
>  drivers/thermal/intel/therm_throt.c | 29 ++++++++++++++++++++++-----
> --
>  1 file changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/thermal/intel/therm_throt.c
> b/drivers/thermal/intel/therm_throt.c
> index e69868e868eb..3058d8fcfcef 100644
> --- a/drivers/thermal/intel/therm_throt.c
> +++ b/drivers/thermal/intel/therm_throt.c
> @@ -196,8 +196,14 @@ static const struct attribute_group
> thermal_attr_group = {
>  static u64 therm_intr_core_clear_mask;
>  static u64 therm_intr_pkg_clear_mask;
>  
> +/* Probe each addition to the mask to ensure that our wrmsrl
> + * won't fail to clear bits.
> + */
>  static void thermal_intr_init_core_clear_mask(void)
>  {
> +       u64 bits = 0;
> +       u64 mask = 0;
> +
>         if (therm_intr_core_clear_mask)
>                 return;
>  
> @@ -211,25 +217,34 @@ static void
> thermal_intr_init_core_clear_mask(void)
>          * Bit 1, 3, 5: CPUID.01H:EDX[22] = 1. This driver will not
>          * enable interrupts, when 0 as it checks for
> X86_FEATURE_ACPI.
>          */
> -       therm_intr_core_clear_mask = (BIT(1) | BIT(3) | BIT(5));
> +       mask = (BIT(1) | BIT(3) | BIT(5));
>  
>         /*
>          * Bit 7 and 9: Thermal Threshold #1 and #2 log
>          * If CPUID.01H:ECX[8] = 1
>          */
> -       if (boot_cpu_has(X86_FEATURE_TM2))
> -               therm_intr_core_clear_mask |= (BIT(7) | BIT(9));
> +       bits = BIT(7) | BIT(9);
> +       if (boot_cpu_has(X86_FEATURE_TM2) &&
> +           wrmsrl_safe(MSR_IA32_THERM_STATUS, mask | bits) >= 0)
> +               mask |= bits;
> +
>  
>         /* Bit 11: Power Limitation log (R/WC0) If CPUID.06H:EAX[4] =
> 1 */
> -       if (boot_cpu_has(X86_FEATURE_PLN))
> -               therm_intr_core_clear_mask |= BIT(11);
> +       bits = BIT(11);
> +       if (boot_cpu_has(X86_FEATURE_PLN) &&
> +           wrmsrl_safe(MSR_IA32_THERM_STATUS, mask | bits) >= 0)
> +               mask |= bits;
>  
>         /*
>          * Bit 13: Current Limit log (R/WC0) If CPUID.06H:EAX[7] = 1
>          * Bit 15: Cross Domain Limit log (R/WC0) If CPUID.06H:EAX[7]
> = 1
>          */
> -       if (boot_cpu_has(X86_FEATURE_HWP))
> -               therm_intr_core_clear_mask |= (BIT(13) | BIT(15));
> +       bits = BIT(13) | BIT(15);
> +       if (boot_cpu_has(X86_FEATURE_HWP) &&
> +           wrmsrl_safe(MSR_IA32_THERM_STATUS, mask | bits) >= 0)
> +               mask |= bits;
> +
> +       therm_intr_core_clear_mask = mask;
>  }
>  
>  static void thermal_intr_init_pkg_clear_mask(void)


^ permalink raw reply

* [RFC PATCH] therm_throt: test bits as we build therm_intr_core_clear_mask
From: Kyle McMartin @ 2024-04-03 21:13 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Srinivas Pandruvada, linux-pm, kernel-team, linux-kernel

X86_FEATURE_HWP appears to be insufficient on some platforms, and
writing 1 to BIT(13)|BIT(15) results in the wrmsrl trapping and failing
to clear PROCHOT_LOG.

Instead, also try to wrmsrl_safe with those bits set in the mask, and
check if we get -EIO back. If so, those bits will trap and prevent us
from writing to THERM_STATUS.

Signed-off-by: Kyle McMartin <jkkm@fb.com>

---

We noticed a problem on some of our production hosts while rolling out
6.4 kernels where we were seeing PROCHOT_LOG set but never cleared,
along with a warn on once in wrmsr.

I tracked this down to:

commit 930d06bf071aa746db11d68d2d75660b449deff3
Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date:   Tue Nov 15 18:54:17 2022 -0800

    thermal: intel: Protect clearing of thermal status bits

which started setting some unexpected bits in THERM_STATUS on our
platform. Previously, the mask had these bits set, but we were masking
with the MSR which was resulting in them not being written to 1.

Starting with 117e4e5bd9d47b89777dbf6b37a709dcfe59520f, these bits were
protected by the HWP CPUID flag, but on some of our platforms, this
doesn't seem sufficient.

On Broadwell and Broadwell-DE, the HWP flag is not set, but writing
these bits does not trap.

On our Skylake-DE, Skylake, and Cooper Lake platforms, the HWP flag is
set in CPUID, and writing 1 to these bits traps attempting to write
0xAAA8 to MSR 0x19C (THERM_STATUS). Writing 0xAA8 from userspace works
as expected to un-stick PROCHOT_LOG.

On our Sapphire Rapids platforms, the HWP flag is set, and writing 1 to
these bits is successful.

 drivers/thermal/intel/therm_throt.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/intel/therm_throt.c b/drivers/thermal/intel/therm_throt.c
index e69868e868eb..3058d8fcfcef 100644
--- a/drivers/thermal/intel/therm_throt.c
+++ b/drivers/thermal/intel/therm_throt.c
@@ -196,8 +196,14 @@ static const struct attribute_group thermal_attr_group = {
 static u64 therm_intr_core_clear_mask;
 static u64 therm_intr_pkg_clear_mask;
 
+/* Probe each addition to the mask to ensure that our wrmsrl
+ * won't fail to clear bits.
+ */
 static void thermal_intr_init_core_clear_mask(void)
 {
+	u64 bits = 0;
+	u64 mask = 0;
+
 	if (therm_intr_core_clear_mask)
 		return;
 
@@ -211,25 +217,34 @@ static void thermal_intr_init_core_clear_mask(void)
 	 * Bit 1, 3, 5: CPUID.01H:EDX[22] = 1. This driver will not
 	 * enable interrupts, when 0 as it checks for X86_FEATURE_ACPI.
 	 */
-	therm_intr_core_clear_mask = (BIT(1) | BIT(3) | BIT(5));
+	mask = (BIT(1) | BIT(3) | BIT(5));
 
 	/*
 	 * Bit 7 and 9: Thermal Threshold #1 and #2 log
 	 * If CPUID.01H:ECX[8] = 1
 	 */
-	if (boot_cpu_has(X86_FEATURE_TM2))
-		therm_intr_core_clear_mask |= (BIT(7) | BIT(9));
+	bits = BIT(7) | BIT(9);
+	if (boot_cpu_has(X86_FEATURE_TM2) &&
+	    wrmsrl_safe(MSR_IA32_THERM_STATUS, mask | bits) >= 0)
+		mask |= bits;
+
 
 	/* Bit 11: Power Limitation log (R/WC0) If CPUID.06H:EAX[4] = 1 */
-	if (boot_cpu_has(X86_FEATURE_PLN))
-		therm_intr_core_clear_mask |= BIT(11);
+	bits = BIT(11);
+	if (boot_cpu_has(X86_FEATURE_PLN) &&
+	    wrmsrl_safe(MSR_IA32_THERM_STATUS, mask | bits) >= 0)
+		mask |= bits;
 
 	/*
 	 * Bit 13: Current Limit log (R/WC0) If CPUID.06H:EAX[7] = 1
 	 * Bit 15: Cross Domain Limit log (R/WC0) If CPUID.06H:EAX[7] = 1
 	 */
-	if (boot_cpu_has(X86_FEATURE_HWP))
-		therm_intr_core_clear_mask |= (BIT(13) | BIT(15));
+	bits = BIT(13) | BIT(15);
+	if (boot_cpu_has(X86_FEATURE_HWP) &&
+	    wrmsrl_safe(MSR_IA32_THERM_STATUS, mask | bits) >= 0)
+		mask |= bits;
+
+	therm_intr_core_clear_mask = mask;
 }
 
 static void thermal_intr_init_pkg_clear_mask(void)

^ permalink raw reply related

* Re: kernel/sched/core.c:961:15: error: incompatible pointer to integer conversion passing 'typeof
From: Paul E. McKenney @ 2024-04-03 19:56 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Vincent Guittot, Naresh Kamboju, open list, Linux Regressions,
	lkft-triage, clang-built-linux, Linux PM, Ingo Molnar,
	Peter Zijlstra, Juri Lelli, Nick Desaulniers, linux-riscv,
	Paul Walmsley, Palmer Dabbelt, Albert Ou
In-Reply-To: <20240403160041.GA1252923@dev-arch.thelio-3990X>

On Wed, Apr 03, 2024 at 09:00:41AM -0700, Nathan Chancellor wrote:
> Hi all,
> 
> + Paul McKenney
> 
> On Wed, Apr 03, 2024 at 03:26:05PM +0200, Vincent Guittot wrote:
> > Hi Naresh,
> > 
> > Adding riscv people
> > 
> > On Wed, 3 Apr 2024 at 09:38, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> > >
> > > The riscv clang-17 defconfig build failed due to following warnings / errors
> > > on the Linux next-20240402.
> > 
> > Could you confirm that there is no problem with other arch and/or
> > other toolchain ?
> 
> This is not a clang specific issue, it happens with GCC too:

Some of these are fixed, but there are a few remaining failures.

I have pulled this series from -next, and apologies for putting it in
too soon.

							Thanx, Paul

>   $ make -skj"$(nproc)" ARCH=riscv CROSS_COMPILE=riscv64-linux- mrproper defconfig kernel/sched/core.o
>   kernel/sched/core.c: In function '__wake_q_add':
>   arch/riscv/include/asm/cmpxchg.h:175:62: warning: passing argument 2 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion]
>     175 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>         |                                                              ^~~~~
>         |                                                              |
>         |                                                              struct wake_q_node *
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   In file included from arch/riscv/include/asm/cmpxchg.h:12,
>                    from arch/riscv/include/asm/atomic.h:19,
>                    from include/linux/atomic.h:7,
>                    from include/linux/cpumask.h:14,
>                    from include/linux/smp.h:13,
>                    from include/linux/lockdep.h:14,
>                    from include/linux/spinlock.h:63,
>                    from include/linux/wait.h:9,
>                    from include/linux/wait_bit.h:8,
>                    from include/linux/fs.h:6:
>   include/linux/cmpxchg-emu.h:13:52: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
>      13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
>         |                                          ~~~~~~~~~~^~~
>   arch/riscv/include/asm/cmpxchg.h:175:69: warning: passing argument 3 of 'cmpxchg_emu_u8' makes integer from pointer without a cast [-Wint-conversion]
>     175 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>         |                                                                     ^~~~~
>         |                                                                     |
>         |                                                                     struct wake_q_node *
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   include/linux/cmpxchg-emu.h:13:67: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
>      13 | uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new);
>         |                                                         ~~~~~~~~~~^~~
>   arch/riscv/include/asm/cmpxchg.h:175:23: warning: assignment to 'struct wake_q_node *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
>     175 |                 __ret = cmpxchg_emu_u8((volatile u8 *)__ptr, __old, __new); \
>         |                       ^
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:179:64: warning: passing argument 2 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion]
>     179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                                                                ^~~~~
>         |                                                                |
>         |                                                                struct wake_q_node *
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   include/linux/cmpxchg-emu.h:14:54: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
>      14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
>         |                                            ~~~~~~~~~~^~~
>   arch/riscv/include/asm/cmpxchg.h:179:71: warning: passing argument 3 of 'cmpxchg_emu_u16' makes integer from pointer without a cast [-Wint-conversion]
>     179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                                                                       ^~~~~
>         |                                                                       |
>         |                                                                       struct wake_q_node *
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   include/linux/cmpxchg-emu.h:14:69: note: expected 'uintptr_t' {aka 'long unsigned int'} but argument is of type 'struct wake_q_node *'
>      14 | uintptr_t cmpxchg_emu_u16(volatile u16 *p, uintptr_t old, uintptr_t new);
>         |                                                           ~~~~~~~~~~^~~
>   arch/riscv/include/asm/cmpxchg.h:179:23: warning: assignment to 'struct wake_q_node *' from 'uintptr_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
>     179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                       ^
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:179:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:180:9: note: here
>     180 |         case 4:                                                         \
>         |         ^~~~
>   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
>      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
>         |                                             ^
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4810:9: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    4810 |         raw_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c:961:22: note: in expansion of macro 'cmpxchg_relaxed'
>     961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
>         |                      ^~~~~~~~~~~~~~~
>   kernel/sched/sched.h: In function 'mm_cid_put_lazy':
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/sched.h:3292:14: note: in expansion of macro 'try_cmpxchg'
>    3292 |             !try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/sched.h:3292:14: note: in expansion of macro 'try_cmpxchg'
>    3292 |             !try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
>         |              ^~~~~~~~~~~
>   kernel/sched/sched.h: In function 'mm_cid_get':
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/sched.h:3429:21: note: in expansion of macro 'try_cmpxchg'
>    3429 |                 if (try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
>         |                     ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/sched.h:3429:21: note: in expansion of macro 'try_cmpxchg'
>    3429 |                 if (try_cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, &cid, MM_CID_UNSET))
>         |                     ^~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h: In function 'raw_atomic_cmpxchg_relaxed':
>   arch/riscv/include/asm/cmpxchg.h:179:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     179 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
>         |                ^~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:180:9: note: here
>     180 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:212:30: note: in expansion of macro '__cmpxchg_relaxed'
>     212 |         (__typeof__(*(ptr))) __cmpxchg_relaxed((ptr),                   \
>         |                              ^~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:89:29: note: in expansion of macro 'arch_cmpxchg_relaxed'
>      89 | #define raw_cmpxchg_relaxed arch_cmpxchg_relaxed
>         |                             ^~~~~~~~~~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:2108:16: note: in expansion of macro 'raw_cmpxchg_relaxed'
>    2108 |         return raw_cmpxchg_relaxed(&v->counter, old, new);
>         |                ^~~~~~~~~~~~~~~~~~~
>   kernel/sched/core.c: In function '__sched_mm_cid_migrate_from_try_steal_cid':
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11724:14: note: in expansion of macro 'try_cmpxchg'
>   11724 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &src_cid, lazy_cid))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11724:14: note: in expansion of macro 'try_cmpxchg'
>   11724 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &src_cid, lazy_cid))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11760:14: note: in expansion of macro 'try_cmpxchg'
>   11760 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11760:14: note: in expansion of macro 'try_cmpxchg'
>   11760 |         if (!try_cmpxchg(&src_pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
>         |              ^~~~~~~~~~~
>   kernel/sched/core.c: In function 'task_mm_cid_work':
>   arch/riscv/include/asm/cmpxchg.h:333:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
>    4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~
>   kernel/sched/core.c:11945:23: note: in expansion of macro 'cmpxchg'
>   11945 |                 res = cmpxchg(&mm->mm_cid_next_scan, old_scan, next_scan);
>         |                       ^~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
>    4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~
>   kernel/sched/core.c:11945:23: note: in expansion of macro 'cmpxchg'
>   11945 |                 res = cmpxchg(&mm->mm_cid_next_scan, old_scan, next_scan);
>         |                       ^~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:333:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11953:14: note: in expansion of macro 'try_cmpxchg'
>   11953 |         if (!try_cmpxchg(&mm->mm_cid_next_scan, &old_scan, next_scan))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11953:14: note: in expansion of macro 'try_cmpxchg'
>   11953 |         if (!try_cmpxchg(&mm->mm_cid_next_scan, &old_scan, next_scan))
>         |              ^~~~~~~~~~~
>   kernel/sched/core.c: In function 'sched_mm_cid_remote_clear':
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11841:14: note: in expansion of macro 'try_cmpxchg'
>   11841 |         if (!try_cmpxchg(&pcpu_cid->cid, &cid, lazy_cid))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11841:14: note: in expansion of macro 'try_cmpxchg'
>   11841 |         if (!try_cmpxchg(&pcpu_cid->cid, &cid, lazy_cid))
>         |              ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11874:21: note: in expansion of macro 'try_cmpxchg'
>   11874 |                 if (try_cmpxchg(&pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
>         |                     ^~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:192:16: note: in expansion of macro 'raw_cmpxchg'
>     192 |         ___r = raw_cmpxchg((_ptr), ___o, (_new)); \
>         |                ^~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4880:9: note: in expansion of macro 'raw_try_cmpxchg'
>    4880 |         raw_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
>         |         ^~~~~~~~~~~~~~~
>   kernel/sched/core.c:11874:21: note: in expansion of macro 'try_cmpxchg'
>   11874 |                 if (try_cmpxchg(&pcpu_cid->cid, &lazy_cid, MM_CID_UNSET))
>         |                     ^~~~~~~~~~~
>   kernel/sched/sched.h: In function 'mm_cid_pcpu_unset':
>   arch/riscv/include/asm/cmpxchg.h:333:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     333 |                 __ret = cmpxchg_emu_u16((volatile u16 *)__ptr, __old, __new); \
>         |                 ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
>    4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~
>   kernel/sched/sched.h:3310:23: note: in expansion of macro 'cmpxchg'
>    3310 |                 res = cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, cid, MM_CID_UNSET);
>         |                       ^~~~~~~
>   arch/riscv/include/asm/cmpxchg.h:334:9: note: here
>     334 |         case 4:                                                         \
>         |         ^~~~
>   arch/riscv/include/asm/cmpxchg.h:368:30: note: in expansion of macro '__cmpxchg'
>     368 |         (__typeof__(*(ptr))) __cmpxchg((ptr),                           \
>         |                              ^~~~~~~~~
>   include/linux/atomic/atomic-arch-fallback.h:55:21: note: in expansion of macro 'arch_cmpxchg'
>      55 | #define raw_cmpxchg arch_cmpxchg
>         |                     ^~~~~~~~~~~~
>   include/linux/atomic/atomic-instrumented.h:4788:9: note: in expansion of macro 'raw_cmpxchg'
>    4788 |         raw_cmpxchg(__ai_ptr, __VA_ARGS__); \
>         |         ^~~~~~~~~~~
>   kernel/sched/sched.h:3310:23: note: in expansion of macro 'cmpxchg'
>    3310 |                 res = cmpxchg(&this_cpu_ptr(pcpu_cid)->cid, cid, MM_CID_UNSET);
>         |                       ^~~~~~~
> 
> > > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> > >
> > > riscv:
> > >   build:
> > >     * clang-17-lkftconfig - Failed
> > >     * rv32-clang-17-defconfig - Failed
> > >     * clang-17-tinyconfig - Failed
> > >     * rv32-clang-17-tinyconfig - Failed
> > >     * clang-17-defconfig - Failed
> > >     * clang-17-allnoconfig - Failed
> > >     * rv32-clang-17-allnoconfig - Failed
> > >
> > > Build log:
> > > -------
> > > kernel/sched/core.c:961:15: error: incompatible pointer to integer
> > > conversion passing 'typeof (*((__ai_ptr)))' (aka 'struct wake_q_node
> > > *') to parameter of type 'uintptr_t' (aka 'unsigned long')
> > > [-Wint-conversion]
> > >   961 |         if (unlikely(cmpxchg_relaxed(&node->next, NULL, WAKE_Q_TAIL)))
> > >       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > There is no recent change on this code. Could it be a change in
> > cmpxchg_relaxed ?
> 
> Yes, it is caused by commit df35ee400e06 ("riscv: Emulate one-byte and
> two-byte cmpxchg") in -next. There is another thread on this problem
> with a suggested diff that resolves it for me (there are other issues
> with that change as well such as break not being in the correct
> location):
> 
> https://lore.kernel.org/Zgz98szFLLjTIZSO@yujie-X299/
> 
> Cheers,
> Nathan

^ permalink raw reply

* [rafael-pm:thermal-core-testing 2/6] drivers/thermal/./thermal_trace_ipa.h:27:36: error: invalid use of undefined type 'struct thermal_zone_device'
From: kernel test robot @ 2024-04-03 19:40 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: oe-kbuild-all, linux-acpi, devel, linux-pm

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal-core-testing
head:   a89f1989a5e97c0ca6a1e355500e2659f64707c5
commit: 9396b9d5d714caf9b54037b49877bfa441cb292c [2/6] thermal: core: Make struct thermal_zone_device definition internal
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20240404/202404040355.vMDBmRgN-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240404/202404040355.vMDBmRgN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404040355.vMDBmRgN-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:102,
                    from drivers/thermal/thermal_trace_ipa.h:102,
                    from drivers/thermal/gov_power_allocator.c:15:
   drivers/thermal/./thermal_trace_ipa.h: In function 'trace_event_raw_event_thermal_power_allocator':
>> drivers/thermal/./thermal_trace_ipa.h:27:36: error: invalid use of undefined type 'struct thermal_zone_device'
      27 |                 __entry->tz_id = tz->id;
         |                                    ^~
   include/trace/trace_events.h:402:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
     402 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   drivers/thermal/./thermal_trace_ipa.h:10:1: note: in expansion of macro 'TRACE_EVENT'
      10 | TRACE_EVENT(thermal_power_allocator,
         | ^~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h:26:9: note: in expansion of macro 'TP_fast_assign'
      26 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h: In function 'trace_event_raw_event_thermal_power_actor':
   drivers/thermal/./thermal_trace_ipa.h:55:36: error: invalid use of undefined type 'struct thermal_zone_device'
      55 |                 __entry->tz_id = tz->id;
         |                                    ^~
   include/trace/trace_events.h:402:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
     402 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   drivers/thermal/./thermal_trace_ipa.h:44:1: note: in expansion of macro 'TRACE_EVENT'
      44 | TRACE_EVENT(thermal_power_actor,
         | ^~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h:54:9: note: in expansion of macro 'TP_fast_assign'
      54 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h: In function 'trace_event_raw_event_thermal_power_allocator_pid':
   drivers/thermal/./thermal_trace_ipa.h:80:36: error: invalid use of undefined type 'struct thermal_zone_device'
      80 |                 __entry->tz_id = tz->id;
         |                                    ^~
   include/trace/trace_events.h:402:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
     402 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   drivers/thermal/./thermal_trace_ipa.h:66:1: note: in expansion of macro 'TRACE_EVENT'
      66 | TRACE_EVENT(thermal_power_allocator_pid,
         | ^~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h:79:9: note: in expansion of macro 'TP_fast_assign'
      79 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   In file included from include/trace/define_trace.h:103:
   drivers/thermal/./thermal_trace_ipa.h: In function 'perf_trace_thermal_power_allocator':
>> drivers/thermal/./thermal_trace_ipa.h:27:36: error: invalid use of undefined type 'struct thermal_zone_device'
      27 |                 __entry->tz_id = tz->id;
         |                                    ^~
   include/trace/perf.h:51:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
      51 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   drivers/thermal/./thermal_trace_ipa.h:10:1: note: in expansion of macro 'TRACE_EVENT'
      10 | TRACE_EVENT(thermal_power_allocator,
         | ^~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h:26:9: note: in expansion of macro 'TP_fast_assign'
      26 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h: In function 'perf_trace_thermal_power_actor':
   drivers/thermal/./thermal_trace_ipa.h:55:36: error: invalid use of undefined type 'struct thermal_zone_device'
      55 |                 __entry->tz_id = tz->id;
         |                                    ^~
   include/trace/perf.h:51:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
      51 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   drivers/thermal/./thermal_trace_ipa.h:44:1: note: in expansion of macro 'TRACE_EVENT'
      44 | TRACE_EVENT(thermal_power_actor,
         | ^~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h:54:9: note: in expansion of macro 'TP_fast_assign'
      54 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h: In function 'perf_trace_thermal_power_allocator_pid':
   drivers/thermal/./thermal_trace_ipa.h:80:36: error: invalid use of undefined type 'struct thermal_zone_device'
      80 |                 __entry->tz_id = tz->id;
         |                                    ^~
   include/trace/perf.h:51:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
      51 |         { assign; }                                                     \
         |           ^~~~~~
   include/trace/trace_events.h:44:30: note: in expansion of macro 'PARAMS'
      44 |                              PARAMS(assign),                   \
         |                              ^~~~~~
   drivers/thermal/./thermal_trace_ipa.h:66:1: note: in expansion of macro 'TRACE_EVENT'
      66 | TRACE_EVENT(thermal_power_allocator_pid,
         | ^~~~~~~~~~~
   drivers/thermal/./thermal_trace_ipa.h:79:9: note: in expansion of macro 'TP_fast_assign'
      79 |         TP_fast_assign(
         |         ^~~~~~~~~~~~~~


vim +27 drivers/thermal/./thermal_trace_ipa.h

6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02   9  
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  10  TRACE_EVENT(thermal_power_allocator,
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  11  	TP_PROTO(struct thermal_zone_device *tz, u32 total_req_power,
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  12  		 u32 total_granted_power, int num_actors, u32 power_range,
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  13  		 u32 max_allocatable_power, int current_temp, s32 delta_temp),
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  14  	TP_ARGS(tz, total_req_power, total_granted_power, num_actors,
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  15  		power_range, max_allocatable_power, current_temp, delta_temp),
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  16  	TP_STRUCT__entry(
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  17  		__field(int,           tz_id          )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  18  		__field(u32,           total_req_power          )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  19  		__field(u32,           total_granted_power      )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  20  		__field(size_t,        num_actors               )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  21  		__field(u32,           power_range              )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  22  		__field(u32,           max_allocatable_power    )
17e8351a77397e include/trace/events/thermal_power_allocator.h Sascha Hauer 2015-07-24  23  		__field(int,           current_temp             )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  24  		__field(s32,           delta_temp               )
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  25  	),
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  26  	TP_fast_assign(
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02 @27  		__entry->tz_id = tz->id;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  28  		__entry->total_req_power = total_req_power;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  29  		__entry->total_granted_power = total_granted_power;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  30  		__entry->num_actors = num_actors;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  31  		__entry->power_range = power_range;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  32  		__entry->max_allocatable_power = max_allocatable_power;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  33  		__entry->current_temp = current_temp;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  34  		__entry->delta_temp = delta_temp;
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  35  	),
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  36  
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  37  	TP_printk("thermal_zone_id=%d total_req_power=%u total_granted_power=%u power_range=%u max_allocatable_power=%u current_temperature=%d delta_temperature=%d",
792c3dc08ddcf2 drivers/thermal/thermal_trace_ipa.h            Lukasz Luba  2023-12-20  38  		__entry->tz_id,	__entry->total_req_power,
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  39  		__entry->total_granted_power, __entry->power_range,
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  40  		__entry->max_allocatable_power, __entry->current_temp,
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  41  		__entry->delta_temp)
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  42  );
6828a4711f994b include/trace/events/thermal_power_allocator.h Javi Merino  2015-03-02  43  

:::::: The code at line 27 was first introduced by commit
:::::: 6828a4711f994bbd9d3fd27b7a541217fc37b341 thermal: add trace events to the power allocator governor

:::::: TO: Javi Merino <javi.merino@arm.com>
:::::: CC: Eduardo Valentin <edubezval@gmail.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* [PATCH v2 2/2] PM / devfreq: exynos: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
From: Anand Moon @ 2024-04-03 18:15 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: Anand Moon, linux-pm, linux-samsung-soc, linux-arm-kernel,
	linux-kernel
In-Reply-To: <20240403181517.5993-1-linux.amoon@gmail.com>

Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM_SLEEP are disabled,
without having to use #ifdef guards. If CONFIG_PM_SLEEP unused,
they will simply be discarded by the compiler.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
added __maybe_unused to suspend/resume functions

[0] https://lore.kernel.org/all/20240226183308.4730-1-linux.amoon@gmail.com/
---
 drivers/devfreq/exynos-bus.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 153340b6685f..09822f8fa209 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -454,8 +454,7 @@ static void exynos_bus_shutdown(struct platform_device *pdev)
 	devfreq_suspend_device(bus->devfreq);
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int exynos_bus_resume(struct device *dev)
+static int __maybe_unused exynos_bus_resume(struct device *dev)
 {
 	struct exynos_bus *bus = dev_get_drvdata(dev);
 	int ret;
@@ -469,7 +468,7 @@ static int exynos_bus_resume(struct device *dev)
 	return 0;
 }
 
-static int exynos_bus_suspend(struct device *dev)
+static int __maybe_unused exynos_bus_suspend(struct device *dev)
 {
 	struct exynos_bus *bus = dev_get_drvdata(dev);
 	int ret;
@@ -482,7 +481,6 @@ static int exynos_bus_suspend(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops exynos_bus_pm = {
 	SET_SYSTEM_SLEEP_PM_OPS(exynos_bus_suspend, exynos_bus_resume)
@@ -499,7 +497,7 @@ static struct platform_driver exynos_bus_platdrv = {
 	.shutdown	= exynos_bus_shutdown,
 	.driver = {
 		.name	= "exynos-bus",
-		.pm	= &exynos_bus_pm,
+		.pm	= pm_sleep_ptr(&exynos_bus_pm),
 		.of_match_table = exynos_bus_of_match,
 	},
 };
-- 
2.44.0


^ permalink raw reply related

* [PATCH v2 1/2] PM / devfreq: exynos: Use Use devm_clk_get_enabled() helpers
From: Anand Moon @ 2024-04-03 18:15 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Krzysztof Kozlowski,
	Alim Akhtar
  Cc: Anand Moon, linux-pm, linux-samsung-soc, linux-arm-kernel,
	linux-kernel

The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

While at it, use dev_err_probe consistently, and use its return value
to return the error code.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v2: no changes
---
 drivers/devfreq/exynos-bus.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 245898f1a88e..153340b6685f 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -160,7 +160,6 @@ static void exynos_bus_exit(struct device *dev)
 	platform_device_unregister(bus->icc_pdev);
 
 	dev_pm_opp_of_remove_table(dev);
-	clk_disable_unprepare(bus->clk);
 	dev_pm_opp_put_regulators(bus->opp_token);
 }
 
@@ -171,7 +170,6 @@ static void exynos_bus_passive_exit(struct device *dev)
 	platform_device_unregister(bus->icc_pdev);
 
 	dev_pm_opp_of_remove_table(dev);
-	clk_disable_unprepare(bus->clk);
 }
 
 static int exynos_bus_parent_parse_of(struct device_node *np,
@@ -247,23 +245,15 @@ static int exynos_bus_parse_of(struct device_node *np,
 	int ret;
 
 	/* Get the clock to provide each bus with source clock */
-	bus->clk = devm_clk_get(dev, "bus");
-	if (IS_ERR(bus->clk)) {
-		dev_err(dev, "failed to get bus clock\n");
-		return PTR_ERR(bus->clk);
-	}
-
-	ret = clk_prepare_enable(bus->clk);
-	if (ret < 0) {
-		dev_err(dev, "failed to get enable clock\n");
-		return ret;
-	}
+	bus->clk = devm_clk_get_enabled(dev, "bus");
+	if (IS_ERR(bus->clk))
+		return dev_err_probe(dev, PTR_ERR(bus->clk), "failed to get bus clock\n");
 
 	/* Get the freq and voltage from OPP table to scale the bus freq */
 	ret = dev_pm_opp_of_add_table(dev);
 	if (ret < 0) {
 		dev_err(dev, "failed to get OPP table\n");
-		goto err_clk;
+		return ret;
 	}
 
 	rate = clk_get_rate(bus->clk);
@@ -281,8 +271,6 @@ static int exynos_bus_parse_of(struct device_node *np,
 
 err_opp:
 	dev_pm_opp_of_remove_table(dev);
-err_clk:
-	clk_disable_unprepare(bus->clk);
 
 	return ret;
 }
@@ -453,7 +441,6 @@ static int exynos_bus_probe(struct platform_device *pdev)
 
 err:
 	dev_pm_opp_of_remove_table(dev);
-	clk_disable_unprepare(bus->clk);
 err_reg:
 	dev_pm_opp_put_regulators(bus->opp_token);
 
-- 
2.44.0


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox