All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Khatri, Sunil" <sukhatri@amd.com>
To: "Christian König" <christian.koenig@amd.com>,
	"Sunil Khatri" <sunil.khatri@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Zhu James" <James.Zhu@amd.com>,
	"Felix Kuehling" <felix.kuehling@amd.com>,
	"Ma Bing" <Bing.Ma@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v1 2/9] drm/amdgpu: hand out the dedicated SPM VMID from the reserved path
Date: Tue, 29 Sep 2026 23:11:38 +0530	[thread overview]
Message-ID: <f100d2bc-fe66-45f8-be68-9d0436df9bc5@amd.com> (raw)
In-Reply-To: <4731b165-af7d-4a1a-a06d-cc817e80d0ca@amd.com>


On 29-09-2026 05:18 pm, Christian König wrote:
> On 9/28/26 20:57, Sunil Khatri wrote:
>> The SPM reservation borrowed a VMID from the GFXHUB round-robin pool
>> shared with normal graphics contexts (VMIDs 1-7). SPM streams its output
>> through the selected VMID's page tables, so sharing that slot with
>> dynamically scheduled contexts is a poor isolation boundary and makes
>> the profiling VMID non-deterministic.
>>
>> Reservation now uses the VMID a hub dedicates to it. When
>> vm_manager.spm_vmid is set, amdgpu_vmid_alloc_reserved() hands out that
>> fixed VMID directly; when it is unset the reservation is rejected with
>> -ENOENT rather than borrowing a pool VMID, so a reserved submission can
>> never end up on VMID 0 (the kernel VM) or on a slot shared with graphics
>> contexts. The dedicated VMID is not part of the round-robin LRU, so it
>> is given an initialized active-fence sync on every GFXHUB instance in
>> amdgpu_vmid_mgr_init() and amdgpu_vmid_free_reserved() has nothing to
>> return to the LRU.
>>
>> The behaviour is gated on spm_vmid, so hubs that do not dedicate a VMID
>> simply do not support reservation.
> That won't work like this. The SPM VMID would still be used round robin with that.
>
> You need to take the VMID completely out of the mask. Take a look at when amdgpu_vmid_mgr_set_vmid_mask() is called.
Noted
Regards
Sunil Khatri
>
> Regards,
> Christian.
>
>> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 15 ++++++++++-----
>>   1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
>> index 5e424e3b6e71f..c8cbd0851d478 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
>> @@ -551,9 +551,12 @@ int amdgpu_vmid_alloc_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>>   		r = -ENOENT;
>>   		goto unlock;
>>   	}
>> -	/* Remove from normal round robin handling */
>> -	id = list_first_entry(&id_mgr->ids_lru, struct amdgpu_vmid, list);
>> -	list_del_init(&id->list);
>> +	if (!adev->vm_manager.spm_vmid) {
>> +		r = -ENOENT;
>> +		goto unlock;
>> +	}
>> +
>> +	id = &id_mgr->ids[adev->vm_manager.spm_vmid];
>>   	vm->reserved_vmid[vmhub] = id;
>>   	id_mgr->reserved_vmid = true;
>>   	mutex_unlock(&id_mgr->lock);
>> @@ -577,8 +580,6 @@ void amdgpu_vmid_free_reserved(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>>   
>>   	mutex_lock(&id_mgr->lock);
>>   	if (vm->reserved_vmid[vmhub]) {
>> -		list_add(&vm->reserved_vmid[vmhub]->list,
>> -			&id_mgr->ids_lru);
>>   		vm->reserved_vmid[vmhub] = NULL;
>>   		id_mgr->reserved_vmid = false;
>>   	}
>> @@ -670,6 +671,10 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev)
>>   			amdgpu_sync_create(&id_mgr->ids[j].active);
>>   			list_add_tail(&id_mgr->ids[j].list, &id_mgr->ids_lru);
>>   		}
>> +
>> +		/* out-of-pool VMID; create its sync here */
>> +		if (adev->vm_manager.spm_vmid && AMDGPU_IS_GFXHUB(i))
>> +			amdgpu_sync_create(&id_mgr->ids[adev->vm_manager.spm_vmid].active);
>>   	}
>>   }
>>   

  reply	other threads:[~2026-09-29 17:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260928185756.2382322-1-sunil.khatri@amd.com>
     [not found] ` <20260928185756.2382322-2-sunil.khatri@amd.com>
2026-09-29 11:48   ` [PATCH v1 2/9] drm/amdgpu: hand out the dedicated SPM VMID from the reserved path Christian König
2026-09-29 17:41     ` Khatri, Sunil [this message]
2026-09-29 11:54 ` [PATCH v1 1/9] drm/amdgpu: add spm_vmid and exclude it from the MES and KFD pools Christian König
2026-09-29 17:39   ` Khatri, Sunil
     [not found] ` <20260928185756.2382322-3-sunil.khatri@amd.com>
2026-09-29 11:59   ` [PATCH v1 3/9] drm/amdgpu: reserve SPM VMID on gfx7 Christian König
     [not found] ` <20260928185756.2382322-9-sunil.khatri@amd.com>
2026-09-29 12:04   ` [PATCH v1 9/9] drm/amdgpu: use spm_vmid for the default RLC SPM VMID Christian König
2026-09-29 14:56     ` Mukul Joshi
2026-09-29 17:13       ` Khatri, Sunil
2026-09-30  6:40         ` Christian König
2026-09-29 17:40     ` Khatri, Sunil

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=f100d2bc-fe66-45f8-be68-9d0436df9bc5@amd.com \
    --to=sukhatri@amd.com \
    --cc=Bing.Ma@amd.com \
    --cc=James.Zhu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=felix.kuehling@amd.com \
    --cc=sunil.khatri@amd.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.