[PATCH] vhost: disable VHOST_OPS_DEBUG by default

Zhu Lingshan posted 1 patch 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230717174405.293668-1-lingshan.zhu@intel.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
hw/virtio/vhost.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[PATCH] vhost: disable VHOST_OPS_DEBUG by default
Posted by Zhu Lingshan 9 months, 2 weeks ago
This commit disables VHOST_OPS_DEBUG by default
These information are ususally only required in development
environment

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 hw/virtio/vhost.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 82394331bf..ec435a3079 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -29,7 +29,9 @@
 #include "trace.h"
 
 /* enabled until disconnected backend stabilizes */
-#define _VHOST_DEBUG 1
+
+/* uncomment macro _VHOST_DEBUG to enable VHOST_OPS_DEBUG */
+/* #define _VHOST_DEBUG 1 */
 
 #ifdef _VHOST_DEBUG
 #define VHOST_OPS_DEBUG(retval, fmt, ...) \
@@ -1318,7 +1320,10 @@ static void vhost_virtqueue_error_notifier(EventNotifier *n)
     struct vhost_virtqueue *vq = container_of(n, struct vhost_virtqueue,
                                               error_notifier);
     struct vhost_dev *dev = vq->dev;
+
+#ifdef _VHOST_DEBUG
     int index = vq - dev->vqs;
+#endif
 
     if (event_notifier_test_and_clear(n) && dev->vdev) {
         VHOST_OPS_DEBUG(-EINVAL,  "vhost vring error in virtqueue %d",
-- 
2.39.3
Re: [PATCH] vhost: disable VHOST_OPS_DEBUG by default
Posted by Philippe Mathieu-Daudé 9 months, 2 weeks ago
Hi,

On 17/7/23 19:44, Zhu Lingshan wrote:
> This commit disables VHOST_OPS_DEBUG by default
> These information are ususally only required in development
> environment
> 
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> ---
>   hw/virtio/vhost.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 82394331bf..ec435a3079 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -29,7 +29,9 @@
>   #include "trace.h"
>   
>   /* enabled until disconnected backend stabilizes */
> -#define _VHOST_DEBUG 1
> +
> +/* uncomment macro _VHOST_DEBUG to enable VHOST_OPS_DEBUG */
> +/* #define _VHOST_DEBUG 1 */

Since you are looking at this, it would be more useful to
convert VHOST_OPS_DEBUG() to trace events (see for example
commit 163b8663b8 and other "Convert DPRINTF() debug macro
to trace events" commits).

Regards,

Phil.
Re: [PATCH] vhost: disable VHOST_OPS_DEBUG by default
Posted by Zhu, Lingshan 9 months, 2 weeks ago

On 7/17/2023 6:14 PM, Philippe Mathieu-Daudé wrote:
> Hi,
>
> On 17/7/23 19:44, Zhu Lingshan wrote:
>> This commit disables VHOST_OPS_DEBUG by default
>> These information are ususally only required in development
>> environment
>>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> ---
>>   hw/virtio/vhost.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>> index 82394331bf..ec435a3079 100644
>> --- a/hw/virtio/vhost.c
>> +++ b/hw/virtio/vhost.c
>> @@ -29,7 +29,9 @@
>>   #include "trace.h"
>>     /* enabled until disconnected backend stabilizes */
>> -#define _VHOST_DEBUG 1
>> +
>> +/* uncomment macro _VHOST_DEBUG to enable VHOST_OPS_DEBUG */
>> +/* #define _VHOST_DEBUG 1 */
>
> Since you are looking at this, it would be more useful to
> convert VHOST_OPS_DEBUG() to trace events (see for example
> commit 163b8663b8 and other "Convert DPRINTF() debug macro
> to trace events" commits).
Thanks Phil, I will look into this
>
> Regards,
>
> Phil.
>