All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/amdgpu: bail on INFO IOCTL if the GPU is in reset
Date: Thu, 15 Feb 2024 08:27:57 +0100	[thread overview]
Message-ID: <55944c59-2943-4557-ad23-eff38b548383@gmail.com> (raw)
In-Reply-To: <BL1PR12MB514476B2675A7FEA612D6473F7482@BL1PR12MB5144.namprd12.prod.outlook.com>

Well using this is in sysfs is a bug to begin with. This would prevent 
starting new applications and crashing applications which don't expect 
to get an -EPERM in return here.

If we need to make operations mutual exclusive with resets then we need 
to take the appropriate locks and *not* work around by abusing 
amdgpu_in_reset().

The functionality of amdgpu_in_reset() is just to check in lower level 
functions if we are inside the higher level reset thread and *not* 
protect anybody from concurrent access.

I think we should probably completely nuke the underlying flag and using 
the thread owner of the lock to prevent such an abuse.

Regards,
Christian.

Am 12.02.24 um 21:56 schrieb Deucher, Alexander:
> [AMD Official Use Only - General]
>
> Ping?
>
>> -----Original Message-----
>> From: Deucher, Alexander <Alexander.Deucher@amd.com>
>> Sent: Monday, January 29, 2024 10:56 AM
>> To: amd-gfx@lists.freedesktop.org
>> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
>> Subject: [PATCH] drm/amdgpu: bail on INFO IOCTL if the GPU is in reset
>>
>> This avoids queries to read registers or query the SMU for telemetry data while
>> the GPU is in reset. This mirrors what we already do for sysfs.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index a2df3025a754..d522e99c6f81 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -607,6 +607,9 @@ int amdgpu_info_ioctl(struct drm_device *dev, void
>> *data, struct drm_file *filp)
>>        int i, found, ret;
>>        int ui32_size = sizeof(ui32);
>>
>> +     if (amdgpu_in_reset(adev))
>> +             return -EPERM;
>> +
>>        if (!info->return_size || !info->return_pointer)
>>                return -EINVAL;
>>
>> --
>> 2.42.0


  reply	other threads:[~2024-02-15  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 15:56 [PATCH] drm/amdgpu: bail on INFO IOCTL if the GPU is in reset Alex Deucher
2024-02-12 20:56 ` Deucher, Alexander
2024-02-15  7:27   ` Christian König [this message]
2024-02-15 14:36     ` Alex Deucher
2024-02-15 14:43       ` Christian König
2024-02-15 14:46         ` Christian König

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=55944c59-2943-4557-ad23-eff38b548383@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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.