* [PATCH] drm/amdgpu: warn if dp aux is still attached on free
@ 2016-10-02 21:06 Grazvydas Ignotas
2016-10-03 15:46 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Grazvydas Ignotas @ 2016-10-02 21:06 UTC (permalink / raw)
To: dri-devel, amd-gfx
If this happens (and it recently did), we free a structure while part of
it is still in use, which results in non-obvious crashes. The way it's
detached is not trivial (DRM core has to call the connector .destroy
callback and things must be torn down in the right order), so better
detect it and warn early.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 +++-
drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index ff0b55a..76a7830 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -769,8 +769,10 @@ static void amdgpu_connector_destroy(struct drm_connector *connector)
{
struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
- if (amdgpu_connector->ddc_bus->has_aux)
+ if (amdgpu_connector->ddc_bus->has_aux) {
drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
+ amdgpu_connector->ddc_bus->has_aux = false;
+ }
amdgpu_connector_free_edid(connector);
kfree(amdgpu_connector->con_priv);
drm_connector_unregister(connector);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
index 34bab61..91d3673 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
@@ -220,6 +220,7 @@ void amdgpu_i2c_destroy(struct amdgpu_i2c_chan *i2c)
{
if (!i2c)
return;
+ WARN_ON(i2c->has_aux);
i2c_del_adapter(&i2c->adapter);
kfree(i2c);
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drm/amdgpu: warn if dp aux is still attached on free
2016-10-02 21:06 [PATCH] drm/amdgpu: warn if dp aux is still attached on free Grazvydas Ignotas
@ 2016-10-03 15:46 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2016-10-03 15:46 UTC (permalink / raw)
To: Grazvydas Ignotas; +Cc: amd-gfx list, Maling list - DRI developers
On Sun, Oct 2, 2016 at 5:06 PM, Grazvydas Ignotas <notasas@gmail.com> wrote:
> If this happens (and it recently did), we free a structure while part of
> it is still in use, which results in non-obvious crashes. The way it's
> detached is not trivial (DRM core has to call the connector .destroy
> callback and things must be torn down in the right order), so better
> detect it and warn early.
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Applied. thanks!
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 +++-
> drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 1 +
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index ff0b55a..76a7830 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -769,8 +769,10 @@ static void amdgpu_connector_destroy(struct drm_connector *connector)
> {
> struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>
> - if (amdgpu_connector->ddc_bus->has_aux)
> + if (amdgpu_connector->ddc_bus->has_aux) {
> drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
> + amdgpu_connector->ddc_bus->has_aux = false;
> + }
> amdgpu_connector_free_edid(connector);
> kfree(amdgpu_connector->con_priv);
> drm_connector_unregister(connector);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
> index 34bab61..91d3673 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
> @@ -220,6 +220,7 @@ void amdgpu_i2c_destroy(struct amdgpu_i2c_chan *i2c)
> {
> if (!i2c)
> return;
> + WARN_ON(i2c->has_aux);
> i2c_del_adapter(&i2c->adapter);
> kfree(i2c);
> }
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-03 15:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-02 21:06 [PATCH] drm/amdgpu: warn if dp aux is still attached on free Grazvydas Ignotas
2016-10-03 15:46 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox