[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e01e321d-d4ea-fcec-a3dc-16e641e49056@linux.intel.com>
Date: Thu, 10 Dec 2020 17:09:33 +0000
From: Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Jerry Snitselaar <jsnitsel@...hat.com>,
linux-kernel@...r.kernel.org,
Tvrtko Ursulin <tvrtko.ursulin@...el.com>,
Chris Wilson <chris@...is-wilson.co.uk>
Cc: Jason Gunthorpe <jgg@...pe.ca>,
Peter Zijlstra <peterz@...radead.org>,
intel-gfx@...ts.freedesktop.org,
Matthew Garrett <mjg59@...gle.com>,
James Bottomley <James.Bottomley@...senPartnership.com>,
David Airlie <airlied@...ux.ie>,
Jarkko Sakkinen <jarkko@...nel.org>,
dri-devel@...ts.freedesktop.org, linux-integrity@...r.kernel.org,
Peter Huewe <peterhuewe@....de>
Subject: Re: [Intel-gfx] [PATCH v3 2/4] drm/i915/pmu: Use kstat_irqs to get
interrupt count
On 10/12/2020 16:35, Thomas Gleixner wrote:
> On Thu, Dec 10 2020 at 10:45, Tvrtko Ursulin wrote:
>> On 10/12/2020 07:53, Joonas Lahtinen wrote:
>>> I think later in the thread there was a suggestion to replace this with
>>> simple counter increment in IRQ handler.
>>
>> It was indeed unsafe until recent b00bccb3f0bb ("drm/i915/pmu: Handle
>> PCI unbind") but now should be fine.
>>
>> If kstat_irqs does not get exported it is easy enough for i915 to keep a
>> local counter. Reasoning was very infrequent per cpu summation is much
>> cheaper than very frequent atomic add. Up to thousands of interrupts per
>> second vs "once per second" PMU read kind of thing.
>
> Why do you need a atomic_add? It's ONE interrupt which can only be
> executed on ONE CPU at a time. Interrupt handlers are non-reentrant.
>
> The core code function will just return an accumulated counter nowadays
> which is only 32bit wide, which is what the interface provided forever.
> That needs to be fixed first.
>
> Aside of that the accounting is wrong when the interrupt line is shared
> because the core accounts interrupt per line not per device sharing the
> line. Don't know whether you care or not.
>
> I'll send out a series addressing irq_to_desc() (ab)use all over the
> place shortly. i915 is in there...
Yep we don't need atomic, my bad. And we would care about the shared
interrupt line. And without atomic the extra accounting falls way below
noise.
So in the light of it all, it sounds best I just quickly replace our
abuse with private counting and then you don't have to deal with it in
your series.
Regards,
Tvrtko
Powered by blists - more mailing lists