qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 0891ee: HACKING: document #include order


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 0891ee: HACKING: document #include order
Date: Thu, 05 Jan 2017 06:00:06 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 0891ee111217101bce683e30ed9f08cf0cfcffd7
      
https://github.com/qemu/qemu/commit/0891ee111217101bce683e30ed9f08cf0cfcffd7
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M HACKING

  Log Message:
  -----------
  HACKING: document #include order

It was not obvious to me why "qemu/osdep.h" must be the first #include.
This documents the rationale and the overall #include order.

Cc: Fam Zheng <address@hidden>
Cc: Markus Armbruster <address@hidden>
Cc: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 721671ade77f4046b45893fbb7864ca84b9504cd
      
https://github.com/qemu/qemu/commit/721671ade77f4046b45893fbb7864ca84b9504cd
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M aio-posix.c
    M aio-win32.c
    M async.c
    M include/block/aio.h

  Log Message:
  -----------
  aio: add flag to skip fds to aio_dispatch()

Polling mode will not call ppoll(2)/epoll_wait(2).  Therefore we know
there are no fds ready and should avoid looping over fd handlers in
aio_dispatch().

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: f6a51c84cdc97e0178aab7690788d3891d2fcf0a
      
https://github.com/qemu/qemu/commit/f6a51c84cdc97e0178aab7690788d3891d2fcf0a
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M aio-posix.c
    M async.c
    M block/curl.c
    M block/iscsi.c
    M block/linux-aio.c
    M block/nbd-client.c
    M block/nfs.c
    M block/sheepdog.c
    M block/ssh.c
    M block/win32-aio.c
    M hw/virtio/virtio.c
    M include/block/aio.h
    M iohandler.c
    M nbd/server.c
    M stubs/set-fd-handler.c
    M tests/test-aio.c
    M util/event_notifier-posix.c

  Log Message:
  -----------
  aio: add AioPollFn and io_poll() interface

The new AioPollFn io_poll() argument to aio_set_fd_handler() and
aio_set_event_handler() is used in the next patch.

Keep this code change separate due to the number of files it touches.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 4a1cba3802554a3b077d436002519ff1fb0c18bf
      
https://github.com/qemu/qemu/commit/4a1cba3802554a3b077d436002519ff1fb0c18bf
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M aio-posix.c
    M aio-win32.c
    M async.c
    M include/block/aio.h
    M trace-events

  Log Message:
  -----------
  aio: add polling mode to AioContext

The AioContext event loop uses ppoll(2) or epoll_wait(2) to monitor file
descriptors or until a timer expires.  In cases like virtqueues, Linux
AIO, and ThreadPool it is technically possible to wait for events via
polling (i.e. continuously checking for events without blocking).

Polling can be faster than blocking syscalls because file descriptors,
the process scheduler, and system calls are bypassed.

The main disadvantage to polling is that it increases CPU utilization.
In classic polling configuration a full host CPU thread might run at
100% to respond to events as quickly as possible.  This patch implements
a timeout so we fall back to blocking syscalls if polling detects no
activity.  After the timeout no CPU cycles are wasted on polling until
the next event loop iteration.

The run_poll_handlers_begin() and run_poll_handlers_end() trace events
are added to aid performance analysis and troubleshooting.  If you need
to know whether polling mode is being used, trace these events to find
out.

Note that the AioContext is now re-acquired before disabling notify_me
in the non-polling case.  This makes the code cleaner since notify_me
was enabled outside the non-polling AioContext release region.  This
change is correct since it's safe to keep notify_me enabled longer
(disabling is an optimization) but potentially causes unnecessary
event_notifer_set() calls.  I think the chance of performance regression
is small here.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 0062ea0fd601c21f5c7b0d9bd1147fe216010c31
      
https://github.com/qemu/qemu/commit/0062ea0fd601c21f5c7b0d9bd1147fe216010c31
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M hw/virtio/virtio.c

  Log Message:
  -----------
  virtio: poll virtqueues for new buffers

Add an AioContext poll handler to detect new virtqueue buffers without
waiting for a guest->host notification.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: ee68697551cd81186c5b12eba10c158350cf1165
      
https://github.com/qemu/qemu/commit/ee68697551cd81186c5b12eba10c158350cf1165
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M block/linux-aio.c

  Log Message:
  -----------
  linux-aio: poll ring for completions

The Linux AIO userspace ABI includes a ring that is shared with the
kernel.  This allows userspace programs to process completions without
system calls.

Add an AioContext poll handler to check for completions in the ring.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 0d9d86fb4df4882ba4ad9968efe81eca1c7b7c90
      
https://github.com/qemu/qemu/commit/0d9d86fb4df4882ba4ad9968efe81eca1c7b7c90
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M include/sysemu/iothread.h
    M iothread.c

  Log Message:
  -----------
  iothread: add polling parameters

Poll mode can be configured with -object iothread,poll-max-ns=NUM.
Polling is disabled with a value of 0 nanoseconds.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 9ef9d40261cc05c01545f46b49dddfe39602e1c8
      
https://github.com/qemu/qemu/commit/9ef9d40261cc05c01545f46b49dddfe39602e1c8
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M hw/block/virtio-blk.c

  Log Message:
  -----------
  virtio-blk: suppress virtqueue kick during processing

