<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Am 09.01.24 um 02:50 schrieb 李真能:<br>
<blockquote type="cite" cite="mid:xrg6qu5muv-xriqmgzqig@nsmail7.0.0--kylin--1">
<p>When the priority value is passed to the kernel, the kernel
compares it with the following values:</p>
<p>#define AMDGPU_CTX_PRIORITY_VERY_LOW -1023<br>
#define AMDGPU_CTX_PRIORITY_LOW -512<br>
#define AMDGPU_CTX_PRIORITY_NORMAL 0<br>
#define AMDGPU_CTX_PRIORITY_HIGH 512<br>
#define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023</p>
<p>If priority is uint32_t, we can't set LOW and VERY_LOW value to
kernel context priority,</p>
</blockquote>
<br>
Well that's nonsense.<br>
<br>
How the kernel handles the values and how userspace handles them are
two separate things. You just need to make sure that it's always 32
bits.<br>
<br>
In other words if you have signed or unsigned data type in userspace
is irrelevant for the kernel.<br>
<br>
<blockquote type="cite" cite="mid:xrg6qu5muv-xriqmgzqig@nsmail7.0.0--kylin--1">
<p>You can refer to the kernel function
amdgpu_ctx_priority_permit, if priority is greater</p>
<p>than 0, and this process has not CAP_SYS_NICE capibility or
DRM_MASTER permission,</p>
<p>this process will be exited.<br>
</p>
</blockquote>
<br>
Correct, that's intentional.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<blockquote type="cite" cite="mid:xrg6qu5muv-xriqmgzqig@nsmail7.0.0--kylin--1">
<p><br>
<br>
<br>
<br>
<br>
----</p>
<p> </p>
<div id="re" style="margin-left: 0.5em; padding-left: 0.5em; border-left: 1px solid green;"><br>
<br>
<br>
<div style="background-color: #f5f7fa;"><strong>主 题:</strong><span id="subject">Re: [PATCH libdrm 1/2] amdgpu: fix parameter of
amdgpu_cs_ctx_create2</span> <br>
<strong>日 期:</strong><span id="date">2024-01-09 00:28</span> <br>
<strong>发件人:</strong><span id="from">Christian König</span> <br>
<strong>收件人:</strong><span id="to" style="word-break: break-all;">李真能;Marek Olsak;Pierre-Eric
Pelloux-Prayer;dri-devel;amd-gfx;</span></div>
<br>
<div id="content">
<div class="viewer_part" style="position: relative;">
<div>Am 08.01.24 um 10:40 schrieb Zhenneng Li:<br>
> In order to pass the correct priority parameter to
the kernel,<br>
> we must change priority type from uint32_t to
int32_t.<br>
<br>
Hui what? Why should it matter if the parameter is signed
or not?<br>
<br>
That doesn't seem to make sense.<br>
<br>
Regards,<br>
Christian.<br>
<br>
><br>
> Signed-off-by: Zhenneng Li <br>
> ---<br>
> amdgpu/amdgpu.h | 2 +-<br>
> amdgpu/amdgpu_cs.c | 2 +-<br>
> 2 files changed, 2 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h<br>
> index 9bdbf366..f46753f3 100644<br>
> --- a/amdgpu/amdgpu.h<br>
> +++ b/amdgpu/amdgpu.h<br>
> @@ -896,7 +896,7 @@ int
amdgpu_bo_list_update(amdgpu_bo_list_handle handle,<br>
> *<br>
> */<br>
> int amdgpu_cs_ctx_create2(amdgpu_device_handle dev,<br>
> - uint32_t priority,<br>
> + int32_t priority,<br>
> amdgpu_context_handle *context);<br>
> /**<br>
> * Create GPU execution Context<br>
> diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c<br>
> index 49fc16c3..eb72c638 100644<br>
> --- a/amdgpu/amdgpu_cs.c<br>
> +++ b/amdgpu/amdgpu_cs.c<br>
> @@ -49,7 +49,7 @@ static int
amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem);<br>
> * \return 0 on success otherwise POSIX Error code<br>
> */<br>
> drm_public int
amdgpu_cs_ctx_create2(amdgpu_device_handle dev,<br>
> - uint32_t priority,<br>
> + int32_t priority,<br>
> amdgpu_context_handle *context)<br>
> {<br>
> struct amdgpu_context *gpu_context;<br>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>