apic NOOP driver
RFC 1/1 apic NOOP driver
Ingo,
here is what implemented at moment. Did you mean something like that? Note that it's quite early RFC not for any kind of inclusion.
Actually compiled driver eats about ~1.3K of memory so perhaps the better option would be to just implement noop read/write and IPI calls leaving all other calls NULLified -- it'll cause NULL deref but the fact is that the former operations are called that deep in apic/io-apic code where they shouldn't be touched at all and even issue warning (as noop does) should be substituted with panic I think (though I tried to put return values for noop operations more or less sane here).
What else... NOOP_FUNC macros looks fishy but can't imagine at moment anything more elegant instead of open coded functions.
Anyway, I would appreciate any comments (negative comments too of course :)
-- Cyrill
---
x86,apic: introduce NOOP apic driver
Introduce NOOP APIC driver. We use it in case if apic was disabled due to hardware of software/firmware problems (including user requested to disable it case).
The driver is attempting to catch any inappropriate apic operation call with warning issue.
Also it is possible to use some apic operation like IPI calls, read/write without checking for apic presence which should make callers code easier.
--- arch/x86/include/asm/apic.h | 2 arch/x86/kernel/apic/Makefile | 2 arch/x86/kernel/apic/apic.c | 22 ---- arch/x86/kernel/apic/apic_noop.c | 194 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 200 insertions(+), 20 deletions(-)
arch/x86/include/asm/apic.h +2 -0
@@ -488,6 +488,8 @@ static inline unsigned int read_apic_id(extern void default_setup_apic_routing (void ); +extern struct apic apic_noop; +#ifdef CONFIG_X86_32 extern struct apic apic_default;
arch/x86/kernel/apic/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for local APIC drivers and for the IO-APIC code # -obj-$(CONFIG_X86_LOCAL_APIC) += apic.o probe_$(BITS).o ipi.o nmi.o +obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_SMP) += ipi.o
arch/x86/kernel/apic/apic.c +3 -19
@@ -241,28 +241,12 @@ static int modern_apic(void) }/* -* bare function to substitute write operation -* and it's _that_ fast :) -*/ -static void native_apic_write_dummy (u32 reg,u32 v) -{ -WARN_ON_ONCE ((cpu_has_apic || !disable_apic)); -} - -static u32 native_apic_read_dummy (u32 reg) -{ -WARN_ON_ONCE ((cpu_has_apic && !disable_apic)); -return 0 ; -} - -/* -* right after this call apic->write/read doesn't do anything -* note that there is no restore operation it works one way +* right after this call apic become NOOP driven +* so apic->write/read doesn't do anything */ void apic_disable (void ) { - apic->read = native_apic_read_dummy; - apic->write = native_apic_write_dummy; + apic = &apic_noop; }void native_apic_wait_icr_idle (void )
arch/x86/kernel/apic/apic_noop.c new file +194 -0
194 lines not on this page · raw message
Quoted 4 lines · Cyrill Gorcunov
Ingo,
here is what implemented at moment. Did you mean something like that? Note that it's quite early RFC not for any kind of inclusion.
yeah, this looks pretty good.
And i'd suggest to separate the patches that introduce this APIC driver from the changes that make use of it. Makes for an easier bisection target.
Ingo
[Ingo Molnar - Tue, Oct 13, 2009 at 12:32:29PM +0200]
| | * Cyrill Gorcunov <[email protected]> wrote: | | > Ingo, | > | > here is what implemented at moment. Did you mean something like that? | > Note that it's quite early RFC not for any kind of inclusion. | | yeah, this looks pretty good. | | And i'd suggest to separate the patches that introduce this APIC driver | from the changes that make use of it. Makes for an easier bisection | target. | | Ingo |
OK, will do so over fresh -tip.
-- Cyrill