kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Regression after "Remove support for reporting coalesced APIC IRQs"
@ 2013-06-06  8:53 Gleb Natapov
  2013-06-06 15:39 ` Ren, Yongjie
  2013-06-20 11:47 ` Gleb Natapov
  0 siblings, 2 replies; 7+ messages in thread
From: Gleb Natapov @ 2013-06-06  8:53 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm, yongjie.ren

Hi Jan,

I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca. Fortunately
further investigation showed that it is not really related to removing
APIC timer interrupt reinjection and the real problem is that we cannot
assume that __apic_accept_irq() always injects interrupts like the patch
does because the function skips interrupt injection if APIC is disabled.
This misreporting screws RTC interrupt tracking, so further RTC interrupt
are stopped to be injected. The simplest solution that I see is to revert
most of the commit and only leave APIC timer interrupt reinjection.

If you have more elegant solution let me know.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=58931
--
			Gleb.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Regression after "Remove support for reporting coalesced APIC IRQs"
  2013-06-06  8:53 Regression after "Remove support for reporting coalesced APIC IRQs" Gleb Natapov
@ 2013-06-06 15:39 ` Ren, Yongjie
  2013-06-20 11:47 ` Gleb Natapov
  1 sibling, 0 replies; 7+ messages in thread
From: Ren, Yongjie @ 2013-06-06 15:39 UTC (permalink / raw)
  To: Gleb Natapov, Jan Kiszka; +Cc: kvm@vger.kernel.org

> -----Original Message-----
> From: Gleb Natapov [mailto:gleb@redhat.com]
> Sent: Thursday, June 06, 2013 4:54 PM
> To: Jan Kiszka
> Cc: kvm@vger.kernel.org; Ren, Yongjie
> Subject: Regression after "Remove support for reporting coalesced APIC
> IRQs"
> 
> Hi Jan,
> 
> I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca.
>
Right. Before Gleb's mail, I also just did the bisection for this bug. 
The first bad commit is Jan's f1ed0450.

> Fortunately
> further investigation showed that it is not really related to removing
> APIC timer interrupt reinjection and the real problem is that we cannot
> assume that __apic_accept_irq() always injects interrupts like the patch
> does because the function skips interrupt injection if APIC is disabled.
> This misreporting screws RTC interrupt tracking, so further RTC interrupt
> are stopped to be injected. The simplest solution that I see is to revert
> most of the commit and only leave APIC timer interrupt reinjection.
> 
> If you have more elegant solution let me know.
> 
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=58931
> --
> 			Gleb.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression after "Remove support for reporting coalesced APIC IRQs"
  2013-06-06  8:53 Regression after "Remove support for reporting coalesced APIC IRQs" Gleb Natapov
  2013-06-06 15:39 ` Ren, Yongjie
@ 2013-06-20 11:47 ` Gleb Natapov
  2013-06-20 20:10   ` Jan Kiszka
  1 sibling, 1 reply; 7+ messages in thread
From: Gleb Natapov @ 2013-06-20 11:47 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm, yongjie.ren

Jan ping, are you OK with what I proposed below?

On Thu, Jun 06, 2013 at 11:53:52AM +0300, Gleb Natapov wrote:
> Hi Jan,
> 
> I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca. Fortunately
> further investigation showed that it is not really related to removing
> APIC timer interrupt reinjection and the real problem is that we cannot
> assume that __apic_accept_irq() always injects interrupts like the patch
> does because the function skips interrupt injection if APIC is disabled.
> This misreporting screws RTC interrupt tracking, so further RTC interrupt
> are stopped to be injected. The simplest solution that I see is to revert
> most of the commit and only leave APIC timer interrupt reinjection.
> 
> If you have more elegant solution let me know.
> 
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=58931
> --
> 			Gleb.
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
			Gleb.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression after "Remove support for reporting coalesced APIC IRQs"
  2013-06-20 11:47 ` Gleb Natapov
@ 2013-06-20 20:10   ` Jan Kiszka
  2013-06-20 20:29     ` Gleb Natapov
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2013-06-20 20:10 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm, yongjie.ren

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

