diff mbox series

drm/vkms: fix misuse of WARN_ON

Message ID 20210320132840.1315853-1-dvyukov@google.com (mailing list archive)
State New, archived
Headers show
Series drm/vkms: fix misuse of WARN_ON | expand

Commit Message

Dmitry Vyukov March 20, 2021, 1:28 p.m. UTC
vkms_vblank_simulate() uses WARN_ON for timing-dependent condition
(timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used
to denote kernel bugs. Use pr_warn() instead.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reported-by: syzbot+4fc21a003c8332eb0bdd@syzkaller.appspotmail.com
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Change-Id: I7f01c288092bc7e472ec63af198f93ce3d8c49f7
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: e94c55b8e0a0bbe9a026250cf31e2fa45957d776

Comments

Melissa Wen March 24, 2021, 10 p.m. UTC | #1
On 03/20, Dmitry Vyukov wrote:
> vkms_vblank_simulate() uses WARN_ON for timing-dependent condition
> (timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used
> to denote kernel bugs. Use pr_warn() instead.
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> Reported-by: syzbot+4fc21a003c8332eb0bdd@syzkaller.appspotmail.com
> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> Cc: Melissa Wen <melissa.srw@gmail.com>
> Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Change-Id: I7f01c288092bc7e472ec63af198f93ce3d8c49f7
> ---
>  drivers/gpu/drm/vkms/vkms_crtc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 0443b7deeaef6..758d8a98d96b3 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -18,7 +18,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
>  
>  	ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer,
>  					  output->period_ns);
> -	WARN_ON(ret_overrun != 1);
> +	if (ret_overrun != 1)
> +		pr_warn("%s: vblank timer overrun\n", __func__);

Hi Dmitry,

Thanks for your patch.

Looks good to me.
The Change-Id tag just seems a little noisy to me, but can be
fixed while applying.

Acked-by: Melissa Wen <melissa.srw@gmail.com>

>  
>  	spin_lock(&output->lock);
>  	ret = drm_crtc_handle_vblank(crtc);
> 
> base-commit: e94c55b8e0a0bbe9a026250cf31e2fa45957d776
> -- 
> 2.31.0.291.g576ba9dcdaf-goog
>
Dmitry Vyukov March 25, 2021, 6:48 a.m. UTC | #2
On Wed, Mar 24, 2021 at 11:00 PM Melissa Wen <melissa.srw@gmail.com> wrote:
>
> On 03/20, Dmitry Vyukov wrote:
> > vkms_vblank_simulate() uses WARN_ON for timing-dependent condition
> > (timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used
> > to denote kernel bugs. Use pr_warn() instead.
> >
> > Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> > Reported-by: syzbot+4fc21a003c8332eb0bdd@syzkaller.appspotmail.com
> > Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > Cc: Melissa Wen <melissa.srw@gmail.com>
> > Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > Cc: linux-kernel@vger.kernel.org
> > Change-Id: I7f01c288092bc7e472ec63af198f93ce3d8c49f7
> > ---
> >  drivers/gpu/drm/vkms/vkms_crtc.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> > index 0443b7deeaef6..758d8a98d96b3 100644
> > --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> > @@ -18,7 +18,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> >
> >       ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer,
> >                                         output->period_ns);
> > -     WARN_ON(ret_overrun != 1);
> > +     if (ret_overrun != 1)
> > +             pr_warn("%s: vblank timer overrun\n", __func__);
>
> Hi Dmitry,
>
> Thanks for your patch.
>
> Looks good to me.
> The Change-Id tag just seems a little noisy to me, but can be
> fixed while applying.

Yes, please drop Change-Id when applying if possible. Sorry for that.
Thanks for the review, Melissa.

> Acked-by: Melissa Wen <melissa.srw@gmail.com>
>
> >
> >       spin_lock(&output->lock);
> >       ret = drm_crtc_handle_vblank(crtc);
> >
> > base-commit: e94c55b8e0a0bbe9a026250cf31e2fa45957d776
> > --
> > 2.31.0.291.g576ba9dcdaf-goog
> >
Melissa Wen March 25, 2021, 11:55 a.m. UTC | #3
On 03/25, Dmitry Vyukov wrote:
> On Wed, Mar 24, 2021 at 11:00 PM Melissa Wen <melissa.srw@gmail.com> wrote:
> >
> > On 03/20, Dmitry Vyukov wrote:
> > > vkms_vblank_simulate() uses WARN_ON for timing-dependent condition
> > > (timer overrun). This is a mis-use of WARN_ON, WARN_ON must be used
> > > to denote kernel bugs. Use pr_warn() instead.
> > >
> > > Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> > > Reported-by: syzbot+4fc21a003c8332eb0bdd@syzkaller.appspotmail.com
> > > Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > Cc: Melissa Wen <melissa.srw@gmail.com>
> > > Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
> > > Cc: Daniel Vetter <daniel@ffwll.ch>
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Cc: linux-kernel@vger.kernel.org
> > > Change-Id: I7f01c288092bc7e472ec63af198f93ce3d8c49f7
> > > ---
> > >  drivers/gpu/drm/vkms/vkms_crtc.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> > > index 0443b7deeaef6..758d8a98d96b3 100644
> > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> > > @@ -18,7 +18,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
> > >
> > >       ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer,
> > >                                         output->period_ns);
> > > -     WARN_ON(ret_overrun != 1);
> > > +     if (ret_overrun != 1)
> > > +             pr_warn("%s: vblank timer overrun\n", __func__);
> >
> > Hi Dmitry,
> >
> > Thanks for your patch.
> >
> > Looks good to me.
> > The Change-Id tag just seems a little noisy to me, but can be
> > fixed while applying.
> 
> Yes, please drop Change-Id when applying if possible. Sorry for that.
> Thanks for the review, Melissa.

Applied to drm-misc-next.

Thanks,

Melissa
> 
> > Acked-by: Melissa Wen <melissa.srw@gmail.com>
> >
> > >
> > >       spin_lock(&output->lock);
> > >       ret = drm_crtc_handle_vblank(crtc);
> > >
> > > base-commit: e94c55b8e0a0bbe9a026250cf31e2fa45957d776
> > > --
> > > 2.31.0.291.g576ba9dcdaf-goog
> > >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 0443b7deeaef6..758d8a98d96b3 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -18,7 +18,8 @@  static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
 
 	ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer,
 					  output->period_ns);
-	WARN_ON(ret_overrun != 1);
+	if (ret_overrun != 1)
+		pr_warn("%s: vblank timer overrun\n", __func__);
 
 	spin_lock(&output->lock);
 	ret = drm_crtc_handle_vblank(crtc);