Re: [PATCH] selftests: iommu: add config needed for iommufd_fail_nth

From: Muhammad Usama Anjum
Date: Thu Apr 04 2024 - 07:48:27 EST


On 3/28/24 1:13 AM, Muhammad Usama Anjum wrote:
> On 3/27/24 11:20 PM, Jason Gunthorpe wrote:
>> On Wed, Mar 27, 2024 at 06:09:37PM +0000, Joao Martins wrote:
>>> On 27/03/2024 17:49, Muhammad Usama Anjum wrote:
>>>> On 3/27/24 7:59 PM, Joao Martins wrote:
>>>>> On 27/03/2024 11:49, Jason Gunthorpe wrote:
>>>>>> On Wed, Mar 27, 2024 at 03:14:25PM +0500, Muhammad Usama Anjum wrote:
>>>>>>> On 3/26/24 8:03 PM, Jason Gunthorpe wrote:
>>>>>>>> On Tue, Mar 26, 2024 at 06:09:34PM +0500, Muhammad Usama Anjum wrote:
>>>>>>>>> Even after applying this config patch and following snippet (which doesn't
>>>>>>>>> terminate the program if mmap doesn't allocate exactly as the hint), I'm
>>>>>>>>> finding failed tests.
>>>>>>>>>
>>>>>>>>> @@ -1746,7 +1748,7 @@ FIXTURE_SETUP(iommufd_dirty_tracking)
>>>>>>>>> assert((uintptr_t)self->buffer % HUGEPAGE_SIZE == 0);
>>>>>>>>> vrc = mmap(self->buffer, variant->buffer_size, PROT_READ | PROT_WRITE,
>>>>>>>>> mmap_flags, -1, 0);
>>>>>>>>> - assert(vrc == self->buffer);
>>>>>>>>> + assert(vrc == self->buffer);// ???
>>>>>>>>>
>>>>>>>>> On x86:
>>>>>>>>> # Totals: pass:176 fail:4 xfail:0 xpass:0 skip:0 error:0
>>>>>>>>> On ARM64:
>>>>>>>>> # Totals: pass:166 fail:14 xfail:0 xpass:0 skip:0 error:0
>>>>>>>>>
>>>>>>>>> The log files are attached.
>>>>>>>>
>>>>>>>> You probably don't have enough transparent huge pages available to the process
>>>>>>>>
>>>>>>>> echo 1024 > /proc/sys/vm/nr_hugepages
>>>>>>> After making huge pages available, the iommufd test always passed on x86.
>>>>>>> But there are still failures on arm64. I'm looking into the failures.
>>>>>>
>>>>>> Oh that is really strange. Joao? Nicolin?
>>>>>>
>>>>> Definitely strange, I'll have a look.
>>>>>
>>>>> So it set the expected number of dirty bits as that assert doesn't fail, but it
>>>>> is failing when we check that even bits are set but not odd ones. Like it's
>>>>> hasn't set those bits.
>>>>>
>>>>> For mock tests there should be no difference between x86 and ARM assuming the
>>>>> typical 4K page-size. Maybe this is 64k base pages in ARM? That's the only thing
>>>>> that I can think of that affected mock domain.
>>>> The config is attached. The defaults are being used i.e., 4k page.
>>>
>>> Looks like CONFIG_IOMMUFD_DRIVER is not defined :(
>>>
>>> Thus no bits are being set.
>>
>> Oh!
>>
>> --- a/drivers/iommu/iommufd/Kconfig
>> +++ b/drivers/iommu/iommufd/Kconfig
>> @@ -37,6 +37,7 @@ config IOMMUFD_TEST
>> depends on DEBUG_KERNEL
>> depends on FAULT_INJECTION
>> depends on RUNTIME_TESTING_MENU
>> + select IOMMUFD_DRIVER
>> default n
>> help
>> This is dangerous, do not enable unless running
>>
> Tested this patch on my system and it fixes all issues for ARM64. Please
> add tag for this Kconfig patch:
> Tested by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
>
> Also please accept the patch in this current series.
Please let me know if you need me to send the config patch. Please accept
the config patch as well.

>>
>> ???
>>
>> Jason
>

--
BR,
Muhammad Usama Anjum