mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhang, Rui" <rui.zhang@intel.com>
To: "hansg@kernel.org" <hansg@kernel.org>,
	"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
	"qinyuntan@linux.alibaba.com" <qinyuntan@linux.alibaba.com>
Cc: "srinivas.pandruvada@linux.intel.com"
	<srinivas.pandruvada@linux.intel.com>,
	"xlpang@linux.alibaba.com" <xlpang@linux.alibaba.com>,
	"tero.kristo@linux.intel.com" <tero.kristo@linux.intel.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86/intel/tpmi/plr: Fix CPU selection on partitioned systems
Date: Fri, 27 Nov 2026 05:00:30 +0000	[thread overview]
Message-ID: <7bd156a0ccc8ce5c24d26b1a4583bd7086f41942.camel@intel.com> (raw)
In-Reply-To: <20261125092244.3641945-1-qinyuntan@linux.alibaba.com>

On Wed, 2026-11-25 at 17:22 +0800, Qinyun Tan wrote:
> When a package has multiple TPMI partitions, PLR can report the same
> CPUs in more than one partition. For example, on a single-package
> system with 72 logical CPUs and two TPMI partitions, both partitions
> list CPUs 0-35 in their PLR status files. CPUs 36-71 are missing.
> 
> Each partition numbers its PLR resources from zero. The driver
> compares
> that index with the CPU's power domain ID from MSR_PM_LOGICAL_ID,
> which
> is unique within the package. As a result, both partitions select the
> same CPUs. A mailbox read or clear on the second partition then uses
> a
> module ID taken from a CPU in the first partition.
> 
> Use the partition's cdie_mask to map each PLR resource to its package
> power domain. For compatibility with older platforms, keep using the
> resource index for partition 0 when no mask is available. Skip per-
> CPU
> mailbox accesses if the resource has no valid CPU mapping.
> 
> Fixes: 9e9397a41b7b ("platform/x86/intel/tpmi/plr: Add support for
> the plr mailbox")
> Signed-off-by: Qinyun Tan <qinyuntan@linux.alibaba.com>

I have reproduced this issue and verified that this patch can fix it.

Tested-by: Zhang Rui <rui.zhang@intel.com>

but one minor comment below,
>  
> +static int plr_power_domain_id(const struct oobmsm_plat_info
> *plat_info, int index)
> +{
> +	u16 mask = plat_info->cdie_mask;

This cdie_mask is a bitmask, its Nth bit means hardware cpu die N,
which IMO equals the punit/power domain id N.

> +	int id = index;
> +
> +	/* Resource indices are relative to the partition's first
> compute die. */
> +	if (mask)
> +		id += __ffs(mask);

here we want to get the power domain id for PLR domain 0/1 because we
use that for cpu to plr/power_domain mapping.
The above code generated correct results for the platform being tested,
but with the assumption that the cdie_mask cannot be sparse.

how about something like
	id = fns(mask, index);

thanks,
rui


> +	else if (plat_info->partition)
> +		return -ENODEV;
> +
> +	if (id >= MAX_POWER_DOMAINS || (mask && !(mask & BIT(id))))
> +		return -ENODEV;
> +
> +	return id;
> +}
> +
>  


  parent reply	other threads:[~2026-11-27  5:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  9:22 Qinyun Tan
2026-11-25 17:49 ` Srinivas Pandruvada
2026-11-26  2:00   ` Qinyun Tan
2026-11-27  5:00 ` Zhang, Rui [this message]
2026-11-27 11:59   ` Srinivas Pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bd156a0ccc8ce5c24d26b1a4583bd7086f41942.camel@intel.com \
    --to=rui.zhang@intel.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=qinyuntan@linux.alibaba.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tero.kristo@linux.intel.com \
    --cc=xlpang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®