On 9/24/2026 11:40 PM, James Zhu wrote:

>
> On 2026-09-23 23:23, Zhu, Lingshan wrote:
>> On 9/23/2026 10:13 PM, James Zhu wrote:
>>>
>>> On 2026-09-22 05:34, Zhu Lingshan wrote:
>>>> This commit implements a device-wide PMC config
>>>> for amdgpu, which including the profiling owner,
>>>> and the profiling enablement indicator.
>>> [JZ] I think it should be render-node wide, not device-wide
>> Hi James,
>>
>> It could be, but we don't have a requirement document defines the scope.
>>
>> But normally a profiler is a device scope,
>> I see KFD profiler operates on all queues under the device queue manager
>
> [JZ] One device could be split into multiple nodes with different
> processes running.
>
> I am wondering if this is really we want.  Ben may comment on it.

Hello James,

Sorry for the late reply, it was mid-autumn festival and national holidays.

In my understanding, there is only one set of PMC registers on the device, so 
it should
be device scope.

Thanks
Lingshan

>
>>
>> Thanks
>> Lingshan
>>>>
>>>> Signed-off-by: Zhu Lingshan <[email protected]>
>>>> ---
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 8 ++++++++
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++
>>>>   2 files changed, 11 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> index 8eff6b9ebe81..45897dca802f 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>>> @@ -620,6 +620,12 @@ enum amdgpu_enforce_isolation_mode {
>>>>       AMDGPU_ENFORCE_ISOLATION_NO_CLEANER_SHADER = 3,
>>>>   };
>>>>   +struct amdgpu_pmc_profiler {
>>>> +    struct mutex        lock;
>>>> +    struct drm_file        *owner;
>>>> +    bool            enable;
>>>> +};
>>>> +
>>>>   struct amdgpu_device {
>>>>       struct device            *dev;
>>>>       struct pci_dev            *pdev;
>>>> @@ -818,6 +824,8 @@ struct amdgpu_device {
>>>>        */
>>>>       struct xarray userq_doorbell_xa;
>>>>   +    struct amdgpu_pmc_profiler    pmc_profiler;
>>>> +
>>>>       /* df */
>>>>       struct amdgpu_df                df;
>>>>   diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> index c924a55fd16f..74ed42e53264 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>>>> @@ -3673,6 +3673,7 @@ int amdgpu_device_init(struct amdgpu_device
>>>> *adev,
>>>>       mutex_init(&adev->pm.stable_pstate_ctx_lock);
>>>>       mutex_init(&adev->benchmark_mutex);
>>>>       mutex_init(&adev->gfx.reset_sem_mutex);
>>>> +    mutex_init(&adev->pmc_profiler.lock);
>>>>         /* Associate locks with lockdep classes for ordering
>>>> validation */
>>>>       amdgpu_lockdep_set_class(adev);
>>>> @@ -4244,6 +4245,8 @@ void amdgpu_device_fini_sw(struct
>>>> amdgpu_device *adev)
>>>>       kfree(adev->pci_state);
>>>>       kfree(adev->pcie_reset_ctx.swds_pcistate);
>>>>       kfree(adev->pcie_reset_ctx.swus_pcistate);
>>>> +
>>>> +    mutex_destroy(&adev->pmc_profiler.lock);
>>>>   }
>>>>     /**

Reply via email to