Hi Juraj,

On Thursday, October 02, 2025 16:45 CEST, Juraj Marcin <[email protected]> 
wrote:

> Hi Marco,
> 
> On 2025-10-01 18:18, Marco Cavenati wrote:
> > Enable the use of the mapped-ram migration feature with savevm/loadvm
> > snapshots by adding the QIO_CHANNEL_FEATURE_SEEKABLE feature to
> > QIOChannelBlock. Implement io_preadv and io_pwritev methods to provide
> > positioned I/O capabilities that don't modify the channel's position
> > pointer.
> > 
> > Signed-off-by: Marco Cavenati <[email protected]>
> > ---
> >  migration/channel-block.c | 48 +++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> > 
> > diff --git a/migration/channel-block.c b/migration/channel-block.c
> > index 97de5a691b..30dcefcd8e 100644
> > --- a/migration/channel-block.c
> > +++ b/migration/channel-block.c
> > @@ -30,6 +30,7 @@ qio_channel_block_new(BlockDriverState *bs)
> >      QIOChannelBlock *ioc;
> >  
> >      ioc = QIO_CHANNEL_BLOCK(object_new(TYPE_QIO_CHANNEL_BLOCK));
> > +    qio_channel_set_feature(QIO_CHANNEL(ioc), 
> > QIO_CHANNEL_FEATURE_SEEKABLE);
> >  
> >      bdrv_ref(bs);
> >      ioc->bs = bs;
> > @@ -96,6 +97,49 @@ qio_channel_block_writev(QIOChannel *ioc,
> >      return qiov.size;
> >  }
> >  
> > +#ifdef CONFIG_PREADV
> 
> I don't think this conditional macro is necessary here. QIOChannelFile
> needs it because it directly uses preadv() syscall which might not be
> available on all systems (see when CONFIG_PREADV is defined below).
> 
>     config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: 
> '#include <sys/uio.h>'))
> 
> However, bdrv_readv_vmstate() (wrapper of bdrv_co_readv_vmstate())
> should be always available IUUC (it is not conditionally compiled based
> on if preadv() syscall is available).

You are right, thanks for pointing this out, I will remove the macro in the
next iteration.

Just to make sure nothing weird happens without preadv support and without the
macro guard, I compiled QEMU without them and indeed it looks like snapshots
are not supported at all without preadv. savevm/loadvm gracefully fail
independently of mapped-ram on/off.

Best regards,
Marco


Reply via email to