1. 19 Aug, 2024 12 commits
    • Ian Rogers's avatar
      perf map: API clean up · a0310736
      Ian Rogers authored
      map__init() is only used internally so make it static. Assume memory is
      zero initialized, which will better support adding fields to struct
      map in the future and was already the case for map__new2.
      
      To reduce complexity, change set_priv and set_erange_warned to not take
      a value to assign as they always assign true.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Anne Macedo <retpolanne@posteo.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Casey Chen <cachen@purestorage.com>
      Cc: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Dominique Martinet <asmadeus@codewreck.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@linaro.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sun Haiyong <sunhaiyong@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yunseong Kim <yskelg@gmail.com>
      Cc: Ze Gao <zegao2021@gmail.com>
      Link: https://lore.kernel.org/r/20240817064442.2152089-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a0310736
    • Ian Rogers's avatar
      perf synthetic-events: Avoid unnecessary memset · 2aebebb8
      Ian Rogers authored
      Make sure the memset of a synthesized event only zeros the necessary
      tracing data part of the event, as a full event can be over 4kb in
      size.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Anne Macedo <retpolanne@posteo.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Casey Chen <cachen@purestorage.com>
      Cc: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Dominique Martinet <asmadeus@codewreck.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@linaro.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sun Haiyong <sunhaiyong@loongson.cn>
      Cc: Weilin Wang <weilin.wang@intel.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Yunseong Kim <yskelg@gmail.com>
      Cc: Ze Gao <zegao2021@gmail.com>
      Link: https://lore.kernel.org/r/20240817064442.2152089-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2aebebb8
    • Xu Yang's avatar
      perf python: Fix the build on 32-bit arm by including missing "util/sample.h" · 2518e132
      Xu Yang authored
      The 32-bit arm build system will complain:
      
        tools/perf/util/python.c:75:28: error: field ‘sample’ has incomplete type
           75 |         struct perf_sample sample;
      
      However, arm64 build system doesn't complain this.
      
      The root cause is arm64 define "HAVE_KVM_STAT_SUPPORT := 1" in
      tools/perf/arch/arm64/Makefile, but arm arch doesn't define this.  This
      will lead to kvm-stat.h include other header files on arm64 build
      system, especially "util/sample.h" for util/python.c.
      
      This will try to directly include "util/sample.h" for "util/python.c" to
      avoid such build issue on arm platform.
      Signed-off-by: default avatarXu Yang <xu.yang_2@nxp.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: imx@lists.linux.dev
      Link: https://lore.kernel.org/r/20240819023403.201324-1-xu.yang_2@nxp.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2518e132
    • Namhyung Kim's avatar
      perf annotate-data: Update type stat at the end of find_data_type_die() · 023aceec
      Namhyung Kim authored
      After trying all possibilities with DWARF and instruction tracking.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-10-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      023aceec
    • Namhyung Kim's avatar
      perf annotate-data: Check variables in every scope · ba883370
      Namhyung Kim authored
      Sometimes it matches a variable in the inner scope but it fails because
      the actual access can be on a different type.  Let's try variables in
      every scope and choose the best one using is_better_type().
      
      I have an example with update_blocked_averages(), at first it found a
      variable (__mptr) but it's a void pointer.  So it moved on to the upper
      scope and found another variable (cfs_rq).
      
        $ perf --debug type-profile annotate --data-type --stdio
        ...
        -----------------------------------------------------------
        find data type for 0x140(reg14) at update_blocked_averages+0x2db
        CU for kernel/sched/fair.c (die:0x12dd892)
        frame base: cfa=1 fbreg=7
        found "__mptr" (die: 0x13022f1) in scope=4/4 (die: 0x13022e8) failed: no/void pointer
         variable location: base=reg14, offset=0x140
         type='void*' size=0x8 (die:0x12dd8f9)
        found "cfs_rq" (die: 0x1301721) in scope=3/4 (die: 0x130171c) type_offset=0x140
         variable location: reg14
         type='struct cfs_rq' size=0x1c0 (die:0x12e37e5)
        final type: type='struct cfs_rq' size=0x1c0 (die:0x12e37e5)
      
      IIUC the scope is like below:
        1: update_blocked_averages
        2:   __update_blocked_fair
        3:     for_each_leaf_cfs_rq_safe
        4:       list_entry -> (container_of)
      
      The container_of is implemented like:
      
        #define container_of(ptr, type, member) ({				\
        	void *__mptr = (void *)(ptr);					\
        	static_assert(__same_type(*(ptr), ((type *)0)->member) ||	\
        		      __same_type(*(ptr), void),			\
        		      "pointer type mismatch in container_of()");	\
        	((type *)(__mptr - offsetof(type, member))); })
      
      That's why we see the __mptr variable first but it failed since it has
      no type information.
      
      Then for_each_leaf_cfs_rq_safe() is defined as
      
        #define for_each_leaf_cfs_rq_safe(rq, cfs_rq, pos)			\
        	list_for_each_entry_safe(cfs_rq, pos, &rq->leaf_cfs_rq_list,	\
        				 leaf_cfs_rq_list)
      
      Note that the access was 0x140(r14).  And the cfs_rq has
      leaf_cfs_rq_list at the 0x140.  So it converts the list_head pointer to
      a pointer to struct cfs_rq here.
      
        $ pahole --hex -C cfs_rq vmlinux | grep 140
        struct cfs_rq 	struct list_head           leaf_cfs_rq_list;     /* 0x140  0x10 */
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-9-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ba883370
    • Namhyung Kim's avatar
      perf annotate-data: Add is_better_type() helper · c663451f
      Namhyung Kim authored
      Sometimes more than one variables are located in the same register or a
      stack slot.  Or it can overwrite existing information with others.  I
      found this is not helpful in some cases so it needs to update the type
      information from the variable only if it's better.
      
      But it's hard to know which one is better, so we needs heuristics. :)
      
      As it deals with memory accesses, the location should have a pointer or
      something similar (like array or reference).  So if it had an integer
      type and a variable is a pointer, we can take the variable's type to
      resolve the target of the access.
      
      If it has a pointer type and a variable with the same location has a
      different pointer type, it'll take one with bigger target type.  This
      can be useful when the target type embeds a smaller type (like list
      header or RB-tree node) at the beginning so their location is same.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c663451f
    • Namhyung Kim's avatar
      perf annotate-data: Add is_pointer_type() helper · 98d1f1dc
      Namhyung Kim authored
      It treats pointers and arrays in the same way.  Let's add the helper and
      use it when it checks if it needs a pointer.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-7-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      98d1f1dc
    • Namhyung Kim's avatar
      perf annotate-data: Change return type of find_data_type_block() · 69e2c784
      Namhyung Kim authored
      So that it can return enum variable_match_type to be propagated to the
      find_data_type_die().  Also update the debug message to show the result
      of the check_matching_type().
      
        chk [dd] reg0 offset=0 ok=1 kind=1  : Good!
      or
        chk [177] reg4 offset=0x138 ok=0 kind=0 cfa : no type information
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-6-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      69e2c784
    • Namhyung Kim's avatar
      perf annotate-data: Add variable_state_str() · 653185d8
      Namhyung Kim authored
      So that it can show a proper debug message in the right place.  The
      check_variable() is used in other places which don't want to print the
      message.
      
        $ perf --debug type-profile annotate --data-type
      
      Before:
        -----------------------------------------------------------
        find data type for 0x140(reg14) at update_blocked_averages+0x2db
        CU for kernel/sched/fair.c (die:0x12dd892)
        frame base: cfa=1 fbreg=7
        no pointer or no type                                         <<<--- removed
        check variable "__mptr" failed (die: 0x13022f1)
         variable location: base=reg14, offset=0x140
         type='void*' size=0x8 (die:0x12dd8f9)
      
      After:
        -----------------------------------------------------------
        find data type for 0x140(reg14) at update_blocked_averages+0x2db
        CU for kernel/sched/fair.c (die:0x12dd892)
        frame base: cfa=1 fbreg=7
        found "__mptr" (die: 0x13022f1) in scope=4/4 (die: 0x13022e8) failed: no/void pointer  <<<--- here
         variable location: base=reg14, offset=0x140
         type='void*' size=0x8 (die:0x12dd8f9)
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      653185d8
    • Namhyung Kim's avatar
      perf annotate-data: Add 'enum type_match_result' · 976862f8
      Namhyung Kim authored
      And let check_variable() return the enum value so that callers can know
      what was the problem.  This will be used by the later patch to update
      the statistics correctly and print the error message in a right place.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      976862f8
    • Namhyung Kim's avatar
      perf annotate-data: Fix off-by-one in location range check · 3ab0b8b2
      Namhyung Kim authored
      The location list will have entries with half-open addressing like
      [start, end) which means it doesn't include the end address.  So it
      should skip entries at the end address and match to the next entry.
      
      An example location list looks like this (from readelf -wo):
      
          00237876 ffffffff8110d32b (base address)
          0023787f v000000000000000 v000000000000002 views at 00237868 for:
                   ffffffff8110d32b ffffffff8110d4eb (DW_OP_reg3 (rbx))     <<<--- 1
          00237885 v000000000000002 v000000000000000 views at 0023786a for:
                   ffffffff8110d4eb ffffffff8110d50b (DW_OP_reg14 (r14))    <<<--- 2
          0023788c v000000000000000 v000000000000001 views at 0023786c for:
                   ffffffff8110d50b ffffffff8110d7c4 (DW_OP_reg3 (rbx))
          00237893 v000000000000000 v000000000000000 views at 0023786e for:
                   ffffffff8110d806 ffffffff8110d854 (DW_OP_reg3 (rbx))
          0023789a v000000000000000 v000000000000000 views at 00237870 for:
                   ffffffff8110d876 ffffffff8110d88e (DW_OP_reg3 (rbx))
      
      The first entry at 0023787f has [8110d32b, 8110d4eb) (omitting the
      ffffffff at the beginning), and the second one has [8110d4eb, 8110d50b).
      
      Fixes: 2bc3cf57 ("perf annotate-data: Improve debug message with location info")
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3ab0b8b2
    • Namhyung Kim's avatar
      perf dwarf-aux: Check allowed location expressions when collecting variables · e8bb03ed
      Namhyung Kim authored
      It missed to call check_allowed_ops() in __die_collect_vars_cb() so it
      can take variables with complex location expression incorrectly.
      
      For example, I found some variable has this expression.
      
          015d8df8 ffffffff81aacfb3 (base address)
          015d8e01 v000000000000004 v000000000000000 views at 015d8df2 for:
                   ffffffff81aacfb3 ffffffff81aacfd2 (DW_OP_fbreg: -176; DW_OP_deref;
      						DW_OP_plus_uconst: 332; DW_OP_deref_size: 4;
      						DW_OP_lit1; DW_OP_shra; DW_OP_const1u: 64;
      						DW_OP_minus; DW_OP_stack_value)
          015d8e14 v000000000000000 v000000000000000 views at 015d8df4 for:
                   ffffffff81aacfd2 ffffffff81aacfd7 (DW_OP_reg3 (rbx))
          015d8e19 v000000000000000 v000000000000000 views at 015d8df6 for:
                   ffffffff81aacfd7 ffffffff81aad020 (DW_OP_fbreg: -176; DW_OP_deref;
      						DW_OP_plus_uconst: 332; DW_OP_deref_size: 4;
      						DW_OP_lit1; DW_OP_shra; DW_OP_const1u: 64;
      						DW_OP_minus; DW_OP_stack_value)
          015d8e2c <End of list>
      
      It looks like '((int *)(-176(%rbp) + 332) >> 1) - 64' but the current
      code thought it's just -176(%rbp) and processed the variable incorrectly.
      It should reject such a complex expression if check_allowed_ops()
      doesn't like it. :)
      
      Fixes: 932dcc2c ("perf dwarf-aux: Add die_collect_vars()")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240816235840.2754937-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e8bb03ed
  2. 16 Aug, 2024 28 commits
    • Arnaldo Carvalho de Melo's avatar
      Merge remote-tracking branch 'torvalds/master' into perf-tools-next · 3bce87eb
      Arnaldo Carvalho de Melo authored
      To pick up the latest perf-tools merge for 6.11, i.e. to have the
      current perf tools branch that is getting into 6.11 with the
      perf-tools-next that is geared towards 6.12.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3bce87eb
    • Yicong Yang's avatar
      perf stat: Display iostat headers correctly · 26156393
      Yicong Yang authored
      Currently we'll only print metric headers for metric leader in
      aggregration mode. This will make `perf iostat` header not shown
      since it'll aggregrated globally but don't have metric events:
      
        root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
         Performance counter stats for 'system wide':
            port
        0000:00                    0                    0                    0                    0
        0000:80                    0                    0                    0                    0
        [...]
      
      Fix this by excluding the iostat in the check of printing metric
      headers. Then we can see the headers:
      
        root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
         Performance counter stats for 'system wide':
            port             Inbound Read(MB)    Inbound Write(MB)    Outbound Read(MB)   Outbound Write(MB)
        0000:00                    0                    0                    0                    0
        0000:80                    0                    0                    0                    0
        [...]
      
      Fixes: 193a9e30 ("perf stat: Don't display metric header for non-leader uncore events")
      Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
      Cc: Junhao He <hejunhao3@huawei.com>
      Cc: linuxarm@huawei.com
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
      Cc: Zeng Tao <prime.zeng@hisilicon.com>
      Link: https://lore.kernel.org/r/20240802065800.48774-1-yangyicong@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      26156393
    • Yang Jihong's avatar
      perf sched timehist: Fix missing free of session in perf_sched__timehist() · 6bdf5168
      Yang Jihong authored
      When perf_time__parse_str() fails in perf_sched__timehist(),
      need to free session that was previously created, fix it.
      
      Fixes: 853b7407 ("perf sched timehist: Add option to specify time window of interest")
      Signed-off-by: default avatarYang Jihong <yangjihong@bytedance.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsa@cumulusnetworks.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20240806023533.1316348-1-yangjihong@bytedance.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6bdf5168
    • Linus Torvalds's avatar
      Merge tag 'block-6.11-20240824' of git://git.kernel.dk/linux · 85652baa
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - Fix corruption issues with s390/dasd (Eric, Stefan)
      
       - Fix a misuse of non irq locking grab of a lock (Li)
      
       - MD pull request with a single data corruption fix for raid1 (Yu)
      
      * tag 'block-6.11-20240824' of git://git.kernel.dk/linux:
        block: Fix lockdep warning in blk_mq_mark_tag_wait
        md/raid1: Fix data corruption for degraded array with slow disk
        s390/dasd: fix error recovery leading to data corruption on ESE devices
        s390/dasd: Remove DMA alignment
      85652baa
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.11-20240824' of git://git.kernel.dk/linux · c5ac744c
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
      
       - Fix a comment in the uapi header using the wrong member name (Caleb)
      
       - Fix KCSAN warning for a debug check in sqpoll (me)
      
       - Two more NAPI tweaks (Olivier)
      
      * tag 'io_uring-6.11-20240824' of git://git.kernel.dk/linux:
        io_uring: fix user_data field name in comment
        io_uring/sqpoll: annotate debug task == current with data_race()
        io_uring/napi: remove duplicate io_napi_entry timeout assignation
        io_uring/napi: check napi_enabled in io_napi_add() before proceeding
      c5ac744c
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 2731835f
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Fix a possible (but unlikely) out-of-bounds read in interrupts
         parsing code
      
       - Add AT25 EEPROM "fujitsu,mb85rs256" compatible
      
       - Update Konrad Dybcio's email
      
      * tag 'devicetree-fixes-for-6.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        of/irq: Prevent device address out-of-bounds read in interrupt map walk
        dt-bindings: eeprom: at25: add fujitsu,mb85rs256 compatible
        dt-bindings: Batch-update Konrad Dybcio's email
      2731835f
    • Linus Torvalds's avatar
      Merge tag 'thermal-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 296c871d
      Linus Torvalds authored
      Pull thermal control fix from Rafael Wysocki:
       "Fix a Bang-bang thermal governor issue causing it to fail to reset the
        state of cooling devices if they are 'on' to start with, but the
        thermal zone temperature is always below the corresponding trip point
        (Rafael Wysocki)"
      
      * tag 'thermal-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        thermal: gov_bang_bang: Use governor_data to reduce overhead
        thermal: gov_bang_bang: Add .manage() callback
        thermal: gov_bang_bang: Split bang_bang_control()
        thermal: gov_bang_bang: Call __thermal_cdev_update() directly
      296c871d
    • Linus Torvalds's avatar
      Merge tag 'acpi-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 64ab5e40
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Fix an issue related to the ACPI EC device handling that causes the
        _REG control method to be evaluated for EC operation regions that are
        not expected to be used.
      
        This confuses the platform firmware and provokes various types of
        misbehavior on some systems (Rafael Wysocki)"
      
      * tag 'acpi-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: EC: Evaluate _REG outside the EC scope more carefully
        ACPICA: Add a depth argument to acpi_execute_reg_methods()
        Revert "ACPI: EC: Evaluate orphan _REG under EC device"
      64ab5e40
    • Linus Torvalds's avatar
      Merge tag 'libnvdimm-fixes-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · e4a55b55
      Linus Torvalds authored
      Pull libnvdimm fix from Ira Weiny:
       "Commit f467fee4 ("block: move the dax flag to queue_limits") broke
        the DAX tests by skipping over the legacy pmem mapping pages case.
      
        Set the DAX flag in this case as well"
      
      * tag 'libnvdimm-fixes-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        nvdimm/pmem: Set dax flag for all 'PFN_MAP' cases
      e4a55b55
    • Caleb Sander Mateos's avatar
      io_uring: fix user_data field name in comment · 1fc2ac42
      Caleb Sander Mateos authored
      io_uring_cqe's user_data field refers to `sqe->data`, but io_uring_sqe
      does not have a data field. Fix the comment to say `sqe->user_data`.
      Signed-off-by: default avatarCaleb Sander Mateos <csander@purestorage.com>
      Link: https://github.com/axboe/liburing/pull/1206
      Link: https://lore.kernel.org/r/20240816181526.3642732-1-csander@purestorage.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1fc2ac42
    • Linus Torvalds's avatar
      Merge tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux · 60cb1da6
      Linus Torvalds authored
      Pull rust fixes from Miguel Ojeda:
      
       - Fix '-Os' Rust 1.80.0+ builds adding more intrinsics (also tweaked in
         upstream Rust for the upcoming 1.82.0).
      
       - Fix support for the latest version of rust-analyzer due to a change
         on rust-analyzer config file semantics (considered a fix since most
         developers use the latest version of the tool, which is the only one
         actually supported by upstream). I am discussing stability of the
         config file with upstream -- they may be able to start versioning it.
      
       - Fix GCC 14 builds due to '-fmin-function-alignment' not skipped for
         libclang (bindgen).
      
       - A couple Kconfig fixes around '{RUSTC,BINDGEN}_VERSION_TEXT' to
         suppress error messages in a foreign architecture chroot and to use a
         proper default format.
      
       - Clean 'rust-analyzer' target warning due to missing recursive make
         invocation mark.
      
       - Clean Clippy warning due to missing indentation in docs.
      
       - Clean LLVM 19 build warning due to removed 3dnow feature upstream.
      
      * tag 'rust-fixes-6.11' of https://github.com/Rust-for-Linux/linux:
        rust: x86: remove `-3dnow{,a}` from target features
        kbuild: rust-analyzer: mark `rust_is_available.sh` invocation as recursive
        rust: add intrinsics to fix `-Os` builds
        kbuild: rust: skip -fmin-function-alignment in bindgen flags
        rust: Support latest version of `rust-analyzer`
        rust: macros: indent list item in `module!`'s docs
        rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
        rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
      60cb1da6
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 5b179fe0
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - reintroduce the text patching global icache flush
      
       - fix syscall entry code to correctly initialize a0, which manifested
         as a strace bug
      
       - XIP kernels now map the entire kernel, which fixes boot under at
         least DEBUG_VIRTUAL=y
      
       - initialize all nodes in the acpi_early_node_map initializer
      
       - fix OOB access in the Andes vendor extension probing code
      
       - A new key for scalar misaligned access performance in hwprobe, which
         correctly treat the values as an enum (as opposed to a bitmap)
      
      * tag 'riscv-for-linus-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Fix out-of-bounds when accessing Andes per hart vendor extension array
        RISC-V: hwprobe: Add SCALAR to misaligned perf defines
        RISC-V: hwprobe: Add MISALIGNED_PERF key
        RISC-V: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
        riscv: change XIP's kernel_map.size to be size of the entire kernel
        riscv: entry: always initialize regs->a0 to -ENOSYS
        riscv: Re-introduce global icache flush in patch_text_XXX()
      5b179fe0
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 4a621e29
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "A couple of fixes for tracing:
      
         - Prevent a NULL pointer dereference in the error path of RTLA tool
      
         - Fix an infinite loop bug when reading from the ring buffer when
           closed. If there's a thread trying to read the ring buffer and it
           gets closed by another thread, the one reading will go into an
           infinite loop when the buffer is empty instead of exiting back to
           user space"
      
      * tag 'trace-v6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        rtla/osnoise: Prevent NULL dereference in error handling
        tracing: Return from tracing_buffers_read() if the file has been closed
      4a621e29
    • Linus Torvalds's avatar
      Merge tag 'keys-trusted-next-6.11-rc4' of... · 1486141a
      Linus Torvalds authored
      Merge tag 'keys-trusted-next-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
      
      Pull key fixes from Jarkko Sakkinen:
       "Two bug fixes for a memory corruption bug and a memory leak bug in the
        DCP trusted keys type.
      
        Just as a reminder DCP was a crypto coprocessor in i.MX SoCs"
      
      * tag 'keys-trusted-next-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
        KEYS: trusted: dcp: fix leak of blob encryption key
        KEYS: trusted: fix DCP blob payload length assignment
      1486141a
    • Linus Torvalds's avatar
      Merge tag 'for-6.11/dm-fixes' of... · 670c12ce
      Linus Torvalds authored
      Merge tag 'for-6.11/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper fixes from Mikulas Patocka:
      
       - fix misbehavior if suspend or resume is interrupted by a signal
      
       - fix wrong indentation in dm-crypt.rst
      
       - fix memory allocation failure in dm-persistent-data
      
      * tag 'for-6.11/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm persistent data: fix memory allocation failure
        Documentation: dm-crypt.rst warning + error fix
        dm resume: don't return EINVAL when signalled
        dm suspend: return -ERESTARTSYS instead of -EINTR
      670c12ce
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux · de53959e
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - Bring back a lost return statement in io-page-fault code
      
       - Remove an unused function declaration
      
      * tag 'iommu-fixes-v6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux:
        iommu: Remove unused declaration iommu_sva_unbind_gpasid()
        iommu: Restore lost return in iommu_report_device_fault()
      de53959e
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · 9bd40f82
      Linus Torvalds authored
      Pull gpio fix from Bartosz Golaszewski:
      
       - add the shutdown() callback to gpio-mlxbf3 in order to disable
         interrupts during graceful reboot
      
      * tag 'gpio-fixes-for-v6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: mlxbf3: Support shutdown() function
      9bd40f82
    • Linus Torvalds's avatar
      Merge tag 'sound-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · d58c542a
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "All small fixes, mostly for usual suspects, HD-audio and USB-audio
        device-specific fixes / quirks. The Cirrus codec support took the
        update of SPI header as well. Other than that, there is a regression
        fix in the sanity check of ALSA timer code"
      
      * tag 'sound-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda/tas2781: Use correct endian conversion
        ALSA: usb-audio: Support Yamaha P-125 quirk entry
        ALSA: hda: cs35l41: Remove redundant call to hda_cs_dsp_control_remove()
        ALSA: hda: cs35l56: Remove redundant call to hda_cs_dsp_control_remove()
        ALSA: hda/tas2781: fix wrong calibrated data order
        ALSA: usb-audio: Add delay quirk for VIVO USB-C-XE710 HEADSET
        ALSA: hda/realtek: Add support for new HP G12 laptops
        ALSA: hda/realtek: Fix noise from speakers on Lenovo IdeaPad 3 15IAU7
        ALSA: timer: Relax start tick time check for slave timer elements
        spi: Add empty versions of ACPI functions
      d58c542a
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2024-08-16' of https://gitlab.freedesktop.org/drm/kernel · 37b20e9a
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Weekly drm fixes, mostly amdgpu and xe. The larger amdgpu fix is for a
        new IP block introduced in rc1, so should be fine. The xe fixes
        contain some missed fixes from the end of the previous round along
        with some fixes which required precursor changes, but otherwise
        everything seems fine,
      
        mediatek:
         - fix cursor crash
      
        amdgpu:
         - Fix MES ring buffer overflow
         - DCN 3.5 fix
         - DCN 3.2.1 fix
         - DP MST fix
         - Cursor fixes
         - JPEG fixes
         - Context ops validation
         - MES 12 fixes
         - VCN 5.0 fix
         - HDP fix
      
        panel:
         - dt bindings style fix
         - orientation quirks
      
        rockchip:
         - inno-hdmi: fix infoframe upload
      
        v3d:
         - fix OOB access in v3d_csd_job_run()
      
        xe:
         - Validate user fence during creation
         - Fix use after free when client stats are captured
         - SRIOV fixes
         - Runtime PM fixes"
      
      * tag 'drm-fixes-2024-08-16' of https://gitlab.freedesktop.org/drm/kernel: (37 commits)
        drm/xe: Hold a PM ref when GT TLB invalidations are inflight
        drm/xe: Drop xe_gt_tlb_invalidation_wait
        drm/xe: Add xe_gt_tlb_invalidation_fence_init helper
        drm/xe/pf: Fix VF config validation on multi-GT platforms
        drm/xe: Build PM into GuC CT layer
        drm/xe/vf: Fix register value lookup
        drm/xe: Fix use after free when client stats are captured
        drm/xe: Take a ref to xe file when user creates a VM
        drm/xe: Add ref counting for xe_file
        drm/xe: Move part of xe_file cleanup to a helper
        drm/xe: Validate user fence during creation
        drm/rockchip: inno-hdmi: Fix infoframe upload
        drm/amd/amdgpu: add HDP_SD support on gc 12.0.0/1
        drm/amdgpu: Update kmd_fw_shared for VCN5
        drm/amd/amdgpu: command submission parser for JPEG
        drm/amdgpu/mes12: fix suspend issue
        drm/amdgpu/mes12: sw/hw fini for unified mes
        drm/amdgpu/mes12: configure two pipes hardware resources
        drm/amdgpu/mes12: adjust mes12 sw/hw init for multiple pipes
        drm/amdgpu/mes12: add mes pipe switch support
        ...
      37b20e9a
    • Rafael J. Wysocki's avatar
      thermal: gov_bang_bang: Use governor_data to reduce overhead · 6e6f58a1
      Rafael J. Wysocki authored
      After running once, the for_each_trip_desc() loop in
      bang_bang_manage() is pure needless overhead because it is not going to
      make any changes unless a new cooling device has been bound to one of
      the trips in the thermal zone or the system is resuming from sleep.
      
      For this reason, make bang_bang_manage() set governor_data for the
      thermal zone and check it upfront to decide whether or not it needs to
      do anything.
      
      However, governor_data needs to be reset in some cases to let
      bang_bang_manage() know that it should walk the trips again, so add an
      .update_tz() callback to the governor and make the core additionally
      invoke it during system resume.
      
      To avoid affecting the other users of that callback unnecessarily, add
      a special notification reason for system resume, THERMAL_TZ_RESUME, and
      also pass it to __thermal_zone_device_update() called during system
      resume for consistency.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarPeter Kästle <peter@piie.net>
      Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
      Cc: 6.10+ <stable@vger.kernel.org> # 6.10+
      Link: https://patch.msgid.link/2285575.iZASKD2KPV@rjwysocki.net
      6e6f58a1
    • Rafael J. Wysocki's avatar
      thermal: gov_bang_bang: Add .manage() callback · 5f64b4a1
      Rafael J. Wysocki authored
      After recent changes, the Bang-bang governor may not adjust the
      initial configuration of cooling devices to the actual situation.
      
      Namely, if a cooling device bound to a certain trip point starts in
      the "on" state and the thermal zone temperature is below the threshold
      of that trip point, the trip point may never be crossed on the way up
      in which case the state of the cooling device will never be adjusted
      because the thermal core will never invoke the governor's
      .trip_crossed() callback.  [Note that there is no issue if the zone
      temperature is at the trip threshold or above it to start with because
      .trip_crossed() will be invoked then to indicate the start of thermal
      mitigation for the given trip.]
      
      To address this, add a .manage() callback to the Bang-bang governor
      and use it to ensure that all of the thermal instances managed by the
      governor have been initialized properly and the states of all of the
      cooling devices involved have been adjusted to the current zone
      temperature as appropriate.
      
      Fixes: 530c932b ("thermal: gov_bang_bang: Use .trip_crossed() instead of .throttle()")
      Link: https://lore.kernel.org/linux-pm/1bfbbae5-42b0-4c7d-9544-e98855715294@piie.net/
      Cc: 6.10+ <stable@vger.kernel.org> # 6.10+
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarPeter Kästle <peter@piie.net>
      Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
      Link: https://patch.msgid.link/8419356.T7Z3S40VBb@rjwysocki.net
      5f64b4a1
    • Rafael J. Wysocki's avatar
      thermal: gov_bang_bang: Split bang_bang_control() · 84248e35
      Rafael J. Wysocki authored
      Move the setting of the thermal instance target state from
      bang_bang_control() into a separate function that will be also called
      in a different place going forward.
      
      No intentional functional impact.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarPeter Kästle <peter@piie.net>
      Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
      Cc: 6.10+ <stable@vger.kernel.org> # 6.10+
      Link: https://patch.msgid.link/3313587.aeNJFYEL58@rjwysocki.net
      84248e35
    • Rafael J. Wysocki's avatar
      thermal: gov_bang_bang: Call __thermal_cdev_update() directly · b9b6ee6f
      Rafael J. Wysocki authored
      Instead of clearing the "updated" flag for each cooling device
      affected by the trip point crossing in bang_bang_control() and
      walking all thermal instances to run thermal_cdev_update() for all
      of the affected cooling devices, call __thermal_cdev_update()
      directly for each of them.
      
      No intentional functional impact.
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarPeter Kästle <peter@piie.net>
      Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
      Cc: 6.10+ <stable@vger.kernel.org> # 6.10+
      Link: https://patch.msgid.link/13583081.uLZWGnKmhe@rjwysocki.net
      b9b6ee6f
    • Dave Airlie's avatar
      Merge tag 'mediatek-drm-fixes-20240805' of... · fee9d135
      Dave Airlie authored
      Merge tag 'mediatek-drm-fixes-20240805' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-fixes
      
      Mediatek DRM Fixes - 20240805
      
      1. Set sensible cursor width/height values to fix crash
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240810084605.3435-1-chunkuang.hu@kernel.org
      fee9d135
    • Dave Airlie's avatar
      Merge tag 'drm-xe-fixes-2024-08-15' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes · f8e170a3
      Dave Airlie authored
      - Validate user fence during creation (Brost)
      - Fix use after free when client stats are captured (Umesh)
      - SRIOV fixes (Michal)
      - Runtime PM fixes (Brost)
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/Zr4KWF5nM1YvnT8H@intel.com
      f8e170a3
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2024-08-15' of... · 75eac7e8
      Dave Airlie authored
      Merge tag 'drm-misc-fixes-2024-08-15' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
      
      Short summary of fixes pull:
      
      panel:
      - dt-bindings style fixes
      
      panel-orientation:
      - add quirk for Any Loki Max
      - add quirk for Any Loki Zero
      
      rockchip:
      - inno-hdmi: fix infoframe upload
      
      v3d:
      - fix OOB access in v3d_csd_job_run()
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240815131751.GA151031@linux.fritz.box
      75eac7e8
    • Li Lingfeng's avatar
      block: Fix lockdep warning in blk_mq_mark_tag_wait · b313a8c8
      Li Lingfeng authored
      Lockdep reported a warning in Linux version 6.6:
      
      [  414.344659] ================================
      [  414.345155] WARNING: inconsistent lock state
      [  414.345658] 6.6.0-07439-gba2303cacfda #6 Not tainted
      [  414.346221] --------------------------------
      [  414.346712] inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
      [  414.347545] kworker/u10:3/1152 [HC0[0]:SC0[0]:HE0:SE1] takes:
      [  414.349245] ffff88810edd1098 (&sbq->ws[i].wait){+.?.}-{2:2}, at: blk_mq_dispatch_rq_list+0x131c/0x1ee0
      [  414.351204] {IN-SOFTIRQ-W} state was registered at:
      [  414.351751]   lock_acquire+0x18d/0x460
      [  414.352218]   _raw_spin_lock_irqsave+0x39/0x60
      [  414.352769]   __wake_up_common_lock+0x22/0x60
      [  414.353289]   sbitmap_queue_wake_up+0x375/0x4f0
      [  414.353829]   sbitmap_queue_clear+0xdd/0x270
      [  414.354338]   blk_mq_put_tag+0xdf/0x170
      [  414.354807]   __blk_mq_free_request+0x381/0x4d0
      [  414.355335]   blk_mq_free_request+0x28b/0x3e0
      [  414.355847]   __blk_mq_end_request+0x242/0xc30
      [  414.356367]   scsi_end_request+0x2c1/0x830
      [  414.345155] WARNING: inconsistent lock state
      [  414.345658] 6.6.0-07439-gba2303cacfda #6 Not tainted
      [  414.346221] --------------------------------
      [  414.346712] inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
      [  414.347545] kworker/u10:3/1152 [HC0[0]:SC0[0]:HE0:SE1] takes:
      [  414.349245] ffff88810edd1098 (&sbq->ws[i].wait){+.?.}-{2:2}, at: blk_mq_dispatch_rq_list+0x131c/0x1ee0
      [  414.351204] {IN-SOFTIRQ-W} state was registered at:
      [  414.351751]   lock_acquire+0x18d/0x460
      [  414.352218]   _raw_spin_lock_irqsave+0x39/0x60
      [  414.352769]   __wake_up_common_lock+0x22/0x60
      [  414.353289]   sbitmap_queue_wake_up+0x375/0x4f0
      [  414.353829]   sbitmap_queue_clear+0xdd/0x270
      [  414.354338]   blk_mq_put_tag+0xdf/0x170
      [  414.354807]   __blk_mq_free_request+0x381/0x4d0
      [  414.355335]   blk_mq_free_request+0x28b/0x3e0
      [  414.355847]   __blk_mq_end_request+0x242/0xc30
      [  414.356367]   scsi_end_request+0x2c1/0x830
      [  414.356863]   scsi_io_completion+0x177/0x1610
      [  414.357379]   scsi_complete+0x12f/0x260
      [  414.357856]   blk_complete_reqs+0xba/0xf0
      [  414.358338]   __do_softirq+0x1b0/0x7a2
      [  414.358796]   irq_exit_rcu+0x14b/0x1a0
      [  414.359262]   sysvec_call_function_single+0xaf/0xc0
      [  414.359828]   asm_sysvec_call_function_single+0x1a/0x20
      [  414.360426]   default_idle+0x1e/0x30
      [  414.360873]   default_idle_call+0x9b/0x1f0
      [  414.361390]   do_idle+0x2d2/0x3e0
      [  414.361819]   cpu_startup_entry+0x55/0x60
      [  414.362314]   start_secondary+0x235/0x2b0
      [  414.362809]   secondary_startup_64_no_verify+0x18f/0x19b
      [  414.363413] irq event stamp: 428794
      [  414.363825] hardirqs last  enabled at (428793): [<ffffffff816bfd1c>] ktime_get+0x1dc/0x200
      [  414.364694] hardirqs last disabled at (428794): [<ffffffff85470177>] _raw_spin_lock_irq+0x47/0x50
      [  414.365629] softirqs last  enabled at (428444): [<ffffffff85474780>] __do_softirq+0x540/0x7a2
      [  414.366522] softirqs last disabled at (428419): [<ffffffff813f65ab>] irq_exit_rcu+0x14b/0x1a0
      [  414.367425]
                     other info that might help us debug this:
      [  414.368194]  Possible unsafe locking scenario:
      [  414.368900]        CPU0
      [  414.369225]        ----
      [  414.369548]   lock(&sbq->ws[i].wait);
      [  414.370000]   <Interrupt>
      [  414.370342]     lock(&sbq->ws[i].wait);
      [  414.370802]
                      *** DEADLOCK ***
      [  414.371569] 5 locks held by kworker/u10:3/1152:
      [  414.372088]  #0: ffff88810130e938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x357/0x13f0
      [  414.373180]  #1: ffff88810201fdb8 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x3a3/0x13f0
      [  414.374384]  #2: ffffffff86ffbdc0 (rcu_read_lock){....}-{1:2}, at: blk_mq_run_hw_queue+0x637/0xa00
      [  414.375342]  #3: ffff88810edd1098 (&sbq->ws[i].wait){+.?.}-{2:2}, at: blk_mq_dispatch_rq_list+0x131c/0x1ee0
      [  414.376377]  #4: ffff888106205a08 (&hctx->dispatch_wait_lock){+.-.}-{2:2}, at: blk_mq_dispatch_rq_list+0x1337/0x1ee0
      [  414.378607]
                     stack backtrace:
      [  414.379177] CPU: 0 PID: 1152 Comm: kworker/u10:3 Not tainted 6.6.0-07439-gba2303cacfda #6
      [  414.380032] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
      [  414.381177] Workqueue: writeback wb_workfn (flush-253:0)
      [  414.381805] Call Trace:
      [  414.382136]  <TASK>
      [  414.382429]  dump_stack_lvl+0x91/0xf0
      [  414.382884]  mark_lock_irq+0xb3b/0x1260
      [  414.383367]  ? __pfx_mark_lock_irq+0x10/0x10
      [  414.383889]  ? stack_trace_save+0x8e/0xc0
      [  414.384373]  ? __pfx_stack_trace_save+0x10/0x10
      [  414.384903]  ? graph_lock+0xcf/0x410
      [  414.385350]  ? save_trace+0x3d/0xc70
      [  414.385808]  mark_lock.part.20+0x56d/0xa90
      [  414.386317]  mark_held_locks+0xb0/0x110
      [  414.386791]  ? __pfx_do_raw_spin_lock+0x10/0x10
      [  414.387320]  lockdep_hardirqs_on_prepare+0x297/0x3f0
      [  414.387901]  ? _raw_spin_unlock_irq+0x28/0x50
      [  414.388422]  trace_hardirqs_on+0x58/0x100
      [  414.388917]  _raw_spin_unlock_irq+0x28/0x50
      [  414.389422]  __blk_mq_tag_busy+0x1d6/0x2a0
      [  414.389920]  __blk_mq_get_driver_tag+0x761/0x9f0
      [  414.390899]  blk_mq_dispatch_rq_list+0x1780/0x1ee0
      [  414.391473]  ? __pfx_blk_mq_dispatch_rq_list+0x10/0x10
      [  414.392070]  ? sbitmap_get+0x2b8/0x450
      [  414.392533]  ? __blk_mq_get_driver_tag+0x210/0x9f0
      [  414.393095]  __blk_mq_sched_dispatch_requests+0xd99/0x1690
      [  414.393730]  ? elv_attempt_insert_merge+0x1b1/0x420
      [  414.394302]  ? __pfx___blk_mq_sched_dispatch_requests+0x10/0x10
      [  414.394970]  ? lock_acquire+0x18d/0x460
      [  414.395456]  ? blk_mq_run_hw_queue+0x637/0xa00
      [  414.395986]  ? __pfx_lock_acquire+0x10/0x10
      [  414.396499]  blk_mq_sched_dispatch_requests+0x109/0x190
      [  414.397100]  blk_mq_run_hw_queue+0x66e/0xa00
      [  414.397616]  blk_mq_flush_plug_list.part.17+0x614/0x2030
      [  414.398244]  ? __pfx_blk_mq_flush_plug_list.part.17+0x10/0x10
      [  414.398897]  ? writeback_sb_inodes+0x241/0xcc0
      [  414.399429]  blk_mq_flush_plug_list+0x65/0x80
      [  414.399957]  __blk_flush_plug+0x2f1/0x530
      [  414.400458]  ? __pfx___blk_flush_plug+0x10/0x10
      [  414.400999]  blk_finish_plug+0x59/0xa0
      [  414.401467]  wb_writeback+0x7cc/0x920
      [  414.401935]  ? __pfx_wb_writeback+0x10/0x10
      [  414.402442]  ? mark_held_locks+0xb0/0x110
      [  414.402931]  ? __pfx_do_raw_spin_lock+0x10/0x10
      [  414.403462]  ? lockdep_hardirqs_on_prepare+0x297/0x3f0
      [  414.404062]  wb_workfn+0x2b3/0xcf0
      [  414.404500]  ? __pfx_wb_workfn+0x10/0x10
      [  414.404989]  process_scheduled_works+0x432/0x13f0
      [  414.405546]  ? __pfx_process_scheduled_works+0x10/0x10
      [  414.406139]  ? do_raw_spin_lock+0x101/0x2a0
      [  414.406641]  ? assign_work+0x19b/0x240
      [  414.407106]  ? lock_is_held_type+0x9d/0x110
      [  414.407604]  worker_thread+0x6f2/0x1160
      [  414.408075]  ? __kthread_parkme+0x62/0x210
      [  414.408572]  ? lockdep_hardirqs_on_prepare+0x297/0x3f0
      [  414.409168]  ? __kthread_parkme+0x13c/0x210
      [  414.409678]  ? __pfx_worker_thread+0x10/0x10
      [  414.410191]  kthread+0x33c/0x440
      [  414.410602]  ? __pfx_kthread+0x10/0x10
      [  414.411068]  ret_from_fork+0x4d/0x80
      [  414.411526]  ? __pfx_kthread+0x10/0x10
      [  414.411993]  ret_from_fork_asm+0x1b/0x30
      [  414.412489]  </TASK>
      
      When interrupt is turned on while a lock holding by spin_lock_irq it
      throws a warning because of potential deadlock.
      
      blk_mq_prep_dispatch_rq
       blk_mq_get_driver_tag
        __blk_mq_get_driver_tag
         __blk_mq_alloc_driver_tag
          blk_mq_tag_busy -> tag is already busy
          // failed to get driver tag
       blk_mq_mark_tag_wait
        spin_lock_irq(&wq->lock) -> lock A (&sbq->ws[i].wait)
        __add_wait_queue(wq, wait) -> wait queue active
        blk_mq_get_driver_tag
        __blk_mq_tag_busy
      -> 1) tag must be idle, which means there can't be inflight IO
         spin_lock_irq(&tags->lock) -> lock B (hctx->tags)
         spin_unlock_irq(&tags->lock) -> unlock B, turn on interrupt accidentally
      -> 2) context must be preempt by IO interrupt to trigger deadlock.
      
      As shown above, the deadlock is not possible in theory, but the warning
      still need to be fixed.
      
      Fix it by using spin_lock_irqsave to get lockB instead of spin_lock_irq.
      
      Fixes: 4f1731df ("blk-mq: fix potential io hang by wrong 'wake_batch'")
      Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Link: https://lore.kernel.org/r/20240815024736.2040971-1-lilingfeng@huaweicloud.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b313a8c8
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-6.11-2024-08-14' of... · 9370e430
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-6.11-2024-08-14' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-6.11-2024-08-14:
      
      amdgpu:
      - Fix MES ring buffer overflow
      - DCN 3.5 fix
      - DCN 3.2.1 fix
      - DP MST fix
      - Cursor fixes
      - JPEG fixes
      - Context ops validation
      - MES 12 fixes
      - VCN 5.0 fix
      - HDP fix
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240814213846.1331827-1-alexander.deucher@amd.com
      9370e430