Skip to contentSkip to conversation

drm: Change link order to load modules first

PATCH In review Ezequiel Garcia 2 participants 5 messages Jun 23, 2014 – Jun 27, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Change link order to load modules first

Given panels and I2C-connected encoders are required by DRM drivers, we need to change the link order so these are probed first. This commit moves all the i2c, panel and bridge helper drivers so they are probed before the DRM drivers.

---
 drivers/gpu/drm/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/Makefile +4 -3
index dd2ba42..552eaad 100644
@@ -33,6 +33,10 @@ obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
 
 CFLAGS_drm_trace_points.o := -I$(src)
 
+obj-y			+= i2c/
+obj-y			+= panel/
+obj-y			+= bridge/
+
 obj-$(CONFIG_DRM)	+= drm.o
 obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
 obj-$(CONFIG_DRM_USB)   += drm_usb.o
@@ -63,6 +67,3 @@ obj-$(CONFIG_DRM_QXL) += qxl/
 obj-$(CONFIG_DRM_BOCHS) += bochs/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
-obj-y			+= i2c/
-obj-y			+= panel/
-obj-y			+= bridge/
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Ezequiel Garcia

Given panels and I2C-connected encoders are required by DRM drivers, we need to change the link order so these are probed first. This commit moves all the i2c, panel and bridge helper drivers so they are probed before the DRM drivers.

No. We don't need to change the link order. What we need to do is make sure that modules deal properly with situations where their resources aren't available yet (i.e. EPROBE_DEFER). There are factors other than link order that influence probe ordering.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Thierry,

Thanks for looking at this.

Quoted 7 lines · Thierry Reding
Quoted 4 lines · Ezequiel Garcia

Given panels and I2C-connected encoders are required by DRM drivers, we need to change the link order so these are probed first. This commit moves all the i2c, panel and bridge helper drivers so they are probed before the DRM drivers.

No. We don't need to change the link order.

Could you clarify why? I guess you have some case in mind where changing the link order breaks things or makes something mis-behave.

Quoted 5 lines

What we need to do is make
sure that modules deal properly with situations where their resources aren't available yet (i.e. EPROBE_DEFER). There are factors other than link order that influence probe ordering.

While I understand defering is more robust, it would be systematically defering the probe when the DRM driver needs an I2C encoder.

Just to name one example, the tilcdc, armada and others requiring TDA998x encoder will always defered the probe of the DRM, and then re-probe() once the encoder is ready.

So, unless we have a good reason not to do this, it sounds a bit silly to me.

Signature · 2 lines
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
#3 lore raw
Quoted 11 lines · Ezequiel Garcia

Hi Thierry,

Thanks for looking at this.

Quoted 6 lines · Thierry Reding
Quoted 4 lines · Ezequiel Garcia

Given panels and I2C-connected encoders are required by DRM drivers, we need to change the link order so these are probed first. This commit moves all the i2c, panel and bridge helper drivers so they are probed before the DRM drivers.

Quoted 4 lines
Quoted 1 line

No. We don't need to change the link order.

Could you clarify why? I guess you have some case in mind where changing the link order breaks things or makes something mis-behave.

I said we don't need to change the link order because there is a better mechanism in the kernel to handle this type of situation. Saying "we need to change" makes it sound like there's a bug that needs to be fixed by changing the link order. That's not so. If link order breaks some drivers then its those drivers that are broken.

Quoted 9 lines
Quoted 5 lines

What we need to do is make
sure that modules deal properly with situations where their resources aren't available yet (i.e. EPROBE_DEFER). There are factors other than link order that influence probe ordering.

While I understand defering is more robust, it would be systematically defering the probe when the DRM driver needs an I2C encoder.

Quoted 6 lines

Just to name one example, the tilcdc, armada and others requiring TDA998x encoder will always defered the probe of the DRM, and then re-probe() once the encoder is ready.

So, unless we have a good reason not to do this, it sounds a bit silly to me.

The problem that I have with working around this issue by changing the link order is that it hides bugs in drivers. It's not like probe deferral is a very expensive operation, so I very much prefer this as a way of forcing drivers to be fixed rather than optimizing for a few microseconds of boot time.

Also note that even if TDA998x is probed first that doesn't mean the probe will succeed. It could equally well be deferred.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 4 lines · Thierry Reding
Quoted 3 lines · Ezequiel Garcia
Quoted 2 lines

No. We don't need to change the link order.

Quoted 9 lines
Quoted 2 lines

Could you clarify why? I guess you have some case in mind where changing the link order breaks things or makes something mis-behave.

I said we don't need to change the link order because there is a better mechanism in the kernel to handle this type of situation. Saying "we need to change" makes it sound like there's a bug that needs to be fixed by changing the link order. That's not so. If link order breaks some drivers then its those drivers that are broken.

Ah, OK. I understand your point now. On a second read, my commit log isn't too clear explaining why I want to change the order.

Quoted 13 lines
Quoted 13 lines
Quoted 5 lines

What we need to do is make
sure that modules deal properly with situations where their resources aren't available yet (i.e. EPROBE_DEFER). There are factors other than link order that influence probe ordering.

While I understand defering is more robust, it would be systematically defering the probe when the DRM driver needs an I2C encoder.

Just to name one example, the tilcdc, armada and others requiring TDA998x encoder will always defered the probe of the DRM, and then re-probe() once the encoder is ready.

Quoted 9 lines
Quoted 2 lines

So, unless we have a good reason not to do this, it sounds a bit silly to me.

The problem that I have with working around this issue by changing the link order is that it hides bugs in drivers. It's not like probe deferral is a very expensive operation, so I very much prefer this as a way of forcing drivers to be fixed rather than optimizing for a few microseconds of boot time.

That's true. However, in this particular case, I'm not worried about the extra microseconds wasted in the defered operation, but about the unneeded delay introduced in the DRM probe.

I know that relying in some particular order is very fragile, but I don't agree with knowingly and even explicitly have a sub-optimal order of the drivers.

Or maybe it's just that I dislike deferals a lot.

Anyway, thanks for feedback.

Signature · 2 lines
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar