public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm: fsl-dcu: Use flat cache
@ 2016-03-24 13:33 Alexander Stein
  2016-03-25 16:24 ` Stefan Agner
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Stein @ 2016-03-24 13:33 UTC (permalink / raw)
  To: Stefan Agner, Alison Wang, David Airlie
  Cc: Alexander Stein, dri-devel, linux-kernel

Using REGCACHE_RBTREE for MMIO regmap is not valid as spinlock's will be
used during cache allocation.

This fixes the following bug:
BUG: sleeping function called from invalid context at mm/slab.h:388
in_atomic(): 1, irqs_disabled(): 128, pid: 192, name: udevd
[...]

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
Please refer also to the discussion at
https://lists.freedesktop.org/archives/dri-devel/2016-January/098696.html

 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index e8d9337..ea65140 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -40,7 +40,7 @@ static const struct regmap_config fsl_dcu_regmap_config = {
 	.reg_bits = 32,
 	.reg_stride = 4,
 	.val_bits = 32,
-	.cache_type = REGCACHE_RBTREE,
+	.cache_type = REGCACHE_FLAT,
 
 	.volatile_reg = fsl_dcu_drm_is_volatile_reg,
 };
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] drm: fsl-dcu: Use flat cache
  2016-03-24 13:33 [PATCH 1/1] drm: fsl-dcu: Use flat cache Alexander Stein
@ 2016-03-25 16:24 ` Stefan Agner
  2016-03-29  6:56   ` Alexander Stein
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2016-03-25 16:24 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Alison Wang, David Airlie, dri-devel, linux-kernel

Hi Alexander,

On 2016-03-24 06:33, Alexander Stein wrote:
> Using REGCACHE_RBTREE for MMIO regmap is not valid as spinlock's will be
> used during cache allocation.
> 
> This fixes the following bug:
> BUG: sleeping function called from invalid context at mm/slab.h:388
> in_atomic(): 1, irqs_disabled(): 128, pid: 192, name: udevd
> [...]
> 
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
> Please refer also to the discussion at
> https://lists.freedesktop.org/archives/dri-devel/2016-January/098696.html
> 
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index e8d9337..ea65140 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -40,7 +40,7 @@ static const struct regmap_config fsl_dcu_regmap_config = {
>  	.reg_bits = 32,
>  	.reg_stride = 4,
>  	.val_bits = 32,
> -	.cache_type = REGCACHE_RBTREE,
> +	.cache_type = REGCACHE_FLAT,

To use flat regcache you also need to set the max_register.

I already have such a patch, see:
https://lists.freedesktop.org/archives/dri-devel/2016-January/099121.html

However, the current suspend/resume implementation (which uses the
regcache) is anyway flawed. I currently prepare a patchset to remove the
regmap cache entirely and use Thierry's new generic suspend/resume
functions.

--
Stefan

>  
>  	.volatile_reg = fsl_dcu_drm_is_volatile_reg,
>  };

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] drm: fsl-dcu: Use flat cache
  2016-03-25 16:24 ` Stefan Agner
@ 2016-03-29  6:56   ` Alexander Stein
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Stein @ 2016-03-29  6:56 UTC (permalink / raw)
  To: Stefan Agner; +Cc: Alison Wang, David Airlie, dri-devel, linux-kernel

On Friday 25 March 2016 09:24:28, Stefan Agner wrote:
> Hi Alexander,
> 
> On 2016-03-24 06:33, Alexander Stein wrote:
> > Using REGCACHE_RBTREE for MMIO regmap is not valid as spinlock's will be
> > used during cache allocation.
> > 
> > This fixes the following bug:
> > BUG: sleeping function called from invalid context at mm/slab.h:388
> > in_atomic(): 1, irqs_disabled(): 128, pid: 192, name: udevd
> > [...]
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> > ---
> > Please refer also to the discussion at
> > https://lists.freedesktop.org/archives/dri-devel/2016-January/098696.html
> > 
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > index e8d9337..ea65140 100644
> > --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > @@ -40,7 +40,7 @@ static const struct regmap_config fsl_dcu_regmap_config
> > = {> 
> >  	.reg_bits = 32,
> >  	.reg_stride = 4,
> >  	.val_bits = 32,
> > 
> > -	.cache_type = REGCACHE_RBTREE,
> > +	.cache_type = REGCACHE_FLAT,
> 
> To use flat regcache you also need to set the max_register.

Ah, thanks for that hint, I was not aware of that. I wondered why my kernel 
crashed using flat cache. Seems cache allocation is too small when 
max_register=0.
Just sent a patch enforcing setting max_register.

> I already have such a patch, see:
> https://lists.freedesktop.org/archives/dri-devel/2016-January/099121.html

Thanks, meanwhile this will do for me. I think.

> However, the current suspend/resume implementation (which uses the
> regcache) is anyway flawed. I currently prepare a patchset to remove the
> regmap cache entirely and use Thierry's new generic suspend/resume
> functions.

Feel free to cc me.
Best regards,
Alexander

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-29  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 13:33 [PATCH 1/1] drm: fsl-dcu: Use flat cache Alexander Stein
2016-03-25 16:24 ` Stefan Agner
2016-03-29  6:56   ` Alexander Stein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox