[PATCH v9 2/8] drm/xe/uapi: Introduce API for EU stall sampling

Jani Nikula jani.nikula at linux.intel.com
Tue Feb 18 11:54:49 UTC 2025


On Sat, 15 Feb 2025, "Dixit, Ashutosh" <ashutosh.dixit at intel.com> wrote:
> On Sat, 15 Feb 2025 17:49:16 -0800, Harish Chegondi wrote:
>>
>> > > > > +struct eu_stall_open_properties {
>> > > > > +	unsigned int sampling_rate_mult;
>> > > > > +	unsigned int wait_num_reports;
>> > > >
>> > > > I already said no need to be so specific. Just use int or u32 as types for
>> > > > these.
>> > > Okay, will try to change these back to u8/u32 in the next version.
>> >
>> > Use int or u32, not u8.
>> Any reason why I can't use u8? The maximum value of sampling_rate_mult
>> is 7.

There is zero benefit in using a smaller type just because you think
your value range fits the type.

Default to using an int. You need a reason to use smaller types or
unsigned, not the other way round.

For example, many hardware registers are u32. That's a good reason to
use u32 when reading/writing registers. Sometimes reducing the memory
footprint matters, and you may want to use a smaller type. Likely not
the case here.


BR,
Jani.


>
> Use whatever you want. The real question to ask is why can't we use a
> generic type like int? Whether you use u8 or int, the CPU will still fetch
> a 64 byte cacheline. And this structure is only used at initialization, so
> performance is not a concern.

-- 
Jani Nikula, Intel


More information about the Intel-xe mailing list