Re: [PATCH 5/7] x86/mmu: Allocate/free PASID

From: Thomas Gleixner
Date: Mon Apr 27 2020 - 19:44:48 EST


Fenghua Yu <fenghua.yu@xxxxxxxxx> writes:
> On Sun, Apr 26, 2020 at 04:55:25PM +0200, Thomas Gleixner wrote:
>> Fenghua Yu <fenghua.yu@xxxxxxxxx> writes:
>> > + +#ifdef CONFIG_INTEL_IOMMU_SVM + int pasid;
>>
>> int? It's a value which gets programmed into the MSR along with the valid
>> bit (bit 31) set.
>
> The pasid is defined as "int" in struct intel_svm and in
> intel_svm_bind_mm() and intel_svm_unbind_mm(). So the pasid defined in this
> patch follows the same type defined in those places.

Which are wrong to begin with.

>> ioasid_alloc() uses ioasid_t which is
>>
>> typedef unsigned int ioasid_t;
>>
>> Can we please have consistent types and behaviour all over the place?
>
> Should I just define "pasid", "pasid_max", "flags" as "unsigned int" for
> the new functions/code?
>
> Or should I also change their types to "unsigned int" in the original
> svm code (struct intel_svm, ...bind_mm(), etc)? I'm afraid that will be
> a lot of changes and should be in a separate preparation patch.

Yes, please. The existance of non-sensical code is not an excuse to
proliferate it.

Thanks,

tglx