Currently, clear_page()/copy_page() are generated by Micro-assembler
dynamically. But they are unavailable until uasm_resolve_relocs() has
finished because jump labels are illegal before that. Since these
functions are shared by every CPU, we only call build_clear_page()/
build_copy_page() on CPU#0 at boot time. Without this patch, programs
will get random memory corruption (segmentation fault, bus error, etc.)
while CPU Hotplug (e.g. one CPU is using clear_page() while another is
generating it in cpu_cache_init()).
For similar reasons we modify build_tlb_refill_handler()'s invocation.

I like the general idea behind the patch. But would prefer to move the
test to the functions that are generating the code. That way if more
call sites are added, we don't have to copy the boiler-plate testing code.

Also can we change the test to something like:
static atomic_t execute_once;
.
.
.
if (!atomic_xchg(&execute_once, 1)) {
/* Generate the code */
}
.
.
.
That way if we take CPU-0 on and off line, the code will not be regenerated.
Thanks,
David Daney