Re: [PATCH] vhost: add support for mandatory barriers

From: Vincent Whitchurch
Date: Tue Aug 24 2021 - 03:23:11 EST


On Mon, Aug 23, 2021 at 11:19:56PM +0200, Michael S. Tsirkin wrote:
> On Mon, Aug 23, 2021 at 10:14:37AM +0200, Vincent Whitchurch wrote:
> > vhost always uses SMP-conditional barriers, but these may not be
> > sufficient when vhost is used to communicate between heterogeneous
> > processors in an AMP configuration, especially since they're NOPs on
> > !SMP builds.
> >
> > To solve this, use the virtio_*() barrier functions and ask them for
> > non-weak barriers if requested by userspace.
> >
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@xxxxxxxx>
>
> I am inclined to say let's (ab)use VIRTIO_F_ORDER_PLATFORM for this.
> Jason what do you think?

OK, thanks, I'll look into that.

> Also is the use of DMA variants really the intended thing here? Could
> you point me at some examples please?

I'm using this on an ARM-based SoC. The main processor is a Cortex-A53
(arm64) and this processor runs the virtio drivers. The SoC also has
another processor which is a Cortex-A5 (arm32) and this processor runs
the virtio device end using vhost. There is no coherency between these
two processors and to each other they look like any other DMA-capable
hardware.