From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Rutherford Subject: Re: [PATCH kvm-unit-tests] x86: ioapic: add tests around retriggering of level interrupts Date: Wed, 29 Jul 2015 20:14:48 -0700 Message-ID: <20150730031448.GB15229@google.com> References: <1438176493-26033-1-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Paolo Bonzini Return-path: Received: from mail-pd0-f182.google.com ([209.85.192.182]:35313 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbbG3DOv (ORCPT ); Wed, 29 Jul 2015 23:14:51 -0400 Received: by pdrg1 with SMTP id g1so16396766pdr.2 for ; Wed, 29 Jul 2015 20:14:51 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1438176493-26033-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 29, 2015 at 03:28:13PM +0200, Paolo Bonzini wrote: > Test resampling of level interrupts after EOI, by leaving the IRQ > line set in the ISR. One tests does reset the IRQ line after a while, > the other uses masking instead in the ISR. > > Signed-off-by: Paolo Bonzini > --- > x86/ioapic.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/x86/ioapic.c b/x86/ioapic.c > index 1fcf67e..d43d5c1 100644 > --- a/x86/ioapic.c > +++ b/x86/ioapic.c > @@ -188,6 +188,31 @@ static void test_ioapic_level_sequential(void) > report("sequential level interrupts", g_isr_99 == 2); > } > > +static volatile int g_isr_9a; > + > +static void ioapic_isr_9a(isr_regs_t *regs) > +{ > + ++g_isr_9a; > + if (g_isr_9a == 2) > + set_irq_line(0x0e, 0); > + eoi(); > +} > + > +static void test_ioapic_level_retrigger(void) > +{ > + handle_irq(0x9a, ioapic_isr_9a); > + set_ioapic_redir(0x0e, 0x9a, LEVEL_TRIGGERED); > + > + asm volatile ("cli"); > + set_irq_line(0x0e, 1); > + while (g_isr_9a != 2) > + asm volatile ("sti; hlt; cli"); This seems sketchy. The test should be able to exit this and fail. Steve