drm/dp/mst: fix kernel oops when turning off secondary monitor
Subsystems (2)
PATCH 1/1 drm/dp/mst: fix kernel oops when turning off secondary monitor
100% reproducible issue found on SKL SkullCanyon NUC with two external DP daisy-chained monitors in DP/MST mode. When turning off or changing the input of the second monitor the machine stops with a kernel oops. This issue happened with 4.8.8 as well as drm/drm-intel-nightly.
This issue is traced to an inconsistent control flow in drm_dp_update_payload_part1(): the 'port' pointer is set to NULL at the same time as'req_payload.num_slots' is set to zero, but the pointer is dereferenced even when req_payload.num_slot is zero.
Fix by adding test condition to make sure both variables are used consistently. This removes the kernel oops.
There are still annoying cases where the primary display goes black when the secondary display is turned off but it can be recovered from by playing with the monitor inputs and power buttons.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98990
--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1815,7 +1815,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)drm_dp_create_payload_step1 (mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].vcpi = req_payload.vcpi; - }else if (mgr->payloads[i].num_slots) { + }else if (mgr->payloads[i].num_slots && port !=NULL ) { mgr->payloads[i].num_slots =0 ;drm_dp_destroy_payload_step1 (mgr, port, port->vcpi.vcpi, &mgr->payloads[i]); req_payload.payload_state = mgr->payloads[i].payload_state;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/dp/mst: fix kernel oops when turning off secondary monitor
== Series Details ==
== Series Details ==
Series: drm/dp/mst: fix kernel oops when turning off secondary monitor
URL : https://patchwork.freedesktop.org/series/16337/
State : success
== Summary ==
Series 16337v1 drm/dp/mst: fix kernel oops when turning off secondary monitor
https://patchwork.freedesktop.org/api/1.0/series/16337/revisions/1/mbox/
fi-bdw-5557u total:247 pass:232 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:247 pass:207 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:247 pass:219 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:247 pass:219 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:247 pass:215 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:247 pass:227 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:247 pass:227 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:247 pass:194 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:247 pass:225 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:247 pass:225 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7500u total:247 pass:225 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:247 pass:233 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:247 pass:226 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:247 pass:223 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:247 pass:233 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:247 pass:215 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:247 pass:214 dwarn:0 dfail:0 fail:0 skip:33
78c588b7383745c70d2a6b144c4c2032b120b949 drm-tip: 2016y-12m-02d-20h-20m-21s UTC integration manifest 5ea903d drm/dp/mst: fix kernel oops when turning off secondary monitor
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3184/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 28 lines · Pierre-Louis Bossart
100% reproducible issue found on SKL SkullCanyon NUC with two external DP daisy-chained monitors in DP/MST mode. When turning off or changing the input of the second monitor the machine stops with a kernel oops. This issue happened with 4.8.8 as well as drm/drm-intel-nightly.
This issue is traced to an inconsistent control flow in
drm_dp_update_payload_part1(): the 'port' pointer is set to NULL at the same time as'req_payload.num_slots' is set to zero, but the pointer is dereferenced even when req_payload.num_slot is zero.Fix by adding test condition to make sure both variables are used consistently. This removes the kernel oops.
There are still annoying cases where the primary display goes black when the secondary display is turned off but it can be recovered from by playing with the monitor inputs and power buttons.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98990
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_dp_mst_topology.c +0
-0
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · line 1820
Quoted 7 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -1815,7 +1815,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)drm_dp_create_payload_step1 (mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].vcpi = req_payload.vcpi; - }else if (mgr->payloads[i].num_slots) { + }else if (mgr->payloads[i].num_slots && port !=NULL ) { mgr->payloads[i].num_slots =0 ;drm_dp_destroy_payload_step1 (mgr, port, port->vcpi.vcpi, &mgr->payloads[i]);
s/port->vcpi.vcpi/mgr->payloads[i].vcpi/ here looks to be the correct fix.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 24 lines · Chris Wilson
Quoted 23 lines · Pierre-Louis Bossart
100% reproducible issue found on SKL SkullCanyon NUC with two external DP daisy-chained monitors in DP/MST mode. When turning off or changing the input of the second monitor the machine stops with a kernel oops. This issue happened with 4.8.8 as well as drm/drm-intel-nightly.
This issue is traced to an inconsistent control flow in
drm_dp_update_payload_part1(): the 'port' pointer is set to NULL at the same time as'req_payload.num_slots' is set to zero, but the pointer is dereferenced even when req_payload.num_slot is zero.Fix by adding test condition to make sure both variables are used consistently. This removes the kernel oops.
There are still annoying cases where the primary display goes black when the secondary display is turned off but it can be recovered from by playing with the monitor inputs and power buttons.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98990
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · line 1820
Quoted 12 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -1815,7 +1815,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)drm_dp_create_payload_step1 (mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].vcpi = req_payload.vcpi; - }else if (mgr->payloads[i].num_slots) { + }else if (mgr->payloads[i].num_slots && port !=NULL ) { mgr->payloads[i].num_slots =0 ;drm_dp_destroy_payload_step1 (mgr, port, port->vcpi.vcpi, &mgr->payloads[i]);s/port->vcpi.vcpi/mgr->payloads[i].vcpi/ here looks to be the correct fix.
-Chris
Hmm, not sure if that is the correct fix either. With port = NULL, doesn't look like we send drm_dp_payload_send_msg(..., pbn = 0). Although, we do update the payload table via DPCD
Also, if port is set to NULL, I wonder if we are messing up the reference counting. Because, this is done below.
...
if (port) drm_dp_put_port(port);
...
-DK
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 47 lines · Dhinakaran
Quoted 24 lines · Chris Wilson
Quoted 23 lines · Pierre-Louis Bossart
100% reproducible issue found on SKL SkullCanyon NUC with two external DP daisy-chained monitors in DP/MST mode. When turning off or changing the input of the second monitor the machine stops with a kernel oops. This issue happened with 4.8.8 as well as drm/drm-intel-nightly.
This issue is traced to an inconsistent control flow in
drm_dp_update_payload_part1(): the 'port' pointer is set to NULL at the same time as'req_payload.num_slots' is set to zero, but the pointer is dereferenced even when req_payload.num_slot is zero.Fix by adding test condition to make sure both variables are used consistently. This removes the kernel oops.
There are still annoying cases where the primary display goes black when the secondary display is turned off but it can be recovered from by playing with the monitor inputs and power buttons.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98990
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · line 1820
Quoted 12 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -1815,7 +1815,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)drm_dp_create_payload_step1 (mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].vcpi = req_payload.vcpi; - }else if (mgr->payloads[i].num_slots) { + }else if (mgr->payloads[i].num_slots && port !=NULL ) { mgr->payloads[i].num_slots =0 ;drm_dp_destroy_payload_step1 (mgr, port, port->vcpi.vcpi, &mgr->payloads[i]);s/port->vcpi.vcpi/mgr->payloads[i].vcpi/ here looks to be the correct fix.
-ChrisHmm, not sure if that is the correct fix either. With port = NULL, doesn't look like we send
drm_dp_payload_send_msg(..., pbn = 0). Although, we do update the payload table via DPCD
Quoted 6 lines
Also, if port is set to NULL, I wonder if we are messing up the reference counting. Because, this is done below.
...if (port) drm_dp_put_port(port);...
Chris' suggested fix works better than my initial proposal, I just sent the update as a V2. It may not be correct or complete but then someone smarter than me needs to take over. I am just an audio guy...
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 43 lines · Dhinakaran
Quoted 24 lines · Chris Wilson
Quoted 23 lines · Pierre-Louis Bossart
100% reproducible issue found on SKL SkullCanyon NUC with two external DP daisy-chained monitors in DP/MST mode. When turning off or changing the input of the second monitor the machine stops with a kernel oops. This issue happened with 4.8.8 as well as drm/drm-intel-nightly.
This issue is traced to an inconsistent control flow in
drm_dp_update_payload_part1(): the 'port' pointer is set to NULL at the same time as'req_payload.num_slots' is set to zero, but the pointer is dereferenced even when req_payload.num_slot is zero.Fix by adding test condition to make sure both variables are used consistently. This removes the kernel oops.
There are still annoying cases where the primary display goes black when the secondary display is turned off but it can be recovered from by playing with the monitor inputs and power buttons.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98990
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 17 lines
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · line 1820
Quoted 12 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -1815,7 +1815,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)drm_dp_create_payload_step1 (mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].vcpi = req_payload.vcpi; - }else if (mgr->payloads[i].num_slots) { + }else if (mgr->payloads[i].num_slots && port !=NULL ) { mgr->payloads[i].num_slots =0 ;drm_dp_destroy_payload_step1 (mgr, port, port->vcpi.vcpi, &mgr->payloads[i]);s/port->vcpi.vcpi/mgr->payloads[i].vcpi/ here looks to be the correct fix.
-Chris
Quoted 3 lines
Hmm, not sure if that is the correct fix either. With port = NULL, doesn't look like we send
drm_dp_payload_send_msg(..., pbn = 0). Although, we do update the payload table via DPCD
I'll leave that for you to work out if something needs to be sent after the downstream disappeared.
Quoted 5 lines
Also, if port is set to NULL, I wonder if we are messing up the reference counting. Because, this is done below.
...if (port) drm_dp_put_port(port);
This is ok, as this is clearing the local ref which is only obtained if port != NULL. (If port == NULL, we have no local ref which we need to put.)
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/dp/mst: fix kernel oops when turning off secondary monitor
In reply to Pierre-Louis Bossart== Series Details ==
== Series Details ==
Series: drm/dp/mst: fix kernel oops when turning off secondary monitor
URL : https://patchwork.freedesktop.org/series/16337/
State : success
== Summary ==
Series 16337v1 drm/dp/mst: fix kernel oops when turning off secondary monitor
https://patchwork.freedesktop.org/api/1.0/series/16337/revisions/1/mbox/
fi-bdw-5557u total:247 pass:232 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:247 pass:207 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:247 pass:219 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:247 pass:219 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:247 pass:215 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:247 pass:227 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:247 pass:227 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:247 pass:194 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:247 pass:225 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:247 pass:225 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7500u total:247 pass:225 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:247 pass:233 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:247 pass:226 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:247 pass:223 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:247 pass:233 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:247 pass:215 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:247 pass:214 dwarn:0 dfail:0 fail:0 skip:33
78c588b7383745c70d2a6b144c4c2032b120b949 drm-tip: 2016y-12m-02d-20h-20m-21s UTC integration manifest 5ea903d drm/dp/mst: fix kernel oops when turning off secondary monitor
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3184/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 28 lines · Pierre-Louis Bossart
100% reproducible issue found on SKL SkullCanyon NUC with two external DP daisy-chained monitors in DP/MST mode. When turning off or changing the input of the second monitor the machine stops with a kernel oops. This issue happened with 4.8.8 as well as drm/drm-intel-nightly.
This issue is traced to an inconsistent control flow in
drm_dp_update_payload_part1(): the 'port' pointer is set to NULL at the same time as'req_payload.num_slots' is set to zero, but the pointer is dereferenced even when req_payload.num_slot is zero.Fix by adding test condition to make sure both variables are used consistently. This removes the kernel oops.
There are still annoying cases where the primary display goes black when the secondary display is turned off but it can be recovered from by playing with the monitor inputs and power buttons.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98990
Signed-off-by Pierre-Louis Bossart <[email protected]>--- drivers/gpu/drm/drm_dp_mst_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_dp_mst_topology.c +0
-0
drivers/gpu/drm/drm_dp_mst_topology.c int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · line 1821
Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1
-1@@ -1815,7 +1815,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)drm_dp_create_payload_step1 (mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].vcpi = req_payload.vcpi; - }else if (mgr->payloads[i].num_slots) { + }else if (mgr->payloads[i].num_slots && port !=NULL ) { mgr->payloads[i].num_slots =0 ;drm_dp_destroy_payload_step1 (mgr, port, port->vcpi.vcpi, &mgr->payloads[i]); req_payload.payload_state = mgr->payloads[i].payload_state;
Or port shouldn't have been set to NULL in the first place. By adding, (port != NULL), you are not updating the payload state.
-DK
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx