AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Add mutex locking to VMID Manager Initialization for Process Isolation
Date: Fri, 10 Jan 2025 07:38:48 +0100	[thread overview]
Message-ID: <f0ca8ded-731d-4a6d-81e1-cc81d3b8bbd4@amd.com> (raw)
In-Reply-To: <20250110033857.3034258-1-srinivasan.shanmugam@amd.com>

Am 10.01.25 um 04:38 schrieb Srinivasan Shanmugam:
> This commit adds mutex locking to the `amdgpu_vmid_mgr_init` function.
> By acquiring and releasing the `enforce_isolation_mutex`, so that it now
> safely allocates reserved VMIDs, which is important for enforcing
> isolation between different GPU processes.
>
> Mutex ensures that the process of allocating VMIDs is done
> correctly and without interference

That is unnecessary.

The VMID mgr is only initialized during driver load and at that moment 
the enforce isolation setting should be static.

Regards,
Christian.

>
> Fixes: 96595204195d ("drm/amdgpu: Make enforce_isolation setting per GPU")
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> index 8e712a11aba5..6ae835a7f031 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> @@ -602,10 +602,12 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev)
>   		}
>   	}
>   	/* alloc a default reserved vmid to enforce isolation */
> +	mutex_lock(&adev->enforce_isolation_mutex);
>   	for (i = 0; i < (adev->xcp_mgr ? adev->xcp_mgr->num_xcps : 1); i++) {
>   		if (adev->enforce_isolation[i])
>   			amdgpu_vmid_alloc_reserved(adev, AMDGPU_GFXHUB(i));
>   	}
> +	mutex_unlock(&adev->enforce_isolation_mutex);
>   }
>   
>   /**


      reply	other threads:[~2025-01-10  6:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10  3:38 [PATCH] drm/amdgpu: Add mutex locking to VMID Manager Initialization for Process Isolation Srinivasan Shanmugam
2025-01-10  6:38 ` Christian König [this message]

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=f0ca8ded-731d-4a6d-81e1-cc81d3b8bbd4@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=srinivasan.shanmugam@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox