Re: [PATCH 1/4] perf vendor events: Syntax corrections in Neoverse N1 json

From: John Garry
Date: Wed Oct 06 2021 - 12:23:39 EST


On 06/10/2021 09:43, James Clark wrote:

+ Andi



On 05/10/2021 11:10, John Garry wrote:
On 04/10/2021 17:00, Andrew Kilroy wrote:
There are some syntactical mistakes in the json files for the Cortex A76
N1 (Neoverse N1).  This was obstructing parsing from an external tool.

If the trailing comma is not allowed by standard, then maybe we should fix our parsing tool to not allow it also. However maybe there is a good reason why we allow it..

It would be nice to do, because I have also made similar fixes before. We looked at the STRICT option
in the parser (https://github.com/zserge/jsmn), but even then it seems to allow trailing commas.

Trailing commas are not allowed in the json standard, but there is a split between parsers
where some allow it and others don't. Specifically the Python parser doesn't allow it, and Python
can easily be involved in some workflow that parses these files.

The only way forwards I can think of is either getting a change accepted upstream to the parser
and then updating it in perf, switching to a different parser, or doing some hack to add an extra
step in perf to look for commas. None of which sound ideal.


Looking at the license in jsmn.c, we seem to be ok to modify it (to error on non-standard trailing ',') - that parser has already apparently been modified in mainline.

If we do that then I hope that there are not to many violations in out JSONs, including downstream.

Thanks,
John