The guest does not need to kick the virtqueue while we are processing
it.  This reduces the number of vmexits during periods of heavy I/O.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 23425cc2b7a9de7ade132399ca146b882ac4d72b
      
https://github.com/qemu/qemu/commit/23425cc2b7a9de7ade132399ca146b882ac4d72b
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M hw/scsi/virtio-scsi.c

  Log Message:
  -----------
  virtio-scsi: suppress virtqueue kick during processing

The guest does not need to kick the virtqueue while we are processing
it.  This reduces the number of vmexits during periods of heavy I/O.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: aff8fd18f1786fc5af259a9bc0077727222f51ca
      
https://github.com/qemu/qemu/commit/aff8fd18f1786fc5af259a9bc0077727222f51ca
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M hw/virtio/virtio.c

  Log Message:
  -----------
  virtio: turn vq->notification into a nested counter

Polling should disable virtqueue notifications but that requires nested
virtio_queue_set_notification() calls.  Turn vq->notification into a
counter so it is possible to do nesting.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 684e508c23d28af8d6ed2c62738a0f60447c8274
      
https://github.com/qemu/qemu/commit/684e508c23d28af8d6ed2c62738a0f60447c8274
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M aio-posix.c
    M aio-win32.c
    M include/block/aio.h

  Log Message:
  -----------
  aio: add .io_poll_begin/end() callbacks

The begin and end callbacks can be used to prepare for the polling loop
and clean up when polling stops.  Note that they may only be called once
for multiple aio_poll() calls if polling continues to succeed.  Once
polling fails the end callback is invoked before aio_poll() resumes file
descriptor monitoring.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: a7c8215e3bbcdd3b5dbaabfcecf236d4a9880558
      
https://github.com/qemu/qemu/commit/a7c8215e3bbcdd3b5dbaabfcecf236d4a9880558
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M hw/virtio/virtio.c

  Log Message:
  -----------
  virtio: disable virtqueue notifications during polling

This is a performance optimization to eliminate vmexits during polling.
It also avoids spurious ioeventfd processing after polling ends.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 82a41186941c419afde977f477f19c545b40c1c5
      
https://github.com/qemu/qemu/commit/82a41186941c419afde977f477f19c545b40c1c5
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M aio-posix.c
    M aio-win32.c
    M async.c
    M include/block/aio.h
    M iothread.c
    M trace-events

  Log Message:
  -----------
  aio: self-tune polling time

This patch is based on the algorithm for the kvm.ko halt_poll_ns
parameter in Linux.  The initial polling time is zero.

If the event loop is woken up within the maximum polling time it means
polling could be effective, so grow polling time.

If the event loop is woken up beyond the maximum polling time it means
polling is not effective, so shrink polling time.

If the event loop makes progress within the current polling time then
the sweet spot has been reached.

This algorithm adjusts the polling time so it can adapt to variations in
workloads.  The goal is to reach the sweet spot while also recognizing
when polling would hurt more than help.

Two new trace events, poll_grow and poll_shrink, are added for observing
polling time adjustment.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 5e5db49953e31689c1c70060870f0a7a6de26fcb
      
https://github.com/qemu/qemu/commit/5e5db49953e31689c1c70060870f0a7a6de26fcb
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-01-03 (Tue, 03 Jan 2017)

  Changed paths:
    M include/sysemu/iothread.h
    M iothread.c

  Log Message:
  -----------
  iothread: add poll-grow and poll-shrink parameters

These parameters control the poll time self-tuning algorithm.  They are
optional and will default to sane values if omitted.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: e92fbc753df4fab9ee524b5ea07a51bee8b6bae4
      
https://github.com/qemu/qemu/commit/e92fbc753df4fab9ee524b5ea07a51bee8b6bae4
  Author: Peter Maydell <address@hidden>
  Date:   2017-01-05 (Thu, 05 Jan 2017)

  Changed paths:
    M HACKING
    M aio-posix.c
    M aio-win32.c
    M async.c
    M block/curl.c
    M block/iscsi.c
    M block/linux-aio.c
    M block/nbd-client.c
    M block/nfs.c
    M block/sheepdog.c
    M block/ssh.c
    M block/win32-aio.c
    M hw/block/virtio-blk.c
    M hw/scsi/virtio-scsi.c
    M hw/virtio/virtio.c
    M include/block/aio.h
    M include/sysemu/iothread.h
    M iohandler.c
    M iothread.c
    M nbd/server.c
    M stubs/set-fd-handler.c
    M tests/test-aio.c
    M trace-events
    M util/event_notifier-posix.c

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

# gpg: Signature made Wed 04 Jan 2017 13:29:09 GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>"
# gpg:                 aka "Stefan Hajnoczi <address@hidden>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  iothread: add poll-grow and poll-shrink parameters
  aio: self-tune polling time
  virtio: disable virtqueue notifications during polling
  aio: add .io_poll_begin/end() callbacks
  virtio: turn vq->notification into a nested counter
  virtio-scsi: suppress virtqueue kick during processing
  virtio-blk: suppress virtqueue kick during processing
  iothread: add polling parameters
  linux-aio: poll ring for completions
  virtio: poll virtqueues for new buffers
  aio: add polling mode to AioContext
  aio: add AioPollFn and io_poll() interface
  aio: add flag to skip fds to aio_dispatch()
  HACKING: document #include order

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/9c904a7581d6...e92fbc753df4

reply via email to

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