Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhanpeng Zhang" <zhangzhanpeng.jasper@bytedance.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v13 08/11] perf: RISC-V: add support for SSE event
Date: Thu, 19 Nov 2026 12:34:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-223092@kernel.org> (raw)
In-Reply-To: <20261119120824.13969-21-zhangzhanpeng.jasper@bytedance.com>

Thank you for your contribution! Sashiko AI review found 10 potential
issues to consider:
- [High] perf: riscv: unstopped counters in pmu_sbi_ovf_sse_handler()
  when regs is NULL
- [High] perf: riscv: unhandled PERF_HES_STOPPED counters in overflow
  and stop paths
- [Medium] perf: riscv: missing sse_event_cleanup() when
  pmu_sbi_setup_sse() fails
- [Medium] perf: riscv: batch counter stop in pmu_sbi_cleanup_sse()
  skips active counters
- [Medium] perf: riscv: premature hw_evt->state reset in
  pmu_sbi_ovf_handler() loop
- [Medium] perf: riscv: missing perf_event_update_userpage() in
  pmu_sbi_fail_sse()
- [Medium] perf: riscv: pmu_sbi_sse_enable() latches sse_failed on
  hotplug and reboot
- [Medium] perf: riscv: riscv_pm_pmu_notify() ignores latched
  cpuc->sse_failed state
- [Medium] perf: riscv: lost PMU SSE resume state on CPU_PM_ENTER after
  unmask failure
- [Low] perf: riscv: unused pmu_sbi_stop_all_cpu() when
  CONFIG_RISCV_PMU_SBI_SSE=n
--

commit f0818fdfc418d31969bed16ca22047c7d7a80ce8
Author: Clément Léger <cleger@rivosinc.com>

perf: RISC-V: add support for SSE event

This commit adds support for delivering RISC-V SBI PMU counter overflow
events via Supervisor Software Events (SSE), including probe-time delivery
selection, CPU power-management coordination, and error handling.

Link: https://lore.kernel.org/r/20261002-reach-cloning-f1594729dbe3@wendy/

> diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
> index 21a2078eab98a..a984ac57a7b6e 100644
> --- a/drivers/perf/riscv_pmu_sbi.c
> +++ b/drivers/perf/riscv_pmu_sbi.c

[ ... ]

> @@ -936,14 +938,42 @@ static inline void pmu_sbi_stop_all(struct riscv_pmu *pmu)
>  	 * which may include counters that are not enabled yet.
>  	 */
>  	for (i = 0; i < BITS_TO_LONGS(RISCV_MAX_COUNTERS); i++) {
> -		if (!pmu->cmask[i])
> +		if (!ctr_mask[i])
>  			continue;
>  		sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP,
> -			  i * BITS_PER_LONG, pmu->cmask[i],
> +			  i * BITS_PER_LONG, ctr_mask[i],
>  			  SBI_PMU_STOP_FLAG_RESET);
>  	}
>  }
>  
> +static void pmu_sbi_sse_stop_all(const unsigned long *ctr_mask)
> +{
> +	struct sbiret ret;
> +	int i;
> +
> +	/*
> +	 * Stop each counter separately: an already-stopped counter must not
> +	 * prevent firmware from stopping a later, overflowing counter.
> +	 */
> +	for_each_set_bit(i, ctr_mask, RISCV_MAX_COUNTERS) {
> +		ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP,
> +				i, 1, SBI_PMU_STOP_FLAG_RESET);
> +		if (ret.error && ret.error != SBI_ERR_ALREADY_STOPPED)
> +			pr_warn_ratelimited("failed to stop counter %d: %ld\n",
> +					    i, ret.error);
> +	}
> +}
> +
> +static inline void pmu_sbi_stop_all(struct riscv_pmu *pmu)
> +{
> +	pmu_sbi_stop_all_mask(pmu->cmask);
> +}
> +
> +static void pmu_sbi_stop_all_cpu(void *info)
> +{
> +	pmu_sbi_stop_all(info);
> +}

[Severity: Low]
Will pmu_sbi_stop_all_cpu() trigger an unused-function warning when
CONFIG_RISCV_PMU_SBI_SSE is disabled, since its only caller is
pmu_sbi_cleanup_sse() inside #ifdef CONFIG_RISCV_PMU_SBI_SSE?

[ ... ]

> @@ -1054,32 +1098,111 @@ static inline void pmu_sbi_start_ovf_ctrs_snapshot(struct cpu_hw_events *cpu_hw_

[ ... ]

> +#ifdef CONFIG_RISCV_PMU_SBI_SSE
> +/*
> + * A local SSE delivery failure makes the current PMU state unsafe to resume.
> + * Latch the failure before stopping mapped events so the SSE transition and
> + * overflow restart paths cannot undo the fail-safe while they are quiesced.
> + */
> +static void pmu_sbi_fail_sse(struct riscv_pmu *pmu, const char *op, int ret)
> +{
> +	struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events);
> +	struct perf_event *event;
> +	int idx;
> +
> +	if (READ_ONCE(cpu_hw_evt->sse_failed))
> +		return;
> +
> +	WRITE_ONCE(cpu_hw_evt->sse_failed, true);
> +	pr_err_ratelimited("failed to %s local PMU SSE event: %d; stopping counters\n",
> +			   op, ret);
> +
> +	for (idx = 0; idx < RISCV_MAX_COUNTERS; idx++) {\n> +		event = cpu_hw_evt->events[idx];
> +		if (event)
> +			riscv_pmu_stop(event, PERF_EF_UPDATE);
> +	}
> +}

[Severity: Medium]
Should pmu_sbi_fail_sse() also call perf_event_update_userpage(event) after
riscv_pmu_stop()?

riscv_pmu_stop() calls pmu_sbi_ctr_stop() -> pmu_sbi_reset_scounteren(),
which clears the counter's bit in CSR_SCOUNTEREN and sets PERF_HES_STOPPED,
but does not update the perf mmap page.  If userpg->index remains non-zero
(for example when sse_event_enable_local() fails in pmu_sbi_sse_enable() or
after riscv_pm_pmu_update() on CPU_PM_EXIT), userspace direct counter reads
will execute csrr on the disabled CSR and trap with SIGILL.

> +
> +static void pmu_sbi_sse_disable(struct pmu *pmu)
> +{
> +	struct riscv_pmu *rvpmu = to_riscv_pmu(pmu);
> +	struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(rvpmu->hw_events);
> +	int ret;
> +
> +	if (!READ_ONCE(rvpmu->sse_active) ||
> +	    READ_ONCE(cpu_hw_evt->sse_failed))
> +		return;
> +
> +	ret = sse_event_disable_local(rvpmu->sse_evt);
> +	if (unlikely(ret))
> +		pmu_sbi_fail_sse(rvpmu, "disable", ret);
> +}
> +
> +static void pmu_sbi_sse_enable(struct pmu *pmu)
> +{
> +	struct riscv_pmu *rvpmu = to_riscv_pmu(pmu);
> +	struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(rvpmu->hw_events);
> +	int ret;
> +
> +	if (!READ_ONCE(rvpmu->sse_active) ||
> +	    READ_ONCE(cpu_hw_evt->sse_failed))
> +		return;
> +
> +	ret = sse_event_enable_local(rvpmu->sse_evt);
> +	if (unlikely(ret))
> +		pmu_sbi_fail_sse(rvpmu, "enable", ret);
> +}
> +#endif

[Severity: Medium]
Can pmu_sbi_sse_enable() permanently latch cpu_hw_evt->sse_failed during
CPU hotplug or system reboot?

CPUHP_AP_RISCV_SSE_ONLINE runs in the threaded ONLINE section after
CPUHP_AP_ONLINE_IDLE, CPUHP_AP_SCHED_WAIT_EMPTY, and
CPUHP_AP_SMPBOOT_THREADS.  If a task carrying a hardware perf event
context-switches on a CPU after sse_cpu_teardown() on cpu_down or before
sse_cpu_online() on cpu_up, perf_pmu_enable() -> pmu_sbi_sse_enable() calls
sse_event_enable_local() while reg_evt->is_registered is false, which
returns -EINVAL and permanently disables PMU counters on that CPU via
pmu_sbi_fail_sse().  Similarly, during reboot sse_reboot_nb (priority 0)
sets sse_shutting_down before perf_reboot_notifier (priority INT_MIN) stops
events, causing sse_event_enable_local() to return -ESHUTDOWN and hit
pmu_sbi_fail_sse().

[ ... ]

> @@ -1165,6 +1306,14 @@ static irqreturn_t pmu_sbi_ovf_handler(int irq, void *dev)
>  		hw_evt->state |= PERF_HES_UPTODATE;
>  		perf_sample_data_init(&data, 0, hw_evt->last_period);
>  		if (riscv_pmu_event_set_period(event)) {
> +			int overflow_ret;
> +
> +			/* Guest attribution and guest stack sampling are not supported yet. */
> +			if (from_guest) {
> +				hw_evt->state = 0;
> +				continue;
> +			}
> +
>  			/*
>  			 * Unlike other ISAs, RISC-V don't have to disable interrupts
>  			 * to avoid throttling here. As per the specification, the
> @@ -1173,128 +1322,291 @@ static irqreturn_t pmu_sbi_ovf_handler(int irq, void *dev)
>  			 * TODO: We will need to stop the guest counters once
>  			 * virtualization support is added.
>  			 */
> -			perf_event_overflow(event, &data, regs);
> +			overflow_ret = perf_event_overflow(event, &data, regs);
> +			if (!overflow_ret)
> +				hw_evt->state = 0;
> +		} else {
> +			hw_evt->state = 0;
>  		}
> -		/* Reset the state as we are going to start the counter after the loop */
> -		hw_evt->state = 0;
>  	}
>  
>  	pmu_sbi_start_overflow_mask(pmu, overflowed_ctrs);

[Severity: High]
When perf_event_overflow() returns non-zero and leaves a throttled counter
stopped with PERF_HES_STOPPED while its bit remains set in
cpu_hw_evt->used_hw_ctrs, how does a subsequent overflow on another counter
handle that stopped counter?

First, pmu_sbi_stop_hw_ctrs() passes the unfiltered cpu_hw_evt->used_hw_ctrs[i]
to a batch SBI_EXT_PMU_COUNTER_STOP call.  Because the throttled counter is
already stopped in firmware, the batch call can abort early with
SBI_ERR_ALREADY_STOPPED without stopping higher-indexed overflowing
counters, or return ret.error == SBI_ERR_ALREADY_STOPPED and cause
pmu_sbi_stop_hw_ctrs() to skip saving sdata->ctr_values[] and overwrite the
shared snapshot buffer with zeroes from snapshot_cval_shcopy[].

Second, because the throttled counter was never restarted, its hardware OF
bit in CSR_SCOUNTOVF remains set while riscv_pmu_event_set_period() already
reloaded hw_evt->period_left > 0.  On the next overflow of another counter,
the loop in pmu_sbi_ovf_handler() does not skip events with
PERF_HES_STOPPED set; it revisits the throttled counter, sees
riscv_pmu_event_set_period(event) return 0, and sets hw_evt->state = 0 in
the else branch (or the from_guest branch), causing
pmu_sbi_start_overflow_mask() to restart the throttled counter.

[Severity: Medium]
Can clearing hw_evt->state = 0 inside the pmu_sbi_ovf_handler() loop before
pmu_sbi_start_overflow_mask() reprograms the counters corrupt group
throttling or frequency-mode throttling?

If two events in the same group overflow together and the first does not
throttle (setting its hw_evt->state = 0) while the second throttles the
group, perf_event_throttle_group() calls riscv_pmu_stop() on the first
event before its hardware counter is reprogrammed, running
riscv_pmu_event_update() a second time against the new hw_evt->prev_count.
Also, for attr.freq events, __perf_event_account_interrupt() calls
perf_adjust_period() after perf_event_throttle_group(); when period_left >
8 * sample_period, perf_adjust_period() calls event->pmu->start()
(riscv_pmu_start()), clearing hwc->state = 0 and starting the counter even
though perf_event_overflow() returns 1.

>  
>  	perf_sample_event_took(sched_clock() - start_clock);
>  
>  	return IRQ_HANDLED;
>  }
>  
> -static int pmu_sbi_starting_cpu(unsigned int cpu, struct hlist_node *node)
> +static irqreturn_t pmu_sbi_ovf_irq_handler(int irq, void *dev)
>  {
> -	struct riscv_pmu *pmu = hlist_entry_safe(node, struct riscv_pmu, node);
> -	struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events);
> -
> -	/*
> -	 * We keep enabling userspace access to CYCLE, TIME and INSTRET via the
> -	 * legacy option but that will be removed in the future.
> -	 */
> -	if (sysctl_perf_user_access == SYSCTL_LEGACY)
> -		csr_write(CSR_SCOUNTEREN, 0x7);
> -	else
> -		csr_write(CSR_SCOUNTEREN, 0x2);
> +	return pmu_sbi_ovf_handler(dev, get_irq_regs(), false, false);
> +}
>  
> -	/* Stop all the counters so that they can be enabled from perf */
> -	pmu_sbi_stop_all(pmu);
> +#ifdef CONFIG_RISCV_PMU_SBI_SSE
> +static int pmu_sbi_ovf_sse_handler(u32 evt, void *arg, struct pt_regs *regs)
> +{
> +	const struct riscv_sse_interrupted_context *context;
> +	struct riscv_pmu *pmu = arg;
> +	struct cpu_hw_events *hw_event = raw_cpu_ptr(pmu->hw_events);
> +	bool from_guest;
> +
> +	if (unlikely(!READ_ONCE(pmu->sse_active))) {
> +		pmu_sbi_sse_stop_all(pmu->cmask);
> +		return -EIO;
> +	}
>  
> -	if (riscv_pmu_use_irq) {
> -		cpu_hw_evt->irq = riscv_pmu_irq;
> -		ALT_SBI_PMU_OVF_CLEAR_PENDING(riscv_pmu_irq_mask);
> -		enable_percpu_irq(riscv_pmu_irq, IRQ_TYPE_NONE);
> +	if (unlikely(!regs)) {
> +		pmu_sbi_fail_sse(pmu, "read interrupted context for", -EIO);
> +		return -EIO;
>  	}

[Severity: High]
Does the !regs path in pmu_sbi_ovf_sse_handler() leave the overflowing
counter running when no perf event is mapped or when cpu_hw_evt->sse_failed
is already true?

Unlike pmu_sbi_ovf_handler(), which stops all counters via
pmu_sbi_sse_stop_all(cmask) when no event is installed and calls
pmu_sbi_stop_hw_ctrs(pmu) before checking pmu_sbi_sse_failed(),
pmu_sbi_fail_sse() only stops non-NULL entries in cpu_hw_evt->events[] and
returns immediately if cpu_hw_evt->sse_failed was already latched (for
example after a failed sse_event_disable_local()).  If an early or unmapped
counter overflows after pmu_sbi_setup_sse() enables the event during probe,
or an overflow arrives after sse_failed is set, returning with the counter
still overflowing will cause firmware to immediately re-deliver the NMI-like
SSE event on SBI_SSE_EVENT_COMPLETE.

[ ... ]

> +static int pmu_sbi_setup_sse(struct riscv_pmu *pmu)
> +{
> +	int ret;
> +	struct sse_event *evt;
>  
> -	/* Disable all counters access for user mode now */
> -	csr_write(CSR_SCOUNTEREN, 0x0);
> +	evt = sse_event_register(SBI_SSE_EVENT_LOCAL_PMU_OVERFLOW, 0,
> +				 pmu_sbi_ovf_sse_handler, pmu);
> +	if (IS_ERR(evt))
> +		return PTR_ERR(evt);
> +	pmu->sse_evt = evt;
>  
> -	if (sbi_pmu_snapshot_available())
> -		return pmu_sbi_snapshot_disable();
> +	ret = sse_event_enable(evt);
> +	if (ret) {
> +		int cleanup_ret;
>  
> -	return 0;
> +		cleanup_ret = sse_event_disable(evt);
> +		if (cleanup_ret) {
> +			pr_warn("failed to disable SSE event after setup error: %d\n",
> +				cleanup_ret);
> +			return cleanup_ret;
> +		}
> +
> +		cleanup_ret = sse_event_unregister(evt);
> +
> +		if (cleanup_ret) {
> +			pr_warn("failed to unregister SSE event: %d\n",
> +				cleanup_ret);
> +		} else {
> +			pmu->sse_evt = NULL;
> +		}
> +		return cleanup_ret ?: ret;
> +	}

[Severity: Medium]
If sse_event_enable() fails in pmu_sbi_setup_sse() and the rollback in
sse_event_disable() or sse_event_unregister() also fails, what transfers the
retained pmu->sse_evt to sse_event_cleanup()?

When pmu_sbi_setup_irqs() returns -EUCLEAN, pmu_sbi_device_probe() treats
the error as non-fatal and continues registering the PMU in counting-only
mode without calling riscv_pmu_destroy() -> pmu_sbi_cleanup_sse().  Because
sse_event_cleanup() is never called on pmu->sse_evt, evt->cleanup_pending
remains false, so the SSE core continues treating the event as active across
CPU hotplug and any counter wrap while pmu->sse_active is false will invoke
pmu_sbi_ovf_sse_handler() -> pmu_sbi_sse_stop_all(pmu->cmask), resetting
active counting counters.

> +
> +	WRITE_ONCE(pmu->sse_active, true);
> +	pr_info("using SSE for PMU event delivery\n");
> +
> +	return ret;
>  }
>  
> -static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pdev)
> +static void pmu_sbi_cleanup_sse(struct riscv_pmu *pmu)
>  {
> +	struct sse_event *sse_evt;
>  	int ret;
> -	struct cpu_hw_events __percpu *hw_events = pmu->hw_events;
> -	struct irq_domain *domain = NULL;
>  
> +	sse_evt = pmu->sse_evt;
> +	if (!sse_evt)
> +		return;
> +	/*
> +	 * Close callback admission before draining each CPU. PMU callbacks run
> +	 * with local interrupts disabled, so the synchronous IPI cannot complete
> +	 * until a callback that observed the old state has returned.
> +	 */
> +	WRITE_ONCE(pmu->sse_active, false);
> +	on_each_cpu(pmu_sbi_stop_all_cpu, pmu, 1);

[Severity: Medium]
Should pmu_sbi_stop_all_cpu() call pmu_sbi_sse_stop_all(pmu->cmask) instead
of the batch pmu_sbi_stop_all(pmu)?

pmu_sbi_stop_all() issues a batch SBI_EXT_PMU_COUNTER_STOP across
pmu->cmask, which can stop at an already-stopped lower-indexed counter and
return SBI_ERR_ALREADY_STOPPED before stopping higher-indexed active
counters.  If sse_event_disable() or sse_event_unregister() then fails and
branches to retain, sse_event_cleanup() replaces the handler with the no-op
sse_cleanup_event_handler(), leaving no handler to stop the counter source.

[ ... ]

> @@ -1289,14 +1601,17 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde
>  }
>  
>  #ifdef CONFIG_CPU_PM
> -static int riscv_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
> -				void *v)
> +static int riscv_pm_pmu_update(struct riscv_pmu *rvpmu, unsigned long cmd)
>  {
> -	struct riscv_pmu *rvpmu = container_of(b, struct riscv_pmu, riscv_pm_nb);
>  	struct cpu_hw_events *cpuc = this_cpu_ptr(rvpmu->hw_events);
>  	bool enabled = !bitmap_empty(cpuc->used_hw_ctrs, RISCV_MAX_COUNTERS);
>  	struct perf_event *event;
>  	int idx;
>  
> +	if (cmd == CPU_PM_ENTER)
> +		bitmap_zero(cpuc->pm_resume_hw_ctrs, RISCV_MAX_COUNTERS);
> +
>  	if (!enabled)
>  		return NOTIFY_OK;
>  
> @@ -1305,6 +1617,8 @@ static int riscv_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
>  
>  		switch (cmd) {
>  		case CPU_PM_ENTER:
> +			if (!(event->hw.state & PERF_HES_STOPPED))
> +				set_bit(idx, cpuc->pm_resume_hw_ctrs);
>  			/*
>  			 * Stop and update the counter
>  			 */
> @@ -1312,6 +1626,8 @@ static int riscv_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
>  			break;
>  		case CPU_PM_EXIT:
>  		case CPU_PM_ENTER_FAILED:
> +			if (!test_and_clear_bit(idx, cpuc->pm_resume_hw_ctrs))
> +				break;
>  			/*
>  			 * Restore and enable the counter.
>  			 */
> @@ -1325,9 +1641,59 @@ static int riscv_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
>  	return NOTIFY_OK;
>  }
>  
> +static int riscv_pm_pmu_notify(struct notifier_block *b,
> +			       unsigned long cmd, void *v)
> +{
> +	struct riscv_pmu *rvpmu = container_of(b, struct riscv_pmu,
> +						 riscv_pm_nb);
> +
> +#ifdef CONFIG_RISCV_PMU_SBI_SSE
> +	struct cpu_hw_events *cpuc = this_cpu_ptr(rvpmu->hw_events);
> +	int ret;
> +
> +	if (!riscv_pmu_use_irq && READ_ONCE(rvpmu->sse_active)) {
> +		switch (cmd) {
> +		case CPU_PM_ENTER:
> +			cpuc->pm_resume_sse =
> +				sse_event_is_enabled_local(rvpmu->sse_evt);
> +			if (cpuc->pm_resume_sse) {
> +				ret = sse_event_disable_local(rvpmu->sse_evt);
> +				if (ret) {
> +					cpuc->pm_resume_sse = false;
> +					pmu_sbi_fail_sse(rvpmu, "disable for CPU PM",
> +							 ret);
> +					return notifier_from_errno(ret);
> +				}
> +			}
> +			break;
> +		case CPU_PM_EXIT:
> +		case CPU_PM_ENTER_FAILED:
> +			ret = riscv_pm_pmu_update(rvpmu, cmd);
> +			if (!cpuc->pm_resume_sse)
> +				return ret;
> +
> +			cpuc->pm_resume_sse = false;
> +			ret = sse_event_enable_local(rvpmu->sse_evt);
> +			if (ret) {
> +				pmu_sbi_fail_sse(rvpmu, "enable after CPU PM", ret);
> +				return notifier_from_errno(ret);
> +			}
> +			return NOTIFY_OK;
> +		default:
> +			break;
> +		}
> +	}
> +#endif

[Severity: Medium]
Should riscv_pm_pmu_notify() check READ_ONCE(cpuc->sse_failed) before
performing local SSE transitions?

If pmu_sbi_fail_sse() is triggered while the local SSE event is enabled (for
example when regs is NULL in pmu_sbi_ovf_sse_handler() or when
sse_event_disable_local() fails in pmu_sbi_sse_disable()), reg_evt->is_enabled
remains true.  On the next CPU_PM_ENTER, riscv_pm_pmu_notify() sees
sse_event_is_enabled_local() == true and tries to disable the event: if that
succeeds, CPU_PM_EXIT re-enables the failed SSE event in firmware; if it
keeps failing, every CPU_PM_ENTER returns notifier_from_errno(ret) and
aborts CPU idle entry.

[Severity: Medium]
What happens on the next CPU_PM_ENTER if sse_events_unmask() fails during
CPU_PM_EXIT?

When sse_events_unmask() fails on CPU_PM_EXIT, sse_pm_notifier() returns
notifier_from_errno(ret) and stops the notifier chain before the
lower-priority riscv_pm_pmu_notify() runs, leaving rvpmu->sse_evt disabled
and the counters stopped with PERF_HES_STOPPED (without setting
cpuc->sse_failed).  On the next CPU_PM_ENTER, riscv_pm_pmu_notify()
overwrites cpuc->pm_resume_sse with false and riscv_pm_pmu_update() zeroes
cpuc->pm_resume_hw_ctrs while skipping the stopped counters, so subsequent
CPU_PM_EXIT calls never restore the counters or re-enable the SSE event.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119120824.13969-13-zhangzhanpeng.jasper@bytedance.com?part=8

  reply	other threads:[~2026-11-19 12:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 12:08 [PATCH v13 00/11] riscv: add SBI Supervisor Software Events support Zhanpeng Zhang
2026-11-19 12:08 ` [PATCH v13 01/11] riscv: add SBI SSE extension definitions Zhanpeng Zhang
2026-11-19 12:14   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 02/11] riscv: add support for SBI Supervisor Software Events extension Zhanpeng Zhang
2026-11-19 12:36   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 03/11] riscv: sse: mask events during shutdown and kexec Zhanpeng Zhang
2026-11-19 12:38   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 04/11] drivers: firmware: add riscv SSE support Zhanpeng Zhang
2026-11-19 12:38   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 05/11] riscv: mm: avoid enabling interrupts for nofault page faults Zhanpeng Zhang
2026-11-19 12:27   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 06/11] riscv: enable NMI-safe lockdep irqflags tracking Zhanpeng Zhang
2026-11-19 12:21   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 07/11] perf: RISC-V: support callchains with SSE delivery Zhanpeng Zhang
2026-11-19 12:08 ` [PATCH v13 08/11] perf: RISC-V: add support for SSE event Zhanpeng Zhang
2026-11-19 12:34   ` sashiko-bot [this message]
2026-11-19 12:08 ` [PATCH v13 09/11] MAINTAINERS: add RISC-V SSE maintainers and file coverage Zhanpeng Zhang
2026-11-19 12:08 ` [PATCH v13 10/11] selftests/riscv: add SSE test module Zhanpeng Zhang
2026-11-19 12:37   ` sashiko-bot
2026-11-19 12:08 ` [PATCH v13 11/11] selftests/riscv: add perf user-stack SSE copy regression test Zhanpeng Zhang
2026-11-19 12:34   ` sashiko-bot

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=sashiko-outbox-223092@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhangzhanpeng.jasper@bytedance.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