• Akash Goel's avatar
    drm/i915: Add a relay backed debugfs interface for capturing GuC logs · f8240835
    Akash Goel authored
    Added a new debugfs interface '/sys/kernel/debug/dri/guc_log' for the
    User to capture GuC firmware logs. Availed relay framework to implement
    the interface, where Driver will have to just use a relay API to store
    snapshots of the GuC log buffer in the buffer managed by relay.
    The snapshot will be taken when GuC firmware sends a log buffer flush
    interrupt and up to four snapshots could be stored in the relay buffer.
    The relay buffer will be operated in a mode where it will overwrite the
    data not yet collected by User.
    Besides mmap method, through which User can directly access the relay
    buffer contents, relay also supports the 'poll' method. Through the 'poll'
    call on log file, User can come to know whenever a new snapshot of the
    log buffer is taken by Driver, so can run in tandem with the Driver and
    capture the logs in a sustained/streaming manner, without any loss of data.
    
    v2: Defer the creation of relay channel & associated debugfs file, as
        debugfs setup is now done at the end of i915 Driver load. (Chris)
    
    v3:
    - Switch to no-overwrite mode for relay.
    - Fix the relay sub buffer switching sequence.
    
    v4:
    - Update i915 Kconfig to select RELAY config. (TvrtKo)
    - Log a message when there is no sub buffer available to capture
      the GuC log buffer. (Tvrtko)
    - Increase the number of relay sub buffers to 8 from 4, to have
      sufficient buffering for boot time logs
    
    v5:
    - Fix the alignment, indentation issues and some minor cleanup. (Tvrtko)
    - Update the comment to elaborate on why a relay channel has to be
      associated with the debugfs file. (Tvrtko)
    
    v6:
    - Move the write to 'is_global' after the NULL check on parent directory
      dentry pointer. (Tvrtko)
    
    v7: Add a BUG_ON to validate relay buffer allocation size. (Chris)
    
    Testcase: igt/tools/intel_guc_logger
    Suggested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: default avatarSourab Gupta <sourab.gupta@intel.com>
    Signed-off-by: default avatarAkash Goel <akash.goel@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    f8240835
Kconfig 3.71 KB