<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bwlp/qemu.git/include/block/throttle-groups.h, branch spice_video_codecs</title>
<subtitle>Experimental fork of QEMU with video encoding patches</subtitle>
<id>https://git.openslx.org/bwlp/qemu.git/atom/include/block/throttle-groups.h?h=spice_video_codecs</id>
<link rel='self' href='https://git.openslx.org/bwlp/qemu.git/atom/include/block/throttle-groups.h?h=spice_video_codecs'/>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/'/>
<updated>2021-02-03T14:14:00+00:00</updated>
<entry>
<title>block/throttle-groups: throttle_group_co_io_limits_intercept(): 64bit bytes</title>
<updated>2021-02-03T14:14:00+00:00</updated>
<author>
<name>Vladimir Sementsov-Ogievskiy</name>
</author>
<published>2020-12-11T18:39:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=801625e69d947b0f9291d77bb1deb7545525c66d'/>
<id>urn:sha1:801625e69d947b0f9291d77bb1deb7545525c66d</id>
<content type='text'>
The function is called from 64bit io handlers, and bytes is just passed
to throttle_account() which is 64bit too (unsigned though). So, let's
convert intermediate argument to 64bit too.

This patch is a first in the 64-bit-blocklayer series, so we are
generally moving to int64_t for both offset and bytes parameters on all
io paths. Main motivation is realization of 64-bit write_zeroes
operation for fast zeroing large disk chunks, up to the whole disk.

We chose signed type, to be consistent with off_t (which is signed) and
with possibility for signed return type (where negative value means
error).

Patch-correctness audit by Eric Blake:

  Caller has 32-bit, this patch now causes widening which is safe:
  block/block-backend.c: blk_do_preadv() passes 'unsigned int'
  block/block-backend.c: blk_do_pwritev_part() passes 'unsigned int'
  block/throttle.c: throttle_co_pwrite_zeroes() passes 'int'
  block/throttle.c: throttle_co_pdiscard() passes 'int'

  Caller has 64-bit, this patch fixes potential bug where pre-patch
  could narrow, except it's easy enough to trace that callers are still
  capped at 2G actions:
  block/throttle.c: throttle_co_preadv() passes 'uint64_t'
  block/throttle.c: throttle_co_pwritev() passes 'uint64_t'

  Implementation in question: block/throttle-groups.c
  throttle_group_co_io_limits_intercept() takes 'unsigned int bytes'
  and uses it: argument to util/throttle.c throttle_account(uint64_t)

  All safe: it patches a latent bug, and does not introduce any 64-bit
  gotchas once throttle_co_p{read,write}v are relaxed, and assuming
  throttle_account() is not buggy.

Signed-off-by: Vladimir Sementsov-Ogievskiy &lt;vsementsov@virtuozzo.com&gt;
Reviewed-by: Eric Blake &lt;eblake@redhat.com&gt;
Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Message-Id: &lt;20201211183934.169161-7-vsementsov@virtuozzo.com&gt;
Signed-off-by: Eric Blake &lt;eblake@redhat.com&gt;
</content>
</entry>
<entry>
<title>Use OBJECT_DECLARE_SIMPLE_TYPE when possible</title>
<updated>2020-09-18T18:12:32+00:00</updated>
<author>
<name>Eduardo Habkost</name>
</author>
<published>2020-09-16T18:25:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=8063396bf3459a810d24e3efd6110b8480f0de5b'/>
<id>urn:sha1:8063396bf3459a810d24e3efd6110b8480f0de5b</id>
<content type='text'>
This converts existing DECLARE_INSTANCE_CHECKER usage to
OBJECT_DECLARE_SIMPLE_TYPE when possible.

$ ./scripts/codeconverter/converter.py -i \
  --pattern=AddObjectDeclareSimpleType $(git grep -l '' -- '*.[ch]')

Signed-off-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
Acked-by: Paul Durrant &lt;paul@xen.org&gt;
Message-Id: &lt;20200916182519.415636-6-ehabkost@redhat.com&gt;
Signed-off-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
</content>
</entry>
<entry>
<title>Use DECLARE_*CHECKER* macros</title>
<updated>2020-09-09T13:27:09+00:00</updated>
<author>
<name>Eduardo Habkost</name>
</author>
<published>2020-08-31T21:07:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=8110fa1d94f2997badc2af39231a1d279c5bb1ee'/>
<id>urn:sha1:8110fa1d94f2997badc2af39231a1d279c5bb1ee</id>
<content type='text'>
Generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]')

Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
Reviewed-by: Juan Quintela &lt;quintela@redhat.com&gt;
Message-Id: &lt;20200831210740.126168-12-ehabkost@redhat.com&gt;
Reviewed-by: Juan Quintela &lt;quintela@redhat.com&gt;
Message-Id: &lt;20200831210740.126168-13-ehabkost@redhat.com&gt;
Message-Id: &lt;20200831210740.126168-14-ehabkost@redhat.com&gt;
Signed-off-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
</content>
</entry>
<entry>
<title>Move QOM typedefs and add missing includes</title>
<updated>2020-09-09T13:26:43+00:00</updated>
<author>
<name>Eduardo Habkost</name>
</author>
<published>2020-09-03T20:43:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=db1015e92e04835c9eb50c29625fe566d1202dbd'/>
<id>urn:sha1:db1015e92e04835c9eb50c29625fe566d1202dbd</id>
<content type='text'>
Some typedefs and macros are defined after the type check macros.
This makes it difficult to automatically replace their
definitions with OBJECT_DECLARE_TYPE.

Patch generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]')

which will split "typdef struct { ... } TypedefName"
declarations.

Followed by:

 $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \
    $(git grep -l '' -- '*.[ch]')

which will:
- move the typedefs and #defines above the type check macros
- add missing #include "qom/object.h" lines if necessary

Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
Reviewed-by: Juan Quintela &lt;quintela@redhat.com&gt;
Message-Id: &lt;20200831210740.126168-9-ehabkost@redhat.com&gt;
Reviewed-by: Juan Quintela &lt;quintela@redhat.com&gt;
Message-Id: &lt;20200831210740.126168-10-ehabkost@redhat.com&gt;
Message-Id: &lt;20200831210740.126168-11-ehabkost@redhat.com&gt;
Signed-off-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
</content>
</entry>
<entry>
<title>throttle-groups: Move ThrottleGroup typedef to header</title>
<updated>2020-08-27T18:04:54+00:00</updated>
<author>
<name>Eduardo Habkost</name>
</author>
<published>2020-08-25T19:20:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=7c9dcd6cabfa96ea2a89dd12041f3e63aa20a09c'/>
<id>urn:sha1:7c9dcd6cabfa96ea2a89dd12041f3e63aa20a09c</id>
<content type='text'>
Move typedef closer to the type check macros, to make it easier
to convert the code to OBJECT_DEFINE_TYPE() in the future.

Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Reviewed-by: Daniel P. Berrangé &lt;berrange@redhat.com&gt;
Signed-off-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
Tested-By: Roman Bolshakov &lt;r.bolshakov@yadro.com&gt;
Message-Id: &lt;20200825192110.3528606-17-ehabkost@redhat.com&gt;
Signed-off-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
</content>
</entry>
<entry>
<title>throttle-groups: fix restart coroutine iothread race</title>
<updated>2019-01-24T10:02:28+00:00</updated>
<author>
<name>Stefan Hajnoczi</name>
</author>
<published>2019-01-14T13:32:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=bc19a0a6e4505390f99d3c593ebaf11b7962cc59'/>
<id>urn:sha1:bc19a0a6e4505390f99d3c593ebaf11b7962cc59</id>
<content type='text'>
The following QMP command leads to a crash when iothreads are used:

  { 'execute': 'device_del', 'arguments': {'id': 'data'} }

The backtrace involves the queue restart coroutine where
tgm-&gt;throttle_state is a NULL pointer because
throttle_group_unregister_tgm() has already been called:

  (gdb) bt full
  #0  0x00005585a7a3b378 in qemu_mutex_lock_impl (mutex=0xffffffffffffffd0, file=0x5585a7bb3d54 "block/throttle-groups.c", line=412) at util/qemu-thread-posix.c:64
        err = &lt;optimized out&gt;
        __PRETTY_FUNCTION__ = "qemu_mutex_lock_impl"
        __func__ = "qemu_mutex_lock_impl"
  #1  0x00005585a79be074 in throttle_group_restart_queue_entry (opaque=0x5585a9de4eb0) at block/throttle-groups.c:412
        _f = &lt;optimized out&gt;
        data = 0x5585a9de4eb0
        tgm = 0x5585a9079440
        ts = 0x0
        tg = 0xffffffffffffff98
        is_write = false
        empty_queue = 255

This coroutine should not execute in the iothread after the throttle
group member has been unregistered!

The root cause is that the device_del code path schedules the restart
coroutine in the iothread while holding the AioContext lock.  Therefore
the iothread cannot execute the coroutine until after device_del
releases the lock - by this time it's too late.

This patch adds a reference count to ThrottleGroupMember so we can
synchronously wait for restart coroutines to complete.  Once they are
done it is safe to unregister the ThrottleGroupMember.

Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Message-id: 20190114133257.30299-2-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: add throttle block filter driver</title>
<updated>2017-09-06T08:12:02+00:00</updated>
<author>
<name>Manos Pitsidianakis</name>
</author>
<published>2017-08-25T13:20:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=d8e7d87ec49c1458f516d50d109b3f201da736a1'/>
<id>urn:sha1:d8e7d87ec49c1458f516d50d109b3f201da736a1</id>
<content type='text'>
block/throttle.c uses existing I/O throttle infrastructure inside a
block filter driver. I/O operations are intercepted in the filter's
read/write coroutines, and referred to block/throttle-groups.c

The driver can be used with the syntax
-drive driver=throttle,file.filename=foo.qcow2,throttle-group=bar

which registers the throttle filter node with the ThrottleGroup 'bar'. The
given group must be created beforehand with object-add or -object.

Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Signed-off-by: Manos Pitsidianakis &lt;el13635@mail.ntua.gr&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: convert ThrottleGroup to object with QOM</title>
<updated>2017-09-05T16:12:21+00:00</updated>
<author>
<name>Manos Pitsidianakis</name>
</author>
<published>2017-08-25T13:20:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=432d889e55e2614bd0e8bb559af18a61ac217565'/>
<id>urn:sha1:432d889e55e2614bd0e8bb559af18a61ac217565</id>
<content type='text'>
ThrottleGroup is converted to an object. This will allow the future
throttle block filter drive easy creation and configuration of throttle
groups in QMP and cli.

A new QAPI struct, ThrottleLimits, is introduced to provide a shared
struct for all throttle configuration needs in QMP.

ThrottleGroups can be created via CLI as
    -object throttle-group,id=foo,x-iops-total=100,x-..
where x-* are individual limit properties. Since we can't add non-scalar
properties in -object this interface must be used instead. However,
setting these properties must be disabled after initialization because
certain combinations of limits are forbidden and thus configuration
changes should be done in one transaction. The individual properties
will go away when support for non-scalar values in CLI is implemented
and thus are marked as experimental.

ThrottleGroup also has a `limits` property that uses the ThrottleLimits
struct.  It can be used to create ThrottleGroups or set the
configuration in existing groups as follows:

{ "execute": "object-add",
  "arguments": {
    "qom-type": "throttle-group",
    "id": "foo",
    "props" : {
      "limits": {
          "iops-total": 100
      }
    }
  }
}
{ "execute" : "qom-set",
    "arguments" : {
        "path" : "foo",
        "property" : "limits",
        "value" : {
            "iops-total" : 99
        }
    }
}

This also means a group's configuration can be fetched with qom-get.

Signed-off-by: Manos Pitsidianakis &lt;el13635@mail.ntua.gr&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: add aio_context field in ThrottleGroupMember</title>
<updated>2017-09-05T14:47:52+00:00</updated>
<author>
<name>Manos Pitsidianakis</name>
</author>
<published>2017-08-25T13:20:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=c61791fc23ecd96e6a1e038c379c4033ffd5f40c'/>
<id>urn:sha1:c61791fc23ecd96e6a1e038c379c4033ffd5f40c</id>
<content type='text'>
timer_cb() needs to know about the current Aio context of the throttle
request that is woken up. In order to make ThrottleGroupMember backend
agnostic, this information is stored in an aio_context field instead of
accessing it from BlockBackend.

Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Manos Pitsidianakis &lt;el13635@mail.ntua.gr&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
<entry>
<title>block: move ThrottleGroup membership to ThrottleGroupMember</title>
<updated>2017-09-05T14:47:51+00:00</updated>
<author>
<name>Manos Pitsidianakis</name>
</author>
<published>2017-08-25T13:20:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.openslx.org/bwlp/qemu.git/commit/?id=022cdc9f407434ad6eb7ace80362a1218a009bcc'/>
<id>urn:sha1:022cdc9f407434ad6eb7ace80362a1218a009bcc</id>
<content type='text'>
This commit eliminates the 1:1 relationship between BlockBackend and
throttle group state.  Users will be able to create multiple throttle
nodes, each with its own throttle group state, in the future.  The
throttle group state cannot be per-BlockBackend anymore, it must be
per-throttle node. This is done by gathering ThrottleGroup membership
details from BlockBackendPublic into ThrottleGroupMember and refactoring
existing code to use the structure.

Reviewed-by: Alberto Garcia &lt;berto@igalia.com&gt;
Reviewed-by: Stefan Hajnoczi &lt;stefanha@redhat.com&gt;
Signed-off-by: Manos Pitsidianakis &lt;el13635@mail.ntua.gr&gt;
Signed-off-by: Kevin Wolf &lt;kwolf@redhat.com&gt;
</content>
</entry>
</feed>
