Skip to contentSkip to conversation

bt_ioremap question / cyclone-timer_A1 patch

RFC Mikael Pettersson 2 participants 2 messages Jul 9, 2002 – Jul 10, 2002 Documentation

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · john stultz

I've been working on improving performance of do_gettimeofday on
certain NUMA hardware (see my earlier tsc-disable posts for why the TSCs cannot be used), and I wanted to run this by the list to make sure I'm not doing anything too daft.

Mainly I'm concerned about my usage of bt_ioremap. Early in the boot processes, I need to map in a couple of chipset registers and poke values into them.

How early? If this is just to get gettimeofday() working, can't it wait until the regular initcalls are done?

Quoted 6 lines

However one of the registers needs to be kept mapped
for the life of the system (look for "cyclone_timer" below). I couldn't find any documentation on whether memory mapped with bt_ioremap can be held across mem_init(). It seems to "just work" but I wanted to find out if I really should be re-mapping the register w/ ioremap once it becomes available.

If you look in include/asm-i386/fixmap.h you'll see that the BT ioremap pages are temporary, and they do disappear once mem_init() [or whatever] is done [pgtable.h sets VMALLOC_END to just below FIXADDR_START, which protects the permanent fixmaps but intensionally not the temporary ones]. If it seemed to work for you then that's just luck, or perhaps it does work in highmem kernels?

For things that must be mapped very early and continue to be mapped as long as the kernel is up, you need a permanent fixmap. fixmap.h has a number of permanent fixmaps defined #ifdef CONFIG_* and you can easily add your own there, under #ifdef CONFIG_X86_IBMEXA.

/Mikael

#1 lore raw
Quoted 7 lines · Mikael Pettersson
Quoted 3 lines · john stultz

Mainly I'm concerned about my usage of bt_ioremap. Early in the boot processes, I need to map in a couple of chipset registers and poke values into them.

How early? If this is just to get gettimeofday() working, can't it wait until the regular initcalls are done?

I guess I might be able to pull it out and do the initialization somewhere else, but really time_init() seems like the best spot.

Quoted 14 lines
Quoted 6 lines

However one of the registers needs to be kept mapped
for the life of the system (look for "cyclone_timer" below). I couldn't find any documentation on whether memory mapped with bt_ioremap can be held across mem_init(). It seems to "just work" but I wanted to find out if I really should be re-mapping the register w/ ioremap once it becomes available.

If you look in include/asm-i386/fixmap.h you'll see that the BT ioremap pages are temporary, and they do disappear once mem_init() [or whatever] is done [pgtable.h sets VMALLOC_END to just below FIXADDR_START, which protects the permanent fixmaps but intensionally not the temporary ones]. If it seemed to work for you then that's just luck, or perhaps it does work in highmem kernels?

Quoted 4 lines

For things that must be mapped very early and continue to be mapped as long as the kernel is up, you need a permanent fixmap. fixmap.h has a number of permanent fixmaps defined #ifdef CONFIG_* and you can easily add your own there, under #ifdef CONFIG_X86_IBMEXA.

Thank you for the pointer. I gave it a whirl (see attached) and it seems to work fine! If anyone notices that I'm still just horribly lucky and I've done everything wrong, please let me know. :)

Thanks again for the feedback and suggestions!
-john

ps: Again, if anyone feels so inclined to try this patch, do note that it depends on my tsc-disable patch to apply cleanly. Send me a note and I'll fwd you my latest version.

Documentation/Configure.help +5 -0
diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help
@@ -257,6 +257,11 @@
   You will need a new lynxer.elf file to flash your firmware with - send
   email to [email protected]
 
+IBM Enterprise X-Architecture support
+CONFIG_X86_IBMEXA
+  This option makes use of a performance counter on the Cyclone chipset 
+  for calculating do_gettimeofday, greatly improving its performance. 
+
 IO-APIC support on uniprocessors
 CONFIG_X86_UP_IOAPIC
   An IO-APIC (I/O Advanced Programmable Interrupt Controller) is an
arch/i386/config.in +1 -0
diff -Nru a/arch/i386/config.in b/arch/i386/config.in
@@ -201,6 +201,7 @@
 	bool 'Multi-node NUMA system support' CONFIG_X86_NUMA
 	if [ "$CONFIG_X86_NUMA" = "y" ]; then
 		bool 'Multiquad (IBM/Sequent) NUMAQ support' CONFIG_MULTIQUAD
+		bool 'IBM Enterprise X-Architecture support' CONFIG_X86_IBMEXA
 	fi
 fi
 
arch/i386/kernel/time.c +99 -0

123 lines not on this page · raw message

include/asm-i386/fixmap.h +3 -0
diff -Nru a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
@@ -61,6 +61,9 @@
 	FIX_LI_PCIA,	/* Lithium PCI Bridge A */
 	FIX_LI_PCIB,	/* Lithium PCI Bridge B */
 #endif
+#ifdef CONFIG_X86_IBMEXA
+	FIX_CYCLONE_TIMER, /*cyclone timer register*/
+#endif 
 #ifdef CONFIG_HIGHMEM
 	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
 	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,