perf/x86/intel/pt: Fix sampling using single range output
Subsystems (3)
Adrian Hunter
reviewerPATCH 1/1 perf/x86/intel/pt: Fix sampling using single range output
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/events/intel/pt.c +9 -0
@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages) goto out; +/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out; + buf->single = true; buf->nr_pages = nr_pages; ret =0 ;
Signature · 1 line
2.34.1
Peter Zijlstra
maintainerQuoted 17 lines · Adrian Hunter
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
Fixes 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode")Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/events/intel/pt.c +0
-0@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages)
arch/x86/events/intel/pt.c static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages) · line 1273
Quoted 10 lines
arch/x86/events/intel/pt.c +8
-0goto out; +/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out;
This effectively declares single-output-mode dead? Because I don't think anybody uses PT with a single 4K buffer.
Adrian Hunter
reviewerQuoted 20 lines · Peter Zijlstra
Quoted 19 lines · Adrian Hunter
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
Fixes 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode")Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/events/intel/pt.c +0
-0@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages) goto out;
Quoted 11 lines
arch/x86/events/intel/pt.c static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages) · line 1273
Quoted 8 lines
arch/x86/events/intel/pt.c +8
-0+/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out;This effectively declares single-output-mode dead? Because I don't think anybody uses PT with a single 4K buffer.
4K is the default size for "sample mode" i.e. stuffing 4KB of Intel PT trace data into a PERF_RECORD_SAMPLE record that has sample_type bit PERF_SAMPLE_AUX
e.g.
$ perf record -vv --aux-sample -e '{intel_pt//u,cycles:u}' uname 2>err.txt
Linux
$ grep aux_sample_size err.txt
aux_sample_size 4096
$ Peter Zijlstra
maintainerQuoted 36 lines · Adrian Hunter
Quoted 20 lines · Peter Zijlstra
Quoted 19 lines · Adrian Hunter
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
Fixes 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode")Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/events/intel/pt.c +0
-0@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages) goto out;Quoted 11 lines
arch/x86/events/intel/pt.c static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages) · line 1273
Quoted 8 lines
arch/x86/events/intel/pt.c +8
-0+/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out;This effectively declares single-output-mode dead? Because I don't think anybody uses PT with a single 4K buffer.
4K is the default size for "sample mode" i.e. stuffing 4KB of Intel PT trace data into a
PERF_RECORD_SAMPLErecord that hassample_typebitPERF_SAMPLE_AUX
Quoted 6 lines
e.g.
$ perf record -vv --aux-sample -e '{intel_pt//u,cycles:u}' uname 2>err.txt Linux $ grep aux_sample_size err.txt aux_sample_size 4096
Ah, ok. Not as bad then. Anyway, I'll go queue it for perf/urgent I suppose.
Quoted 39 lines · Peter Zijlstra
Quoted 38 lines · Adrian Hunter
Quoted 20 lines · Peter Zijlstra
Quoted 19 lines · Adrian Hunter
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
Fixes 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode")Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/events/intel/pt.c +0
-0@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages) goto out;Quoted 11 lines
arch/x86/events/intel/pt.c static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages) · line 1273
Quoted 8 lines
arch/x86/events/intel/pt.c +8
-0+/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out;This effectively declares single-output-mode dead? Because I don't think anybody uses PT with a single 4K buffer.
4K is the default size for "sample mode" i.e. stuffing 4KB of Intel PT trace data into a
PERF_RECORD_SAMPLErecord that hassample_typebitPERF_SAMPLE_AUXe.g.
Quoted 7 lines
Quoted 4 lines
$ perf record -vv --aux-sample -e '{intel_pt//u,cycles:u}' uname 2>err.txt Linux $ grep aux_sample_size err.txt aux_sample_size 4096Ah, ok. Not as bad then. Anyway, I'll go queue it for perf/urgent I suppose.
It would be better to only limit on the CPUs with the bug because switching buffers causes some extra latencies. So this patch may regress PT overhead or tail latencies.
-Andi
Adrian Hunter
reviewerQuoted 46 lines · Andi Kleen
Quoted 44 lines · Peter Zijlstra
Quoted 42 lines · Adrian Hunter
Quoted 20 lines · Peter Zijlstra
Quoted 19 lines · Adrian Hunter
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
Fixes 670638477aed ("perf/x86/intel/pt: Opportunistically use single range output mode")Signed-off-by Adrian Hunter <[email protected]>--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)arch/x86/events/intel/pt.c +0
-0@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages) goto out;Quoted 11 lines
arch/x86/events/intel/pt.c static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages) · line 1273
Quoted 8 lines
arch/x86/events/intel/pt.c +8
-0+/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out;This effectively declares single-output-mode dead? Because I don't think anybody uses PT with a single 4K buffer.
4K is the default size for "sample mode" i.e. stuffing 4KB of Intel PT trace data into a
PERF_RECORD_SAMPLErecord that hassample_typebitPERF_SAMPLE_AUXe.g.
$ perf record -vv --aux-sample -e '{intel_pt//u,cycles:u}' uname 2>err.txt Linux $ grep aux_sample_size err.txt aux_sample_size 4096
Quoted 6 lines
Quoted 2 lines
Ah, ok. Not as bad then. Anyway, I'll go queue it for perf/urgent I suppose.
It would be better to only limit on the CPUs with the bug because switching buffers causes some extra latencies. So this patch may regress PT overhead or tail latencies.
I could whitelist CPUs that do not have the issue, because a blacklist would keep expanding, which would be a bit of a pain to maintain.
The following commit has been merged into the perf/urgent branch of tip:
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: ce0d998be9274dd3a3d971cbeaa6fe28fd2c3062 Gitweb: https://git.kernel.org/tip/ce0d998be9274dd3a3d971cbeaa6fe28fd2c3062 Author: Adrian Hunter <[email protected]> AuthorDate: Sat, 12 Nov 2022 17:15:08 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 16 Nov 2022 10:12:59 +01:00
perf/x86/intel/pt: Fix sampling using single range output
Deal with errata TGL052, ADL037 and RPL017 "Trace May Contain Incorrect Data When Configured With Single Range Output Larger Than 4KB" by disabling single range output whenever larger than 4KB.
--- arch/x86/events/intel/pt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/events/intel/pt.c +9 -0
@@ -1263,6 +1263,15 @@ static int pt_buffer_try_single(struct pt_buffer *buf, int nr_pages)if (1 << order != nr_pages) goto out; +/* +* Some processors cannot always support single range for more than +* 4KB - refer errata TGL052, ADL037 and RPL017. Future processors might +* also be affected, so for now rather than trying to keep track of +* which ones, just disable it for all. +*/ +if (nr_pages >1 ) + goto out; + buf->single = true; buf->nr_pages = nr_pages; ret =0 ;