msm: kgsl: Add fault count to snapshot debugfs

Additional faults can occur between when a snapshot is frozen
and the snapshot is read.  Keep track of the total number of
faults encountered to keep track of how the GPU is actually
doing on multi-hour test cases.

Change-Id: I392fce74e7d215aa7bd0e1a7ce5c9f340413cd53
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
This commit is contained in:
Carter Cooper 2013-04-30 10:21:34 -06:00 committed by Iliyan Malchev
parent b6c0616e78
commit 9ef881db66
2 changed files with 28 additions and 0 deletions

View file

@ -255,6 +255,7 @@ struct kgsl_device {
int snapshot_maxsize; /* Max size of the snapshot region */
int snapshot_size; /* Current size of the snapshot region */
u32 snapshot_timestamp; /* Timestamp of the last valid snapshot */
u32 snapshot_faultcount; /* Total number of faults since boot */
int snapshot_frozen; /* 1 if the snapshot output is frozen until
it gets read by the user. This avoids
losing the output on multiple hangs */

View file

@ -543,6 +543,10 @@ int kgsl_device_snapshot(struct kgsl_device *device, int hang)
void *snapshot;
struct timespec boot;
/* increment the hang count (on hang) for good book keeping */
if (hang)
device->snapshot_faultcount++;
/*
* The first hang is always the one we are interested in. To
* avoid a subsequent hang blowing away the first, the snapshot
@ -681,6 +685,22 @@ done:
return itr.write;
}
/* Show the total number of hangs since device boot */
static ssize_t faultcount_show(struct kgsl_device *device, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_faultcount);
}
/* Reset the total number of hangs since device boot */
static ssize_t faultcount_store(struct kgsl_device *device, const char *buf,
size_t count)
{
if (device && count > 0)
device->snapshot_faultcount = 0;
return count;
}
/* Show the timestamp of the last collected snapshot */
static ssize_t timestamp_show(struct kgsl_device *device, char *buf)
{
@ -716,6 +736,7 @@ struct kgsl_snapshot_attribute attr_##_name = { \
SNAPSHOT_ATTR(trigger, 0600, NULL, trigger_store);
SNAPSHOT_ATTR(timestamp, 0444, timestamp_show, NULL);
SNAPSHOT_ATTR(faultcount, 0644, faultcount_show, faultcount_store);
static void snapshot_sysfs_release(struct kobject *kobj)
{
@ -781,6 +802,7 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
device->snapshot_maxsize = KGSL_SNAPSHOT_MEMSIZE;
device->snapshot_timestamp = 0;
device->snapshot_faultcount = 0;
INIT_LIST_HEAD(&device->snapshot_obj_list);
@ -798,6 +820,10 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
goto done;
ret = sysfs_create_file(&device->snapshot_kobj, &attr_timestamp.attr);
if (ret)
goto done;
ret = sysfs_create_file(&device->snapshot_kobj, &attr_faultcount.attr);
done:
return ret;
@ -824,5 +850,6 @@ void kgsl_device_snapshot_close(struct kgsl_device *device)
device->snapshot = NULL;
device->snapshot_maxsize = 0;
device->snapshot_timestamp = 0;
device->snapshot_faultcount = 0;
}
EXPORT_SYMBOL(kgsl_device_snapshot_close);