On Thu, Oct 16, 2025 at 04:36:23PM -0700, Umesh Nerlige Ramappa wrote: > On Thu, Oct 16, 2025 at 01:07:17PM -0700, Dixit, Ashutosh wrote: > > On Wed, 15 Oct 2025 17:03:51 -0700, Umesh Nerlige Ramappa wrote: > > > > > > When tick values are large, the multiplication by NSEC_PER_SEC is larger > > > than 64 bits and results in bad conversions. > > > > > > The issue is seen in PMU busyness counters that look like they have > > > wrapped around due to bad conversion. i915 PMU implementation returns > > > monotonically increasing counters. If a count is lesser than previous > > > one, it will only return the larger value until the smaller value > > > catches up. The user will see this as zero delta between two > > > measurements even though the engines are busy. > > > > > > Fix it by using mul_u64_u32_div() > > > > Reviewed-by: Ashutosh Dixit <[email protected]> > > Thanks, Pushed it. > > @Lucas, @Rodrigo > > fyi, > > I was working on drm-intel-gt-next and did a dim ub at some point and it > automatically switched to drm-xe-next. Instead of pushing drm-intel-gt-next, > I accidentally pushed drm-xe-next without any changes. Hope that does not > cause any issues.
I'm kind of confused here.... I was going to force-push this out of drm-xe-next. But it is not there. Unless Lucas was faster than me... In any case, please go to your drm-xe-next repository and run git fetch drm-xe && git reset --hard drm-xe/drm-xe-next just in case it is only applied but not pushed yet, so you don't end up really pushing it on your next dim push. > > I later pushed the right branch. yeap, this one in the drm-intel-gt-next I can see. > > Regards, > Umesh > > > > > Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14955 > > > Signed-off-by: Umesh Nerlige Ramappa <[email protected]> > > > --- > > > v2: > > > - Fix divide by zero for Gen11 (Andi) > > > - Update commit message > > > > > > v3: > > > - Drop GCD and use mul_u64_u32_div() instead (Ashutosh) > > > --- > > > drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c > > > b/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c > > > index 88b147fa5cb1..c90b35881a26 100644 > > > --- a/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c > > > +++ b/drivers/gpu/drm/i915/gt/intel_gt_clock_utils.c > > > @@ -205,7 +205,7 @@ static u64 div_u64_roundup(u64 nom, u32 den) > > > > > > u64 intel_gt_clock_interval_to_ns(const struct intel_gt *gt, u64 count) > > > { > > > - return div_u64_roundup(count * NSEC_PER_SEC, gt->clock_frequency); > > > + return mul_u64_u32_div(count, NSEC_PER_SEC, gt->clock_frequency); > > > } > > > > > > u64 intel_gt_pm_interval_to_ns(const struct intel_gt *gt, u64 count) > > > @@ -215,7 +215,7 @@ u64 intel_gt_pm_interval_to_ns(const struct intel_gt > > > *gt, u64 count) > > > > > > u64 intel_gt_ns_to_clock_interval(const struct intel_gt *gt, u64 ns) > > > { > > > - return div_u64_roundup(gt->clock_frequency * ns, NSEC_PER_SEC); > > > + return mul_u64_u32_div(ns, gt->clock_frequency, NSEC_PER_SEC); > > > } > > > > > > u64 intel_gt_ns_to_pm_interval(const struct intel_gt *gt, u64 ns) > > > -- > > > 2.43.0 > > >
