Re: [PATCH] contrib/plugins: add execlog to log instruction execution and memory access

2021-06-14 Thread Mahmoud Mandour
On 14/06/2021 11:01, Alexandre Iooss wrote: Log instruction execution and memory access to a file. This plugin can be used for reverse engineering or for side-channel analysis using QEMU. Signed-off-by: Alexandre Iooss --- MAINTAINERS | 1 + contrib/plugins/Makefile | 1

[RFC PATCH v3 0/4] Cache TCG plugin & symbol-resolution API

2021-06-07 Thread Mahmoud Mandour
ot; arguments and sticked to the last one. Alex Bennée (1): plugins/api: expose symbol lookup to plugins Mahmoud Mandour (3): plugins: Added a new cache modelling plugin. plugins/cache: Enabled cache parameterization plugins/cache: Added FIFO and LRU eviction policies. contrib/plugins/Mak

[RFC PATCH v3 1/4] plugins/api: expose symbol lookup to plugins

2021-06-07 Thread Mahmoud Mandour
-by: Alex Bennée Message-Id: <20210601145824.3849-1-alex.ben...@linaro.org> Signed-off-by: Mahmoud Mandour --- include/qemu/qemu-plugin.h | 9 + plugins/api.c | 6 ++ 2 files changed, 15 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-pl

[RFC PATCH v3 2/4] plugins: Added a new cache modelling plugin.

2021-06-07 Thread Mahmoud Mandour
Added a cache modelling plugin that uses a static configuration used in many of the commercial microprocessors and uses random eviction policy. The purpose of the plugin is to identify the most cache-thrashing instructions for both instruction cache and data cache. Signed-off-by: Mahmoud Mandour

[RFC PATCH v3 4/4] plugins/cache: Added FIFO and LRU eviction policies.

2021-06-07 Thread Mahmoud Mandour
Implemented FIFO and LRU eviction policies. Now one of the three eviction policies can be chosen as an argument. On not specifying an argument, LRU is used by default. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 205 +--- 1 file changed, 192

[RFC PATCH v3 3/4] plugins/cache: Enabled cache parameterization

2021-06-07 Thread Mahmoud Mandour
Made both icache and dcache configurable through plugin arguments. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 44 +++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index

[RFC PATCH v2] Add a post for the new TCG cache modelling plugin

2021-06-17 Thread Mahmoud Mandour
This post introduces the new TCG plugin `cache` that's used for cache modelling. This plugin is a part of my GSoC 2021 participation. Signed-off-by: Mahmoud Mandour --- v1 -> v2: Elaborated some more in the introduction and broken up some sentences. Changed the example of bloc

Re: [PATCH v4 4/5] docs/devel: Added cache plugin to the plugins docs

2021-06-23 Thread Mahmoud Mandour
On Wed, Jun 23, 2021 at 2:55 PM Mahmoud Mandour wrote: > Signed-off-by: Mahmoud Mandour > --- > docs/devel/tcg-plugins.rst | 60 ++ > 1 file changed, 60 insertions(+) > > diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst

[PATCH v4 5/5] MAINTAINTERS: Added myself as a reviewer for TCG Plugins

2021-06-23 Thread Mahmoud Mandour
Signed-off-by: Mahmoud Mandour --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5f55404f2f..1c4970c88b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2966,6 +2966,7 @@ F: include/tcg/ TCG Plugins M: Alex Bennée +R: Mahmoud Mandour S

[PATCH v4 1/5] plugins: Added a new cache modelling plugin

2021-06-23 Thread Mahmoud Mandour
Added a cache modelling plugin that uses a static configuration used in many of the commercial microprocessors and uses random eviction policy. The purpose of the plugin is to identify the most cache-thrashing instructions for both instruction cache and data cache. Signed-off-by: Mahmoud Mandour

[PATCH v4 3/5] plugins/cache: Added FIFO and LRU eviction policies

2021-06-23 Thread Mahmoud Mandour
Implemented FIFO and LRU eviction policies. Now one of the three eviction policies can be chosen as an argument. On not specifying an argument, LRU is used by default. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 203 +--- 1 file changed, 190

[PATCH v4 2/5] plugins/cache: Enable cache parameterization

2021-06-23 Thread Mahmoud Mandour
Enabled configuring both icache and dcache parameters using plugin parameters. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 47 - 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/contrib/plugins/cache.c b/contrib/plugins

[PATCH v4 4/5] docs/devel: Added cache plugin to the plugins docs

2021-06-23 Thread Mahmoud Mandour
Signed-off-by: Mahmoud Mandour --- docs/devel/tcg-plugins.rst | 60 ++ 1 file changed, 60 insertions(+) diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 18c6581d85..9d90110cbf 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel

[PATCH v4 0/5] plugins: New TCG plugin for cache modelling

2021-06-23 Thread Mahmoud Mandour
elf as a reviewer for TCG plugins. (Ignore if not appropriate of course) Mahmoud Mandour (5): plugins: Added a new cache modelling plugin plugins/cache: Enable cache parameterization plugins/cache: Added FIFO and LRU eviction policies docs/devel: Added cache plugin to the plugins d

[RFC PATCH v2] plugins: Passed the parsed arguments directly to plugins

2021-06-23 Thread Mahmoud Mandour
name". In either case, the argument is passed to the plugin as only the name, omitting the "=on" part. Signed-off-by: Mahmoud Mandour --- plugins/loader.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/loader.c b/plugins/loader.c index 05df40

[RFC PATCH] Subject: [RFC PATCH] plugins: Passed the parsed arguments directly to plugins

2021-06-23 Thread Mahmoud Mandour
name". In either case, the argument is passed to the plugin as only the name, omitting the "=on" part. Signed-off-by: Mahmoud Mandour --- plugins/loader.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/loader.c b/plugins/loader.c index 05df40

[RFC PATCH] Add a post for the new TCG cache modelling plugin

2021-06-15 Thread Mahmoud Mandour
This post introduces the new TCG plugin `cache` that's used for cache modelling. This plugin is a part of my GSoC 2021 participation. Signed-off-by: Mahmoud Mandour --- This initial RFC patch reflects the latest version that I have for the plugin (the multi-core part is not yet reviewed

[PATCH v4] plugins/syscall: Added a table-like summary output

2021-05-18 Thread Mahmoud Mandour
Added a table-like output which contains the total number of calls for each used syscall along with the number of errors that occurred. Per-call tracing is still available through supplying the argument ``print`` to the plugin. Signed-off-by: Mahmoud Mandour --- v3 -> v4: Added a miss

Re: [RFC PATCH v2 2/3] plugins: cache: Enabled parameterization and added trace printing

2021-06-01 Thread Mahmoud Mandour
CC'ing Emilio On Sun, May 30, 2021 at 8:37 AM Mahmoud Mandour wrote: > Made both icache and dcache configurable through plugin arguments > and added memory trace printing in a separate file. > > Signed-off-by: Mahmoud Mandour > --- > contrib/pl

Re: [RFC PATCH 1/3] plugins: Added a new cache modelling plugin

2021-06-01 Thread Mahmoud Mandour
On Tue, Jun 1, 2021 at 1:12 PM Alex Bennée wrote: > > Mahmoud Mandour writes: > > > Added a cache modelling plugin that uses a static configuration used in > > many of the commercial microprocessors and uses random eviction policy. > > > > Signed-off-by: Mahm

Re: [RFC PATCH v2 1/3] plugins: Added a new cache modelling plugin

2021-06-01 Thread Mahmoud Mandour
On Sun, May 30, 2021 at 8:37 AM Mahmoud Mandour wrote: > Added a cache modelling plugin that uses a static configuration used in > many of the commercial microprocessors and uses random eviction policy. > > Signed-off-by: Mahmoud Mandour > --- > contrib/plugins/Makefile

Re: [RFC PATCH v2 2/3] plugins: cache: Enabled parameterization and added trace printing

2021-06-01 Thread Mahmoud Mandour
On Tue, Jun 1, 2021 at 1:29 PM Alex Bennée wrote: > > (Stefan CC'ed for tracing discussion) > > Mahmoud Mandour writes: > > > Made both icache and dcache configurable through plugin arguments > > and added memory trace printing in a separate file. > > Please kee

Re: [RFC PATCH v2 3/3] plugins: cache: Added FIFO and LRU eviction policies.

2021-06-01 Thread Mahmoud Mandour
On Sun, May 30, 2021 at 8:37 AM Mahmoud Mandour wrote: > Now one of the three eviction policies can be chosen as an argument. On > not specifying an argument, LRU is used by default. > > Signed-off-by: Mahmoud Mandour > --- > contrib/plu

Re: [RFC PATCH v2 3/3] plugins: cache: Added FIFO and LRU eviction policies.

2021-06-01 Thread Mahmoud Mandour
On Tue, Jun 1, 2021 at 3:27 PM Alex Bennée wrote: > > Mahmoud Mandour writes: > > > Now one of the three eviction policies can be chosen as an argument. On > > not specifying an argument, LRU is used by default. > > > > Signed-off-by: Mahmoud Mandour > >

Re: [RFC PATCH v2 0/3] Cache modelling TCG plugin

2021-06-02 Thread Mahmoud Mandour
On Tue, Jun 1, 2021 at 3:32 PM Alex Bennée wrote: > > Mahmoud Mandour writes: > > > In this RFC patch series, I propose an initial cache modelling TCG > > plugin. As of now, it models separate L1 data cache and L1 instruction > > cache. It supports three eviction poli

Re: [RFC PATCH] plugins/api: expose symbol lookup to plugins

2021-06-02 Thread Mahmoud Mandour
On Tue, Jun 1, 2021 at 4:58 PM Alex Bennée wrote: > This is a quality of life helper for plugins so they don't need to > re-implement symbol lookup when dumping an address. The strings are > constant so don't need to be duplicated. One minor tweak is to return > NULL instead of a zero length

[RFC PATCH 1/3] plugins: Added a new cache modelling plugin

2021-05-29 Thread Mahmoud Mandour
Added a cache modelling plugin that uses a static configuration used in many of the commercial microprocessors and uses random eviction policy. Signed-off-by: Mahmoud Mandour --- contrib/plugins/Makefile | 1 + contrib/plugins/cache.c | 398 +++ 2 files

[RFC PATCH 2/3] plugins: cache: Enabled parameterization and added trace printing

2021-05-29 Thread Mahmoud Mandour
Made both icache and dcache configurable through plugin arguments and added memory trace printing in a separate file. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 68 +++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/contrib

[RFC PATCH 0/3] Cache modelling TCG plugin

2021-05-29 Thread Mahmoud Mandour
In this RFC patch series, I propose an initial cache modelling TCG plugin. As of now, it models separate L1 data cache and L1 instruction cache. It supports three eviction policies: LRU, random, and FIFO. Once a policy is chosen, it's used for both instruction and data caches. Mahmoud Mandour (3

[RFC PATCH 3/3] plugins: cache: Added FIFO and LRU eviction policies.

2021-05-29 Thread Mahmoud Mandour
Now one of the three eviction policies can be chosen as an argument. On not specifying an argument, LRU is used by default. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 159 1 file changed, 146 insertions(+), 13 deletions(-) diff --git

Re: [RFC PATCH v2 0/3] Cache modelling TCG plugin

2021-05-30 Thread Mahmoud Mandour
On Sun, May 30, 2021 at 8:37 AM Mahmoud Mandour wrote: > In this RFC patch series, I propose an initial cache modelling TCG > plugin. As of now, it models separate L1 data cache and L1 instruction > cache. It supports three eviction policies: LRU, random, and FIFO. Once > a poli

[RFC PATCH v2 2/3] plugins: cache: Enabled parameterization and added trace printing

2021-05-30 Thread Mahmoud Mandour
Made both icache and dcache configurable through plugin arguments and added memory trace printing in a separate file. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 68 +++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/contrib

Re: [RFC PATCH 0/3] Cache modelling TCG plugin

2021-05-30 Thread Mahmoud Mandour
Thank you, I'll also CC Emilio in the v2 of this series. On Sun, May 30, 2021 at 8:36 AM Philippe Mathieu-Daudé wrote: > Cc'ing Emilio too. > > On 5/29/21 5:22 PM, Mahmoud Mandour wrote: > > In this RFC patch series, I propose an initial cache modelling TCG > > plugin.

[RFC PATCH v2 1/3] plugins: Added a new cache modelling plugin

2021-05-30 Thread Mahmoud Mandour
Added a cache modelling plugin that uses a static configuration used in many of the commercial microprocessors and uses random eviction policy. Signed-off-by: Mahmoud Mandour --- contrib/plugins/Makefile | 1 + contrib/plugins/cache.c | 398 +++ 2 files

[RFC PATCH v2 0/3] Cache modelling TCG plugin

2021-05-30 Thread Mahmoud Mandour
le-free it. How do I mitigate this? I need to free the InsnData passed to vcpu_mem_access only once if we find out that it's an IO access since we do not need it anymore and it will early return every time. Mahmoud Mandour (3): plugins: Added a new cache modelling

[RFC PATCH v2 3/3] plugins: cache: Added FIFO and LRU eviction policies.

2021-05-30 Thread Mahmoud Mandour
Now one of the three eviction policies can be chosen as an argument. On not specifying an argument, LRU is used by default. Signed-off-by: Mahmoud Mandour --- contrib/plugins/cache.c | 159 1 file changed, 146 insertions(+), 13 deletions(-) diff --git

[PATCH v5] MAINTAINERS: Added myself as a reviewer for TCG Plugins

2021-07-07 Thread Mahmoud Mandour
Signed-off-by: Mahmoud Mandour --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5f55404f2f..1c4970c88b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2966,6 +2966,7 @@ F: include/tcg/ TCG Plugins M: Alex Bennée +R: Mahmoud Mandour S

[PATCH v5] docs/devel: Added cache plugin to the plugins docs

2021-06-27 Thread Mahmoud Mandour
Signed-off-by: Mahmoud Mandour --- v4 -> v5: Fixed the illustrated command since it has path problems... docs/devel/tcg-plugins.rst | 59 ++ 1 file changed, 59 insertions(+) diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst in

Re: [PATCH v2 2/7] virtiofds: Changed allocations of iovec to GLib's functions

2021-04-27 Thread Mahmoud Mandour
On Tue, Apr 27, 2021 at 12:25 PM Dr. David Alan Gilbert wrote: > * Mahmoud Mandour (ma.mando...@gmail.com) wrote: > > Replaced the calls to malloc()/calloc() and their respective > > calls to free() of iovec structs with GLib's allocation and > > deallocation functions.

Re: [PATCH v2 2/7] virtiofds: Changed allocations of iovec to GLib's functions

2021-04-27 Thread Mahmoud Mandour
On Tue, Apr 27, 2021 at 1:01 PM Dr. David Alan Gilbert wrote: > * Mahmoud Mandour (ma.mando...@gmail.com) wrote: > > On Tue, Apr 27, 2021 at 12:25 PM Dr. David Alan Gilbert < > dgilb...@redhat.com> > > wrote: > > > > > * Mahmoud Mandour (ma.mando...@gmail

[PATCH v3 2/7] virtiofsd: Changed allocations of iovec to GLib's functions

2021-04-27 Thread Mahmoud Mandour
. Not g_new0() because the buffer is immediately overwritten using memcpy. Signed-off-by: Mahmoud Mandour --- v2 -> v3: * Removed a wrongful combination of g_autofree and g_steel_pointer(). * Removed some goto paths that IMHO were not so useful any more. * In v2, I allocated in_sg_cpy thro

Re: [PATCH v2 2/7] virtiofds: Changed allocations of iovec to GLib's functions

2021-04-27 Thread Mahmoud Mandour
On Tue, Apr 27, 2021 at 1:33 PM Dr. David Alan Gilbert wrote: > * Mahmoud Mandour (ma.mando...@gmail.com) wrote: > > On Tue, Apr 27, 2021 at 1:01 PM Dr. David Alan Gilbert < > dgilb...@redhat.com> > > wrote: > > > > > * Mahmoud Mandour (ma.mando...@gmail.c

[PATCH] tools/meson.build: Error on enabling virtiofsd and have_system is false

2021-04-28 Thread Mahmoud Mandour
Previously, on configuring with --enable-virtiofsd and specifying a target list that does not contain a full-system emulation target, a spurious error message is emitted. This patch introduces a meaningful error message for such case. Signed-off-by: Mahmoud Mandour --- tools/meson.build | 4

Re: [PATCH v3] plugins/syscall: Added a table-like summary output

2021-05-05 Thread Mahmoud Mandour
On Wed, May 5, 2021 at 3:19 PM Alex Bennée wrote: > > Mahmoud Mandour writes: > > > Added a table-like output which contains the total number of calls > > for each used syscall along with the number of errors that occurred. > > > > Per-call tracing is

Re: [PATCH] tools/meson.build: Error on enabling virtiofsd and have_system is false

2021-04-28 Thread Mahmoud Mandour
On Wed, Apr 28, 2021 at 3:56 PM Connor Kuehl wrote: > On 4/28/21 8:35 AM, Mahmoud Mandour wrote: > > Previously, on configuring with --enable-virtiofsd and specifying > > a target list that does not contain a full-system emulation target, > > a spurious error message i

Re: [PATCH] tools/meson.build: Error on enabling virtiofsd and have_system is false

2021-04-28 Thread Mahmoud Mandour
On Wed, Apr 28, 2021 at 4:29 PM Connor Kuehl wrote: > On 4/28/21 9:13 AM, Mahmoud Mandour wrote: > >> I am not entirely sure if this is true. The error message before this > >> patch is applied is: > >> > >> ../tools/meson.build:12:6

[PATCH] virtiofsd: Changed allocations of fuse_session to GLib's functions

2021-03-24 Thread Mahmoud Mandour
Replaced the allocation and deallocation of fuse_session structs from calloc() and free() calls to g_try_new0() and g_free(). Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_lowlevel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virtiofsd

Re: [PATCH 2/8] virtiofds: Changed allocations of iovec to GLib's functions

2021-03-24 Thread Mahmoud Mandour
On Wed, Mar 24, 2021 at 2:57 PM Stefan Hajnoczi wrote: > Please use Reply-All on mailing list emails so that the mailing like and > all other CC email addresses are included in the discussion. > That's my bad, hopefully this won't happen again in the future. Mahmoud

Re: [PATCH 2/9] block: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD

2021-03-12 Thread Mahmoud Mandour
:23 PM Vladimir Sementsov-Ogievskiy < vsement...@virtuozzo.com> wrote: > 11.03.2021 06:15, Mahmoud Mandour wrote: > > Replaced various qemu_mutex_lock/qemu_mutex_unlock calls with > > lock guard macros (QEMU_LOCK_GUARD() and WITH_QEMU_LOCK_GUARD). > > This slightly simplif

Re: [PATCH 8/9] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD

2021-03-12 Thread Mahmoud Mandour
at 1:59 PM Christian Schoenebeck < qemu_...@crudebyte.com> wrote: > On Donnerstag, 11. März 2021 12:52:45 CET Greg Kurz wrote: > > On Thu, 11 Mar 2021 11:49:06 +0100 > > > > Christian Schoenebeck wrote: > > > On Donnerstag, 11. März 2021 04:15:37 CET Mahmoud Ma

[PATCH 3/9] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants

2021-03-13 Thread Mahmoud Mandour
Replaced calls to malloc(), and free() to their equivalent allocation functions from GLib. Also added checking for null after ENV_CURVE allocation following the same pattern of checking on preceeding table allocations. Signed-off-by: Mahmoud Mandour --- hw/audio/fmopl.c | 41

[PATCH 6/9] util/compatfd.c: Replaced a malloc with GLib's g_try_malloc

2021-03-13 Thread Mahmoud Mandour
Replaced a malloc() call and its respective free() call with GLib's g_try_malloc() and g_free(). Also, did slight styling changes that were producing errors using the checkpatch.pl script. Signed-off-by: Mahmoud Mandour --- util/compatfd.c | 10 +- 1 file changed, 5 insertions(+), 5

[PATCH 2/9] hw/audio/fmopl.c: Fixing some style errors.

2021-03-13 Thread Mahmoud Mandour
Fixed style errors on the relevant lines in which I will introduce changes. Signed-off-by: Mahmoud Mandour --- hw/audio/fmopl.c | 52 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c index

[PATCH 8/9] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc

2021-03-13 Thread Mahmoud Mandour
Replaced a malloc() call and its respective free() with GLib's g_try_malloc() and g_free() calls. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_opt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c index

[PATCH 1/9] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants

2021-03-13 Thread Mahmoud Mandour
Replaced the calls to malloc(), realloc(), and free() to their equivalents in GLib's allocation functions in various places. Signed-off-by: Mahmoud Mandour --- bsd-user/elfload.c | 74 +++--- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git

[PATCH 0/9] Replacing malloc and the like with GLib's variants

2021-03-13 Thread Mahmoud Mandour
to free(). Mahmoud Mandour (9): bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants hw/audio/fmopl.c: Fixing some style errors. hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants target/xtensa

[PATCH 4/9] pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants

2021-03-13 Thread Mahmoud Mandour
Changed a call to malloc() and its respective calls free() with GLib's allocation and deallocation functions. Signed-off-by: Mahmoud Mandour --- pc-bios/s390-ccw/netmain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw

[PATCH 7/9] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0

2021-03-13 Thread Mahmoud Mandour
Replaced a call to calloc() and its respective free() call with GLib's g_try_new0() and g_free() calls. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c index

[PATCH 9/9] tools/virtiofsd: Replacing malloc-like calls with GLib's variants

2021-03-13 Thread Mahmoud Mandour
established through GLib's functions. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_lowlevel.c | 30 ++-- tools/virtiofsd/fuse_virtio.c| 34 tools/virtiofsd/passthrough_ll.c | 32 +++--- 3 files changed, 48

[PATCH 5/9] target/xtensa: Replaced malloc/free with GLib's variants.

2021-03-13 Thread Mahmoud Mandour
Replaced the calls to malloc() and their respective calls to free() with GLib's allocation and deallocation functions. Signed-off-by: Mahmoud Mandour --- target/xtensa/xtensa-isa.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/target/xtensa

Re: [PATCH 5/8] util/compatfd.c: Replaced a malloc with GLib's variant

2021-03-15 Thread Mahmoud Mandour
> > If it's unrelated, then maybe better do it in a separate patch. > I thought so but I didn't know whether it was a so-small change that it didn't require its own patch or not. I will amend that. Since this is only a very small allocation, I think it would be better to > use g_malloc() here

[PATCH 2/2] util/compatfd.c: Replaced a malloc call with g_malloc.

2021-03-15 Thread Mahmoud Mandour
in a healthy system. Otherwise, the system is already in a critical state. Subsequently, removed NULL-checking after g_malloc(). Signed-off-by: Mahmoud Mandour --- util/compatfd.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/util/compatfd.c b/util/compatfd.c index 174f394533

[PATCH 0/2] util/compatfd.c: Fixed styling and replaced malloc

2021-03-15 Thread Mahmoud Mandour
is already small and its better if the system aborts on failure of such small allocations. Mahmoud Mandour (2): util/compatfd.c: Fixed style issues util/compatfd.c: Replaced a malloc call with g_malloc. util/compatfd.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions

[PATCH 1/2] util/compatfd.c: Fixed style issues

2021-03-15 Thread Mahmoud Mandour
Fixed two styling issues that caused checkpatch.pl errors. Signed-off-by: Mahmoud Mandour --- util/compatfd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/compatfd.c b/util/compatfd.c index ee47dd8089..174f394533 100644 --- a/util/compatfd.c +++ b/util

Re: [PATCH 2/2] util/compatfd.c: Replaced a malloc call with g_malloc.

2021-03-15 Thread Mahmoud Mandour
On Mon, Mar 15, 2021 at 1:13 PM Philippe Mathieu-Daudé wrote: > Hi Mahmoud, > > On 3/15/21 11:58 AM, Mahmoud Mandour wrote: > > Replaced a call to malloc() and its respective call to free() > > with g_malloc() and g_free(). > > > > g_malloc() is preferred m

Re: [PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's variants

2021-03-15 Thread Mahmoud Mandour
On Mon, Mar 15, 2021 at 12:01 PM Stefan Hajnoczi wrote: > On Sun, Mar 14, 2021 at 05:23:24AM +0200, Mahmoud Mandour wrote: > > @@ -130,7 +130,7 @@ static struct fuse_req *fuse_ll_alloc_req(struct > fuse_session *se) > > { > > struct fuse_req *req; > > &

[PATCH 1/8] virtiofsd: Changed allocations of fuse_req to GLib functions

2021-03-19 Thread Mahmoud Mandour
Replaced the allocation and deallocation of fuse_req structs using calloc()/free() call pairs to a GLib's g_try_new0() and g_free(). Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_lowlevel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virtiofsd

Re: [PATCH 0/8] virtiofsd: Changed various allocations to GLib functions

2021-03-19 Thread Mahmoud Mandour
On Fri, Mar 19, 2021 at 3:25 PM Mahmoud Mandour wrote: > Replaced allocations done using malloc(), calloc(), and realloc() > to their equivalent functions in GLib. > > Memory that is allocated locally and freed when the function exits > are annotated g_autofree so that t

[PATCH 0/8] virtiofsd: Changed various allocations to GLib functions

2021-03-19 Thread Mahmoud Mandour
patch had some errors. Also, I thought that it's better to split the patch into smaller pieces. The previous patch can be found here: https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg05153.html Mahmoud Mandour (8): virtiofsd: Changed allocations of fuse_req to GLib functions virtiofds

[PATCH 4/8] virtiofsd: Changed allocations of fuse_session to GLib's functions

2021-03-19 Thread Mahmoud Mandour
-by: Mahmoud Mandour --- tools/virtiofsd/fuse_lowlevel.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c index 45527ff703..b0e9ef29a7 100644 --- a/tools/virtiofsd/fuse_lowlevel.c +++ b/tools/virtiofsd

[PATCH 3/8] virtiofsd: Changed fuse_pollhandle allocation to GLib's functions

2021-03-19 Thread Mahmoud Mandour
Changed allocation of fuse_pollhandle structs to GLib's g_new(). Removed the null checking as allocating such a small memory segment should always succeed on a healthy system. Otherwise, the system is already in a critical state. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd

[PATCH 8/8] virtiofsd/fuse_virtio.c: Changed allocations of locals to GLib

2021-03-19 Thread Mahmoud Mandour
Replaced the allocation of local variables from malloc() to GLib allocation functions. In one instance, dropped the usage to an assert after a malloc() call and used g_malloc() instead. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_virtio.c | 9 - 1 file changed, 4 insertions

[PATCH 5/8] virtiofsd: Changed allocation of lo_map_elems to GLib's functions

2021-03-19 Thread Mahmoud Mandour
Replaced (re)allocation of lo_map_elem structs from realloc() to GLib's g_try_realloc_n() and replaced the respective free() call with a g_free(). Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/passthrough_ll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools

[PATCH 6/8] virtiofsd: Changed allocations of fv_VuDev & its internals to GLib functions

2021-03-19 Thread Mahmoud Mandour
ucts and fv_QueueInfo structs. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_virtio.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c index 07e5d91a9f..5828b9a76f 100644 --- a/t

[PATCH 2/8] virtiofds: Changed allocations of iovec to GLib's functions

2021-03-19 Thread Mahmoud Mandour
to the calling function and still auto-frees the memory when the calling function finishes (maintaining the symantics of previous code). Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_lowlevel.c | 19 +++ tools/virtiofsd/fuse_virtio.c | 6 +- 2 files changed, 8

[PATCH 7/8] virtiofsd/passthrough_ll.c: Changed local allocations to GLib functions

2021-03-19 Thread Mahmoud Mandour
Changed the allocations of some local variables to GLib's allocation functions, such as g_try_malloc0(), and annotated those variables as g_autofree. Subsequently, I was able to remove the calls to free(). Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/passthrough_ll.c | 17

Re: [PATCH 1/8] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants

2021-03-15 Thread Mahmoud Mandour
l make the changes again and properly, split the patch, and then send it as a series regarding this file. Thanks Mahmoud Mandour

Re: [PATCH 3/8] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants

2021-03-15 Thread Mahmoud Mandour
checks for the tables to be dropped. And that's because of the cruciality of this initialization code. Can you please elaborate more on how I would employ g_autofree in this code? Are you talking about the memory allocated for ``ptr`` in OPLCreate here? Thanks Mahmoud Mandour

[PATCH 8/8] tools/virtiofsd: Replacing malloc-like calls with GLib's variants

2021-03-13 Thread Mahmoud Mandour
established through GLib's functions. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_lowlevel.c | 30 ++-- tools/virtiofsd/fuse_virtio.c| 34 tools/virtiofsd/passthrough_ll.c | 32 +++--- 3 files changed, 48

[PATCH 6/8] tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0

2021-03-13 Thread Mahmoud Mandour
Replaced a call to calloc() and its respective free() call with GLib's g_try_new0() and g_free() calls. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c index

Re: [PATCH 4/9] pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants

2021-03-13 Thread Mahmoud Mandour
going to resend it (after amending those problems). Therefore I'm going to exclude this commit. On Sat, Mar 13, 2021 at 8:50 PM Christian Borntraeger < borntrae...@de.ibm.com> wrote: > On 13.03.21 17:36, Mahmoud Mandour wrote: > > Changed a call to malloc() and its respective calls fre

[PATCH 3/8] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants

2021-03-13 Thread Mahmoud Mandour
Replaced calls to malloc(), and free() to their equivalent allocation functions from GLib. Also added checking for null after ENV_CURVE allocation following the same pattern of checking on preceeding table allocations. Signed-off-by: Mahmoud Mandour --- hw/audio/fmopl.c | 42

[PATCH 4/8] target/xtensa: Replaced malloc/free with GLib's variants

2021-03-13 Thread Mahmoud Mandour
Replaced the calls to malloc() and their respective calls to free() with GLib's allocation and deallocation functions. Removed null checking before calling g_free() because it's not necessary and generates style errors. Signed-off-by: Mahmoud Mandour --- target/xtensa/xtensa-isa.c | 53

[PATCH 2/8] hw/audio/fmopl.c: Fixing some style errors

2021-03-13 Thread Mahmoud Mandour
Fixed style errors on the relevant lines in which I will introduce changes. Signed-off-by: Mahmoud Mandour --- hw/audio/fmopl.c | 58 ++-- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c index

[PATCH 5/8] util/compatfd.c: Replaced a malloc with GLib's variant

2021-03-13 Thread Mahmoud Mandour
Replaced a malloc() call and its respective free() call with GLib's g_try_malloc() and g_free(). Also, did slight styling changes that were producing style errors when using the checkpatch.pl script against the file. Signed-off-by: Mahmoud Mandour --- util/compatfd.c | 10 +- 1 file

[PATCH 7/8] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc

2021-03-13 Thread Mahmoud Mandour
Replaced a malloc() call and its respective free() with GLib's g_try_malloc() and g_free() calls. Signed-off-by: Mahmoud Mandour --- tools/virtiofsd/fuse_opt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c index

[PATCH 1/8] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants

2021-03-13 Thread Mahmoud Mandour
Replaced the calls to malloc(), realloc(), and free() to their equivalents in GLib's allocation functions in various places. Signed-off-by: Mahmoud Mandour --- bsd-user/elfload.c | 74 +++--- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git

[PATCH 0/8] Replacing malloc and the like with GLib's variants

2021-03-13 Thread Mahmoud Mandour
to free(). This series was resent due to some previous problems that are hopefully resolved in this series. Mahmoud Mandour (8): bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants hw/audio/fmopl.c: Fixing some style errors hw/audio/fmopl.c: Replaced calls to malloc with GLib's

[PATCH 9/9] hw/hyperv/vmbus: replaced qemu_mutex_lock with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Replaced some calls to qemu_mutex_lock and their respective qemu_mutex_unlock calls with QEMU_LOCK_GUARD macro. This simplifies the code by removing the calls to qemu_mutex_unlock and eliminates goto paths. Signed-off-by: Mahmoud Mandour --- hw/hyperv/vmbus.c | 13 + 1 file changed

[PATCH 4/9] util: Replaced qemu_mutex_lock with QEMU_LOCK_GUARDs

2021-03-11 Thread Mahmoud Mandour
Removed various qemu_mutex_lock calls and their respective qemu_mutex_unlock calls and used QEMU_LOCK_GUARD. This simplifies the code by eliminating various goto paths and removes qemu_mutex_unlock calls. Signed-off-by: Mahmoud Mandour --- util/filemonitor-inotify.c | 24

[PATCH 6/9] migration: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Replaced various qemu_mutex_lock calls and their respective qemu_mutex_unlock calls with QEMU_LOCK_GUARD macro. This simplifies the code by eliminating the respective qemu_mutex_unlock calls. Signed-off-by: Mahmoud Mandour --- migration/migration.c | 6 ++ migration/ram.c | 6

[PATCH 8/9] hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Replaced a call to qemu_mutex_lock and its respective call to qemu_mutex_unlock and used QEMU_LOCK_GUARD macro in their place. This simplifies the code by removing the call required to unlock and also eliminates goto paths. Signed-off-by: Mahmoud Mandour --- hw/9pfs/9p-synth.c | 12

[PATCH 7/9] virtio-iommu: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
In various places, qemu_mutex_lock calls and their respective calls to qemu_mutex_unlock are replaced with QEMU_LOCK_GUARD macros. This simplifies the code by removing the calls to qemu_mutex_unlock and eliminates goto paths. Signed-off-by: Mahmoud Mandour --- hw/virtio/virtio-iommu.c | 78

[PATCH 2/9] block: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Replaced various qemu_mutex_lock/qemu_mutex_unlock calls with lock guard macros (QEMU_LOCK_GUARD() and WITH_QEMU_LOCK_GUARD). This slightly simplifies the code by eliminating calls to qemu_mutex_unlock and eliminates goto paths. Signed-off-by: Mahmoud Mandour --- block/curl.c | 13 ++-- block

[PATCH 1/9] tpm: Changed a qemu_mutex_lock to QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Removed a qemu_mutex_lock() and its respective qemu_mutex_unlock() and used QEMU_LOCK_GUARD instead. This simplifies the code by eliminiating gotos and removing the qemu_mutex_unlock() calls. Signed-off-by: Mahmoud Mandour --- backends/tpm/tpm_emulator.c | 8 +++- 1 file changed, 3

[PATCH 0/9] Changing qemu_mutex_locks to lock guard macros

2021-03-11 Thread Mahmoud Mandour
to qemu_mutex_lock/unlock are a matching pair. Mahmoud Mandour (9): tpm: Changed a qemu_mutex_lock to QEMU_LOCK_GUARD block: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD util: Replaced qemu_mutex_lock with QEMU_LOCK_GUARDs

[PATCH 3/9] char: Replaced a qemu_mutex_lock with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Removed a pair of qemu_mutex_lock and its respective qemu_mutex_unlock and used a QEMU_LOCK_GUARD instead. This improves readability by removing the call to qemu_mutex_unlock. Signed-off-by: Mahmoud Mandour --- chardev/char.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[PATCH 5/9] monitor: Replaced qemu_mutex_lock calls with QEMU_LOCK_GUARD

2021-03-11 Thread Mahmoud Mandour
Removed various qemu_mutex_lock and their respective qemu_mutex_unlock calls and used lock guard macros (QEMU_LOCK_GUARD and WITH_QEMU_LOCK_GUARD). This simplifies the code by eliminating qemu_mutex_unlock calls. Signed-off-by: Mahmoud Mandour --- monitor/monitor.c | 8 ++-- monitor/qmp.c

[PATCH] plugins/syscall: Added a table-like summary output

2021-04-15 Thread Mahmoud Mandour
Added a table-like output which contains the total number of calls for each used syscall along with the number of errors that occurred. Per-call tracing is still available through supplying the argument ``print`` to the plugin. Signed-off-by: Mahmoud Mandour --- tests/plugin/syscall.c | 94

[PATCH v3] plugins/syscall: Added a table-like summary output

2021-04-20 Thread Mahmoud Mandour
Added a table-like output which contains the total number of calls for each used syscall along with the number of errors that occurred. Per-call tracing is still available through supplying the argument ``print`` to the plugin. Signed-off-by: Mahmoud Mandour --- v2 -> v3: * Locked shared h

  1   2   3   >