On Thu, Oct 20, 2022 at 11:58:34AM +0800, Jason Wang wrote:
> Haven't tried but I guess there would be some issue other than the
> suggested configuration "ats=on, device-iotlb=on"
> 
> So we have:
> 
> 1) ats=on, device-iotlb=on, this is the configuration that libvirt is
> using and it should work
> 2) ats=off, device-iotlb=on, in this case, the DEVICEIOTLB_UNMAP
> notifier will succeed but there won't be a device iotlb invalidation
> sent from guest, so we will meet errors since there's no way to flush
> device IOTLB. According to the PCIe spec, the device should still work
> (using untranslated transactions). In this case we probably need a way
> to detect if device page fault (ats) is enabled and fallback to UNMAP
> if it doesn't.

Yeah, agreed that we should not register to dev-iotlb notifier if ats is
off in the first place.  Maybe worth another patch.

> 3) ats=on, device-iotlb=off, in this case, without your patch, it
> won't work since the DEVICEIOTLB_UNMAP will succeed but guest won't
> enable ATS so there will be no IOTLB invalidation. With your patch, we
> fallback to UNMAP and I think it should then work
> 4) ats=off, device-iotlb=off, similar to 3), it won't work without
> your patch, but with your patch we fallback to UNMAP so it should
> work.

I think the current patch should still be correct, but maybe something else
is missing.  I'll add this one into the todo list but I'd be more than glad
if anyone can look into this too before that..  Or as Eric suggested to
detect such a mismatch before it's fixed, but then if we know they're not
working we should fail hard rather than a warning anymore.

Thanks,

-- 
Peter Xu


Reply via email to