All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: Joao Martins <joao.m.martins@oracle.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>, <iommu@lists.linux.dev>,
	Kevin Tian <kevin.tian@intel.com>,
	Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
	Lu Baolu <baolu.lu@linux.intel.com>, Yi Liu <yi.l.liu@intel.com>,
	Yi Y Sun <yi.y.sun@intel.com>, Joerg Roedel <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	"Zhenzhong Duan" <zhenzhong.duan@intel.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	<kvm@vger.kernel.org>
Subject: Re: [PATCH v5 00/18] IOMMUFD Dirty Tracking
Date: Mon, 23 Oct 2023 11:32:32 -0700	[thread overview]
Message-ID: <ZTa8QO9zmdt/bfcj@Asurada-Nvidia> (raw)
In-Reply-To: <f9178725-5706-4d56-b496-5f1bc1c48ef6@oracle.com>

On Mon, Oct 23, 2023 at 07:21:09PM +0100, Joao Martins wrote:
> External email: Use caution opening links or attachments
> 
> 
> On 23/10/2023 19:12, Nicolin Chen wrote:
> > On Mon, Oct 23, 2023 at 12:49:55PM +0100, Joao Martins wrote:
> >> Here's an example down that avoids the kernel header dependency; imported from
> >> the arch-independent non-atomic bitops
> >> (include/asm-generic/bitops/generic-non-atomic.h)
> >>
> >> diff --git a/tools/testing/selftests/iommu/iommufd.c
> >> b/tools/testing/selftests/iommu/iommufd.c
> >> index 96837369a0aa..026ff9f5c1f3 100644
> >> --- a/tools/testing/selftests/iommu/iommufd.c
> >> +++ b/tools/testing/selftests/iommu/iommufd.c
> >> @@ -12,7 +12,6 @@
> >>  static unsigned long HUGEPAGE_SIZE;
> >>
> >>  #define MOCK_PAGE_SIZE (PAGE_SIZE / 2)
> >> -#define BITS_PER_BYTE 8
> >>
> >>  static unsigned long get_huge_page_size(void)
> >>  {
> >> diff --git a/tools/testing/selftests/iommu/iommufd_utils.h
> >> b/tools/testing/selftests/iommu/iommufd_utils.h
> >> index 390563ff7935..6bbcab7fd6ab 100644
> >> --- a/tools/testing/selftests/iommu/iommufd_utils.h
> >> +++ b/tools/testing/selftests/iommu/iommufd_utils.h
> >> @@ -9,8 +9,6 @@
> >>  #include <sys/ioctl.h>
> >>  #include <stdint.h>
> >>  #include <assert.h>
> >> -#include <linux/bitmap.h>
> >> -#include <linux/bitops.h>
> >>
> >>  #include "../kselftest_harness.h"
> >>  #include "../../../../drivers/iommu/iommufd/iommufd_test.h"
> >> @@ -18,6 +16,24 @@
> >>  /* Hack to make assertions more readable */
> >>  #define _IOMMU_TEST_CMD(x) IOMMU_TEST_CMD
> >>
> >> +/* Imported from include/asm-generic/bitops/generic-non-atomic.h */
> >> +#define BITS_PER_BYTE 8
> >> +#define BITS_PER_LONG __BITS_PER_LONG
> >> +#define BIT_MASK(nr) (1UL << ((nr) % __BITS_PER_LONG))
> >> +#define BIT_WORD(nr) ((nr) / __BITS_PER_LONG)
> >> +
> >> +static inline void set_bit(unsigned int nr, unsigned long *addr)
> >
> > The whole piece could fix the break, except this one. We'd need
> > __set_bit instead of set_bit.
> >
> 
> I changed it set_bit in the caller of course

Can you confirm the test results too? I am seeing test failing
and BUG_ON since this commit:

1d2ac3b64486 (HEAD) iommufd/selftest: Test out_capabilities in IOMMU_GET_HW_INFO

-----logs-----
# ok 133 iommufd_dirty_tracking.domain_dirty128k.set_dirty_tracking
# #  RUN           iommufd_dirty_tracking.domain_dirty128k.device_dirty_capability ... 
# # iommufd.c:1577:device_dirty_capability:Expected IOMMU_HW_CAP_DIRTY_TRACKING (1) == caps & IOMMU_HW_CAP_DIRTY_TRACKING (0)
# # device_dirty_capability: Test terminated by assertion
.....
# # FAILED: 151 / 161 tests passed.

-----bug_on-----
[   29.209521] BUG: unable to handle page fault for address: 000056258adc0000
[   29.209771] #PF: supervisor read access in kernel mode
[   29.209965] #PF: error_code(0x0001) - permissions violation
[   29.210155] PGD 112975067 P4D 112975067 PUD 112976067 PMD 10e5a8067 PTE 800000010973b067
[   29.210446] Oops: 0001 [#1] SMP
[   29.210594] CPU: 1 PID: 857 Comm: iommufd Not tainted 6.6.0-rc2+ #1823
[   29.210842] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
[   29.211267] RIP: 0010:iommufd_test+0xb7a/0x1120 [iommufd]
[   29.211480] Code: 82 a8 00 00 00 4c 8b 7d 90 c7 45 98 00 00 00 00 4d 89 cd 4c 89 5d 88 4c 89 75 80 48 89 45 a8 4c 89 95 78 ff ff ff 48 8b 45 b8 <48> 0f a3 18 73 5e 48 8b 4d a8 31 d2 4c 89 e8 49 f7 f4 48 89 c6 48
[   29.212131] RSP: 0018:ffffc900029f7d70 EFLAGS: 00010206
[   29.212348] RAX: 000056258adc0000 RBX: 0000000000000000 RCX: ffff888104296498
[   29.212638] RDX: 0000000000000000 RSI: 0000000094904f49 RDI: ffff888103fa23c8
[   29.212928] RBP: ffffc900029f7e00 R08: 0000000000020000 R09: 0000000001000000
[   29.213214] R10: ffffc900029f7e10 R11: ffffc900029f7e30 R12: 0000000000000800
[   29.213501] R13: 0000000001000000 R14: ffff888104296400 R15: 0000000000000040
[   29.213786] FS:  00007f485e907740(0000) GS:ffff8881ba440000(0000) knlGS:0000000000000000
[   29.214072] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   29.214310] CR2: 000056258adc0000 CR3: 0000000112974001 CR4: 00000000003706a0
[   29.214592] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   29.214882] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   29.215171] Call Trace:
[   29.215265]  <TASK>
[   29.215358]  ? show_regs+0x5c/0x70
[   29.215496]  ? __die+0x1f/0x60
[   29.215638]  ? page_fault_oops+0x15d/0x440
[   29.215779]  ? exc_page_fault+0x4ca/0x9e0
[   29.215923]  ? lock_acquire+0xb8/0x2a0
[   29.216064]  ? asm_exc_page_fault+0x27/0x30
[   29.216207]  ? iommufd_test+0xb7a/0x1120 [iommufd]
[   29.216435]  ? should_fail_usercopy+0x15/0x20
[   29.216577]  iommufd_fops_ioctl+0x10d/0x190 [iommufd]
[   29.216725]  __x64_sys_ioctl+0x412/0x9b0
[   29.216823]  do_syscall_64+0x3c/0x80
[   29.216919]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
[   29.217050] RIP: 0033:0x7f485ea0d04f
[   29.217147] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00
[   29.217593] RSP: 002b:00007ffddef77ca0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[   29.217785] RAX: ffffffffffffffda RBX: 0000562588e29d60 RCX: 00007f485ea0d04f
[   29.217982] RDX: 00007ffddef77d30 RSI: 0000000000003ba0 RDI: 0000000000000005
[   29.218177] RBP: 0000562588e29038 R08: 4000000000000000 R09: 0000000000000008
[   29.218372] R10: 0000000000000001 R11: 0000000000000246 R12: 000056258adc0000
[   29.218567] R13: 0000000000000000 R14: 0000000000000040 R15: 0000562588e29d60
[   29.218772]  </TASK>
[   29.218835] Modules linked in: iommufd ib_umad rdma_ucm rdma_cm ib_ipoib iw_cm ib_cm mlx5_ib ib_uverbs ib_core mlx5_core
[   29.219117] CR2: 000056258adc0000
[   29.219216] ---[ end trace 0000000000000000 ]---



  reply	other threads:[~2023-10-23 18:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 22:27 [PATCH v5 00/18] IOMMUFD Dirty Tracking Joao Martins
2023-10-20 22:27 ` [PATCH v5 01/18] vfio/iova_bitmap: Export more API symbols Joao Martins
2023-10-20 22:27 ` [PATCH v5 02/18] vfio: Move iova_bitmap into iommufd Joao Martins
2023-10-20 22:27 ` [PATCH v5 03/18] iommufd/iova_bitmap: Move symbols to IOMMUFD namespace Joao Martins
2023-10-20 22:27 ` [PATCH v5 04/18] iommu: Add iommu_domain ops for dirty tracking Joao Martins
2023-10-20 22:27 ` [PATCH v5 05/18] iommufd: Add a flag to enforce dirty tracking on attach Joao Martins
2023-10-20 22:27 ` [PATCH v5 06/18] iommufd: Add IOMMU_HWPT_SET_DIRTY_TRACKING Joao Martins
2023-10-20 22:27 ` [PATCH v5 07/18] iommufd: Add IOMMU_HWPT_GET_DIRTY_BITMAP Joao Martins
2023-10-23  9:09   ` Arnd Bergmann
2023-10-23  9:28     ` Joao Martins
2023-10-23 12:10       ` Jason Gunthorpe
2023-10-23 12:41         ` Arnd Bergmann
2023-10-23 15:56           ` Joao Martins
2023-10-23 16:16             ` Jason Gunthorpe
2023-10-23 16:31               ` Joao Martins
2023-10-23 16:34                 ` Jason Gunthorpe
2023-10-23 17:55                   ` Joao Martins
2023-10-23 18:08                     ` Jason Gunthorpe
2023-10-20 22:27 ` [PATCH v5 08/18] iommufd: Add capabilities to IOMMU_GET_HW_INFO Joao Martins
2023-10-20 22:27 ` [PATCH v5 09/18] iommufd: Add a flag to skip clearing of IOPTE dirty Joao Martins
2023-10-20 22:27 ` [PATCH v5 10/18] iommu/amd: Add domain_alloc_user based domain allocation Joao Martins
2023-10-20 22:27 ` [PATCH v5 11/18] iommu/amd: Access/Dirty bit support in IOPTEs Joao Martins
2023-10-20 22:27 ` [PATCH v5 12/18] iommu/intel: Access/Dirty bit support for SL domains Joao Martins
2023-10-24 12:34   ` Yi Liu
2023-10-24 12:42     ` Joao Martins
2023-10-24 12:52       ` Joao Martins
2023-10-24 13:51         ` Yi Liu
2023-10-20 22:27 ` [PATCH v5 13/18] iommufd/selftest: Expand mock_domain with dev_flags Joao Martins
2023-10-20 22:28 ` [PATCH v5 14/18] iommufd/selftest: Test IOMMU_HWPT_ALLOC_DIRTY_TRACKING Joao Martins
2023-10-20 22:28 ` [PATCH v5 15/18] iommufd/selftest: Test IOMMU_HWPT_SET_DIRTY_TRACKING Joao Martins
2023-10-20 22:28 ` [PATCH v5 16/18] iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP Joao Martins
2023-10-23 20:08   ` Nicolin Chen
2023-10-23 20:15     ` Joao Martins
2023-10-23 20:37       ` Nicolin Chen
2023-10-23 20:50         ` Joao Martins
2023-10-23 21:46           ` Joao Martins
2023-10-23 21:56             ` Nicolin Chen
2023-10-20 22:28 ` [PATCH v5 17/18] iommufd/selftest: Test out_capabilities in IOMMU_GET_HW_INFO Joao Martins
2023-10-20 22:28 ` [PATCH v5 18/18] iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR flag Joao Martins
2023-10-21 16:23 ` [PATCH v5 00/18] IOMMUFD Dirty Tracking Jason Gunthorpe
2023-10-23  1:36   ` Nicolin Chen
2023-10-23  9:15     ` Joao Martins
2023-10-23 11:49       ` Joao Martins
2023-10-23 13:24         ` Jason Gunthorpe
2023-10-23 18:12         ` Nicolin Chen
2023-10-23 18:21           ` Joao Martins
2023-10-23 18:32             ` Nicolin Chen [this message]
2023-10-23 18:52               ` Joao Martins
2023-10-23 18:10       ` Nicolin Chen
2023-10-23 18:20         ` Joao Martins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTa8QO9zmdt/bfcj@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joao.m.martins@oracle.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.com \
    --cc=yi.y.sun@intel.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.