From: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
To: James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
scclevenger@os.amperecomputing.com
Cc: acme@redhat.com, coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, darren@os.amperecomputing.com,
james.clark@arm.com, suzuki.poulose@arm.com, Al.Grant@arm.com,
Mike Leach <mike.leach@linaro.org>
Subject: Re: [PATCH] perf scripts python arm-cs-trace-disasm.py: Skip disasm if address continuity is broken
Date: Thu, 8 Aug 2024 16:44:46 +0530 [thread overview]
Message-ID: <3ef38bf2-39df-47c6-aa6a-7e65d3909564@os.amperecomputing.com> (raw)
In-Reply-To: <16ea091e-0f3b-44cf-b3b4-b07efabe9c02@linaro.org>
On 08-08-2024 04:21 pm, James Clark wrote:
>
>
> On 08/08/2024 10:21 am, James Clark wrote:
>>
>>
>> On 08/08/2024 8:42 am, Leo Yan wrote:
>>> On 8/8/2024 5:36 AM, Ganapatrao Kulkarni wrote:
>>>>
>>>> On 08-08-2024 12:50 am, Leo Yan wrote:
>>>>> On 8/7/2024 5:18 PM, Ganapatrao Kulkarni wrote:
>>>>>
>>>>>> Is below diff with force option looks good?
>>>>>>
>>>>>> diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py
>>>>>> b/tools/perf/scripts/python/arm-cs-trace-disasm.py
>>>>>> index d973c2baed1c..efe34f308beb 100755
>>>>>> --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
>>>>>> +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
>>>>>> @@ -36,7 +36,10 @@ option_list = [
>>>>>> help="Set path to objdump executable file"),
>>>>>> make_option("-v", "--verbose", dest="verbose",
>>>>>> action="store_true", default=False,
>>>>>> - help="Enable debugging log")
>>>>>> + help="Enable debugging log"),
>>>>>> + make_option("-f", "--force", dest="force",
>>>>>> + action="store_true", default=False,
>>>>>> + help="Force decoder to continue")
>>>>>> ]
>>>>>>
>>>>>> parser = OptionParser(option_list=option_list)
>>>>>> @@ -257,6 +260,12 @@ def process_event(param_dict):
>>>>>> print("Stop address 0x%x is out of range [ 0x%x
>>>>>> .. 0x%x
>>>>>> ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso))
>>>>>> return
>>>>>>
>>>>>> + if (stop_addr < start_addr):
>>>>>> + if (options.verbose == True or options.force):
>>>>>> + print("Packet Discontinuity detected
>>>>>> [stop_add:0x%x start_addr:0x%x ] for dso %s" % (stop_addr,
>>>>>> start_addr, dso))
>>
>> The options.force for the print should be "options.verbose or not
>> options.force" I think? You want to print the error until the user
>> adds -f, then hide it. Unless verbose is on.
>>
>>>>>> + if (options.force):
>>>>>> + return
>>
>> Oops I had this one the wrong way around in my example. This way is
>> correct.
>>
>>>>>
>>>>> I struggled a bit for the code - it is confused that force mode
>>>>> bails out
>>>>> and the non-force mode continues to run. I prefer to always bail
>>>>> out for
>>>>> the discontinuity case, as it is pointless to continue in this case.
>>>>
>>>> Kept bail out with force option since I though it is not good to hide
>>>> the error in normal use, otherwise we never able to notice this
>>>> error in
>>>> the future and it becomes default hidden. Eventually this error should
>>>> be fixed.
>>>
>>> As James said, the issue should be fixed in OpenCSD or Perf decoding
>>> flow.
>>>
>>> Thus, perf tool should be tolerant errors - report warning and drop
>>> discontinuous samples. This would be easier for developers later if face
>>> the same issue, they don't need to spend time to locate issue and
>>> struggle
>>> for overriding the error.
>>>
>>> If you prefer to use force option, it might be better to give
>>> reasoning and
>>> *suggestion* in one go, something like:
>>>
>>> if (stop_addr < start_addr):
>>> print("Packet Discontinuity detected [stop_add:0x%x
>>> start_addr:0x%x ] for dso %s" % (stop_addr, start_addr, dso))
>>> print("Use option '-f' following the script for force mode"
>>> if (options.force)
>>> return
>>>
>>> Either way is fine for me. Thanks a lot for taking time on the issue.
>>>
>>> Leo
>>
>> But your diff looks good Ganapat, I think send a patch with Leo's
>> extra help message added and the first force flipped.
>
> One other small detail about Leo's suggestion print out. Can you add an
> instruction of how to keep the warnings as well:
>
> print("Use option '-f' following the script for force mode. Add '-v' \
> to continue printing decode warnings.")
>
Thanks James and Leo for your comments.
I will send the V2 with the changes as discussed.
Thanks.
Ganapat
next prev parent reply other threads:[~2024-08-08 11:15 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 9:26 Ganapatrao Kulkarni
2024-07-19 14:39 ` James Clark
2024-07-22 10:02 ` Ganapatrao Kulkarni
2024-07-23 13:10 ` James Clark
2024-07-23 15:26 ` Ganapatrao Kulkarni
2024-07-23 15:46 ` James Clark
2024-07-24 6:38 ` Ganapatrao Kulkarni
2024-07-24 14:45 ` James Clark
2024-08-01 10:00 ` James Clark
2024-08-01 10:28 ` Al Grant
2024-08-01 11:26 ` James Clark
2024-08-01 11:58 ` Al Grant
2024-08-01 14:58 ` James Clark
2024-08-05 12:22 ` Ganapatrao Kulkarni
2024-08-05 13:59 ` James Clark
2024-08-06 7:02 ` Ganapatrao Kulkarni
2024-08-06 9:47 ` James Clark
2024-08-06 9:57 ` James Clark
2024-08-06 15:02 ` Steve Clevenger
2024-08-06 16:14 ` James Clark
2024-08-07 12:17 ` Ganapatrao Kulkarni
2024-08-07 14:53 ` James Clark
2024-08-07 16:18 ` Ganapatrao Kulkarni
2024-08-07 19:20 ` Leo Yan
2024-08-08 4:36 ` Ganapatrao Kulkarni
2024-08-08 7:42 ` Leo Yan
2024-08-08 9:21 ` James Clark
2024-08-08 10:51 ` James Clark
2024-08-08 11:14 ` Ganapatrao Kulkarni [this message]
2024-08-08 15:01 ` Mike Leach
2024-08-07 16:48 ` Leo Yan
2024-08-08 9:32 ` James Clark
2024-08-08 11:05 ` Leo Yan
2024-08-09 14:13 ` Mike Leach
2024-08-09 15:19 ` James Clark
2024-08-19 10:59 ` Mike Leach
2024-08-23 9:03 ` James Clark
2024-08-23 9:57 ` Ganapatrao Kulkarni
2024-08-23 10:36 ` James Clark
2024-08-23 10:37 ` James Clark
2024-08-30 9:58 ` James Clark
2024-09-02 6:12 ` Ganapatrao Kulkarni
2024-08-28 9:33 ` Mike Leach
2024-08-29 13:35 ` James Clark
2024-08-08 7:54 ` Leo Yan
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=3ef38bf2-39df-47c6-aa6a-7e65d3909564@os.amperecomputing.com \
--to=gankulkarni@os.amperecomputing.com \
--cc=Al.Grant@arm.com \
--cc=acme@redhat.com \
--cc=coresight@lists.linaro.org \
--cc=darren@os.amperecomputing.com \
--cc=james.clark@arm.com \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=scclevenger@os.amperecomputing.com \
--cc=suzuki.poulose@arm.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
all inboxes | Powered by JetHome®