All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: "Cavitt, Jonathan" <jonathan.cavitt@intel.com>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Gupta, saurabhg" <saurabhg.gupta@intel.com>,
	"Zuo, Alex" <alex.zuo@intel.com>,
	"joonas.lahtinen@linux.intel.com"
	<joonas.lahtinen@linux.intel.com>,
	"Brost, Matthew" <matthew.brost@intel.com>,
	"Zhang, Jianxun" <jianxun.zhang@intel.com>,
	"Lin, Shuicheng" <shuicheng.lin@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"Wajdeczko, Michal" <Michal.Wajdeczko@intel.com>,
	"Mrozek, Michal" <michal.mrozek@intel.com>
Subject: Re: [PATCH v10 5/5] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl
Date: Wed, 26 Mar 2025 01:36:14 +0200	[thread overview]
Message-ID: <Z-M97u82VI49T0lz@black.fi.intel.com> (raw)
In-Reply-To: <CH0PR11MB5444B20C4AD1D82138D6970CE5A72@CH0PR11MB5444.namprd11.prod.outlook.com>

On Tue, Mar 25, 2025 at 08:14:13PM +0530, Cavitt, Jonathan wrote:
> From: Jadav, Raag <raag.jadav@intel.com> 
> > On Tue, Mar 25, 2025 at 03:01:27AM +0530, Cavitt, Jonathan wrote:
> > > From: Jadav, Raag <raag.jadav@intel.com> 
> > > > On Mon, Mar 24, 2025 at 10:27:08PM +0530, Cavitt, Jonathan wrote:
> > > > > From: Jadav, Raag <raag.jadav@intel.com> 
> > > > > > On Thu, Mar 20, 2025 at 03:26:15PM +0000, Jonathan Cavitt wrote:
> > > > > > > Add support for userspace to request a list of observed faults
> > > > > > > from a specified VM.
> > > > > > 
> > > > > > ...
> > > > > > 
> > > > > > > +static int xe_vm_get_property_size(struct xe_vm *vm, u32 property)
> > > > > > > +{
> > > > > > > +	int size = -EINVAL;
> > > > > > 
> > > > > > Mixing size and error codes is usually received with mixed feelings.
> > > > > > 
> > > > > > > +
> > > > > > > +	switch (property) {
> > > > > > > +	case DRM_XE_VM_GET_PROPERTY_FAULTS:
> > > > > > > +		spin_lock(&vm->faults.lock);
> > > > > > > +		size = vm->faults.len * sizeof(struct xe_vm_fault);
> > > > > > 
> > > > > > size_mul() and,
> > > > > > [1] perhaps fill it up into the pointer passed by the caller here?
> > > > > 
> > > > > "The pointer passed by the caller".  You mean the args pointer?
> > > > > 
> > > > > We'd still need to check that the args->size value is empty here before overwriting
> > > > > it, and we'd also still need to return the size to the ioctl so we can verify it's
> > > > > acceptable later in xe_vm_get_property_verify_size.
> > > > > 
> > > > > Unless you want to merge those two processes together into here?
> > > > 
> > > > The semantics are a bit fuzzy to me. Why do we have a single ioctl for
> > > > two different processes? Shouldn't they be handled separately?
> > > 
> > > No.  Sorry.  Let me clarify.
> > > "two different processes" = getting the size + verifying the size.
> > 
> > Yes, which seems like they should be handlded with _FAULT_NUM and
> > _FAULT_DATA ioctls but I guess we're way past it now.
> 
> The current implementation mirrors xe_query.  Should we have separate
> queries for getting the size of the query data and getting the data itself
> in xe_query?

Let's not break a well established API.

> And just to preempt the question: this cannot be an xe_query because
> the size of the returned data depends on the target VM, which cannot
> be passed to the xe_query structure on the first pass when calculating
> the size.  And just reporting the maximum possible size was rejected
> separately. 

Sure, makes sense.

> > I'm also not much informed about the history here. Is there a real
> > usecase behind exposing them? What is the user expected to do with
> > this information?
> 
> This is a request from Vulkan, and is necessary to satisfy the requirements
> for one of their interfaces.  Specifically,
> https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_device_fault.html

It says this should be a subsequence of device lost. What is the criteria
for it wrt xe?

A big enough fault will probably result in a coredump. So why not just
reuse it?

Raag

  reply	other threads:[~2025-03-25 23:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20 15:26 [PATCH v10 0/5] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Jonathan Cavitt
2025-03-20 15:26 ` [PATCH v10 1/5] drm/xe/xe_gt_pagefault: Disallow writes to read-only VMAs Jonathan Cavitt
2025-03-20 15:26 ` [PATCH v10 2/5] drm/xe/xe_gt_pagefault: Move pagefault struct to header Jonathan Cavitt
2025-03-20 15:26 ` [PATCH v10 3/5] drm/xe/uapi: Define drm_xe_vm_get_property Jonathan Cavitt
2025-03-20 15:26 ` [PATCH v10 4/5] drm/xe/xe_vm: Add per VM fault info Jonathan Cavitt
2025-03-20 15:26 ` [PATCH v10 5/5] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Jonathan Cavitt
2025-03-21 23:36   ` Raag Jadav
2025-03-24 16:57     ` Cavitt, Jonathan
2025-03-24 21:25       ` Raag Jadav
2025-03-24 21:31         ` Cavitt, Jonathan
2025-03-25  7:19           ` Raag Jadav
2025-03-25 14:44             ` Cavitt, Jonathan
2025-03-25 23:36               ` Raag Jadav [this message]
2025-03-20 16:27 ` ✓ CI.Patch_applied: success for drm/xe/xe_vm: Implement xe_vm_get_property_ioctl (rev11) Patchwork
2025-03-20 16:27 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-20 16:28 ` ✓ CI.KUnit: success " Patchwork
2025-03-20 16:45 ` ✓ CI.Build: " Patchwork
2025-03-20 16:47 ` ✗ CI.Hooks: failure " Patchwork
2025-03-20 16:48 ` ✓ CI.checksparse: success " Patchwork
2025-03-20 17:08 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-20 18:01 ` ✗ Xe.CI.Full: 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=Z-M97u82VI49T0lz@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=Michal.Wajdeczko@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jianxun.zhang@intel.com \
    --cc=jonathan.cavitt@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=michal.mrozek@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=shuicheng.lin@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.