[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181213154616.GM23318@stefanha-x1.localdomain>
Date: Thu, 13 Dec 2018 15:46:16 +0000
From: Stefan Hajnoczi <stefanha@...hat.com>
To: jiangyiwen <jiangyiwen@...wei.com>
Cc: David Miller <davem@...emloft.net>, mst@...hat.com,
jasowang@...hat.com, netdev@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer
in host
On Thu, Dec 13, 2018 at 03:42:33PM +0800, jiangyiwen wrote:
> On 2018/12/13 13:59, David Miller wrote:
> > From: jiangyiwen <jiangyiwen@...wei.com>
> > Date: Thu, 13 Dec 2018 11:11:48 +0800
> >
> >> I hope Host can fill fewer bytes into rx virtqueue, so
> >> I keep structure virtio_vsock_mrg_rxbuf_hdr one byte
> >> alignment.
> >
> > The question is if this actully matters.
> >
> > Do you know?
> >
> > If the obejct this is embeeded inside of is at least 2 byte aligned,
> > you are marking it packed for nothing.
> >
> > There are only %100 downsides to using the packed attribute.
> >
> > Simply define your datastructures properly, with fixed sized types,
> > and all padding defined explicitly.
> >
> > .
> >
>
> Hi David,
>
> Thanks a lot, I need to send number buffers from Host to Guest, so I think
> we need to keep the structure size the same between host and guest.
> But after your reminder, I feel my code may exist a serious problem,
> that in mergeable mode, I send the total structure virtio_vsock_pkt
> from Host to Guest, however, this structure size may be different
> under different compilers (Guest and Host are different). Then, Guest
> may parse the wrong packet length.
>
> David, I want to ask if there is such a problem?
>
> In addition, why I send total virtio_vsock_pkt structure from Host to Guest?
> - In order to avoid to allocate virtio_vsock_pkt memory when receiving
> packets, in case of insufficient memory, it may have some advantages, and
> we may keep consistent with old version.
Yes, virtio_vsock_pkt is internal driver state and should not be part of
the host<->guest interface (also for security reasons it's not good to
expose internal state structs across the interface).
Stefan
Download attachment "signature.asc" of type "application/pgp-signature" (456 bytes)
Powered by blists - more mailing lists