Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2024-01-14 Thread Joel Granados
On Sun, Jan 14, 2024 at 09:13:19PM +0800, Baolu Lu wrote: > On 2024/1/13 5:56, Joel Granados wrote: > > On Thu, Oct 26, 2023 at 10:49:24AM +0800, Lu Baolu wrote: > >> Hi folks, > >> > >> This series implements the functionality of delivering IO page faults to

Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2024-01-12 Thread Joel Granados
u/iommufd/hw_pagetable.c | 260 +- > drivers/iommu/iommufd/selftest.c | 56 > tools/testing/selftests/iommu/iommufd.c | 24 +- > .../selftests/iommu/iommufd_fail_nth.c| 2 +- > 12 files changed, 620 insertions(+), 16 deletions(-) > > -- > 2.34.1 > -- Joel Granados signature.asc Description: PGP signature

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-20 Thread Joel Granados
On Tue, Dec 19, 2023 at 05:26:21PM +0800, Yi Liu wrote: > On 2023/12/17 19:21, Joel Granados wrote: > > Hey Yi > > > > I have been working with > > https://protect2.fireeye.com/v1/url?k=b58750ce-ea1c9eaa-b586db81-000babda0201-365207d33731a099=1=ee73b69d-5c35-49ef-9e

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-17 Thread Joel Granados
iommufd: Add IOMMU_HWPT_INVALIDATE > > drivers/iommu/iommufd/hw_pagetable.c | 35 > drivers/iommu/iommufd/iommufd_private.h | 9 ++ > drivers/iommu/iommufd/iommufd_test.h | 22 + > drivers/iommu/iommufd/main.c | 3 + > drive

Re: [PATCH v2 3/6] iommufd: Initializing and releasing IO page fault data

2023-12-12 Thread Joel Granados
roup) > +{ > + struct iommufd_hw_pagetable *hwpt = group->domain->fault_data; > + > + mutex_lock(>fault->mutex); > + list_add_tail(>node, >fault->deliver); > + mutex_unlock(>fault->mutex); > + > + return 0; > +} > + > int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd) > { > struct iommufd_hw_pagetable *(*alloc_fn)( > @@ -364,6 +404,20 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd) > goto out_unlock; > } > > + if (cmd->flags & IOMMU_HWPT_ALLOC_IOPF_CAPABLE) { > + hwpt->fault = hw_pagetable_fault_alloc(); > + if (IS_ERR(hwpt->fault)) { > + rc = PTR_ERR(hwpt->fault); > + hwpt->fault = NULL; > + goto out_hwpt; > + } > + > + hwpt->fault->ictx = ucmd->ictx; > + hwpt->fault->hwpt = hwpt; > + hwpt->domain->iopf_handler = iommufd_hw_pagetable_iopf_handler; > + hwpt->domain->fault_data = hwpt; > + } > + > cmd->out_hwpt_id = hwpt->obj.id; > rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd)); > if (rc) > -- > 2.34.1 > -- Joel Granados signature.asc Description: PGP signature

Re: [PATCH v2 4/6] iommufd: Deliver fault messages to user space

2023-12-07 Thread Joel Granados
o, please get back to me if you need more information about how I got to this place. I have provided what I think is enough info, but I might be missing something obvious. Best > kfree(fault); > } > > @@ -347,7 +546,9 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd) > struct mutex *mutex; > int rc; > > - if (cmd->flags & ~IOMMU_HWPT_ALLOC_NEST_PARENT || cmd->__reserved) > + if ((cmd->flags & ~(IOMMU_HWPT_ALLOC_NEST_PARENT | > + IOMMU_HWPT_ALLOC_IOPF_CAPABLE)) || > + cmd->__reserved) > return -EOPNOTSUPP; > if (!cmd->data_len && cmd->hwpt_type != IOMMU_HWPT_TYPE_DEFAULT) > return -EINVAL; > @@ -416,6 +617,7 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd) > hwpt->fault->hwpt = hwpt; > hwpt->domain->iopf_handler = iommufd_hw_pagetable_iopf_handler; > hwpt->domain->fault_data = hwpt; > + cmd->out_fault_fd = hwpt->fault->fault_fd; > } > > cmd->out_hwpt_id = hwpt->obj.id; > -- > 2.34.1 > -- Joel Granados signature.asc Description: PGP signature

Re: [PATCH v2 0/6] IOMMUFD: Deliver IO page faults to user space

2023-12-04 Thread Joel Granados
| 50 > drivers/iommu/iommufd/device.c| 69 - > drivers/iommu/iommufd/hw_pagetable.c | 260 +- > drivers/iommu/iommufd/selftest.c | 56 > tools/testing/selftests/iommu/iommufd.c | 24 +- > .../selftests/iommu/iommufd_fail_nth.c| 2 +- > 12 files changed, 620 insertions(+), 16 deletions(-) > > -- > 2.34.1 > -- Joel Granados signature.asc Description: PGP signature

[PATCH 3/3] sysclt: Clarify the results of selftest run

2023-11-21 Thread Joel Granados via B4 Relay
From: Joel Granados In some cases the result of test were hidden inside the stdout and it was difficult to identify when a test was skipped and why. List of changes 1. Capitalize all the words that express a test result : "OK", "SKIPPED" and "FAIL". 2. Place a

[PATCH 0/3] sysctl: Fix out of bounds access for empty syscl ctl_tables

2023-11-21 Thread Joel Granados via B4 Relay
to more easily identify which ones are OK, Skipped and Failed. Comments are greatly appreciated Best Signed-off-by: Joel Granados --- Joel Granados (3): sysctl: Fix out of bounds access for empty sysctl registers sysctl: Add a selftest for handling empty dirs sysclt: Clarify

[PATCH 1/3] sysctl: Fix out of bounds access for empty sysctl registers

2023-11-21 Thread Joel Granados via B4 Relay
From: Joel Granados When registering tables to the sysctl subsystem there is a check to see if header is a permanently empty directory (used for mounts). This check evaluates the first element of the ctl_table. This results in an out of bounds evaluation when registering empty directories

[PATCH 2/3] sysctl: Add a selftest for handling empty dirs

2023-11-21 Thread Joel Granados via B4 Relay
From: Joel Granados Basic test to ensure that empty directories can be registered and that they in turn can serve as a base dir for other registrations. Add one test to the sysctl selftest module. It first registers an empty directory under "empty_add" and then uses that as a base t