RE: flusing cache ranges while doing module_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm sorry !!!!

-Vamsi


-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Thomas Petazzoni
Sent: Friday, March 10, 2006 6:32 PM
To: kernelnewbies@xxxxxxxxxxxx
Subject: Re: flusing cache ranges while doing module_init


Hi,

First of all, please do not recycle old threads to send your messages. Please use the "New" button of your e-mail client, and not the "Reply" button when you want to start a new thread. Thanks.

Le Fri, 10 Mar 2006 22:22:51 +0530,
Vamsi <krishna.vamsi@xxxxxxxxx> a écrit :

> gng by the Kernel Module initialisation code (
> kernel/module.c-sys_init_module()  function ), it is trying flush 
> i-cache ranges and i really failed to understand why it is doing it...
> 
> if (mod->module_init)
>                 flush_icache_range((unsigned long)mod->module_init,
>                                    (unsigned long)mod->module_init
>                                    + mod->init_size);
>         flush_icache_range((unsigned long)mod->module_core,
>                            (unsigned long)mod->module_core +
> mod->core_size);

This happens right after module loading, and before execution of any
code of the module. From my understand, this flush of Instruction Cache
is needed, because this cache might contain spurious cache lines, not
coherent with what we just loaded into memory. In order to make sure
that we're going to execute the code we have just loaded, we need to
flush the cache for the range of adresses where we loaded the code.

BTW, on i386, flush_icache_range() is a no-op, because the processor
already takes care of this kind of problem. See
http://lxr.linux.no/source/include/asm-i386/cacheflush.h#L15. But for
m68k, some stuff is needed, see
http://lxr.linux.no/source/arch/m68k/mm/memory.c#L426.

This is related to the cache coherency problem, see
http://en.wikipedia.org/wiki/Cache_coherency.

(Please note that I'm not a specialist of these caches, barriers and
other architecture-dependant subtelties, so do not hesitate to correct
these informations if needed.)

Sincerly,

Thomas
-- 
Thomas Petazzoni - thomas.petazzoni@xxxxxxxx
http://{thomas,sos,kos}.enix.org - http://www.toulibre.org
http://www.{livret,agenda}dulibre.org

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux