Skip to content
Permalink
Jim-Cromie/use…
Switch branches/tags

Commits on Aug 22, 2021

  1. dyndbg: RFC add print-once and print-ratelimited features. RFC.

    Its tautological that having pr_debug()s with optional print-once and
    rate-limiting features could be useful.  Build it, they will come.
    
    The advantages:
    
    - dynamically configured with flags
    - can use them on existing callsites
    - printonce is easy, (almost) just new flags
      no additional resources
    - ratelimiting is pooled, expecting rare use
      provisioned only for enabled & ratelimited callsites
    - RFC ratelimit grouping
      mostly to reduce resources
      reduces to choice of hash key: module, function, file, line
    
    Whats done here:
    
    Expand ddebug.flags to 11 bits, and define new flags to support
    print-once and ratelimited semantics:
    
      echo file init/main.c +o > control	# init/main runs just once anyway
      echo module foo +r > control		# turn on ratelimiting
      echo module foo +g > control		# turn on group flag
    
    is_onced_or_ratelimited() tests these conditions, it is called from
    __dynamic_pr_debug() and others (which are all behind the '+p'
    enablement test).
    
    NB: test_dynamic_debug.ko ratelimiting test triggers reports on
    is_onced_or_ratelimited() as the limited source.
    
    PRINT-ONCE: can be done with just +2 bits in flags;
    
    .o _DPRINTK_FLAGS_ONCE     enables state test and set
    .P _DPRINTK_FLAGS_PRINTED  state bit
    
    Just adding the flags lets the existing code operate on them.
    We will need new code to enforce constraints on flag combos;
    '+ro' is nonsense, but this can wait, or can take a new meaning.
    
    RATE-LIMITING:
    
    .r _DPRINTK_FLAGS_RATELIMITED - track & limit prdbgs callrate
    
    We wait until a prdebug is called, and if RATELIMITED is set, THEN
    lookup a RateLimitState (RL) for it.  If found, bump its state and
    return true/false, otherwise create & initialize one and return false.
    
    RFC: GROUP-FLAG:
    
    .g _DPRINTK_FLAGS_GROUPED
    
    Currently, the hash-key is just the prdebug descriptor, so is unique
    per prdebug.  With the 'g' flag, we could use a different key, for
    example desc->site.function, to get a shared ratelimit for whole
    functions.
    
    This gets subtly different behavior at the ratelimit transition, but
    it is predictable for a given function (except perhaps recursive, but
    thats not done anyway).
    
    Note also that any function can have a single group of prdebugs, plus
    any number of prdbgs without 'g', either with or without 'r'.  So
    grouping should be flexible enough to use advantageously.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  2. dyndbg: RFC add debug-trace callback, selftest with it. RFC

    Sean Paul seanpaul@chromium.org proposed, in
    https://patchwork.freedesktop.org/series/78133/
    drm/trace: Mirror DRM debug logs to tracefs
    
    That patchset's objective is to be able to independently steer some of
    the debug stream to an alternate tracing destination, by splitting
    drm_debug_enabled() into syslog & trace flavors, and enabling them
    separately with a drm.debug_trace knob.
    
    2 advantages are identified:
      - syslog is heavyweight, alternate stream is lighter
      - steering selected categories separately means less traffic
    
    Dynamic-Debug can do this better:
    
    1- all work is behind jump-label's NOOP, Zero overhead when off.
    
    2- perfect site selectivity, no unwanted traffic.
    
    drm's debug categories are a general classification system, not one
    tailored to pick out the exact pool of pr_debugs to watch/trace.
    
    With drm.debug built on dyndbg, the given "drm:<cat>:" system can be
    used to select a base trace-set, which can then be adjusted +/-,
    and/or augmented with unrelated pr_debugs that just happen to be
    useful.  And this tweaking can be done at the command-line, and
    reduced to a script.
    
    Then the string-prefix "drm:<cat>:" system can be extended to suit.
    
    The basic elements:
    
     - add a new struct _ddebug member: (*tracer)(char *format, ...)
     - add a new T flag to enable tracer
     - adjust the static-key-enable/disable condition for (p|T)
     - if (p) before printk, since T enables too.
     - if (T) call tracer if its true
    
     = int dynamic_debug_register_tracer(query, modname, tracer);
     = int dynamic_debug_unregister_tracer(query, modname, cookie);
    
    This new interface lets clients set/unset a tracer function on each
    callsite matching the query, for example: "drm:atomic:fail:".
    
    Clients must unregister the same callsites they register, allowing
    protection of each client's dyndbg-state setup against overwrites by
    others, while allowing maximal sharing of 1 slot/callsite.
    
    The internal call-chain gets some rework: it gets new void* tracer
    param, which dynamic_debug_exec_queries() hides from public.
    
    And convert ddebug_exec_queries() to wrap __ddebug_exec_queries(), and
    move the query copy code to it.
    
    public:					passing down:
      dynamic_debug_(un)register_tracer	tracer
      dynamic_debug_exec_queries		tracer=NULL
      calling:
          ddebug_exec_queries		copies ro-query, tracer
              __ddebug_exec_queries		modifies query, tracer
                  ddebug_exec_query		modifies query, tracer
    
    Then adjust most ddebug_exec_queries users to __ddebug_exec_queries
    
    Intended Behavior: (things are in flux, RFC)
    
    - register sets empty slot, doesn't overwrite
      the query selects callsites, and sets +T (grammar requires +-action)
    
    - register allows same-tracer over-set wo warn
      2nd register can then enable superset, subset, disjoint set
    
    - unregister clears slot if it matches cookie/tracer
      query selects set, -T (as tested)
      tolerates over-clears
    
    - dd-exec-queries(+/-T) can modify the enablements
      not sure its needed, but it falls out..
    
    The code is currently in-line in ddebug_change(), to be moved to
    separate fn, rc determines flow, may also veto/alter changes by
    altering flag-settings - tbd.
    
    TBD: Im not sure what happens when exec-queries(+T) hits a site wo a
    tracer (silence I think. maybe not ideal).
    
    SELFTEST: test_dynamic_debug.ko:
    
    Uses the tracer facility to implement a selftest:
    
    - DUT(x) calls a set of categorized pr_debugs x times
    - A custom tracer counts the number of calls (of T-enabled pr_debugs),
    
    - test registers the tracer on the function,
      then iteratively:
      manipulates dyndbg states via query-cmds
      calls DUT(x)
      counts enabled callsite executions
      reports mismatches
    
    - modprobe test_dynamic_debug broken_tracer=1
      attaches a broken tracer: recursive on pr_debug
      Bad Things Happen.
      has thrown me interesting panics.
    
    This needs more work. RFC.
    waste of time due to use_bad_tracer properties ?
    
    NOTES:
    
    Next step: replace tracer member with a hashtable lookup, done only
    when T.  Registration then becomes populating the hashtable; mod->name
    would make a good key, which would limit tracer mapping granularity to
    1 registrant per module, but not enablement, which is still the
    per-callsite bit.
    
    ERRORS (or WARNINGS):
    
    It should be an error to +T a callsite which has no aux_print set (ie
    already registered with a query that selected that callsite).  This
    tacitly enforces registration.
    
    Then +T,-T can toggle those aux_print callsites (or subsets of them)
    to tailor the debug-stream for the purpose.  Controlling flow is the
    best work limiter.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  3. nouveau: fold multiple DRM_DEBUG_DRIVERs together

    With DRM_USE_DYNAMIC_DEBUG, each callsite record requires 56 bytes.
    We can combine 12 into one here and save ~620 bytes.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  4. amdgpu_ucode: reduce number of pr_debug calls

    There are blocks of DRM_DEBUG calls, consolidate their args into
    single calls.  With dynamic-debug in use, each callsite consumes 56
    bytes of ro callsite data, and this patch removes about 65 calls, so
    it saves ~3.5kb.
    
    no functional changes.
    
    RFC: this creates multi-line log messages, does that break any syslog
    conventions ?
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  5. drm_print: instrument drm_debug_enabled

    Duplicate drm_debug_enabled() code into both "basic" and "dyndbg"
    ifdef branches.  Then add a pr_debug("todo: ...") into the "dyndbg"
    branch.
    
    Then convert the "dyndbg" branch's code to a macro, so that its
    pr_debug() get its callsite info from the invoking function, instead
    of from drm_debug_enabled() itself.
    
    This gives us unique callsite info for the 8 remaining users of
    drm_debug_enabled(), and lets us enable them individually to see how
    much logging traffic they generate.  The oft-visited callsites can
    then be reviewed for runtime cost and possible optimizations.
    
    Heres what we get:
    
    bash-5.1# modprobe drm
    dyndbg: 384 debug prints in module drm
    bash-5.1# grep todo: /proc/dynamic_debug/control
    drivers/gpu/drm/drm_edid.c:1843 [drm]connector_bad_edid =_ "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_print.c:309 [drm]___drm_dbg =p "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_print.c:286 [drm]__drm_dev_dbg =p "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_vblank.c:1491 [drm]drm_vblank_restore =_ "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_vblank.c:787 [drm]drm_crtc_vblank_helper_get_vblank_timestamp_internal =_ "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_vblank.c:410 [drm]drm_crtc_accurate_vblank_count =_ "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_atomic_uapi.c:1457 [drm]drm_mode_atomic_ioctl =_ "todo: maybe avoid via dyndbg\012"
    drivers/gpu/drm/drm_edid_load.c:178 [drm]edid_load =_ "todo: maybe avoid via dyndbg\012"
    
    At quick glance, edid won't qualify, drm_print might, drm_vblank is
    strongest chance, maybe atomic-ioctl too.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  6. drm_print: add choice to use dynamic debug in drm-debug

    drm's debug system writes 10 distinct categories of messages to syslog
    using a small API[1]: drm_dbg*(10 names), DRM_DEBUG*(8 names),
    DRM_DEV_DEBUG*(3 names).  There are thousands of these callsites, each
    categorized by their authors.
    
    These callsites can be enabled at runtime by their category, each
    controlled by a bit in drm.debug (/sys/modules/drm/parameter/debug).
    In the current "basic" implementation, drm_debug_enabled() tests these
    bits in __drm_debug each time an API[1] call is executed; while cheap
    individually, the costs accumulate.
    
    This patch uses dynamic-debug with jump-label to patch enabled calls
    onto their respective NOOP slots, avoiding all runtime bit-checks of
    __drm_debug.
    
    Dynamic debug has no concept of category, but we can emulate one by
    replacing enum categories with a set of prefix-strings; "drm:core:",
    "drm:kms:" "drm:driver:" etc, and prepend them (at compile time) to
    the given formats.
    
    Then we can use:
      `echo module drm format "^drm:core: " +p > control`
    
    to enable the whole category with one query.
    
    This conversion yields ~2100 new callsites on my i7/i915 laptop:
    
      dyndbg: 195 debug prints in module drm_kms_helper
      dyndbg: 298 debug prints in module drm
      dyndbg: 1630 debug prints in module i915
    
    CONFIG_DRM_USE_DYNAMIC_DEBUG enables this, and is available if
    CONFIG_DYNAMIC_DEBUG or CONFIG_DYNAMIC_DEBUG_CORE is chosen, and if
    CONFIG_JUMP_LABEL is enabled; this because its required to get the
    promised optimizations.
    
    The "basic" -> "dyndbg" switchover is layered into the macro scheme
    
    A. use DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug, __drm_debug,
    		"DRM debug category-per-bit control",
       	  	{ "drm:core:", "enable CORE debug messages" },
       	  	{ "drm:kms:", "enable KMS debug messages" }, ...);
    
    B. A "classy" version of DRM_UT_<CATs> map, named DRM_DBG_CAT_<CATs>
    
       DRM_DBG_CLASS_<CATs> was proposed, I had agreed, but reconsidered;
       CATEGORY is already DRM's term-of-art, and adding a near-synonym
       'CLASS' only adds ambiguity.
    
       "basic":  DRM_DBG_CAT_<CATs>  <===  DRM_UT_<CATs>.  Identity map.
       "dyndbg":
         #define DRM_DBG_CAT_KMS    "drm:kms: "
         #define DRM_DBG_CAT_PRIME  "drm:prime: "
         #define DRM_DBG_CAT_ATOMIC "drm:atomic: "
    
       DRM_UT_* are preserved, since theyre used elsewhere.
       We can probably reduce its use further, but thats a separate thing.
    
    C. drm_dev_dbg() & drm_debug() are interposed with macros
    
         basic:	forward to renamed fn, with args preserved
         enabled:	redirect to pr_debug, dev_dbg, with CATEGORY # format
    
       this is where drm_debug_enabled() is avoided.
       prefix is prepended at compile-time, no category at runtime.
    
    D. API[1] uses DRM_DBG_CAT_<CAT>s
       these already use (C), now they use (B) too,
       to get the correct token type for "basic" and "dyndbg" configs.
    
    NOTES:
    
    Because the dyndbg callback is watching __drm_debug, it is coherent
    with drm_debug_enabled(), the switchover should be transparent.
    
    Code Review is expected to catch lack of correspondence between
    bit=>prefix definitions (the selector) and the prefixes used in the
    API[1] layer above pr_debug()
    
    I've coded the search-prefixes/categories with a trailing space, which
    excludes any sub-categories added later.  This convention protects any
    "drm:atomic:fail:" callsites from getting stomped on by `echo 0 > debug`.
    Other categories could differ, but we need some default.
    
    Dyndbg requires that the prefix be in the compiled-in format string;
    run-time prefixing evades callsite selection by category.
    
    	pr_debug("%s: ...", __func__, ...) // not ideal
    
    With "lineno X" in a query, its possible to enable single callsites,
    but it is tedious, and useless in a category context.
    
    Unfortunately __func__ is not a macro, and cannot be catenated at
    preprocess/compile time.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  7. amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES to control categorized pr…

    …_debugs
    
    logger_types.h defines many DC_LOG_*() categorized debug wrappers.
    Most of these use DRM debug API, so are controllable using drm.debug,
    but others use bare pr_debug("$prefix: .."), each with a different
    class-prefix matching "^\[\w+\]:"
    
    Use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create a /sys debug_dc
    parameter, modinfos, and to specify a map from bits -> categorized
    pr_debugs to be controlled.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  8. i915/gvt: use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create "gvt:core:" e…

    …tc categories
    
    The gvt component of this driver has ~120 pr_debugs, in 9 categories
    quite similar to those in DRM.  Following the interface model of
    drm.debug, add a parameter to map bits to these categorizations.
    
    DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug,
    	"dyndbg bitmap desc",
    	{ "gvt:cmd: ",  "command processing" },
    	{ "gvt:core: ", "core help" },
    	{ "gvt:dpy: ",  "display help" },
    	{ "gvt:el: ",   "help" },
    	{ "gvt:irq: ",  "help" },
    	{ "gvt:mm: ",   "help" },
    	{ "gvt:mmio: ", "help" },
    	{ "gvt:render: ", "help" },
    	{ "gvt:sched: " "help" });
    
    The actual patch has a few details different, cmd_help() macro emits
    the initialization construct.
    
    if CONFIG_DRM_USE_DYNAMIC_DEBUG, then -DDYNAMIC_DEBUG_MODULE is added
    cflags, by gvt/Makefile.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  9. i915/gvt: remove spaces in pr_debug "gvt: core:" etc prefixes

    Taking embedded spaces out of existing prefixes makes them better
    class-prefixes; simplifying the nested quoting needed otherwise:
    
      $> echo "format '^gvt: core:' +p" >control
    
    Dropping the internal spaces means any trailing space in a query will
    more clearly terminate the prefix being searched for.
    
    Consider a generic drm-debug example:
    
      # turn off ATOMIC reports
      echo format "^drm:atomic: " -p > control
    
      # turn off all ATOMIC:* reports, including any sub-categories
      echo format "^drm:atomic:" -p > control
    
      # turn on ATOMIC:FAIL: reports
      echo format "^drm:atomic:fail: " +p > control
    
    Removing embedded spaces in the class-prefixes simplifies the
    corresponding match-prefix.  This means that "quoted" match-prefixes
    are only needed when the trailing space is desired, in order to
    exclude explicitly sub-categorized pr-debugs; in this example,
    "drm:atomic:fail:".
    
    RFC: maybe the prefix catenation should paste in the " " class-prefix
    terminator explicitly.  A pr_debug_() flavor could exclude the " ",
    allowing ad-hoc sub-categorization by appending for example, "fail:"
    to "drm:atomic:".
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  10. dyndbg: add DEFINE_DYNAMIC_DEBUG_CATEGORIES and callbacks

    DEFINE_DYNAMIC_DEBUG_CATEGORIES(name, var, bitmap_desc, @bit_descs)
    allows users to define a drm.debug style (bitmap) sysfs interface, and
    to specify the desired mapping from bits[0-N] to the format-prefix'd
    pr_debug()s to be controlled.
    
    DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_gvt, __gvt_debug,
    	"i915/gvt bitmap desc",
    	/**
    	 * search-prefixes, passed to dd-exec_queries
    	 * defines bits 0-N in order.
    	 * leading ^ is tacitly inserted (by callback currently)
    	 * trailing space used here excludes subcats.
    	 * helper macro needs more work
    	 * macro to autogen ++$i, 0x%x$i ?
    	 */
    	_DD_cat_("gvt:cmd: "),
    	_DD_cat_("gvt:core: "),
    	_DD_cat_("gvt:dpy: "),
    	_DD_cat_("gvt:el: "),
    	_DD_cat_("gvt:irq: "),
    	_DD_cat_("gvt:mm: "),
    	_DD_cat_("gvt:mmio: "),
    	_DD_cat_("gvt:render: "),
    	_DD_cat_("gvt:sched: "));
    
    dynamic_debug.c: add 3 new elements:
    
     - int param_set_dyndbg()
     - int param_get_dyndbg()
     - struct kernel_param_ops param_ops_dyndbg
    
    Following the model of kernel/params.c STANDARD_PARAM_DEFS, All 3 are
    non-static and exported.
    
    dynamic_debug.h:
    
    Add DEFINE_DYNAMIC_DEBUG_CATEGORIES() described above, and a do-nothing stub.
    
    Note that it also calls MODULE_PARM_DESC for the user, but expects the
    user to catenate all the bit-descriptions together (as is done in
    drm.debug), and in the following uses in amdgpu, i915.
    
    This in the hope that someone can offer an auto-incrementing
    label-generating macro, producing "\tbit-4 0x10\t" etc, and can show
    how to apply it to __VA_ARGS__.
    
    Also extern the struct kernel_param param_ops_dyndbg symbol, as is
    done in moduleparams.h for all the STANDARD params.
    
    USAGE NOTES:
    
    Using dyndbg to query on "format ^$prefix" requires that the prefix be
    present in the compiled-in format string; where run-time prefixing is
    used, that format would be "%s...", which is not usefully selectable.
    
    Adding structural query terms (func,file,lineno) could help (module is
    already done), but DEFINE_DYNAMIC_DEBUG_CATEGORIES can't do that now,
    adding it needs a better reason imo.
    
    Dyndbg is completely agnostic wrt the categorization scheme used, to
    play well with any prefix convention already in use.  Ad-hoc
    categories and sub-categories are implicitly allowed, author
    discipline and review is expected.
    
    Here are some examples:
    
    "1","2","3"		2 doesn't imply 1.
       			otherwize, sorta like printk levels
    "1:","2:","3:"		are better, avoiding [1-9]\d+ ambiguity
    "hi:","mid:","low:"	are reasonable, and imply independence
    "todo:","rfc:","fixme:" might be handy
    "A:".."Z:"		uhm, yeah
    
    Hierarchical classes/categories are natural:
    
    "drm:<CAT>:"		is used in later commit
    "drm:<CAT>:<SUB>:"	is a natural extension.
    "drm:atomic:fail:"	has been proposed, sounds directly useful
    
    Some properties of a hierarchical category deserve explication:
    
    Trailing spaces matter !
    
    With 1..3-space ("drm: ", "drm:atomic: ", "drm:atomic:fail: "), the
    ":" doesn't terminate the search-space, the trailing space does.  So a
    "drm:" search spec will match all DRM categories & subcategories, and
    will not be useful in an interface where all categories are already
    controlled together.  That said, "drm:atomic:" & "drm:atomic: " are
    different, and both are useful in cases.
    
    Ad-Hoc sub-categories:
    
    These have a caveat wrt wrapper macros adding prefixes like
    "drm:atomic: "; the trailing space in the prefix means that
    drm_dbg_atomic("fail: ...") pastes as "drm:atomic: fail: ", which
    obviously isn't ideal wrt clear and simple bitmaps.
    
    A possible solution is to have a FOO_() version of every FOO() macro
    which (anti-mnemonically) elides the trailing space, which is normally
    inserted by a modified FOO().  Doing this would enforce a policy
    decision that "debug categories will be space terminated", with an
    pressure-relief valve.
    
    Summarizing:
    
     - "drm:kms: " & "drm:kms:" are different
     - "drm:kms"		also different - includes drm:kms2:
     - "drm:kms:\t"		also different
     - "drm:kms:*"		doesn't work, no wildcard on format atm.
    
    Order matters in DEFINE_DYNAMIC_DEBUG_CATEGORIES(... @bit_descs)
    
    @bit_descs (array) position determines the bit mapping to the prefix,
    so to keep a stable map, new categories or 3rd level categories must
    be added to the end.
    
    Since bits are/will-stay applied 0-N, the later bits can countermand
    the earlier ones, but its tricky - consider;
    
        DD_CATs(... "drm:atomic:", "drm:atomic:fail:" ) // misleading
    
    The 1st search-term is misleading, because it includes (modifies)
    subcategories, but then 2nd overrides it.  So don't do that.
    
    For "drm:atomic:fail:" in particular, its best not to add it into an
    existing bitmap, because the current setting would be lost at every
    (unrelated) write, and a separate bitmap is much more stable.
    
    There is still plenty of bikeshedding to do.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021
  11. moduleparam: add data member to struct kernel_param

    Add a const void* data member to the struct, to allow attaching
    private data that will be used soon by a setter method (via kp->data)
    to perform more elaborate actions.
    
    To attach the data at compile time, add new macros:
    
    module_param_cb_data() derives from module_param_cb(), adding data
    param, and latter is redefined to use former.
    
    It calls __module_param_call_with_data(), which accepts new data param
    and inits .data with it. Re-define __module_param_call() to use it.
    
    Use of this new data member will be rare, it might be worth redoing
    this as a separate/sub-type to de-bloat the base case.
    
    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    jimc authored and intel-lab-lkp committed Aug 22, 2021

Commits on Aug 20, 2021

  1. drm/i915/dp: Use max params for panels < eDP 1.4

    Users reported that after commit 2bbd6db ("drm/i915: Try to use
    fast+narrow link on eDP again and fall back to the old max strategy on
    failure"), the screen starts to have wobbly effect.
    
    Commit a5c936a ("drm/i915/dp: Use slow and wide link training for
    everything") doesn't help either, that means the affected eDP 1.2 panels
    only work with max params.
    
    So use max params for panels < eDP 1.4 as Windows does to solve the
    issue.
    
    v3:
     - Do the eDP rev check in intel_edp_init_dpcd()
    
    v2:
     - Check eDP 1.4 instead of DPCD 1.1 to apply max params
    
    Cc: stable@vger.kernel.org
    Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/3714
    Fixes: 2bbd6db ("drm/i915: Try to use fast+narrow link on eDP again and fall back to the old max strategy on failure")
    Fixes: a5c936a ("drm/i915/dp: Use slow and wide link training for everything")
    Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210820075301.693099-1-kai.heng.feng@canonical.com
    khfeng authored and vsyrjala committed Aug 20, 2021
  2. drm/i915/fbc: Polish the skl+ FBC stride override handling

    Polish the FBC stride override stuff:
    - just call it override_cfb_stride since it'll be used on
      more gens later
    - Use REG_BIT() & co. for the registers and give everything
      CHICKEN_ prefix since glk+ will have a different register
      for this
    - Use intel_de_rmw() for the RMW
    
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210702204603.596-5-ville.syrjala@linux.intel.com
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    vsyrjala committed Aug 20, 2021
  3. drm/i915/fbc: Move the "recompress on activate" to a central place

    On ILK+ we current do a nuke right after activating FBC. If my
    memory isn't playing tricks on me this is actially required if
    FBC didn't stay disabled for a full frame. In that case the
    deactivate+reactivate may not invalidate the cfb. I'd have to
    double chekc to be sure though.
    
    So let's keep the nuke, and just extend it backwards to cover
    all the platforms by doing it a bit higher up.
    
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210702204603.596-4-ville.syrjala@linux.intel.com
    vsyrjala committed Aug 20, 2021
  4. drm/i915/fbc: Extract intel_fbc_update()

    Pull the fbc enable vs. disable stuff into a small helper so
    we don't have to have it pollute the higher level modeset code.
    
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210702204603.596-3-ville.syrjala@linux.intel.com
    vsyrjala committed Aug 20, 2021
  5. drm/i915/fbc: Rewrite the FBC tiling check a bit

    Write the tiling check in a nicer form. No functional
    changes due to Y-tile scanout being a gen9+ feature.
    
    Reviewed-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210702204603.596-2-ville.syrjala@linux.intel.com
    vsyrjala committed Aug 20, 2021
  6. drm/i915/fdi: move intel_fdi_link_freq() to intel_fdi.[ch]

    There's no performance reason to have it as static inline; move it out
    of intel_display_types.h to reduce clutter and dependency on i915_drv.h.
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/8c9bb23d92878deb1ecc75427ec6648bd3505816.1629281426.git.jani.nikula@intel.com
    jnikula committed Aug 20, 2021
  7. drm/i915/panel: move intel_panel_use_ssc() out of headers

    There's no performance reason to have it as static inline; move it out
    of intel_display_types.h to reduce clutter and dependency on i915_drv.h.
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/6f2c05005e4fa43a5572b02b3f41363725ffdb4f.1629281426.git.jani.nikula@intel.com
    jnikula committed Aug 20, 2021
  8. drm/i915/pm: use forward declaration to remove an include

    The fewer includes the better.
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/dcb426e4c6497f9ee3356c5f4fd4aaabd6295262.1629281426.git.jani.nikula@intel.com
    jnikula committed Aug 20, 2021
  9. drm/i915: intel_runtime_pm.h does not actually need intel_display.h

    Reduce includes.
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/289a6837379c4422395c3ac2b36a6c2a44110227.1629281426.git.jani.nikula@intel.com
    jnikula committed Aug 20, 2021
  10. drm/i915/irq: reduce inlines to reduce header dependencies

    Presumably if the compiler is smart, it does not generate an extra
    function call to the update functions that are now static.
    
    Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/594f628740717cda5ef407a26ea03129c22ddc12.1629281426.git.jani.nikula@intel.com
    jnikula committed Aug 20, 2021

Commits on Aug 18, 2021

  1. drm/i915/adl_p: Also disable underrun recovery with MSO

    One of the cases that the bspec lists for when underrun recovery must be
    disabled is "COG;" that note actually refers to eDP multi-segmented
    operation (MSO).  Let's ensure the this additional restriction is
    honored by the driver.
    
    Bspec: 50351
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Fixes: ba3b049 ("drm/i915/adl_p: Allow underrun recovery when possible")
    Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210816204112.2960624-1-matthew.d.roper@intel.com
    Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
    mattrope committed Aug 18, 2021
  2. drm/i915/dp: return proper DPRX link training result

    After DPRX link training, intel_dp_link_train_phy() did not
    return the training result properly. If link training failed,
    i915 driver would not run into link train fallback function.
    And no hotplug uevent would be received by user space application.
    
    Fixes: b30edfd ("drm/i915: Switch to LTTPR non-transparent mode link training")
    Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Cooper Chiou <cooper.chiou@intel.com>
    Cc: William Tseng <william.tseng@intel.com>
    Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
    Reviewed-by: Imre Deak <imre.deak@intel.com>
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210706152541.25021-1-shawn.c.lee@intel.com
    ShawnCLee authored and ideak committed Aug 18, 2021

Commits on Aug 16, 2021

  1. drm/i915: Nuke ORIGIN_GTT

    There is no users of it, so no need to keep handling for it.
    
    Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210815014346.373945-2-jose.souza@intel.com
    zehortigoza committed Aug 16, 2021
  2. drm/i915/display: Fix sel fetch plane offset calculation

    skl_calc_main_surface_offset() is used to calculate an aligned plane
    surface address considering the inner framebuffer x and y offset.
    It can not be used by selective fetch functions becase there is no
    PLANE_SEL_FETCH_SURF.
    So the PLANE_SEL_FETCH_OFFSET.y should only be PLANE_OFFSET.y +
    damaged_area_within_plane.y1.
    
    This fixes glitches seen in fbcon caused by typing something in
    the terminal.
    
    BSpec: 55229
    Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210815014346.373945-1-jose.souza@intel.com
    zehortigoza committed Aug 16, 2021
  3. drm/i915/dp: remove superfluous EXPORT_SYMBOL()

    The symbol isn't needed outside of i915.ko.
    
    Fixes: b30edfd ("drm/i915: Switch to LTTPR non-transparent mode link training")
    Fixes: 264613b ("drm/i915: Disable LTTPR support when the DPCD rev < 1.4")
    Cc: Imre Deak <imre.deak@intel.com>
    Reviewed-by: Imre Deak <imre.deak@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210816071737.2917-1-jani.nikula@intel.com
    jnikula committed Aug 16, 2021
  4. Merge drm/drm-next into drm-intel-next

    Catch up with drm core changes.
    
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    jnikula committed Aug 16, 2021
  5. Merge tag 'drm-misc-next-2021-08-12' of git://anongit.freedesktop.org…

    …/drm/drm-misc into drm-next
    
    drm-misc-next for v5.15:
    
    UAPI Changes:
    
    Cross-subsystem Changes:
    - Add lockdep_assert(once) helpers.
    
    Core Changes:
    - Add lockdep assert to drm_is_current_master_locked.
    - Fix typos in dma-buf documentation.
    - Mark drm irq midlayer as legacy only.
    - Fix GPF in udmabuf_create.
    - Rename member to correct value in drm_edid.h
    
    Driver Changes:
    - Build fix to make nouveau build with NOUVEAU_BACKLIGHT.
    - Add MI101AIT-ICP1, LTTD800480070-L6WWH-RT panels.
    - Assorted fixes to bridge/it66121, anx7625.
    - Add custom crtc_state to simple helpers, and use it to
      convert pll handling in mgag200 to atomic.
    - Convert drivers to use offset-adjusted framebuffer bo mappings.
    - Assorted small fixes and fix for a use-after-free in vmwgfx.
    - Convert remaining callers of non-legacy drivers to use linux irqs directly.
    - Small cleanup in ingenic.
    - Small fixes to virtio and ti-sn65dsi86.
    
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    
    From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/1cf2d7fc-402d-1852-574a-21cbbd2eaebf@linux.intel.com
    airlied committed Aug 16, 2021

Commits on Aug 13, 2021

  1. drm/i915/dg2: add SNPS PHY translations for UHBR link rates

    UHBR link rates use different tx equalization settings. Using this will
    require changes in the link training code too.
    
    Bspec: 53920
    Cc: Manasi Navare <manasi.d.navare@intel.com>
    Cc: Matt Roper <matthew.d.roper@intel.com>
    Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210813115151.19290-3-jani.nikula@intel.com
    jnikula committed Aug 13, 2021
  2. drm/i915/dg2: use existing mechanisms for SNPS PHY translations

    We use encoder->get_buf_trans() in many places, for example
    intel_ddi_dp_voltage_max(), and the hook was set to some old platform's
    function for DG2 SNPS PHY. Convert SNPS PHY to use the same translation
    mechanisms as everything else.
    
    Cc: Manasi Navare <manasi.d.navare@intel.com>
    Cc: Matt Roper <matthew.d.roper@intel.com>
    Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210813115151.19290-2-jani.nikula@intel.com
    jnikula committed Aug 13, 2021
  3. drm/i915/dp: pass crtc_state to intel_ddi_dp_level()

    Needed in the future.
    
    Cc: Manasi Navare <manasi.d.navare@intel.com>
    Cc: Matt Roper <matthew.d.roper@intel.com>
    Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210813115151.19290-1-jani.nikula@intel.com
    jnikula committed Aug 13, 2021
  4. drm/i915/mst: use intel_de_rmw() to simplify VC payload alloc set/clear

    Less is more, fewer lines to wonder about.
    
    Cc: Manasi Navare <manasi.d.navare@intel.com>
    Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210813115610.20010-1-jani.nikula@intel.com
    jnikula committed Aug 13, 2021
  5. drm/i915/edp: fix eDP MSO pipe sanity checks for ADL-P

    ADL-P supports stream splitter on pipe B in addition to pipe A. Update
    the sanity check in intel_ddi_mso_get_config() to reflect this, and
    remove the check in intel_ddi_mso_configure() as redundant with
    encoder->pipe_mask. Abstract the splitter pipe mask to a single point of
    truth while at it to avoid similar mistakes in the future.
    
    Fixes: 7bc188c ("drm/i915/adl_p: enable MSO on pipe B")
    Cc: Uma Shankar <uma.shankar@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Swati Sharma <swati2.sharma@intel.com>
    Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
    Tested-by: Swati Sharma <swati2.sharma@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210812132354.10885-1-jani.nikula@intel.com
    jnikula committed Aug 13, 2021
  6. fbdev/efifb: Release PCI device's runtime PM ref during FB destroy

    Atm the EFI FB platform driver gets a runtime PM reference for the
    associated GFX PCI device during probing the EFI FB platform device and
    releases it only when the platform device gets unbound.
    
    When fbcon switches to the FB provided by the PCI device's driver (for
    instance i915/drmfb), the EFI FB will get only unregistered without the
    EFI FB platform device getting unbound, keeping the runtime PM reference
    acquired during the platform device probing. This reference will prevent
    the PCI driver from runtime suspending the device.
    
    Fix this by releasing the RPM reference from the EFI FB's destroy hook,
    called when the FB gets unregistered.
    
    While at it assert that pm_runtime_get_sync() didn't fail.
    
    v2:
    - Move pm_runtime_get_sync() before register_framebuffer() to avoid its
      race wrt. efifb_destroy()->pm_runtime_put(). (Daniel)
    - Assert that pm_runtime_get_sync() didn't fail.
    - Clarify commit message wrt. platform/PCI device/driver and driver
      removal vs. device unbinding.
    
    Fixes: a6c0fd3 ("efifb: Ensure graphics device for efifb stays at PCI D0")
    Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v1)
    Acked-by: Alex Deucher <alexander.deucher@amd.com>
    Acked-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Imre Deak <imre.deak@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210809133146.2478382-1-imre.deak@intel.com
    ideak committed Aug 13, 2021

Commits on Aug 12, 2021

  1. drm/bridge: ti-sn65dsi86: Avoid creating multiple connectors

    If we created our own connector because the driver does not support the
    NO_CONNECTOR flag, we don't want the downstream bridge to *also* create
    a connector.  And if this driver did pass the NO_CONNECTOR flag (and we
    supported that mode) this would change nothing.
    
    Fixes: 4e5763f ("drm/bridge: ti-sn65dsi86: Wrap panel with panel-bridge")
    Reported-by: Stephen Boyd <swboyd@chromium.org>
    Signed-off-by: Rob Clark <robdclark@chromium.org>
    Tested-by: Stephen Boyd <swboyd@chromium.org>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Tested-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210811235253.924867-2-robdclark@gmail.com
    Rob Clark authored and dianders committed Aug 12, 2021
Older