OSDN Git Service

msm: kgsl: Allow a draw context to skip snapshot
authorJordan Crouse <jcrouse@codeaurora.org>
Wed, 11 May 2016 15:37:41 +0000 (09:37 -0600)
committerCarter Cooper <ccooper@codeaurora.org>
Wed, 20 Jul 2016 21:19:33 +0000 (15:19 -0600)
Some test applications intentionally generate a GPU fault for
various reasons. Because a GPU fault generates a snapshot and
snapshots are persistent until they are pulled, running the test
application may take up the snapshot slot and prevent a real fault
from being captured and debugged.

This flag allows the draw context to intentionally avoid generating
a snapshot.

CRs-Fixed: 1009190
Change-Id: Ic0dedbad8476c308a13572d999540b243d97eabc
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
drivers/gpu/msm/adreno_dispatch.c
drivers/gpu/msm/adreno_drawctxt.c
include/uapi/linux/msm_kgsl.h

index fe92a5d..ac38058 100644 (file)
@@ -1699,6 +1699,27 @@ replay:
        kfree(replay);
 }
 
+static void do_header_and_snapshot(struct kgsl_device *device,
+               struct adreno_ringbuffer *rb, struct kgsl_cmdbatch *cmdbatch)
+{
+       /* Always dump the snapshot on a non-cmdbatch failure */
+       if (cmdbatch == NULL) {
+               adreno_fault_header(device, rb, NULL);
+               kgsl_device_snapshot(device, NULL);
+               return;
+       }
+
+       /* Skip everything if the PMDUMP flag is set */
+       if (test_bit(KGSL_FT_SKIP_PMDUMP, &cmdbatch->fault_policy))
+               return;
+
+       /* Print the fault header */
+       adreno_fault_header(device, rb, cmdbatch);
+
+       if (!(cmdbatch->context->flags & KGSL_CONTEXT_NO_SNAPSHOT))
+               kgsl_device_snapshot(device, cmdbatch->context);
+}
+
 static int dispatcher_do_fault(struct adreno_device *adreno_dev)
 {
        struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
@@ -1788,17 +1809,7 @@ static int dispatcher_do_fault(struct adreno_device *adreno_dev)
        adreno_readreg64(adreno_dev, ADRENO_REG_CP_IB1_BASE,
                ADRENO_REG_CP_IB1_BASE_HI, &base);
 
-       /*
-        * Dump the snapshot information if this is the first
-        * detected fault for the oldest active command batch
-        */
-
-       if (cmdbatch == NULL ||
-               !test_bit(KGSL_FT_SKIP_PMDUMP, &cmdbatch->fault_policy)) {
-               adreno_fault_header(device, hung_rb, cmdbatch);
-               kgsl_device_snapshot(device,
-                       cmdbatch ? cmdbatch->context : NULL);
-       }
+       do_header_and_snapshot(device, hung_rb, cmdbatch);
 
        /* Terminate the stalled transaction and resume the IOMMU */
        if (fault & ADRENO_IOMMU_PAGE_FAULT)
index 54ae1f0..ca7add5 100644 (file)
@@ -346,7 +346,8 @@ adreno_drawctxt_create(struct kgsl_device_private *dev_priv,
                KGSL_CONTEXT_PWR_CONSTRAINT |
                KGSL_CONTEXT_IFH_NOP |
                KGSL_CONTEXT_SECURE |
-               KGSL_CONTEXT_PREEMPT_STYLE_MASK);
+               KGSL_CONTEXT_PREEMPT_STYLE_MASK |
+               KGSL_CONTEXT_NO_SNAPSHOT);
 
        /* Check for errors before trying to initialize */
 
index 3450342..dbba773 100644 (file)
 /* This is a cmdbatch exclusive flag - use the CMDBATCH equivalent instead */
 #define KGSL_CONTEXT_SYNC               0x00000400
 #define KGSL_CONTEXT_PWR_CONSTRAINT     0x00000800
-
 #define KGSL_CONTEXT_PRIORITY_MASK      0x0000F000
 #define KGSL_CONTEXT_PRIORITY_SHIFT     12
 #define KGSL_CONTEXT_PRIORITY_UNDEF     0
 
 #define KGSL_CONTEXT_IFH_NOP            0x00010000
 #define KGSL_CONTEXT_SECURE             0x00020000
+#define KGSL_CONTEXT_NO_SNAPSHOT        0x00040000
 
 #define KGSL_CONTEXT_PREEMPT_STYLE_MASK       0x0E000000
 #define KGSL_CONTEXT_PREEMPT_STYLE_SHIFT      25