Re: [PATCH 5/5] perf record: Put a copy of kcore into the perf.data directory

From: Adrian Hunter
Date: Mon Oct 07 2019 - 08:08:25 EST


On 7/10/19 2:20 PM, Jiri Olsa wrote:
> On Fri, Oct 04, 2019 at 11:31:21AM +0300, Adrian Hunter wrote:
>
> SNIP
>
>> +}
>> +
>> static int record__mmap_evlist(struct record *rec,
>> struct evlist *evlist)
>> {
>> @@ -1383,6 +1417,12 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>> session->header.env.comp_type = PERF_COMP_ZSTD;
>> session->header.env.comp_level = rec->opts.comp_level;
>>
>> + if (rec->opts.kcore &&
>> + !record__kcore_readable(&session->machines.host)) {
>> + pr_err("ERROR: kcore is not readable.\n");
>> + return -1;
>> + }
>> +
>
> is there any reason why this change is not merged with the change below?

It seemed better to do the validation before opening all the events.

>
>
>> record__init_features(rec);
>>
>> if (rec->opts.use_clockid && rec->opts.clockid_res_ns)
>> @@ -1414,6 +1454,14 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>> }
>> session->header.env.comp_mmap_len = session->evlist->core.mmap_len;
>>
>> + if (rec->opts.kcore) {
>> + err = record__kcore_copy(&session->machines.host, data);
>> + if (err) {
>> + pr_err("ERROR: Failed to copy kcore\n");
>> + goto out_child;
>> + }
>> + }
>> +
>
> thanks,
> jirka
>