Re: [PATCH 0/5] trace: Remove and forbid newline characters in event format

2024-06-07 Thread Mads Ynddal
| 4 ++-- > hw/usb/trace-events | 6 +++--- > hw/vfio/trace-events | 4 ++-- > scripts/tracetool/__init__.py | 2 ++ > 6 files changed, 14 insertions(+), 10 deletions(-) > > -- > 2.41.0 > Acked-by: Mads Ynddal

Re: [RFC 0/6] scripts: Rewrite simpletrace printer in Rust

2024-05-29 Thread Mads Ynddal
e TCG analysis? I'm not saying it can't be true, but it'd be nice to see it demonstrated before making decisions. Because, as you point out, there's a lot of downsides to having two versions. So the benefits have to clearly outweigh the additional work. I have a lot of other questions, but let's maybe start with the core idea first. — Mads Ynddal

Re: [RFC 0/6] scripts: Rewrite simpletrace printer in Rust

2024-05-27 Thread Mads Ynddal
e Python version. We're not doing anything obviously exploitable. — Mads Ynddal

Re: [PATCH] scripts/simpletrace: Mark output with unstable timestamp as WARN

2024-05-13 Thread Mads Ynddal
> Why are the timestamps non-monotonic? > > In a situation like that maybe not only the negative timestamps are > useless but even some positive timestamps are incorrect. I think it's > worth understanding the nature of the instability before merging a > fix. I agree with Stefan on this. We'll

Re: [PATCH v4 12/14] simpletrace: added simplified Analyzer2 class

2023-09-26 Thread Mads Ynddal
>> +class Formatter2(Analyzer2): > > Was this class part of the benchmark? It appears to be unused. > >> +def __init__(self): >> +self.last_timestamp_ns = None >> + >> +def catchall(self, *rec_args, event, timestamp_ns, pid, event_id): >> +if

[PATCH v5 05/14] simpletrace: update code for Python 3.11

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal The call to `getargspec` was deprecated and in Python 3.11 it has been removed in favor of `getfullargspec`. `getfullargspec` is compatible with QEMU's requirement of at least Python version 3.6. Reviewed-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Signed-off

[PATCH v5 06/14] simpletrace: improved error handling on struct unpack

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal A failed call to `read_header` wouldn't be handled the same for the two different code paths (one path would try to use `None` as a list). Changed to raise exception to be handled centrally. This also allows for easier unpacking, as errors has been filtered out. Reviewed

[PATCH v5 12/14] simpletrace: added simplified Analyzer2 class

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal By moving the dynamic argument construction to keyword-arguments, we can remove all of the specialized handling, and streamline it. If a tracing method wants to access these, they can define the kwargs, or ignore it be placing `**kwargs` at the end of the function's arguments

[PATCH v5 10/14] simpletrace: move logic of process into internal function

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal To avoid duplicate code depending on input types and to better handle open/close of log with a context-manager, we move the logic of process into _process. Reviewed-by: Stefan Hajnoczi Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 26 ++ 1

[PATCH v5 08/14] simpletrace: made Analyzer into context-manager

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal Instead of explicitly calling `begin` and `end`, we can change the class to use the context-manager paradigm. This is mostly a styling choice, used in modern Python code. But it also allows for more advanced analyzers to handle exceptions gracefully in the `__exit__` method

[PATCH v5 01/14] simpletrace: add __all__ to define public interface

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal It was unclear what was the supported public interface. I.e. when refactoring the code, what functions/classes are important to retain. Reviewed-by: Stefan Hajnoczi Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH v5 09/14] simpletrace: refactor to separate responsibilities

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal Moved event_mapping and event_id_to_name down one level in the function call-stack to keep variable instantiation and usage closer (`process` and `run` has no use of the variables; `read_trace_records` does). Instead of passing event_mapping and event_id_to_name to the bottom

[PATCH v5 03/14] simpletrace: improve parsing of sys.argv; fix files never closed.

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal The arguments extracted from `sys.argv` named and unpacked to make it clear what the arguments are and what they're used for. The two input files were opened, but never explicitly closed. File usage changed to use `with` statement to take care of this. At the same time

