kmalloc before kmem_cache_init
From: Sukanto Ghosh <hidden>
Date: 2012-01-29 07:25:47
Hi Dave,
If you look into start_kernel() the call to parse_early_param()
precedes mm_init().
parse_early_param() eventually calls do_early_param().
do_early_param() parses for "earlycon" in kernel commandline and then calls the
setup_function associated with earlycon.
I have in my commandline: earlycon=uart8250,mmio32,0x10000000,9600
Call flow starting from drivers/tty/serial/8250_early.c will lead to kmalloc
early_param("early_con", setup_early_serial8250_console)
setup_early_serial8250_console()
early_serial8250_setup()
parse_options()
ioremap_nocache()
... arch-specific-ioremap
-- some form of arch specific __ioremap_caller
--- get_vm_area_caller()
__get_vm_area_node
kzalloc_node
kmalloc_node
kmalloc
Regards,
Sukanto
On Jan 29, 2012 12:28 PM, "Dave Hylands" [off-list ref] wrote:Hi Sukanto On Sat, Jan 28, 2012 at 10:02 PM, Sukanto Ghosh [off-list ref] wrote:quoted
I am kind of lost trying to figure out how can kmallocs work if they are called before kmem_cache_init (e.g. such a case occurs when in start_kernel() we call parse_early_param() (which in turn might call early_serial8250_setup() if earlycon= is used in kernel command-line) before mm_init() ?(which later calls kmem_cache_init() )I don't think that you're allowed to call kmalloc during early_setup. I don't see where early_serial8250_setup calls kmalloc. -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com