qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 40003a: Introduce event-loop-base abstract cl


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 40003a: Introduce event-loop-base abstract class
Date: Thu, 05 May 2022 08:18:48 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 40003a3997df83abf155955efc6ac05817ebc95c
      
https://github.com/qemu/qemu/commit/40003a3997df83abf155955efc6ac05817ebc95c
  Author: Nicolas Saenz Julienne <nsaenzju@redhat.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    A event-loop-base.c
    A include/sysemu/event-loop-base.h
    M include/sysemu/iothread.h
    M iothread.c
    M meson.build
    M qapi/qom.json

  Log Message:
  -----------
  Introduce event-loop-base abstract class

Introduce the 'event-loop-base' abstract class, it'll hold the
properties common to all event loops and provide the necessary hooks for
their creation and maintenance. Then have iothread inherit from it.

EventLoopBaseClass is defined as user creatable and provides a hook for
its children to attach themselves to the user creatable class 'complete'
function. It also provides an update_params() callback to propagate
property changes onto its children.

The new 'event-loop-base' class will live in the root directory. It is
built on its own using the 'link_whole' option (there are no direct
function dependencies between the class and its children, it all happens
trough 'constructor' magic). And also imposes new compilation
dependencies:

    qom <- event-loop-base <- blockdev (iothread.c)

And in subsequent patches:

    qom <- event-loop-base <- qemuutil (util/main-loop.c)

All this forced some amount of reordering in meson.build:

 - Moved qom build definition before qemuutil. Doing it the other way
   around (i.e. moving qemuutil after qom) isn't possible as a lot of
   core libraries that live in between the two depend on it.

 - Process the 'hw' subdir earlier, as it introduces files into the
   'qom' source set.

No functional changes intended.

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20220425075723.20019-2-nsaenzju@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: af4c7a1db8721e9ee85e37eb0f6b8f8a59947096
      
https://github.com/qemu/qemu/commit/af4c7a1db8721e9ee85e37eb0f6b8f8a59947096
  Author: Nicolas Saenz Julienne <nsaenzju@redhat.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M event-loop-base.c
    M include/qemu/main-loop.h
    M include/sysemu/event-loop-base.h
    M meson.build
    M qapi/qom.json
    M util/main-loop.c

  Log Message:
  -----------
  util/main-loop: Introduce the main loop into QOM

'event-loop-base' provides basic property handling for all 'AioContext'
based event loops. So let's define a new 'MainLoopClass' that inherits
from it. This will permit tweaking the main loop's properties through
qapi as well as through the command line using the '-object' keyword[1].
Only one instance of 'MainLoopClass' might be created at any time.

'EventLoopBaseClass' learns a new callback, 'can_be_deleted()' so as to
mark 'MainLoop' as non-deletable.

[1] For example:
      -object main-loop,id=main-loop,aio-max-batch=<value>

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20220425075723.20019-3-nsaenzju@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: bef2e050d6a7feb865854c65570c496ac5a8cf53
      
https://github.com/qemu/qemu/commit/bef2e050d6a7feb865854c65570c496ac5a8cf53
  Author: Nicolas Saenz Julienne <nsaenzju@redhat.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M event-loop-base.c
    M include/block/aio.h
    M include/block/thread-pool.h
    M include/sysemu/event-loop-base.h
    M iothread.c
    M qapi/qom.json
    M util/aio-posix.c
    M util/async.c
    M util/main-loop.c
    M util/thread-pool.c

  Log Message:
  -----------
  util/event-loop-base: Introduce options to set the thread pool size

The thread pool regulates itself: when idle, it kills threads until
empty, when in demand, it creates new threads until full. This behaviour
doesn't play well with latency sensitive workloads where the price of
creating a new thread is too high. For example, when paired with qemu's
'-mlock', or using safety features like SafeStack, creating a new thread
has been measured take multiple milliseconds.

In order to mitigate this let's introduce a new 'EventLoopBase'
property to set the thread pool size. The threads will be created during
the pool's initialization or upon updating the property's value, remain
available during its lifetime regardless of demand, and destroyed upon
freeing it. A properly characterized workload will then be able to
configure the pool to avoid any latency spikes.

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20220425075723.20019-4-nsaenzju@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


  Commit: 4914670da35ea977b75375f4424668e4f7d66234
      
https://github.com/qemu/qemu/commit/4914670da35ea977b75375f4424668e4f7d66234
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-05-05 (Thu, 05 May 2022)

  Changed paths:
    A event-loop-base.c
    M include/block/aio.h
    M include/block/thread-pool.h
    M include/qemu/main-loop.h
    A include/sysemu/event-loop-base.h
    M include/sysemu/iothread.h
    M iothread.c
    M meson.build
    M qapi/qom.json
    M util/aio-posix.c
    M util/async.c
    M util/main-loop.c
    M util/thread-pool.c

  Log Message:
  -----------
  Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into 
staging

Pull request

Add new thread-pool-min/thread-pool-max parameters to control the thread pool
used for async I/O.

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmJzjdsACgkQnKSrs4Gr
# c8girQf/Y2t6W8oabGJrh4pUYPV/YMcjspxWnMWLoggU/qv0vkjUQ6ZsppobCVTp
# /YuIsiAJUr2/65qf13SZ2CrK/g86zr9ACVzHqa5/ZIPQwv9yE1epyJLf/Nq5RidU
# ZcntNzLar+x8i/nToGylqYHjJtyQu7+anf6EHblw8xv80xDUWatsbiwor7ckl8iC
# d/52tAmyHYxy9ako/z9axxfnhcb9tBc1yHrfDJtwNQzV+u8abeCoLM2T/i59Dl74
# 9qzpR8e4qjbg+q9U8MlsbRbnPM2e3LmR/MFCu5mHbMolxj+1lJIGmJCWzFK/Xw/c
# J2asU5eynWNOIaiCnFHJhFdA0zgtSg==
# =L7qN
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 05 May 2022 03:42:03 AM CDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  util/event-loop-base: Introduce options to set the thread pool size
  util/main-loop: Introduce the main loop into QOM
  Introduce event-loop-base abstract class

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/8fff209577fb...4914670da35e



reply via email to

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