[PATCH v5 11/14] simpletrace: move event processing to Analyzer class

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal Moved event processing to the Analyzer class to separate specific analyzer logic (like caching and function signatures) from the _process function. This allows for new types of Analyzer-based subclasses without changing the core code. Note, that the fn_cache is important

[PATCH v5 13/14] MAINTAINERS: add maintainer of simpletrace.py

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal In my work to refactor simpletrace.py, I noticed that there's no maintainer of it, and has the status of "odd fixes". I'm using it from time to time, so I'd like to maintain the script. I've added myself as reviewer under "Tracing" to be informed of chang

[PATCH v5 14/14] scripts/analyse-locks-simpletrace.py: changed iteritems() to items()

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal Python 3 removed `dict.iteritems()` in favor of `dict.items()`. This means the script currently doesn't work on Python 3. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Signed-off-by: Mads Ynddal --- scripts/analyse-locks-simpletrace.py | 2 +- 1 file

[PATCH v5 00/14] simpletrace: refactor and general improvements

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal I wanted to use simpletrace.py for an internal project, so I tried to update and polish the code. Some of the commits resolve specific issues, while some are more subjective. I've tried to divide it into commits so we can discuss the individual changes, and I'm ready to pull

[PATCH v5 02/14] simpletrace: annotate magic constants from QEMU code

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal It wasn't clear where the constants and structs came from, so I added comments to help. Reviewed-by: Stefan Hajnoczi Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/simpletrace.py b/scripts

[PATCH v5 07/14] simpletrace: define exception and add handling

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal Define `SimpleException` to differentiate our exceptions from generic exceptions (IOError, etc.). Adapted simpletrace to support this and output to stderr. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Signed-off-by: Mads Ynddal --- scripts

[PATCH v5 04/14] simpletrace: changed naming of edict and idtoname to improve readability

2023-09-26 Thread Mads Ynddal
From: Mads Ynddal Readability is subjective, but I've expanded the naming of the variables and arguments, to help with understanding for new eyes on the code. Signed-off-by: Mads Ynddal Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- scripts/simpletrace.py | 34

Re: [PATCH v4 13/14] MAINTAINERS: add maintainer of simpletrace.py

2023-09-26 Thread Mads Ynddal
tainer yourself > (requires publishing a GPG key and signing pull request tags). > > Please let me know which option you prefer. For future patches, I would like to send pull requests myself with a GPG key to get the practice. I can have Klaus Jensen sign my key to get started. — Mads Ynddal

Re: [PATCH v4 12/14] simpletrace: added simplified Analyzer2 class

2023-09-06 Thread Mads Ynddal
> AFAIK, we don't consider simpletrace.py python code to be a > supported public API, just a command line tool. > > IOW, we can change the python code at will, as long as the > command line doesn't alter its behaviour. Thus I don't see > a need to add new classes, just change the existing ones.

Re: [PATCH v4 12/14] simpletrace: added simplified Analyzer2 class

2023-09-05 Thread Mads Ynddal
> On 23 Aug 2023, at 10.54, Mads Ynddal wrote: > > From: Mads Ynddal > > By moving the dynamic argument construction to keyword-arguments, > we can remove all of the specialized handling, and streamline it. > If a tracing method wants to access these, they can define th

Re: [PATCH v4 00/14] simpletrace: refactor and general improvements

2023-09-05 Thread Mads Ynddal
> On 23 Aug 2023, at 10.54, Mads Ynddal wrote: > > From: Mads Ynddal > > I wanted to use simpletrace.py for an internal project, so I tried to update > and polish the code. Some of the commits resolve specific issues, while some > are more subjective. >

[PATCH v4 12/14] simpletrace: added simplified Analyzer2 class

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal By moving the dynamic argument construction to keyword-arguments, we can remove all of the specialized handling, and streamline it. If a tracing method wants to access these, they can define the kwargs, or ignore it be placing `**kwargs` at the end of the function's arguments

[PATCH v4 06/14] simpletrace: improved error handling on struct unpack

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal A failed call to `read_header` wouldn't be handled the same for the two different code paths (one path would try to use `None` as a list). Changed to raise exception to be handled centrally. This also allows for easier unpacking, as errors has been filtered out. Signed-off

[PATCH v4 01/14] simpletrace: add __all__ to define public interface

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal It was unclear what was the supported public interface. I.e. when refactoring the code, what functions/classes are important to retain. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/simpletrace.py b

[PATCH v4 14/14] scripts/analyse-locks-simpletrace.py: changed iteritems() to items()

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal Python 3 removed `dict.iteritems()` in favor of `dict.items()`. This means the script curerntly doesn't work on Python 3. Signed-off-by: Mads Ynddal --- scripts/analyse-locks-simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analyse

[PATCH v4 02/14] simpletrace: annotate magic constants from QEMU code

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal It wasn't clear where the constants and structs came from, so I added comments to help. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index b221d9a241..5c230a1b74

[PATCH v4 13/14] MAINTAINERS: add maintainer of simpletrace.py

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal In my work to refactor simpletrace.py, I noticed that there's no maintainer of it, and has the status of "odd fixes". I'm using it from time to time, so I'd like to maintain the script. I've added myself as reviewer under "Tracing" to be informed of chang

[PATCH v4 10/14] simpletrace: move logic of process into internal function

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal To avoid duplicate code depending on input types and to better handle open/close of log with a context-manager, we move the logic of process into _process. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 26 ++ 1 file changed, 18 insertions

[PATCH v4 11/14] simpletrace: move event processing to Analyzer class

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal Moved event processing to the Analyzer class to separate specific analyzer logic (like caching and function signatures) from the _process function. This allows for new types of Analyzer-based subclasses without changing the core code. Note, that the fn_cache is important

[PATCH v4 04/14] simpletrace: changed naming of edict and idtoname to improve readability

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal Readability is subjective, but I've expanded the naming of the variables and arguments, to help with understanding for new eyes on the code. Signed-off-by: Mads Ynddal Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- scripts/simpletrace.py | 34

[PATCH v4 00/14] simpletrace: refactor and general improvements

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal I wanted to use simpletrace.py for an internal project, so I tried to update and polish the code. Some of the commits resolve specific issues, while some are more subjective. I've tried to divide it into commits so we can discuss the individual changes, and I'm ready to pull

[PATCH v4 07/14] simpletrace: define exception and add handling

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal Define `SimpleException` to differentiate our exceptions from generic exceptions (IOError, etc.). Adapted simpletrace to support this and output to stderr. Signed-off-by: Mads Ynddal Reviewed-by: Philippe Mathieu-Daudé --- scripts/simpletrace.py | 22

[PATCH v4 03/14] simpletrace: improve parsing of sys.argv; fix files never closed.

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal The arguments extracted from `sys.argv` named and unpacked to make it clear what the arguments are and what they're used for. The two input files were opened, but never explicitly closed. File usage changed to use `with` statement to take care of this. At the same time

[PATCH v4 08/14] simpletrace: made Analyzer into context-manager

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal Instead of explicitly calling `begin` and `end`, we can change the class to use the context-manager paradigm. This is mostly a styling choice, used in modern Python code. But it also allows for more advanced analyzers to handle exceptions gracefully in the `__exit__` method

[PATCH v4 05/14] simpletrace: update code for Python 3.11

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal The call to `getargspec` was deprecated and in Python 3.11 it has been removed in favor of `getfullargspec`. `getfullargspec` is compatible with QEMU's requirement of at least Python version 3.6. Signed-off-by: Mads Ynddal Reviewed-by: Stefan Hajnoczi --- scripts

[PATCH v4 09/14] simpletrace: refactor to separate responsibilities

