This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can i change serial driver transmit buffer size from 1 page to 2 page

Can i change serial driver transmit buffer size from 1 page to 2 page.

  • Please specify processor and software being used.
  • am335x based customized board and linux kernel 3.2
  • Hi,

    The transmit buffer is a circular buffer, see serial_core.c. Its size is UART_XMIT_SIZE, and currently it is set in include/linux/serial_core.h and it is equal to PAGE_SIZE. You can change this in include/linux/serial_core.h:
    #define SERIAL_XMIT_SIZE PAGE_SIZE

    The receive buffer rx_buf is also set to 4KB and it can be increased. This is done by modifying
    #define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */
    in arch/arm/mach-omap2/serial.c

    Hope this helps.

    Best Regards,
    Yordan
  • Hi,
    As you told i changed the page size to 8K, but i am facing crashing problem, kernel crashing after some time e.g execute ls command 5-10 times continuously on serial port. when 2095 space left in buffer kernel is crashing



    Please check the below logs

    [ 224.751795] kernel BUG at mm/slab.c:3109!
    [ 224.756041] Internal error: Oops - undefined instruction: 0 [#1]
    [ 224.762393] Modules linked in: wl12xx_sdio(O) wl12xx(O) mac80211(O) cfg80211(O)
    [ 224.770174] CPU: 0 Tainted: G O (3.2.0 #7)
    [ 224.775829] PC is at cache_alloc_refill+0x134/0x51c
    [ 224.781011] LR is at kmem_cache_alloc+0x6c/0x98
    [ 224.785811] pc : [<c03f4d40>] lr : [<c009c070>] psr: 20030093
    [ 224.785826] sp : de3e7e70 ip : 0000003b fp : de3e7eb4
    [ 224.797956] r10: df002608 r9 : df0000c0 r8 : 00100100
    [ 224.803483] r7 : 00200200 r6 : df002600 r5 : ffffffff r4 : df003600
    [ 224.810388] r3 : df3af000 r2 : 0000000f r1 : 0000003b r0 : 3533334d
    [ 224.817296] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
    [ 224.824937] Control: 10c5387d Table: 9e3f0019 DAC: 00000015
    _________________________________________________
    .......................................................................................................

  • Any solution for kernel crashing issue ?

  • Hi,

    Have you tried changing the UART FIFO thresholds, as described in Section 19.3.6 FIFO Management in AM335x TRM? Also check the irq triggers.
    Also check your kernel, to see if the SERIAL_XMIT_SIZE is used anywhere else besides the UART, there could be dependencies (from what I see in your log you should check the sdio & ethernet drivers: Modules linked in: wl12xx_sdio(O) wl12xx(O) mac80211(O) cfg80211(O)).

    Best Regards,
    Yordan
  • Hi

    i will check that, one more thing i have seen after i enabled SLAB_DEBUG option   "slab corrupted" error is coming.

     UART_XMIT_SIZE 8192(8K)

    [ 18.952272] Slab corruption: names_cache start=de010000, len=4096
    [ 18.958761] 000: 0d 20 60 5f 5f 5f 5f 7c 5f 5f 5f 5f 5f 7c 20 20 . `____|_____|
    [ 18.966756] 010: 20 2f 5f 2f 20 20 20 60 5f 60 5f 7c 20 20 7c 5f /_/ `_`_| |_
    [ 18.974732] 020: 7c 5f 5f 5f 5f 2f 5f 5f 5f 5f 2f 5f 5f 5f 5f 2f |____/____/____/
    [ 18.982700] 030: 5f 2f 60 5f 60 0d 0a 0d 0d 0a 0d 0d 0a 0d 4f 53 _/`_`.........OS
    [ 18.990678] 040: 45 4c 41 53 28 52 29 2d 47 45 2d 41 4d 33 33 35 ELAS(R)-GE-AM335
    [ 18.998667] 050: 78 2d 50 44 31 33 2e 31 2e 32 20 2f 20 47 45 2d x-PD13.1.2 / GE-

    If disabling the kernel SLAB_DEBUG then following log is coming

     cat /proc/slabinfo
    slabinfo - version: 2.1
    # name [   24.110399] Unable to handle kernel paging request at virtual address 0a0d3030
    [   24.119057] pgd = de4a8000
    [   24.121899] [0a0d3030] *pgd=00000000
    [   24.125665] Internal error: Oops: 5 [#1]
    [   24.129785] Modules linked in: wl12xx_sdio(O) wl12xx(O) mac80211(O) cfg80211(O)
    [   24.137495] CPU: 0    Tainted: G           O  (3.2.0 #24)
    [   24.143190] PC is at s_show+0x50/0x248
    [   24.147141] LR is at __func__.14656+0xa1684/0xeaefc
    [   24.152270] pc : [<c009b34c>]    lr : [<c04d3890>]    psr: 00070093
    [   24.152277] sp : de4a3b10  ip : df002608  fp : de4a3b54
    [   24.164341] r10: de1986c0  r9 : de4a3b68  r8 : de12d5c0
    [   24.169831] r7 : df002600  r6 : df000100  r5 : 000002ff  r4 : 0000000d
    [   24.176691] r3 : 0a0d3020  r2 : c04d3890  r1 : 0000003b  r0 : 20202020
    [   24.183553] Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    [   24.191326] Control: 10c5387d  Table: 9e4a8019  DAC: 00000015
    [   24.197363] Process cat (pid: 945, stack limit = 0xde4a22f0)
    [   24.203308] Stack: (0xde4a3b10 to 0xde4a4000)
    [   24.207889] 3b00:                                     00000000 00000040 0000003b 00000001
    [   24.216491] 3b20: 00000000 00000005 de4a3b54 de4a3cb0 000002ed de1986c0 00000000 de12d5c0
    [   24.225092] 3b40: de4a3b68 df000100 de4a3ba4 de4a3b58 c00ba874 c009b308 00000023 de1986e8
    [   24.233693] 3b60: de0fd023 00000fdd 00000077 00000000 00000078 00000000 de4a3bac df181c40
    [   24.242292] 3b80: 0000000c 00001000 de12d5c0 de4a3cb0 00002016 c00e788c de4a3bbc de4a3ba8
    [   24.250893] 3ba0: c00e78d0 c00ba564 de0f63e8 0000000c de4a3bec de4a3bc0 c009f2a0 c00e7898
    [   24.259493] 3bc0: de4a3cb0 de12d5c0 0000f016 de4a3c08 00000000 00000010 00000000 0000f016
    [   24.268094] 3be0: de4a3c6c de4a3bf0 c009f598 c009f258 c00e788c de4a3c04 00000001 00000000
    [   24.276693] 3c00: df3a2400 de0f63c0 de4a2000 de453dc0 de4227ea 0000006a de4a3c3c de4a3c28
    [   24.285294] 3c20: c0211c30 c02115dc df070e00 df7f9600 de4a3c6c de4a3c40 c02045d4 c0211f20
    [   24.293896] 3c40: c0200438 000200d0 00000010 de4a3d10 bf000000 de4a3d10 00000fea de198680
    [   24.302498] 3c60: de4a3c8c de4a3c70 c009f674 c009f42c de4a3cb0 00000000 de4a2000 00000000

  • Hi,

    It seems other drivers also uses the serial_xmit_size definition, and cannot work when you increase the size to two pages. Maybe more drivers depend on this setting as well.
    You can try to utilize different definition than serial_xmit_size for the UART_XMIT_SIZE & modify the serial driver to use your custom define.

    Also inspect the dma for conflicts with your customization.  

    Best Regards,
    Yordan