net/virtio: improve logs in Vhost-vDPA DMA mapping

Message ID 20201118080817.669343-1-maxime.coquelin@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series net/virtio: improve logs in Vhost-vDPA DMA mapping |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-testing warning Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot warning Travis build: failed

Commit Message

Maxime Coquelin Nov. 18, 2020, 8:08 a.m. UTC
  This patch adds debug logs in vhost_vdpa_dma_map() and
vhost_vdpa_dma_unmap() to ease debugging.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_user/vhost_vdpa.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Chenbo Xia Nov. 19, 2020, 8:36 a.m. UTC | #1
Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, November 18, 2020 4:08 PM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; amorenoz@redhat.com
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH] net/virtio: improve logs in Vhost-vDPA DMA mapping
> 
> This patch adds debug logs in vhost_vdpa_dma_map() and
> vhost_vdpa_dma_unmap() to ease debugging.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  drivers/net/virtio/virtio_user/vhost_vdpa.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c
> b/drivers/net/virtio/virtio_user/vhost_vdpa.c
> index c7b9349fc8..528ff60f29 100644
> --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
> +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
> @@ -93,6 +93,9 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
>  	msg.iotlb.size = len;
>  	msg.iotlb.perm = VHOST_ACCESS_RW;
> 
> +	PMD_DRV_LOG(DEBUG, "%s: iova: 0x%" PRIx64 ", addr: %p, len: 0x%" PRIx64,
> +			__func__, iova, addr, len);

Use PRIx64 to print size_t (len in this case)will cause compile errors in i686.
Should we use %zx ?

> +
>  	if (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
>  		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
>  				strerror(errno));
> @@ -113,6 +116,9 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev,
> __rte_unused void *addr,
>  	msg.iotlb.iova = iova;
>  	msg.iotlb.size = len;
> 
> +	PMD_DRV_LOG(DEBUG, "%s: iova: 0x%" PRIx64 ", len: 0x%" PRIx64,
> +			__func__, iova, len);
> +

Ditto.

Thanks!
Chenbo

>  	if (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
>  		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
>  				strerror(errno));
> --
> 2.26.2
  
Maxime Coquelin Jan. 5, 2021, 3:31 p.m. UTC | #2
On 11/19/20 9:36 AM, Xia, Chenbo wrote:
> Hi Maxime,
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Wednesday, November 18, 2020 4:08 PM
>> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; amorenoz@redhat.com
>> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Subject: [PATCH] net/virtio: improve logs in Vhost-vDPA DMA mapping
>>
>> This patch adds debug logs in vhost_vdpa_dma_map() and
>> vhost_vdpa_dma_unmap() to ease debugging.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>>  drivers/net/virtio/virtio_user/vhost_vdpa.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c
>> b/drivers/net/virtio/virtio_user/vhost_vdpa.c
>> index c7b9349fc8..528ff60f29 100644
>> --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
>> +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
>> @@ -93,6 +93,9 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
>>  	msg.iotlb.size = len;
>>  	msg.iotlb.perm = VHOST_ACCESS_RW;
>>
>> +	PMD_DRV_LOG(DEBUG, "%s: iova: 0x%" PRIx64 ", addr: %p, len: 0x%" PRIx64,
>> +			__func__, iova, addr, len);
> 
> Use PRIx64 to print size_t (len in this case)will cause compile errors in i686.
> Should we use %zx ?
> 
>> +
>>  	if (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
>>  		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
>>  				strerror(errno));
>> @@ -113,6 +116,9 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev,
>> __rte_unused void *addr,
>>  	msg.iotlb.iova = iova;
>>  	msg.iotlb.size = len;
>>
>> +	PMD_DRV_LOG(DEBUG, "%s: iova: 0x%" PRIx64 ", len: 0x%" PRIx64,
>> +			__func__, iova, len);
>> +
> 
> Ditto.

Indeed, will fix it

Thanks,
Maxime

> Thanks!
> Chenbo
> 
>>  	if (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
>>  		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
>>  				strerror(errno));
>> --
>> 2.26.2
>
  

Patch

diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c
index c7b9349fc8..528ff60f29 100644
--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
@@ -93,6 +93,9 @@  vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
 	msg.iotlb.size = len;
 	msg.iotlb.perm = VHOST_ACCESS_RW;
 
+	PMD_DRV_LOG(DEBUG, "%s: iova: 0x%" PRIx64 ", addr: %p, len: 0x%" PRIx64,
+			__func__, iova, addr, len);
+
 	if (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
 				strerror(errno));
@@ -113,6 +116,9 @@  vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,
 	msg.iotlb.iova = iova;
 	msg.iotlb.size = len;
 
+	PMD_DRV_LOG(DEBUG, "%s: iova: 0x%" PRIx64 ", len: 0x%" PRIx64,
+			__func__, iova, len);
+
 	if (write(dev->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
 				strerror(errno));