2023-08-23 Thread Mads Ynddal
From: Mads Ynddal Moved event_mapping and event_id_to_name down one level in the function call-stack to keep variable instantiation and usage closer (`process` and `run` has no use of the variables; `read_trace_records` does). Instead of passing event_mapping and event_id_to_name to the bottom

Re: [PATCH 00/12] Introduce new vmapple machine type

2023-06-20 Thread Mads Ynddal
> On 15 Jun 2023, at 00.40, Alexander Graf wrote: > > This patch set introduces a new ARM and HVF specific machine type > called "vmapple". It mimicks the device model that Apple's proprietary > Virtualization.Framework exposes, but implements it in QEMU. > > With this new machine type, you

Re: [PATCH] target/arm: Restructure has_vfp_d32 test

2023-06-19 Thread Mads Ynddal
for Apple M1 cpus. > > We already have a check for ARMv8-A never setting vfp-d32 true, > so restructure the code so that AArch64 avoids the test entirely. > > Reported-by: Mads Ynddal > Signed-off-by: Richard Henderson > --- > target/arm/cpu.c | 28 +++---

Re: [PATCH v2 12/12] target/arm: Allow users to set the number of VFP registers

2023-06-19 Thread Mads Ynddal
cs fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asimdfhm dit uscat ilrcpc flagm sb paca pacg dcpodp flagm2 frint CPU implementer : 0x00 CPU architecture: 8 CPU variant : 0x0 CPU part : 0x000 CPU revision : 0 — Mads Ynddal

Re: [PATCH v2 12/12] target/arm: Allow users to set the number of VFP registers

2023-06-19 Thread Mads Ynddal
ial "mon:stdio" qemu-system-aarch64: ARM CPUs must have both VFP-D32 and Neon or neither If you fix/work on this issue in a separate thread/patch, you can add reported-by, so I'll automatically follow and help test it: Reported-by: Mads Ynddal — Mads Ynddal > On 7 Jun 2023, at

Re: [PATCH v3 12/14] simpletrace: added simplified Analyzer2 class

2023-06-09 Thread Mads Ynddal
> On 8 Jun 2023, at 14.41, Mads Ynddal wrote: > > From: Mads Ynddal > > By moving the dynamic argument construction to keyword-arguments, > we can remove all of the specialized handling, and streamline it. > If a tracing method wants to access these, they can define th

[PATCH v3 12/14] simpletrace: added simplified Analyzer2 class

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal By moving the dynamic argument construction to keyword-arguments, we can remove all of the specialized handling, and streamline it. If a tracing method wants to access these, they can define the kwargs, or ignore it be placing `**kwargs` at the end of the function's arguments

[PATCH v3 07/14] simpletrace: define exception and add handling

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal Define `SimpleException` to differentiate our exceptions from generic exceptions (IOError, etc.). Adapted simpletrace to support this and output to stderr. Signed-off-by: Mads Ynddal Reviewed-by: Philippe Mathieu-Daudé --- scripts/simpletrace.py | 22

[PATCH v3 11/14] simpletrace: move event processing to Analyzer class

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal Moved event processing to the Analyzer class to separate specific analyzer logic (like caching and function signatures) from the _process function. This allows for new types of Analyzer-based subclasses without changing the core code. Note, that the fn_cache is important

[PATCH v3 05/14] simpletrace: update code for Python 3.11

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal The call to `getargspec` was deprecated and in Python 3.11 it has been removed in favor of `getfullargspec`. `getfullargspec` is compatible with QEMU's requirement of at least Python version 3.6. Signed-off-by: Mads Ynddal Reviewed-by: Stefan Hajnoczi --- scripts

[PATCH v3 08/14] simpletrace: made Analyzer into context-manager

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal Instead of explicitly calling `begin` and `end`, we can change the class to use the context-manager paradigm. This is mostly a styling choice, used in modern Python code. But it also allows for more advanced analyzers to handle exceptions gracefully in the `__exit__` method

