On Thu, Jul 14, 2022 at 12:16:16PM +0200, Hanna Reitz wrote: > On 08.07.22 06:17, Stefan Hajnoczi wrote: > > Register guest RAM using BlockRAMRegistrar and set the > > BDRV_REQ_REGISTERED_BUF flag so block drivers can optimize memory > > accesses in I/O requests. > > > > This is for vdpa-blk, vhost-user-blk, and other I/O interfaces that rely > > on DMA mapping/unmapping. > > > > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > > --- > > include/hw/virtio/virtio-blk.h | 2 ++ > > hw/block/virtio-blk.c | 13 +++++++++---- > > 2 files changed, 11 insertions(+), 4 deletions(-) > > Seems fair, but as said on patch 5, I’m quite wary of “register guest RAM”. > How can we guarantee that it won’t be too fragmented to be registerable with > either nvme.c or blkio.c?
We can't guarantee it. blkio instances have a maximum number of mappings and we might exceed it. This patch doesn't have a smart solution. Smart solutions are possible, but I haven't had time to work on one yet. It is necessary to keep track of which mappings are referenced by in-flight requests. When the maximum number of mappings is hit, a mapping that currently has no references can be evicted to make space. When the maximum number of mappings is reached by in-flight requests then new requests may have to wait. Until we hit the maximum number of mappings in the real world this doesn't matter. Stefan
signature.asc
Description: PGP signature