2024-03-25 13:28:04

by Muhammad Usama Anjum

[permalink] [raw]
Subject: [PATCH] selftests: iommu: add config needed for iommufd_fail_nth

Add FAULT_INJECTION_DEBUG_FS and FAILSLAB configurations which are
needed by iommufd_fail_nth test.

Signed-off-by: Muhammad Usama Anjum <[email protected]>
---
While building and running these tests on x86, defconfig had these
configs enabled. But ARM64's defconfig doesn't enable these configs.
Hence the config options are being added explicitly in this patch.
---
tools/testing/selftests/iommu/config | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/iommu/config b/tools/testing/selftests/iommu/config
index 110d73917615d..02a2a1b267c1e 100644
--- a/tools/testing/selftests/iommu/config
+++ b/tools/testing/selftests/iommu/config
@@ -1,3 +1,5 @@
CONFIG_IOMMUFD=y
+CONFIG_FAULT_INJECTION_DEBUG_FS=y
CONFIG_FAULT_INJECTION=y
CONFIG_IOMMUFD_TEST=y
+CONFIG_FAILSLAB=y
--
2.39.2



2024-03-25 13:53:50

by Muhammad Usama Anjum

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

On 3/25/24 2:00 PM, Muhammad Usama Anjum wrote:
> Add FAULT_INJECTION_DEBUG_FS and FAILSLAB configurations which are
> needed by iommufd_fail_nth test.
>
> Signed-off-by: Muhammad Usama Anjum <[email protected]>
> ---
> While building and running these tests on x86, defconfig had these
> configs enabled. But ARM64's defconfig doesn't enable these configs.
> Hence the config options are being added explicitly in this patch.
Please disregard this extra comment. Overall this patch is needed to enable
these config options of x86 and ARM both.

> ---
> tools/testing/selftests/iommu/config | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/iommu/config b/tools/testing/selftests/iommu/config
> index 110d73917615d..02a2a1b267c1e 100644
> --- a/tools/testing/selftests/iommu/config
> +++ b/tools/testing/selftests/iommu/config
> @@ -1,3 +1,5 @@
> CONFIG_IOMMUFD=y
> +CONFIG_FAULT_INJECTION_DEBUG_FS=y
> CONFIG_FAULT_INJECTION=y
> CONFIG_IOMMUFD_TEST=y
> +CONFIG_FAILSLAB=y

--
BR,
Muhammad Usama Anjum

2024-03-26 13:09:24

by Muhammad Usama Anjum

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

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.

On 3/25/24 2:00 PM, Muhammad Usama Anjum wrote:
> Add FAULT_INJECTION_DEBUG_FS and FAILSLAB configurations which are
> needed by iommufd_fail_nth test.
>
> Signed-off-by: Muhammad Usama Anjum <[email protected]>
> ---
> While building and running these tests on x86, defconfig had these
> configs enabled. But ARM64's defconfig doesn't enable these configs.
> Hence the config options are being added explicitly in this patch.
> ---
> tools/testing/selftests/iommu/config | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/iommu/config b/tools/testing/selftests/iommu/config
> index 110d73917615d..02a2a1b267c1e 100644
> --- a/tools/testing/selftests/iommu/config
> +++ b/tools/testing/selftests/iommu/config
> @@ -1,3 +1,5 @@
> CONFIG_IOMMUFD=y
> +CONFIG_FAULT_INJECTION_DEBUG_FS=y
> CONFIG_FAULT_INJECTION=y
> CONFIG_IOMMUFD_TEST=y
> +CONFIG_FAILSLAB=y

--
BR,
Muhammad Usama Anjum


Attachments:
iommufd_arm.log (34.37 kB)
iommufd_x86.log (32.92 kB)
Download all attachments

2024-03-26 15:03:52

by Jason Gunthorpe

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

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

Jason

2024-03-27 10:14:39

by Muhammad Usama Anjum

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

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.

cat /proc/sys/vm/nr_hugepages
1024
/iommufd
..
# Totals: pass:166 fail:14 xfail:0 xpass:0 skip:0 error:0

>
> Jason
>

--
BR,
Muhammad Usama Anjum


Attachments:
iommufd_arm.log (34.15 kB)

2024-03-27 11:50:47

by Jason Gunthorpe

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

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?

> # RUN iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap ...
> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap
> not ok 139 iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap

> # RUN iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear ...
> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap_no_clear: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear
> not ok 140 iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear

> # RUN iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap ...
> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap
> not ok 144 iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap

> # RUN iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear ...
> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap_no_clear: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear
> not ok 145 iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear

> # RUN iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap ...
> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap
> not ok 149 iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap

> # RUN iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear ...
> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap_no_clear: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear
> not ok 150 iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear

> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap ...
> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap
> not ok 159 iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap

> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear ...
> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap_no_clear: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear
> not ok 160 iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear

> # RUN iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap ...
> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap
> not ok 164 iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap

> # RUN iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear ...
> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap_no_clear: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear
> not ok 165 iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear

> # RUN iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap ...
> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap
> not ok 169 iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap

> # RUN iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear ...
> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
> # get_dirty_bitmap_no_clear: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear
> not ok 170 iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear


2024-03-27 15:22:31

by Joao Martins

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

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.

Muhammad, could you paste your kconfig?

>> # RUN iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap ...
>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap
>> not ok 139 iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap
>
>> # RUN iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear ...
>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear
>> not ok 140 iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear
>
>> # RUN iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap ...
>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap
>> not ok 144 iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap
>
>> # RUN iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear ...
>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear
>> not ok 145 iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear
>
>> # RUN iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap ...
>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap
>> not ok 149 iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap
>
>> # RUN iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear ...
>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear
>> not ok 150 iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear
>
>> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap ...
>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap
>> not ok 159 iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap
>
>> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear ...
>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear
>> not ok 160 iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear
>
>> # RUN iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap ...
>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap
>> not ok 164 iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap
>
>> # RUN iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear ...
>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear
>> not ok 165 iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear
>
>> # RUN iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap ...
>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap
>> not ok 169 iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap
>
>> # RUN iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear ...
>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>> # FAIL iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear
>> not ok 170 iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear
>


2024-03-27 18:03:19

by Muhammad Usama Anjum

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

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.
>
> Muhammad, could you paste your kconfig?
>
>>> # RUN iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap ...
>>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap
>>> not ok 139 iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear ...
>>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear
>>> not ok 140 iommufd_dirty_tracking.domain_dirty128k.get_dirty_bitmap_no_clear
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap ...
>>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap
>>> not ok 144 iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear ...
>>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear
>>> not ok 145 iommufd_dirty_tracking.domain_dirty256k.get_dirty_bitmap_no_clear
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap ...
>>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap
>>> not ok 149 iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear ...
>>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear
>>> not ok 150 iommufd_dirty_tracking.domain_dirty640k.get_dirty_bitmap_no_clear
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap ...
>>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap
>>> not ok 159 iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear ...
>>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear
>>> not ok 160 iommufd_dirty_tracking.domain_dirty128M_huge.get_dirty_bitmap_no_clear
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap ...
>>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap
>>> not ok 164 iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear ...
>>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear
>>> not ok 165 iommufd_dirty_tracking.domain_dirty256M.get_dirty_bitmap_no_clear
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap ...
>>> # iommufd_utils.h:374:get_dirty_bitmap:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap
>>> not ok 169 iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap
>>
>>> # RUN iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear ...
>>> # iommufd_utils.h:374:get_dirty_bitmap_no_clear:Expected j < npte (1) == test_bit(i + j, (unsigned long *)bitmap) (0)
>>> # get_dirty_bitmap_no_clear: Test terminated by assertion
>>> # FAIL iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear
>>> not ok 170 iommufd_dirty_tracking.domain_dirty256M_huge.get_dirty_bitmap_no_clear
>>
>

--
BR,
Muhammad Usama Anjum


Attachments:
config-6.8.0-next-20240314-00001-gedd74cd6cdda-dirty (287.46 kB)

2024-03-27 18:14:40

by Joao Martins

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

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.

2024-03-27 18:18:25

by Muhammad Usama Anjum

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

On 3/27/24 11:09 PM, 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 :(
I'll retest with this config and update the patch to include it in the
config fragment needed for this test. Once we add all required config
options in config fragment, the test should never fail. Somehow this gets
included in the x86, but not on ARM.

>
> Thus no bits are being set.
>

--
BR,
Muhammad Usama Anjum

2024-03-27 18:21:01

by Jason Gunthorpe

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

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


???

Jason

2024-03-27 18:34:46

by Joao Martins

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

On 27/03/2024 18:20, 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
>
>
> ???

Yeap. It probably needs a:

Fixes: a9af47e382a ("iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP")


2024-03-27 18:47:59

by Joao Martins

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

On 27/03/2024 18:17, Muhammad Usama Anjum wrote:
> On 3/27/24 11:09 PM, 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 :(
> I'll retest with this config and update the patch to include it in the
> config fragment needed for this test. Once we add all required config
> options in config fragment, the test should never fail. Somehow this gets
> included in the x86, but not on ARM.

The option is automatically selected by an user of iova_bitmap_set(). x86 has
AMD and Intel IOMMUs which use it and auto selected (ARM64 doesn't yet, but soon
to be a reality). Some vfio drivers get it auto-selected it as well.

But I forgot to do the same thing for iommufd-test kconfig in commit a9af47e382a
("iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP") where mock domain also
uses iova_bitmap_set(). So your patch is likely not the right place to set
CONFIG_IOMMUFD_DRIVER=y.

See Jason's snip on auto-selecting if IOMMUFD_TEST is set.

2024-03-27 20:31:51

by Muhammad Usama Anjum

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

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 <[email protected]>

Also please accept the patch in this current series.
>
> ???
>
> Jason

--
BR,
Muhammad Usama Anjum

2024-04-04 11:48:25

by Muhammad Usama Anjum

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

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 <[email protected]>
>
> 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

2024-04-05 00:10:32

by Jason Gunthorpe

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

On Mon, Mar 25, 2024 at 02:11:41PM +0500, Muhammad Usama Anjum wrote:
> On 3/25/24 2:00 PM, Muhammad Usama Anjum wrote:
> > Add FAULT_INJECTION_DEBUG_FS and FAILSLAB configurations which are
> > needed by iommufd_fail_nth test.
> >
> > Signed-off-by: Muhammad Usama Anjum <[email protected]>
> > ---
> > While building and running these tests on x86, defconfig had these
> > configs enabled. But ARM64's defconfig doesn't enable these configs.
> > Hence the config options are being added explicitly in this patch.
> Please disregard this extra comment. Overall this patch is needed to enable
> these config options of x86 and ARM both.

I picked this and the other patch up, thanks

Jason

2024-04-14 14:39:38

by Muhammad Usama Anjum

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

On 4/5/24 5:10 AM, Jason Gunthorpe wrote:
> On Mon, Mar 25, 2024 at 02:11:41PM +0500, Muhammad Usama Anjum wrote:
>> On 3/25/24 2:00 PM, Muhammad Usama Anjum wrote:
>>> Add FAULT_INJECTION_DEBUG_FS and FAILSLAB configurations which are
>>> needed by iommufd_fail_nth test.
>>>
>>> Signed-off-by: Muhammad Usama Anjum <[email protected]>
>>> ---
>>> While building and running these tests on x86, defconfig had these
>>> configs enabled. But ARM64's defconfig doesn't enable these configs.
>>> Hence the config options are being added explicitly in this patch.
>> Please disregard this extra comment. Overall this patch is needed to enable
>> these config options of x86 and ARM both.
>
> I picked this and the other patch up, thanks
Not sure why but I'm unable to find this patch in next and in your tree:
https://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git/log/?h=for-next

Maybe this patch was missed?


>
> Jason
>

--
BR,
Muhammad Usama Anjum

2024-04-15 16:09:25

by Jason Gunthorpe

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

On Sun, Apr 14, 2024 at 07:39:58PM +0500, Muhammad Usama Anjum wrote:
> On 4/5/24 5:10 AM, Jason Gunthorpe wrote:
> > On Mon, Mar 25, 2024 at 02:11:41PM +0500, Muhammad Usama Anjum wrote:
> >> On 3/25/24 2:00 PM, Muhammad Usama Anjum wrote:
> >>> Add FAULT_INJECTION_DEBUG_FS and FAILSLAB configurations which are
> >>> needed by iommufd_fail_nth test.
> >>>
> >>> Signed-off-by: Muhammad Usama Anjum <[email protected]>
> >>> ---
> >>> While building and running these tests on x86, defconfig had these
> >>> configs enabled. But ARM64's defconfig doesn't enable these configs.
> >>> Hence the config options are being added explicitly in this patch.
> >> Please disregard this extra comment. Overall this patch is needed to enable
> >> these config options of x86 and ARM both.
> >
> > I picked this and the other patch up, thanks
> Not sure why but I'm unable to find this patch in next and in your tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git/log/?h=for-next
>
> Maybe this patch was missed?

ah I made some mistakes, all sorted thanks

Jason