[PATCH v3 14/14] scripts/analyse-locks-simpletrace.py: changed iteritems() to items()

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal Python 3 removed `dict.iteritems()` in favor of `dict.items()`. This means the script curerntly doesn't work on Python 3. Signed-off-by: Mads Ynddal --- scripts/analyse-locks-simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analyse

[PATCH v3 06/14] simpletrace: improved error handling on struct unpack

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal A failed call to `read_header` wouldn't be handled the same for the two different code paths (one path would try to use `None` as a list). Changed to raise exception to be handled centrally. This also allows for easier unpacking, as errors has been filtered out. Signed-off

[PATCH v3 10/14] simpletrace: move logic of process into internal function

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal To avoid duplicate code depending on input types and to better handle open/close of log with a context-manager, we move the logic of process into _process. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 26 ++ 1 file changed, 18 insertions

[PATCH v3 04/14] simpletrace: changed naming of edict and idtoname to improve readability

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal Readability is subjective, but I've expanded the naming of the variables and arguments, to help with understanding for new eyes on the code. Signed-off-by: Mads Ynddal Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi --- scripts/simpletrace.py | 34

[PATCH v3 01/14] simpletrace: add __all__ to define public interface

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal It was unclear what was the supported public interface. I.e. when refactoring the code, what functions/classes are important to retain. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/simpletrace.py b

[PATCH v3 02/14] simpletrace: annotate magic constants from QEMU code

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal It wasn't clear where the constants and structs came from, so I added comments to help. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index b221d9a241..5c230a1b74

[PATCH v3 09/14] simpletrace: refactor to separate responsibilities

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal Moved event_mapping and event_id_to_name down one level in the function call-stack to keep variable instantiation and usage closer (`process` and `run` has no use of the variables; `read_trace_records` does). Instead of passing event_mapping and event_id_to_name to the bottom

[PATCH v3 13/14] MAINTAINERS: add maintainer of simpletrace.py

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal In my work to refactor simpletrace.py, I noticed that there's no maintainer of it, and has the status of "odd fixes". I'm using it from time to time, so I'd like to maintain the script. I've added myself as reviewer under "Tracing" to be informed of chang

[PATCH v3 00/14] simpletrace: refactor and general improvements

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal I wanted to use simpletrace.py for an internal project, so I tried to update and polish the code. Some of the commits resolve specific issues, while some are more subjective. I've tried to divide it into commits so we can discuss the individual changes, and I'm ready to pull

[PATCH v3 03/14] simpletrace: improve parsing of sys.argv; fix files never closed.

2023-06-08 Thread Mads Ynddal
From: Mads Ynddal The arguments extracted from `sys.argv` named and unpacked to make it clear what the arguments are and what they're used for. The two input files were opened, but never explicitly closed. File usage changed to use `with` statement to take care of this. At the same time

Re: [PATCH v2 06/12] simpletrace: Simplify construction of tracing methods

2023-05-15 Thread Mads Ynddal
> > This is nice but breaking existing analysis scripts should be avoided. > > I suggest preserving the Analyzer class the way it is and adding a new > Analyzer2 class that follows the new method signature for trace event > methods. You're right. This has too large effects on the API. I

Re: [PATCH v2 05/12] simpletrace: Changed Analyzer class to become context-manager

2023-05-15 Thread Mads Ynddal
> > Bearing in mind compatibility with existing simpletrace analysis > scripts, how about the following default method implementations? > > def __enter__(self): > self.begin() > > def __exit__(self, exc_type, exc_val, exc_tb): > if exc_type is None: > self.end() >

Re: [PATCH v2 02/12] simpletrace: Annotate magic constants from QEMU code

2023-05-15 Thread Mads Ynddal
> > From my reply to v1 of this patch series: > > This is fragile since this information will be outdated if the C source > code changes (e.g. renaming files or variables). > > Instead I would add the following comment: > > # This is the binary format that the QEMU "simple" trace backend > #

Re: [PATCH v2 04/12] simpletrace: update code for Python 3.11

