[PATCH 2/6] drm/radeon: track memory statistics about VRAM and GTT usage and buffer moves
Marek Olšák
maraeo at gmail.com
Wed Feb 26 09:56:53 PST 2014
On Mon, Feb 24, 2014 at 5:20 PM, Christian König
<deathsimple at vodafone.de> wrote:
> Am 24.02.2014 16:20, schrieb Marek Olšák:
>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> The statistics are:
>> - VRAM usage in bytes
>> - GTT usage in bytes
>> - number of bytes moved by TTM
>>
>> The last one is actually a counter, so you need to sample it before and
>> after
>> command submission and take the difference.
>>
>> This is useful for finding performance bottlenecks. Userspace queries are
>> also added.
>>
>> Signed-off-by: Marek Olšák <marek.olsak at amd.com>
>> ---
>> drivers/gpu/drm/radeon/radeon.h | 5 +++++
>> drivers/gpu/drm/radeon/radeon_device.c | 1 +
>> drivers/gpu/drm/radeon/radeon_kms.c | 15 ++++++++++++++
>> drivers/gpu/drm/radeon/radeon_object.c | 38
>> +++++++++++++++++++++++++++++++++-
>> drivers/gpu/drm/radeon/radeon_object.h | 2 +-
>> drivers/gpu/drm/radeon/radeon_ttm.c | 10 ++++++++-
>> include/uapi/drm/radeon_drm.h | 3 +++
>> 7 files changed, 71 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/radeon.h
>> b/drivers/gpu/drm/radeon/radeon.h
>> index 3f10782..d37a57a 100644
>> --- a/drivers/gpu/drm/radeon/radeon.h
>> +++ b/drivers/gpu/drm/radeon/radeon.h
>> @@ -2307,6 +2307,11 @@ struct radeon_device {
>> /* virtual memory */
>> struct radeon_vm_manager vm_manager;
>> struct mutex gpu_clock_mutex;
>> + /* memory stats */
>> + struct mutex memory_stats_mutex;
>> + uint64_t vram_usage;
>> + uint64_t gtt_usage;
>> + uint64_t num_bytes_moved;
>
>
> As far as I can see you could make those tree values atomic64_t instead and
> avoid the mutex.
I'm afraid I cannot use atomic64_t. It doesn't work on x86 32-bit.
This seems to be a no-op:
u64 size = (u64)bo->num_pages << PAGE_SHIFT;
atomic64_add(size, &rdev->num_bytes_moved);
Marek
More information about the dri-devel
mailing list