Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59bfd155 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Make snapshot priority configurable"

parents 44f7d4d2 f698a7f8
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2253,6 +2253,14 @@ static int dispatcher_do_fault(struct adreno_device *adreno_dev)

	atomic_add(halt, &adreno_dev->halt);

	/*
	 * At this point it is safe to assume that we recovered. Setting
	 * this field allows us to take a new snapshot for the next failure
	 * if we are prioritizing the first unrecoverable snapshot.
	 */
	if (device->snapshot)
		device->snapshot->recovered = true;

	return 1;
}

+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2002,2007-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2007-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -303,6 +303,7 @@ struct kgsl_device {

	u32 snapshot_faultcount;	/* Total number of faults since boot */
	bool force_panic;		/* Force panic after snapshot dump */
	bool prioritize_unrecoverable;	/* Overwrite with new GMU snapshots */

	/* Use CP Crash dumper to get GPU snapshot*/
	bool snapshot_crashdumper;
+33 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -663,7 +663,8 @@ void kgsl_device_snapshot(struct kgsl_device *device,
	 * Overwrite a non-GMU fault snapshot if a GMU fault occurs.
	 */
	if (device->snapshot != NULL) {
		if (!gmu_fault || !device->snapshot->recovered)
		if (!device->prioritize_unrecoverable ||
				!device->snapshot->recovered)
			return;

		/*
@@ -954,6 +955,28 @@ static ssize_t force_panic_store(struct kgsl_device *device, const char *buf,
	return (ssize_t) ret < 0 ? ret : count;
}

/* Show the prioritize_unrecoverable status */
static ssize_t prioritize_unrecoverable_show(
		struct kgsl_device *device, char *buf)
{
	return snprintf(buf, PAGE_SIZE, "%d\n",
			device->prioritize_unrecoverable);
}

/* Store the priority value to prioritize unrecoverable */
static ssize_t prioritize_unrecoverable_store(
		struct kgsl_device *device, const char *buf, size_t count)
{
	unsigned int val = 0;
	int ret = 0;

	ret = kgsl_sysfs_store(buf, &val);
	if (!ret && device)
		device->prioritize_unrecoverable = (bool) val;

	return (ssize_t) ret < 0 ? ret : count;
}

/* Show the snapshot_crashdumper request status */
static ssize_t snapshot_crashdumper_show(struct kgsl_device *device, char *buf)
{
@@ -1026,6 +1049,8 @@ struct kgsl_snapshot_attribute attr_##_name = { \
static SNAPSHOT_ATTR(timestamp, 0444, timestamp_show, NULL);
static SNAPSHOT_ATTR(faultcount, 0644, faultcount_show, faultcount_store);
static SNAPSHOT_ATTR(force_panic, 0644, force_panic_show, force_panic_store);
static SNAPSHOT_ATTR(prioritize_unrecoverable, 0644,
		prioritize_unrecoverable_show, prioritize_unrecoverable_store);
static SNAPSHOT_ATTR(snapshot_crashdumper, 0644, snapshot_crashdumper_show,
	snapshot_crashdumper_store);
static SNAPSHOT_ATTR(snapshot_legacy, 0644, snapshot_legacy_show,
@@ -1110,6 +1135,7 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
	device->snapshot = NULL;
	device->snapshot_faultcount = 0;
	device->force_panic = 0;
	device->prioritize_unrecoverable = true;
	device->snapshot_crashdumper = 1;
	device->snapshot_legacy = 0;

@@ -1135,6 +1161,11 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
	if (ret)
		goto done;

	ret = sysfs_create_file(&device->snapshot_kobj,
			&attr_prioritize_unrecoverable.attr);
	if (ret)
		goto done;

	ret  = sysfs_create_file(&device->snapshot_kobj,
			&attr_snapshot_crashdumper.attr);
	if (ret)