Re: [RFC] /dev/ioasid uAPI proposal
From: Alex Williamson
Date: Mon Jun 07 2021 - 20:30:42 EST
On Mon, 7 Jun 2021 20:03:53 -0300
Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
> On Mon, Jun 07, 2021 at 01:41:28PM -0600, Alex Williamson wrote:
>
> > > Compatibility is important, but when I look in the kernel code I see
> > > very few places that call wbinvd(). Basically all DRM for something
> > > relavent to qemu.
> > >
> > > That tells me that the vast majority of PCI devices do not generate
> > > no-snoop traffic.
> >
> > Unfortunately, even just looking at devices across a couple laptops
> > most devices do support and have NoSnoop+ set by default.
>
> Yes, mine too, but that doesn't mean the device is issuing nosnoop
> transactions, it just means the OS is allowing it to do so if it wants.
>
> As I said, without driver support the feature cannot be used, and
> there is no driver support in Linux outside DRM, unless it is
> hidden.. Certainly I've never run into it..
>
> Even mlx5 is setting the nosnoop bit, but I have a fairly high
> confidence that we don't set the TLP bit for anything Linux does.
>
> > It's not safe for QEMU to make an assumption that only GPUs will
> > actually make use of it.
>
> Not 100% safe, but if you know you are running Linux OS in the VM you
> can look at the drivers the devices need and make a determination.
QEMU doesn't know what guest it's running or what driver the guest is
using. QEMU can only create safe configurations by default, the same
as done now using vfio. Anything outside of that scope would require
experimental opt-in support by the user or a guarantee from the device
vendor that the device cannot ever (not just for the existing drivers)
create non-coherent TLPs. Thanks,
Alex
> > Yes, QEMU can reject a hot-unplug event, but then QEMU retains the
> > privilege that the device grants it. Releasing the device and
> > retaining the privileged gained by it seems wrong. Thanks,
>
> It is not completely ideal, but it is such a simplification, and I
> can't really see a drawback..
>
> Jason
>