vhost-vdpa: print error when vhost_vdpa_alloc_domain fails
Subsystems (5)
PATCH 1/1 vhost-vdpa: print error when vhost_vdpa_alloc_domain fails
Add a print explaining why vhost_vdpa_alloc_domain failed if the device is not IOMMU cache coherent capable.
Without this print, we have no hint why the operation failed.
For example:
$ virsh start <domain> error: Failed to start domain <domain> error: Unable to open '/dev/vhost-vdpa-<idx>' for vdpa device: Unknown error 524
--- drivers/vhost/vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/vhost/vdpa.c +4 -1
@@ -1151,8 +1151,11 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)if (!bus)return -EFAULT ; -if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) +if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) { +dev_err (&v->dev, +"Failed to allocate domain, device is not IOMMU cache coherent capable\n" );return -ENOTSUPP ; + } v->domain =iommu_domain_alloc (bus);if (!v->domain)
Signature · 6 lines
2.34.1 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 7 lines · Alvaro Karsz
Add a print explaining why
vhost_vdpa_alloc_domainfailed if the device is not IOMMU cache coherent capable.Without this print, we have no hint why the operation failed.
For example:
Quoted 7 lines
$ virsh start <domain> error: Failed to start domain <domain> error: Unable to open '/dev/vhost-vdpa-<idx>' for vdpa device: Unknown error 524Suggested-by Eugenio Perez Martin <[email protected]>Signed-off-by Alvaro Karsz <[email protected]>
I'm not sure this is a good idea. Userspace is not supposed to be able to trigger dev_err.
Quoted 23 lines
--- drivers/vhost/vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/vhost/vdpa.c +4
-1@@ -1151,8 +1151,11 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)if (!bus)return -EFAULT ; -if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) +if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) { +dev_err (&v->dev, +"Failed to allocate domain, device is not IOMMU cache coherent capable\n" );return -ENOTSUPP ; + } v->domain =iommu_domain_alloc (bus);if (!v->domain)Signature · 1 line
2.34.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 2 lines
I'm not sure this is a good idea. Userspace is not supposed to be able to trigger
dev_err.
dev_warn then?
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 4 lines · Alvaro Karsz
Quoted 2 lines
I'm not sure this is a good idea. Userspace is not supposed to be able to trigger
dev_err.
dev_warnthen?
dev_warn_once is ok.
Signature · 6 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 3 lines
Quoted 1 line
dev_warnthen?
dev_warn_onceis ok.
Ok, thanks
I'll send a new version tomorrow.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
PATCH v2 1/1 vhost-vdpa: print warning when vhost_vdpa_alloc_domain fails
In reply to Alvaro KarszAdd a print explaining why vhost_vdpa_alloc_domain failed if the device is not IOMMU cache coherent capable.
Without this print, we have no hint why the operation failed.
For example:
$ virsh start <domain> error: Failed to start domain <domain> error: Unable to open '/dev/vhost-vdpa-<idx>' for vdpa device: Unknown error 524
---
v2:
- replace dev_err with dev_warn_once.
drivers/vhost/vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/vhost/vdpa.c +4 -1
@@ -1151,8 +1151,11 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)if (!bus)return -EFAULT ; -if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) +if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) { +dev_warn_once (&v->dev, +"Failed to allocate domain, device is not IOMMU cache coherent capable\n" );return -ENOTSUPP ; + } v->domain =iommu_domain_alloc (bus);if (!v->domain)
Signature · 1 line
2.34.1
Re: [PATCH v2] vhost-vdpa: print warning when vhost_vdpa_alloc_domain fails
Quoted 8 lines · Alvaro Karsz
Add a print explaining why
vhost_vdpa_alloc_domainfailed if the device is not IOMMU cache coherent capable.Without this print, we have no hint why the operation failed.
For example:
Quoted 8 lines
$ virsh start <domain> error: Failed to start domain <domain> error: Unable to open '/dev/vhost-vdpa-<idx>' for vdpa device: Unknown error 524Suggested-by Eugenio Perez Martin <[email protected]>Signed-off-by Alvaro Karsz <[email protected]>
Thanks!
Quoted 27 lines
---
v2:
- replacedev_errwithdev_warn_once.drivers/vhost/vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/vhost/vdpa.c +4
-2@@ -1151,8 +1151,11 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)if (!bus)return -EFAULT ; -if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) +if (!device_iommu_capable (dma_dev,IOMMU_CAP_CACHE_COHERENCY )) { +dev_warn_once (&v->dev, +"Failed to allocate domain, device is not IOMMU cache coherent capable\n" );return -ENOTSUPP ; + } v->domain =iommu_domain_alloc (bus);if (!v->domain) --2.34.1