What is use of apply_alternative function from alternative.c

Jim Cromie jim.cromie at gmail.com
Mon Mar 26 00:42:35 EDT 2012


On Tue, Mar 20, 2012 at 7:54 AM, Pritam Bankar
<pritambankar1988 at gmail.com> wrote:
> Hi,
> Cal anyone help me in understanding alternative.c file from Linux source
> code.

> I want to learn function apply_alternative. AFAIK this code applies better
> replacement to instruction set used by processor.
> But I am not sure what exactly it is doing ?

if you add "debug-alternatives" to boot args, you'll see something like this.

basically it patches the kernel, inserting locks and synchronization
so that the kernel can run on SMP / multi-core arches.
Once this is done, the other cores can be started.

There are also some helpful comments in the code :-O

apply_alternatives: alt table ffffffff81d546a8 -> ffffffff81d54ccc
alternatives_smp_module_add: locks ffffffff81d57000 ->
ffffffff81d5a000, text ffffffff81000000 -> ffffffff8149a3d2, name core
kernel
lockdep: fixing up alternatives.
lockdep: fixing up alternatives.
lockdep: fixing up alternatives.
apply_alternatives: alt table ffffffff81a0363a -> ffffffff81a03652
alternatives_smp_module_add: locks ffffffffa001115c ->
ffffffffa001117c, text ffffffffa000f000 -> ffffffffa0010ac0, name
video
alternatives_smp_module_add: locks ffffffffa002f530 ->
ffffffffa002f598, text ffffffffa002c000 -> ffffffffa002efb4, name
agpgart
alternatives_smp_module_add: locks ffffffffa005b1a4 ->
ffffffffa005b244, text ffffffffa0039000 -> ffffffffa004e508, name drm
alternatives_smp_module_add: locks ffffffffa007f634 ->
ffffffffa007f638, text ffffffffa007b000 -> ffffffffa007e6fc, name
drm_kms_helper
alternatives_smp_module_add: locks ffffffffa0091a84 ->
ffffffffa0091abc, text ffffffffa0087000 -> ffffffffa008fab4, name ttm
apply_alternatives: alt table ffffffffa011ca28 -> ffffffffa011ca40
alternatives_smp_module_add: locks ffffffffa011c8f8 ->
ffffffffa011c974, text ffffffffa00a1000 -> ffffffffa010c104, name
nouveau
alternatives_smp_module_add: locks ffffffffa006fc14 ->
ffffffffa006fc68, text ffffffffa006b000 -> ffffffffa006e340, name
usb_storage
alternatives_smp_module_add: locks ffffffffa013d45c ->
ffffffffa013d474, text ffffffffa0138000 -> ffffffffa013c044, name
autofs4
alternatives_smp_module_add: locks ffffffffa0177b38 ->
ffffffffa0177c84, text ffffffffa0141000 -> ffffffffa0170380, name ipv6
alternatives_smp_module_add: locks ffffffffa000d294 ->
ffffffffa000d2bc, text ffffffffa000c000 -> ffffffffa000d174, name
uinput
apply_alternatives: alt table ffffffffa01d7b77 -> ffffffffa01d7be3
alternatives_smp_module_add: locks ffffffffa01d491c ->
ffffffffa01d4a00, text ffffffffa01a2000 -> ffffffffa01ccf6c, name kvm

>
> --
>
> Pritam Bankar
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



More information about the Kernelnewbies mailing list