RE: Wake up issue about Flexcan driver in v5.4 kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Sent: 2019年11月11日 18:09
> To: Joakim Zhang <qiangqing.zhang@xxxxxxx>; sean@xxxxxxxxxx;
> linux-can@xxxxxxxxxxxxxxx
> Subject: Re: Wake up issue about Flexcan driver in v5.4 kernel
> 
> On 11/11/19 10:48 AM, Joakim Zhang wrote:
> > I came across a strange phenomenon about wake up in Flexcan driver
> > with
> > v5.4 kernel, I connected two i.MX7D-SDB board.
> >
> > I found that CAN frame which try to wake up the system will not be
> > received at another side in order. Like below case:
> >
> > Sender: cangen can0 -vv
> >   can0  4D9   [8]  89 72 0C 5F C8 15 2D 3A
> >   can0  0AA   [8]  B7 DC 14 61 7F A0 8E 40
> >   can0  304   [8]  42 5C D7 3B D6 1D 36 56
> >   can0  0D9   [7]  B0 C3 1B 7B 9B 3A 19
> >   can0  66B   [8]  8A B0 D9 56 00 46 76 48
> >   can0  22D   [8]  44 4B FD 53 B2 D3 A5 33
> >   can0  47E   [8]  B9 6B 72 0B 4C 15 96 72
> >   can0  54C   [3]  3F BE 8F
> >   can0  7C1   [8]  EE A7 B4 11 6C 80 8F 7D
> >   can0  5D6   [5]  EB 20 1E 3E DB
> >   can0  794   [8]  B1 56 9E 13 6D 88 CE 52
> >   can0  584   [1]  08
> >
> >
> >
> > Receiver: candump can0 &
> >   can0  0AA   [8]  B7 DC 14 61 7F A0 8E 40
> >   can0  304   [8]  42 5C D7 3B D6 1D 36 56
> >   can0  0D9   [7]  B0 C3 1B 7B 9B 3A 19
> >   can0  66B   [8]  8A B0 D9 56 00 46 76 48
> >   can0  22D   [8]  44 4B FD 53 B2 D3 A5 33
> >   can0  4D9   [8]  89 72 0C 5F C8 15 2D 3A
> >   can0  47E   [8]  B9 6B 72 0B 4C 15 96 72
> >   can0  54C   [3]  3F BE 8F
> >   can0  7C1   [8]  EE A7 B4 11 6C 80 8F 7D
> >   can0  5D6   [5]  EB 20 1E 3E DB
> >   can0  794   [8]  B1 56 9E 13 6D 88 CE 52
> >   can0  584   [1]  08
> >
> > You can see that wake up frame(can0  4D9   [8]  89 72 0C 5F C8 15 2D
> > 3A) will be received at 6^th , it’s hard to understand.
> 
> - What did you do before wakeup?
>   - Clean reboot?
>   - ifdown/ifup?
>   - sending other packets?
> - Does this happen on every wakeup?
> - Is the wake up frame always "received" as 6th frame?
> - Is the situation the same, if you add some delay between the frames,
>   using the "cangen -g option"?
> - How big can you make the -g until the frames are received in order
>   again?
> 
> The reception path works like this:
> In the interrupt handler the rx-offload reads all mailboxes based on the iflag
> register. It iterates over all set mailboxes, starting with the first. All mailboxes
> are read including the rx-timestamp, sorted and added into a queue. At the end
> of the IRQ handler the queue is added to the per device queue thats read in the
> NAPI and pushed into the networking stack.
> 
> Maybe something with the timestamp of the first packet is wrong, as the
> counter is only 16 bits wide, it will overflow quite often.
> 
> Maybe you can trace_printk the mailbox number, timestamp and can_id in
> mailbox_read() and analyse output after wakeup. Feel free to post the output
> of the tracer here.

Hi Marc,

I dump some info in wake up case from v5.3.10 with below change:
printk("\nmailbox_num = %u, timestamp = %u, can_id = %x\n", n, *timestamp, cf->can_id);

1)
Sender: cangen can0 -vv
  can0  266   [8]  F2 2D C6 5F 0E FE DE 38
  can0  71E   [8]  8A F0 C5 2F 9F 3C 72 32
  can0  256   [2]  03 4B
  can0  6FC   [8]  B1 46 D5 40 F6 C4 CC 1D
  can0  21A   [2]  60 2C
  can0  594   [2]  B1 5A
  can0  162   [2]  CB 41
  can0  6B0   [4]  CA 64 AB 70
  can0  710   [8]  25 27 2F 11 2F 76 54 17
  can0  50B   [8]  CE B2 C6 49 61 1F B9 3A

Receiver: candump can0 &
 mailbox_num = 1, timestamp = 4113563648, can_id = 266
 mailbox_num = 2, timestamp = 4105568256, can_id = 71e
 mailbox_num = 3, timestamp = 43646976, can_id = 256
 mailbox_num = 4, timestamp = 276496384, can_id = 6fc
 mailbox_num = 5, timestamp = 509149184, can_id = 21a
 mailbox_num = 6, timestamp = 741605376, can_id = 594
 mailbox_num = 1, timestamp = 973406208, can_id = 162
 mailbox_num = 1, timestamp = 1205010432, can_id = 6b0
 mailbox_num = 1, timestamp = 1437138944, can_id = 710
 mailbox_num = 1, timestamp = 1670184960, can_id = 50b
  can0  71E   [8]  8A F0 C5 2F 9F 3C 72 32
  can0  266   [8]  F2 2D C6 5F 0E FE DE 38
  can0  256   [2]  03 4B
  can0  6FC   [8]  B1 46 D5 40 F6 C4 CC 1D
  can0  21A   [2]  60 2C
  can0  594   [2]  B1 5A
  can0  162   [2]  CB 41
  can0  6B0   [4]  CA 64 AB 70
  can0  710   [8]  25 27 2F 11 2F 76 54 17
  can0  50B   [8]  CE B2 C6 49 61 1F B9 3A

2)
Sender: cangen can0 -g 100 -vv
  can0  343   [4]  13 89 21 5D
  can0  2DF   [8]  E6 64 C6 25 ED F0 7B 16
  can0  353   [8]  9B 84 9B 21 CA A3 CC 50
  can0  4E2   [8]  63 0E B0 1E 70 0E C2 12
  can0  643   [4]  75 9E 6E 08
  can0  3D1   [5]  E9 A6 FE 1D 88
  can0  4E6   [8]  A3 02 0E 08 1B F1 32 4F
  can0  6E2   [1]  1B
  can0  026   [8]  08 36 25 73 05 BB F3 4F
  can0  1CD   [8]  F3 AB 6F 66 20 ED B2 46
  can0  157   [8]  EB 90 7F 17 39 0E E7 48
  can0  227   [8]  A9 1C A9 5B 6B 78 7D 33
  can0  6D2   [8]  A3 E3 01 56 A3 3A AB 3C
  can0  2D4   [8]  2C F5 A4 62 BA C7 6E 7D
  can0  416   [8]  D5 B8 A1 4C F8 E2 EF 0A
  can0  6B0   [1]  1E
  can0  620   [6]  DC 01 4F 77 ED 1F
  can0  615   [8]  0D 0D 98 68 6C E7 EF 06
  can0  65D   [8]  A5 F5 D6 4F 85 D0 9B 14
  can0  546   [8]  F0 48 19 48 18 C4 DA 53
  can0  56D   [3]  BC FE 85
  can0  71F   [8]  FB 57 77 5D 35 AB E6 73

Receiver: candump can0 &
 mailbox_num = 1, timestamp = 1521614848, can_id = 343
 mailbox_num = 2, timestamp = 3618439168, can_id = 2df
 mailbox_num = 3, timestamp = 1590951936, can_id = 353
 mailbox_num = 4, timestamp = 3859611648, can_id = 4e2
 mailbox_num = 5, timestamp = 1833238528, can_id = 643
 mailbox_num = 6, timestamp = 4101767168, can_id = 3d1
 mailbox_num = 7, timestamp = 2076770304, can_id = 4e6
 mailbox_num = 8, timestamp = 50135040, can_id = 6e2
 mailbox_num = 9, timestamp = 2318729216, can_id = 26
 mailbox_num = 10, timestamp = 291897344, can_id = 1cd
 mailbox_num = 11, timestamp = 2559901696, can_id = 157
 mailbox_num = 12, timestamp = 532742144, can_id = 227
 mailbox_num = 1, timestamp = 2801336320, can_id = 6d2
 mailbox_num = 1, timestamp = 776011776, can_id = 2d4
 mailbox_num = 1, timestamp = 3044343808, can_id = 416
 mailbox_num = 1, timestamp = 1016332288, can_id = 6b0

  can0  343   [4]  13 89 21 5D
  can0  353   [8]  9B 84 9B 21 CA A3 CC 50
  can0  643   [4]  75 9E 6E 08
  can0  4E6   [8]  A3 02 0E 08 1B F1 32 4F
  can0  026   [8]  08 36 25 73 05 BB F3 4F
  can0  157   [8]  EB 90 7F 17 39 0E E7 48
  can0  2DF   [8]  E6 64 C6 25 ED F0 7B 16
  can0  4E2   [8]  63 0E B0 1E 70 0E C2 12
  can0  3D1   [5]  E9 A6 FE 1D 88
  can0  6E2   [1]  1B
  can0  1CD   [8]  F3 AB 6F 66 20 ED B2 46
  can0  227   [8]  A9 1C A9 5B 6B 78 7D 33
  can0  6D2   [8]  A3 E3 01 56 A3 3A AB 3C
  can0  2D4   [8]  2C F5 A4 62 BA C7 6E 7D
  can0  416   [8]  D5 B8 A1 4C F8 E2 EF 0A
  can0  6B0   [1]  1E

I found that not only the wake up frame will out-of-order, frames read in one round including wake up frame all could be disordered.

Best Regards,
Joakim Zhang
> regards,
> Marc
> 
> --
> Pengutronix e.K.                 | Marc Kleine-Budde           |
> Embedded Linux                   | https://www.pengutronix.de  |
> Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
> Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux