All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qi Liu" <liuqi@hygon.cn>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/3] perf/x86/amd/uncore: Add Hygon uncore PMU support
Date: Wed, 01 Jul 2026 03:56:24 +0000	[thread overview]
Message-ID: <20260701035625.026621F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701034413.718872-4-liuqi@hygon.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Inconsistency between sysfs format attribute and event mask for unknown/future models (> 0x18) in the DF IOD PMU.
--

commit 7e45f23af16ead4a16cb506a64d18f3c1ad13f46
Author: Qi Liu <liuqi@hygon.cn>

perf/x86/amd/uncore: Add Hygon uncore PMU support

Add uncore PMU support for Hygon processors based on the
shared AMD-family uncore framework.

> diff --git a/arch/x86/events/amd/hygon_uncore.c b/arch/x86/events/amd/hygon_uncore.c
> new file mode 100644
> index 0000000000000..7758a1dda21ae
> --- /dev/null
> +++ b/arch/x86/events/amd/hygon_uncore.c

[ ... ]

> +static u64 hygon_uncore_df_event_mask(void)
> +{
> +	if (boot_cpu_data.x86_model == 0x4 ||
> +	    boot_cpu_data.x86_model == 0x5)
> +		return HYGON_F18H_M4H_RAW_EVENT_MASK_DF;
> +
> +	if (boot_cpu_data.x86_model >= 0x6 &&
> +	    boot_cpu_data.x86_model <= 0x18)
> +		return HYGON_F18H_M6H_RAW_EVENT_MASK_DF;
> +
> +	return HYGON_F18H_RAW_EVENT_MASK_DF;
> +}

[ ... ]

> +static struct attribute *hygon_uncore_df_iod_format_attr[] = {
> +	&format_attr_event.attr,
> +	&format_attr_umask10.attr,
> +	&format_attr_constid.attr,
> +	&format_attr_iod.attr,
> +	NULL,
> +};

[ ... ]

> +static int hygon_uncore_df_iod_ctx_init(struct uncore_common *uncore,
> +					unsigned int cpu)
> +{

[ ... ]

> +	pmu->msr_base = MSR_HYGON_F18H_DF_IOD_CTL;
> +	pmu->rdpmc_base = -1;
> +	pmu->group = uncore_common_ctx_gid(uncore, cpu);
> +	pmu->private = uncore;
> +
> +	if (boot_cpu_data.x86_model >= 0x6 &&
> +	    boot_cpu_data.x86_model <= 0x18)
> +		hygon_uncore_df_iod_format_attr[1] = &format_attr_umask12.attr;

[Severity: Medium]
For unknown or future CPU models (where x86_model > 0x18), this initialization
leaves the DF IOD format attribute as the default 10-bit umask
(format_attr_umask10.attr).

However, hygon_uncore_df_event_mask() above falls back to returning the 8-bit
mask HYGON_F18H_RAW_EVENT_MASK_DF for these models.

Will this inconsistency cause userspace to believe a 10-bit umask is supported
via sysfs, while the PMU driver silently truncates the top 2 bits when applying
the hardware mask in hygon_uncore_df_event_init()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701034413.718872-1-liuqi@hygon.cn?part=3

      reply	other threads:[~2026-07-01  3:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  3:44 [PATCH 0/3] perf/x86/amd/uncore: Add common helpers and Hygon support Qi Liu
2026-07-01  3:44 ` [PATCH 1/3] perf/x86/amd/uncore: Add common PMU helper functions Qi Liu
2026-07-01  4:04   ` sashiko-bot
2026-07-01  7:00   ` Peter Zijlstra
2026-07-01  7:50     ` 答复: " Qi Liu
2026-07-01  7:51       ` Peter Zijlstra
2026-07-01  7:55         ` 答复: " Qi Liu
2026-07-01  3:44 ` [PATCH 2/3] perf/x86/amd/uncore: Convert AMD driver to common PMU helpers Qi Liu
2026-07-01  4:00   ` sashiko-bot
2026-07-01  3:44 ` [PATCH 3/3] perf/x86/amd/uncore: Add Hygon uncore PMU support Qi Liu
2026-07-01  3:56   ` sashiko-bot [this message]

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=20260701035625.026621F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=liuqi@hygon.cn \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.