1. 04 Oct, 2022 38 commits
    • Ian Rogers's avatar
      perf mmap: Remove unnecessary pthread.h include · 26b3a5fa
      Ian Rogers authored
      The comment says it is for cpu_set_t which isn't used in the header.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-11-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      26b3a5fa
    • Ian Rogers's avatar
      perf ui: Update use of pthread mutex · 82aff6cc
      Ian Rogers authored
      Switch to the use of mutex wrappers that provide better error checking.
      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: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-10-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      82aff6cc
    • Ian Rogers's avatar
      perf sched: Update use of pthread mutex · 0bd14ac2
      Ian Rogers authored
      Switch to the use of mutex wrappers that provide better error
      checking. Update cmd_sched so that we always explicitly destroy the
      mutexes.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-9-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0bd14ac2
    • Ian Rogers's avatar
      perf record: Update use of pthread mutex · 49c670b1
      Ian Rogers authored
      Switch to the use of mutex wrappers that provide better error checking
      for synth_lock.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-8-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49c670b1
    • Ian Rogers's avatar
      perf lock: Remove unused pthread.h include · 6f37dc6e
      Ian Rogers authored
      No pthread usage in builtin-lock.c.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6f37dc6e
    • Ian Rogers's avatar
      perf bpf: Remove unused pthread.h include · ed0546b7
      Ian Rogers authored
      No pthread usage in bpf-event.h.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ed0546b7
    • Ian Rogers's avatar
      perf hist: Update use of pthread mutex · 8e03bb88
      Ian Rogers authored
      Switch to the use of mutex wrappers that provide better error checking.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-5-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8e03bb88
    • Ian Rogers's avatar
      perf tests: Avoid pthread.h inclusion · 130f267a
      Ian Rogers authored
      pthread.h is being included for the side-effect of getting sched.h and
      macros like CPU_CLR. Switch to directly using sched.h, or if that is
      already present, just remove the pthread.h inclusion entirely.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      130f267a
    • Ian Rogers's avatar
      perf bench: Update use of pthread mutex/cond · a64d3af5
      Ian Rogers authored
      Switch to the use of mutex wrappers that provide better error checking.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a64d3af5
    • Pavithra Gurushankar's avatar
      perf mutex: Wrapped usage of mutex and cond · e57d8977
      Pavithra Gurushankar authored
      Added a new header file mutex.h that wraps the usage of
      pthread_mutex_t and pthread_cond_t. By abstracting these it is
      possible to introduce error checking.
      Signed-off-by: default avatarPavithra Gurushankar <gpavithrasha@gmail.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Truong <alexandre.truong@arm.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: André Almeida <andrealmeid@igalia.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Colin Ian King <colin.king@intel.com>
      Cc: Dario Petrillo <dario.pk1@gmail.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Dave Marchevsky <davemarchevsky@fb.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jason Wang <wangborong@cdjrlc.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Weiguo Li <liwg06@foxmail.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: William Cohen <wcohen@redhat.com>
      Cc: Zechuan Chen <chenzechuan1@huawei.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Cc: yaowenbin <yaowenbin1@huawei.com>
      Link: https://lore.kernel.org/r/20220826164242.43412-2-irogers@google.comSigned-off-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e57d8977
    • Adrian Hunter's avatar
      perf record: Allow multiple recording time ranges · 6657a099
      Adrian Hunter authored
      AUX area traces can produce too much data to record successfully or
      analyze subsequently. Add another means to reduce data collection by
      allowing multiple recording time ranges.
      
      This is useful, for instance, in cases where a workload produces
      predictably reproducible events in specific time ranges.
      
      Today we only have perf record -D <msecs> to start at a specific region, or
      some complicated approach using snapshot mode and external scripts sending
      signals or using the fifos. But these approaches are difficult to set up
      compared with simply having perf do it.
      
      Extend perf record option -D/--delay option to specifying relative time
      stamps for start stop controlled by perf with the right time offset, for
      instance:
      
          perf record -e intel_pt// -D 10-20,30-40
      
      to record 10ms to 20ms into the trace and 30ms to 40ms.
      
      Example:
      
       The example workload is:
      
       $ cat repeat-usleep.c
      
       int usleep(useconds_t usec);
      
       int usage(int ret, const char *msg)
       {
               if (msg)
                       fprintf(stderr, "%s\n", msg);
      
               fprintf(stderr, "Usage is: repeat-usleep <microseconds>\n");
      
               return ret;
       }
      
       int main(int argc, char *argv[])
       {
               unsigned long usecs;
               char *end_ptr;
      
               if (argc != 2)
                       return usage(1, "Error: Wrong number of arguments!");
      
               errno = 0;
               usecs = strtoul(argv[1], &end_ptr, 0);
               if (errno || *end_ptr || usecs > UINT_MAX)
                       return usage(1, "Error: Invalid argument!");
      
               while (1) {
                       int ret = usleep(usecs);
      
                       if (ret & errno != EINTR)
                               return usage(1, "Error: usleep() failed!");
               }
      
               return 0;
       }
      
       $ perf record -e intel_pt//u --delay 10-20,40-70,110-160 -- ./repeat-usleep 500
       Events disabled
       Events enabled
       Events disabled
       Events enabled
       Events disabled
       Events enabled
       Events disabled
       [ perf record: Woken up 5 times to write data ]
       [ perf record: Captured and wrote 0.204 MB perf.data ]
       Terminated
      
       A dlfilter is used to determine continuous data collection (timestamps
       less than 1ms apart):
      
       $ cat dlfilter-show-delays.c
      
       static __u64 start_time;
       static __u64 last_time;
      
       int start(void **data, void *ctx)
       {
               printf("%-17s\t%-9s\t%-6s\n", " Time", " Duration", " Delay");
               return 0;
       }
      
       int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, void *ctx)
       {
               __u64 delta;
      
               if (!sample->time)
                       return 1;
               if (!last_time)
                       goto out;
               delta = sample->time - last_time;
               if (delta < 1000000)
                       goto out2;;
               printf("%17.9f\t%9.1f\t%6.1f\n", start_time / 1000000000.0, (last_time - start_time) / 1000000.0, delta / 1000000.0);
       out:
               start_time = sample->time;
       out2:
               last_time = sample->time;
               return 1;
       }
      
       int stop(void *data, void *ctx)
       {
               printf("%17.9f\t%9.1f\n", start_time / 1000000000.0, (last_time - start_time) / 1000000.0);
               return 0;
       }
      
       The result shows the times roughly match the --delay option:
      
       $ perf script --itrace=qb --dlfilter dlfilter-show-delays.so
        Time                    Duration        Delay
         39215.302317300             9.7         20.5
         39215.332480217            30.4         40.9
         39215.403837717            49.8
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220824072814.16422-6-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6657a099
    • Adrian Hunter's avatar
      perf evlist: Add evlist__{en/dis}able_non_dummy() · 329725d5
      Adrian Hunter authored
      Dummy events are used to provide sideband information like MMAP events that
      are always needed even when main events are disabled. Add functions that
      take that into account.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220824072814.16422-5-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      329725d5
    • Adrian Hunter's avatar
      perf record: Change evlist->ctl_fd to use fdarray_flag__non_perf_event · feff0b61
      Adrian Hunter authored
      Patch "perf record: Fix way of handling non-perf-event pollfds" added a
      generic way to handle non-perf-event file descriptors like evlist->ctl_fd.
      Use it instead of handling evlist->ctl_fd separately.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220824072814.16422-4-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      feff0b61
    • Adrian Hunter's avatar
      perf record: Fix done_fd wakeup event · a032ad87
      Adrian Hunter authored
      evlist__add_wakeup_eventfd() calls perf_evlist__add_pollfd() to add a
      non-perf-event to the evlist pollfds. Since commit 415ccb58
      ("perf record: Introduce thread specific data array") that doesn't work
      because evlist pollfs is not polled and done_fd is not duplicated into
      thread-data.
      
      Patch "perf record: Fix way of handling non-perf-event pollfds" added a new
      approach that ensures file descriptors like done_fd are handled correctly
      by flagging them as fdarray_flag__non_perf_event.
      
      Fix by flagging done_fd as fdarray_flag__non_perf_event.
      
      Example:
      
       Before:
      
        $ sleep 3 & perf record -vv -p $!
        ...
        thread_data[0x55f44bd34140]: pollfd[0] <- event_fd=5
        thread_data[0x55f44bd34140]: pollfd[1] <- event_fd=6
        thread_data[0x55f44bd34140]: pollfd[2] <- event_fd=7
        thread_data[0x55f44bd34140]: pollfd[3] <- event_fd=8
        thread_data[0x55f44bd34140]: pollfd[4] <- event_fd=9
        thread_data[0x55f44bd34140]: pollfd[5] <- event_fd=10
        thread_data[0x55f44bd34140]: pollfd[6] <- event_fd=11
        thread_data[0x55f44bd34140]: pollfd[7] <- event_fd=12
        ...
      
       After:
      
        $ sleep 3 & perf record -vv -p $!
        ...
        thread_data[0x55a8ded89140]: pollfd[0] <- event_fd=5
        thread_data[0x55a8ded89140]: pollfd[1] <- event_fd=6
        thread_data[0x55a8ded89140]: pollfd[2] <- event_fd=7
        thread_data[0x55a8ded89140]: pollfd[3] <- event_fd=8
        thread_data[0x55a8ded89140]: pollfd[4] <- event_fd=9
        thread_data[0x55a8ded89140]: pollfd[5] <- event_fd=10
        thread_data[0x55a8ded89140]: pollfd[6] <- event_fd=11
        thread_data[0x55a8ded89140]: pollfd[7] <- event_fd=12
        thread_data[0x55a8ded89140]: pollfd[8] <- non_perf_event fd=4
        ...
      
      This patch depends on "perf record: Fix way of handling non-perf-event
      pollfds".
      
      Fixes: 415ccb58 ("perf record: Introduce thread specific data array")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220824072814.16422-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a032ad87
    • Adrian Hunter's avatar
      perf record: Fix way of handling non-perf-event pollfds · 6562c9ac
      Adrian Hunter authored
      perf record __cmd_record() does not poll evlist pollfds. Instead it polls
      thread_data[0].pollfd. That happens whether or not threads are being used.
      
      perf record duplicates evlist mmap pollfds as needed for separate threads.
      The non-perf-event represented by evlist->ctl_fd has to handled separately,
      which is done explicitly, duplicating it into the thread_data[0] pollfds.
      That approach neglects any other non-perf-event file descriptors. Currently
      there is also done_fd which needs the same handling.
      
      Add a new generalized approach.
      
      Add fdarray_flag__non_perf_event to identify the file descriptors that
      need the special handling. For those cases, also keep a mapping of the
      evlist pollfd index and thread pollfd index, so that the evlist revents
      can be updated.
      
      Although this patch adds the new handling, it does not take it into use.
      There is no functional change, but it is the precursor to a fix, so is
      marked as a fix.
      
      Fixes: 415ccb58 ("perf record: Introduce thread specific data array")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220824072814.16422-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6562c9ac
    • Ian Rogers's avatar
      perf hashmap: Tidy hashmap dependency · bdf45725
      Ian Rogers authored
      When libbpf is present the build uses definitions in libbpf hashmap.c,
      however, libbpf's hashmap.h wasn't being used. Switch to using the
      correct hashmap.h dependent on the define HAVE_LIBBPF_SUPPORT. This was
      the original intent in:
      
        https://lore.kernel.org/lkml/20200515221732.44078-8-irogers@google.com/Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20220824050604.352156-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bdf45725
    • Xin Gao's avatar
      perf metrics: Use 'unsigned int' instead of just 'unsigned'. · 84f879c5
      Xin Gao authored
      'unsigned int' should be clearer than 'unsigned'.
      Signed-off-by: default avatarXin Gao <gaoxin@cdjrlc.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20220816173804.7539-1-gaoxin@cdjrlc.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84f879c5
    • Xin Gao's avatar
      perf parse-events: Use 'unsigned int' instead of plain 'unsigned'. · f1417cea
      Xin Gao authored
      'unsigned int' should be clearer than 'unsigned'.
      Signed-off-by: default avatarXin Gao <gaoxin@cdjrlc.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220816174109.7718-1-gaoxin@cdjrlc.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1417cea
    • Roberto Sassu's avatar
      tools build: Display logical OR of a feature flavors · 74ef1cc9
      Roberto Sassu authored
      Sometimes, features are simply different flavors of another feature, to
      properly detect the exact dependencies needed by different Linux
      distributions.
      
      For example, libbfd has three flavors: libbfd if the distro does not
      require any additional dependency; libbfd-liberty if it requires libiberty;
      libbfd-liberty-z if it requires libiberty and libz.
      
      It might not be clear to the user whether a feature has been successfully
      detected or not, given that some of its flavors will be set to OFF, others
      to ON.
      
      Instead, display only the feature main flavor if not in verbose mode
      (VF != 1), and set it to ON if at least one of its flavors has been
      successfully detected (logical OR), OFF otherwise. Omit the other flavors.
      
      Accomplish that by declaring a FEATURE_GROUP_MEMBERS-<feature main flavor>
      variable, with the list of the other flavors as variable value. For now, do
      it just for libbfd.
      
      In verbose mode, of if no group is defined for a feature, show the feature
      detection result as before.
      
      Committer testing:
      
      Collecting the output from:
      
        $ make -C tools/bpf/bpftool/ clean
        $ make -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A10
      
        $ diff -u before after
        --- before	2022-08-18 10:06:40.422086966 -0300
        +++ after	2022-08-18 10:07:59.202138282 -0300
        @@ -1,6 +1,4 @@
         Auto-detecting system features:
         ...                                  libbfd: [ on  ]
        -...                          libbfd-liberty: [ on  ]
        -...                        libbfd-liberty-z: [ on  ]
         ...                                  libcap: [ on  ]
         ...                         clang-bpf-co-re: [ on  ]
        $
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20220818120957.319995-3-roberto.sassu@huaweicloud.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      74ef1cc9
    • Roberto Sassu's avatar
      tools build: Increment room for feature name in feature detection output · 74da7697
      Roberto Sassu authored
      Since now there are features with a long name, increase the room for them,
      so that fields are correctly aligned.
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20220818120957.319995-2-roberto.sassu@huaweicloud.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      74da7697
    • Roberto Sassu's avatar
      tools build: Fix feature detection output due to eval expansion · 709533e5
      Roberto Sassu authored
      As the first eval expansion is used only to generate Makefile statements,
      messages should not be displayed at this stage, as for example conditional
      expressions are not evaluated.
      
      It can be seen for example in the output of feature detection for bpftool,
      where the number of detected features does not change, despite turning on
      the verbose mode (VF = 1) and there are additional features to display.
      
      Fix this issue by escaping the $ before $(info) statements, to ensure that
      messages are printed only when the function containing them is actually
      executed, and not when it is expanded.
      
      In addition, move the $(info) statement out of feature_print_status, due to
      the fact that is called both inside and outside an eval context, and place
      it to the caller so that the $ can be escaped when necessary. For symmetry,
      move the $(info) statement also out of feature_print_text, and place it to
      the caller.
      
      Force the TMP variable evaluation in verbose mode, to display the features
      in FEATURE_TESTS that are not in FEATURE_DISPLAY.
      
      Reorder perf feature detection messages (first non-verbose, then verbose
      ones) by moving the call to feature_display_entries earlier, before the VF
      environment variable check.
      
      Also, remove the newline from that function, as perf might display
      additional messages. Move the newline to perf Makefile, and display another
      one if displaying the detection result is not deferred as in the case of
      bpftool.
      
      Committer testing:
      
        Collecting the output from:
      
        $ make VF=1 -C tools/bpf/bpftool/ |& grep "Auto-detecting system features" -A20
      
        $ diff -u before after
        --- before	2022-08-18 09:59:55.460529231 -0300
        +++ after	2022-08-18 10:01:11.182517282 -0300
        @@ -4,3 +4,5 @@
         ...              libbfd-liberty-z: [ on  ]
         ...                        libcap: [ on  ]
         ...               clang-bpf-co-re: [ on  ]
        +...        disassembler-four-args: [ on  ]
        +...      disassembler-init-styled: [ OFF ]
        $
      
      Fixes: 0afc5cad ("perf build: Separate feature make support into config/Makefile.feature")
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: bpf@vger.kernel.org
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Link: https://lore.kernel.org/r/20220818120957.319995-1-roberto.sassu@huaweicloud.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      709533e5
    • Raul Silvera's avatar
      perf inject: Add a command line option to specify build ids. · 8012243e
      Raul Silvera authored
      This commit adds the option --known-build-ids to perf inject.
      It allows the user to explicitly specify the build id for a given
      path, instead of retrieving it from the current system. This is
      useful in cases where a perf.data file is processed on a different
      system from where it was collected, or if some of the binaries are
      no longer available.
      
      The build ids and paths are specified in pairs in the command line.
      Using the file:// specifier, build ids can be loaded from a file
      directly generated by perf buildid-list. This is convenient to copy
      build ids from one perf.data file to another.
      
      ** Example: In this example we use perf record to create two
      perf.data files, one with build ids and another without, and use
      perf buildid-list and perf inject to copy the build ids from the
      first file to the second.
      
       $ perf record ls /tmp
       $ perf record --no-buildid -o perf.data.no-buildid ls /tmp
       $ perf buildid-list > build-ids.txt
       $ perf inject -b --known-build-ids='file://build-ids.txt' \
              -i perf.data.no-buildid -o perf.data.buildid
      Signed-off-by: default avatarRaul Silvera <rsilvera@google.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: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220815225922.2118745-1-rsilvera@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8012243e
    • Linus Torvalds's avatar
      Merge tag 'statx-dioalign-for-linus' of... · 725737e7
      Linus Torvalds authored
      Merge tag 'statx-dioalign-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux
      
      Pull STATX_DIOALIGN support from Eric Biggers:
       "Make statx() support reporting direct I/O (DIO) alignment information.
      
        This provides a generic interface for userspace programs to determine
        whether a file supports DIO, and if so with what alignment
        restrictions. Specifically, STATX_DIOALIGN works on block devices, and
        on regular files when their containing filesystem has implemented
        support.
      
        An interface like this has been requested for years, since the
        conditions for when DIO is supported in Linux have gotten increasingly
        complex over time. Today, DIO support and alignment requirements can
        be affected by various filesystem features such as multi-device
        support, data journalling, inline data, encryption, verity,
        compression, checkpoint disabling, log-structured mode, etc.
      
        Further complicating things, Linux v6.0 relaxed the traditional rule
        of DIO needing to be aligned to the block device's logical block size;
        now user buffers (but not file offsets) only need to be aligned to the
        DMA alignment.
      
        The approach of uplifting the XFS specific ioctl XFS_IOC_DIOINFO was
        discarded in favor of creating a clean new interface with statx().
      
        For more information, see the individual commits and the man page
        update[1]"
      
      Link: https://lore.kernel.org/r/20220722074229.148925-1-ebiggers@kernel.org [1]
      
      * tag 'statx-dioalign-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux:
        xfs: support STATX_DIOALIGN
        f2fs: support STATX_DIOALIGN
        f2fs: simplify f2fs_force_buffered_io()
        f2fs: move f2fs_force_buffered_io() into file.c
        ext4: support STATX_DIOALIGN
        fscrypt: change fscrypt_dio_supported() to prepare for STATX_DIOALIGN
        vfs: support STATX_DIOALIGN on block devices
        statx: add direct I/O alignment information
      725737e7
    • Linus Torvalds's avatar
      Merge tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt · 5779aa2d
      Linus Torvalds authored
      Pull fsverity updates from Eric Biggers:
       "Minor changes to convert uses of kmap() to kmap_local_page()"
      
      * tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
        fs-verity: use kmap_local_page() instead of kmap()
        fs-verity: use memcpy_from_page()
      5779aa2d
    • Linus Torvalds's avatar
      Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt · 438b2cdd
      Linus Torvalds authored
      Pull fscrypt updates from Eric Biggers:
       "This release contains some implementation changes, but no new
        features:
      
         - Rework the implementation of the fscrypt filesystem-level keyring
           to not be as tightly coupled to the keyrings subsystem. This
           resolves several issues.
      
         - Eliminate most direct uses of struct request_queue from fs/crypto/,
           since struct request_queue is considered to be a block layer
           implementation detail.
      
         - Stop using the PG_error flag to track decryption failures. This is
           a prerequisite for freeing up PG_error for other uses"
      
      * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
        fscrypt: work on block_devices instead of request_queues
        fscrypt: stop holding extra request_queue references
        fscrypt: stop using keyrings subsystem for fscrypt_master_key
        fscrypt: stop using PG_error to track error status
        fscrypt: remove fscrypt_set_test_dummy_encryption()
      438b2cdd
    • Linus Torvalds's avatar
      Merge tag 'dlm-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm · f4309528
      Linus Torvalds authored
      Pull dlm updates from David Teigland:
      
       - Fix a couple races found with a new torture test
      
       - Improve errors when api functions are used incorrectly
      
       - Improve tracing for lock requests from user space
      
       - Fix use after free in recently added tracing cod.
      
       - Small internal code cleanups
      
      * tag 'dlm-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
        fs: dlm: fix possible use after free if tracing
        fs: dlm: const void resource name parameter
        fs: dlm: LSFL_CB_DELAY only for kernel lockspaces
        fs: dlm: remove DLM_LSFL_FS from uapi
        fs: dlm: trace user space callbacks
        fs: dlm: change ls_clear_proc_locks to spinlock
        fs: dlm: remove dlm_del_ast prototype
        fs: dlm: handle rcom in else if branch
        fs: dlm: allow lockspaces have zero lvblen
        fs: dlm: fix invalid derefence of sb_lvbptr
        fs: dlm: handle -EINVAL as log_error()
        fs: dlm: use __func__ for function name
        fs: dlm: handle -EBUSY first in unlock validation
        fs: dlm: handle -EBUSY first in lock arg validation
        fs: dlm: fix race between test_bit() and queue_work()
        fs: dlm: fix race in lowcomms
      f4309528
    • Linus Torvalds's avatar
      Merge tag 'nfsd-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux · f90497a1
      Linus Torvalds authored
      Pull nfsd updates from Chuck Lever:
       "This release is mostly bug fixes, clean-ups, and optimizations.
      
        One notable set of fixes addresses a subtle buffer overflow issue that
        occurs if a small RPC Call message arrives in an oversized RPC record.
        This is only possible on a framed RPC transport such as TCP.
      
        Because NFSD shares the receive and send buffers in one set of pages,
        an oversized RPC record steals pages from the send buffer that will be
        used to construct the RPC Reply message. NFSD must not assume that a
        full-sized buffer is always available to it; otherwise, it will walk
        off the end of the send buffer while constructing its reply.
      
        In this release, we also introduce the ability for the server to wait
        a moment for clients to return delegations before it responds with
        NFS4ERR_DELAY. This saves a retransmit and a network round- trip when
        a delegation recall is needed. This work will be built upon in future
        releases.
      
        The NFS server adds another shrinker to its collection. Because
        courtesy clients can linger for quite some time, they might be
        freeable when the server host comes under memory pressure. A new
        shrinker has been added that releases courtesy client resources during
        low memory scenarios.
      
        Lastly, of note: the maximum number of operations per NFSv4 COMPOUND
        that NFSD can handle is increased from 16 to 50. There are NFSv4
        client implementations that need more than 16 to successfully perform
        a mount operation that uses a pathname with many components"
      
      * tag 'nfsd-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (53 commits)
        nfsd: extra checks when freeing delegation stateids
        nfsd: make nfsd4_run_cb a bool return function
        nfsd: fix comments about spinlock handling with delegations
        nfsd: only fill out return pointer on success in nfsd4_lookup_stateid
        NFSD: fix use-after-free on source server when doing inter-server copy
        NFSD: Cap rsize_bop result based on send buffer size
        NFSD: Rename the fields in copy_stateid_t
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_file_cache_stats_fops
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_reply_cache_stats_fops
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
        nfsd: use DEFINE_SHOW_ATTRIBUTE to define export_features_fops and supported_enctypes_fops
        nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops
        NFSD: Pack struct nfsd4_compoundres
        NFSD: Remove unused nfsd4_compoundargs::cachetype field
        NFSD: Remove "inline" directives on op_rsize_bop helpers
        NFSD: Clean up nfs4svc_encode_compoundres()
        SUNRPC: Fix typo in xdr_buf_subsegment's kdoc comment
        NFSD: Clean up WRITE arg decoders
        NFSD: Use xdr_inline_decode() to decode NFSv3 symlinks
        NFSD: Refactor common code out of dirlist helpers
        ...
      f90497a1
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · 3497640a
      Linus Torvalds authored
      Pull erofs updates from Gao Xiang:
       "In this cycle, for container use cases, fscache-based shared domain is
        introduced [1] so that data blobs in the same domain will be storage
        deduplicated and it will also be used for page cache sharing later.
      
        Also, a special packed inode is now introduced to record inode
        fragments which keep the tail part of files by Yue Hu [2]. You can
        keep arbitary length or (at will) the whole file as a fragment and
        then fragments can be optionally compressed in the packed inode
        together and even deduplicated for smaller image sizes.
      
        In addition to that, global compressed data deduplication by sharing
        partial-referenced pclusters is also supported in this cycle.
      
        Summary:
      
         - Introduce fscache-based domain to share blobs between images
      
         - Support recording fragments in a special packed inode
      
         - Support partial-referenced pclusters for global compressed data
           deduplication
      
         - Fix an order >= MAX_ORDER warning due to crafted negative i_size
      
         - Several cleanups"
      
      Link: https://lore.kernel.org/r/20220916085940.89392-1-zhujia.zj@bytedance.com [1]
      Link: https://lore.kernel.org/r/cover.1663065968.git.huyue2@coolpad.com [2]
      
      * tag 'erofs-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: clean up erofs_iget()
        erofs: clean up unnecessary code and comments
        erofs: fold in z_erofs_reload_indexes()
        erofs: introduce partial-referenced pclusters
        erofs: support on-disk compressed fragments data
        erofs: support interlaced uncompressed data for compressed files
        erofs: clean up .read_folio() and .readahead() in fscache mode
        erofs: introduce 'domain_id' mount option
        erofs: Support sharing cookies in the same domain
        erofs: introduce a pseudo mnt to manage shared cookies
        erofs: introduce fscache-based domain
        erofs: code clean up for fscache
        erofs: use kill_anon_super() to kill super in fscache mode
        erofs: fix order >= MAX_ORDER warning due to crafted negative i_size
      3497640a
    • Linus Torvalds's avatar
      Merge tag 'fs.vfsuid.fat.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping · 8bea8ff3
      Linus Torvalds authored
      Pull fatfs vfsuid conversion from Christian Brauner:
       "Last cycle we introduced the new vfs{g,u}id_t types that we had agreed
        on. The most important parts of the vfs have been converted but there
        are a few more places we need to switch before we can remove the old
        helpers completely.
      
        This cycle we converted all filesystems that called idmapped mount
        helpers directly. The affected filesystems are f2fs, fat, fuse, ksmbd,
        overlayfs, and xfs. We've sent patches for all of them. Looking at
        -next f2fs, ksmbd, overlayfs, and xfs have all picked up these patches
        and they should land in mainline during the v6.1 merge window.
      
        So all filesystems that have a separate tree should send the vfsuid
        conversion themselves. Onle the fat conversion is going through this
        generic fs trees because there is no fat tree.
      
        In order to change time settings on an inode fat checks that the
        caller either is the owner of the inode or the inode's group is in the
        caller's group list. If fat is on an idmapped mount we compare whether
        the inode mapped into the mount is equivalent to the caller's fsuid.
        If it isn't we compare whether the inode's group mapped into the mount
        is in the caller's group list.
      
        We now use the new vfsuid based helpers for that"
      
      * tag 'fs.vfsuid.fat.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping:
        fat: port to vfs{g,u}id_t and associated helpers
      8bea8ff3
    • Linus Torvalds's avatar
      Merge tag 'fs.acl.rework.prep.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping · 223b8452
      Linus Torvalds authored
      Pull vfs acl updates from Christian Brauner:
       "These are general fixes and preparatory changes related to the ongoing
        posix acl rework. The actual rework where we build a type safe posix
        acl api wasn't ready for this merge window but we're hopeful for the
        next merge window.
      
        General fixes:
      
         - Some filesystems like 9p and cifs have to implement custom posix
           acl handlers because they require access to the dentry in order to
           set and get posix acls while the set and get inode operations
           currently don't. But the ntfs3 filesystem has no such requirement
           and thus implemented custom posix acl xattr handlers when it really
           didn't have to. So this pr contains patch that just implements set
           and get inode operations for ntfs3 and switches it to rely on the
           generic posix acl xattr handlers. (We would've appreciated reviews
           from the ntfs3 maintainers but we didn't get any. But hey, if we
           really broke it we'll fix it. But fstests for ntfs3 said it's
           fine.)
      
         - The posix_acl_fix_xattr_common() helper has been adapted so it can
           be used by a few more callers and avoiding open-coding the same
           checks over and over.
      
        Other than the two general fixes this series introduces a new helper
        vfs_set_acl_prepare(). The reason for this helper is so that we can
        mitigate one of the source that change {g,u}id values directly in the
        uapi struct. With the vfs_set_acl_prepare() helper we can move the
        idmapped mount fixup into the generic posix acl set handler.
      
        The advantage of this is that it allows us to remove the
        posix_acl_setxattr_idmapped_mnt() helper which so far we had to call
        in vfs_setxattr() to account for idmapped mounts. While semantically
        correct the problem with this approach was that we had to keep the
        value parameter of the generic vfs_setxattr() call as non-const. This
        is rectified in this series.
      
        Ultimately, we will get rid of all the extreme kludges and type
        unsafety once we have merged the posix api - hopefully during the next
        merge window - built solely around get and set inode operations. Which
        incidentally will also improve handling of posix acls in security and
        especially in integrity modesl. While this will come with temporarily
        having two inode operation for posix acls that is nothing compared to
        the problems we have right now and so well worth it. We'll end up with
        something that we can actually reason about instead of needing to
        write novels to explain what's going on"
      
      * tag 'fs.acl.rework.prep.v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping:
        xattr: always us is_posix_acl_xattr() helper
        acl: fix the comments of posix_acl_xattr_set
        xattr: constify value argument in vfs_setxattr()
        ovl: use vfs_set_acl_prepare()
        acl: move idmapping handling into posix_acl_xattr_set()
        acl: add vfs_set_acl_prepare()
        acl: return EOPNOTSUPP in posix_acl_fix_xattr_common()
        ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers
      223b8452
    • Linus Torvalds's avatar
      Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · da380aef
      Linus Torvalds authored
      Pull coredump fix from Al Viro:
       "Brown paper bag bug fix for the coredumping fix late in the 6.0
        release cycle"
      
      * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        [brown paperbag] fix coredump breakage
      da380aef
    • Linus Torvalds's avatar
      Merge tag 'lsm-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm · 26b84401
      Linus Torvalds authored
      Pull LSM updates from Paul Moore:
       "Seven patches for the LSM layer and we've got a mix of trivial and
        significant patches. Highlights below, starting with the smaller bits
        first so they don't get lost in the discussion of the larger items:
      
         - Remove some redundant NULL pointer checks in the common LSM audit
           code.
      
         - Ratelimit the lockdown LSM's access denial messages.
      
           With this change there is a chance that the last visible lockdown
           message on the console is outdated/old, but it does help preserve
           the initial series of lockdown denials that started the denial
           message flood and my gut feeling is that these might be the more
           valuable messages.
      
         - Open userfaultfds as readonly instead of read/write.
      
           While this code obviously lives outside the LSM, it does have a
           noticeable impact on the LSMs with Ondrej explaining the situation
           in the commit description. It is worth noting that this patch
           languished on the VFS list for over a year without any comments
           (objections or otherwise) so I took the liberty of pulling it into
           the LSM tree after giving fair notice. It has been in linux-next
           since the end of August without any noticeable problems.
      
         - Add a LSM hook for user namespace creation, with implementations
           for both the BPF LSM and SELinux.
      
           Even though the changes are fairly small, this is the bulk of the
           diffstat as we are also including BPF LSM selftests for the new
           hook.
      
           It's also the most contentious of the changes in this pull request
           with Eric Biederman NACK'ing the LSM hook multiple times during its
           development and discussion upstream. While I've never taken NACK's
           lightly, I'm sending these patches to you because it is my belief
           that they are of good quality, satisfy a long-standing need of
           users and distros, and are in keeping with the existing nature of
           the LSM layer and the Linux Kernel as a whole.
      
           The patches in implement a LSM hook for user namespace creation
           that allows for a granular approach, configurable at runtime, which
           enables both monitoring and control of user namespaces. The general
           consensus has been that this is far preferable to the other
           solutions that have been adopted downstream including outright
           removal from the kernel, disabling via system wide sysctls, or
           various other out-of-tree mechanisms that users have been forced to
           adopt since we haven't been able to provide them an upstream
           solution for their requests. Eric has been steadfast in his
           objections to this LSM hook, explaining that any restrictions on
           the user namespace could have significant impact on userspace.
           While there is the possibility of impacting userspace, it is
           important to note that this solution only impacts userspace when it
           is requested based on the runtime configuration supplied by the
           distro/admin/user. Frederick (the pathset author), the LSM/security
           community, and myself have tried to work with Eric during
           development of this patchset to find a mutually acceptable
           solution, but Eric's approach and unwillingness to engage in a
           meaningful way have made this impossible. I have CC'd Eric directly
           on this pull request so he has a chance to provide his side of the
           story; there have been no objections outside of Eric's"
      
      * tag 'lsm-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
        lockdown: ratelimit denial messages
        userfaultfd: open userfaultfds with O_RDONLY
        selinux: Implement userns_create hook
        selftests/bpf: Add tests verifying bpf lsm userns_create hook
        bpf-lsm: Make bpf_lsm_userns_create() sleepable
        security, lsm: Introduce security_create_user_ns()
        lsm: clean up redundant NULL pointer check
      26b84401
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · e816da29
      Linus Torvalds authored
      Pull SELinux updates from Paul Moore:
       "Six SELinux patches, all are simple and easily understood, but a list
        of the highlights is below:
      
         - Use 'grep -E' instead of 'egrep' in the SELinux policy install
           script.
      
           Fun fact, this seems to be GregKH's *second* dedicated SELinux
           patch since we transitioned to git (ignoring merges, the SPDX
           stuff, and a trivial fs reference removal when lustre was yanked);
           the first was back in 2011 when selinuxfs was placed in
           /sys/fs/selinux. Oh, the memories ...
      
         - Convert the SELinux policy boolean values to use signed integer
           types throughout the SELinux kernel code.
      
           Prior to this we were using a mix of signed and unsigned integers
           which was probably okay in this particular case, but it is
           definitely not a good idea in general.
      
         - Remove a reference to the SELinux runtime disable functionality in
           /etc/selinux/config as we are in the process of deprecating that.
      
           See [1] for more background on this if you missed the previous
           notes on the deprecation.
      
         - Minor cleanups: remove unneeded variables and function parameter
           constification"
      
      Link: https://github.com/SELinuxProject/selinux-kernel/wiki/DEPRECATE-runtime-disable [1]
      
      * tag 'selinux-pr-20221003' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: remove runtime disable message in the install_policy.sh script
        selinux: use "grep -E" instead of "egrep"
        selinux: remove the unneeded result variable
        selinux: declare read-only parameters const
        selinux: use int arrays for boolean values
        selinux: remove an unneeded variable in sel_make_class_dir_entries()
      e816da29
    • Linus Torvalds's avatar
      Merge tag 'integrity-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity · eafb121e
      Linus Torvalds authored
      Pull integrity updates from Mimi Zohar:
       "Just two bug fixes"
      
      * tag 'integrity-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
        efi: Correct Macmini DMI match in uefi cert quirk
        ima: fix blocking of security.ima xattrs of unsupported algorithms
      eafb121e
    • Linus Torvalds's avatar
      Merge tag 'Smack-for-6.1' of https://github.com/cschaufler/smack-next · 74a0f845
      Linus Torvalds authored
      Pull smack updates from Casey Schaufler:
       "Two minor code clean-ups: one removes constants left over from the old
        mount API, while the other gets rid of an unneeded variable.
      
        The other change fixes a flaw in handling IPv6 labeling"
      
      * tag 'Smack-for-6.1' of https://github.com/cschaufler/smack-next:
        smack: cleanup obsolete mount option flags
        smack: lsm: remove the unneeded result variable
        SMACK: Add sk_clone_security LSM hook
      74a0f845
    • Al Viro's avatar
      [brown paperbag] fix coredump breakage · 4f526fef
      Al Viro authored
      Let me count the ways in which I'd screwed up:
      
      * when emitting a page, handling of gaps in coredump should happen
      before fetching the current file position.
      * fix for a problem that occurs on rather uncommon setups (and hadn't
      been observed in the wild) had been sent very late in the cycle.
      * ... with badly insufficient testing, introducing an easily
      reproducible breakage.  Without giving it time to soak in -next.
      Fucked-up-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Reported-by: default avatar"J. R. Okajima" <hooanon05g@gmail.com>
      Tested-by: default avatar"J. R. Okajima" <hooanon05g@gmail.com>
      Fixes: 06bbaa6d "[coredump] don't use __kernel_write() on kmap_local_page()"
      Cc: stable@kernel.org	# v6.0-only
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      4f526fef
    • Linus Torvalds's avatar
      Merge tag 'hardening-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · d0989d01
      Linus Torvalds authored
      Pull kernel hardening updates from Kees Cook:
       "Most of the collected changes here are fixes across the tree for
        various hardening features (details noted below).
      
        The most notable new feature here is the addition of the memcpy()
        overflow warning (under CONFIG_FORTIFY_SOURCE), which is the next step
        on the path to killing the common class of "trivially detectable"
        buffer overflow conditions (i.e. on arrays with sizes known at compile
        time) that have resulted in many exploitable vulnerabilities over the
        years (e.g. BleedingTooth).
      
        This feature is expected to still have some undiscovered false
        positives. It's been in -next for a full development cycle and all the
        reported false positives have been fixed in their respective trees.
        All the known-bad code patterns we could find with Coccinelle are also
        either fixed in their respective trees or in flight.
      
        The commit message in commit 54d9469b ("fortify: Add run-time WARN
        for cross-field memcpy()") for the feature has extensive details, but
        I'll repeat here that this is a warning _only_, and is not intended to
        actually block overflows (yet). The many patches fixing array sizes
        and struct members have been landing for several years now, and we're
        finally able to turn this on to find any remaining stragglers.
      
        Summary:
      
        Various fixes across several hardening areas:
      
         - loadpin: Fix verity target enforcement (Matthias Kaehlcke).
      
         - zero-call-used-regs: Add missing clobbers in paravirt (Bill
           Wendling).
      
         - CFI: clean up sparc function pointer type mismatches (Bart Van
           Assche).
      
         - Clang: Adjust compiler flag detection for various Clang changes
           (Sami Tolvanen, Kees Cook).
      
         - fortify: Fix warnings in arch-specific code in sh, ARM, and xen.
      
        Improvements to existing features:
      
         - testing: improve overflow KUnit test, introduce fortify KUnit test,
           add more coverage to LKDTM tests (Bart Van Assche, Kees Cook).
      
         - overflow: Relax overflow type checking for wider utility.
      
        New features:
      
         - string: Introduce strtomem() and strtomem_pad() to fill a gap in
           strncpy() replacement needs.
      
         - um: Enable FORTIFY_SOURCE support.
      
         - fortify: Enable run-time struct member memcpy() overflow warning"
      
      * tag 'hardening-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (27 commits)
        Makefile.extrawarn: Move -Wcast-function-type-strict to W=1
        hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero
        sparc: Unbreak the build
        x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled
        x86/paravirt: clean up typos and grammaros
        fortify: Convert to struct vs member helpers
        fortify: Explicitly check bounds are compile-time constants
        x86/entry: Work around Clang __bdos() bug
        ARM: decompressor: Include .data.rel.ro.local
        fortify: Adjust KUnit test for modular build
        sh: machvec: Use char[] for section boundaries
        kunit/memcpy: Avoid pathological compile-time string size
        lib: Improve the is_signed_type() kunit test
        LoadPin: Require file with verity root digests to have a header
        dm: verity-loadpin: Only trust verity targets with enforcement
        LoadPin: Fix Kconfig doc about format of file with verity digests
        um: Enable FORTIFY_SOURCE
        lkdtm: Update tests for memcpy() run-time warnings
        fortify: Add run-time WARN for cross-field memcpy()
        fortify: Use SIZE_MAX instead of (size_t)-1
        ...
      d0989d01
    • Linus Torvalds's avatar
      Merge tag 'kcfi-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 865dad20
      Linus Torvalds authored
      Pull kcfi updates from Kees Cook:
       "This replaces the prior support for Clang's standard Control Flow
        Integrity (CFI) instrumentation, which has required a lot of special
        conditions (e.g. LTO) and work-arounds.
      
        The new implementation ("Kernel CFI") is specific to C, directly
        designed for the Linux kernel, and takes advantage of architectural
        features like x86's IBT. This series retains arm64 support and adds
        x86 support.
      
        GCC support is expected in the future[1], and additional "generic"
        architectural support is expected soon[2].
      
        Summary:
      
         - treewide: Remove old CFI support details
      
         - arm64: Replace Clang CFI support with Clang KCFI support
      
         - x86: Introduce Clang KCFI support"
      
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107048 [1]
      Link: https://github.com/samitolvanen/llvm-project/commits/kcfi_generic [2]
      
      * tag 'kcfi-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (22 commits)
        x86: Add support for CONFIG_CFI_CLANG
        x86/purgatory: Disable CFI
        x86: Add types to indirectly called assembly functions
        x86/tools/relocs: Ignore __kcfi_typeid_ relocations
        kallsyms: Drop CONFIG_CFI_CLANG workarounds
        objtool: Disable CFI warnings
        objtool: Preserve special st_shndx indexes in elf_update_symbol
        treewide: Drop __cficanonical
        treewide: Drop WARN_ON_FUNCTION_MISMATCH
        treewide: Drop function_nocfi
        init: Drop __nocfi from __init
        arm64: Drop unneeded __nocfi attributes
        arm64: Add CFI error handling
        arm64: Add types to indirect called assembly functions
        psci: Fix the function type for psci_initcall_t
        lkdtm: Emit an indirect call for CFI tests
        cfi: Add type helper macros
        cfi: Switch to -fsanitize=kcfi
        cfi: Drop __CFI_ADDRESSABLE
        cfi: Remove CONFIG_CFI_CLANG_SHADOW
        ...
      865dad20
  2. 03 Oct, 2022 2 commits
    • Linus Torvalds's avatar
      Merge tag 'execve-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 12ed00ba
      Linus Torvalds authored
      Pull execve updates from Kees Cook:
       "This removes a.out support globally; it has been disabled for a while
        now.
      
         - Remove a.out implementation globally (Eric W. Biederman)
      
         - Remove unused linux_binprm::taso member (Lukas Bulwahn)"
      
      * tag 'execve-v6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        binfmt: remove taso from linux_binprm struct
        a.out: Remove the a.out implementation
      12ed00ba
    • Linus Torvalds's avatar
      Merge tag 'rust-v6.1-rc1' of https://github.com/Rust-for-Linux/linux · 8aebac82
      Linus Torvalds authored
      Pull Rust introductory support from Kees Cook:
       "The tree has a recent base, but has fundamentally been in linux-next
        for a year and a half[1]. It's been updated based on feedback from the
        Kernel Maintainer's Summit, and to gain recent Reviewed-by: tags.
      
        Miguel is the primary maintainer, with me helping where needed/wanted.
        Our plan is for the tree to switch to the standard non-rebasing
        practice once this initial infrastructure series lands.
      
        The contents are the absolute minimum to get Rust code building in the
        kernel, with many more interfaces[2] (and drivers - NVMe[3], 9p[4], M1
        GPU[5]) on the way.
      
        The initial support of Rust-for-Linux comes in roughly 4 areas:
      
         - Kernel internals (kallsyms expansion for Rust symbols, %pA format)
      
         - Kbuild infrastructure (Rust build rules and support scripts)
      
         - Rust crates and bindings for initial minimum viable build
      
         - Rust kernel documentation and samples
      
        Rust support has been in linux-next for a year and a half now, and the
        short log doesn't do justice to the number of people who have
        contributed both to the Linux kernel side but also to the upstream
        Rust side to support the kernel's needs. Thanks to these 173 people,
        and many more, who have been involved in all kinds of ways:
      
        Miguel Ojeda, Wedson Almeida Filho, Alex Gaynor, Boqun Feng, Gary Guo,
        Björn Roy Baron, Andreas Hindborg, Adam Bratschi-Kaye, Benno Lossin,
        Maciej Falkowski, Finn Behrens, Sven Van Asbroeck, Asahi Lina, FUJITA
        Tomonori, John Baublitz, Wei Liu, Geoffrey Thomas, Philip Herron,
        Arthur Cohen, David Faust, Antoni Boucher, Philip Li, Yujie Liu,
        Jonathan Corbet, Greg Kroah-Hartman, Paul E. McKenney, Josh Triplett,
        Kent Overstreet, David Gow, Alice Ryhl, Robin Randhawa, Kees Cook,
        Nick Desaulniers, Matthew Wilcox, Linus Walleij, Joe Perches, Michael
        Ellerman, Petr Mladek, Masahiro Yamada, Arnaldo Carvalho de Melo,
        Andrii Nakryiko, Konstantin Shelekhin, Rasmus Villemoes, Konstantin
        Ryabitsev, Stephen Rothwell, Andy Shevchenko, Sergey Senozhatsky, John
        Paul Adrian Glaubitz, David Laight, Nathan Chancellor, Jonathan
        Cameron, Daniel Latypov, Shuah Khan, Brendan Higgins, Julia Lawall,
        Laurent Pinchart, Geert Uytterhoeven, Akira Yokosawa, Pavel Machek,
        David S. Miller, John Hawley, James Bottomley, Arnd Bergmann,
        Christian Brauner, Dan Robertson, Nicholas Piggin, Zhouyi Zhou, Elena
        Zannoni, Jose E. Marchesi, Leon Romanovsky, Will Deacon, Richard
        Weinberger, Randy Dunlap, Paolo Bonzini, Roland Dreier, Mark Brown,
        Sasha Levin, Ted Ts'o, Steven Rostedt, Jarkko Sakkinen, Michal
        Kubecek, Marco Elver, Al Viro, Keith Busch, Johannes Berg, Jan Kara,
        David Sterba, Connor Kuehl, Andy Lutomirski, Andrew Lunn, Alexandre
        Belloni, Peter Zijlstra, Russell King, Eric W. Biederman, Willy
        Tarreau, Christoph Hellwig, Emilio Cobos Álvarez, Christian Poveda,
        Mark Rousskov, John Ericson, TennyZhuang, Xuanwo, Daniel Paoliello,
        Manish Goregaokar, comex, Josh Stone, Stephan Sokolow, Philipp Krones,
        Guillaume Gomez, Joshua Nelson, Mats Larsen, Marc Poulhiès, Samantha
        Miller, Esteban Blanc, Martin Schmidt, Martin Rodriguez Reboredo,
        Daniel Xu, Viresh Kumar, Bartosz Golaszewski, Vegard Nossum, Milan
        Landaverde, Dariusz Sosnowski, Yuki Okushi, Matthew Bakhtiari, Wu
        XiangCheng, Tiago Lam, Boris-Chengbiao Zhou, Sumera Priyadarsini,
        Viktor Garske, Niklas Mohrin, Nándor István Krácser, Morgan Bartlett,
        Miguel Cano, Léo Lanteri Thauvin, Julian Merkle, Andreas Reindl,
        Jiapeng Chong, Fox Chen, Douglas Su, Antonio Terceiro, SeongJae Park,
        Sergio González Collado, Ngo Iok Ui (Wu Yu Wei), Joshua Abraham,
        Milan, Daniel Kolsoi, ahomescu, Manas, Luis Gerhorst, Li Hongyu,
        Philipp Gesang, Russell Currey, Jalil David Salamé Messina, Jon Olson,
        Raghvender, Angelos, Kaviraj Kanagaraj, Paul Römer, Sladyn Nunes,
        Mauro Baladés, Hsiang-Cheng Yang, Abhik Jain, Hongyu Li, Sean Nash,
        Yuheng Su, Peng Hao, Anhad Singh, Roel Kluin, Sara Saa, Geert
        Stappers, Garrett LeSage, IFo Hancroft, and Linus Torvalds"
      
      Link: https://lwn.net/Articles/849849/ [1]
      Link: https://github.com/Rust-for-Linux/linux/commits/rust [2]
      Link: https://github.com/metaspace/rust-linux/commit/d88c3744d6cbdf11767e08bad56cbfb67c4c96d0 [3]
      Link: https://github.com/wedsonaf/linux/commit/9367032607f7670de0ba1537cf09ab0f4365a338 [4]
      Link: https://github.com/AsahiLinux/linux/commits/gpu/rust-wip [5]
      
      * tag 'rust-v6.1-rc1' of https://github.com/Rust-for-Linux/linux: (27 commits)
        MAINTAINERS: Rust
        samples: add first Rust examples
        x86: enable initial Rust support
        docs: add Rust documentation
        Kbuild: add Rust support
        rust: add `.rustfmt.toml`
        scripts: add `is_rust_module.sh`
        scripts: add `rust_is_available.sh`
        scripts: add `generate_rust_target.rs`
        scripts: add `generate_rust_analyzer.py`
        scripts: decode_stacktrace: demangle Rust symbols
        scripts: checkpatch: enable language-independent checks for Rust
        scripts: checkpatch: diagnose uses of `%pA` in the C side as errors
        vsprintf: add new `%pA` format specifier
        rust: export generated symbols
        rust: add `kernel` crate
        rust: add `bindings` crate
        rust: add `macros` crate
        rust: add `compiler_builtins` crate
        rust: adapt `alloc` crate to the kernel
        ...
      8aebac82