On 2013-06-20 13:47, Gleb Natapov wrote:
> Jan ping, are you OK with what I proposed below?
> 
> On Thu, Jun 06, 2013 at 11:53:52AM +0300, Gleb Natapov wrote:
>> Hi Jan,
>>
>> I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca. Fortunately
>> further investigation showed that it is not really related to removing
>> APIC timer interrupt reinjection and the real problem is that we cannot
>> assume that __apic_accept_irq() always injects interrupts like the patch
>> does because the function skips interrupt injection if APIC is disabled.
>> This misreporting screws RTC interrupt tracking, so further RTC interrupt
>> are stopped to be injected. The simplest solution that I see is to revert
>> most of the commit and only leave APIC timer interrupt reinjection.

I'm not understanding the precise error yet and how __apic_accept_irq
should be (properly) involved in its solution. Which code path depend on
the information that the APIC is enabled?

The point is that preserving the return value of __apic_accept_irq, just
redefining it to "delivery_mode != APIC_DM_FIXED || apic_enabled()"
creates a pretty ugly interface, no? Can't we address the specific issue
of the RTC at a different level?

Jan



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression after "Remove support for reporting coalesced APIC IRQs"
  2013-06-20 20:10   ` Jan Kiszka
@ 2013-06-20 20:29     ` Gleb Natapov
  2013-06-20 21:01       ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Gleb Natapov @ 2013-06-20 20:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm, yongjie.ren

On Thu, Jun 20, 2013 at 10:10:18PM +0200, Jan Kiszka wrote:
> On 2013-06-20 13:47, Gleb Natapov wrote:
> > Jan ping, are you OK with what I proposed below?
> > 
> > On Thu, Jun 06, 2013 at 11:53:52AM +0300, Gleb Natapov wrote:
> >> Hi Jan,
> >>
> >> I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca. Fortunately
> >> further investigation showed that it is not really related to removing
> >> APIC timer interrupt reinjection and the real problem is that we cannot
> >> assume that __apic_accept_irq() always injects interrupts like the patch
> >> does because the function skips interrupt injection if APIC is disabled.
> >> This misreporting screws RTC interrupt tracking, so further RTC interrupt
> >> are stopped to be injected. The simplest solution that I see is to revert
> >> most of the commit and only leave APIC timer interrupt reinjection.
> 
> I'm not understanding the precise error yet and how __apic_accept_irq
> should be (properly) involved in its solution. Which code path depend on
> the information that the APIC is enabled?
> 
RTC interrupt injection tracking in virt/kvm/ioapic.c depends on
accurate information about which vcpus interrupt was injected into since it
expects EOI from each vcpu before injection next RTC interrupt. Since
now kvm_apic_set_irq() reports interrupt as injected for vcpus with
disabled apic the logic breaks because EOI will never happen.

> The point is that preserving the return value of __apic_accept_irq, just
> redefining it to "delivery_mode != APIC_DM_FIXED || apic_enabled()"
> creates a pretty ugly interface, no? Can't we address the specific issue
> of the RTC at a different level?
> 
Do not see how.

--
			Gleb.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression after "Remove support for reporting coalesced APIC IRQs"
  2013-06-20 20:29     ` Gleb Natapov
@ 2013-06-20 21:01       ` Jan Kiszka
  2013-06-23  9:13         ` Gleb Natapov
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2013-06-20 21:01 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: kvm, yongjie.ren

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

On 2013-06-20 22:29, Gleb Natapov wrote:
> On Thu, Jun 20, 2013 at 10:10:18PM +0200, Jan Kiszka wrote:
>> On 2013-06-20 13:47, Gleb Natapov wrote:
>>> Jan ping, are you OK with what I proposed below?
>>>
>>> On Thu, Jun 06, 2013 at 11:53:52AM +0300, Gleb Natapov wrote:
>>>> Hi Jan,
>>>>
>>>> I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca. Fortunately
>>>> further investigation showed that it is not really related to removing
>>>> APIC timer interrupt reinjection and the real problem is that we cannot
>>>> assume that __apic_accept_irq() always injects interrupts like the patch
>>>> does because the function skips interrupt injection if APIC is disabled.
>>>> This misreporting screws RTC interrupt tracking, so further RTC interrupt
>>>> are stopped to be injected. The simplest solution that I see is to revert
>>>> most of the commit and only leave APIC timer interrupt reinjection.
>>
>> I'm not understanding the precise error yet and how __apic_accept_irq
>> should be (properly) involved in its solution. Which code path depend on
>> the information that the APIC is enabled?
>>
> RTC interrupt injection tracking in virt/kvm/ioapic.c depends on
> accurate information about which vcpus interrupt was injected into since it
> expects EOI from each vcpu before injection next RTC interrupt. Since
> now kvm_apic_set_irq() reports interrupt as injected for vcpus with
> disabled apic the logic breaks because EOI will never happen.

OK, so we may have to enhance kvm_apic_set_irq. Or implement the
apic_enabled check properly in __apic_accept_irq (though only
kvm_apic_set_irq will have a use for it).

The (historic) check looks very strange, misplaced, and carries a
comment that is probably also outdated. The check used to protect the
only functioning delivery mode, but then was left in place, ignoring all
the other modes.

Yes, that's not directly related to this regression. We can revert first
and then rework this interface. But the latter should definitely be done
as the revert will make the interface even worse IMHO.

Jan



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Regression after "Remove support for reporting coalesced APIC IRQs"
  2013-06-20 21:01       ` Jan Kiszka
@ 2013-06-23  9:13         ` Gleb Natapov
  0 siblings, 0 replies; 7+ messages in thread
From: Gleb Natapov @ 2013-06-23  9:13 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm, yongjie.ren

On Thu, Jun 20, 2013 at 11:01:54PM +0200, Jan Kiszka wrote:
> On 2013-06-20 22:29, Gleb Natapov wrote:
> > On Thu, Jun 20, 2013 at 10:10:18PM +0200, Jan Kiszka wrote:
> >> On 2013-06-20 13:47, Gleb Natapov wrote:
> >>> Jan ping, are you OK with what I proposed below?
> >>>
> >>> On Thu, Jun 06, 2013 at 11:53:52AM +0300, Gleb Natapov wrote:
> >>>> Hi Jan,
> >>>>
> >>>> I bisected [1] to f1ed0450a5fac7067590317cbf027f566b6ccbca. Fortunately
> >>>> further investigation showed that it is not really related to removing
> >>>> APIC timer interrupt reinjection and the real problem is that we cannot
> >>>> assume that __apic_accept_irq() always injects interrupts like the patch
> >>>> does because the function skips interrupt injection if APIC is disabled.
> >>>> This misreporting screws RTC interrupt tracking, so further RTC interrupt
> >>>> are stopped to be injected. The simplest solution that I see is to revert
> >>>> most of the commit and only leave APIC timer interrupt reinjection.
> >>
> >> I'm not understanding the precise error yet and how __apic_accept_irq
> >> should be (properly) involved in its solution. Which code path depend on
> >> the information that the APIC is enabled?
> >>
> > RTC interrupt injection tracking in virt/kvm/ioapic.c depends on
> > accurate information about which vcpus interrupt was injected into since it
> > expects EOI from each vcpu before injection next RTC interrupt. Since
> > now kvm_apic_set_irq() reports interrupt as injected for vcpus with
> > disabled apic the logic breaks because EOI will never happen.
> 
> OK, so we may have to enhance kvm_apic_set_irq. Or implement the
> apic_enabled check properly in __apic_accept_irq (though only
> kvm_apic_set_irq will have a use for it).
> 
> The (historic) check looks very strange, misplaced, and carries a
> comment that is probably also outdated. The check used to protect the
> only functioning delivery mode, but then was left in place, ignoring all
> the other modes.
> 
The only other delivery mode that needs to be protected is NMI as far as
I see and check can be relaxed to kvm_apic_sw_enabled() since if apic is
hw disabled the function should not be called. I do not think the check
is strange or misplaced, where do you propose to put it instead? The
comment is probably outdated since I cannot figure out what it means :)

> Yes, that's not directly related to this regression. We can revert first
> and then rework this interface. But the latter should definitely be done
> as the revert will make the interface even worse IMHO.
> 
> Jan
> 
> 



--
			Gleb.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-23  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06  8:53 Regression after "Remove support for reporting coalesced APIC IRQs" Gleb Natapov
2013-06-06 15:39 ` Ren, Yongjie
2013-06-20 11:47 ` Gleb Natapov
2013-06-20 20:10   ` Jan Kiszka
2013-06-20 20:29     ` Gleb Natapov
2013-06-20 21:01       ` Jan Kiszka
2013-06-23  9:13         ` Gleb Natapov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).