public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<thomas.hellstrom@linux.intel.com>, <stuart.summers@intel.com>,
	<arvind.yadav@intel.com>, <tejas.upadhyay@intel.com>
Subject: Re: [RFC 07/15] drm/xe: Move ASID to FAULT VM lookup to xe_device
Date: Tue, 7 Apr 2026 12:11:32 +0530	[thread overview]
Message-ID: <bff64dfb-92f7-4150-a7e5-39a5f01a240b@intel.com> (raw)
In-Reply-To: <ac7ksb6r259ILaR/@gsse-cloud1.jf.intel.com>



On 03-04-2026 03:20, Matthew Brost wrote:
> On Wed, Mar 18, 2026 at 01:14:48PM +0530, Himal Prasad Ghimiray wrote:
>> Move xe_pagefault_asid_to_vm() to xe_device.c as
>> xe_device_asid_to_fault_vm() for reuse in access counter handling.
>>
>> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_device.c    | 25 +++++++++++++++++++++++++
>>   drivers/gpu/drm/xe/xe_device.h    |  1 +
>>   drivers/gpu/drm/xe/xe_pagefault.c | 16 +---------------
>>   3 files changed, 27 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
>> index 8773c2d2f69a..ba2f0e345257 100644
>> --- a/drivers/gpu/drm/xe/xe_device.c
>> +++ b/drivers/gpu/drm/xe/xe_device.c
>> @@ -1399,3 +1399,28 @@ struct xe_vm *xe_device_asid_to_vm(struct xe_device *xe, u32 asid)
>>   
>>   	return vm;
>>   }
>> +
>> +/**
>> + * xe_device_asid_to_fault_vm() - Find FAULT VM from ASID
>> + * @xe: the &xe_device
>> + * @asid: Address space ID
>> + *
>> + * Find a FAULTING VM from ASID and take a reference to VM which
>> + * caller must drop. Reclaim safe.
>> + *
>> + * Return: VM on success, ERR_PTR on failure
>> + */
>> +struct xe_vm *xe_device_asid_to_fault_vm(struct xe_device *xe, u32 asid)
> 
> I think the recently merged xe_pagefault_save_to_vm() function can reuse
> this function now too.


For xe_pagefault_save_to_vm we need to use existing function 
xe_device_asid_to_vm instead of xe_device_asid_to_fault_vm(). Will 
submit patch for same too.

Thanks.


> 
> Patch LGTM to though.
> 
> Matt
> 
>> +{
>> +	struct xe_vm *vm;
>> +
>> +	down_read(&xe->usm.lock);
>> +	vm = xa_load(&xe->usm.asid_to_vm, asid);
>> +	if (vm && xe_vm_in_fault_mode(vm))
>> +		xe_vm_get(vm);
>> +	else
>> +		vm = ERR_PTR(-EINVAL);
>> +	up_read(&xe->usm.lock);
>> +
>> +	return vm;
>> +}
>> diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
>> index c4d267002661..e746f5c7cce0 100644
>> --- a/drivers/gpu/drm/xe/xe_device.h
>> +++ b/drivers/gpu/drm/xe/xe_device.h
>> @@ -209,6 +209,7 @@ int xe_is_injection_active(void);
>>   bool xe_is_xe_file(const struct file *file);
>>   
>>   struct xe_vm *xe_device_asid_to_vm(struct xe_device *xe, u32 asid);
>> +struct xe_vm *xe_device_asid_to_fault_vm(struct xe_device *xe, u32 asid);
>>   
>>   /*
>>    * Occasionally it is seen that the G2H worker starts running after a delay of more than
>> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
>> index 8c159e3512ee..a4ee9393e4af 100644
>> --- a/drivers/gpu/drm/xe/xe_pagefault.c
>> +++ b/drivers/gpu/drm/xe/xe_pagefault.c
>> @@ -121,20 +121,6 @@ xe_pagefault_access_is_atomic(enum xe_pagefault_access_type access_type)
>>   	return (access_type & XE_PAGEFAULT_ACCESS_TYPE_MASK) == XE_PAGEFAULT_ACCESS_TYPE_ATOMIC;
>>   }
>>   
>> -static struct xe_vm *xe_pagefault_asid_to_vm(struct xe_device *xe, u32 asid)
>> -{
>> -	struct xe_vm *vm;
>> -
>> -	down_read(&xe->usm.lock);
>> -	vm = xa_load(&xe->usm.asid_to_vm, asid);
>> -	if (vm && xe_vm_in_fault_mode(vm))
>> -		xe_vm_get(vm);
>> -	else
>> -		vm = ERR_PTR(-EINVAL);
>> -	up_read(&xe->usm.lock);
>> -
>> -	return vm;
>> -}
>>   
>>   static int xe_pagefault_service(struct xe_pagefault *pf)
>>   {
>> @@ -149,7 +135,7 @@ static int xe_pagefault_service(struct xe_pagefault *pf)
>>   	if (pf->consumer.fault_type_level == XE_PAGEFAULT_TYPE_LEVEL_NACK)
>>   		return -EFAULT;
>>   
>> -	vm = xe_pagefault_asid_to_vm(xe, pf->consumer.asid);
>> +	vm = xe_device_asid_to_fault_vm(xe, pf->consumer.asid);
>>   	if (IS_ERR(vm))
>>   		return PTR_ERR(vm);
>>   
>> -- 
>> 2.34.1
>>


  reply	other threads:[~2026-04-07  6:41 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  7:44 [RFC 00/15] drm/xe: Access counter consumer layer Himal Prasad Ghimiray
2026-03-18  7:34 ` ✗ CI.checkpatch: warning for " Patchwork
2026-03-18  7:35 ` ✗ CI.KUnit: failure " Patchwork
2026-03-18  7:44 ` [RFC 01/15] drm/xe: Add xe_usm_queue generic USM circular buffer Himal Prasad Ghimiray
2026-04-01 21:28   ` Matthew Brost
2026-04-06  4:46     ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 02/15] drm/xe/pagefault: Use xe_usm_queue helpers Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 03/15] drm/xe: Stub out new access_counter layer Himal Prasad Ghimiray
2026-04-02 21:46   ` Matthew Brost
2026-04-06  5:28     ` Ghimiray, Himal Prasad
2026-04-14 20:06   ` Summers, Stuart
2026-03-18  7:44 ` [RFC 04/15] drm/xe: Implement xe_access_counter_init Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 05/15] drm/xe: Implement xe_access_counter_handler Himal Prasad Ghimiray
2026-04-03  2:06   ` Matthew Brost
2026-03-18  7:44 ` [RFC 06/15] drm/xe: Extract xe_vma_lock_and_validate helper Himal Prasad Ghimiray
2026-04-01 22:03   ` Matthew Brost
2026-03-18  7:44 ` [RFC 07/15] drm/xe: Move ASID to FAULT VM lookup to xe_device Himal Prasad Ghimiray
2026-04-02 21:50   ` Matthew Brost
2026-04-07  6:41     ` Ghimiray, Himal Prasad [this message]
2026-03-18  7:44 ` [RFC 08/15] drm/xe: Implement xe_access_counter_queue_work Himal Prasad Ghimiray
2026-04-01 21:10   ` Matthew Brost
2026-04-01 22:01     ` Matthew Brost
2026-04-01 22:11   ` Matthew Brost
2026-04-02 22:06   ` Matthew Brost
2026-03-18  7:44 ` [RFC 09/15] drm/xe/trace: Add xe_vma_acc trace event for access counter notifications Himal Prasad Ghimiray
2026-04-03  1:01   ` Matthew Brost
2026-03-18  7:44 ` [RFC 10/15] drm/xe/svm: Handle svm ranges on access ctr trigger Himal Prasad Ghimiray
2026-04-03  0:25   ` Matthew Brost
2026-03-18  7:44 ` [RFC 11/15] drm/xe: Add xe_guc_access_counter layer Himal Prasad Ghimiray
2026-04-02 21:27   ` Matthew Brost
2026-04-14 21:24   ` Summers, Stuart
2026-03-18  7:44 ` [RFC 12/15] drm/xe/uapi: Add access counter parameter extension for exec queue Himal Prasad Ghimiray
2026-03-24 14:25   ` Francois Dugast
2026-04-01 14:46     ` Matthew Brost
2026-04-01 16:36       ` Ghimiray, Himal Prasad
2026-03-18  7:44 ` [RFC 13/15] drm/xe/lrc: Pass exec_queue to xe_lrc_create for access counter params Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 14/15] drm/xe/vm: Add xe_vma_supports_access_ctr() helper Himal Prasad Ghimiray
2026-03-18  7:44 ` [RFC 15/15] drm/xe/pt: Set NC PTE bit for VMAs ineligible for access counting Himal Prasad Ghimiray
2026-04-03  0:09   ` Matthew Brost

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=bff64dfb-92f7-4150-a7e5-39a5f01a240b@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=tejas.upadhyay@intel.com \
    --cc=thomas.hellstrom@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox