All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
@ 2019-03-10 21:21 ` Rodrigo Siqueira
  0 siblings, 0 replies; 14+ messages in thread
From: Rodrigo Siqueira @ 2019-03-10 21:21 UTC (permalink / raw)
  To: Gerd Hoffmann, David Airlie, Daniel Vetter
  Cc: virtualization, dri-devel, linux-kernel

When the subtest basic-plain-flip from IGT project was executed on Bochs
driver, the following bug appears:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
PGD 0 P4D 0
Oops: 0010 [#1] PREEMPT SMP PTI
CPU: 0 PID: 423 Comm: kms_flip Not tainted 5.0.0-VM+ #102
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-20181126_142135-anatol 04/01/2014
RIP: 0010:          (null)
Code: Bad RIP value.
RSP: 0018:ffffb6a6c0bdfb70 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff90467940bf00 RCX: ffff90467a730318
RDX: 000000000000001f RSI: 0000000000000003 RDI: ffff90467bf94050
RBP: ffff90467bf94050 R08: ffff904679424e00 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: ffff90467a460000 R14: ffff90467946d400 R15: ffffffffc080d460
FS:  00007f259c1990c0(0000) GS:ffff90467c800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 00000000b97ec000 CR4: 00000000000006f0
Call Trace:
 ? drm_atomic_helper_commit_modeset_disables+0x396/0x3e0 [drm_kms_helper]
 ? drm_atomic_helper_commit_tail+0x19/0x60 [drm_kms_helper]
 ? commit_tail+0x58/0x70 [drm_kms_helper]
 ? drm_atomic_helper_commit+0x103/0x110 [drm_kms_helper]
 ? drm_atomic_helper_set_config+0x80/0x90 [drm_kms_helper]
 ? drm_mode_setcrtc+0x18d/0x690 [drm]
 ? tty_insert_flip_string_fixed_flag+0x85/0xe0
 ? drm_mode_getcrtc+0x180/0x180 [drm]
 ? drm_ioctl_kernel+0xb2/0xf0 [drm]
 ? drm_ioctl+0x25f/0x3f0 [drm]
 ? drm_mode_getcrtc+0x180/0x180 [drm]
 ? do_vfs_ioctl+0xa4/0x630
 ? ksys_ioctl+0x60/0x90
 ? ksys_write+0x4f/0xb0
 ? __x64_sys_ioctl+0x16/0x20
 ? do_syscall_64+0x5b/0x170
 ? entry_SYSCALL_64_after_hwframe+0x44/0xa9

This commit adds an entry to atomic_disable in the drm_crtc_helper_funcs
to avoid the NULL pointer dereference.

Fixes: 0f0eb98e33c6 ("drm/bochs: atomic: add atomic_flush+atomic_enable callbacks")

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 drivers/gpu/drm/bochs/bochs_kms.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 9e7cd6b34106..7e821776727f 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -35,6 +35,11 @@ static void bochs_crtc_atomic_enable(struct drm_crtc *crtc,
 {
 }
 
+static void  bochs_crtc_atomic_disable(struct drm_crtc *crtc,
+				       struct drm_crtc_state *old_state)
+{
+}
+
 static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
 				    struct drm_crtc_state *old_crtc_state)
 {
@@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
 	.mode_set_nofb = bochs_crtc_mode_set_nofb,
 	.atomic_enable = bochs_crtc_atomic_enable,
+	.atomic_disable = bochs_crtc_atomic_disable,
 	.atomic_flush = bochs_crtc_atomic_flush,
 };
 
-- 
2.21.0

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

* [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
@ 2019-03-10 21:21 ` Rodrigo Siqueira
  0 siblings, 0 replies; 14+ messages in thread
From: Rodrigo Siqueira @ 2019-03-10 21:21 UTC (permalink / raw)
  To: Gerd Hoffmann, David Airlie, Daniel Vetter
  Cc: linux-kernel, dri-devel, virtualization

When the subtest basic-plain-flip from IGT project was executed on Bochs
driver, the following bug appears:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
PGD 0 P4D 0
Oops: 0010 [#1] PREEMPT SMP PTI
CPU: 0 PID: 423 Comm: kms_flip Not tainted 5.0.0-VM+ #102
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-20181126_142135-anatol 04/01/2014
RIP: 0010:          (null)
Code: Bad RIP value.
RSP: 0018:ffffb6a6c0bdfb70 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff90467940bf00 RCX: ffff90467a730318
RDX: 000000000000001f RSI: 0000000000000003 RDI: ffff90467bf94050
RBP: ffff90467bf94050 R08: ffff904679424e00 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
R13: ffff90467a460000 R14: ffff90467946d400 R15: ffffffffc080d460
FS:  00007f259c1990c0(0000) GS:ffff90467c800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 00000000b97ec000 CR4: 00000000000006f0
Call Trace:
 ? drm_atomic_helper_commit_modeset_disables+0x396/0x3e0 [drm_kms_helper]
 ? drm_atomic_helper_commit_tail+0x19/0x60 [drm_kms_helper]
 ? commit_tail+0x58/0x70 [drm_kms_helper]
 ? drm_atomic_helper_commit+0x103/0x110 [drm_kms_helper]
 ? drm_atomic_helper_set_config+0x80/0x90 [drm_kms_helper]
 ? drm_mode_setcrtc+0x18d/0x690 [drm]
 ? tty_insert_flip_string_fixed_flag+0x85/0xe0
 ? drm_mode_getcrtc+0x180/0x180 [drm]
 ? drm_ioctl_kernel+0xb2/0xf0 [drm]
 ? drm_ioctl+0x25f/0x3f0 [drm]
 ? drm_mode_getcrtc+0x180/0x180 [drm]
 ? do_vfs_ioctl+0xa4/0x630
 ? ksys_ioctl+0x60/0x90
 ? ksys_write+0x4f/0xb0
 ? __x64_sys_ioctl+0x16/0x20
 ? do_syscall_64+0x5b/0x170
 ? entry_SYSCALL_64_after_hwframe+0x44/0xa9

This commit adds an entry to atomic_disable in the drm_crtc_helper_funcs
to avoid the NULL pointer dereference.

Fixes: 0f0eb98e33c6 ("drm/bochs: atomic: add atomic_flush+atomic_enable callbacks")

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 drivers/gpu/drm/bochs/bochs_kms.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 9e7cd6b34106..7e821776727f 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -35,6 +35,11 @@ static void bochs_crtc_atomic_enable(struct drm_crtc *crtc,
 {
 }
 
+static void  bochs_crtc_atomic_disable(struct drm_crtc *crtc,
+				       struct drm_crtc_state *old_state)
+{
+}
+
 static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
 				    struct drm_crtc_state *old_crtc_state)
 {
@@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
 static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
 	.mode_set_nofb = bochs_crtc_mode_set_nofb,
 	.atomic_enable = bochs_crtc_atomic_enable,
+	.atomic_disable = bochs_crtc_atomic_disable,
 	.atomic_flush = bochs_crtc_atomic_flush,
 };
 
-- 
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-10 21:21 ` Rodrigo Siqueira
  (?)
@ 2019-03-11  6:22 ` Gerd Hoffmann
  2019-03-11 10:11   ` Rodrigo Siqueira
  -1 siblings, 1 reply; 14+ messages in thread
From: Gerd Hoffmann @ 2019-03-11  6:22 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: David Airlie, Daniel Vetter, virtualization, dri-devel, linux-kernel

On Sun, Mar 10, 2019 at 06:21:50PM -0300, Rodrigo Siqueira wrote:
> When the subtest basic-plain-flip from IGT project was executed on Bochs
> driver, the following bug appears:
> 
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000000

>  ? drm_atomic_helper_commit_modeset_disables+0x396/0x3e0 [drm_kms_helper]

> +static void  bochs_crtc_atomic_disable(struct drm_crtc *crtc,
> +				       struct drm_crtc_state *old_state)
> +{
> +}
> +
>  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
>  				    struct drm_crtc_state *old_crtc_state)
>  {
> @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
>  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
>  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
>  	.atomic_enable = bochs_crtc_atomic_enable,
> +	.atomic_disable = bochs_crtc_atomic_disable,

Shouldn't we make the callback optional instead of adding empty dummy
functions to drivers?

cheers,
  Gerd


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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-10 21:21 ` Rodrigo Siqueira
  (?)
  (?)
@ 2019-03-11  6:22 ` Gerd Hoffmann
  -1 siblings, 0 replies; 14+ messages in thread
From: Gerd Hoffmann @ 2019-03-11  6:22 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: David Airlie, linux-kernel, dri-devel, Daniel Vetter, virtualization

On Sun, Mar 10, 2019 at 06:21:50PM -0300, Rodrigo Siqueira wrote:
> When the subtest basic-plain-flip from IGT project was executed on Bochs
> driver, the following bug appears:
> 
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000000

>  ? drm_atomic_helper_commit_modeset_disables+0x396/0x3e0 [drm_kms_helper]

> +static void  bochs_crtc_atomic_disable(struct drm_crtc *crtc,
> +				       struct drm_crtc_state *old_state)
> +{
> +}
> +
>  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
>  				    struct drm_crtc_state *old_crtc_state)
>  {
> @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
>  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
>  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
>  	.atomic_enable = bochs_crtc_atomic_enable,
> +	.atomic_disable = bochs_crtc_atomic_disable,

Shouldn't we make the callback optional instead of adding empty dummy
functions to drivers?

cheers,
  Gerd

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11  6:22 ` Gerd Hoffmann
@ 2019-03-11 10:11   ` Rodrigo Siqueira
  2019-03-11 13:07     ` Gerd Hoffmann
  2019-03-11 13:07     ` Gerd Hoffmann
  0 siblings, 2 replies; 14+ messages in thread
From: Rodrigo Siqueira @ 2019-03-11 10:11 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: David Airlie, Daniel Vetter, virtualization, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

On 03/11, Gerd Hoffmann wrote:
> On Sun, Mar 10, 2019 at 06:21:50PM -0300, Rodrigo Siqueira wrote:
> > When the subtest basic-plain-flip from IGT project was executed on Bochs
> > driver, the following bug appears:
> > 
> > BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
> 
> >  ? drm_atomic_helper_commit_modeset_disables+0x396/0x3e0 [drm_kms_helper]
> 
> > +static void  bochs_crtc_atomic_disable(struct drm_crtc *crtc,
> > +				       struct drm_crtc_state *old_state)
> > +{
> > +}
> > +
> >  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
> >  				    struct drm_crtc_state *old_crtc_state)
> >  {
> > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
> >  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
> >  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
> >  	.atomic_enable = bochs_crtc_atomic_enable,
> > +	.atomic_disable = bochs_crtc_atomic_disable,
> 
> Shouldn't we make the callback optional instead of adding empty dummy
> functions to drivers?

Hi Gerd,

I agree, and I can work in this issue.
Just one question, should we make atomic_enable optional as well?
 
Thanks for your feedback,
Best Regards
> cheers,
>   Gerd
> 

-- 
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 10:11   ` Rodrigo Siqueira
  2019-03-11 13:07     ` Gerd Hoffmann
@ 2019-03-11 13:07     ` Gerd Hoffmann
  2019-03-11 13:23         ` Daniel Vetter
  1 sibling, 1 reply; 14+ messages in thread
From: Gerd Hoffmann @ 2019-03-11 13:07 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: David Airlie, Daniel Vetter, virtualization, dri-devel, linux-kernel

  Hi,

> > >  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
> > >  				    struct drm_crtc_state *old_crtc_state)
> > >  {
> > > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
> > >  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
> > >  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
> > >  	.atomic_enable = bochs_crtc_atomic_enable,
> > > +	.atomic_disable = bochs_crtc_atomic_disable,
> > 
> > Shouldn't we make the callback optional instead of adding empty dummy
> > functions to drivers?
> 
> Hi Gerd,
> 
> I agree, and I can work in this issue.
> Just one question, should we make atomic_enable optional as well?

IIRC the drm code checks for the atomic_enable callback presence to
figure whenever it should take the atomic or legacy code paths.

So, I think that will not work.

cheers,
  Gerd


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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 10:11   ` Rodrigo Siqueira
@ 2019-03-11 13:07     ` Gerd Hoffmann
  2019-03-11 13:07     ` Gerd Hoffmann
  1 sibling, 0 replies; 14+ messages in thread
From: Gerd Hoffmann @ 2019-03-11 13:07 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: David Airlie, linux-kernel, dri-devel, Daniel Vetter, virtualization

  Hi,

> > >  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
> > >  				    struct drm_crtc_state *old_crtc_state)
> > >  {
> > > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
> > >  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
> > >  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
> > >  	.atomic_enable = bochs_crtc_atomic_enable,
> > > +	.atomic_disable = bochs_crtc_atomic_disable,
> > 
> > Shouldn't we make the callback optional instead of adding empty dummy
> > functions to drivers?
> 
> Hi Gerd,
> 
> I agree, and I can work in this issue.
> Just one question, should we make atomic_enable optional as well?

IIRC the drm code checks for the atomic_enable callback presence to
figure whenever it should take the atomic or legacy code paths.

So, I think that will not work.

cheers,
  Gerd

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 13:07     ` Gerd Hoffmann
@ 2019-03-11 13:23         ` Daniel Vetter
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2019-03-11 13:23 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Rodrigo Siqueira, David Airlie, Daniel Vetter, virtualization,
	dri-devel, linux-kernel

On Mon, Mar 11, 2019 at 02:07:16PM +0100, Gerd Hoffmann wrote:
>   Hi,
> 
> > > >  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
> > > >  				    struct drm_crtc_state *old_crtc_state)
> > > >  {
> > > > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
> > > >  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
> > > >  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
> > > >  	.atomic_enable = bochs_crtc_atomic_enable,
> > > > +	.atomic_disable = bochs_crtc_atomic_disable,
> > > 
> > > Shouldn't we make the callback optional instead of adding empty dummy
> > > functions to drivers?
> > 
> > Hi Gerd,
> > 
> > I agree, and I can work in this issue.
> > Just one question, should we make atomic_enable optional as well?
> 
> IIRC the drm code checks for the atomic_enable callback presence to
> figure whenever it should take the atomic or legacy code paths.

It should check for drm_driver->mode_config.funcs.atomic_commit for that,
see drm_drv_uses_atomic_modeset(). Anything else should be a bug.

Or do you mean the fallback to the old crtc helper prepare/commit
callbacks? We'd need to make all of them optional ofc, with atomic_
variants being preferred ofc.
-Daniel


> 
> So, I think that will not work.
> 
> cheers,
>   Gerd
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
@ 2019-03-11 13:23         ` Daniel Vetter
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2019-03-11 13:23 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Rodrigo Siqueira, David Airlie, linux-kernel, dri-devel,
	virtualization, Daniel Vetter

On Mon, Mar 11, 2019 at 02:07:16PM +0100, Gerd Hoffmann wrote:
>   Hi,
> 
> > > >  static void bochs_crtc_atomic_flush(struct drm_crtc *crtc,
> > > >  				    struct drm_crtc_state *old_crtc_state)
> > > >  {
> > > > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
> > > >  static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
> > > >  	.mode_set_nofb = bochs_crtc_mode_set_nofb,
> > > >  	.atomic_enable = bochs_crtc_atomic_enable,
> > > > +	.atomic_disable = bochs_crtc_atomic_disable,
> > > 
> > > Shouldn't we make the callback optional instead of adding empty dummy
> > > functions to drivers?
> > 
> > Hi Gerd,
> > 
> > I agree, and I can work in this issue.
> > Just one question, should we make atomic_enable optional as well?
> 
> IIRC the drm code checks for the atomic_enable callback presence to
> figure whenever it should take the atomic or legacy code paths.

It should check for drm_driver->mode_config.funcs.atomic_commit for that,
see drm_drv_uses_atomic_modeset(). Anything else should be a bug.

Or do you mean the fallback to the old crtc helper prepare/commit
callbacks? We'd need to make all of them optional ofc, with atomic_
variants being preferred ofc.
-Daniel


> 
> So, I think that will not work.
> 
> cheers,
>   Gerd
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 13:23         ` Daniel Vetter
  (?)
@ 2019-03-11 13:39         ` Gerd Hoffmann
  2019-03-11 17:49           ` Rodrigo Siqueira
  -1 siblings, 1 reply; 14+ messages in thread
From: Gerd Hoffmann @ 2019-03-11 13:39 UTC (permalink / raw)
  To: Rodrigo Siqueira, David Airlie, virtualization, dri-devel, linux-kernel

  Hi,

> > IIRC the drm code checks for the atomic_enable callback presence to
> > figure whenever it should take the atomic or legacy code paths.
> 
> It should check for drm_driver->mode_config.funcs.atomic_commit for that,
> see drm_drv_uses_atomic_modeset(). Anything else should be a bug.
> 
> Or do you mean the fallback to the old crtc helper prepare/commit
> callbacks?

Probably the later.  There was some reason why I've left in the empty
bochs_crtc_atomic_enable() callback ...

cheers,
  Gerd


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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 13:23         ` Daniel Vetter
  (?)
  (?)
@ 2019-03-11 13:39         ` Gerd Hoffmann
  -1 siblings, 0 replies; 14+ messages in thread
From: Gerd Hoffmann @ 2019-03-11 13:39 UTC (permalink / raw)
  To: Rodrigo Siqueira, David Airlie, virtualization, dri-devel, linux-kernel

  Hi,

> > IIRC the drm code checks for the atomic_enable callback presence to
> > figure whenever it should take the atomic or legacy code paths.
> 
> It should check for drm_driver->mode_config.funcs.atomic_commit for that,
> see drm_drv_uses_atomic_modeset(). Anything else should be a bug.
> 
> Or do you mean the fallback to the old crtc helper prepare/commit
> callbacks?

Probably the later.  There was some reason why I've left in the empty
bochs_crtc_atomic_enable() callback ...

cheers,
  Gerd

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 13:39         ` Gerd Hoffmann
@ 2019-03-11 17:49           ` Rodrigo Siqueira
  2019-03-11 18:48             ` Daniel Vetter
  2019-03-11 18:48             ` Daniel Vetter
  0 siblings, 2 replies; 14+ messages in thread
From: Rodrigo Siqueira @ 2019-03-11 17:49 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: David Airlie, virtualization, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

On 03/11, Gerd Hoffmann wrote:
>   Hi,
> 
> > > IIRC the drm code checks for the atomic_enable callback presence to
> > > figure whenever it should take the atomic or legacy code paths.
> > 
> > It should check for drm_driver->mode_config.funcs.atomic_commit for that,
> > see drm_drv_uses_atomic_modeset(). Anything else should be a bug.
> > 
> > Or do you mean the fallback to the old crtc helper prepare/commit
> > callbacks?
> 
> Probably the later.  There was some reason why I've left in the empty
> bochs_crtc_atomic_enable() callback ...

Just for checking before I start to work in this patch:
The correct solution should be made atomic_enable and atomic_disable
optional, right? I should do it, and check if Bochs driver really needs
bochs_crtc_atomic_enable after my change, right?

> cheers,
>   Gerd
> 

-- 
Rodrigo Siqueira
https://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 17:49           ` Rodrigo Siqueira
@ 2019-03-11 18:48             ` Daniel Vetter
  2019-03-11 18:48             ` Daniel Vetter
  1 sibling, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2019-03-11 18:48 UTC (permalink / raw)
  To: Rodrigo Siqueira
  Cc: Gerd Hoffmann, David Airlie, linux-kernel, dri-devel, virtualization

On Mon, Mar 11, 2019 at 02:49:58PM -0300, Rodrigo Siqueira wrote:
> On 03/11, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > > > IIRC the drm code checks for the atomic_enable callback presence to
> > > > figure whenever it should take the atomic or legacy code paths.
> > > 
> > > It should check for drm_driver->mode_config.funcs.atomic_commit for that,
> > > see drm_drv_uses_atomic_modeset(). Anything else should be a bug.
> > > 
> > > Or do you mean the fallback to the old crtc helper prepare/commit
> > > callbacks?
> > 
> > Probably the later.  There was some reason why I've left in the empty
> > bochs_crtc_atomic_enable() callback ...
> 
> Just for checking before I start to work in this patch:
> The correct solution should be made atomic_enable and atomic_disable
> optional, right? I should do it, and check if Bochs driver really needs
> bochs_crtc_atomic_enable after my change, right?

Yup. I just tried to remember why we haven't done this yet, but I think
that was a patch to make crtc->helper_funcs optional. And that doesn't
make sense imo, since if your crtc doesn't do anything then you don't
really have an atomic driver :-) And if there's ever a legit use case for
this, then that drive probably shouldn't use the atomic helpers ...

