Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: "Belgaumkar, Vinay" <vinay.belgaumkar@intel.com>,
	<intel-xe@lists.freedesktop.org>,
	 Riana Tauro <riana.tauro@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v3] drm/xe/pmu: Add GT frequency events
Date: Sat, 22 Mar 2025 14:06:09 -0700	[thread overview]
Message-ID: <87o6xsai7y.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <azol66l3wmb6r6cy6kh2j5ooglx25bduwj2ybifdxtpvpej23d@jxw766ana4kv>

On Sat, 22 Mar 2025 05:57:12 -0700, Lucas De Marchi wrote:
>
> On Fri, Mar 21, 2025 at 03:45:21PM -0700, Belgaumkar, Vinay wrote:
> >
> > On 3/13/2025 2:45 PM, Lucas De Marchi wrote:
> >> On Tue, Mar 11, 2025 at 05:14:08PM -0700, Vinay Belgaumkar wrote:
> >>> Define PMU events for GT frequency (actual and requested). This is
> >>> a port from the i915 driver implementation, where an internal timer
> >>> is used to aggregate GT frequencies over certain fixed interval.
> >>> Following PMU events are being added-
> >>                      ^
> >> why do you use "-"  instead of ":"?
> >>
> >>>
> >>>  xe_0000_00_02.0/gt-actual-frequency/              [Kernel PMU event]
> >>>  xe_0000_00_02.0/gt-requested-frequency/           [Kernel PMU event]
> >>>
> >>> Standard perf commands can be used to monitor GT frequency-
> >>>  $ perf stat -e xe_0000_00_02.0/gt-requested-frequency,gt=0/ -I1000
> >>>
> >>>     1.001175175                700 M xe/gt-requested-frequency,gt=0/
> >>>     2.005891881                703 M xe/gt-requested-frequency,gt=0/
> >>>     3.007318169                700 M xe/gt-requested-frequency,gt=0/
> >>>
> >>> Actual frequencies will be reported as 0 when GT is in C6.
> >>
> >>
> >> I think we need to document somewhere, but at the very least in the
> >> commit message what the event count actually is. Let me see if I get
> >> this right:  if userspace is sampling every 1sec, and assuming the gpu
> >> is at 700MHz for the first 0.5sec and at 1.4 GHz, userspace should
> >> expect to see ~1050 as the value. Correct?  I find this frequency
> >> handling very different from anything else reported via perf. Other
> >> than i915, are there any other cases you know of?
> >
> > Yes,  user will see a gradual ramp. One thing that could work is
> > something along these lines:
> >
> > @@ -324,7 +327,10 @@ static void xe_pmu_event_update(struct perf_event
> > *event)
> >                 new = __xe_pmu_event_read(event);
> >         } while (!local64_try_cmpxchg(&hwc->prev_count, &prev, new));
> >
> > -       local64_add(new - prev, &event->count);
> > +       if (is_gt_frequency_event(id))
> > +               local64_add(new, &event->count);
> > +       else
> > +               local64_add(new - prev, &event->count);
> >
> > This will give us instantaneous values and will not need the use of an
> > internal timer.  Should be ok to do it this way?
>
> yes, I think it'd be preferred. It's much simpler and don't prevent us
> from eventually adding an avg_* event if the needs arise. Which would
> also be clearer on what that is.

Instantaneous values would show 0 if the sampling instant landed when gt is
in C6. Also instantaneous values are already available via sysfs.

Also, the way i915 calculates the average freq is itself
controversial. i915 computes average freq when gt is awake and disregards
those intervals when gt is in C6. There was this patch to suggest that
average freq also take into account those intervals when gt is in C6:

https://patchwork.freedesktop.org/series/109372/

But it was not accepted since it would change uapi.

  reply	other threads:[~2025-03-22 21:06 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12  0:14 [PATCH v3] drm/xe/pmu: Add GT frequency events Vinay Belgaumkar
2025-03-12  0:23 ` ✓ CI.Patch_applied: success for drm/xe/pmu: Add GT frequency events (rev5) Patchwork
2025-03-12  0:24 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-12  0:25 ` ✓ CI.KUnit: success " Patchwork
2025-03-12  0:41 ` ✓ CI.Build: " Patchwork
2025-03-12  0:44 ` ✓ CI.Hooks: " Patchwork
2025-03-12  0:45 ` ✓ CI.checksparse: " Patchwork
2025-03-12  1:06 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-12 16:31 ` ✗ Xe.CI.Full: failure " Patchwork
2025-03-13 14:27 ` [PATCH v3] drm/xe/pmu: Add GT frequency events Riana Tauro
2025-03-13 20:39   ` Belgaumkar, Vinay
2025-03-13 21:45 ` Lucas De Marchi
2025-03-21 22:45   ` Belgaumkar, Vinay
2025-03-22 12:57     ` Lucas De Marchi
2025-03-22 21:06       ` Dixit, Ashutosh [this message]
2025-03-23  2:47         ` Lucas De Marchi
2025-03-24 16:24           ` Dixit, Ashutosh
2025-03-24 19:07             ` Lucas De Marchi
2025-03-24 20:09               ` Rodrigo Vivi
2025-03-24 22:14                 ` Belgaumkar, Vinay
2025-03-25  1:10                   ` Dixit, Ashutosh
2025-03-25  2:17                     ` Belgaumkar, Vinay
  -- strict thread matches above, loose matches on Subject: below --
2025-02-13  0:02 Vinay Belgaumkar
2025-02-25 17:47 ` Lucas De Marchi
2025-03-01  0:59   ` Belgaumkar, Vinay
2025-03-01  1:19     ` Lucas De Marchi
2025-03-01 22:56       ` Belgaumkar, Vinay
2025-03-06  1:47   ` Belgaumkar, Vinay

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=87o6xsai7y.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=vinay.belgaumkar@intel.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