Re: [PATCH] MIPS: Implement __read_mostly

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

 



On Sat, Oct 16, 2010 at 10:04, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> On Thu, Oct 14, 2010 at 21:36, David Daney <ddaney@xxxxxxxxxxxxxxxxxx> wrote:
>> Just do what everyone else is doing by placing __read_mostly things in
>> the .data.read_mostly section.
>>
>> mips_io_port_base can not be read-only (const) and writable
>> (__read_mostly) at the same time. ÂOne of them has to go, so I chose
>> to eliminate the __read_mostly. ÂIt will still get stuck in a portion
>> of memory that is not adjacent to things that are written, and thus
>> not be on a dirty cache line, for whatever that is worth.
>>
>> Signed-off-by: David Daney <ddaney@xxxxxxxxxxxxxxxxxx>
>> ---
>> Âarch/mips/include/asm/cache.h | Â Â2 ++
>> Âarch/mips/kernel/setup.c   Â|  Â2 +-
>> Â2 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/mips/include/asm/cache.h b/arch/mips/include/asm/cache.h
>> index 37f175c..650ac9b 100644
>> --- a/arch/mips/include/asm/cache.h
>> +++ b/arch/mips/include/asm/cache.h
>> @@ -17,4 +17,6 @@
>> Â#define SMP_CACHE_SHIFT Â Â Â Â Â Â Â ÂL1_CACHE_SHIFT
>> Â#define SMP_CACHE_BYTES Â Â Â Â Â Â Â ÂL1_CACHE_BYTES
>>
>> +#define __read_mostly __attribute__((__section__(".data.read_mostly")))
>> +
>> Â#endif /* _ASM_CACHE_H */
>> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
>> index 4e68a51..6d0c3be 100644
>> --- a/arch/mips/kernel/setup.c
>> +++ b/arch/mips/kernel/setup.c
>> @@ -69,7 +69,7 @@ static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
>> Â* mips_io_port_base is the begin of the address space to which x86 style
>> Â* I/O ports are mapped.
>> Â*/
>> -const unsigned long mips_io_port_base __read_mostly = -1;
>> +const unsigned long mips_io_port_base = -1;
>> ÂEXPORT_SYMBOL(mips_io_port_base);
>
> Ugh. So as soon as someone implements MMU protection for the read-only data
> section, it'll break silently?

Sorry, not silently. It'll panic ;-)

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux