aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-02-14 11:05:30 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-02-14 11:05:30 -0500
commit0c9781280fb672ca09c997df3f14ba506bbdb977 (patch)
treec69f428b2717025d5afb2a8997d82ff9a4b8aea1 /tools/perf/builtin-record.c
parent7e1ccd3804281fc0755eb726b654469c40a96d89 (diff)
perf tools: Handle kernels that don't support attr.exclude_{guest,host}
Just fall back to resetting those fields, if set, warning the user that that feature is not available. If guest samples appear they will just be discarded because no struct machine will be found and thus the event will be accounted as not handled and dropped, see 0c09571. Reported-by: Namhyung Kim <namhyung@gmail.com> Tested-by: Joerg Roedel <joerg.roedel@amd.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Joerg Roedel <joerg.roedel@amd.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-vuwxig36mzprl5n7nzvnxxsh@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 08ed24b66ffe..d6c10e8ff6b6 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -205,6 +205,9 @@ static void perf_record__open(struct perf_record *rec)
205 205
206 if (opts->group && pos != first) 206 if (opts->group && pos != first)
207 group_fd = first->fd; 207 group_fd = first->fd;
208fallback_missing_features:
209 if (opts->exclude_guest_missing)
210 attr->exclude_guest = attr->exclude_host = 0;
208retry_sample_id: 211retry_sample_id:
209 attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; 212 attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0;
210try_again: 213try_again:
@@ -218,15 +221,23 @@ try_again:
218 } else if (err == ENODEV && opts->cpu_list) { 221 } else if (err == ENODEV && opts->cpu_list) {
219 die("No such device - did you specify" 222 die("No such device - did you specify"
220 " an out-of-range profile CPU?\n"); 223 " an out-of-range profile CPU?\n");
221 } else if (err == EINVAL && opts->sample_id_all_avail) { 224 } else if (err == EINVAL) {
222 /* 225 if (!opts->exclude_guest_missing &&
223 * Old kernel, no attr->sample_id_type_all field 226 (attr->exclude_guest || attr->exclude_host)) {
224 */ 227 pr_debug("Old kernel, cannot exclude "
225 opts->sample_id_all_avail = false; 228 "guest or host samples.\n");
226 if (!opts->sample_time && !opts->raw_samples && !time_needed) 229 opts->exclude_guest_missing = true;
227 attr->sample_type &= ~PERF_SAMPLE_TIME; 230 goto fallback_missing_features;
228 231 } else if (opts->sample_id_all_avail) {
229 goto retry_sample_id; 232 /*
233 * Old kernel, no attr->sample_id_type_all field
234 */
235 opts->sample_id_all_avail = false;
236 if (!opts->sample_time && !opts->raw_samples && !time_needed)
237 attr->sample_type &= ~PERF_SAMPLE_TIME;
238
239 goto retry_sample_id;
240 }
230 } 241 }
231 242
232 /* 243 /*