Skip to contentSkip to conversation

Regression in next with "mfd: twl6040: The chip does not support bulk access"

DISCUSSION Tony Lindgren 3 participants 8 messages Sep 22, 2016 – Sep 23, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

Looks like commit 7a17e47f6403 ("mfd: twl6040: The chip does not support bulk access") breaks at least omap4-duovero. I now get tons of errors:

Skipping twl internal clock init and using bootloader value (unknown osc rate) twl 0-0048: PIH (irq 332) nested IRQs
of_get_named_gpiod_flags: parsed 'ti,audpwron-gpio' property of node '/ocp/i2c at 48070000/t wl at 4b[0]' - status (0)
omap_i2c 48070000.i2c: bus 0 rev0.10 at 400 kHz
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16

It seems the regmap irqs don't work with use_single_rw?

Also seems that twl6040 does support bulk access as things have been working earlier?

Anyways, can you please revert?

Regards,

Tony

#1 lore raw
Quoted 4 lines · Tony Lindgren

Hi,

Looks like commit 7a17e47f6403 ("mfd: twl6040: The chip does not support bulk access") breaks at least omap4-duovero.

That's odd. I see no such errors on omap4 PandaBoard-ES nor on omap5 uEVM. The IRQ status is one register so even in bulk access it is one read. So the use_single_rw should have no effect on the access.

The only time when regmap would try to use bulk access to twl6040 is when we execute regcache_sync() on it after resuming the chip and this would fail at the first time when it tries to restore more than one consecutive registers.

I just tested things on next-20160915 and I see no errors at all.

Quoted 17 lines

I now get tons of errors:

Skipping twl internal clock init and using bootloader value (unknown osc rate) twl 0-0048: PIH (irq 332) nested IRQs
of_get_named_gpiod_flags: parsed 'ti,audpwron-gpio' property of node '/ocp/i2c at 48070000/t wl at 4b[0]' - status (0)
omap_i2c 48070000.i2c: bus 0 rev0.10 at 400 kHz
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16

Quoted 4 lines

It seems the regmap irqs don't work with use_single_rw?

Also seems that twl6040 does support bulk access as things have been working earlier?

Things kind of worked as we had single register reads and writes, but when I tried to power down/up the twl6040 the regcache_sync() would fail to restore the registers at the first place when we had two or more registers to update in bulk mode. In that case regmap gives an error, but I have not been checking the return of the regcache_sync() so the chip comes up, but not all settings were restored.

Quoted 1 line

Anyways, can you please revert?

Please don't.

On which linux-next version you are seeing this?

Signature · 1 line
P?ter
#2 lore raw
Quoted 10 lines · Peter Ujfalusi
Quoted 4 lines · Tony Lindgren

Hi,

Looks like commit 7a17e47f6403 ("mfd: twl6040: The chip does not support bulk access") breaks at least omap4-duovero.

That's odd. I see no such errors on omap4 PandaBoard-ES nor on omap5 uEVM. The IRQ status is one register so even in bulk access it is one read. So the use_single_rw should have no effect on the access.

Quoted 5 lines

The only time when regmap would try to use bulk access to twl6040 is when we execute regcache_sync() on it after resuming the chip and this would fail at the first time when it tries to restore more than one consecutive registers.

I just tested things on next-20160915 and I see no errors at all.

Retested on next-20160923 and I see no issue on Panda-ES or omap5-uevm.

My guess is that you receive an interrupt from twl6040 while the chip is powered down, the regmap is set to cache only. But this has nothing to do with the bulk or non bulk access... Looking at the commit logs and git blame I see no recent change in the driver(s) for twl6040 which changed the way it loads and/or powers up/down.

Signature · 1 line
P?ter
#4 lore raw
In reply to Peter Ujfalusi
Quoted 9 lines · Peter Ujfalusi
Quoted 4 lines · Tony Lindgren

Hi,

Looks like commit 7a17e47f6403 ("mfd: twl6040: The chip does not support bulk access") breaks at least omap4-duovero.

That's odd. I see no such errors on omap4 PandaBoard-ES nor on omap5 uEVM. The IRQ status is one register so even in bulk access it is one read. So the use_single_rw should have no effect on the access.

Oh it's just one register.

Quoted 5 lines

The only time when regmap would try to use bulk access to twl6040 is when we execute regcache_sync() on it after resuming the chip and this would fail at the first time when it tries to restore more than one consecutive registers.

I just tested things on next-20160915 and I see no errors at all.

OK interesting.

Quoted 17 lines
Quoted 17 lines

I now get tons of errors:

Skipping twl internal clock init and using bootloader value (unknown osc rate) twl 0-0048: PIH (irq 332) nested IRQs
of_get_named_gpiod_flags: parsed 'ti,audpwron-gpio' property of node '/ocp/i2c at 48070000/t wl at 4b[0]' - status (0)
omap_i2c 48070000.i2c: bus 0 rev0.10 at 400 kHz
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16
twl6040 0-004b: Failed to read IRQ status: -16

Quoted 1 line
Quoted 1 line

It seems the regmap irqs don't work with use_single_rw?

So obviously that's a wrong conclusion then.

Quoted 10 lines
Quoted 2 lines

Also seems that twl6040 does support bulk access as things have been working earlier?

Things kind of worked as we had single register reads and writes, but when I tried to power down/up the twl6040 the regcache_sync() would fail to restore the registers at the first place when we had two or more registers to update in bulk mode. In that case regmap gives an error, but I have not been checking the return of the regcache_sync() so the chip comes up, but not all settings were restored.

Quoted 5 lines
Quoted 1 line

Anyways, can you please revert?

Please don't.

On which linux-next version you are seeing this?

This was with next-20160922. But testing it again this is just another regression caused by "softirq: fix tasklet_kill() and its users", so adding Santosh to Cc.

So no need to revert $subject patch.

Regards,

Tony

#3 lore raw
In reply to Peter Ujfalusi
Quoted 17 lines · Peter Ujfalusi
Quoted 10 lines · Peter Ujfalusi
Quoted 4 lines · Tony Lindgren

Hi,

Looks like commit 7a17e47f6403 ("mfd: twl6040: The chip does not support bulk access") breaks at least omap4-duovero.

That's odd. I see no such errors on omap4 PandaBoard-ES nor on omap5 uEVM. The IRQ status is one register so even in bulk access it is one read. So the use_single_rw should have no effect on the access.

Quoted 5 lines

The only time when regmap would try to use bulk access to twl6040 is when we execute regcache_sync() on it after resuming the chip and this would fail at the first time when it tries to restore more than one consecutive registers.

I just tested things on next-20160915 and I see no errors at all.

Quoted 7 lines

Retested on next-20160923 and I see no issue on Panda-ES or omap5-uevm.

My guess is that you receive an interrupt from twl6040 while the chip is powered down, the regmap is set to cache only. But this has nothing to do with the bulk or non bulk access... Looking at the commit logs and git blame I see no recent change in the driver(s) for twl6040 which changed the way it loads and/or powers up/down.

OK yeah this is another one caused by "softirq: fix tasklet_kill() and its users".

Thanks,

Tony

#5 lore raw
In reply to Tony Lindgren
Quoted 2 lines · Tony Lindgren
Quoted 1 line · Peter Ujfalusi

On 09/22/16 21:07, Tony Lindgren wrote:

[...]

Quoted 8 lines
Quoted 1 line

On which linux-next version you are seeing this?

This was with next-20160922. But testing it again this is just another regression caused by "softirq: fix tasklet_kill() and its users", so adding Santosh to Cc.

So no need to revert $subject patch.

So your driver also looks like fiddling with tasklet core structures if you got impacted because of the core change. After the merge window am going to take stab at bad users of tasklet but below is quick snap shot conversation I had with Thomas and Andrew...

------------------------------------------------------------------

Quoted 8 lines · Santosh Shilimkar

I requested you to include this patch but now am not sure anymore. Looks like there are almost 30 more users which are directly tweaking 'tasklet_struct' fields and calling other APIs. Hunting them and fixing them probably would be an exercise and also those changes needs those changed drivers to be tested.

What do you suggest ? At least this patch needs to be dropped as of now till we can have complete coverage for those bad users.

Yes, it needs to be dropped. Stephen, can you please revert it from next?

How to fix this: The only way is to review all tasklet usage sites for creative abuse and then fix them one by one. This needs to be done anyway because those are ticking timebombs even without changes in the core code. I looked at one of the offenders and it's broken today, it's just protected by the extremly low probablity to hit the wreckage case.

What you can do to coerce the developers/maintainers of offending code into looking at the mess they created/merged is to implement accessors for the tasklet struct fields and replace the open coded fiddling with them.

Once that is done, rename the struct fields to something which is absurd enough to type. But don't worry, you will find people doing that. I catched a few brainwrecks who actually used:

irqdesc->core_internal_state__do_not_mess_with_it

in their code.

Now after having everything converted to accessors, you can add sanity checks into the accessors and emit WARN_ONCE() when they are used in the wrong context. That'll make them look and explain why they think that fiddling in the internals is a good idea.

Thanks,

tglx
------------------------------------------------------------------

#6 lore raw
Quoted 8 lines · Santosh Shilimkar
Quoted 2 lines · Tony Lindgren
Quoted 1 line · Peter Ujfalusi

On 09/22/16 21:07, Tony Lindgren wrote:

[...]

Quoted 2 lines
Quoted 1 line

On which linux-next version you are seeing this?

Quoted 8 lines
Quoted 6 lines

This was with next-20160922. But testing it again this is just another regression caused by "softirq: fix tasklet_kill() and its users", so adding Santosh to Cc.

So no need to revert $subject patch.

So your driver also looks like fiddling with tasklet core structures if you got impacted because of the core change.

How is that? None of the drivers in the twl6040 stack uses tasklets explicitly. The core uses regmap_irq and the drivers use threaded irq when they need interrupt handling, but no tasklet, no fiddling with internals.

Signature · 1 line
P?ter
Quoted 45 lines

After the merge window
am going to take stab at bad users of tasklet but below is quick snap shot conversation I had with Thomas and Andrew...

------------------------------------------------------------------

Quoted 8 lines · Santosh Shilimkar

I requested you to include this patch but now am not sure anymore. Looks like there are almost 30 more users which are directly tweaking 'tasklet_struct' fields and calling other APIs. Hunting them and fixing them probably would be an exercise and also those changes needs those changed drivers to be tested.

What do you suggest ? At least this patch needs to be dropped as of now till we can have complete coverage for those bad users.

Yes, it needs to be dropped. Stephen, can you please revert it from next?

How to fix this: The only way is to review all tasklet usage sites for creative abuse and then fix them one by one. This needs to be done anyway because those are ticking timebombs even without changes in the core code. I looked at one of the offenders and it's broken today, it's just protected by the extremly low probablity to hit the wreckage case.

What you can do to coerce the developers/maintainers of offending code into looking at the mess they created/merged is to implement accessors for the tasklet struct fields and replace the open coded fiddling with them.

Once that is done, rename the struct fields to something which is absurd enough to type. But don't worry, you will find people doing that. I catched a few brainwrecks who actually used:

irqdesc->core_internal_state__do_not_mess_with_it

in their code.

Now after having everything converted to accessors, you can add sanity checks into the accessors and emit WARN_ONCE() when they are used in the wrong context. That'll make them look and explain why they think that fiddling in the internals is a good idea.

Thanks,

tglx
------------------------------------------------------------------

#7 lore raw
Quoted 13 lines · Peter Ujfalusi
Quoted 12 lines · Santosh Shilimkar
Quoted 2 lines · Tony Lindgren
Quoted 1 line · Peter Ujfalusi

On 09/22/16 21:07, Tony Lindgren wrote:

[...]

Quoted 6 lines
Quoted 1 line

On which linux-next version you are seeing this?

This was with next-20160922. But testing it again this is just another regression caused by "softirq: fix tasklet_kill() and its users", so adding Santosh to Cc.

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

So no need to revert $subject patch.

So your driver also looks like fiddling with tasklet core structures if you got impacted because of the core change.

How is that? None of the drivers in the twl6040 stack uses tasklets explicitly. The core uses regmap_irq and the drivers use threaded irq when they need interrupt handling, but no tasklet, no fiddling with internals.

May be MFD core or some up dependency for this driver does that. If not then you shouldn't be impacted because of the change.

Regards,
Santosh