[PATCH v5 09/11] coresight: etm4x: Add flag to control single-shot restart

Leo Yan leo.yan at arm.com
Tue Nov 11 01:24:03 PST 2025


On Mon, Nov 10, 2025 at 11:37:52AM +0000, Suzuki Kuruppassery Poulose wrote:

[...]

> > -static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
> > +static int etm4_enable_hw(struct etmv4_drvdata *drvdata, bool restart_ss)
> 
> While this looks to work, I wonder if we could manage this all in the config
> ? i.e.,
> 
> Use an extra field, say config->retain_single_shot_status, which defaults to
> 0 and is always cleared once we pass through enable_hw.

This is fine for me in general.  I agree that adding an argument in
etm4_enable_hw() is not scalable, though we can take a bit advantage
of stack push and pop so no need cleanup.

Before proceed, I would check another idea.  Can we do this with
is_idle_task()?

  if (!is_idle_task(current)) {
      if (config->ss_ctrl[i] || config->ss_pe_cmp[i])
          config->ss_status[i] &= ~TRCSSCSRn_STATUS;
  }

As a result, we can avoid new flag and extra operatoins (set/clear) for
the added flag.

Note, this does not only impact CPU idle flow, this also applies on CPU
hotplug flow (as CPU hotplug callback also runs in idle thread).  I
think this would be fine, no matter CPU idle or hotplug, we keep the
single-shot state after the CPU resume back.

Thoughts?

Thanks,
Leo



More information about the linux-arm-kernel mailing list