xref: /OK3568_Linux_fs/kernel/Documentation/csf_sync_state_dump.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
2#
3# (C) COPYRIGHT 2022 ARM Limited. All rights reserved.
4#
5# This program is free software and is provided to you under the terms of the
6# GNU General Public License version 2 as published by the Free Software
7# Foundation, and any use by you of this program is subject to the terms
8# of such GNU license.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, you can access it online at
17# http://www.gnu.org/licenses/gpl-2.0.html.
18#
19#
20
21DebugFS interface:
22------------------
23
24A new per-kbase-context debugfs file called csf_sync has been implemented
25which captures the current KCPU & GPU queue state of the not-yet-completed
26operations and displayed through the debugfs file.
27This file is at:
28=======================================================
29/sys/kernel/debug/mali0/ctx/<pid>_<context id>/csf_sync
30=======================================================
31
32Output Format:
33----------------
34
35The csf_sync file contains important data for the currently active queues.
36This data is formatted into two segments, which are separated by a
37pipe character: the common properties and the operation-specific properties.
38
39Common Properties:
40------------------
41
42* Queue type: GPU or KCPU.
43* kbase context id and the queue id.
44* If the queue type is a GPU queue then the group handle is also noted,
45in the middle of the other two IDs. The slot value is also dumped.
46* Execution status, which can either be 'P' for pending or 'S' for started.
47* Command type is then output which indicates the type of dependency
48(i.e. wait or signal).
49* Object address which is a pointer to the sync object that the
50command operates on.
51* The live value, which is the value of the synchronization object
52at the time of dumping. This could help to determine why wait
53operations might be blocked.
54
55Operation-Specific Properties:
56------------------------------
57
58The operation-specific values for KCPU queue fence operations
59are as follows: a unique timeline name, timeline context, and a fence
60sequence number. The CQS WAIT and CQS SET are denoted in the sync dump
61as their OPERATION counterparts, and therefore show the same operation
62specific values; the argument value to wait on or set to, and operation type,
63being (by definition) op:gt and op:set for CQS_WAIT and CQS_SET respectively.
64
65There are only two operation-specific values for operations in GPU queues
66which are always shown; the argument value to wait on or set/add to,
67and the operation type (set/add) or wait condition (e.g. LE, GT, GE).
68
69Examples
70--------
71GPU Queue Example
72------------------
73
74The following output is of a GPU queue, from a process that has a KCTX ID of 52,
75is in Queue Group (CSG) 0, and has Queue ID 0. It has started and is waiting on
76the object at address 0x0000007f81ffc800. The live value is 0,
77as is the arg value. However, the operation "op" is GT, indicating it's waiting
78for the live value to surpass the arg value:
79
80======================================================================================================================================
81queue:GPU-52-0-0 exec:S cmd:SYNC_WAIT slot:4 obj:0x0000007f81ffc800 live_value:0x0000000000000000 | op:gt arg_value:0x0000000000000000
82======================================================================================================================================
83
84The following is an example of GPU queue dump, where the SYNC SET operation
85is blocked by the preceding SYNC WAIT operation. This shows two GPU queues,
86with the same KCTX ID of 8, Queue Group (CSG) 0, and Queue ID 0. The SYNC WAIT
87operation has started, while the SYNC SET is pending, blocked by the SYNC WAIT.
88Both operations are on the same slot, 2 and have live value of 0. The SYNC WAIT
89is waiting on the object at address 0x0000007f81ffc800, while the SYNC SET will
90set the object at address 0x00000000a3bad4fb when it is unblocked.
91The operation "op" is GT for the SYNC WAIT, indicating it's waiting for the
92live value to surpass the arg value, while the operation and arg value for the
93SYNC SET is "set" and "1" respectively:
94
95======================================================================================================================================
96queue:GPU-8-0-0 exec:S cmd:SYNC_WAIT slot:2 obj:0x0000007f81ffc800 live_value:0x0000000000000000 | op:gt arg_value:0x0000000000000000
97queue:GPU-8-0-0 exec:P cmd:SYNC_SET slot:2 obj:0x00000000a3bad4fb live_value:0x0000000000000000 | op:set arg_value:0x0000000000000001
98======================================================================================================================================
99
100KCPU Queue Example
101------------------
102
103The following is an example of a KCPU queue, from a process that has
104a KCTX ID of 0 and has Queue ID 1. It has started and is waiting on the
105object at address 0x0000007fbf6f2ff8. The live value is currently 0 with
106the "op" being GT indicating it is waiting on the live value to
107surpass the arg value.
108
109===============================================================================================================================
110queue:KCPU-0-1 exec:S cmd:CQS_WAIT_OPERATION obj:0x0000007fbf6f2ff8 live_value:0x0000000000000000 | op:gt arg_value: 0x00000000
111===============================================================================================================================
112