diff mbox

[1/1] drm/radeon: Don't run tests when underlying memory was uninitialized

Message ID 81629B7E-5291-4566-89BD-5520C3D6A7CA@p0n4ik.tk (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Ivanov Sept. 22, 2013, 1:18 a.m. UTC
20.09.2013, ? 22:33, Alex Deucher <alexdeucher@gmail.com> ???????(?):

> On Fri, Sep 20, 2013 at 9:36 AM, Alex Ivanov <gnidorah@p0n4ik.tk> wrote:
>> Prevent NULL pointer dereference in case when radeon_ring_fini() did it's job.
>> 
>> Reading of r100_cp_ring_info and radeon_ring_gfx debugfs entries will lead to a KP if ring buffer was deallocated, e.g. on failed ring test.
>> Seen on PA-RISC machine having "radeon: ring test failed (scratch(0x8504)=0xCAFEDEAD)" issue.
>> 
>> Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk>
> 
> Applied.  thanks!
> 
> Alex

One more. Thank you!

Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk>
---

Comments

Alex Ivanov Sept. 23, 2013, 11:59 a.m. UTC | #1
P.S.: don't run means don't allow to run, by either feeding radeon.test=X
or radeon.benchmark=1

22.09.2013, ? 5:18, Alex Ivanov <gnidorah@p0n4ik.tk> ???????(?):

> 20.09.2013, ? 22:33, Alex Deucher <alexdeucher@gmail.com> ???????(?):
> 
>> On Fri, Sep 20, 2013 at 9:36 AM, Alex Ivanov <gnidorah@p0n4ik.tk> wrote:
>>> Prevent NULL pointer dereference in case when radeon_ring_fini() did it's job.
>>> 
>>> Reading of r100_cp_ring_info and radeon_ring_gfx debugfs entries will lead to a KP if ring buffer was deallocated, e.g. on failed ring test.
>>> Seen on PA-RISC machine having "radeon: ring test failed (scratch(0x8504)=0xCAFEDEAD)" issue.
>>> 
>>> Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk>
>> 
>> Applied.  thanks!
>> 
>> Alex
> 
> One more. Thank you!
> 
> Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk>
> ---
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index e29faa7..e6d1897 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1319,6 +1319,11 @@ int radeon_device_init(struct radeon_device *rdev,
>                if (r)
>                        return r;
>        }
> +       /* If ring buffer or PCI GART got uninitialized, we should't run tests */
> +       if (!rdev->accel_working) {
> +               DRM_INFO("radeon: acceleration disabled, skipping tests and benchmark.\n");
> +               return 0;
> +       }
>        if ((radeon_testing & 1)) {
>                radeon_test_moves(rdev);
>        }
> 
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher Sept. 23, 2013, 2:44 p.m. UTC | #2
On Mon, Sep 23, 2013 at 7:59 AM, Alex Ivanov <gnidorah@p0n4ik.tk> wrote:
> P.S.: don't run means don't allow to run, by either feeding radeon.test=X
> or radeon.benchmark=1

Good catch.  I applied a slightly different variant of the same idea.

Thanks,

Alex

>
> 22.09.2013, ? 5:18, Alex Ivanov <gnidorah@p0n4ik.tk> ???????(?):
>
>> 20.09.2013, ? 22:33, Alex Deucher <alexdeucher@gmail.com> ???????(?):
>>
>>> On Fri, Sep 20, 2013 at 9:36 AM, Alex Ivanov <gnidorah@p0n4ik.tk> wrote:
>>>> Prevent NULL pointer dereference in case when radeon_ring_fini() did it's job.
>>>>
>>>> Reading of r100_cp_ring_info and radeon_ring_gfx debugfs entries will lead to a KP if ring buffer was deallocated, e.g. on failed ring test.
>>>> Seen on PA-RISC machine having "radeon: ring test failed (scratch(0x8504)=0xCAFEDEAD)" issue.
>>>>
>>>> Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk>
>>>
>>> Applied.  thanks!
>>>
>>> Alex
>>
>> One more. Thank you!
>>
>> Signed-off-by: Alex Ivanov <gnidorah@p0n4ik.tk>
>> ---
>> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
>> index e29faa7..e6d1897 100644
>> --- a/drivers/gpu/drm/radeon/radeon_device.c
>> +++ b/drivers/gpu/drm/radeon/radeon_device.c
>> @@ -1319,6 +1319,11 @@ int radeon_device_init(struct radeon_device *rdev,
>>                if (r)
>>                        return r;
>>        }
>> +       /* If ring buffer or PCI GART got uninitialized, we should't run tests */
>> +       if (!rdev->accel_working) {
>> +               DRM_INFO("radeon: acceleration disabled, skipping tests and benchmark.\n");
>> +               return 0;
>> +       }
>>        if ((radeon_testing & 1)) {
>>                radeon_test_moves(rdev);
>>        }
>>
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index e29faa7..e6d1897 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1319,6 +1319,11 @@  int radeon_device_init(struct radeon_device *rdev,
                if (r)
                        return r;
        }
+       /* If ring buffer or PCI GART got uninitialized, we should't run tests */
+       if (!rdev->accel_working) {
+               DRM_INFO("radeon: acceleration disabled, skipping tests and benchmark.\n");
+               return 0;
+       }
        if ((radeon_testing & 1)) {
                radeon_test_moves(rdev);
        }