allwinner/i2c interrupt storm detected

Daniel Braniss danny at cs.huji.ac.il
Mon Jul 6 07:44:42 UTC 2020



> On 6 Jul 2020, at 08:51, Daniel Braniss <danny at cs.huji.ac.il> wrote:
> 
> 
> 
>> On 5 Jul 2020, at 20:14, Emmanuel Vadot <manu at bidouilliste.com> wrote:
>> 
>> 
>> Hi Daniel, Manuel,
>> 
>> On Sat, 4 Jul 2020 13:45:50 +0300
>> Daniel Braniss <danny at cs.huji.ac.il <mailto:danny at cs.huji.ac.il>> wrote:
>> 
>>> 
>>> 
>>>> On 4 Jul 2020, at 13:29, Manuel Stühn <freebsdnewbie at freenet.de> wrote:
>>>> 
>>>> On Tue, 30 Jun 2020 16:01:41 +0300
>>>> Daniel Braniss <danny at cs.huji.ac.il <mailto:danny at cs.huji.ac.il>> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> after a long time I decided to try and upgrade to stable 12.1 r362793 since I saw some changes where done 
>>>>> with respect to the DTS and twsi.c, 
>>>>> 
>>>>> if nothing is connected to the i2c, i2c -s just hangs,
>>>>> 
>>>>> if something is connected this is what i get on the console after typing ?i2c -s?
>>>>> 
>>>>> 
>>>>> Hardware may not support START/STOP scanning; trinterrupt storm detected on "gic0,s6:"; throttling interrupt source
>>>>> ying less-reliable read method.
>>>>> interrupt storm detected on "gic0,s6:"; throttling interrupt source
>>>>> interrupt storm detected on "gic0,s6:"; throttling interrupt source
>>>>> ?
>>>>> 
>>>>> and
>>>>> neo-04> vmstat -i
>>>>> interrupt                                             total       rate
>>>>> gic0,p13:-ic_timer0                                   16052        164
>>>>> gic0,s0: uart2                                          318          3
>>>>> gic0,s6: iichb0                                       13034        133
>>>>> gic0,s60: aw_mmc0                                      1293         13
>>>>> gic0,s82: awg0                                          334          3
>>>>> gic0,s120: pmu0                                       49725        509
>>>>> cpu0:rendezvous                                          18          0
>>>>> cpu1:rendezvous                                          50          1
>>>>> cpu2:rendezvous                                          51          1
>>>>> cpu3:rendezvous                                          40          0
>>>>> cpu0:preempt                                           2691         28
>>>>> cpu1:preempt                                           3165         32
>>>>> cpu2:preempt                                           2778         28
>>>>> cpu3:preempt                                           2986         31
>>>>> cpu0:hardclock                                           15          0
>>>>> Total                                                 92550        946
>>>>> 
>>>>> 
>>>>> the hardware is an NanoPi Neo
>>>>> ---<<BOOT>>---
>>>>> KDB: debugger backends: ddb
>>>>> KDB: current backend: ddb
>>>>> Copyright (c) 1992-2020 The FreeBSD Project.
>>>>> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
>>>>>     The Regents of the University of California. All rights reserved.
>>>>> FreeBSD is a registered trademark of The FreeBSD Foundation.
>>>>> FreeBSD 12.1-STABLE #0 r362793M: Tue Jun 30 11:39:11 IDT 2020
>>>>> danny at nrnd:/home/obj/nrnd/arm/neo/vol/rnd/stable/12/arm.armv7/sys/AWGEN arm
>>>>> FreeBSD clang version 10.0.0 (git at github.com <mailto:git at github.com>:llvm/llvm-project.git llvmorg-10.0.0-0-gd32170dbd5b)
>>>>> VT: init without driver.
>>>>> No PSCI/SMCCC call function found
>>>>> CPU: ARM Cortex-A7 r0p5 (ECO: 0x00000000)
>>>>> ?
>>>>> 
>>>> 
>>>> I do not have a IRQ-Storm on my NanoPI NEO2, but a "i2s -s" does never return. Commit v356609 broke i2c-support on my hardware (reverting this single commit fixed it, bugreport filed: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247576 <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247576>).
>>>> 
>>>> Perhaps it is worth a try for you also to revert this commit and test again...
>>>> 
>>> 
>>> before the latest changes it works fine, and if you add my patch to it, i2s -s will not hang:
>>> 
>>>> -- twsi.c	(revision 346538)
>>>> +++ twsi.c	(working copy)
>>>> @@ -458,8 +458,15 @@
>>>> 		if (sc->msg->len == 1)
>>>> 			sc->control_val &= ~TWSI_CONTROL_ACK;
>>>> 		TWSI_WRITE(sc, sc->reg_control, sc->control_val | TWSI_CONTROL_START);
>>>> -		while (sc->error == 0 && sc->transfer != 0) {
>>>> -			pause_sbt("twsi", SBT_1MS * 30, SBT_1MS, 0);
>>>> +		{
>>>> +			 int count = 10;
>>>> +			 while (sc->error == 0 && sc->transfer != 0) {
>>>> +				  pause_sbt("twsi", SBT_1MS * 30, SBT_1MS, 0);
>>>> +				  if(count-- == 0) {
>>>> +					   sc->error = EDEADLK;
>>>> +					   break;
>>>> +				  }
>>>> +			 }
>>>> 		}
>>>> 
>>>> 		debugf(dev, "Done with msg[%d]\n", i);
>>> 
>>> 
>>> cheers,
>>> 	danny
>>> 
>>>> 
>>>> BR
>>>> Manuel
>> 
>> Could you test the patch I've just attached to
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247576 <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247576> please ?
>> 
>> It doesn't fix everything and I'm still working on doing test on a lot
>> of different boards but this is clearly needed.
>> 
>> -- 
>> Emmanuel Vadot <manu at bidouilliste.com <mailto:manu at bidouilliste.com>> <manu at freebsd.org <mailto:manu at freebsd.org>>
> 
> 
> short version: it works!
> 
> longer version:
> first tried with debugging on - worked
> next tried with no debugging- worked
> 
> the next test will take some time, trying my app.
> if I feel up to it, i can try on a neopi neo2 - but that will take longer.
> 
> thanks Manu!!!!
> 


not out of the woods yet :-(

my app hangs the kernel.
it’s now stuck in what seems waiting for an interrupt that never comes …

this is the debug:
neo-001# iichb0: twsi_calc_baud_rate: Bus clock is at 24000000
iichb0: twsi_reset: Using clock param=59
iichb0: TWSI_WRITE: Writing 0 to 18
iichb0: TWSI_WRITE: Writing 59 to 14
iichb0: TWSI_WRITE: Writing 40 to c
iichb0: twsi_calc_baud_rate: Bus clock is at 24000000
iichb0: twsi_reset: Using clock param=59
iichb0: TWSI_WRITE: Writing 0 to 18
iichb0: TWSI_WRITE: Writing 59 to 14
iichb0: TWSI_WRITE: Writing 40 to c
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_transfer: transmitting 2 messages
iichb0: TWSI_READ: read f8 from 10
iichb0: twsi_transfer: status=f8
iichb0: TWSI_WRITE: Writing e4 to c
iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 8 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Send the address(48)
iichb0: TWSI_WRITE: Writing 48 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 18 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting the address (write)
iichb0: twsi_intr: Sending byte 0 = 0
iichb0: TWSI_WRITE: Writing 0 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 1 = 0
iichb0: TWSI_WRITE: Writing 0 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 2 = ff
iichb0: TWSI_WRITE: Writing ff to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 3 = 2
iichb0: TWSI_WRITE: Writing 2 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 4 = fe
iichb0: TWSI_WRITE: Writing fe to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 5 = d4
iichb0: TWSI_WRITE: Writing d4 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 6 = 2
iichb0: TWSI_WRITE: Writing 2 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 7 = 2a
iichb0: TWSI_WRITE: Writing 2a to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Sending byte 8 = 0
iichb0: TWSI_WRITE: Writing 0 to 8
iichb0: TWSI_WRITE: Writing c4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

iichb0: twsi_intr: Got interrupt Current msg=0
iichb0: TWSI_READ: read 28 from 10
iichb0: TWSI_READ: read cc from c
iichb0: twsi_intr: reg control=cc
iichb0: twsi_intr: Ack received after transmitting data
iichb0: twsi_intr: Done sending all the bytes for msg 0
iichb0: twsi_intr: Done TX data, send stop
iichb0: TWSI_WRITE: Writing d4 to c
iichb0: twsi_intr: Refresh reg_control
iichb0: TWSI_WRITE: Writing cc to c
iichb0: twsi_intr: Done with interrupts

and here it hangs.
reboot is necessary.

> 	danny
> 
> 
> _______________________________________________
> freebsd-arm at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"



More information about the freebsd-arm mailing list