From: Stefan Hajnoczi <stefanha@redhat.com>
To: Hanna Reitz <hreitz@redhat.com>
Cc: qemu-devel@nongnu.org, "Alberto Faria" <afaria@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
sgarzare@redhat.com,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-block@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>,
"Vladimir Sementsov-Ogievskiy" <v.sementsov-og@mail.ru>,
"John Snow" <jsnow@redhat.com>, "Thomas Huth" <thuth@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Fam Zheng" <fam@euphon.net>,
"Yanan Wang" <wangyanan55@huawei.com>
Subject: Re: [RFC v3 5/8] block: add BlockRAMRegistrar
Date: Wed, 17 Aug 2022 16:51:41 -0400 [thread overview]
Message-ID: <Yv1U3diLPyXF1coa@fedora> (raw)
In-Reply-To: <9ec50e0f-46b1-8e44-6891-dbfb983cee1f@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2650 bytes --]
On Thu, Jul 14, 2022 at 11:30:11AM +0200, Hanna Reitz wrote:
> On 08.07.22 06:17, Stefan Hajnoczi wrote:
> > Emulated devices and other BlockBackend users wishing to take advantage
> > of blk_register_buf() all have the same repetitive job: register
> > RAMBlocks with the BlockBackend using RAMBlockNotifier.
> >
> > Add a BlockRAMRegistrar API to do this. A later commit will use this
> > from hw/block/virtio-blk.c.
> >
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> > MAINTAINERS | 1 +
> > include/sysemu/block-ram-registrar.h | 30 +++++++++++++++++++++
> > block/block-ram-registrar.c | 39 ++++++++++++++++++++++++++++
> > block/meson.build | 1 +
> > 4 files changed, 71 insertions(+)
> > create mode 100644 include/sysemu/block-ram-registrar.h
> > create mode 100644 block/block-ram-registrar.c
>
> What memory is handled in ram_list? Is it everything? If so, won’t devices
> have trouble registering all those buffer, especially if they happen to be
> fragmented in physical memory? (nvme_register_buf() seems to say it can run
> out of slots quite easily.)
I replied to this in another sub-thread. You are right, there is a
possibility of running out of mappings and there's no smart resource
management at the moment.
>
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 50f340d9ee..d16189449f 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -2490,6 +2490,7 @@ F: block*
> > F: block/
> > F: hw/block/
> > F: include/block/
> > +F: include/sysemu/block-*.h
> > F: qemu-img*
> > F: docs/tools/qemu-img.rst
> > F: qemu-io*
>
> Sneaky. ;)
>
> > diff --git a/include/sysemu/block-ram-registrar.h b/include/sysemu/block-ram-registrar.h
> > new file mode 100644
> > index 0000000000..09d63f64b2
> > --- /dev/null
> > +++ b/include/sysemu/block-ram-registrar.h
> > @@ -0,0 +1,30 @@
> > +/*
> > + * BlockBackend RAM Registrar
> > + *
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + */
> > +
> > +#ifndef BLOCK_RAM_REGISTRAR_H
> > +#define BLOCK_RAM_REGISTRAR_H
> > +
> > +#include "exec/ramlist.h"
> > +
> > +/**
> > + * struct BlockRAMRegistrar:
> > + *
> > + * Keeps RAMBlock memory registered with a BlockBackend using
> > + * blk_register_buf() including hotplugged memory.
> > + *
> > + * Emulated devices or other BlockBackend users initialize a BlockRAMRegistrar
> > + * with blk_ram_registrar_init() before submitting I/O requests with the
> > + * BLK_REQ_REGISTERED_BUF flag set.
>
> s/BLK/BDRV/, right?
Thanks, fixed!
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-08-17 20:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 4:17 [RFC v3 0/8] blkio: add libblkio BlockDriver Stefan Hajnoczi
2022-07-08 4:17 ` [RFC v3 1/8] blkio: add io_uring block driver using libblkio Stefan Hajnoczi
2022-07-12 14:23 ` Stefano Garzarella
2022-08-11 16:51 ` Stefan Hajnoczi
2022-07-13 12:05 ` Hanna Reitz
2022-08-11 19:08 ` Stefan Hajnoczi
2022-07-27 19:33 ` Kevin Wolf
2022-08-03 12:25 ` Peter Krempa
2022-08-03 13:30 ` Kevin Wolf
2022-08-11 19:09 ` Stefan Hajnoczi
2022-07-08 4:17 ` [RFC v3 2/8] numa: call ->ram_block_removed() in ram_block_notifer_remove() Stefan Hajnoczi
2022-07-08 4:17 ` [RFC v3 3/8] block: pass size to bdrv_unregister_buf() Stefan Hajnoczi
2022-07-13 14:08 ` Hanna Reitz
2022-07-08 4:17 ` [RFC v3 4/8] block: add BDRV_REQ_REGISTERED_BUF request flag Stefan Hajnoczi
2022-07-14 8:54 ` Hanna Reitz
2022-08-17 20:46 ` Stefan Hajnoczi
2022-07-08 4:17 ` [RFC v3 5/8] block: add BlockRAMRegistrar Stefan Hajnoczi
2022-07-14 9:30 ` Hanna Reitz
2022-08-17 20:51 ` Stefan Hajnoczi [this message]
2022-07-08 4:17 ` [RFC v3 6/8] stubs: add memory_region_from_host() and memory_region_get_fd() Stefan Hajnoczi
2022-07-14 9:39 ` Hanna Reitz
2022-07-08 4:17 ` [RFC v3 7/8] blkio: implement BDRV_REQ_REGISTERED_BUF optimization Stefan Hajnoczi
2022-07-12 14:28 ` Stefano Garzarella
2022-08-15 20:52 ` Stefan Hajnoczi
2022-07-14 10:13 ` Hanna Reitz
2022-08-18 19:46 ` Stefan Hajnoczi
2022-07-08 4:17 ` [RFC v3 8/8] virtio-blk: use BDRV_REQ_REGISTERED_BUF optimization hint Stefan Hajnoczi
2022-07-14 10:16 ` Hanna Reitz
2022-08-15 21:24 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yv1U3diLPyXF1coa@fedora \
--to=stefanha@redhat.com \
--cc=afaria@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=f4bug@amsat.org \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=thuth@redhat.com \
--cc=v.sementsov-og@mail.ru \
--cc=vsementsov@yandex-team.ru \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.