* [PATCH v2 01/10] drm/connector: add mutex to protect ELD from concurrent access
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 02/10] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld Dmitry Baryshkov
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
The connector->eld is accessed by the .get_eld() callback. This access
can collide with the drm_edid_to_eld() updating the data at the same
time. Add drm_connector.eld_mutex to protect the data from concurrenct
access. Individual drivers are not updated (to reduce possible issues
while applying the patch), maintainers are to find a best suitable way
to lock that mutex while accessing the ELD data.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/drm_connector.c | 1 +
drivers/gpu/drm/drm_edid.c | 6 ++++++
include/drm/drm_connector.h | 5 ++++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index fc35f47e2849ed6786d6223ac9c69e1c359fc648..bbdaaf7022b62d84594a29f1b60144920903a99a 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -277,6 +277,7 @@ static int __drm_connector_init(struct drm_device *dev,
INIT_LIST_HEAD(&connector->probed_modes);
INIT_LIST_HEAD(&connector->modes);
mutex_init(&connector->mutex);
+ mutex_init(&connector->eld_mutex);
mutex_init(&connector->edid_override_mutex);
mutex_init(&connector->hdmi.infoframes.lock);
connector->edid_blob_ptr = NULL;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 855beafb76ffbecf5c08d58e2f54bfb76f30b930..13bc4c290b17d556d654b7cdd8c48c24a32aba9c 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5605,7 +5605,9 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);
static void clear_eld(struct drm_connector *connector)
{
+ mutex_lock(&connector->eld_mutex);
memset(connector->eld, 0, sizeof(connector->eld));
+ mutex_unlock(&connector->eld_mutex);
connector->latency_present[0] = false;
connector->latency_present[1] = false;
@@ -5657,6 +5659,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,
if (!drm_edid)
return;
+ mutex_lock(&connector->eld_mutex);
+
mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]);
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD monitor %s\n",
connector->base.id, connector->name,
@@ -5717,6 +5721,8 @@ static void drm_edid_to_eld(struct drm_connector *connector,
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD size %d, SAD count %d\n",
connector->base.id, connector->name,
drm_eld_size(eld), total_sad_count);
+
+ mutex_unlock(&connector->eld_mutex);
}
static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index e3fa43291f449d70f3b92a00985336c4f2237bc6..1e2b25e204cb523d61d30f5409faa059bf2b86eb 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -2001,8 +2001,11 @@ struct drm_connector {
struct drm_encoder *encoder;
#define MAX_ELD_BYTES 128
- /** @eld: EDID-like data, if present */
+ /** @eld: EDID-like data, if present, protected by @eld_mutex */
uint8_t eld[MAX_ELD_BYTES];
+ /** @eld_mutex: protection for concurrenct access to @eld */
+ struct mutex eld_mutex;
+
/** @latency_present: AV delay info from ELD, if found */
bool latency_present[2];
/**
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 02/10] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 01/10] drm/connector: add mutex to protect ELD from concurrent access Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 03/10] drm/bridge: ite-it66121: " Dmitry Baryshkov
` (9 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index a2675b121fe44b96945f34215fd900f35bfde43a..c036bbc92ba96ec4663c55cca091cd5da9f6d271 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -2002,8 +2002,10 @@ static int anx7625_audio_get_eld(struct device *dev, void *data,
memset(buf, 0, len);
} else {
dev_dbg(dev, "audio copy eld\n");
+ mutex_lock(&ctx->connector->eld_mutex);
memcpy(buf, ctx->connector->eld,
min(sizeof(ctx->connector->eld), len));
+ mutex_unlock(&ctx->connector->eld_mutex);
}
return 0;
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 03/10] drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 01/10] drm/connector: add mutex to protect ELD from concurrent access Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 02/10] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 04/10] drm/amd/display: " Dmitry Baryshkov
` (8 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/ite-it66121.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index 35ae3f0e8f51f768229e055a086b53a419ffcd9f..940083e5d2ddbfc56f14e2bdc6ddd0b9dd50b1f8 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1450,8 +1450,10 @@ static int it66121_audio_get_eld(struct device *dev, void *data,
dev_dbg(dev, "No connector present, passing empty EDID data");
memset(buf, 0, len);
} else {
+ mutex_lock(&ctx->connector->eld_mutex);
memcpy(buf, ctx->connector->eld,
min(sizeof(ctx->connector->eld), len));
+ mutex_unlock(&ctx->connector->eld_mutex);
}
mutex_unlock(&ctx->lock);
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (2 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 03/10] drm/bridge: ite-it66121: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-10 21:20 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 05/10] drm/exynos: hdmi: " Dmitry Baryshkov
` (7 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
continue;
*enabled = true;
+ mutex_lock(&connector->eld_mutex);
ret = drm_eld_size(connector->eld);
memcpy(buf, connector->eld, min(max_bytes, ret));
+ mutex_unlock(&connector->eld_mutex);
break;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 ` [PATCH v2 04/10] drm/amd/display: " Dmitry Baryshkov
@ 2024-12-10 21:20 ` Dmitry Baryshkov
2024-12-16 14:53 ` Harry Wentland
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-10 21:20 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
On Fri, Dec 06, 2024 at 11:43:07AM +0200, Dmitry Baryshkov wrote:
> Reading access to connector->eld can happen at the same time the
> drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
> order to protect connector->eld from concurrent access.
>
> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
> 1 file changed, 2 insertions(+)
Harry, Leo, Rodrigo, Alex, Christian, Xinhui, any response to this one
and to the radeon patches? I'd like to be able to pick the series for
drm-misc and these two are not reviewed by you.
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
> continue;
>
> *enabled = true;
> + mutex_lock(&connector->eld_mutex);
> ret = drm_eld_size(connector->eld);
> memcpy(buf, connector->eld, min(max_bytes, ret));
> + mutex_unlock(&connector->eld_mutex);
>
> break;
> }
>
> --
> 2.39.5
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-10 21:20 ` Dmitry Baryshkov
@ 2024-12-16 14:53 ` Harry Wentland
2024-12-16 15:12 ` Dmitry Baryshkov
0 siblings, 1 reply; 20+ messages in thread
From: Harry Wentland @ 2024-12-16 14:53 UTC (permalink / raw)
To: Dmitry Baryshkov, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Leo Li,
Rodrigo Siqueira, Alex Deucher, Christian König, Xinhui Pan,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim,
Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Jani Nikula,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, Rob Clark,
Abhinav Kumar, Sean Paul, Marijn Suijten, Alain Volmat,
Raphael Gallais-Pou, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
On 2024-12-10 16:20, Dmitry Baryshkov wrote:
> On Fri, Dec 06, 2024 at 11:43:07AM +0200, Dmitry Baryshkov wrote:
>> Reading access to connector->eld can happen at the same time the
>> drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
>> order to protect connector->eld from concurrent access.
>>
>> Reviewed-by: Maxime Ripard <mripard@kernel.org>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
>> 1 file changed, 2 insertions(+)
>
> Harry, Leo, Rodrigo, Alex, Christian, Xinhui, any response to this one
> and to the radeon patches? I'd like to be able to pick the series for
> drm-misc and these two are not reviewed by you.
>
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
>> continue;
>>
>> *enabled = true;
>> + mutex_lock(&connector->eld_mutex);
>> ret = drm_eld_size(connector->eld);
>> memcpy(buf, connector->eld, min(max_bytes, ret));
>> + mutex_unlock(&connector->eld_mutex);
All of this is wrapped by the adev->dm.audio_lock mutex. It might
be safer to modify the audio_lock mutex so it only guards the
aconnector->audio_inst access.
But I don't see any way these mutexes would otherwise interact,
so this change should be good as-is.
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
>>
>> break;
>> }
>>
>> --
>> 2.39.5
>>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-16 14:53 ` Harry Wentland
@ 2024-12-16 15:12 ` Dmitry Baryshkov
2024-12-16 15:31 ` Alex Deucher
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-16 15:12 UTC (permalink / raw)
To: Harry Wentland
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Leo Li, Rodrigo Siqueira, Alex Deucher,
Christian König, Xinhui Pan, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
On Mon, 16 Dec 2024 at 16:53, Harry Wentland <harry.wentland@amd.com> wrote:
>
>
>
> On 2024-12-10 16:20, Dmitry Baryshkov wrote:
> > On Fri, Dec 06, 2024 at 11:43:07AM +0200, Dmitry Baryshkov wrote:
> >> Reading access to connector->eld can happen at the same time the
> >> drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
> >> order to protect connector->eld from concurrent access.
> >>
> >> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >> ---
> >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >
> > Harry, Leo, Rodrigo, Alex, Christian, Xinhui, any response to this one
> > and to the radeon patches? I'd like to be able to pick the series for
> > drm-misc and these two are not reviewed by you.
> >
> >>
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
> >> continue;
> >>
> >> *enabled = true;
> >> + mutex_lock(&connector->eld_mutex);
> >> ret = drm_eld_size(connector->eld);
> >> memcpy(buf, connector->eld, min(max_bytes, ret));
> >> + mutex_unlock(&connector->eld_mutex);
>
> All of this is wrapped by the adev->dm.audio_lock mutex. It might
> be safer to modify the audio_lock mutex so it only guards the
> aconnector->audio_inst access.
>
> But I don't see any way these mutexes would otherwise interact,
> so this change should be good as-is.
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Would you ack it to merge it through drm-misc? Or would you prefer to
pick up those two patches after merging drm-misc-next once the rest of
the series lands?
>
> Harry
>
> >>
> >> break;
> >> }
> >>
> >> --
> >> 2.39.5
> >>
> >
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-16 15:12 ` Dmitry Baryshkov
@ 2024-12-16 15:31 ` Alex Deucher
2024-12-16 15:39 ` Dmitry Baryshkov
2024-12-16 19:38 ` Harry Wentland
0 siblings, 2 replies; 20+ messages in thread
From: Alex Deucher @ 2024-12-16 15:31 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Harry Wentland, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Leo Li,
Rodrigo Siqueira, Alex Deucher, Christian König, Xinhui Pan,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim,
Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Jani Nikula,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, Rob Clark,
Abhinav Kumar, Sean Paul, Marijn Suijten, Alain Volmat,
Raphael Gallais-Pou, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, dri-devel, linux-kernel, amd-gfx,
linux-arm-kernel, linux-samsung-soc, intel-gfx, intel-xe,
linux-arm-msm, freedreno
On Mon, Dec 16, 2024 at 10:12 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Mon, 16 Dec 2024 at 16:53, Harry Wentland <harry.wentland@amd.com> wrote:
> >
> >
> >
> > On 2024-12-10 16:20, Dmitry Baryshkov wrote:
> > > On Fri, Dec 06, 2024 at 11:43:07AM +0200, Dmitry Baryshkov wrote:
> > >> Reading access to connector->eld can happen at the same time the
> > >> drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
> > >> order to protect connector->eld from concurrent access.
> > >>
> > >> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> > >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > >> ---
> > >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
> > >> 1 file changed, 2 insertions(+)
> > >
> > > Harry, Leo, Rodrigo, Alex, Christian, Xinhui, any response to this one
> > > and to the radeon patches? I'd like to be able to pick the series for
> > > drm-misc and these two are not reviewed by you.
> > >
> > >>
> > >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > >> index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
> > >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > >> @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
> > >> continue;
> > >>
> > >> *enabled = true;
> > >> + mutex_lock(&connector->eld_mutex);
> > >> ret = drm_eld_size(connector->eld);
> > >> memcpy(buf, connector->eld, min(max_bytes, ret));
> > >> + mutex_unlock(&connector->eld_mutex);
> >
> > All of this is wrapped by the adev->dm.audio_lock mutex. It might
> > be safer to modify the audio_lock mutex so it only guards the
> > aconnector->audio_inst access.
> >
> > But I don't see any way these mutexes would otherwise interact,
> > so this change should be good as-is.
> >
> > Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Would you ack it to merge it through drm-misc? Or would you prefer to
> pick up those two patches after merging drm-misc-next once the rest of
> the series lands?
Merging through drm-misc is fine with me.
Thanks,
Alex
>
> >
> > Harry
> >
> > >>
> > >> break;
> > >> }
> > >>
> > >> --
> > >> 2.39.5
> > >>
> > >
> >
>
>
> --
> With best wishes
> Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-16 15:31 ` Alex Deucher
@ 2024-12-16 15:39 ` Dmitry Baryshkov
2024-12-16 19:38 ` Harry Wentland
1 sibling, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-16 15:39 UTC (permalink / raw)
To: Alex Deucher
Cc: Harry Wentland, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Leo Li,
Rodrigo Siqueira, Alex Deucher, Christian König, Xinhui Pan,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim,
Kyungmin Park, Krzysztof Kozlowski, Alim Akhtar, Jani Nikula,
Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin, Rob Clark,
Abhinav Kumar, Sean Paul, Marijn Suijten, Alain Volmat,
Raphael Gallais-Pou, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, dri-devel, linux-kernel, amd-gfx,
linux-arm-kernel, linux-samsung-soc, intel-gfx, intel-xe,
linux-arm-msm, freedreno
On Mon, 16 Dec 2024 at 17:32, Alex Deucher <alexdeucher@gmail.com> wrote:
>
> On Mon, Dec 16, 2024 at 10:12 AM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Mon, 16 Dec 2024 at 16:53, Harry Wentland <harry.wentland@amd.com> wrote:
> > >
> > >
> > >
> > > On 2024-12-10 16:20, Dmitry Baryshkov wrote:
> > > > On Fri, Dec 06, 2024 at 11:43:07AM +0200, Dmitry Baryshkov wrote:
> > > >> Reading access to connector->eld can happen at the same time the
> > > >> drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
> > > >> order to protect connector->eld from concurrent access.
> > > >>
> > > >> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> > > >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > >> ---
> > > >> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
> > > >> 1 file changed, 2 insertions(+)
> > > >
> > > > Harry, Leo, Rodrigo, Alex, Christian, Xinhui, any response to this one
> > > > and to the radeon patches? I'd like to be able to pick the series for
> > > > drm-misc and these two are not reviewed by you.
> > > >
> > > >>
> > > >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > >> index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
> > > >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > > >> @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
> > > >> continue;
> > > >>
> > > >> *enabled = true;
> > > >> + mutex_lock(&connector->eld_mutex);
> > > >> ret = drm_eld_size(connector->eld);
> > > >> memcpy(buf, connector->eld, min(max_bytes, ret));
> > > >> + mutex_unlock(&connector->eld_mutex);
> > >
> > > All of this is wrapped by the adev->dm.audio_lock mutex. It might
> > > be safer to modify the audio_lock mutex so it only guards the
> > > aconnector->audio_inst access.
> > >
> > > But I don't see any way these mutexes would otherwise interact,
> > > so this change should be good as-is.
> > >
> > > Reviewed-by: Harry Wentland <harry.wentland@amd.com>
> >
> > Would you ack it to merge it through drm-misc? Or would you prefer to
> > pick up those two patches after merging drm-misc-next once the rest of
> > the series lands?
>
> Merging through drm-misc is fine with me.
Thanks!
>
> Thanks,
>
> Alex
>
> >
> > >
> > > Harry
> > >
> > > >>
> > > >> break;
> > > >> }
> > > >>
> > > >> --
> > > >> 2.39.5
> > > >>
> > > >
> > >
> >
> >
> > --
> > With best wishes
> > Dmitry
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
2024-12-16 15:31 ` Alex Deucher
2024-12-16 15:39 ` Dmitry Baryshkov
@ 2024-12-16 19:38 ` Harry Wentland
1 sibling, 0 replies; 20+ messages in thread
From: Harry Wentland @ 2024-12-16 19:38 UTC (permalink / raw)
To: Alex Deucher, Dmitry Baryshkov
Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Leo Li, Rodrigo Siqueira, Alex Deucher,
Christian König, Xinhui Pan, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
On 2024-12-16 10:31, Alex Deucher wrote:
> On Mon, Dec 16, 2024 at 10:12 AM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
>>
>> On Mon, 16 Dec 2024 at 16:53, Harry Wentland <harry.wentland@amd.com> wrote:
>>>
>>>
>>>
>>> On 2024-12-10 16:20, Dmitry Baryshkov wrote:
>>>> On Fri, Dec 06, 2024 at 11:43:07AM +0200, Dmitry Baryshkov wrote:
>>>>> Reading access to connector->eld can happen at the same time the
>>>>> drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
>>>>> order to protect connector->eld from concurrent access.
>>>>>
>>>>> Reviewed-by: Maxime Ripard <mripard@kernel.org>
>>>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>>>> ---
>>>>> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
>>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> Harry, Leo, Rodrigo, Alex, Christian, Xinhui, any response to this one
>>>> and to the radeon patches? I'd like to be able to pick the series for
>>>> drm-misc and these two are not reviewed by you.
>>>>
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>>> index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644
>>>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>>> @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port,
>>>>> continue;
>>>>>
>>>>> *enabled = true;
>>>>> + mutex_lock(&connector->eld_mutex);
>>>>> ret = drm_eld_size(connector->eld);
>>>>> memcpy(buf, connector->eld, min(max_bytes, ret));
>>>>> + mutex_unlock(&connector->eld_mutex);
>>>
>>> All of this is wrapped by the adev->dm.audio_lock mutex. It might
>>> be safer to modify the audio_lock mutex so it only guards the
>>> aconnector->audio_inst access.
>>>
>>> But I don't see any way these mutexes would otherwise interact,
>>> so this change should be good as-is.
>>>
>>> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>>
>> Would you ack it to merge it through drm-misc? Or would you prefer to
>> pick up those two patches after merging drm-misc-next once the rest of
>> the series lands?
>
> Merging through drm-misc is fine with me.
>
Same.
Harry
> Thanks,
>
> Alex
>
>>
>>>
>>> Harry
>>>
>>>>>
>>>>> break;
>>>>> }
>>>>>
>>>>> --
>>>>> 2.39.5
>>>>>
>>>>
>>>
>>
>>
>> --
>> With best wishes
>> Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 05/10] drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (3 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 04/10] drm/amd/display: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 06/10] drm/i915/audio: " Dmitry Baryshkov
` (6 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index c9d4b9146df95bb46cb6bea4849c331616c2b463..6fc537c9048f5c8e57e30f083121c9aea6b99a5f 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1648,7 +1648,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf,
struct hdmi_context *hdata = dev_get_drvdata(dev);
struct drm_connector *connector = &hdata->connector;
+ mutex_lock(&connector->eld_mutex);
memcpy(buf, connector->eld, min(sizeof(connector->eld), len));
+ mutex_unlock(&connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 06/10] drm/i915/audio: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (4 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 05/10] drm/exynos: hdmi: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 07/10] drm/msm/dp: " Dmitry Baryshkov
` (5 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno,
Jani Nikula
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/i915/display/intel_audio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
index 32aa9ec1a204d2ecde46cad36598aa768a3af671..3902ab8431139c3ff4dc17b841d94b6d3241dec3 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -699,10 +699,12 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,
const struct drm_display_mode *adjusted_mode =
&crtc_state->hw.adjusted_mode;
+ mutex_lock(&connector->eld_mutex);
if (!connector->eld[0]) {
drm_dbg_kms(&i915->drm,
"Bogus ELD on [CONNECTOR:%d:%s]\n",
connector->base.id, connector->name);
+ mutex_unlock(&connector->eld_mutex);
return false;
}
@@ -710,6 +712,7 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,
memcpy(crtc_state->eld, connector->eld, sizeof(crtc_state->eld));
crtc_state->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
+ mutex_unlock(&connector->eld_mutex);
return true;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 07/10] drm/msm/dp: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (5 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 06/10] drm/i915/audio: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 08/10] drm/radeon: " Dmitry Baryshkov
` (4 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/msm/dp/dp_audio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c
index 74e01a5dd4195d5e0e04250663886f1116f25711..0fd5e0abaf07828157085bd680bfd3c7d32deb61 100644
--- a/drivers/gpu/drm/msm/dp/dp_audio.c
+++ b/drivers/gpu/drm/msm/dp/dp_audio.c
@@ -414,8 +414,10 @@ static int msm_dp_audio_get_eld(struct device *dev,
return -ENODEV;
}
+ mutex_lock(&msm_dp_display->connector->eld_mutex);
memcpy(buf, msm_dp_display->connector->eld,
min(sizeof(msm_dp_display->connector->eld), len));
+ mutex_unlock(&msm_dp_display->connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 08/10] drm/radeon: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (6 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 07/10] drm/msm/dp: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 09/10] drm/sti: hdmi: " Dmitry Baryshkov
` (3 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/radeon/radeon_audio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index 5b69cc8011b42b4686c02f97a2b451a63d6c346d..8d64ba18572ec4bb6f6985be3a5edf581c47d7a3 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -775,8 +775,10 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port,
if (!dig->pin || dig->pin->id != port)
continue;
*enabled = true;
+ mutex_lock(&connector->eld_mutex);
ret = drm_eld_size(connector->eld);
memcpy(buf, connector->eld, min(max_bytes, ret));
+ mutex_unlock(&connector->eld_mutex);
break;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 09/10] drm/sti: hdmi: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (7 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 08/10] drm/radeon: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-06 9:43 ` [PATCH v2 10/10] drm/vc4: " Dmitry Baryshkov
` (2 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/sti/sti_hdmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 847470f747c0efad61c2ebdc3fb3746a7a13a863..3c8f3532c79723e7b1a720c855c90e40584cc6ca 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1225,7 +1225,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size
struct drm_connector *connector = hdmi->drm_connector;
DRM_DEBUG_DRIVER("\n");
+ mutex_lock(&connector->eld_mutex);
memcpy(buf, connector->eld, min(sizeof(connector->eld), len));
+ mutex_unlock(&connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 10/10] drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (8 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 09/10] drm/sti: hdmi: " Dmitry Baryshkov
@ 2024-12-06 9:43 ` Dmitry Baryshkov
2024-12-16 11:24 ` [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
2024-12-16 16:08 ` Dmitry Baryshkov
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-06 9:43 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno
Reading access to connector->eld can happen at the same time the
drm_edid_to_eld() updates the data. Take the newly added eld_mutex in
order to protect connector->eld from concurrent access.
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 297afd89036ba8fba571379f5b6d63227eadb66e..f98617b8bf6cf9d92a806e35584e8f8ab0ac9f96 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2220,9 +2220,9 @@ static int vc4_hdmi_audio_get_eld(struct device *dev, void *data,
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
struct drm_connector *connector = &vc4_hdmi->connector;
- mutex_lock(&vc4_hdmi->mutex);
+ mutex_lock(&connector->eld_mutex);
memcpy(buf, connector->eld, min(sizeof(connector->eld), len));
- mutex_unlock(&vc4_hdmi->mutex);
+ mutex_unlock(&connector->eld_mutex);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (9 preceding siblings ...)
2024-12-06 9:43 ` [PATCH v2 10/10] drm/vc4: " Dmitry Baryshkov
@ 2024-12-16 11:24 ` Dmitry Baryshkov
2024-12-16 15:24 ` Maxime Ripard
2024-12-16 16:08 ` Dmitry Baryshkov
11 siblings, 1 reply; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-16 11:24 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno,
Jani Nikula
On Fri, Dec 06, 2024 at 11:43:03AM +0200, Dmitry Baryshkov wrote:
> The connector->eld is accessed by the .get_eld() callback. This access
> can collide with the drm_edid_to_eld() updating the data at the same
> time. Add drm_connector.eld_mutex to protect the data from concurrenct
> access.
>
> The individual drivers were just compile tested. I propose to merge the
> drm_connector and bridge drivers through drm-misc, allowing other
> maintainers either to ack merging through drm-misc or merging the
> drm-misc into their tree and then picking up correcponding patch.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> Changes in v2:
> - Also take the mutex in clear_eld() (Jani)
> - Rebased on top of linux-next + drm-misc-next to solve build error
> - Link to v1: https://lore.kernel.org/r/20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org
>
> ---
> Dmitry Baryshkov (10):
> drm/connector: add mutex to protect ELD from concurrent access
> drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
> drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
> drm/amd/display: use eld_mutex to protect access to connector->eld
> drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
> drm/i915/audio: use eld_mutex to protect access to connector->eld
> drm/msm/dp: use eld_mutex to protect access to connector->eld
> drm/radeon: use eld_mutex to protect access to connector->eld
> drm/sti: hdmi: use eld_mutex to protect access to connector->eld
> drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
Granted the lack of reviews from AMD maintainers and granted that the
rest of the series was reviewed and acked, is it suitable to leave those
two patches out and merge the rest through drm-misc-next?
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld
2024-12-16 11:24 ` [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
@ 2024-12-16 15:24 ` Maxime Ripard
0 siblings, 0 replies; 20+ messages in thread
From: Maxime Ripard @ 2024-12-16 15:24 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
Christian König, Xinhui Pan, Andrzej Hajda, Neil Armstrong,
Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno,
Jani Nikula
[-- Attachment #1: Type: text/plain, Size: 2070 bytes --]
On Mon, Dec 16, 2024 at 01:24:29PM +0200, Dmitry Baryshkov wrote:
> On Fri, Dec 06, 2024 at 11:43:03AM +0200, Dmitry Baryshkov wrote:
> > The connector->eld is accessed by the .get_eld() callback. This access
> > can collide with the drm_edid_to_eld() updating the data at the same
> > time. Add drm_connector.eld_mutex to protect the data from concurrenct
> > access.
> >
> > The individual drivers were just compile tested. I propose to merge the
> > drm_connector and bridge drivers through drm-misc, allowing other
> > maintainers either to ack merging through drm-misc or merging the
> > drm-misc into their tree and then picking up correcponding patch.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> > Changes in v2:
> > - Also take the mutex in clear_eld() (Jani)
> > - Rebased on top of linux-next + drm-misc-next to solve build error
> > - Link to v1: https://lore.kernel.org/r/20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org
> >
> > ---
> > Dmitry Baryshkov (10):
> > drm/connector: add mutex to protect ELD from concurrent access
> > drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
> > drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
> > drm/amd/display: use eld_mutex to protect access to connector->eld
> > drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
> > drm/i915/audio: use eld_mutex to protect access to connector->eld
> > drm/msm/dp: use eld_mutex to protect access to connector->eld
> > drm/radeon: use eld_mutex to protect access to connector->eld
> > drm/sti: hdmi: use eld_mutex to protect access to connector->eld
> > drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
>
> Granted the lack of reviews from AMD maintainers and granted that the
> rest of the series was reviewed and acked, is it suitable to leave those
> two patches out and merge the rest through drm-misc-next?
Sounds reasonable to me
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld
2024-12-06 9:43 [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
` (10 preceding siblings ...)
2024-12-16 11:24 ` [PATCH v2 00/10] drm/connector: add eld_mutex to protect connector->eld Dmitry Baryshkov
@ 2024-12-16 16:08 ` Dmitry Baryshkov
11 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2024-12-16 16:08 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Harry Wentland, Leo Li, Rodrigo Siqueira,
Alex Deucher, Christian König, Xinhui Pan, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Phong LE, Inki Dae, Seung-Woo Kim, Kyungmin Park,
Krzysztof Kozlowski, Alim Akhtar, Jani Nikula, Rodrigo Vivi,
Joonas Lahtinen, Tvrtko Ursulin, Rob Clark, Abhinav Kumar,
Sean Paul, Marijn Suijten, Alain Volmat, Raphael Gallais-Pou,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
Dmitry Baryshkov
Cc: dri-devel, linux-kernel, amd-gfx, linux-arm-kernel,
linux-samsung-soc, intel-gfx, intel-xe, linux-arm-msm, freedreno,
Jani Nikula
On Fri, 06 Dec 2024 11:43:03 +0200, Dmitry Baryshkov wrote:
> The connector->eld is accessed by the .get_eld() callback. This access
> can collide with the drm_edid_to_eld() updating the data at the same
> time. Add drm_connector.eld_mutex to protect the data from concurrenct
> access.
>
> The individual drivers were just compile tested. I propose to merge the
> drm_connector and bridge drivers through drm-misc, allowing other
> maintainers either to ack merging through drm-misc or merging the
> drm-misc into their tree and then picking up correcponding patch.
>
> [...]
Applied to drm-misc-next, thanks!
[01/10] drm/connector: add mutex to protect ELD from concurrent access
commit: df7c8e3dde37a9d81c0613285b43600f3cc70f34
[02/10] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld
commit: e72bf423a60afd744d13e40ab2194044a3af5217
[03/10] drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld
commit: 39ead6e02ea7d19b421e9d42299d4293fed3064e
[04/10] drm/amd/display: use eld_mutex to protect access to connector->eld
commit: 819bee01eea06282d7bda17d46caf29cae4f6d84
[05/10] drm/exynos: hdmi: use eld_mutex to protect access to connector->eld
commit: 5e8436d334ed7f6785416447c50b42077c6503e0
[06/10] drm/i915/audio: use eld_mutex to protect access to connector->eld
commit: 5db44dd1528625c73a31542df2a68972327c9897
[07/10] drm/msm/dp: use eld_mutex to protect access to connector->eld
commit: 9aad030dc64f6994dc5de7bb81ceca55dbc555c3
[08/10] drm/radeon: use eld_mutex to protect access to connector->eld
commit: b54c14f82428c8a602392d4cae1958a71a578132
[09/10] drm/sti: hdmi: use eld_mutex to protect access to connector->eld
commit: e99c0b517bcd53cf61f998a3c4291333401cb391
[10/10] drm/vc4: hdmi: use eld_mutex to protect access to connector->eld
commit: 81a9a93b169a273ccc4a9a1ee56f17e9981d3f98
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 20+ messages in thread