All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use pr_warn_ratelimited() for vq_err()
@ 2021-01-15 17:37 John Levon
  2021-01-18  2:55   ` Jason Wang
  2021-02-22 11:29 ` [PATCH v2] " John Levon
  0 siblings, 2 replies; 5+ messages in thread
From: John Levon @ 2021-01-15 17:37 UTC (permalink / raw)
  To: levon, virtualization, kvm, jasowang, mst; +Cc: John Levon

vq_err() is used to report various failure states in vhost code, but by
default uses pr_debug(), and as a result doesn't record anything unless
enabled via dynamic debug. We'll change this so we get something recorded
in the log in these failure cases. Guest VMs (and userspace) can trigger
some of these messages, so we want to use the pr_warn_ratelimited()
variant.

Signed-off-by: John Levon <john.levon@nutanix.com>
---
 drivers/vhost/vhost.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index b063324c7669..cb4ef78c84ba 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -228,10 +228,10 @@ int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);
 void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
 			  struct vhost_iotlb_map *map);
 
-#define vq_err(vq, fmt, ...) do {                                  \
-		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
-		if ((vq)->error_ctx)                               \
-				eventfd_signal((vq)->error_ctx, 1);\
+#define vq_err(vq, fmt, ...) do {                                \
+		pr_warn_ratelimited(pr_fmt(fmt), ##__VA_ARGS__); \
+		if ((vq)->error_ctx)                             \
+			eventfd_signal((vq)->error_ctx, 1);      \
 	} while (0)
 
 enum {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] use pr_warn_ratelimited() for vq_err()
  2021-01-15 17:37 [PATCH] use pr_warn_ratelimited() for vq_err() John Levon
@ 2021-01-18  2:55   ` Jason Wang
  2021-02-22 11:29 ` [PATCH v2] " John Levon
  1 sibling, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-01-18  2:55 UTC (permalink / raw)
  To: John Levon, levon, virtualization, kvm, mst


On 2021/1/16 上午1:37, John Levon wrote:
> vq_err() is used to report various failure states in vhost code, but by
> default uses pr_debug(), and as a result doesn't record anything unless
> enabled via dynamic debug. We'll change this so we get something recorded
> in the log in these failure cases. Guest VMs (and userspace) can trigger
> some of these messages, so we want to use the pr_warn_ratelimited()
> variant.


It looks to me KVM also use pr_warn_ratelimited().

So

Acked-by: Jason Wang <jasowang@redhat.com>



>
> Signed-off-by: John Levon <john.levon@nutanix.com>
> ---
>   drivers/vhost/vhost.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index b063324c7669..cb4ef78c84ba 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -228,10 +228,10 @@ int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);
>   void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
>   			  struct vhost_iotlb_map *map);
>   
> -#define vq_err(vq, fmt, ...) do {                                  \
> -		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
> -		if ((vq)->error_ctx)                               \
> -				eventfd_signal((vq)->error_ctx, 1);\
> +#define vq_err(vq, fmt, ...) do {                                \
> +		pr_warn_ratelimited(pr_fmt(fmt), ##__VA_ARGS__); \
> +		if ((vq)->error_ctx)                             \
> +			eventfd_signal((vq)->error_ctx, 1);      \
>   	} while (0)
>   
>   enum {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] use pr_warn_ratelimited() for vq_err()
@ 2021-01-18  2:55   ` Jason Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-01-18  2:55 UTC (permalink / raw)
  To: John Levon, levon, virtualization, kvm, mst


On 2021/1/16 上午1:37, John Levon wrote:
> vq_err() is used to report various failure states in vhost code, but by
> default uses pr_debug(), and as a result doesn't record anything unless
> enabled via dynamic debug. We'll change this so we get something recorded
> in the log in these failure cases. Guest VMs (and userspace) can trigger
> some of these messages, so we want to use the pr_warn_ratelimited()
> variant.


It looks to me KVM also use pr_warn_ratelimited().

So

Acked-by: Jason Wang <jasowang@redhat.com>



>
> Signed-off-by: John Levon <john.levon@nutanix.com>
> ---
>   drivers/vhost/vhost.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index b063324c7669..cb4ef78c84ba 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -228,10 +228,10 @@ int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);
>   void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
>   			  struct vhost_iotlb_map *map);
>   
> -#define vq_err(vq, fmt, ...) do {                                  \
> -		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
> -		if ((vq)->error_ctx)                               \
> -				eventfd_signal((vq)->error_ctx, 1);\
> +#define vq_err(vq, fmt, ...) do {                                \
> +		pr_warn_ratelimited(pr_fmt(fmt), ##__VA_ARGS__); \
> +		if ((vq)->error_ctx)                             \
> +			eventfd_signal((vq)->error_ctx, 1);      \
>   	} while (0)
>   
>   enum {

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] use pr_warn_ratelimited() for vq_err()
  2021-01-15 17:37 [PATCH] use pr_warn_ratelimited() for vq_err() John Levon
  2021-01-18  2:55   ` Jason Wang