2023-05-15 Thread Mads Ynddal
> On 9 May 2023, at 16.38, Stefan Hajnoczi wrote: > > On Tue, May 02, 2023 at 11:23:31AM +0200, Mads Ynddal wrote: >> From: Mads Ynddal >> >> The call to `getargspec` was deprecated and in Python 3.11 it has been >> removed in favor of `getfullargspec`. &g

Re: [PATCH v2 00/12] simpletrace: refactor and general improvements

2023-05-08 Thread Mads Ynddal
> > I was curious how Mads is using simpletrace for an internal (to > Samsung?) project. > I was just tracing the NVMe emulation to get some metrics. The code is all upstream or a part of this patchset. The rest is tracing configs.

Re: [PATCH v2 01/12] simpletrace: Improve parsing of sys.argv; fix files never closed.

2023-05-08 Thread Mads Ynddal
> simpletrace.py is both a command-line tool and a Python module. The > Python module has a public API that people's scripts may rely on. Let's > avoid breaking API changes unless necessary so that existing scripts > that import simpletrace continue to work. > > It's not very clear what is a

Re: [PATCH v2 00/12] simpletrace: refactor and general improvements

2023-05-08 Thread Mads Ynddal
> A question for you: do you think it's possible to move simpletrace into > qemu/python/utils? This requires cleaning up the code to some fairly pedantic > standards, but helps protect it against rot as we change target python > versions. > > No problem if that's too much to ask. just want

[PATCH v2 10/12] MAINTAINERS: add maintainer of simpletrace.py

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal In my work to refactor simpletrace.py, I noticed that there's no maintainer of it, and has the status of "odd fixes". I'm using it from time to time, so I'd like to maintain the script. I've added myself as reviewer under "Tracing" to be informed of chang

[PATCH v2 12/12] scripts/analyse-locks-simpletrace.py: reflect changes to process in simpletrace.py

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal The signature of `process` in simpletrace.py has changed to not take filepaths as the two first arguments, but rather a file-like object. We change the code here to reflect that. Signed-off-by: Mads Ynddal --- scripts/analyse-locks-simpletrace.py | 3 ++- 1 file changed, 2

[PATCH v2 11/12] scripts/analyse-locks-simpletrace.py: changed iteritems() to items()

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal Python 3 removed `dict.iteritems()` in favor of `dict.items()`. This means the script curerntly doesn't work on Python 3. Signed-off-by: Mads Ynddal --- scripts/analyse-locks-simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analyse

[PATCH v2 02/12] simpletrace: Annotate magic constants from QEMU code

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal It wasn't clear where the constants and structs came from, so I added comments to help. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py

[PATCH v2 08/12] simpletrace: define exception and add handling

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal Define `SimpleException` to differentiate our exceptions from generic exceptions (IOError, etc.). Adapted simpletrace to support this and output to stderr. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 22

[PATCH v2 03/12] simpletrace: changed naming of edict and idtoname to improve readability

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal Readability is subjective, but I've expanded the naming of the variables and arguments, to help with understanding for new eyes on the code. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 34 +- 1

[PATCH v2 06/12] simpletrace: Simplify construction of tracing methods

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal By moving the dynamic argument construction to keyword-arguments, we can remove all of the specialized handling, and streamline it. If a tracing method wants to access these, they can define the kwargs, or ignore it be placing `**kwargs` at the end of the function's arguments

[PATCH v2 01/12] simpletrace: Improve parsing of sys.argv; fix files never closed.

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal The arguments extracted from `sys.argv` named and unpacked to make it clear what the arguments are and what they're used for. The two input files were opened, but never explicitly closed. File usage changed to use `with` statement to take care of this. At the same time

[PATCH v2 09/12] simpletrace: Refactor to separate responsibilities

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal NOTE: `process` changes function signature Moved event_mapping and event_id_to_name down one level in the function call-stack to keep variable instantiation and usage closer (`process` and `run` has no use of the variables; `read_trace_records` does). Instead of passing

[PATCH v2 04/12] simpletrace: update code for Python 3.11

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal The call to `getargspec` was deprecated and in Python 3.11 it has been removed in favor of `getfullargspec`. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/simpletrace.py b/scripts

