Linux-HyperV List
 help / color / mirror / Atom feed
* [PATCH] drm/hyperv: Add ratelimit on error message
@ 2022-09-09 15:09 Saurabh Sengar
  2022-09-10 15:07 ` Michael Kelley (LINUX)
  2022-09-10 18:06 ` Thomas Zimmermann
  0 siblings, 2 replies; 5+ messages in thread
From: Saurabh Sengar @ 2022-09-09 15:09 UTC (permalink / raw)
  To: ssengar, drawat.floss, airlied, daniel, linux-hyperv, dri-devel,
	linux-kernel, mikelley

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.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
 drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
index 76a182a..013a782 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
@@ -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;
 }
-- 
1.8.3.1


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

* RE: [PATCH] drm/hyperv: Add ratelimit on error message
  2022-09-09 15:09 [PATCH] drm/hyperv: Add ratelimit on error message Saurabh Sengar
@ 2022-09-10 15:07 ` Michael Kelley (LINUX)
  2022-09-10 18:06 ` Thomas Zimmermann
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Kelley (LINUX) @ 2022-09-10 15:07 UTC (permalink / raw)
  To: Saurabh Sengar, Saurabh Singh Sengar, drawat.floss@gmail.com,
	airlied@linux.ie, daniel@ffwll.ch, linux-hyperv@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org

From: Saurabh Sengar <ssengar@linux.microsoft.com> Sent: Friday, September 9, 2022 8:10 AM
> 
> 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.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>  drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> index 76a182a..013a782 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> @@ -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;
>  }
> --
> 1.8.3.1

Reviewed-by: Michael Kelley <mikelley@microsoft.com>


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

* Re: [PATCH] drm/hyperv: Add ratelimit on error message
  2022-09-09 15:09 [PATCH] drm/hyperv: Add ratelimit on error message Saurabh Sengar
  2022-09-10 15:07 ` Michael Kelley (LINUX)
@ 2022-09-10 18:06 ` Thomas Zimmermann
  2022-09-11 16:11   ` Saurabh Singh Sengar
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Zimmermann @ 2022-09-10 18:06 UTC (permalink / raw)
  To: Saurabh Sengar, ssengar, drawat.floss, airlied, daniel,
	linux-hyperv, dri-devel, linux-kernel, mikelley


[-- Attachment #1.1: Type: text/plain, Size: 1475 bytes --]

Hi

Am 09.09.22 um 17:09 schrieb Saurabh Sengar:
> 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.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>   drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> index 76a182a..013a782 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> @@ -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

>   
>   	return ret;
>   }

-- 
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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH] drm/hyperv: Add ratelimit on error message
  2022-09-10 18:06 ` Thomas Zimmermann
@ 2022-09-11 16:11   ` Saurabh Singh Sengar
  2022-09-29 16:28     ` Wei Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Saurabh Singh Sengar @ 2022-09-11 16:11 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: ssengar, drawat.floss, airlied, daniel, linux-hyperv, dri-devel,
	linux-kernel, mikelley

On Sat, Sep 10, 2022 at 08:06:05PM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 09.09.22 um 17:09 schrieb Saurabh Sengar:
> >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.
> >
> >Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> >---
> >  drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> >index 76a182a..013a782 100644
> >--- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> >+++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> >@@ -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.

> 
> Best regards
> Thomas
> 
> >  	return ret;
> >  }
> 
> -- 
> 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




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

* Re: [PATCH] drm/hyperv: Add ratelimit on error message
  2022-09-11 16:11   ` Saurabh Singh Sengar
@ 2022-09-29 16:28     ` Wei Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2022-09-29 16:28 UTC (permalink / raw)
  To: Saurabh Singh Sengar
  Cc: Thomas Zimmermann, ssengar, drawat.floss, airlied, daniel,
	linux-hyperv, dri-devel, linux-kernel, mikelley, Wei Liu

On Sun, Sep 11, 2022 at 09:11:42AM -0700, Saurabh Singh Sengar wrote:
> On Sat, Sep 10, 2022 at 08:06:05PM +0200, Thomas Zimmermann wrote:
> > Hi
> > 
> > Am 09.09.22 um 17:09 schrieb Saurabh Sengar:
> > >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.
> > >
> > >Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> > >---
> > >  drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > >diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> > >index 76a182a..013a782 100644
> > >--- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> > >+++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c
> > >@@ -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.

Applied to hyperv-next. Thanks.

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

end of thread, other threads:[~2022-09-29 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-09 15:09 [PATCH] drm/hyperv: Add ratelimit on error message Saurabh Sengar
2022-09-10 15:07 ` Michael Kelley (LINUX)
2022-09-10 18:06 ` Thomas Zimmermann
2022-09-11 16:11   ` Saurabh Singh Sengar
2022-09-29 16:28     ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox