Message ID | 20221110061545.1531-5-xin3.li@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/traps,VMX: implement software based NMI/IRQ dispatch for VMX NMI/IRQ reinjection | expand |
On Wed, Nov 09, 2022, Xin Li wrote: > +__visible noinstr void external_interrupt(struct pt_regs *regs, > + unsigned int vector) > +{ > + unsigned int sysvec = vector - FIRST_SYSTEM_VECTOR; > + > + BUG_ON(vector < FIRST_EXTERNAL_VECTOR); Why not return an error up the stack? KVM and/or CPU bugs aren't unheard of. Dropping an IRQ obviously isn't ideal, but there's a non-zero chance that letting KVM WARN and kill the VM will keep the host alive and thus other VMs running. A somewhat sophisticated setup might even react to the VM being killed by migrating other VMs off the system and initiating host maintenance.
> > +__visible noinstr void external_interrupt(struct pt_regs *regs, > > + unsigned int vector) > > +{ > > + unsigned int sysvec = vector - FIRST_SYSTEM_VECTOR; > > + > > + BUG_ON(vector < FIRST_EXTERNAL_VECTOR); > > Why not return an error up the stack? KVM and/or CPU bugs aren't unheard > of. > Dropping an IRQ obviously isn't ideal, but there's a non-zero chance that letting > KVM WARN and kill the VM will keep the host alive and thus other VMs > running. A somewhat sophisticated setup might even react to the VM being > killed by migrating other VMs off the system and initiating host maintenance. Make sense. What about having it return a signed integer?
On Thu, Nov 10, 2022, Li, Xin3 wrote: > > > +__visible noinstr void external_interrupt(struct pt_regs *regs, > > > + unsigned int vector) > > > +{ > > > + unsigned int sysvec = vector - FIRST_SYSTEM_VECTOR; > > > + > > > + BUG_ON(vector < FIRST_EXTERNAL_VECTOR); > > > > Why not return an error up the stack? KVM and/or CPU bugs aren't unheard > > of. > > Dropping an IRQ obviously isn't ideal, but there's a non-zero chance that letting > > KVM WARN and kill the VM will keep the host alive and thus other VMs > > running. A somewhat sophisticated setup might even react to the VM being > > killed by migrating other VMs off the system and initiating host maintenance. > > Make sense. > > What about having it return a signed integer? Ya, the standard 0/-errno will do nicely.
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 9c7826e588bc..c1eb3bd335ce 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -1507,6 +1507,27 @@ void __init install_system_interrupt_handler(unsigned int n, const void *asm_add alloc_intr_gate(n, asm_addr); } +/* + * External interrupt dispatch function. + * + * Until/unless common_interrupt() can be taught to deal with the + * special system vectors, split the dispatch. + * + * Note: common_interrupt() already deals with IRQ_MOVE_CLEANUP_VECTOR. + */ +__visible noinstr void external_interrupt(struct pt_regs *regs, + unsigned int vector) +{ + unsigned int sysvec = vector - FIRST_SYSTEM_VECTOR; + + BUG_ON(vector < FIRST_EXTERNAL_VECTOR); + + if (sysvec < NR_SYSTEM_VECTORS) + return system_interrupt_handler_table[sysvec](regs, vector); + + common_interrupt(regs, vector); +} + void __init trap_init(void) { /* Init cpu_entry_area before IST entries are set up */