[PATCH v2 05/12] simpletrace: Changed Analyzer class to become context-manager

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal Instead of explicitly calling `begin` and `end`, we can change the class to use the context-manager paradigm. This is mostly a styling choice, used in modern Python code. But it also allows for more advanced analyzers to handle exceptions gracefully in the `__exit__` method

[PATCH v2 07/12] simpletrace: Improved error handling on struct unpack

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal A failed call to `read_header` wouldn't be handled the same for the two different code paths (one path would try to use `None` as a list). Changed to raise exception to be handled centrally. This also allows for easier unpacking, as errors has been filtered out. Signed-off

[PATCH v2 00/12] simpletrace: refactor and general improvements

2023-05-02 Thread Mads Ynddal
From: Mads Ynddal I wanted to use simpletrace.py for an internal project, so I tried to update and polish the code. Some of the commits resolve specific issues, while some are more subjective. I've tried to divide it into commits so we can discuss the individual changes, and I'm ready to pull

[PATCH 7/9] simpletrace: Improved error handling on struct unpack

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal A failed call to `read_header` wouldn't be handled the same for the two different code paths (one path would try to use `None` as a list). Changed to raise exception to be handled centrally. This also allows for easier unpacking, as errors has been filtered out. Signed-off

[PATCH 9/9] simpletrace: Refactor to separate responsibilities

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal Moved event_mapping and event_id_to_name down one level in the function call-stack to keep variable instantiation and usage closer (`process` and `run` has no use of the variables; `read_trace_records` does). Instead of passing event_mapping and event_id_to_name to the bottom

[PATCH 0/9] simpletrace: refactor and general improvements

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal I wanted to use simpletrace.py for an internal project, so I tried to update and polish the code. Some of the commits resolve specific issues, while some are more subjective. I've tried to divide it into commits so we can discuss the individual changes, and I'm ready to pull

[PATCH 1/9] simpletrace: Improve parsing of sys.argv; fix files never closed.

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal The arguments extracted from `sys.argv` named and unpacked to make it clear what the arguments are and what they're used for. The two input files were opened, but never explicitly closed. File usage changed to use `with` statement to take care of this. At the same time

[PATCH 4/9] simpletrace: update code for Python 3.11

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal The call to `getargspec` was deprecated and in Python 3.11 it has been removed in favor of `getfullargspec`. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/simpletrace.py b/scripts

[PATCH 6/9] simpletrace: Simplify construction of tracing methods

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal By moving the dynamic argument construction to keyword-arguments, we can remove all of the specialized handling, and streamline it. If a tracing method wants to access these, they can define the kwargs, or ignore it be placing `**kwargs` at the end of the function's arguments

[PATCH 3/9] simpletrace: changed naming of edict and idtoname to improve readability

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal Readability is subjective, but I've expanded the naming of the variables and arguments, to help with understanding for new eyes on the code. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 34 +- 1 file changed, 17 insertions(+), 17

[PATCH 8/9] simpletrace: define exception and add handling

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal Define `SimpleException` to differentiate our exceptions from generic exceptions (IOError, etc.). Adapted simpletrace to support this and output to stderr. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 23 +++ 1 file changed, 15 insertions(+), 8

[PATCH 5/9] simpletrace: Changed Analyzer class to become context-manager

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal Instead of explicitly calling `begin` and `end`, we can change the class to use the context-manager paradigm. This is mostly a styling choice, used in modern Python code. But it also allows for more advanced analyzers to handle exceptions gracefully in the `__exit__` method

[PATCH 2/9] simpletrace: Annotate magic constants from QEMU code

2023-02-21 Thread Mads Ynddal
From: Mads Ynddal It wasn't clear where the constants and structs came from, so I added comments to help. Signed-off-by: Mads Ynddal --- scripts/simpletrace.py | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py

[PATCH v2] gdbstub: move update guest debug to accel ops

2023-02-07 Thread Mads Ynddal
From: Mads Ynddal Continuing the refactor of a48e7d9e52 (gdbstub: move guest debug support check to ops) by removing hardcoded kvm_enabled() from generic cpu.c code, and replace it with a property of AccelOpsClass. Signed-off-by: Mads Ynddal --- accel/kvm/kvm-accel-ops.c | 5 + cpu.c

Re: [PATCH] gdbstub: move update guest debug to accel ops

2023-02-07 Thread Mads Ynddal
> > Sorry this dropped of my radar. Yes I think the ifdef will do. Are you > going to post a v2 with all the various updates? > No worries, I'll make a v2 with the changes. — Mads Ynddal

Re: [PATCH v3 2/3] hvf: implement guest debugging on Apple Silicon hosts

2023-02-02 Thread Mads Ynddal
with 2 cores. — Mads Ynddal

Re: [PATCH v3 2/3] hvf: implement guest debugging on Apple Silicon hosts

2023-01-19 Thread Mads Ynddal
> It seems v3 has a regression in regards to BRK instructions that I cannot > reproduce with v2. I've now observed the same messages on v2 on a co-worker's computer. Maybe it's happening in combination with another commit on master. If I can find the time, I'll try to bisect it. — Mads Ynddal

Re: [PATCH v3 2/3] hvf: implement guest debugging on Apple Silicon hosts

2023-01-18 Thread Mads Ynddal
Unexpected kernel BRK exception at EL1 [4.664650] Internal error: BRK handler: f200 [#1] PREEMPT SMP ... Maybe the software breakpoints aren't removed/reapplied correctly in v3? — Mads Ynddal

Re: [PATCH] gdbstub: move update guest debug to accel ops

2022-12-20 Thread Mads Ynddal
, 0); } +#endif trace_breakpoint_singlestep(cpu->cpu_index, enabled); } — Mads Ynddal

Re: [PATCH] gdbstub: move update guest debug to accel ops

2022-11-24 Thread Mads Ynddal
> Isn't this '0' flag here accelerator-specific? ... > ... if so the prototype should be: > > int (*update_guest_debug)(CPUState *cpu); > > and the '0' value set within kvm-accel-ops.c handler implementation. > You're right, we can avoid the additional variable. We'll then have to

Re: [PATCH] gdbstub: move update guest debug to accel ops

2022-11-23 Thread Mads Ynddal
> On 23 Nov 2022, at 15.05, Alex Bennée wrote: > > Nice. Looks good to me but I'll have a proper look when I go through my > gdbstub/next queue. I don't think this is critical for 7.2. > Thanks, and I agree. It can easily wait.

Re: [PATCH] gdbstub: move update guest debug to accel ops

2022-11-23 Thread Mads Ynddal
> On 23 Nov 2022, at 13.17, Mads Ynddal wrote: > > From: Mads Ynddal > > Continuing the refactor of a48e7d9e52 (gdbstub: move guest debug support > check to ops) by removing hardcoded kvm_enabled() from generic cpu.c > code, and replace it with a property of AccelOpsC

[PATCH] gdbstub: move update guest debug to accel ops

2022-11-23 Thread Mads Ynddal
From: Mads Ynddal Continuing the refactor of a48e7d9e52 (gdbstub: move guest debug support check to ops) by removing hardcoded kvm_enabled() from generic cpu.c code, and replace it with a property of AccelOpsClass. Signed-off-by: Mads Ynddal --- accel/kvm/kvm-accel-ops.c | 1 + cpu.c

Re: [PATCH v2 2/3] hvf: implement guest debugging on Apple Silicon hosts

2022-11-17 Thread Mads Ynddal
| 29 ++ > include/sysemu/hvf_int.h | 1 + > target/arm/hvf/hvf.c | 194 +- > 6 files changed, 372 insertions(+), 2 deletions(-) Looks good. I've tested hw/sw breakpoints, hw watchpoints and single-stepping. Reviewed-by: Mads Ynddal

  1   2   >