diff mbox series

[1/4] drm/i915: Add pipe crc tracepoint

Message ID 20190206204910.13965-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/i915: Add pipe crc tracepoint | expand

Commit Message

Ville Syrjälä Feb. 6, 2019, 8:49 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a tracepoint for pipe crc. Makes life much simpler when staring at
traces when hunting for fifo underruns and other issues which cause
corrupted frames. We'll add the tracepoint before filtering out any
potentially bogus crcs during modeset (should actually verify if that
filtering is even correct anymore...)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c   |  9 +++------
 drivers/gpu/drm/i915/i915_trace.h | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 6 deletions(-)

Comments

kernel test robot Feb. 7, 2019, 5:23 a.m. UTC | #1
Hi Ville,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20190206]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-Add-pipe-crc-tracepoint/20190207-123120
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x009-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:98,
                    from drivers/gpu/drm/i915/i915_trace.h:951,
                    from drivers/gpu/drm/i915/i915_trace_points.c:13:
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h: In function '__bpf_trace_intel_pipe_crc':
>> include/trace/bpf_probe.h:39:17: error: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Werror=sizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:32:35: note: in definition of macro 'UINTTYPE'
     __typeof__(__builtin_choose_expr(size == 1,  (u8)1, \
                                      ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
>> include/trace/bpf_probe.h:39:17: error: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Werror=sizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:33:28: note: in definition of macro 'UINTTYPE'
         __builtin_choose_expr(size == 2, (u16)2, \
                               ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
>> include/trace/bpf_probe.h:39:17: error: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Werror=sizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:34:28: note: in definition of macro 'UINTTYPE'
         __builtin_choose_expr(size == 4, (u32)3, \
                               ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
>> include/trace/bpf_probe.h:39:17: error: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Werror=sizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:35:28: note: in definition of macro 'UINTTYPE'
         __builtin_choose_expr(size == 8, (u64)4, \
                               ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
   cc1: all warnings being treated as errors

vim +39 include/trace/bpf_probe.h

c4f6699d Alexei Starovoitov 2018-03-28  29  
c4f6699d Alexei Starovoitov 2018-03-28  30  /* cast any integer, pointer, or small struct to u64 */
c4f6699d Alexei Starovoitov 2018-03-28  31  #define UINTTYPE(size) \
c4f6699d Alexei Starovoitov 2018-03-28  32  	__typeof__(__builtin_choose_expr(size == 1,  (u8)1, \
c4f6699d Alexei Starovoitov 2018-03-28  33  		   __builtin_choose_expr(size == 2, (u16)2, \
c4f6699d Alexei Starovoitov 2018-03-28  34  		   __builtin_choose_expr(size == 4, (u32)3, \
c4f6699d Alexei Starovoitov 2018-03-28  35  		   __builtin_choose_expr(size == 8, (u64)4, \
c4f6699d Alexei Starovoitov 2018-03-28  36  					 (void)5)))))
c4f6699d Alexei Starovoitov 2018-03-28  37  #define __CAST_TO_U64(x) ({ \
c4f6699d Alexei Starovoitov 2018-03-28  38  	typeof(x) __src = (x); \
c4f6699d Alexei Starovoitov 2018-03-28 @39  	UINTTYPE(sizeof(x)) __dst; \
c4f6699d Alexei Starovoitov 2018-03-28  40  	memcpy(&__dst, &__src, sizeof(__dst)); \
c4f6699d Alexei Starovoitov 2018-03-28  41  	(u64)__dst; })
c4f6699d Alexei Starovoitov 2018-03-28  42  

:::::: The code at line 39 was first introduced by commit
:::::: c4f6699dfcb8558d138fe838f741b2c10f416cf9 bpf: introduce BPF_RAW_TRACEPOINT

:::::: TO: Alexei Starovoitov <ast@kernel.org>
:::::: CC: Daniel Borkmann <daniel@iogearbox.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Feb. 7, 2019, 6:01 a.m. UTC | #2
Hi Ville,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on next-20190206]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-Add-pipe-crc-tracepoint/20190207-123120
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x001-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/trace/define_trace.h:98,
                    from drivers/gpu/drm/i915/i915_trace.h:951,
                    from drivers/gpu/drm/i915/i915_trace_points.c:13:
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h: In function '__bpf_trace_intel_pipe_crc':
>> include/trace/bpf_probe.h:39:17: warning: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Wsizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:32:35: note: in definition of macro 'UINTTYPE'
     __typeof__(__builtin_choose_expr(size == 1,  (u8)1, \
                                      ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
>> include/trace/bpf_probe.h:39:17: warning: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Wsizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:33:28: note: in definition of macro 'UINTTYPE'
         __builtin_choose_expr(size == 2, (u16)2, \
                               ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
>> include/trace/bpf_probe.h:39:17: warning: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Wsizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:34:28: note: in definition of macro 'UINTTYPE'
         __builtin_choose_expr(size == 4, (u32)3, \
                               ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~
>> include/trace/bpf_probe.h:39:17: warning: 'sizeof' on array function parameter 'crcs' will return size of 'const u32 *' {aka 'const unsigned int *'} [-Wsizeof-array-argument]
     UINTTYPE(sizeof(x)) __dst; \
                    ^
   include/trace/bpf_probe.h:35:28: note: in definition of macro 'UINTTYPE'
         __builtin_choose_expr(size == 8, (u64)4, \
                               ^~~~
   include/trace/bpf_probe.h:43:24: note: in expansion of macro '__CAST_TO_U64'
    #define __CAST1(a,...) __CAST_TO_U64(a)
                           ^~~~~~~~~~~~~
   include/trace/bpf_probe.h:44:42: note: in expansion of macro '__CAST1'
    #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__)
                                             ^~~~~~~
   include/linux/kernel.h:986:24: note: in expansion of macro '__CAST2'
    #define __CONCAT(a, b) a ## b
                           ^
   include/linux/kernel.h:987:27: note: in expansion of macro '__CONCAT'
    #define CONCATENATE(a, b) __CONCAT(a, b)
                              ^~~~~~~~
   include/trace/bpf_probe.h:56:26: note: in expansion of macro 'CONCATENATE'
    #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)
                             ^~~~~~~~~~~
   include/trace/bpf_probe.h:64:53: note: in expansion of macro 'CAST_TO_U64'
     CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \
                                                        ^~~~~~~~~~~
   include/trace/trace_events.h:74:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
     DECLARE_EVENT_CLASS(name,          \
     ^~~~~~~~~~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:50: note: declared here
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
                                           ~~~~~~~~~~^~~~~~~
   include/trace/bpf_probe.h:61:34: note: in definition of macro 'DECLARE_EVENT_CLASS'
    __bpf_trace_##call(void *__data, proto)     \
                                     ^~~~~
   include/trace/trace_events.h:75:9: note: in expansion of macro 'PARAMS'
            PARAMS(proto),         \
            ^~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:19:1: note: in expansion of macro 'TRACE_EVENT'
    TRACE_EVENT(intel_pipe_crc,
    ^~~~~~~~~~~
   include/trace/../../drivers/gpu/drm/i915/i915_trace.h:20:6: note: in expansion of macro 'TP_PROTO'
         TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
         ^~~~~~~~

vim +39 include/trace/bpf_probe.h

c4f6699d Alexei Starovoitov 2018-03-28  29  
c4f6699d Alexei Starovoitov 2018-03-28  30  /* cast any integer, pointer, or small struct to u64 */
c4f6699d Alexei Starovoitov 2018-03-28  31  #define UINTTYPE(size) \
c4f6699d Alexei Starovoitov 2018-03-28  32  	__typeof__(__builtin_choose_expr(size == 1,  (u8)1, \
c4f6699d Alexei Starovoitov 2018-03-28  33  		   __builtin_choose_expr(size == 2, (u16)2, \
c4f6699d Alexei Starovoitov 2018-03-28  34  		   __builtin_choose_expr(size == 4, (u32)3, \
c4f6699d Alexei Starovoitov 2018-03-28  35  		   __builtin_choose_expr(size == 8, (u64)4, \
c4f6699d Alexei Starovoitov 2018-03-28  36  					 (void)5)))))
c4f6699d Alexei Starovoitov 2018-03-28  37  #define __CAST_TO_U64(x) ({ \
c4f6699d Alexei Starovoitov 2018-03-28  38  	typeof(x) __src = (x); \
c4f6699d Alexei Starovoitov 2018-03-28 @39  	UINTTYPE(sizeof(x)) __dst; \
c4f6699d Alexei Starovoitov 2018-03-28  40  	memcpy(&__dst, &__src, sizeof(__dst)); \
c4f6699d Alexei Starovoitov 2018-03-28  41  	(u64)__dst; })
c4f6699d Alexei Starovoitov 2018-03-28  42  

:::::: The code at line 39 was first introduced by commit
:::::: c4f6699dfcb8558d138fe838f741b2c10f416cf9 bpf: introduce BPF_RAW_TRACEPOINT

:::::: TO: Alexei Starovoitov <ast@kernel.org>
:::::: CC: Daniel Borkmann <daniel@iogearbox.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Rodrigo Vivi Feb. 13, 2019, 5:40 p.m. UTC | #3
On Wed, Feb 06, 2019 at 10:49:07PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a tracepoint for pipe crc. Makes life much simpler when staring at
> traces when hunting for fifo underruns and other issues which cause
> corrupted frames. We'll add the tracepoint before filtering out any
> potentially bogus crcs during modeset (should actually verify if that
> filtering is even correct anymore...)
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_irq.c   |  9 +++------
>  drivers/gpu/drm/i915/i915_trace.h | 25 +++++++++++++++++++++++++
>  2 files changed, 28 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 441d2674b272..92bb32ed27fb 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1693,7 +1693,9 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
>  {
>  	struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
>  	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
> -	u32 crcs[5];
> +	u32 crcs[5] = { crc0, crc1, crc2, crc3, crc4 };
> +
> +	trace_intel_pipe_crc(crtc, crcs);
>  
>  	spin_lock(&pipe_crc->lock);
>  	/*
> @@ -1712,11 +1714,6 @@ static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
>  	}
>  	spin_unlock(&pipe_crc->lock);
>  
> -	crcs[0] = crc0;
> -	crcs[1] = crc1;
> -	crcs[2] = crc2;
> -	crcs[3] = crc3;
> -	crcs[4] = crc4;
>  	drm_crtc_add_crc_entry(&crtc->base, true,
>  				drm_crtc_accurate_vblank_count(&crtc->base),
>  				crcs);
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index eab313c3163c..308d36926335 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -18,6 +18,31 @@
>  
>  /* watermark/fifo updates */
>  
> +TRACE_EVENT(intel_pipe_crc,
> +	    TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
> +	    TP_ARGS(crtc, crcs),
> +
> +	    TP_STRUCT__entry(
> +			     __field(enum pipe, pipe)
> +			     __field(u32, frame)
> +			     __field(u32, scanline)
> +			     __array(u32, crcs, 5)
> +			     ),
> +
> +	    TP_fast_assign(
> +			   __entry->pipe = crtc->pipe;
> +			   __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
> +										       crtc->pipe);
> +			   __entry->scanline = intel_get_crtc_scanline(crtc);
> +			   memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
> +			   ),
> +
> +	    TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x",
> +		      pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
> +		      __entry->crcs[0], __entry->crcs[1], __entry->crcs[2],
> +		      __entry->crcs[3], __entry->crcs[4])
> +);
> +
>  TRACE_EVENT(intel_cpu_fifo_underrun,
>  	    TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
>  	    TP_ARGS(dev_priv, pipe),
> -- 
> 2.19.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 441d2674b272..92bb32ed27fb 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1693,7 +1693,9 @@  static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 {
 	struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
 	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
-	u32 crcs[5];
+	u32 crcs[5] = { crc0, crc1, crc2, crc3, crc4 };
+
+	trace_intel_pipe_crc(crtc, crcs);
 
 	spin_lock(&pipe_crc->lock);
 	/*
@@ -1712,11 +1714,6 @@  static void display_pipe_crc_irq_handler(struct drm_i915_private *dev_priv,
 	}
 	spin_unlock(&pipe_crc->lock);
 
-	crcs[0] = crc0;
-	crcs[1] = crc1;
-	crcs[2] = crc2;
-	crcs[3] = crc3;
-	crcs[4] = crc4;
 	drm_crtc_add_crc_entry(&crtc->base, true,
 				drm_crtc_accurate_vblank_count(&crtc->base),
 				crcs);
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index eab313c3163c..308d36926335 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -18,6 +18,31 @@ 
 
 /* watermark/fifo updates */
 
+TRACE_EVENT(intel_pipe_crc,
+	    TP_PROTO(struct intel_crtc *crtc, const u32 crcs[5]),
+	    TP_ARGS(crtc, crcs),
+
+	    TP_STRUCT__entry(
+			     __field(enum pipe, pipe)
+			     __field(u32, frame)
+			     __field(u32, scanline)
+			     __array(u32, crcs, 5)
+			     ),
+
+	    TP_fast_assign(
+			   __entry->pipe = crtc->pipe;
+			   __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
+										       crtc->pipe);
+			   __entry->scanline = intel_get_crtc_scanline(crtc);
+			   memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
+			   ),
+
+	    TP_printk("pipe %c, frame=%u, scanline=%u crc=%08x %08x %08x %08x %08x",
+		      pipe_name(__entry->pipe), __entry->frame, __entry->scanline,
+		      __entry->crcs[0], __entry->crcs[1], __entry->crcs[2],
+		      __entry->crcs[3], __entry->crcs[4])
+);
+
 TRACE_EVENT(intel_cpu_fifo_underrun,
 	    TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
 	    TP_ARGS(dev_priv, pipe),