But making crtc_helper_funcs->atomic_enable/disable optional sounds like a
good idea.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
  2019-03-11 17:49           ` Rodrigo Siqueira
  2019-03-11 18:48             ` Daniel Vetter
@ 2019-03-11 18:48             ` Daniel Vetter
  1 sibling, 0 replies; 14+ messages in thread
From: Daniel Vetter @ 2019-03-11 18:48 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: David Airlie, virtualization, dri-devel, linux-kernel

On Mon, Mar 11, 2019 at 02:49:58PM -0300, Rodrigo Siqueira wrote:
> On 03/11, Gerd Hoffmann wrote:
> >   Hi,
> > 
> > > > IIRC the drm code checks for the atomic_enable callback presence to
> > > > figure whenever it should take the atomic or legacy code paths.
> > > 
> > > It should check for drm_driver->mode_config.funcs.atomic_commit for that,
> > > see drm_drv_uses_atomic_modeset(). Anything else should be a bug.
> > > 
> > > Or do you mean the fallback to the old crtc helper prepare/commit
> > > callbacks?
> > 
> > Probably the later.  There was some reason why I've left in the empty
> > bochs_crtc_atomic_enable() callback ...
> 
> Just for checking before I start to work in this patch:
> The correct solution should be made atomic_enable and atomic_disable
> optional, right? I should do it, and check if Bochs driver really needs
> bochs_crtc_atomic_enable after my change, right?

Yup. I just tried to remember why we haven't done this yet, but I think
that was a patch to make crtc->helper_funcs optional. And that doesn't
make sense imo, since if your crtc doesn't do anything then you don't
really have an atomic driver :-) And if there's ever a legit use case for
this, then that drive probably shouldn't use the atomic helpers ...

But making crtc_helper_funcs->atomic_enable/disable optional sounds like a
good idea.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

end of thread, other threads:[~2019-03-11 18:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-10 21:21 [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper Rodrigo Siqueira
2019-03-10 21:21 ` Rodrigo Siqueira
2019-03-11  6:22 ` Gerd Hoffmann
2019-03-11 10:11   ` Rodrigo Siqueira
2019-03-11 13:07     ` Gerd Hoffmann
2019-03-11 13:07     ` Gerd Hoffmann
2019-03-11 13:23       ` Daniel Vetter
2019-03-11 13:23         ` Daniel Vetter
2019-03-11 13:39         ` Gerd Hoffmann
2019-03-11 17:49           ` Rodrigo Siqueira
2019-03-11 18:48             ` Daniel Vetter
2019-03-11 18:48             ` Daniel Vetter
2019-03-11 13:39         ` Gerd Hoffmann
2019-03-11  6:22 ` Gerd Hoffmann

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.