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 stil

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

2021-03-19 Thread Mahmoud Mandour
vious 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

[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 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/virt

[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

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

2021-03-19 Thread Mahmoud Mandour
er 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 chang

[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/virt

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

2021-03-19 Thread Mahmoud Mandour
: 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 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/

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 the

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

2021-03-23 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

[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
calls 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_G

[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 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 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 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 a

[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 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 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

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

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

2021-03-12 Thread Mahmoud Mandour
at 12: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 si

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

2021-03-13 Thread Mahmoud Mandour
ll 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

[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 --

[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

[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 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(

[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 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

[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/s39

[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/x

[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 change

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

2021-03-13 Thread Mahmoud Mandour
ng 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 call

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

2021-03-13 Thread Mahmoud Mandour
ll 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 G

[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 --

[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 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

[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-

[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

[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

[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 change

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

2021-03-14 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 and

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 2/2] util/compatfd.c: Replaced a malloc call with g_malloc.

2021-03-15 Thread Mahmoud Mandour
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
ation 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 dele

[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 1/8] bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants

2021-03-15 Thread Mahmoud Mandour
ll 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
null 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

[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 Mando

[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 a

[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 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 v2 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 v2 0/3] Cache modelling TCG plugin

2021-05-29 Thread Mahmoud Mandour
ld double-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

[RFC PATCH v2 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 a

[RFC PATCH v2 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

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

2021-05-29 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 > &g

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

2021-05-29 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

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
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 > --- > contr

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 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 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. > > Pleas

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] plugins/api: expose symbol lookup to plugins

2021-06-01 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 stri

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

2021-06-01 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

[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

[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

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

2021-04-15 Thread Mahmoud Mandour
On Thu, Apr 15, 2021 at 5:20 PM Mahmoud Mandour wrote: > 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`

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

2021-04-16 Thread Mahmoud Mandour
On Fri, Apr 16, 2021 at 8:54 AM Mahmoud Mandour wrote: > On Thu, Apr 15, 2021 at 5:20 PM Mahmoud Mandour > wrote: > >> >> Hello. I just realized that this hunk: > > static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx, >>

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

2021-04-16 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 --- v1: https://lists.gnu.org

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

2021-04-16 Thread Mahmoud Mandour
On Mon, Mar 22, 2021 at 5:53 PM Stefan Hajnoczi wrote: > On Fri, Mar 19, 2021 at 03:47:03PM +0200, Mahmoud Mandour wrote: > > On Fri, Mar 19, 2021 at 3:25 PM Mahmoud Mandour > > wrote: > > > > > Replaced allocations done using malloc(), calloc(), and reall

[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

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

2021-04-20 Thread Mahmoud Mandour
patch had some errors. Also, I thought that it's better to split the patch into smaller pieces. Mahmoud Mandour (7): virtiofsd: Changed allocations of fuse_req to GLib functions virtiofds: Changed allocations of iovec to GLib's functions virtiofsd: Changed allocations of fuse_se

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

2021-04-20 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 Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/fuse_lowlevel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

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

2021-04-20 Thread Mahmoud Mandour
er 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 Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/fuse_lowlevel.c | 19 +++ tools/virtiofsd/fuse_virtio.c

[PATCH v2 3/7] virtiofsd: Changed allocations of fuse_session to GLib's functions

2021-04-20 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 Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/fuse_lowlevel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH v2 4/7] virtiofsd: Changed allocation of lo_map_elems to GLib's functions

2021-04-20 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 Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/passthrough_ll.c | 4 ++-- 1 file changed, 2 insertions(

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

2021-04-20 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 Reviewed-by: Stefan Hajnoczi --- tools/virtiofsd/fuse_virtio.c | 9

[PATCH v2 5/7] virtiofsd: Changed allocations of fv_VuDev & its internals to GLib functions

2021-04-20 Thread Mahmoud Mandour
ucts and fv_QueueInfo structs. Signed-off-by: Mahmoud Mandour Reviewed-by: Stefan Hajnoczi --- 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 07e5d9

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

2021-04-20 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 Reviewed-by: Stefan Hajnoczi --- tools/virt

Re: [Virtio-fs] [PATCH v2 1/7] virtiofsd: Changed allocations of fuse_req to GLib functions

2021-04-20 Thread Mahmoud Mandour
On Tue, Apr 20, 2021 at 9:03 PM Vivek Goyal wrote: > On Tue, Apr 20, 2021 at 05:46:36PM +0200, Mahmoud Mandour wrote: > > Replaced the allocation and deallocation of fuse_req structs > > using calloc()/free() call pairs to a GLib's g_try_new0() > > and g_free(). > &g

[PATCH 0/2] plugins: Freeing allocated values in hash tables.

2021-04-21 Thread Mahmoud Mandour
A hash table made using ``g_hash_table_new`` requires manually freeing any dynamically allocated keys/values. The two patches in this series fixes this issue in hotblocks and hotpages plugins. Mahmoud Mandour (2): plugins/hotblocks: Properly freed the hash table values plugins/hotpages

[PATCH 2/2] plugins/hotpages: Properly freed the hash table values

2021-04-21 Thread Mahmoud Mandour
Freed the values stored in the hash table ``pages`` returned by ``g_hash_table_get_values()`` by freeing the sorted list and destroyed the hash table afterward. Signed-off-by: Mahmoud Mandour --- contrib/plugins/hotpages.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a

[PATCH 1/2] plugins/hotblocks: Properly freed the hash table values

2021-04-21 Thread Mahmoud Mandour
Freed the values stored in the hash table ``hotblocks`` returned by ``g_hash_table_get_values()`` by freeing the sorted list and destroyed the hash table afterward. Signed-off-by: Mahmoud Mandour --- contrib/plugins/hotblocks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v2 0/2] plugins: Freeing allocated values in hash tables.

2021-04-21 Thread Mahmoud Mandour
probably better because the sorted list is only made on having ``counts != NULL`` and ``counts`` has a next pointer so essentially at least 2 elements in the list. Mahmoud Mandour (2): plugins/hotblocks: Properly freed the hash table values plugins/hotpages: Properly freed the hash tabl

[PATCH v2 1/2] plugins/hotblocks: Properly freed the hash table values

2021-04-21 Thread Mahmoud Mandour
Freed the values stored in the hash table ``hotblocks`` returned by ``g_hash_table_get_values()`` by freeing the sorted list and destroyed the hash table afterward. Signed-off-by: Mahmoud Mandour --- contrib/plugins/hotblocks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v2 2/2] plugins/hotpages: Properly freed the hash table values

2021-04-21 Thread Mahmoud Mandour
Allocated ``pages`` hash table through ``g_hash_table_new_full`` to add a freeing function & destroyed the hash table on exit. Signed-off-by: Mahmoud Mandour --- contrib/plugins/hotpages.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/plugins/hotpages.c b/con

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 funct

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

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] 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

  1   2   3   >