@ 2021-02-22 11:29 ` John Levon
  2021-02-23  8:15   ` David Edmondson
  1 sibling, 1 reply; 5+ messages in thread
From: John Levon @ 2021-02-22 11:29 UTC (permalink / raw)
  To: john.levon; +Cc: jasowang, kvm, levon, mst, virtualization

vq_err() is used to report various failure states in vhost code, but by
default uses pr_debug(), and as a result doesn't record anything unless
enabled via dynamic debug. We'll change this so we get something recorded
in the log in these failure cases. Guest VMs (and userspace) can trigger
some of these messages, so we want to use the pr_warn_ratelimited()
variant. However, on DEBUG kernels, we'd like to get everything, so we use
pr_warn() then.

Signed-off-by: John Levon <john.levon@nutanix.com>
---
v2: use pr_warn() for DEBUG kernels
---
 drivers/vhost/vhost.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index b063324c7669..10007bd49f84 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -228,10 +228,16 @@ int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);
 void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
 			  struct vhost_iotlb_map *map);
 
-#define vq_err(vq, fmt, ...) do {                                  \
-		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
-		if ((vq)->error_ctx)                               \
-				eventfd_signal((vq)->error_ctx, 1);\
+#ifdef DEBUG
+#define vq_pr_warn pr_warn
+#else
+#define vq_pr_warn pr_warn_ratelimited
+#endif
+
+#define vq_err(vq, fmt, ...) do {                                \
+		vq_pr_warn(pr_fmt(fmt), ##__VA_ARGS__);          \
+		if ((vq)->error_ctx)                             \
+			eventfd_signal((vq)->error_ctx, 1);      \
 	} while (0)
 
 enum {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] use pr_warn_ratelimited() for vq_err()
  2021-02-22 11:29 ` [PATCH v2] " John Levon
@ 2021-02-23  8:15   ` David Edmondson
  0 siblings, 0 replies; 5+ messages in thread
From: David Edmondson @ 2021-02-23  8:15 UTC (permalink / raw)
  To: John Levon, john.levon; +Cc: jasowang, kvm, levon, mst, virtualization

On Monday, 2021-02-22 at 11:29:47 GMT, John Levon wrote:

> vq_err() is used to report various failure states in vhost code, but by
> default uses pr_debug(), and as a result doesn't record anything unless
> enabled via dynamic debug. We'll change this so we get something recorded
> in the log in these failure cases. Guest VMs (and userspace) can trigger
> some of these messages, so we want to use the pr_warn_ratelimited()
> variant. However, on DEBUG kernels, we'd like to get everything, so we use
> pr_warn() then.
>
> Signed-off-by: John Levon <john.levon@nutanix.com>

Reviewed-by: David Edmondson <david.edmondson@oracle.com>

> ---
> v2: use pr_warn() for DEBUG kernels
> ---
>  drivers/vhost/vhost.h | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index b063324c7669..10007bd49f84 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -228,10 +228,16 @@ int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);
>  void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
>  			  struct vhost_iotlb_map *map);
>  
> -#define vq_err(vq, fmt, ...) do {                                  \
> -		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
> -		if ((vq)->error_ctx)                               \
> -				eventfd_signal((vq)->error_ctx, 1);\
> +#ifdef DEBUG
> +#define vq_pr_warn pr_warn
> +#else
> +#define vq_pr_warn pr_warn_ratelimited
> +#endif
> +
> +#define vq_err(vq, fmt, ...) do {                                \
> +		vq_pr_warn(pr_fmt(fmt), ##__VA_ARGS__);          \
> +		if ((vq)->error_ctx)                             \
> +			eventfd_signal((vq)->error_ctx, 1);      \
>  	} while (0)
>  
>  enum {
> -- 
> 2.25.1

dme.
-- 
Slow me down, it's getting away from me.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-23  8:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 17:37 [PATCH] use pr_warn_ratelimited() for vq_err() John Levon
2021-01-18  2:55 ` Jason Wang
2021-01-18  2:55   ` Jason Wang
2021-02-22 11:29 ` [PATCH v2] " John Levon
2021-02-23  8:15   ` David Edmondson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.