From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@redhat.com>,
jolsa@kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] perf, tools: Make build fail on JSON parse error
Date: Mon, 24 Jul 2017 12:07:55 -0700 [thread overview]
Message-ID: <20170724190755.GD15787@us.ibm.com> (raw)
In-Reply-To: <20170724174454.GR3044@two.firstfloor.org>
Andi Kleen [andi@firstfloor.org] wrote:
> On Mon, Jul 24, 2017 at 02:42:09PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jul 24, 2017 at 04:16:49PM +0200, Jiri Olsa escreveu:
> > > On Fri, Jul 21, 2017 at 05:31:59PM -0700, Sukadev Bhattiprolu wrote:
> > > > Andi Kleen [andi@firstfloor.org] wrote:
> > > > > From: Andi Kleen <ak@linux.intel.com>
> > > > >
> > > > > Today, when a JSON file fails parsing the build continues,
> > > > > but there are no json files built in, which is difficult to debug later.
> > > > > Make the build stop on a parse error instead.
> > > >
> > > > I see the problem and we were being defensive to not break the build
> > > > on architectures that don't yet have the PMU event lists. It will be
> > > > good to check build on an architecture other than x86/powerpc.
> > > >
> > > > Also, following comments may no longer be applicable?
> > >
> > > Isn't the Andi's change only to fail in case there's
> > > a real error in process_one_file? I think you can still
> > > have empty events dir.
> >
> > That explains why all the cross builds failed when I added that cset?
>
> Hmm, let me test. It was supposed to only fail when there
> is a file, but it cannot be parsed.
Wonder if adding this check for event lists helps.
---
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index baa073f..4de5c87 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -840,6 +840,7 @@ int main(int argc, char *argv[])
const char *arch;
const char *output_file;
const char *start_dirname;
+ struct stat stbuf;
prog = basename(argv[0]);
if (argc < 4) {
@@ -861,11 +862,17 @@ int main(int argc, char *argv[])
return 2;
}
+ sprintf(ldirname, "%s/%s", start_dirname, arch);
+
+ /* If architecture does not have any event lists, bail out */
+ if (stat(ldirname, &stbuf) < 0) {
+ pr_info("%s: Arch %s has no PMU event lists\n", prog, arch);
+ goto empty_map;
+ }
+
/* Include pmu-events.h first */
fprintf(eventsfp, "#include \"../../pmu-events/pmu-events.h\"\n");
- sprintf(ldirname, "%s/%s", start_dirname, arch);
-
/*
* The mapfile allows multiple CPUids to point to the same JSON file,
* so, not sure if there is a need for symlinks within the pmu-events
@@ -882,6 +889,9 @@ int main(int argc, char *argv[])
if (rc && verbose) {
pr_info("%s: Error walking file tree %s\n", prog, ldirname);
goto empty_map;
+ } else if (rc < 0) {
+ /* Make build fail */
+ return 1;
} else if (rc) {
goto empty_map;
}
@@ -896,7 +906,8 @@ int main(int argc, char *argv[])
if (process_mapfile(eventsfp, mapfile)) {
pr_info("%s: Error processing mapfile %s\n", prog, mapfile);
- goto empty_map;
+ /* Make build fail */
+ return 1;
}
return 0;
next prev parent reply other threads:[~2017-07-24 19:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 19:25 [PATCH] perf, tools: Make build fail on JSON parse error Andi Kleen
2017-07-22 0:31 ` Sukadev Bhattiprolu
2017-07-24 14:16 ` Jiri Olsa
2017-07-24 17:42 ` Arnaldo Carvalho de Melo
2017-07-24 17:44 ` Andi Kleen
2017-07-24 19:07 ` Sukadev Bhattiprolu [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-07-25 0:16 Andi Kleen
2017-07-25 7:26 ` Jiri Olsa
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=20170724190755.GD15787@us.ibm.com \
--to=sukadev@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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