[PATCH v2 00/13] resolve hangs/crashes on libvirtd shutdown

Nikolay Shirokovskiy posted 13 patches 3 weeks ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1595499253-584162-1-git-send-email-nshirokovskiy@virtuozzo.com
scripts/check-drivername.py   |   2 +
src/driver-state.h            |   8 ++++
src/libvirt.c                 |  42 ++++++++++++++++
src/libvirt_internal.h        |   2 +
src/libvirt_private.syms      |   4 ++
src/libvirt_remote.syms       |   2 +-
src/qemu/qemu_domain.c        |  18 +++++--
src/qemu/qemu_driver.c        |  32 +++++++++++++
src/qemu/qemu_process.c       |   3 --
src/remote/remote_daemon.c    |   6 +--
src/rpc/virnetdaemon.c        | 109 ++++++++++++++++++++++++++++++++++++------
src/rpc/virnetdaemon.h        |   8 +++-
src/rpc/virnetserver.c        |   8 ++++
src/rpc/virnetserver.h        |   1 +
src/rpc/virnetserverservice.c |   1 -
src/util/vireventthread.c     |   1 +
src/util/virthreadpool.c      |  65 +++++++++++++++++--------
src/util/virthreadpool.h      |   6 +--
18 files changed, 267 insertions(+), 51 deletions(-)

[PATCH v2 00/13] resolve hangs/crashes on libvirtd shutdown

Posted by Nikolay Shirokovskiy 3 weeks ago
I keep qemu VM event loop exiting synchronously but add code to avoid deadlock
that can be caused by this approach. I guess it is worth having synchronous
exiting of threads in this case to avoid crashes.

Patches that are already positively reviewed has appropriate 'Reviewed-by' lines.

Changes from v1:
- rename stateShutdown to state stateShutdownPrepare
- introduce net daemon shutdown callbacks
- make some adjustments in terms of qemu per VM's event loop thread
  finishing
- factor out net server shutdown facilities into distinct patch
- increase shutdown timeout from 15s to 30s

Nikolay Shirokovskiy (13):
  libvirt: add stateShutdownPrepare/stateShutdownWait to drivers
  util: always initialize priority condition
  util: add stop/drain functions to thread pool
  rpc: don't unref service ref on socket behalf twice
  rpc: add virNetDaemonSetShutdownCallbacks
  rpc: add shutdown facilities to netserver
  rpc: finish all threads before exiting main loop
  qemu: don't shutdown event thread in monitor EOF callback
  vireventthread: exit thread synchronously on finalize
  qemu: avoid deadlock in qemuDomainObjStopWorker
  qemu: implement driver's shutdown/shutdown wait methods
  rpc: cleanup virNetDaemonClose method
  util: remove unused virThreadPoolNew macro

 scripts/check-drivername.py   |   2 +
 src/driver-state.h            |   8 ++++
 src/libvirt.c                 |  42 ++++++++++++++++
 src/libvirt_internal.h        |   2 +
 src/libvirt_private.syms      |   4 ++
 src/libvirt_remote.syms       |   2 +-
 src/qemu/qemu_domain.c        |  18 +++++--
 src/qemu/qemu_driver.c        |  32 +++++++++++++
 src/qemu/qemu_process.c       |   3 --
 src/remote/remote_daemon.c    |   6 +--
 src/rpc/virnetdaemon.c        | 109 ++++++++++++++++++++++++++++++++++++------
 src/rpc/virnetdaemon.h        |   8 +++-
 src/rpc/virnetserver.c        |   8 ++++
 src/rpc/virnetserver.h        |   1 +
 src/rpc/virnetserverservice.c |   1 -
 src/util/vireventthread.c     |   1 +
 src/util/virthreadpool.c      |  65 +++++++++++++++++--------
 src/util/virthreadpool.h      |   6 +--
 18 files changed, 267 insertions(+), 51 deletions(-)

-- 
1.8.3.1

Re: [PATCH v2 00/13] resolve hangs/crashes on libvirtd shutdown

Posted by Nikolay Shirokovskiy 1 week ago
polite ping

On 23.07.2020 13:14, Nikolay Shirokovskiy wrote:
> I keep qemu VM event loop exiting synchronously but add code to avoid deadlock
> that can be caused by this approach. I guess it is worth having synchronous
> exiting of threads in this case to avoid crashes.
> 
> Patches that are already positively reviewed has appropriate 'Reviewed-by' lines.
> 
> Changes from v1:
> - rename stateShutdown to state stateShutdownPrepare
> - introduce net daemon shutdown callbacks
> - make some adjustments in terms of qemu per VM's event loop thread
>   finishing
> - factor out net server shutdown facilities into distinct patch
> - increase shutdown timeout from 15s to 30s
> 
> Nikolay Shirokovskiy (13):
>   libvirt: add stateShutdownPrepare/stateShutdownWait to drivers
>   util: always initialize priority condition
>   util: add stop/drain functions to thread pool
>   rpc: don't unref service ref on socket behalf twice
>   rpc: add virNetDaemonSetShutdownCallbacks
>   rpc: add shutdown facilities to netserver
>   rpc: finish all threads before exiting main loop
>   qemu: don't shutdown event thread in monitor EOF callback
>   vireventthread: exit thread synchronously on finalize
>   qemu: avoid deadlock in qemuDomainObjStopWorker
>   qemu: implement driver's shutdown/shutdown wait methods
>   rpc: cleanup virNetDaemonClose method
>   util: remove unused virThreadPoolNew macro
> 
>  scripts/check-drivername.py   |   2 +
>  src/driver-state.h            |   8 ++++
>  src/libvirt.c                 |  42 ++++++++++++++++
>  src/libvirt_internal.h        |   2 +
>  src/libvirt_private.syms      |   4 ++
>  src/libvirt_remote.syms       |   2 +-
>  src/qemu/qemu_domain.c        |  18 +++++--
>  src/qemu/qemu_driver.c        |  32 +++++++++++++
>  src/qemu/qemu_process.c       |   3 --
>  src/remote/remote_daemon.c    |   6 +--
>  src/rpc/virnetdaemon.c        | 109 ++++++++++++++++++++++++++++++++++++------
>  src/rpc/virnetdaemon.h        |   8 +++-
>  src/rpc/virnetserver.c        |   8 ++++
>  src/rpc/virnetserver.h        |   1 +
>  src/rpc/virnetserverservice.c |   1 -
>  src/util/vireventthread.c     |   1 +
>  src/util/virthreadpool.c      |  65 +++++++++++++++++--------
>  src/util/virthreadpool.h      |   6 +--
>  18 files changed, 267 insertions(+), 51 deletions(-)
>