From: kajoljain <kjain@linux.ibm.com>
To: John Garry <john.garry@huawei.com>, Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Ian Rogers <irogers@google.com>,
Yao Jin <yao.jin@linux.intel.com>,
yeyunfeng@huawei.com, linux-kernel <linux-kernel@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH 1/2] perf jevents: Tidy error handling
Date: Wed, 21 Oct 2020 19:07:53 +0530 [thread overview]
Message-ID: <7e7c5aeb-5c9b-727a-d605-e871007af34a@linux.ibm.com> (raw)
In-Reply-To: <3fda581b-3f2b-5dce-b388-916117d20e7c@huawei.com>
On 10/20/20 2:05 PM, John Garry wrote:
> On 20/10/2020 09:14, kajoljain wrote:
>>
>>
>> On 10/20/20 11:13 AM, Namhyung Kim wrote:
>>> Hello,
>>>
>>> On Tue, Oct 20, 2020 at 12:42 AM John Garry <john.garry@huawei.com> wrote:
>>>>
>>>> There is much duplication in the error handling for directory traversing
>>>> for processing JSONs.
>>>>
>>>> Factor out the common code to tidy a bit.
>>>>
>>>> Signed-off-by: John Garry <john.garry@huawei.com>
>>>> ---
>>> [SNIP]
>>>> -empty_map:
>>>> +err_processing_std_arch_event_dir:
>>>> + err_string_ext = " for std arch event";
>>>> +err_processing_dir:
>>>> + if (verbose || rc > 0) {
>>>> + pr_info("%s: Error walking file tree %s%s\n", prog, ldirname,
>>>> + err_string_ext);
>>>
>>> This was printed only if verbose is set but now changed.
>>
>
> pr_info() is silenced if verbose is unset, so in effect it is the same - see pr_info() definition in json.h
>
>> Hi John,
>> Yes I agree with Namhyung.
>> So, this is our original checks
>>
>> if (rc && verbose) {
>> pr_info("%s: Error walking file tree %s\n", prog, ldirname);
>> goto empty_map;
>> } else if (rc < 0) {
>> /* Make build fail */
>> fclose(eventsfp);
>> free_arch_std_events();
>> ret = 1;
>> goto out_free_mapfile;
>> } else if (rc) {
>> goto empty_map;
>> }
>>
>> May be we can use similar checks:
>>
>> if( verbose)
>> pr_info("%s: Error walking file tree %s%s\n", prog, ldirname,err_string_ext);
>> if(rc > 0)
>> empty_map = 1;
>> else
>> ret = 1;
>>
>
> Not that it matters much, this logic is slightly different for verbose set and rc < 0. I don't mind going with that, so let me know.
Yes right. Sure if required we can made changes on these checks and include appropriate condition for verbose set and rc < 0. Seems fine to me.
Thanks,
Kajol Jain
>
> Thanks for checking,
> John
>
>> Thanks,
>> Kajol Jain
>>
>>>
>>> Thanks
>>> Namhyung
>>>
>>>
>>>> + empty_map = 1;
>>>> + } else {
>>>> + ret = 1;
>>>> + }
>>>> +err_close_eventsfp:
>>>> fclose(eventsfp);
>>>> - create_empty_mapping(output_file);
>>>> + if (empty_map)
>>>> + create_empty_mapping(output_file);
>>>> +err_out:
>>>> free_arch_std_events();
>>>> -out_free_mapfile:
>>>> free(mapfile);
>>>> return ret;
>>>> }
>>>> --
>>>> 2.26.2
>>>>
>> .
>>
>
next prev parent reply other threads:[~2020-10-21 13:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 15:38 [PATCH 0/2] perf PMU events test: Add scenario for arch std events John Garry
2020-10-19 15:38 ` [PATCH 1/2] perf jevents: Tidy error handling John Garry
2020-10-20 5:43 ` Namhyung Kim
2020-10-20 8:14 ` kajoljain
2020-10-20 8:35 ` John Garry
2020-10-21 13:37 ` kajoljain [this message]
2020-10-22 9:43 ` John Garry
2020-10-19 15:38 ` [PATCH 2/2] perf jevents: Add test for arch std events John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e7c5aeb-5c9b-727a-d605-e871007af34a@linux.ibm.com \
--to=kjain@linux.ibm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=john.garry@huawei.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=yao.jin@linux.intel.com \
--cc=yeyunfeng@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome