* Victor Kaplansky (vkapl...@redhat.com) wrote:
> From: Victor Kaplansky <vkaplans@dell9020.localdomain>
> 
> If we allow qemu to change logging area after it was already established,
> it may require from the backend to acquire a lock on each access to
> the log_base, which has a potential quite a big performance hit.
> 
> Thus we would like to clarify in the spec, that qemu is not expected
> to resize or remap the logging area, and backend implementations
> can safely ignore subsequent requests to log_base modifications.

There's quite a bit of code in vhost to cope with changes in mappings
of regions; and there's already code in there to handle log size
changes:

static inline void vhost_dev_log_resize(struct vhost_dev *dev, uint64_t size)
{
    struct vhost_log *log = vhost_log_get(size, vhost_dev_log_is_shared(dev));
    uint64_t log_base = (uintptr_t)log->log;
    int r;

    /* inform backend of log switching, this must be done before
       releasing the current log, to ensure no logging is lost */
    r = dev->vhost_ops->vhost_set_log_base(dev, log_base, log);

so when is a log resize legal?

Dave

> Signed-off-by: Victor Kaplansky <vkapl...@redhat.com>
> Suggested-by: Maxime Coquelin <maxime.coque...@redhat.com>
> ---
>  docs/interop/vhost-user.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/docs/interop/vhost-user.txt b/docs/interop/vhost-user.txt
> index 954771d0d8..7ab31e57ef 100644
> --- a/docs/interop/vhost-user.txt
> +++ b/docs/interop/vhost-user.txt
> @@ -257,6 +257,12 @@ Where addr is the guest physical address.
>  
>  Use atomic operations, as the log may be concurrently manipulated.
>  
> +Note that master is not expected to issue more than one 
> VHOST_USER_SET_LOG_BASE
> +request before the rings are fully stopped by the master. Thus no 
> modifications
> +to log_base address are allowed before the rings are restated and the client
> +can ignore all subsequent VHOST_USER_SET_LOG_BASE requests after the log_base
> +address has been established.
> +
>  Note that when logging modifications to the used ring (when VHOST_VRING_F_LOG
>  is set for this ring), log_guest_addr should be used to calculate the log
>  offset: the write to first byte of the used ring is logged at this offset 
> from
> -- 
> 2.14.2
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to