[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-08 Thread Shawn Starr
On Tuesday, December 6, 2016 8:59:09 AM EST Christian König wrote:
> Am 06.12.2016 um 02:00 schrieb Michel Dänzer:
> > On 06/12/16 05:07 AM, Alex Deucher wrote:
> >> Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> >> struct drm_device's ->control member is always NULL.
> >> 
> >> In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> >> ->control->debugfs_root though. This results in the following Oops:
> >> 
> >> [9.627636] BUG: unable to handle kernel NULL pointer dereference at
> >> 0018 [9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100
> >> [amdgpu]
> >> [9.628867] PGD 2514c7067
> >> [9.628876] PUD 2514c8067
> >> [9.629448] PMD 0
> >> [9.630026] Oops:  [#1] PREEMPT SMP
> >> [...]
> >> [9.639906] Call Trace:
> >> [9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
> >> [9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
> >> [9.641900]  ? kmalloc_order_trace+0x2e/0x100
> >> [9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
> >> [9.643355]  drm_dev_register+0xa7/0xd0
> >> [9.644016]  drm_get_pci_dev+0xde/0x1d0
> >> [9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
> >> [...]
> >> 
> >> Fix this by omitting the drm_debugfs_create_files() call for the
> >> control minor debugfs directory which is now non-existent anyway.
> >> 
> >> Port of Nicolai Stange's radeon patch to amdgpu.
> >> 
> >> bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915
> > 
> > Not sure about the kernel, but in other projects the convention is
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98915
> > 
> >> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> >> Signed-off-by: Alex Deucher 
> > 
> > Regardless of the above,
> > 
> > Reviewed-by: Michel Dänzer 
> 
> Reviewed-by: Christian König .
> 

Worked fine, fixed the issue for me.

Tested-by: Shawn Starr 

> ___
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-06 Thread Michel Dänzer
On 06/12/16 05:07 AM, Alex Deucher wrote:
> Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> struct drm_device's ->control member is always NULL.
> 
> In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> ->control->debugfs_root though. This results in the following Oops:
> 
> [9.627636] BUG: unable to handle kernel NULL pointer dereference at 
> 0018
> [9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100 [amdgpu]
> [9.628867] PGD 2514c7067
> [9.628876] PUD 2514c8067
> [9.629448] PMD 0
> [9.630026] Oops:  [#1] PREEMPT SMP
> [...]
> [9.639906] Call Trace:
> [9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
> [9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
> [9.641900]  ? kmalloc_order_trace+0x2e/0x100
> [9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
> [9.643355]  drm_dev_register+0xa7/0xd0
> [9.644016]  drm_get_pci_dev+0xde/0x1d0
> [9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
> [...]
> 
> Fix this by omitting the drm_debugfs_create_files() call for the
> control minor debugfs directory which is now non-existent anyway.
> 
> Port of Nicolai Stange's radeon patch to amdgpu.
> 
> bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915

Not sure about the kernel, but in other projects the convention is

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98915


> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> Signed-off-by: Alex Deucher 

Regardless of the above,

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-06 Thread Christian König
Am 06.12.2016 um 02:00 schrieb Michel Dänzer:
> On 06/12/16 05:07 AM, Alex Deucher wrote:
>> Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
>> struct drm_device's ->control member is always NULL.
>>
>> In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
>> ->control->debugfs_root though. This results in the following Oops:
>>
>> [9.627636] BUG: unable to handle kernel NULL pointer dereference at 
>> 0018
>> [9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100 [amdgpu]
>> [9.628867] PGD 2514c7067
>> [9.628876] PUD 2514c8067
>> [9.629448] PMD 0
>> [9.630026] Oops:  [#1] PREEMPT SMP
>> [...]
>> [9.639906] Call Trace:
>> [9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
>> [9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
>> [9.641900]  ? kmalloc_order_trace+0x2e/0x100
>> [9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
>> [9.643355]  drm_dev_register+0xa7/0xd0
>> [9.644016]  drm_get_pci_dev+0xde/0x1d0
>> [9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
>> [...]
>>
>> Fix this by omitting the drm_debugfs_create_files() call for the
>> control minor debugfs directory which is now non-existent anyway.
>>
>> Port of Nicolai Stange's radeon patch to amdgpu.
>>
>> bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915
> Not sure about the kernel, but in other projects the convention is
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98915
>
>
>> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
>> Signed-off-by: Alex Deucher 
> Regardless of the above,
>
> Reviewed-by: Michel Dänzer 

Reviewed-by: Christian König .



[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-06 Thread Daniel Vetter
On Tue, Dec 06, 2016 at 02:01:37AM +, Mike Lothian wrote:
> Feel free to add a tested by from myself
> 
> Thanks for the fix
> 
> On Mon, 5 Dec 2016 at 20:33 Deucher, Alexander 
> wrote:
> 
> > > -Original Message-
> > > From: Nicolai Stange [mailto:nicstange at gmail.com]
> > > Sent: Monday, December 05, 2016 3:30 PM
> > > To: Daniel Vetter
> > > Cc: Deucher, Alexander; Koenig, Christian; Michel Dänzer; linux-
> > > kernel at vger.kernel.org; dri-devel at lists.freedesktop.org; Nicolai 
> > > Stange
> > > Subject: [PATCH] drm/amdgpu: don't add files at control minor debugfs
> > > directory
> > >
> > > Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> > > struct drm_device's ->control member is always NULL.
> > >
> > > In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> > > ->control->debugfs_root though. This results in a NULL pointer
> > > dereference.
> > >
> > > Fix this by omitting the drm_debugfs_create_files() call for the
> > > control minor debugfs directory which is now non-existent anyway.
> > >
> > > Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> > > Signed-off-by: Nicolai Stange 
> >
> > Please add the bugzilla:
> > https://bugs.freedesktop.org/show_bug.cgi?id=98915
> > With that,
> > Reviewed-by: Alex Deucher 

Applied to drm-misc, thanks for catching this and sorry for the fallout I
caused.
-Daniel

> >
> > > ---
> > > Applicable to next-20161202. Compile-only tested.
> > >
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 --
> > >  1 file changed, 6 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > index deee2db..0cb3e82 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > > @@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct
> > > amdgpu_device *adev,
> > >   adev->debugfs_count = i;
> > >  #if defined(CONFIG_DEBUG_FS)
> > >   drm_debugfs_create_files(files, nfiles,
> > > -  adev->ddev->control->debugfs_root,
> > > -  adev->ddev->control);
> > > - drm_debugfs_create_files(files, nfiles,
> > >adev->ddev->primary->debugfs_root,
> > >adev->ddev->primary);
> > >  #endif
> > > @@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct
> > > amdgpu_device *adev)
> > >   for (i = 0; i < adev->debugfs_count; i++) {
> > >   drm_debugfs_remove_files(adev->debugfs[i].files,
> > >adev->debugfs[i].num_files,
> > > -  adev->ddev->control);
> > > - drm_debugfs_remove_files(adev->debugfs[i].files,
> > > -  adev->debugfs[i].num_files,
> > >adev->ddev->primary);
> > >   }
> > >  #endif
> > > --
> > > 2.10.2
> >
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >

> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-06 Thread Mike Lothian
Feel free to add a tested by from myself

Thanks for the fix

On Mon, 5 Dec 2016 at 20:33 Deucher, Alexander 
wrote:

> > -Original Message-
> > From: Nicolai Stange [mailto:nicstange at gmail.com]
> > Sent: Monday, December 05, 2016 3:30 PM
> > To: Daniel Vetter
> > Cc: Deucher, Alexander; Koenig, Christian; Michel Dänzer; linux-
> > kernel at vger.kernel.org; dri-devel at lists.freedesktop.org; Nicolai 
> > Stange
> > Subject: [PATCH] drm/amdgpu: don't add files at control minor debugfs
> > directory
> >
> > Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> > struct drm_device's ->control member is always NULL.
> >
> > In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> > ->control->debugfs_root though. This results in a NULL pointer
> > dereference.
> >
> > Fix this by omitting the drm_debugfs_create_files() call for the
> > control minor debugfs directory which is now non-existent anyway.
> >
> > Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> > Signed-off-by: Nicolai Stange 
>
> Please add the bugzilla:
> https://bugs.freedesktop.org/show_bug.cgi?id=98915
> With that,
> Reviewed-by: Alex Deucher 
>
> > ---
> > Applicable to next-20161202. Compile-only tested.
> >
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 --
> >  1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > index deee2db..0cb3e82 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > @@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct
> > amdgpu_device *adev,
> >   adev->debugfs_count = i;
> >  #if defined(CONFIG_DEBUG_FS)
> >   drm_debugfs_create_files(files, nfiles,
> > -  adev->ddev->control->debugfs_root,
> > -  adev->ddev->control);
> > - drm_debugfs_create_files(files, nfiles,
> >adev->ddev->primary->debugfs_root,
> >adev->ddev->primary);
> >  #endif
> > @@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct
> > amdgpu_device *adev)
> >   for (i = 0; i < adev->debugfs_count; i++) {
> >   drm_debugfs_remove_files(adev->debugfs[i].files,
> >adev->debugfs[i].num_files,
> > -  adev->ddev->control);
> > - drm_debugfs_remove_files(adev->debugfs[i].files,
> > -  adev->debugfs[i].num_files,
> >adev->ddev->primary);
> >   }
> >  #endif
> > --
> > 2.10.2
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20161206/371cb336/attachment-0001.html>


[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-05 Thread Nicolai Stange
Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
struct drm_device's ->control member is always NULL.

In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
->control->debugfs_root though. This results in a NULL pointer
dereference.

Fix this by omitting the drm_debugfs_create_files() call for the
control minor debugfs directory which is now non-existent anyway.

Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
Signed-off-by: Nicolai Stange 
---
Applicable to next-20161202. Compile-only tested.

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index deee2db..0cb3e82 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct amdgpu_device *adev,
adev->debugfs_count = i;
 #if defined(CONFIG_DEBUG_FS)
drm_debugfs_create_files(files, nfiles,
-adev->ddev->control->debugfs_root,
-adev->ddev->control);
-   drm_debugfs_create_files(files, nfiles,
 adev->ddev->primary->debugfs_root,
 adev->ddev->primary);
 #endif
@@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct 
amdgpu_device *adev)
for (i = 0; i < adev->debugfs_count; i++) {
drm_debugfs_remove_files(adev->debugfs[i].files,
 adev->debugfs[i].num_files,
-adev->ddev->control);
-   drm_debugfs_remove_files(adev->debugfs[i].files,
-adev->debugfs[i].num_files,
 adev->ddev->primary);
}
 #endif
-- 
2.10.2



[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-05 Thread Deucher, Alexander
> -Original Message-
> From: Nicolai Stange [mailto:nicstange at gmail.com]
> Sent: Monday, December 05, 2016 3:30 PM
> To: Daniel Vetter
> Cc: Deucher, Alexander; Koenig, Christian; Michel Dänzer; linux-
> kernel at vger.kernel.org; dri-devel at lists.freedesktop.org; Nicolai Stange
> Subject: [PATCH] drm/amdgpu: don't add files at control minor debugfs
> directory
> 
> Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
> struct drm_device's ->control member is always NULL.
> 
> In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
> ->control->debugfs_root though. This results in a NULL pointer
> dereference.
> 
> Fix this by omitting the drm_debugfs_create_files() call for the
> control minor debugfs directory which is now non-existent anyway.
> 
> Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
> Signed-off-by: Nicolai Stange 

Please add the bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=98915
With that,
Reviewed-by: Alex Deucher 

> ---
> Applicable to next-20161202. Compile-only tested.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index deee2db..0cb3e82 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2493,9 +2493,6 @@ int amdgpu_debugfs_add_files(struct
> amdgpu_device *adev,
>   adev->debugfs_count = i;
>  #if defined(CONFIG_DEBUG_FS)
>   drm_debugfs_create_files(files, nfiles,
> -  adev->ddev->control->debugfs_root,
> -  adev->ddev->control);
> - drm_debugfs_create_files(files, nfiles,
>adev->ddev->primary->debugfs_root,
>adev->ddev->primary);
>  #endif
> @@ -2510,9 +2507,6 @@ static void amdgpu_debugfs_remove_files(struct
> amdgpu_device *adev)
>   for (i = 0; i < adev->debugfs_count; i++) {
>   drm_debugfs_remove_files(adev->debugfs[i].files,
>adev->debugfs[i].num_files,
> -  adev->ddev->control);
> - drm_debugfs_remove_files(adev->debugfs[i].files,
> -  adev->debugfs[i].num_files,
>adev->ddev->primary);
>   }
>  #endif
> --
> 2.10.2



[PATCH] drm/amdgpu: don't add files at control minor debugfs directory

2016-12-05 Thread Alex Deucher
Since commit 8a357d10043c ("drm: Nerf DRM_CONTROL nodes"), a
struct drm_device's ->control member is always NULL.

In the case of CONFIG_DEBUG_FS=y, amdgpu_debugfs_add_files() accesses
->control->debugfs_root though. This results in the following Oops:

[9.627636] BUG: unable to handle kernel NULL pointer dereference at 
0018
[9.628274] IP: amdgpu_debugfs_add_files+0x8d/0x100 [amdgpu]
[9.628867] PGD 2514c7067
[9.628876] PUD 2514c8067
[9.629448] PMD 0
[9.630026] Oops:  [#1] PREEMPT SMP
[...]
[9.639906] Call Trace:
[9.640538]  amdgpu_fence_driver_init+0x1e/0x40 [amdgpu]
[9.641186]  amdgpu_device_init+0xa6d/0x1410 [amdgpu]
[9.641900]  ? kmalloc_order_trace+0x2e/0x100
[9.642587]  amdgpu_driver_load_kms+0x5b/0x200 [amdgpu]
[9.643355]  drm_dev_register+0xa7/0xd0
[9.644016]  drm_get_pci_dev+0xde/0x1d0
[9.644659]  amdgpu_pci_probe+0xbe/0xf0 [amdgpu]
[...]

Fix this by omitting the drm_debugfs_create_files() call for the
control minor debugfs directory which is now non-existent anyway.

Port of Nicolai Stange's radeon patch to amdgpu.

bug: https://bugs.freedesktop.org/show_bug.cgi?id=98915
Fixes: 8a357d10043c ("drm: Nerf DRM_CONTROL nodes")
Signed-off-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4701d94..a578540 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2512,9 +2512,6 @@ int amdgpu_debugfs_add_files(struct amdgpu_device *adev,
adev->debugfs_count = i;
 #if defined(CONFIG_DEBUG_FS)
drm_debugfs_create_files(files, nfiles,
-adev->ddev->control->debugfs_root,
-adev->ddev->control);
-   drm_debugfs_create_files(files, nfiles,
 adev->ddev->primary->debugfs_root,
 adev->ddev->primary);
 #endif
@@ -2529,9 +2526,6 @@ static void amdgpu_debugfs_remove_files(struct 
amdgpu_device *adev)
for (i = 0; i < adev->debugfs_count; i++) {
drm_debugfs_remove_files(adev->debugfs[i].files,
 adev->debugfs[i].num_files,
-adev->ddev->control);
-   drm_debugfs_remove_files(adev->debugfs[i].files,
-adev->debugfs[i].num_files,
 adev->ddev->primary);
}
 #endif
-- 
2.5.5