Skip to contentSkip to conversation

drm/hyperv: Add ratelimit on error message

PATCH Applied Saurabh Sengar 4 participants 5 messages Sep 9, 2022 – Sep 29, 2022

Subsystems (5)
lore
Share & tools
lore

Saurabh Sengar

author maintainer
#0 lore raw

PATCH 1/1 drm/hyperv: Add ratelimit on error message

Due to a full ring buffer, the driver may be unable to send updates to the Hyper-V host. But outputing the error message can make the problem worse because console output is also typically written to the frame buffer.
Rate limiting the error message, also output the error code for additional diagnosability.

---
 drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1 -1
index 76a182a..013a782 100644
@@ -208,7 +208,7 @@ static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg
 			       VM_PKT_DATA_INBAND, 0);
 
 	if (ret)
-		drm_err(&hv->dev, "Unable to send packet via vmbus\n");
+		drm_err_ratelimited(&hv->dev, "Unable to send packet via vmbus; error %d\n", ret);
 
 	return ret;
 }
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw

From: Saurabh Sengar <[email protected]> Sent: Friday, September 9, 2022 8:10 AM

Quoted 29 lines

Due to a full ring buffer, the driver may be unable to send updates to the Hyper-V host. But outputing the error message can make the problem worse because console output is also typically written to the frame buffer.
Rate limiting the error message, also output the error code for additional diagnosability.

---
 drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0 -0
index 76a182a..013a782 100644
@@ -208,7 +208,7 @@ static inline int hyperv_sendpacket(struct hv_device *hdev,

struct synthvid_msg

drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1 -2
 			       VM_PKT_DATA_INBAND, 0);
 
 	if (ret)
-		drm_err(&hv->dev, "Unable to send packet via vmbus\n");
+		drm_err_ratelimited(&hv->dev, "Unable to send packet via vmbus; error %d\n", ret);
 
 	return ret;
 }
--
Quoted 1 line

1.8.3.1

#2 lore raw
In reply to Saurabh Sengar

Hi

Am 09.09.22 um 17:09 schrieb Saurabh Sengar:

Quoted 17 lines

Due to a full ring buffer, the driver may be unable to send updates to the Hyper-V host. But outputing the error message can make the problem worse because console output is also typically written to the frame buffer.
Rate limiting the error message, also output the error code for additional diagnosability.

---
  drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0 -0
index 76a182a..013a782 100644

drivers/gpu/drm/hyperv/hyperv_drm_proto.c static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg · line 211

Quoted 5 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1 -1
@@ -208,7 +208,7 @@ static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg
  			       VM_PKT_DATA_INBAND, 0);
 
  	if (ret)
-		drm_err(&hv->dev, "Unable to send packet via vmbus\n");
+		drm_err_ratelimited(&hv->dev, "Unable to send packet via vmbus; error %d\n", ret);

I better option would probably be drm_err_once(). Then you'd get the first error message and skip all others.

Best regards
Thomas

Quoted 3 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0 -0
  	return ret;
  }
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
author maintainer
#3 lore raw
Quoted 15 lines · Thomas Zimmermann

Hi

Am 09.09.22 um 17:09 schrieb Saurabh Sengar:

Quoted 12 lines

Due to a full ring buffer, the driver may be unable to send updates to the Hyper-V host. But outputing the error message can make the problem worse because console output is also typically written to the frame buffer.
Rate limiting the error message, also output the error code for additional diagnosability.

---
 drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/hyperv/hyperv_drm_proto.c static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg · line 210

Quoted 9 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1 -1
index 76a182a..013a782 100644
@@ -208,7 +208,7 @@ static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg
 			       VM_PKT_DATA_INBAND, 0);
 	if (ret)
-		drm_err(&hv->dev, "Unable to send packet via vmbus\n");
+		drm_err_ratelimited(&hv->dev, "Unable to send packet via vmbus; error %d\n", ret);

I better option would probably be drm_err_once(). Then you'd get the first error message and skip all others.

Thanks for your comment however the intention here is to limit the printk messages and break the chain rather then printing only once. There can be cases where at different point of time we again get a ring buffer full condition and we don't want to miss that. We should get the message for each of these errror which are widely-separated in time not just the first time.

Quoted 14 lines

Best regards
Thomas

Quoted 2 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +0 -0
 	return ret;
 }
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
maintainer Applied
#4 lore raw
Quoted 29 lines · Saurabh Singh Sengar
Quoted 15 lines · Thomas Zimmermann

Hi

Am 09.09.22 um 17:09 schrieb Saurabh Sengar:

Quoted 12 lines

Due to a full ring buffer, the driver may be unable to send updates to the Hyper-V host. But outputing the error message can make the problem worse because console output is also typically written to the frame buffer.
Rate limiting the error message, also output the error code for additional diagnosability.

---
 drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/hyperv/hyperv_drm_proto.c static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg · line 210

Quoted 9 lines
drivers/gpu/drm/hyperv/hyperv_drm_proto.c +1 -1
index 76a182a..013a782 100644
@@ -208,7 +208,7 @@ static inline int hyperv_sendpacket(struct hv_device *hdev, struct synthvid_msg
 			       VM_PKT_DATA_INBAND, 0);
 	if (ret)
-		drm_err(&hv->dev, "Unable to send packet via vmbus\n");
+		drm_err_ratelimited(&hv->dev, "Unable to send packet via vmbus; error %d\n", ret);

I better option would probably be drm_err_once(). Then you'd get the first error message and skip all others.

Quoted 4 lines

Thanks for your comment however the intention here is to limit the printk messages and break the chain rather then printing only once. There can be cases where at different point of time we again get a ring buffer full condition and we don't want to miss that. We should get the message for each of these errror which are widely-separated in time not just the first time.

Applied to hyperv-next. Thanks.