-----Original Message-----
From: Jadav, Raag <raag.ja...@intel.com> 
Sent: Monday, March 24, 2025 2:26 PM
To: Cavitt, Jonathan <jonathan.cav...@intel.com>
Cc: intel...@lists.freedesktop.org; Gupta, saurabhg <saurabhg.gu...@intel.com>; 
Zuo, Alex <alex....@intel.com>; joonas.lahti...@linux.intel.com; Brost, Matthew 
<matthew.br...@intel.com>; Zhang, Jianxun <jianxun.zh...@intel.com>; Lin, 
Shuicheng <shuicheng....@intel.com>; dri-devel@lists.freedesktop.org; 
Wajdeczko, Michal <michal.wajdec...@intel.com>; Mrozek, Michal 
<michal.mro...@intel.com>
Subject: Re: [PATCH v10 5/5] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl
> 
> On Mon, Mar 24, 2025 at 10:27:08PM +0530, Cavitt, Jonathan wrote:
> > From: Jadav, Raag <raag.ja...@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.
-Jonathan Cavitt

> 
> Raag
> 

Reply via email to