Re: [PATCH v4 1/2] irqchip: irq-qcom-mpm: Register MPM with cpu_pm for RPM notification
From: Maulik Shah
Date: Mon Nov 30 2026 - 04:11:37 EST
On 18-11-2026 11:36, Sneh Mankad wrote:
> MPM irqchip needs to notify RPM (Resource Power Manager) processor to read
> the latest wake up capable interrupts when the CPU cluster is entering the
> deepest idle state. This is done by sending IPC interrupt to RPM and is
> implemented as .power_off() callback by registering MPM as parent power
> domain to CPU cluster.
>
[...]
> +
> +static int mpm_cpu_pm_callback(struct notifier_block *nfb, unsigned long action, void *v)
> +{
> + struct qcom_mpm_priv *priv = container_of(nfb, struct qcom_mpm_priv, mpm_pm);
> + int cpus_in_pm;
> +
> + switch (action) {
> + case CPU_PM_ENTER:
CPU's exit notification decrements cpus_in_pm without a matching entry, for the case when CPU is already in deeper idle
state when the register for CPU PM callback happens via MPM irqchip.
To avoid this, one possible way is to have additional cpus_entered_pm, to track.
cpumask_set_cpu(cpu, &priv->cpus_entered_pm);
> + cpus_in_pm = atomic_inc_return(&priv->cpus_in_pm);
> + /*
> + * NOTE: comments for num_online_cpus() point out that it's
> + * only a snapshot so we need to be careful. It should be OK
> + * for us to use, though. It's important for us not to miss
> + * if we're the last CPU going down so it would only be a
> + * problem if a CPU went offline right after we did the check
> + * AND that CPU was not idle AND that CPU was the last non-idle
> + * CPU. That can't happen. CPUs would have to come out of idle
> + * before the CPU could go offline.
> + */
> + if (cpus_in_pm < num_online_cpus())
> + return NOTIFY_OK;
> + break;
> + case CPU_PM_ENTER_FAILED:
> + case CPU_PM_EXIT:
> + atomic_dec(&priv->cpus_in_pm);
> + return NOTIFY_OK;
Decrement only if enter has tracked the CPU.
/* A CPU may have entered idle before notifier registration. */
if (cpumask_test_and_clear_cpu(cpu, &priv->cpus_entered_pm))
atomic_dec(&priv->cpus_in_pm);
Thanks,
Maulik