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

Commit d61c196f authored by Harshdeep Dhatt's avatar Harshdeep Dhatt Committed by Raghu Ananya Arabolu
Browse files

msm: kgsl: Correct snapshot over-write policy



Since non-gmu days, we have always kept the first gpu
snapshot around, until it was retrieved. Let's reinstate
that first i.e. never over-write existing snapshot with
a gpu fault.

Secondly, lets talk about gmu snapshot. if we want to
over-write a previously recovered fault with new gmu snapshot,
use the existing "prioritize_unrecoverable" sysfs knob.
By default, set it to false to mimic gpu fault policy of
keeping the first snapshot around.

Also, set the snapshot recovery bit as soon as we are past a
successful CP_INIT. This ensures that snapshot recovery bit is
set for a fault for which we didn't exercise dispatcher
based recovery.

Change-Id: Idae83344e3f70e451cd7cb036d6a0dcb76182172
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent 28dc3885
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2074,6 +2074,14 @@ static int _adreno_start(struct adreno_device *adreno_dev)
	if (status)
		goto error_oob_clear;

	/*
	 * 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;

	/* Start the dispatcher */
	adreno_dispatcher_start(device);

+0 −8
Original line number Diff line number Diff line
@@ -2225,14 +2225,6 @@ 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;
}

+20 −8
Original line number Diff line number Diff line
@@ -628,14 +628,20 @@ void kgsl_device_snapshot(struct kgsl_device *device,
	/* increment the hang count for good book keeping */
	device->snapshot_faultcount++;

	if (device->snapshot != NULL) {

		/*
	 * Overwrite a fault snapshot only if GMU is
	 * enabled and we managed to recover from it.
		 * Snapshot over-write policy:
		 * 1. By default, don't over-write the very first snapshot,
		 *    be it a gmu or gpu fault.
		 * 2. Never over-write existing snapshot on a gpu fault.
		 * 3. Never over-write a snapshot that we didn't recover from.
		 * 4. In order to over-write a new gmu fault snapshot with a
		 *    previously recovered fault, then set the sysfs knob
		 *    prioritize_recoverable to true.
		 */
	if (device->snapshot != NULL) {
		if (!gmu_core_gpmu_isenabled(device) ||
			!device->prioritize_unrecoverable ||
				!device->snapshot->recovered)
		if (!device->prioritize_unrecoverable ||
			!device->snapshot->recovered || !gmu_fault)
			return;

		/*
@@ -1083,10 +1089,16 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
	device->snapshot = NULL;
	device->snapshot_faultcount = 0;
	device->force_panic = false;
	device->prioritize_unrecoverable = true;
	device->snapshot_crashdumper = true;
	device->snapshot_legacy = false;

	/*
	 * Set this to false so that we only ever keep the first snapshot around
	 * If we want to over-write with a gmu snapshot, then set it to true
	 * via sysfs
	 */
	device->prioritize_unrecoverable = false;

	ret = kobject_init_and_add(&device->snapshot_kobj, &ktype_snapshot,
		&device->dev->kobj, "snapshot");
	if (ret)