qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] d90226: multi-process: Initialize variables d


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] d90226: multi-process: Initialize variables declared with ...
Date: Mon, 24 May 2021 11:02:24 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d90226808b5b1b30b07968e94d8f74bf8804fc89
      
https://github.com/qemu/qemu/commit/d90226808b5b1b30b07968e94d8f74bf8804fc89
  Author: Zenghui Yu <yuzenghui@huawei.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M hw/remote/memory.c
    M hw/remote/proxy.c

  Log Message:
  -----------
  multi-process: Initialize variables declared with g_auto*

Quote docs/devel/style.rst (section "Automatic memory deallocation"):

* Variables declared with g_auto* MUST always be initialized,
  otherwise the cleanup function will use uninitialized stack memory

Initialize @name properly to get rid of the compilation error (using
gcc-7.3.0 on CentOS):

../hw/remote/proxy.c: In function 'pci_proxy_dev_realize':
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'name' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
   g_free (*pp);
   ^~~~~~~~~~~~
../hw/remote/proxy.c:350:30: note: 'name' was declared here
             g_autofree char *name;
                              ^~~~

Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
Message-id: 20210312112143.1369-1-yuzenghui@huawei.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 5c6ae58d4bdca71f0b63e854ceb6a8ee67cbddd8
      
https://github.com/qemu/qemu/commit/5c6ae58d4bdca71f0b63e854ceb6a8ee67cbddd8
  Author: Philippe Mathieu-Daudé <philmd@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M include/qemu/bitops.h

  Log Message:
  -----------
  bitops.h: Improve find_xxx_bit() documentation

Document the following functions return the bitmap size
if no matching bit is found:

- find_first_bit
- find_next_bit
- find_last_bit
- find_first_zero_bit
- find_next_zero_bit

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20210510200758.2623154-2-philmd@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 5b33e015d38acb00340b8310a24c9998138afbe6
      
https://github.com/qemu/qemu/commit/5b33e015d38acb00340b8310a24c9998138afbe6
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  coroutine-sleep: use a stack-allocated timer

The lifetime of the timer is well-known (it cannot outlive
qemu_co_sleep_ns_wakeable, because it's deleted by the time the
coroutine resumes), so it is not necessary to place it on the heap.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210517100548.28806-2-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: fb74a286feaa4ec2cdcda61ba570244464581ca7
      
https://github.com/qemu/qemu/commit/fb74a286feaa4ec2cdcda61ba570244464581ca7
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M include/qemu/coroutine.h
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  coroutine-sleep: disallow NULL QemuCoSleepState** argument

Simplify the code by removing conditionals.  qemu_co_sleep_ns
can simply point the argument to an on-stack temporary.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210517100548.28806-3-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: eaee0720851f22b273099eaf4c02722d9f24340a
      
https://github.com/qemu/qemu/commit/eaee0720851f22b273099eaf4c02722d9f24340a
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M block/block-copy.c
    M block/nbd.c
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  coroutine-sleep: allow qemu_co_sleep_wake that wakes nothing

All callers of qemu_co_sleep_wake are checking whether they are passing
a NULL argument inside the pointer-to-pointer: do the check in
qemu_co_sleep_wake itself.

As a side effect, qemu_co_sleep_wake can be called more than once and
it will only wake the coroutine once; after the first time, the argument
will be set to NULL via *sleep_state->user_state_pointer.  However, this
would not be safe unless co_sleep_cb keeps using the QemuCoSleepState*
directly, so make it go through the pointer-to-pointer instead.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210517100548.28806-4-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 1485f0c24cfbef7a542ce13d49e9f68e285c57d8
      
https://github.com/qemu/qemu/commit/1485f0c24cfbef7a542ce13d49e9f68e285c57d8
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  coroutine-sleep: move timer out of QemuCoSleepState

This simplification is enabled by the previous patch.  Now aio_co_wake
will only be called once, therefore we do not care about a spurious
firing of the timer after a qemu_co_sleep_wake.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210517100548.28806-5-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 29a6ea24eb85d8400df1607a9e11d0ef9ec5e88d
      
https://github.com/qemu/qemu/commit/29a6ea24eb85d8400df1607a9e11d0ef9ec5e88d
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M block/block-copy.c
    M block/nbd.c
    M include/qemu/coroutine.h
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  coroutine-sleep: replace QemuCoSleepState pointer with struct in the API

Right now, users of qemu_co_sleep_ns_wakeable are simply passing
a pointer to QemuCoSleepState by reference to the function.  But
QemuCoSleepState really is just a Coroutine*; making the
content of the struct public is just as efficient and lets us
skip the user_state_pointer indirection.

Since the usage is changed, take the occasion to rename the
struct to QemuCoSleep.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210517100548.28806-6-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 0a6f0c76a030710780ce10d6347a70f098024d21
      
https://github.com/qemu/qemu/commit/0a6f0c76a030710780ce10d6347a70f098024d21
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M include/qemu/coroutine.h
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  coroutine-sleep: introduce qemu_co_sleep

Allow using QemuCoSleep to sleep forever until woken by qemu_co_sleep_wake.
This makes the logic of qemu_co_sleep_ns_wakeable easy to understand.

In the future we will introduce an API that can work even if the
sleep and wake happen from different threads.  For now, initializing
w->to_wake after timer_mod is fine because the timer can only fire in
the same AioContext.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210517100548.28806-7-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 0dab1d36f55c3ed649bb8e4c74b9269ef3a63049
      
https://github.com/qemu/qemu/commit/0dab1d36f55c3ed649bb8e4c74b9269ef3a63049
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-05-24 (Mon, 24 May 2021)

  Changed paths:
    M block/block-copy.c
    M block/nbd.c
    M hw/remote/memory.c
    M hw/remote/proxy.c
    M include/qemu/bitops.h
    M include/qemu/coroutine.h
    M util/qemu-coroutine-sleep.c

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/stefanha-gitlab/tags/block-pull-request' into staging

Pull request

(Resent due to an email preparation mistake.)

# gpg: Signature made Mon 24 May 2021 14:01:42 BST
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha-gitlab/tags/block-pull-request:
  coroutine-sleep: introduce qemu_co_sleep
  coroutine-sleep: replace QemuCoSleepState pointer with struct in the API
  coroutine-sleep: move timer out of QemuCoSleepState
  coroutine-sleep: allow qemu_co_sleep_wake that wakes nothing
  coroutine-sleep: disallow NULL QemuCoSleepState** argument
  coroutine-sleep: use a stack-allocated timer
  bitops.h: Improve find_xxx_bit() documentation
  multi-process: Initialize variables declared with g_auto*

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/371ebfe28600...0dab1d36f55c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]