Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-29 Thread Kevin Wolf
Am 28.07.2022 um 21:27 hat Denis V. Lunev geschrieben: > On 28.07.2022 16:42, Vladimir Sementsov-Ogievskiy wrote: > > On 7/11/22 14:07, Denis V. Lunev wrote: > > > Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from > > > the first glance, but it has changed things a lot. 'libv

Re: [PATCH v10 03/21] job.c: API functions not used outside should be static

2022-07-29 Thread Kevin Wolf
Am 25.07.2022 um 09:38 hat Emanuele Giuseppe Esposito geschrieben: > job_event_* functions can all be static, as they are not used > outside job.c. > > Same applies for job_txn_add_job(). > > Signed-off-by: Emanuele Giuseppe Esposito > Reviewed-by: Stefan Hajnoczi > Reviewed-by: Vladimir Sement

Re: [PATCH v10 02/21] job.h: categorize fields in struct Job

2022-07-29 Thread Kevin Wolf
Am 25.07.2022 um 09:38 hat Emanuele Giuseppe Esposito geschrieben: > Categorize the fields in struct Job to understand which ones > need to be protected by the job mutex and which don't. > > Signed-off-by: Emanuele Giuseppe Esposito > Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Kevin

Re: [PATCH v10 04/21] aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED

2022-07-29 Thread Kevin Wolf
Am 25.07.2022 um 09:38 hat Emanuele Giuseppe Esposito geschrieben: > Same as AIO_WAIT_WHILE macro, but if we are in the Main loop > do not release and then acquire ctx_ 's aiocontext. > > Once all Aiocontext locks go away, this macro will replace > AIO_WAIT_WHILE. > > Signed-off-by: Emanuele Gius

Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-29 Thread Denis V. Lunev
On 29.07.2022 11:13, Kevin Wolf wrote: Am 28.07.2022 um 21:27 hat Denis V. Lunev geschrieben: On 28.07.2022 16:42, Vladimir Sementsov-Ogievskiy wrote: On 7/11/22 14:07, Denis V. Lunev wrote: Commit 5f76a7aac156ca75680dad5df4a385fd0b58f6b1 is looking harmless from the first glance, but it has c

[RFC v2 00/10] Introduce an extensible static analyzer

2022-07-29 Thread Alberto Faria
This series introduces a static analyzer for QEMU. It consists of a single static-analyzer.py script that relies on libclang's Python bindings, and provides a common framework on which arbitrary static analysis checks can be developed and run against QEMU's code base. Summary of the series: - P

[RFC v2 01/10] Add an extensible static analyzer

2022-07-29 Thread Alberto Faria
Add a static-analyzer.py script that uses libclang's Python bindings to provide a common framework on which arbitrary static analysis checks can be developed and run against QEMU's code base. As an example, a simple "return-value-never-used" check is included that verifies that the return value of

[RFC v2 02/10] Drop unused static function return values

2022-07-29 Thread Alberto Faria
Make non-void static functions whose return values are ignored by all callers return void instead. These functions were found by static-analyzer.py. Not all occurrences of this problem were fixed. Signed-off-by: Alberto Faria --- accel/kvm/kvm-all.c | 12 ++--- accel/tcg/

[RFC v2 03/10] static-analyzer: Support adding tests to checks

2022-07-29 Thread Alberto Faria
Introduce an add_check_tests() method to add output-comparison tests to checks, and add some tests to the "return-value-never-used" check. Signed-off-by: Alberto Faria --- static-analyzer.py | 133 - static_analyzer/__init__.py| 39 +++

[RFC v2 09/10] block: Add no_coroutine_fn marker

2022-07-29 Thread Alberto Faria
When applied to a function, it advertises that it should not be called from coroutine_fn functions. Make generated_co_wrapper evaluate to no_coroutine_fn, as coroutine_fn functions should instead directly call the coroutine_fn that backs the generated_co_wrapper. Add a "no_coroutine_fn" check to

[RFC v2 05/10] static-analyzer: Enforce coroutine_fn restrictions for direct calls

2022-07-29 Thread Alberto Faria
Add a "coroutine_fn" check to static-analyzer.py that ensures that non-coroutine_fn functions don't perform direct calls to coroutine_fn functions. For the few cases where this must happen, introduce an __allow_coroutine_fn_call() macro that wraps offending calls and overrides the static analyzer.

[RFC v2 04/10] static-analyzer: Avoid reanalyzing unmodified translation units

2022-07-29 Thread Alberto Faria
For each translation unit, run each check only if any of the translation unit's files has been modified since the last time the check ran and passed without reporting problems. Signed-off-by: Alberto Faria --- static-analyzer.py | 240 - 1 file changed

[RFC v2 06/10] Fix some direct calls from non-coroutine_fn to coroutine_fn

2022-07-29 Thread Alberto Faria
In some cases we need to use a different function, in others we need to make the caller a coroutine_fn, and in others still we need to wrap calls to coroutines in __allow_coroutine_fn_call(). Also fix coroutine_fn annotation disagreements between several declarations of the same function. These p

[RFC v2 07/10] static-analyzer: Enforce coroutine_fn restrictions on function pointers

2022-07-29 Thread Alberto Faria
Extend static-analyzer.py's "coroutine_fn" check to enforce coroutine_fn restrictions on function pointer operations. Invalid operations include assigning a coroutine_fn value to a non-coroutine_fn function pointer, and invoking a coroutine_fn function pointer from a non-coroutine_fn function. Si

[RFC v2 10/10] Fix some calls from coroutine_fn to no_coroutine_fn

2022-07-29 Thread Alberto Faria
These calls were found by static-analyzer.py. Not all occurrences of this problem were fixed. Signed-off-by: Alberto Faria --- block/commit.c | 2 +- block/io.c | 4 ++-- block/mirror.c | 4 ++-- block/parallels.c | 28 ++-- block/qcow

[RFC v2 08/10] Fix some bad coroutine_fn indirect calls and pointer assignments

2022-07-29 Thread Alberto Faria
These problems were found by static-analyzer.py. Not all occurrences of these problems were fixed. Signed-off-by: Alberto Faria --- block/backup.c | 2 +- include/block/block_int-common.h | 12 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/block/

Re: [RFC 0/3] Add Generic SPI GPIO model

2022-07-29 Thread Cédric Le Goater
Hello Iris, On 7/29/22 01:23, Iris Chen wrote: Hey everyone, I have been working on a project to add support for SPI-based TPMs in QEMU. Currently, most of our vboot platforms using a SPI-based TPM use the Linux SPI-GPIO driver to "bit-bang" the SPI protocol. This is because the Aspeed SPI cont

Re: [PATCH v10 05/21] job.c: add job_lock/unlock while keeping job.h intact

2022-07-29 Thread Kevin Wolf
Am 25.07.2022 um 09:38 hat Emanuele Giuseppe Esposito geschrieben: > With "intact" we mean that all job.h functions implicitly > take the lock. Therefore API callers are unmodified. > > This means that: > - many static functions that will be always called with job lock held > become _locked, and

Re: [RFC 0/3] Add Generic SPI GPIO model

2022-07-29 Thread Patrick Williams
On Fri, Jul 29, 2022 at 03:25:55PM +0200, Cédric Le Goater wrote: > Hello Iris, > > On 7/29/22 01:23, Iris Chen wrote: > > Currently, most of our vboot platforms using a SPI-based TPM use the Linux > > SPI-GPIO driver to "bit-bang" the SPI protocol. This is because the Aspeed > > SPI controller (m

Re: [RFC 0/3] Add Generic SPI GPIO model

2022-07-29 Thread Patrick Williams
On Fri, Jul 29, 2022 at 03:25:55PM +0200, Cédric Le Goater wrote: > Hello Iris, > > On 7/29/22 01:23, Iris Chen wrote: > > MOSI pin in spi_gpio: the mosi pin is not included and we poll the realtime > > value > > of the gpio for input bits to prevent bugs with caching the mosi value. It > > was

Re: [RFC 0/3] Add Generic SPI GPIO model

2022-07-29 Thread Cédric Le Goater
On 7/29/22 16:38, Patrick Williams wrote: On Fri, Jul 29, 2022 at 03:25:55PM +0200, Cédric Le Goater wrote: Hello Iris, On 7/29/22 01:23, Iris Chen wrote: Currently, most of our vboot platforms using a SPI-based TPM use the Linux SPI-GPIO driver to "bit-bang" the SPI protocol. This is because

Re: [PATCH v2 0/3] Fix some coverity issues on VDUSE

2022-07-29 Thread Peter Maydell
On Wed, 6 Jul 2022 at 11:18, Xie Yongji wrote: > > This series fixes some issues reported by coverity. > > Patch 1 fixes a incorrect function name. > > Patch 2 fixes Coverity CID 1490224. > > Patch 3 fixes Coverity CID 1490226, 1490223. > > V1 to V2: > - Drop the patch to fix Coverity CID 1490222,

Re: [RFC 0/3] Add Generic SPI GPIO model

2022-07-29 Thread Peter Delevoryas
On Fri, Jul 29, 2022 at 03:25:55PM +0200, Cédric Le Goater wrote: > Hello Iris, > > On 7/29/22 01:23, Iris Chen wrote: > > Hey everyone, > > > > I have been working on a project to add support for SPI-based TPMs in QEMU. > > Currently, most of our vboot platforms using a SPI-based TPM use the Lin

Re: [PATCH 1/1] block: add missed block_acct_setup with new block device init procedure

2022-07-29 Thread Kevin Wolf
Am 29.07.2022 um 14:36 hat Denis V. Lunev geschrieben: > On 29.07.2022 11:13, Kevin Wolf wrote: > > Am 28.07.2022 um 21:27 hat Denis V. Lunev geschrieben: > > > On 28.07.2022 16:42, Vladimir Sementsov-Ogievskiy wrote: > > > > On 7/11/22 14:07, Denis V. Lunev wrote: > > > > > Commit 5f76a7aac156ca75