perf tools: Use perf_evsel__match in perf_evsel__is_bpf_output
Subsystems (3)
Jiri Olsa
reviewerPATCH 1/4 perf tools: Use perf_evsel__match in perf_evsel__is_bpf_output
Using perf_evsel__match helper in perf_evsel__is_bpf_output.
--- tools/perf/util/evsel.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/evsel.h +1 -4
@@ -402,10 +402,7 @@ bool perf_evsel__is_function_event(struct perf_evsel *evsel);static inline bool perf_evsel__is_bpf_output (struct perf_evsel *evsel) { -struct perf_event_attr *attr = &evsel->attr; - -return (attr->config ==PERF_COUNT_SW_BPF_OUTPUT ) && - (attr->type ==PERF_TYPE_SOFTWARE ); +return perf_evsel__match (evsel,SOFTWARE ,SW_BPF_OUTPUT ); }struct perf_attr_details {
Signature · 1 line
2.17.1
Jiri Olsa
reviewerPATCH 2/4 perf stat: Get rid of extra clock display function
There's no reason to have separate function to display clock events. It's only purpose was to convert the nanosecond value into microseconds. We do that now in generic code, if the unit and scale values are properly set, which this patch do for clock events.
The output differs in the unit field being displayed in its columns rather than having it added as a suffix of the event name. Plus the value is rounded into 2 decimal numbers as for any other event.
Before:
# perf stat -e cpu-clock,task-clock -C 0 sleep 3
Performance counter stats for 'CPU(s) 0':
3001.123137 cpu-clock (msec) # 1.000 CPUs utilized
3001.133250 task-clock (msec) # 1.000 CPUs utilized3.001159813 seconds time elapsed
Now:
# perf stat -e cpu-clock,task-clock -C 0 sleep 3
Performance counter stats for 'CPU(s) 0':
3,001.05 msec cpu-clock # 1.000 CPUs utilized
3,001.05 msec task-clock # 1.000 CPUs utilized3.001077794 seconds time elapsed
There's small difference in csv output, as we now output the unit field, which was empty before. It's in the proper spot, so there's no compatibility issue.
Before:
# perf stat -e cpu-clock,task-clock -C 0 -x, sleep 3 3001.065177,,cpu-clock,3001064187,100.00,1.000,CPUs utilized 3001.077085,,task-clock,3001077085,100.00,1.000,CPUs utilized
# perf stat -e cpu-clock,task-clock -C 0 -x, sleep 3 3000.80,msec,cpu-clock,3000799026,100.00,1.000,CPUs utilized 3000.80,msec,task-clock,3000799550,100.00,1.000,CPUs utilized
Adding perf_evsel__is_clock to replace nsec_counter.
--- tools/perf/builtin-stat.c | 48 ++--------------------------------- tools/perf/util/evsel.c | 11 ++++++++ tools/perf/util/evsel.h | 6 +++++ tools/perf/util/stat-shadow.c | 5 ++-- 4 files changed, 21 insertions(+), 49 deletions(-)
tools/perf/builtin-stat.c +2 -46
@@ -296,18 +296,6 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)return perf_evsel__open_per_thread (evsel, evsel_list->threads); } -/* -* Does the counter have nsecs as a unit? -*/ -static inline int nsec_counter (struct perf_evsel *evsel) -{ -if (perf_evsel__match (evsel,SOFTWARE ,SW_CPU_CLOCK ) || -perf_evsel__match (evsel,SOFTWARE ,SW_TASK_CLOCK )) -return 1 ; - -return 0 ; -} - static int process_synthesized_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused,
@@ -1058,34 +1046,6 @@ static void print_metric_header(void *ctx, const char *color __maybe_unused,fprintf (os->fh,"%*s " , metric_only_len, unit); } -static void nsec_printout (int id,int nr,struct perf_evsel *evsel,double avg) -{ -FILE *output = stat_config.output; -double msecs = avg /NSEC_PER_MSEC ; -const char *fmt_v, *fmt_n; -char name[25 ]; - - fmt_v = csv_output ?"%.6f%s" :"%18.6f%s" ; - fmt_n = csv_output ?"%s" :"%-25s" ; - -aggr_printout (evsel, id, nr); - -scnprintf (name,sizeof (name),"%s%s" , -perf_evsel__name (evsel), csv_output ?"" :" (msec)" ); - -fprintf (output, fmt_v, msecs, csv_sep); - -if (csv_output) -fprintf (output,"%s%s" , evsel->unit, csv_sep); -else -fprintf (output,"%-*s%s" , unit_width, evsel->unit, csv_sep); - -fprintf (output, fmt_n, name); - -if (evsel->cgrp) -fprintf (output,"%s%s" , csv_sep, evsel->cgrp->name); -} -static int first_shadow_cpu (struct perf_evsel *evsel,int id) {int i;
@@ -1241,11 +1201,7 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval,return ; } -if (metric_only) -/* nothing */ ; -else if (nsec_counter (counter)) -nsec_printout (id, nr, counter, uval); -else +if (!metric_only)abs_printout (id, nr, counter, uval); out.print_metric = pm;
@@ -1331,7 +1287,7 @@ static void collect_all_aliases(struct perf_evsel *counter, alias->scale != counter->scale || alias->cgrp != counter->cgrp ||strcmp (alias->unit, counter->unit) || - nsec_counter(alias) != nsec_counter(counter)) + perf_evsel__is_clock(alias) != perf_evsel__is_clock(counter)) break; alias->merged_stat = true;cb (alias, data, false);
tools/perf/util/evsel.c +11 -0
@@ -260,6 +260,17 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) evsel->attr.sample_period =1 ; } +if (perf_evsel__is_clock (evsel)) { +/* +* The evsel->unit points to static alias->unit +* so it's ok to use static string in here. +*/ +static const char *unit ="msec" ; + + evsel->unit = unit; + evsel->scale =1e-6 ; + } +return evsel; }
tools/perf/util/evsel.h +6 -0
@@ -405,6 +405,12 @@ static inline bool perf_evsel__is_bpf_output(struct perf_evsel *evsel)return perf_evsel__match (evsel,SOFTWARE ,SW_BPF_OUTPUT ); } +static inline bool perf_evsel__is_clock (struct perf_evsel *evsel) +{ +return perf_evsel__match (evsel,SOFTWARE ,SW_CPU_CLOCK ) || +perf_evsel__match (evsel,SOFTWARE ,SW_TASK_CLOCK ); +} +struct perf_attr_details {bool freq;bool verbose;
tools/perf/util/stat-shadow.c +2 -3
@@ -913,11 +913,10 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel, ratio = total / avg;print_metric (ctxp,NULL ,"%8.0f" ,"cycles / elision" , ratio); - }else if (perf_evsel__match (evsel,SOFTWARE ,SW_TASK_CLOCK ) || -perf_evsel__match (evsel,SOFTWARE ,SW_CPU_CLOCK )) { + }else if (perf_evsel__is_clock (evsel)) {if ((ratio =avg_stats (&walltime_nsecs_stats)) !=0 )print_metric (ctxp,NULL ,"%8.3f" ,"CPUs utilized" , - avg / ratio); + avg / (ratio * evsel->scale));else print_metric (ctxp,NULL ,NULL ,"CPUs utilized" ,0 ); }else if (perf_stat_evsel__is (evsel,TOPDOWN_FETCH_BUBBLES )) {
Signature · 1 line
2.17.1
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf stat: Get rid of extra clock display function
perf stat: Get rid of extra clock display function
Commit-ID: 0aa802a79469a86ebe143019144cd4df8ae852e4 Gitweb: https://git.kernel.org/tip/0aa802a79469a86ebe143019144cd4df8ae852e4 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 20 Jul 2018 13:00:34 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 24 Jul 2018 14:54:58 -0300
perf stat: Get rid of extra clock display function
There's no reason to have separate function to display clock events. It's only purpose was to convert the nanosecond value into microseconds. We do that now in generic code, if the unit and scale values are properly set, which this patch do for clock events.
The output differs in the unit field being displayed in its columns rather than having it added as a suffix of the event name. Plus the value is rounded into 2 decimal numbers as for any other event.
Before:
# perf stat -e cpu-clock,task-clock -C 0 sleep 3
Performance counter stats for 'CPU(s) 0':
3001.123137 cpu-clock (msec) # 1.000 CPUs utilized
3001.133250 task-clock (msec) # 1.000 CPUs utilized3.001159813 seconds time elapsed
Now:
# perf stat -e cpu-clock,task-clock -C 0 sleep 3
Performance counter stats for 'CPU(s) 0':
3,001.05 msec cpu-clock # 1.000 CPUs utilized
3,001.05 msec task-clock # 1.000 CPUs utilized3.001077794 seconds time elapsed
There's a small difference in csv output, as we now output the unit field, which was empty before. It's in the proper spot, so there's no compatibility issue.
Before:
# perf stat -e cpu-clock,task-clock -C 0 -x, sleep 3 3001.065177,,cpu-clock,3001064187,100.00,1.000,CPUs utilized 3001.077085,,task-clock,3001077085,100.00,1.000,CPUs utilized
# perf stat -e cpu-clock,task-clock -C 0 -x, sleep 3 3000.80,msec,cpu-clock,3000799026,100.00,1.000,CPUs utilized 3000.80,msec,task-clock,3000799550,100.00,1.000,CPUs utilized
Add perf_evsel__is_clock to replace nsec_counter.
--- tools/perf/builtin-stat.c | 48 ++----------------------------------------- tools/perf/util/evsel.c | 11 ++++++++++ tools/perf/util/evsel.h | 6 ++++++ tools/perf/util/stat-shadow.c | 5 ++--- 4 files changed, 21 insertions(+), 49 deletions(-)
tools/perf/builtin-stat.c +2 -46
@@ -296,18 +296,6 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)return perf_evsel__open_per_thread (evsel, evsel_list->threads); } -/* -* Does the counter have nsecs as a unit? -*/ -static inline int nsec_counter (struct perf_evsel *evsel) -{ -if (perf_evsel__match (evsel,SOFTWARE ,SW_CPU_CLOCK ) || -perf_evsel__match (evsel,SOFTWARE ,SW_TASK_CLOCK )) -return 1 ; - -return 0 ; -} - static int process_synthesized_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused,
@@ -1058,34 +1046,6 @@ static void print_metric_header(void *ctx, const char *color __maybe_unused,fprintf (os->fh,"%*s " , metric_only_len, unit); } -static void nsec_printout (int id,int nr,struct perf_evsel *evsel,double avg) -{ -FILE *output = stat_config.output; -double msecs = avg /NSEC_PER_MSEC ; -const char *fmt_v, *fmt_n; -char name[25 ]; - - fmt_v = csv_output ?"%.6f%s" :"%18.6f%s" ; - fmt_n = csv_output ?"%s" :"%-25s" ; - -aggr_printout (evsel, id, nr); - -scnprintf (name,sizeof (name),"%s%s" , -perf_evsel__name (evsel), csv_output ?"" :" (msec)" ); - -fprintf (output, fmt_v, msecs, csv_sep); - -if (csv_output) -fprintf (output,"%s%s" , evsel->unit, csv_sep); -else -fprintf (output,"%-*s%s" , unit_width, evsel->unit, csv_sep); - -fprintf (output, fmt_n, name); - -if (evsel->cgrp) -fprintf (output,"%s%s" , csv_sep, evsel->cgrp->name); -} -static int first_shadow_cpu (struct perf_evsel *evsel,int id) {int i;
@@ -1241,11 +1201,7 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval,return ; } -if (metric_only) -/* nothing */ ; -else if (nsec_counter (counter)) -nsec_printout (id, nr, counter, uval); -else +if (!metric_only)abs_printout (id, nr, counter, uval); out.print_metric = pm;
@@ -1331,7 +1287,7 @@ static void collect_all_aliases(struct perf_evsel *counter, alias->scale != counter->scale || alias->cgrp != counter->cgrp ||strcmp (alias->unit, counter->unit) || - nsec_counter(alias) != nsec_counter(counter)) + perf_evsel__is_clock(alias) != perf_evsel__is_clock(counter)) break; alias->merged_stat = true;cb (alias, data, false);
tools/perf/util/evsel.c +11 -0
@@ -260,6 +260,17 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) evsel->attr.sample_period =1 ; } +if (perf_evsel__is_clock (evsel)) { +/* +* The evsel->unit points to static alias->unit +* so it's ok to use static string in here. +*/ +static const char *unit ="msec" ; + + evsel->unit = unit; + evsel->scale =1e-6 ; + } +return evsel; }
tools/perf/util/evsel.h +6 -0
@@ -405,6 +405,12 @@ static inline bool perf_evsel__is_bpf_output(struct perf_evsel *evsel)return perf_evsel__match (evsel,SOFTWARE ,SW_BPF_OUTPUT ); } +static inline bool perf_evsel__is_clock (struct perf_evsel *evsel) +{ +return perf_evsel__match (evsel,SOFTWARE ,SW_CPU_CLOCK ) || +perf_evsel__match (evsel,SOFTWARE ,SW_TASK_CLOCK ); +} +struct perf_attr_details {bool freq;bool verbose;
tools/perf/util/stat-shadow.c +2 -3
@@ -913,11 +913,10 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel, ratio = total / avg;print_metric (ctxp,NULL ,"%8.0f" ,"cycles / elision" , ratio); - }else if (perf_evsel__match (evsel,SOFTWARE ,SW_TASK_CLOCK ) || -perf_evsel__match (evsel,SOFTWARE ,SW_CPU_CLOCK )) { + }else if (perf_evsel__is_clock (evsel)) {if ((ratio =avg_stats (&walltime_nsecs_stats)) !=0 )print_metric (ctxp,NULL ,"%8.3f" ,"CPUs utilized" , - avg / ratio); + avg / (ratio * evsel->scale));else print_metric (ctxp,NULL ,NULL ,"CPUs utilized" ,0 ); }else if (perf_stat_evsel__is (evsel,TOPDOWN_FETCH_BUBBLES )) {
Jiri Olsa
reviewerPATCH 3/4 perf tools: Fix check-headers.sh output file variables
In reply to Jiri OlsaThe warning message in check_w function uses wrongly the $file variable instead of $file1 and $file2.
--- tools/perf/check-headers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/check-headers.sh +1 -1
@@ -67,7 +67,7 @@ check_2 () { cmd="diff $* $file1 $file2 > /dev/null" test -f $file2 && - eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + eval $cmd || echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2 } check () {
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 3/4] perf tools: Fix check-headers.sh output file variables
Em Fri, Jul 20, 2018 at 01:00:35PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
The warning message in
check_wfunction uses wrongly the $file variable instead of $file1 and $file2.
Humm,
Before:
Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at 'arch/powerpc/include/uapi/asm/unistd.h'
After:
Warning: Kernel ABI header at '../arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at '../../arch/powerpc/include/uapi/asm/unistd.h'
The previous version is better, I can then just use:
diff -u tools/arch/powerpc/include/uapi/asm/unistd.h arch/powerpc/include/uapi/asm/unistd.h
and get what changed, with your change I have to go to tools/perf before doing that diff, which is an unnecessary extra step in at least my workflow.
- Arnaldo
Quoted 22 lines
Fixes 582472973593 ("perf check-headers.sh: Add support to check 2 independent files")Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/check-headers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/check-headers.sh +1
-1@@ -67,7 +67,7 @@ check_2 () { cmd="diff $* $file1 $file2 > /dev/null" test -f $file2 && - eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + eval $cmd || echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2 } check () {Signature · 1 line
2.17.1
Re: [PATCH 3/4] perf tools: Fix check-headers.sh output file variables
Quoted 15 lines · Arnaldo Carvalho de Melo
Em Fri, Jul 20, 2018 at 01:00:35PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
The warning message in
check_wfunction uses wrongly the $file variable instead of $file1 and $file2.Humm,
Before:
Warning: Kernel ABI header at '
tools/arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at 'arch/powerpc/include/uapi/asm/unistd.h'After:
Warning: Kernel ABI header at '
../arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at '../../arch/powerpc/include/uapi/asm/unistd.h'
Quoted 7 lines
The previous version is better, I can then just use:
diff -u
tools/arch/powerpc/include/uapi/asm/unistd.harch/powerpc/include/uapi/asm/unistd.hand get what changed, with your change I have to go to
tools/perfbefore doing that diff, which is an unnecessary extra step in at least my workflow.
so all paths output based in kernel tree root then, will change
jirka
Re: [PATCH 3/4] perf tools: Fix check-headers.sh output file variables
Quoted 21 lines · Jiri Olsa
Quoted 19 lines · Arnaldo Carvalho de Melo
Em Fri, Jul 20, 2018 at 01:00:35PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
The warning message in
check_wfunction uses wrongly the $file variable instead of $file1 and $file2.Humm,
Before:
Warning: Kernel ABI header at '
tools/arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at 'arch/powerpc/include/uapi/asm/unistd.h'After:
Warning: Kernel ABI header at '
../arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at '../../arch/powerpc/include/uapi/asm/unistd.h'The previous version is better, I can then just use:
diff -u
tools/arch/powerpc/include/uapi/asm/unistd.harch/powerpc/include/uapi/asm/unistd.h
Quoted 7 lines
Quoted 3 lines
and get what changed, with your change I have to go to
tools/perfbefore doing that diff, which is an unnecessary extra step in at least my workflow.so all paths output based in kernel tree root then, will change
jirka
I was going to ask about this in a separate email initially, but then thought I'd use this email exchange instead, as my question is about the code in question. Hope you don't mind.
If I'm reading this right, the intended behavoir of the block of code below is to test file2 for existance, and if it exists, to evaluate $cmd. If file1 and file2 are found to differ, print the warning.
test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file'
differs from latest version at '$file'" >&2
The '||' path of execution is however also taken if file2 doesn't exist, which is probably very unlikely to happen. See below.
% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'
Is this something you would rather leave as is, or perhaps use something along the lines of the code below instead:
test -f $file2 && {
eval $cmd ||
echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2
}
Thanks.
Re: [PATCH 3/4] perf tools: Fix check-headers.sh output file variables
Quoted 53 lines · Alexander Kapshuk
Quoted 21 lines · Jiri Olsa
Quoted 19 lines · Arnaldo Carvalho de Melo
Em Fri, Jul 20, 2018 at 01:00:35PM +0200, Jiri Olsa escreveu:
Quoted 2 lines
The warning message in
check_wfunction uses wrongly the $file variable instead of $file1 and $file2.Humm,
Before:
Warning: Kernel ABI header at '
tools/arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at 'arch/powerpc/include/uapi/asm/unistd.h'After:
Warning: Kernel ABI header at '
../arch/powerpc/include/uapi/asm/unistd.h' differs from latest version at '../../arch/powerpc/include/uapi/asm/unistd.h'The previous version is better, I can then just use:
diff -u
tools/arch/powerpc/include/uapi/asm/unistd.harch/powerpc/include/uapi/asm/unistd.hQuoted 7 lines
Quoted 3 lines
and get what changed, with your change I have to go to
tools/perfbefore doing that diff, which is an unnecessary extra step in at least my workflow.so all paths output based in kernel tree root then, will change
jirka
I was going to ask about this in a separate email initially, but then thought I'd use this email exchange instead, as my question is about the code in question. Hope you don't mind.
If I'm reading this right, the intended behavoir of the block of code below is to test file2 for existance, and if it exists, to evaluate $cmd. If file1 and file2 are found to differ, print the warning.
test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file'
differs from latest version at '$file'" >&2The '||' path of execution is however also taken if file2 doesn't exist, which is probably very unlikely to happen. See below.
% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'
Quoted 8 lines
Is this something you would rather leave as is, or perhaps use something along the lines of the code below instead:
test -f $file2 && {
eval $cmd ||
echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2
}
hi,
yea, probably.. please feel free to post a patch.. just make sure all the displayed files paths are based on the kernel root
thanks,
jirka
A message that is not in the archive (sent off-list or not yet received): CAJ1xhMUZc88fJwdLL-SitEasyVnomcVHV6+vTyJYAcXGo10C5A@mail.gmail.com
Re: [PATCH 3/4] perf tools: Fix check-headers.sh output file variables
On Tue, Jul 24, 2018 at 08:20:07AM +0100, Alexander Kapshuk wrote:
SNIP
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'Quoted 8 lines
Is this something you would rather leave as is, or perhaps use something along the lines of the code below instead:
test -f $file2 && {
eval $cmd ||
echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2
}hi,
yea, probably.. please feel free to post a patch.. just make sure all the displayed files paths are based on the kernel root
Quoted 6 lines
Quoted 3 lines
thanks,
jirkaI'm away traveling till August 10th, and I may not be able to send the patch in until I get back. Is that OK?
sure, thanks
jirka
PATCH 1/1 perf tools: Fix check-headers.sh AND list path of execution
In reply to Jiri OlsaThe '||' path of execution in the 'test' block of the check_2() function may also be taken if file2 does not exist, in which case the warning message about the ABI headers being different would still be printed where it should not be. See below.
% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'
The proposed patch converts the code following the '&&' operator into a compound list to be executed in the current process environment only if file2 does exist. Should the files being compared differ, a diff command to compare the files concerned is printed on standard output. E.g.
diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
--- tools/perf/check-headers.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/check-headers.sh +6 -2
@@ -67,8 +67,12 @@ check_2 () { cmd="diff $* $file1 $file2 > /dev/null" - test -f $file2 && - eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + test -f $file2 && { + eval $cmd || { + echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + echo diff -u tools/$file $file + } + } } check () {
Signature · 1 line
2.18.0
Jiri Olsa
reviewerPATCH 1/2 perf tools: Make check-headers.sh check based on kernel dir
Changing the logic to compare files with paths relative to kernel source base dir. This way we can keep the output message for 2 unrelated files, which is coming in following patch.
--- tools/perf/check-headers.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/check-headers.sh +7 -3
@@ -69,8 +69,8 @@ check_2 () { test -f $file2 && { eval $cmd || { - echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 - echo diff -u tools/$file $file + echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2 + echo diff -u $file1 $file2 } } }
@@ -80,7 +80,7 @@ check () { shift - check_2 ../$file ../../$file $* + check_2 tools/$file $file $* } # Check if we have the kernel headers (tools/perf/../../include), else
@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +pushd ../.. > /dev/null + # simple diff check for i in $HEADERS; do check $i -B
@@ -98,3 +100,5 @@ check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' + +popd > /dev/null
Signature · 1 line
2.17.1
Jiri Olsa
reviewerPATCH 2/2 perf tools: Move syscall_64.tbl check into check-headers.sh
Probably leftover from the time we introducd the check-headers.sh script.
--- tools/perf/arch/x86/Makefile | 3 --- tools/perf/check-headers.sh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/arch/x86/Makefile +0 -3
@@ -19,9 +19,6 @@ systbl := $(sys)/syscalltbl.sh _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') $(header): $(sys)/syscall_64.tbl $(systbl) - @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \ - (diff -B arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl >/dev/null) \ - || echo "Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'" >&2 )) || true $(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@ clean::
tools/perf/check-headers.sh +3 -0
@@ -101,4 +101,7 @@ check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' +# diff non-symmetric files +check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl + popd > /dev/null
Signature · 1 line
2.17.1
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf tools: Move syscall_64.tbl check into check-headers.sh
perf tools: Move syscall_64.tbl check into check-headers.sh
Commit-ID: c9b51a017065bf514ab5a380f2fb3b0dada5bc68 Gitweb: https://git.kernel.org/tip/c9b51a017065bf514ab5a380f2fb3b0dada5bc68 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 13 Aug 2018 13:15:04 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 14 Aug 2018 15:10:40 -0300
perf tools: Move syscall_64.tbl check into check-headers.sh
Probably leftover from the time we introducd the check-headers.sh script.
Committer testing:
Remove the 'rseq' syscall from tools/perf/arch/x86/entry/syscalls/syscall_64.tbl to fake a diff:
make: Entering directory '/home/acme/git/perf/tools/perf'
BUILD: Doing 'make -j4' parallel build
Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl' diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
CC /tmp/build/perf/util/syscalltbl.o
INSTALL trace_plugins
<SNIP>
$ diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl --- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl 2018-08-13 15:49:50.896585176 -0300 +++ arch/x86/entry/syscalls/syscall_64.tbl 2018-07-20 12:04:04.536858304 -0300 @@ -342,6 +342,7 @@ 331 common pkey_free __x64_sys_pkey_free 332 common statx __x64_sys_statx 333 common io_pgetevents __x64_sys_io_pgetevents +334 common rseq __x64_sys_rseq
#
# x32-specific system call numbers start at 512 to avoid cache impact $
--- tools/perf/arch/x86/Makefile | 3 --- tools/perf/check-headers.sh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/arch/x86/Makefile +0 -3
@@ -19,9 +19,6 @@ systbl := $(sys)/syscalltbl.sh _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') $(header): $(sys)/syscall_64.tbl $(systbl) - @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \ - (diff -B arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl >/dev/null) \ - || echo "Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'" >&2 )) || true $(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@ clean::
tools/perf/check-headers.sh +3 -0
@@ -101,4 +101,7 @@ check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' +# diff non-symmetric files +check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl + cd tools/perf
Re: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
In reply to Jiri Olsatools/perf/check-headers.sh check () { · line 95
Quoted 13 lines · Jiri Olsa
tools/perf/check-headers.sh +2
-0@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +pushd ../.. > /dev/null + # simple diff check for i in $HEADERS; do check $i -B
This breaks the build when sh is not bash:
./check-headers.sh: 91: ./check-headers.sh: pushd: not found ./check-headers.sh: 107: ./check-headers.sh: popd: not found Makefile.perf:205: recipe for target 'sub-make' failed
cheers
Re: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
Quoted 17 lines · Michael Ellerman
tools/perf/check-headers.sh check () { · line 95
Quoted 13 lines · Jiri Olsa
tools/perf/check-headers.sh +2
-0@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +pushd ../.. > /dev/null + # simple diff check for i in $HEADERS; do check $i -BThis breaks the build when sh is not bash:
Quoted 3 lines
./check-headers.sh: 91: ./check-headers.sh: pushd: not found ./check-headers.sh: 107: ./check-headers.sh: popd: not found Makefile.perf:205: recipe for target 'sub-make' failed
sry.. Arnaldo, would you change it for simple cd (attached below) or should I send the fix?
thanks,
jirka
---
tools/perf/check-headers.sh +2 -2
@@ -88,7 +88,7 @@ check () { # differences. test -d ../../include || exit 0 -pushd ../.. > /dev/null +cd ../.. # simple diff check for i in $HEADERS; do
@@ -104,4 +104,4 @@ check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' # diff non-symmetric files check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl -popd > /dev/null +cd tools/perf
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
Em Tue, Aug 14, 2018 at 09:27:26AM +0200, Jiri Olsa escreveu:
Quoted 18 lines · Michael Ellerman
Quoted 17 lines
tools/perf/check-headers.sh check () { · line 95
Quoted 13 lines · Jiri Olsa
tools/perf/check-headers.sh +2
-0@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +pushd ../.. > /dev/null + # simple diff check for i in $HEADERS; do check $i -BThis breaks the build when sh is not bash:
Quoted 6 lines
Quoted 3 lines
./check-headers.sh: 91: ./check-headers.sh: pushd: not found ./check-headers.sh: 107: ./check-headers.sh: popd: not found Makefile.perf:205: recipe for target 'sub-make' failed
sry.. Arnaldo, would you change it for simple cd (attached below) or should I send the fix?
Nah, I'm folding this in, to keep it bisectable.
Quoted 24 lines
thanks,
jirka---
tools/perf/check-headers.sh +2
-2@@ -88,7 +88,7 @@ check () { # differences. test -d ../../include || exit 0 -pushd ../.. > /dev/null +cd ../.. # simple diff check for i in $HEADERS; do@@ -104,4 +104,4 @@ check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' # diff non-symmetric files check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl -popd > /dev/null +cd tools/perf
Re: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
Quoted 19 lines · Arnaldo Carvalho de Melo
Em Tue, Aug 14, 2018 at 09:27:26AM +0200, Jiri Olsa escreveu:
Quoted 18 lines · Michael Ellerman
Quoted 17 lines
tools/perf/check-headers.sh check () { · line 95
Quoted 13 lines · Jiri Olsa
tools/perf/check-headers.sh +2
-0@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +pushd ../.. > /dev/null + # simple diff check for i in $HEADERS; do check $i -BThis breaks the build when sh is not bash:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
./check-headers.sh: 91: ./check-headers.sh: pushd: not found ./check-headers.sh: 107: ./check-headers.sh: popd: not found Makefile.perf:205: recipe for target 'sub-make' failed
sry.. Arnaldo, would you change it for simple cd (attached below) or should I send the fix?
Nah, I'm folding this in, to keep it bisectable.
any chance one of your docker tests could run build in sh/zsh? ;-)
thanks,
jirka
Re: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
Quoted 24 lines · Jiri Olsa
Quoted 23 lines · Arnaldo Carvalho de Melo
Em Tue, Aug 14, 2018 at 09:27:26AM +0200, Jiri Olsa escreveu:
Quoted 22 lines · Michael Ellerman
Quoted 20 lines
tools/perf/check-headers.sh check () { · line 95
Quoted 13 lines · Jiri Olsa
tools/perf/check-headers.sh +2
-0@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +pushd ../.. > /dev/null + # simple diff check for i in $HEADERS; do check $i -BThis breaks the build when sh is not bash:
./check-headers.sh: 91: ./check-headers.sh: pushd: not found ./check-headers.sh: 107: ./check-headers.sh: popd: not found Makefile.perf:205: recipe for target 'sub-make' failed
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
sry.. Arnaldo, would you change it for simple cd (attached below) or should I send the fix?
Nah, I'm folding this in, to keep it bisectable.
any chance one of your docker tests could run build in sh/zsh? ;-)
Just using an Ubuntu image, where /bin/sh == dash should work, that's how I hit it.
cheers
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
Em Wed, Aug 15, 2018 at 08:02:48PM +1000, Michael Ellerman escreveu:
Quoted 9 lines
Quoted 8 lines · Jiri Olsa
Quoted 5 lines · Arnaldo Carvalho de Melo
Em Tue, Aug 14, 2018 at 09:27:26AM +0200, Jiri Olsa escreveu:
Quoted 2 lines
sry.. Arnaldo, would you change it for simple cd (attached below) or should I send the fix?
Nah, I'm folding this in, to keep it bisectable.
any chance one of your docker tests could run build in sh/zsh? ;-)
It does already, see below :-)
Quoted 2 lines
Just using an Ubuntu image, where
/bin/sh== dash should work, that's how I hit it.
So, I do the tests only prior to pushing to Ingo, so didn't catch this, lemme check, put that change back on, start a ubuntu:18.04 perf build container, try to build, see if it would fail, yeah, I'd have detected this before pushing to Ingo, so probably I have to run the tests before pushing to my acme/perf/core branch, will try to operate like that from now on.
[root@jouet perf]# git diff
tools/perf/check-headers.sh +2 -2
@@ -88,7 +88,7 @@ check () { # differences. test -d ../../include || exit 0 -cd ../.. +pushd ../.. > /dev/null # simple diff check for i in $HEADERS; do
@@ -104,4 +104,4 @@ check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' # diff non-symmetric files check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl -cd tools/perf +popd > /dev/null
[root@jouet perf]# docker run --privileged --entrypoint=/bin/sh -v /home/acme/git:/git:Z --rm -ti docker.io/acmel/linux-perf-tools-build-ubuntu:18.04
$ bash perfbuilder@65ead4a4734a:/$ cd /git/perf perfbuilder@65ead4a4734a:/git/perf$ make -C tools/perf O=/tmp/build/perf/ install-bin make: Entering directory '/git/perf/tools/perf' BUILD: Doing 'make -j4' parallel build HOSTCC /tmp/build/perf/fixdep.o HOSTLD /tmp/build/perf/fixdep-in.o LINK /tmp/build/perf/fixdep ./check-headers.sh: 91: ./check-headers.sh: pushd: not found diff: tools/perf/arch/x86/entry/syscalls/syscall_64.tbl: No such file or directory Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl' diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl ./check-headers.sh: 107: ./check-headers.sh: popd: not found Makefile.perf:205: recipe for target 'sub-make' failed make[1]: *** [sub-make] Error 127 Makefile:109: recipe for target 'install-bin' failed make: *** [install-bin] Error 2 make: Leaving directory '/git/perf/tools/perf' perfbuilder@65ead4a4734a:/git/perf$
Re: [PATCH 1/2] perf tools: Make check-headers.sh check based on kernel dir
Quoted 16 lines · Arnaldo Carvalho de Melo
Em Wed, Aug 15, 2018 at 08:02:48PM +1000, Michael Ellerman escreveu:
Quoted 9 lines
Quoted 8 lines · Jiri Olsa
Quoted 5 lines · Arnaldo Carvalho de Melo
Em Tue, Aug 14, 2018 at 09:27:26AM +0200, Jiri Olsa escreveu:
Quoted 2 lines
sry.. Arnaldo, would you change it for simple cd (attached below) or should I send the fix?
Nah, I'm folding this in, to keep it bisectable.
any chance one of your docker tests could run build in sh/zsh? ;-)
It does already, see below :-)
Quoted 2 lines
Just using an Ubuntu image, where
/bin/sh== dash should work, that's how I hit it.
Quoted 6 lines
So, I do the tests only prior to pushing to Ingo, so didn't catch this, lemme check, put that change back on, start a ubuntu:18.04 perf build container, try to build, see if it would fail, yeah, I'd have detected this before pushing to Ingo, so probably I have to run the tests before pushing to my acme/perf/core branch, will try to operate like that from now on.
Or you can tell me to test a different branch :)
cheers
tip-bot for Jiri Olsa
merge bot[tip:perf/urgent] perf tools: Make check-headers.sh check based on kernel dir
In reply to Jiri Olsaperf tools: Make check-headers.sh check based on kernel dir
Commit-ID: 7ea6e983b2cce9a4277ea602c2976d18bd75a908 Gitweb: https://git.kernel.org/tip/7ea6e983b2cce9a4277ea602c2976d18bd75a908 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 13 Aug 2018 13:15:03 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 14 Aug 2018 15:08:33 -0300
perf tools: Make check-headers.sh check based on kernel dir
Changing the logic to compare files with paths relative to kernel source base dir. This way we can keep the output message for 2 unrelated files, which is coming in following patch.
Committer testing:
Remove a line from tools/arch/x86/lib/memcpy_64.S to have it detected:
make: Entering directory '/home/acme/git/perf/tools/perf'
BUILD: Doing 'make -j4' parallel build
Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S' diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
INSTALL GTK UI
INSTALL binaries
--- tools/perf/check-headers.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/check-headers.sh +7 -3
@@ -69,8 +69,8 @@ check_2 () { test -f $file2 && { eval $cmd || { - echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 - echo diff -u tools/$file $file + echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2 + echo diff -u $file1 $file2 } } }
@@ -80,7 +80,7 @@ check () { shift - check_2 ../$file ../../$file $* + check_2 tools/$file $file $* } # Check if we have the kernel headers (tools/perf/../../include), else
@@ -88,6 +88,8 @@ check () { # differences. test -d ../../include || exit 0 +cd ../.. + # simple diff check for i in $HEADERS; do check $i -B
@@ -98,3 +100,5 @@ check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' + +cd tools/perf
Re: [PATCH] perf tools: Fix check-headers.sh AND list path of execution
In reply to Alexander KapshukQuoted 13 lines · Alexander Kapshuk
The '||' path of execution in the 'test' block of the
check_2()function may also be taken if file2 does not exist, in which case the warning message about the ABI headers being different would still be printed where it should not be. See below.% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'
Quoted 8 lines
The proposed patch converts the code following the '&&' operator into a compound list to be executed in the current process environment only if file2 does exist. Should the files being compared differ, a diff command to compare the files concerned is printed on standard output. E.g.
diff -u
tools/arch/x86/lib/memcpy_64.Sarch/x86/lib/memcpy_64.SSigned-off-by Alexander Kapshuk <[email protected]>
I posted follow up patches based on this one
as a reply on this patch
for this one:
thanks,
jirka
Quoted 26 lines
--- tools/perf/check-headers.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/perf/check-headers.sh +6
-2@@ -67,8 +67,12 @@ check_2 () { cmd="diff $* $file1 $file2 > /dev/null" - test -f $file2 && - eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + test -f $file2 && { + eval $cmd || { + echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + echo diff -u tools/$file $file + } + } } check () {Signature · 1 line
2.18.0
Re: [PATCH] perf tools: Fix check-headers.sh AND list path of execution
Quoted 27 lines · Jiri Olsa
Quoted 13 lines · Alexander Kapshuk
The '||' path of execution in the 'test' block of the
check_2()function may also be taken if file2 does not exist, in which case the warning message about the ABI headers being different would still be printed where it should not be. See below.% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'Quoted 8 lines
The proposed patch converts the code following the '&&' operator into a compound list to be executed in the current process environment only if file2 does exist. Should the files being compared differ, a diff command to compare the files concerned is printed on standard output. E.g.
diff -u
tools/arch/x86/lib/memcpy_64.Sarch/x86/lib/memcpy_64.SSigned-off-by Alexander Kapshuk <[email protected]>I posted follow up patches based on this one
as a reply on this patch
Quoted 6 lines
for this one:
Acked-by Jiri Olsa <[email protected]>thanks,
jirka
Noted.
Thanks.
Quoted 27 lines
Quoted 27 lines
--- tools/perf/check-headers.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/perf/check-headers.sh +6
-3@@ -67,8 +67,12 @@ check_2 () { cmd="diff $* $file1 $file2 > /dev/null" - test -f $file2 && - eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + test -f $file2 && { + eval $cmd || { + echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + echo diff -u tools/$file $file + } + } } check () { --2.18.0
Re: [PATCH] perf tools: Fix check-headers.sh AND list path of execution
Em Mon, Aug 13, 2018 at 02:19:10PM +0300, Alexander Kapshuk escreveu:
Quoted 30 lines · Jiri Olsa
Quoted 29 lines · Alexander Kapshuk
Quoted 13 lines
The '||' path of execution in the 'test' block of the
check_2()function may also be taken if file2 does not exist, in which case the warning message about the ABI headers being different would still be printed where it should not be. See below.% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 &&
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1' differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'Quoted 8 lines
The proposed patch converts the code following the '&&' operator into a compound list to be executed in the current process environment only if file2 does exist. Should the files being compared differ, a diff command to compare the files concerned is printed on standard output. E.g.
diff -u
tools/arch/x86/lib/memcpy_64.Sarch/x86/lib/memcpy_64.SSigned-off-by Alexander Kapshuk <[email protected]>I posted follow up patches based on this one
as a reply on this patchfor this one:
Quoted 7 lines
Quoted 4 lines
Acked-by Jiri Olsa <[email protected]>thanks,
jirkaNoted.
Thanks.
Thanks, applied the three patches to acme/perf/core.
- Arnaldo
Re: [PATCH] perf tools: Fix check-headers.sh AND list path of execution
Quoted 3 lines · Arnaldo Carvalho de Melo
Thanks, applied the three patches to acme/perf/core.
- Arnaldo
Thanks.
tip-bot for Alexander Kapshuk
merge bot[tip:perf/urgent] perf tools: Fix check-headers.sh AND list path of execution
In reply to Alexander Kapshukperf tools: Fix check-headers.sh AND list path of execution
Commit-ID: 51d8aac236493833acf60d9c3b6c42437a18da36 Gitweb: https://git.kernel.org/tip/51d8aac236493833acf60d9c3b6c42437a18da36 Author: Alexander Kapshuk <[email protected]> AuthorDate: Sat, 11 Aug 2018 11:39:15 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 13 Aug 2018 15:46:19 -0300
perf tools: Fix check-headers.sh AND list path of execution
The '||' path of execution in the 'test' block of the check_2() function may also be taken if file2 does not exist, in which case the warning message about the ABI headers being different would still be printed where it should not be. See below.
% file1=file1; file2=file2
% cmd="echo diff $file1 $file2"
% test -f $file2 && \
eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file1'
differs from latest version at '$file2'" >&2
Warning: Kernel ABI header at 'tools/file1' differs from latest version at 'file2'
The proposed patch converts the code following the '&&' operator into a compound list to be executed in the current process environment only if file2 does exist. Should the files being compared differ, a diff command to compare the files concerned is printed on standard output. E.g.
$ diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
Committer testing:
Remove a line from that tools/arch/x86/lib/memcpy_64.S file to test this:
BUILD: Doing 'make -j4' parallel build
Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S' diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o
--- tools/perf/check-headers.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/check-headers.sh +6 -2
@@ -67,8 +67,12 @@ check_2 () { cmd="diff $* $file1 $file2 > /dev/null" - test -f $file2 && - eval $cmd || echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + test -f $file2 && { + eval $cmd || { + echo "Warning: Kernel ABI header at 'tools/$file' differs from latest version at '$file'" >&2 + echo diff -u tools/$file $file + } + } } check () {
Jiri Olsa
reviewerPATCH 4/4 perf tools: Move syscall_64.tbl check into check-headers.sh
In reply to Jiri OlsaProbably leftover from the time we introducd the check-headers.sh script.
--- tools/perf/arch/x86/Makefile | 3 --- tools/perf/check-headers.sh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/arch/x86/Makefile +0 -3
@@ -19,9 +19,6 @@ systbl := $(sys)/syscalltbl.sh _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') $(header): $(sys)/syscall_64.tbl $(systbl) - @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \ - (diff -B arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl >/dev/null) \ - || echo "Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'" >&2 )) || true $(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@ clean::
tools/perf/check-headers.sh +3 -0
@@ -93,3 +93,6 @@ check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' + +# diff non-symmetric files +check_2 arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 4/4] perf tools: Move syscall_64.tbl check into check-headers.sh
Em Fri, Jul 20, 2018 at 01:00:36PM +0200, Jiri Olsa escreveu:
Quoted 1 line
Probably leftover from the time we introducd the
check-headers.shscript.
So, with your patch:
[acme@jouet perf]$ git diff
arch/x86/entry/syscalls/syscall_64.tbl +1 -0
@@ -343,6 +343,7 @@ 332 common statx __x64_sys_statx 333 common io_pgetevents __x64_sys_io_pgetevents 334 common rseq __x64_sys_rseq +335 common krava __x64_sys_krava # # x32-specific system call numbers start at 512 to avoid cache impact
[acme@jouet perf]$
It doesn't warn about that new cool syscall, without your patch:
Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
Can you check this?
- Arnaldo
Quoted 34 lines
Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/arch/x86/Makefile | 3 --- tools/perf/check-headers.sh | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)tools/perf/arch/x86/Makefile +0
-3@@ -19,9 +19,6 @@ systbl := $(sys)/syscalltbl.sh _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') $(header): $(sys)/syscall_64.tbl $(systbl) - @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \ - (diff -B arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tbl >/dev/null) \ - || echo "Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'" >&2 )) || true $(Q)$(SHELL) '$(systbl)' $(sys)/syscall_64.tbl 'x86_64' > $@ clean::tools/perf/check-headers.sh +3
-0@@ -93,3 +93,6 @@ check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' + +# diff non-symmetric files +check_2 arch/x86/entry/syscalls/syscall_64.tbl ../../arch/x86/entry/syscalls/syscall_64.tblSignature · 1 line
2.17.1
Re: [PATCH 4/4] perf tools: Move syscall_64.tbl check into check-headers.sh
Quoted 21 lines · Arnaldo Carvalho de Melo
Em Fri, Jul 20, 2018 at 01:00:36PM +0200, Jiri Olsa escreveu:
Quoted 1 line
Probably leftover from the time we introducd the
check-headers.shscript.So, with your patch:
[acme@jouet perf]$ git diff
arch/x86/entry/syscalls/syscall_64.tbl +1
-0@@ -343,6 +343,7 @@ 332 common statx __x64_sys_statx 333 common io_pgetevents __x64_sys_io_pgetevents 334 common rseq __x64_sys_rseq +335 common krava __x64_sys_krava # # x32-specific system call numbers start at 512 to avoid cache impact[acme@jouet perf]$
Quoted 5 lines
It doesn't warn about that new cool syscall, without your patch:
Warning: Kernel ABI header at '
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'Can you check this?
hum, did you have the previous patch applied?
without it it displays misleading output
will check
jirka
tip-bot for Jiri Olsa
merge bot[tip:perf/core] perf tools: Use perf_evsel__match instead of open coded equivalent
In reply to Jiri Olsaperf tools: Use perf_evsel__match instead of open coded equivalent
Commit-ID: 2d6cae13f10d5d8b370038dbfdf60317c22b9f52 Gitweb: https://git.kernel.org/tip/2d6cae13f10d5d8b370038dbfdf60317c22b9f52 Author: Jiri Olsa <[email protected]> AuthorDate: Fri, 20 Jul 2018 13:00:33 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 24 Jul 2018 14:54:13 -0300
perf tools: Use perf_evsel__match instead of open coded equivalent
Use perf_evsel__match() helper in perf_evsel__is_bpf_output().
--- tools/perf/util/evsel.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/evsel.h +1 -4
@@ -402,10 +402,7 @@ bool perf_evsel__is_function_event(struct perf_evsel *evsel);static inline bool perf_evsel__is_bpf_output (struct perf_evsel *evsel) { -struct perf_event_attr *attr = &evsel->attr; - -return (attr->config ==PERF_COUNT_SW_BPF_OUTPUT ) && - (attr->type ==PERF_TYPE_SOFTWARE ); +return perf_evsel__match (evsel,SOFTWARE ,SW_BPF_OUTPUT ); }struct perf_attr_details {