1

I want to understand what happens in these two functions in linux kernel 4.9.17

smp_tlb.c

void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
    if (tlb_ops_need_broadcast()) {
        struct tlb_args ta;
        ta.ta_start = start;
        ta.ta_end = end;
        on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
    } else          
        local_flush_tlb_kernel_range(start, end);//becomes v7wbi_flush_kern_tlb_range(start, end);

    broadcast_tlb_a15_erratum();
}

tlb_v7.S

/*
 *  v7wbi_flush_kern_tlb_range(start,end)
 *
 *  Invalidate a range of kernel TLB entries
 *
 *  - start - start address (may not be aligned)
 *  - end   - end address (exclusive, may not be aligned)
 */
ENTRY(v7wbi_flush_kern_tlb_range)
    dsb ish
    mov r0, r0, lsr #PAGE_SHIFT     @ align address
    mov r1, r1, lsr #PAGE_SHIFT
    mov r0, r0, lsl #PAGE_SHIFT
    mov r1, r1, lsl #PAGE_SHIFT
1:
#ifdef CONFIG_ARM_ERRATA_720789
    ALT_SMP(mcr p15, 0, r0, c8, c3, 3)  @ TLB invalidate U MVA all ASID (shareable)
#else
    ALT_SMP(mcr p15, 0, r0, c8, c3, 1)  @ TLB invalidate U MVA (shareable)
#endif
    ALT_UP(mcr  p15, 0, r0, c8, c7, 1)  @ TLB invalidate U MVA
    add r0, r0, #PAGE_SZ
    cmp r0, r1
    blo 1b
    dsb ish
    isb
    ret lr
ENDPROC(v7wbi_flush_kern_tlb_range)

Because I do not have a debugger and my kernel stops after calling local_flush_tlb_kernel_range(start, end); and I do not know how to debug inside this assembly file.

Also I just copied this from sabresd kernel command line for android

Kernel command line: console=ttymxc0,115200 init=/init earlyprintk video=mxcfb0:dev=ldb,fbpix=RGB32,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=128M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=448M galcore.contiguousSize=33554432 buildvariant=userdebug androidboot.serialno=110f91d4ea9ac958 androidboot.soc_type=imx6qp androidboot.storage_type=sd gpt

Can anyone tell what these variables means to kernel

vmalloc=128M
cma=448M
galcore.contiguousSize=33554432
androidboot.serialno=110f91d4ea9ac958

How should I change these, on what basis? How can i cross check that these are correct command line options i want?

Here in the command line it wants 448MiB of contiguous area, for vmalloc 128M. But isn't it the vmalloc area itself needs to be contiguous, then why two seperate variables?

Now sabresd have 1GB of DDR3 memory, 448+ 128+ 32 = 608MiB. if that much memry is allocated as contiguous blocks then kernel memory will be very small and smaller will be user address space. Is my understanding correct?

What is androidboot.serialno? Why android put it in command line?

Any help or direction will be very helpful.

mrigendra
  • 1,472
  • 3
  • 19
  • 33
  • *Because I do not have a debugger* There's your problem. If you're hitting a problem before you can attach remote debugging, can you build your kernel with KDB, so you have a debugger built-in to your kernel? [Linux kernel live debugging, how it's done and what tools are used?](https://stackoverflow.com/q/4943857) – Peter Cordes Jul 08 '18 at 22:11
  • I removed vmalloc, galcore.contiguous then its booting? What are the implications of this removal? – mrigendra Jul 09 '18 at 07:05

0 Answers0