From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Welty, Brian" <brian.welty@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v2 45/50] drm/xe/uapi: Remove bogus engine list from the wait_user_fence IOCTL
Date: Thu, 9 Nov 2023 13:56:57 -0500 [thread overview]
Message-ID: <ZU0reeajpBgzq9in@intel.com> (raw)
In-Reply-To: <e19494be-fd50-4aad-bdc0-44e9901fec37@intel.com>
On Tue, Nov 07, 2023 at 04:05:54PM -0800, Welty, Brian wrote:
>
>
> On 11/3/2023 7:34 AM, Francois Dugast wrote:
> > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> >
> > Right now this is only checking if the engine list is sane and nothing
> > else. In the end every operation with this IOCTL is a soft check.
> > So, let's formalize that and only use this IOCTL to wait on the fence.
> >
> > Upon timeout, userspace need then to inspect the engine properties
> > like BAN, in order to determine the reset status and any other
> > information that can be (or be added) there.
>
> I think the point of a per-engine wait was for long-running context?
> In that case, a large timeout value would be specified... and then if
> engine is reset (due to hang for example), it would abort the wait_ufence
> early and return some error other than -ETIME.
> But as you say, understand this is not even implemented right now so
> makes sense to delete it.
>
> If this is indeed needed in future, this can be restored again using
> the drm_xe_wait_user_fence.extensions, correct?
yes, we could do that. or even returning earlier with a different error
wouldn't break the compatibility, and then the userspace inspecting the
engine status with the properties.
>
> -Brian
>
> >
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_wait_user_fence.c | 56 +------------------------
> > include/uapi/drm/xe_drm.h | 17 +-------
> > 2 files changed, 3 insertions(+), 70 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> > index dcbb1c578b22..a9d231548498 100644
> > --- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
> > +++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
> > @@ -58,29 +58,7 @@ static const enum xe_engine_class user_to_xe_engine_class[] = {
> > [DRM_XE_ENGINE_CLASS_COMPUTE] = XE_ENGINE_CLASS_COMPUTE,
> > };
> > -static int check_hw_engines(struct xe_device *xe,
> > - struct drm_xe_engine_class_instance *eci,
> > - int num_engines)
> > -{
> > - int i;
> > -
> > - for (i = 0; i < num_engines; ++i) {
> > - enum xe_engine_class user_class =
> > - user_to_xe_engine_class[eci[i].engine_class];
> > -
> > - if (eci[i].sched_group_id >= xe->info.tile_count)
> > - return -EINVAL;
> > -
> > - if (!xe_gt_hw_engine(xe_device_get_gt(xe, eci[i].sched_group_id),
> > - user_class, eci[i].engine_instance, true))
> > - return -EINVAL;
> > - }
> > -
> > - return 0;
> > -}
> > -
> > -#define VALID_FLAGS (DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP | \
> > - DRM_XE_UFENCE_WAIT_FLAG_ABSTIME)
> > +#define VALID_FLAGS (DRM_XE_UFENCE_WAIT_FLAG_ABSTIME)
> > #define MAX_OP DRM_XE_UFENCE_WAIT_OP_LTE
> > static long to_jiffies_timeout(struct xe_device *xe,
> > @@ -132,12 +110,8 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
> > struct xe_device *xe = to_xe_device(dev);
> > DEFINE_WAIT_FUNC(w_wait, woken_wake_function);
> > struct drm_xe_wait_user_fence *args = data;
> > - struct drm_xe_engine_class_instance eci[XE_HW_ENGINE_MAX_INSTANCE];
> > - struct drm_xe_engine_class_instance __user *user_eci =
> > - u64_to_user_ptr(args->instances);
> > u64 addr = args->addr;
> > int err;
> > - bool no_engines = args->flags & DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP;
> > long timeout;
> > ktime_t start;
> > @@ -151,41 +125,13 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,
> > if (XE_IOCTL_DBG(xe, args->op > MAX_OP))
> > return -EINVAL;
> > - if (XE_IOCTL_DBG(xe, no_engines &&
> > - (args->num_engines || args->instances)))
> > - return -EINVAL;
> > -
> > - if (XE_IOCTL_DBG(xe, !no_engines && !args->num_engines))
> > - return -EINVAL;
> > -
> > if (XE_IOCTL_DBG(xe, addr & 0x7))
> > return -EINVAL;
> > - if (XE_IOCTL_DBG(xe, args->num_engines > XE_HW_ENGINE_MAX_INSTANCE))
> > - return -EINVAL;
> > -
> > - if (!no_engines) {
> > - err = copy_from_user(eci, user_eci,
> > - sizeof(struct drm_xe_engine_class_instance) *
> > - args->num_engines);
> > - if (XE_IOCTL_DBG(xe, err))
> > - return -EFAULT;
> > -
> > - if (XE_IOCTL_DBG(xe, check_hw_engines(xe, eci,
> > - args->num_engines)))
> > - return -EINVAL;
> > - }
> > -
> > timeout = to_jiffies_timeout(xe, args);
> > start = ktime_get();
> > - /*
> > - * FIXME: Very simple implementation at the moment, single wait queue
> > - * for everything. Could be optimized to have a wait queue for every
> > - * hardware engine. Open coding as 'do_compare' can sleep which doesn't
> > - * work with the wait_event_* macros.
> > - */
> > add_wait_queue(&xe->ufence_wq, &w_wait);
> > for (;;) {
> > err = do_compare(addr, args->value, args->mask, args->op);
> > diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> > index 757e6da97f87..aada6f75b905 100644
> > --- a/include/uapi/drm/xe_drm.h
> > +++ b/include/uapi/drm/xe_drm.h
> > @@ -1278,8 +1278,7 @@ struct drm_xe_wait_user_fence {
> > /** @op: wait operation (type of comparison) */
> > __u16 op;
> > -#define DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP (1 << 0) /* e.g. Wait on VM bind */
> > -#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 1)
> > +#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 0)
> > /** @flags: wait flags */
> > __u16 flags;
> > @@ -1312,20 +1311,8 @@ struct drm_xe_wait_user_fence {
> > */
> > __s64 timeout;
> > - /**
> > - * @num_engines: number of engine instances to wait on, must be zero
> > - * when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set
> > - */
> > - __u64 num_engines;
> > -
> > - /**
> > - * @instances: user pointer to array of drm_xe_engine_class_instance to
> > - * wait on, must be NULL when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set
> > - */
> > - __u64 instances;
> > -
> > /** @reserved: Reserved */
> > - __u64 reserved[2];
> > + __u64 reserved[4];
> > };
> > /**
next prev parent reply other threads:[~2023-11-09 18:57 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-03 14:34 [Intel-xe] [PATCH v2 00/50] uAPI Alignment - take 2 Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 01/50] fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy Francois Dugast
2023-11-07 16:26 ` Lucas De Marchi
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 02/50] drm/xe/uapi: Add documentation for query Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 03/50] drm/xe: Extend drm_xe_vm_bind_op Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 04/50] drm/xe: Add uAPI to query micro-controler firmware version Francois Dugast
2023-11-09 15:37 ` Souza, Jose
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 05/50] drm/xe/uapi: Document DRM_XE_DEVICE_QUERY_HWCONFIG Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 06/50] drm/xe: Extend uAPI to query HuC micro-controler firmware version Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 07/50] drm/xe: Remove useless query config num_params Francois Dugast
2023-11-07 15:49 ` Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 08/50] drm/xe/uapi: Add missing DRM_ prefix in uAPI constants Francois Dugast
2023-11-07 14:05 ` Matthew Brost
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 09/50] drm/xe/uapi: Add _FLAG to uAPI constants usable for flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 10/50] fixup! drm/xe: Add uAPI to query micro-controler firmware version Francois Dugast
2023-11-07 14:07 ` Matthew Brost
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 11/50] drm/xe/uapi: Make constant comments visible in kernel doc Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 12/50] fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 13/50] drm/xe/uapi: Remove GT_TYPE_REMOTE Francois Dugast
2023-11-03 23:35 ` Matt Roper
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 14/50] drm/xe/uapi: Kill VM_MADVISE IOCTL Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 15/50] drm/xe/uapi: Separate bo_create placement from flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 16/50] drm/xe/uapi: Remove unused inaccessible memory region Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 17/50] drm/xe/uapi: Remove unused QUERY_CONFIG_MEM_REGION_COUNT Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 18/50] drm/xe/uapi: Remove unused QUERY_CONFIG_GT_COUNT Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 19/50] drm/xe/uapi: Rename *_mem_regions masks Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 20/50] drm/xe/uapi: Rename query's mem_usage to mem_regions Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 21/50] drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 22/50] drm/xe/uapi: Replace BO with GEM in documentation Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 23/50] drm/xe/pmu: Drop interrupt pmu event Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 24/50] xe/xe_bo: Reject bo creation of unaligned size Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 25/50] fixup! drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 26/50] drm/xe/uapi: Fix indentation issues that sometimes causes build warning Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 27/50] drm/xe/uapi: Order sections Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 28/50] drm/xe/uapi: More uAPI documentation additions and cosmetic updates Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 29/50] drm/xe/uapi: Split xe_sync types from flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 30/50] drm/xe/uapi: Standardize the FLAG naming and assignment Francois Dugast
2023-11-09 14:56 ` Matthew Brost
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 31/50] drm/xe/uapi: Differentiate WAIT_OP from WAIT_MASK Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 32/50] drm/xe/uapi: Move xe_exec after xe_exec_queue Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 33/50] fixup! drm/xe/uapi: Split xe_sync types from flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 34/50] drm/xe/uapi: Move memory_region masks from GT to engine Francois Dugast
2023-11-09 16:29 ` Souza, Jose
2023-11-09 16:35 ` Souza, Jose
2023-11-09 18:46 ` Rodrigo Vivi
2023-11-09 19:50 ` Souza, Jose
2023-11-09 21:04 ` Rodrigo Vivi
2023-11-16 3:31 ` Rodrigo Vivi
2023-11-16 16:15 ` Souza, Jose
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 35/50] drm/xe/uapi: Document the memory_region bitmask Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 36/50] drm/xe/uapi: Be more specific about the vm_bind prefetch region Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 37/50] drm/xe/uapi: Convert tile_mask to a pt_placement_hint Francois Dugast
2023-11-08 0:17 ` Welty, Brian
2023-11-09 18:55 ` Rodrigo Vivi
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 38/50] drm/xe/uapi: Rename couple exec_queue items Francois Dugast
2023-11-09 17:14 ` Souza, Jose
2023-11-09 18:40 ` Rodrigo Vivi
2023-11-09 20:02 ` Souza, Jose
2023-11-09 20:56 ` Rodrigo Vivi
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 39/50] drm/xe/uapi: Refactor engine information Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 40/50] drm/xe/uapi: Add link to Xe documentation Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 41/50] drm/xe/uapi: Crystal Reference Clock updates Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 42/50] drm/xe/uapi: Add Tile ID information to the GT info query Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 43/50] squash! drm/xe/uapi: Rename couple exec_queue items Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 44/50] fixup! drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 45/50] drm/xe/uapi: Remove bogus engine list from the wait_user_fence IOCTL Francois Dugast
2023-11-08 0:05 ` Welty, Brian
2023-11-09 18:56 ` Rodrigo Vivi [this message]
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 46/50] drm/xe/uapi: Align on a common way to return arrays (memory regions) Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 47/50] drm/xe/uapi: Align on a common way to return arrays (gt) Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 48/50] drm/xe/uapi: Align on a common way to return arrays (engines) Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 49/50] drm/xe/uapi: Add block diagram of a device Francois Dugast
2023-11-09 15:35 ` Souza, Jose
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 50/50] drm/xe/uapi: Add examples of user space code Francois Dugast
2023-11-03 14:38 ` [Intel-xe] ✓ CI.Patch_applied: success for uAPI Alignment - take 2 Patchwork
2023-11-03 14:39 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-11-03 14:40 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-11-03 14:47 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-03 14:48 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
2023-11-03 14:49 ` [Intel-xe] ✓ CI.checksparse: success " Patchwork
2023-11-03 15:24 ` [Intel-xe] ✗ CI.BAT: failure " Patchwork
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=ZU0reeajpBgzq9in@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=brian.welty@intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox