Re: [PATCH] drm/bridge:Fix the panic problem caused by bridge->funcs->attach

2023-04-24 Thread 余治国
two separate pipeline:crtc->encoder->bridge->connector->panel

Jagan Teki  于2023年4月23日周日 19:10写道:

> + Bridge Maintainers
>
> On Wed, Apr 19, 2023 at 8:35 AM 余治国  wrote:
> >
> > The log looks like this:
> > [ 31.723823] Internal error: Oops: 9604 [#1] SMP\013 \010
> > [ 31.729030] Modules linked in:\013 \010
> > [ 31.733395] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.59+2.0.0
> #250\013
> > \010
> > [ 31.745167] pstate: 60c5 (nZCv daif +PAN +UAO -TCO BTYPE=--)\013
> \010
> > [ 31.752785] pc : drm_bridge_attach+0xdc/0x1a4\013 \010
> > [ 31.757518] lr : drm_bridge_attach+0x40/0x1a4\013 \010
> > [ 31.762104] sp : 000678f0\013 \010
> > [ 31.765726] x29: 000678f0 x28: 0031c880 \013 \010
> > [ 31.771599] x27: 0060 x26: 800010539e90 \013 \010
> > [ 31.777340] x25: 000a6000 x24: 00129c10 \013 \010
> > [ 31.783060] x23:  x22: 000131c0 \013 \010
> > [ 31.788770] x21: 80001052a5b8 x20: 003e2c80 \013 \010
> > [ 31.794506] x19: 00017080 x18: 0010 \013 \010
> > [ 31.800210] x17: 5fcfcd6c x16: d27b105e \013 \010
> > [ 31.805907] x15: 00c7 x14: 000675d0 \013 \010
> > [ 31.811599] x13: ffea x12: 8000114158c0 \013 \010
> > [ 31.817282] x11: 0003 x10: 800011295880 \013 \010
> > [ 31.823000] x9 : 8000112958d8 x8 : 0017ffe8 \013 \010
> > [ 31.828731] x7 : c000fffe x6 : 0001 \013 \010
> > [ 31.834425] x5 : 0057ffa8 x4 :  \013 \010
> > [ 31.840101] x3 :  x2 : 00013218 \013 \010
> > [ 31.845787] x1 : 003e2cf8 x0 :  \013 \010
> > [ 31.851594] Call trace:\013 \010
> > [ 31.854603] drm_bridge_attach+0xdc/0x1a4\013 \010
> > [ 31.859079] dw_mipi_dsi_bridge_attach+0x98/0xa8\013 \010
> > [ 31.864035] drm_bridge_attach+0x104/0x1a4\013 \010
> > [ 31.869211] dw_mipi_dsi_bind+0x24/0x58\013 \010
> > drm_bridge_attach will call bridge->funcs in many cases, so I think it
> is necessary to check。
>
> I don't think the bridge pointer or bridge->funcs pointer is NULL
> here. It looks like the controlling is attaching the bridge prior to
> registering it. If I remember correctly, I got a similar issue with
> rockchip-drm pipeline. Would you please share your pipeline as well?
>
> Thanks,
> Jagan.
>


Re: [PATCH] drm/bridge:Fix the panic problem caused by bridge->funcs->attach

2023-04-23 Thread Jagan Teki
+ Bridge Maintainers

On Wed, Apr 19, 2023 at 8:35 AM 余治国  wrote:
>
> The log looks like this:
> [ 31.723823] Internal error: Oops: 9604 [#1] SMP\013 \010
> [ 31.729030] Modules linked in:\013 \010
> [ 31.733395] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.59+2.0.0 #250\013
> \010
> [ 31.745167] pstate: 60c5 (nZCv daif +PAN +UAO -TCO BTYPE=--)\013 \010
> [ 31.752785] pc : drm_bridge_attach+0xdc/0x1a4\013 \010
> [ 31.757518] lr : drm_bridge_attach+0x40/0x1a4\013 \010
> [ 31.762104] sp : 000678f0\013 \010
> [ 31.765726] x29: 000678f0 x28: 0031c880 \013 \010
> [ 31.771599] x27: 0060 x26: 800010539e90 \013 \010
> [ 31.777340] x25: 000a6000 x24: 00129c10 \013 \010
> [ 31.783060] x23:  x22: 000131c0 \013 \010
> [ 31.788770] x21: 80001052a5b8 x20: 003e2c80 \013 \010
> [ 31.794506] x19: 00017080 x18: 0010 \013 \010
> [ 31.800210] x17: 5fcfcd6c x16: d27b105e \013 \010
> [ 31.805907] x15: 00c7 x14: 000675d0 \013 \010
> [ 31.811599] x13: ffea x12: 8000114158c0 \013 \010
> [ 31.817282] x11: 0003 x10: 800011295880 \013 \010
> [ 31.823000] x9 : 8000112958d8 x8 : 0017ffe8 \013 \010
> [ 31.828731] x7 : c000fffe x6 : 0001 \013 \010
> [ 31.834425] x5 : 0057ffa8 x4 :  \013 \010
> [ 31.840101] x3 :  x2 : 00013218 \013 \010
> [ 31.845787] x1 : 003e2cf8 x0 :  \013 \010
> [ 31.851594] Call trace:\013 \010
> [ 31.854603] drm_bridge_attach+0xdc/0x1a4\013 \010
> [ 31.859079] dw_mipi_dsi_bridge_attach+0x98/0xa8\013 \010
> [ 31.864035] drm_bridge_attach+0x104/0x1a4\013 \010
> [ 31.869211] dw_mipi_dsi_bind+0x24/0x58\013 \010
> drm_bridge_attach will call bridge->funcs in many cases, so I think it is 
> necessary to check。

I don't think the bridge pointer or bridge->funcs pointer is NULL
here. It looks like the controlling is attaching the bridge prior to
registering it. If I remember correctly, I got a similar issue with
rockchip-drm pipeline. Would you please share your pipeline as well?

Thanks,
Jagan.


Re: [PATCH] drm/bridge:Fix the panic problem caused by bridge->funcs->attach

2023-04-20 Thread 余治国
The log looks like this:
[ 31.723823] Internal error: Oops: 9604 [#1] SMP\013 \010
[ 31.729030] Modules linked in:\013 \010
[ 31.733395] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.59+2.0.0
#250\013
\010
[ 31.745167] pstate: 60c5 (nZCv daif +PAN +UAO -TCO BTYPE=--)\013 \010
[ 31.752785] pc : drm_bridge_attach+0xdc/0x1a4\013 \010
[ 31.757518] lr : drm_bridge_attach+0x40/0x1a4\013 \010
[ 31.762104] sp : 000678f0\013 \010
[ 31.765726] x29: 000678f0 x28: 0031c880 \013 \010
[ 31.771599] x27: 0060 x26: 800010539e90 \013 \010
[ 31.777340] x25: 000a6000 x24: 00129c10 \013 \010
[ 31.783060] x23:  x22: 000131c0 \013 \010
[ 31.788770] x21: 80001052a5b8 x20: 003e2c80 \013 \010
[ 31.794506] x19: 00017080 x18: 0010 \013 \010
[ 31.800210] x17: 5fcfcd6c x16: d27b105e \013 \010
[ 31.805907] x15: 00c7 x14: 000675d0 \013 \010
[ 31.811599] x13: ffea x12: 8000114158c0 \013 \010
[ 31.817282] x11: 0003 x10: 800011295880 \013 \010
[ 31.823000] x9 : 8000112958d8 x8 : 0017ffe8 \013 \010
[ 31.828731] x7 : c000fffe x6 : 0001 \013 \010
[ 31.834425] x5 : 0057ffa8 x4 :  \013 \010
[ 31.840101] x3 :  x2 : 00013218 \013 \010
[ 31.845787] x1 : 003e2cf8 x0 :  \013 \010
[ 31.851594] Call trace:\013 \010
[ 31.854603] drm_bridge_attach+0xdc/0x1a4\013 \010
[ 31.859079] dw_mipi_dsi_bridge_attach+0x98/0xa8\013 \010
[ 31.864035] drm_bridge_attach+0x104/0x1a4\013 \010
[ 31.869211] dw_mipi_dsi_bind+0x24/0x58\013 \010
drm_bridge_attach will call bridge->funcs in many cases, so I think it is
necessary to check。


Jagan Teki  于2023年4月18日周二 21:45写道:

> On Mon, Apr 17, 2023 at 12:52 PM logic.yu  wrote:
> >
> > When the code is executed to bridge->funcs->attach,bridge->funcs is NULL.
> > Although the function entry checks whether the bridge pointer is NULL,it
> > does not detect whether the bridge->funcs is NULL, so a panic error
> > occurs.
> >
> > Signed-off-by: logic.yu 
> > ---
> >  drivers/gpu/drm/drm_bridge.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > index c3d69af02e79..f3dd67fb3f1d 100644
> > --- a/drivers/gpu/drm/drm_bridge.c
> > +++ b/drivers/gpu/drm/drm_bridge.c
> > @@ -302,7 +302,7 @@ int drm_bridge_attach(struct drm_encoder *encoder,
> struct drm_bridge *bridge,
> >  {
> > int ret;
> >
> > -   if (!encoder || !bridge)
> > +   if (!encoder || !bridge || !bridge->funcs)
>
> Would you please share the use case log where you found panic? I think
> checking bridge->funcs during funcs-> trigger later in this function
> would be a valid check (assume if an issue) as some drivers use the
> bridge to handle downstream bridge w/o using any bridge functions.
>
> Jagan.
>


Re: [PATCH] drm/bridge:Fix the panic problem caused by bridge->funcs->attach

2023-04-18 Thread Jagan Teki
On Mon, Apr 17, 2023 at 12:52 PM logic.yu  wrote:
>
> When the code is executed to bridge->funcs->attach,bridge->funcs is NULL.
> Although the function entry checks whether the bridge pointer is NULL,it
> does not detect whether the bridge->funcs is NULL, so a panic error
> occurs.
>
> Signed-off-by: logic.yu 
> ---
>  drivers/gpu/drm/drm_bridge.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index c3d69af02e79..f3dd67fb3f1d 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -302,7 +302,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct 
> drm_bridge *bridge,
>  {
> int ret;
>
> -   if (!encoder || !bridge)
> +   if (!encoder || !bridge || !bridge->funcs)

Would you please share the use case log where you found panic? I think
checking bridge->funcs during funcs-> trigger later in this function
would be a valid check (assume if an issue) as some drivers use the
bridge to handle downstream bridge w/o using any bridge functions.

Jagan.


[PATCH] drm/bridge:Fix the panic problem caused by bridge->funcs->attach

2023-04-17 Thread logic.yu
When the code is executed to bridge->funcs->attach,bridge->funcs is NULL.
Although the function entry checks whether the bridge pointer is NULL,it
does not detect whether the bridge->funcs is NULL, so a panic error
occurs.

Signed-off-by: logic.yu 
---
 drivers/gpu/drm/drm_bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index c3d69af02e79..f3dd67fb3f1d 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -302,7 +302,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct 
drm_bridge *bridge,
 {
int ret;
 
-   if (!encoder || !bridge)
+   if (!encoder || !bridge || !bridge->funcs)
return -EINVAL;
 
if (previous && (!previous->dev || previous->encoder != encoder))
-- 
2.17.1