kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <wanpeng.li@linux.intel.com>
To: Zhang Haoyu <zhanghy@sangfor.com>
Cc: "Zhang, Yang Z" <yang.z.zhang@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>, kvm <kvm@vger.kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	"Michael S.Tsirkin" <mst@redhat.com>,
	Gleb Natapov <gleb@cloudius-systems.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [question] lots of interrupts injected to vm when pressing some key w/o releasing
Date: Fri, 28 Nov 2014 16:27:06 +0800	[thread overview]
Message-ID: <20141128082706.GA4090@kernel> (raw)
In-Reply-To: <201411271520408455055@sangfor.com>

Hi all,
On Thu, Nov 27, 2014 at 03:20:43PM +0800, Zhang Haoyu wrote:
>>>>>>> I tested win-server-2008 with "-cpu 
>>>>>>> core2duo,hv_spinlocks=0xffff,hv_relaxed,hv_time",
>>>>>>> this problem still happened, about 200,000 vmexits per-second, 
>>>>>>> bringing very bad experience, just like being stuck.
>>>>>> 
>>>>>> Please upload a full trace somewhere, or at least the "perf report" output.
>>>>>> 
>>>>> 
>>>>> And, if I remove the commit of 0bc830b0, the problem disappeared.
>>>> 
>>>> Please send the full trace file.  If you compress it, it should be small.
>>>> 
>>> See the attach 1, please.
>>> 
>>>> Paolo
>>
>>Can you try the follow draft patch to see whether it solve your problem? This patch is based on commit 0bc830b0.
>>
>After applying this patch, VM got stuck with black-screen at boot stage,
># trace-cmd report:
>version = 6
>CPU 0 is empty
>CPU 1 is empty
>CPU 2 is empty
>CPU 3 is empty
>CPU 5 is empty
>CPU 7 is empty
>cpus=8
>             kvm-1266  [004] 14399.834397: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [004] 14399.834403: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [004] 14399.834411: kvm_apic_accept_irq:  apicid 0 vec 177 (LowPrio|level)
>             kvm-1266  [004] 14399.834412: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>             kvm-1266  [004] 14402.180013: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [004] 14402.180019: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [004] 14402.180028: kvm_apic_accept_irq:  apicid 1 vec 177 (LowPrio|level)
>             kvm-1266  [004] 14402.180029: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>             kvm-1266  [004] 14404.525627: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [004] 14404.525634: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [004] 14404.525641: kvm_apic_accept_irq:  apicid 0 vec 177 (LowPrio|level)
>             kvm-1266  [004] 14404.525642: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>             kvm-1266  [004] 14406.871238: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [004] 14406.871245: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [004] 14406.871254: kvm_apic_accept_irq:  apicid 1 vec 177 (LowPrio|level)
>             kvm-1266  [004] 14406.871256: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>             kvm-1266  [006] 14409.216849: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [006] 14409.216855: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [006] 14409.216862: kvm_apic_accept_irq:  apicid 0 vec 177 (LowPrio|level)
>             kvm-1266  [006] 14409.216863: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>             kvm-1266  [006] 14411.562475: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [006] 14411.562481: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [006] 14411.562489: kvm_apic_accept_irq:  apicid 1 vec 177 (LowPrio|level)
>             kvm-1266  [006] 14411.562491: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>             kvm-1266  [004] 14413.908074: kvm_set_irq:          gsi 9 level 1 source 0
>             kvm-1266  [004] 14413.908080: kvm_pic_set_irq:      chip 1 pin 1 (edge|masked)
>             kvm-1266  [004] 14413.908088: kvm_apic_accept_irq:  apicid 0 vec 177 (LowPrio|level)
>             kvm-1266  [004] 14413.908089: kvm_ioapic_set_irq:   pin 9 dst 3 vec=177 (LowPrio|logical|level)
>
>Thanks,
>Zhang Haoyu
>
>>diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
>>index 25e16a6..8f4e211 100644
>>--- a/virt/kvm/ioapic.c
>>+++ b/virt/kvm/ioapic.c
>>@@ -305,6 +305,7 @@ static int ioapic_service(struct kvm_ioapic *ioapic, int irq, bool line_status)
>>        return ret;
>> }
>> 
>>+static int irq_status[256];
>> int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
>>                       int level, bool line_status)
>> {
>>@@ -312,10 +313,13 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
>>        u32 mask = 1 << irq;
>>        union kvm_ioapic_redirect_entry entry;
>>        int ret, irq_level;
>>+       int old_irq;
>> 

I'm not sure which version of kvm the patch is against, anyway, all the 
modification should be moved to ioapic_set_irq() against the upstream 
kvm, I test the patch w/ win2k8 guest and w/o the Haoyu's comand line 
and it can fix the bug mentioned by Haoyu, in addition, press any key 
can reproduce the bug on my side instead of the small set which Haoyu 
mentioned.

Regards,
Wanpeng Li 

>>        BUG_ON(irq < 0 || irq >= IOAPIC_NUM_PINS);
>> 
>>        spin_lock(&ioapic->lock);
>>+       old_irq = irq_status[irq];
>>+       irq_status[irq] = level;
>>        old_irr = ioapic->irr;
>>        irq_level = __kvm_irq_line_state(&ioapic->irq_states[irq],
>>                                         irq_source_id, level);
>>@@ -332,6 +336,10 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int irq_source_id,
>>                        goto out;
>>                }
>>                ioapic->irr |= mask;
>>+               if (edge && old_irq == irq_status[irq] && old_irq) {
>>+                       ret = 0;
>>+                       goto out;
>>+               }
>>                if ((edge && old_irr != ioapic->irr) ||
>>                    (!edge && !entry.fields.remote_irr))
>>                        ret = ioapic_service(ioapic, irq, line_status);
>>
>>Best regards,
>>Yang
>
>--
>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

  parent reply	other threads:[~2014-11-28  8:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20  2:20 [question] lots of interrupts injected to vm when pressing some key w/o releasing Zhang Haoyu
2014-11-20  6:19 ` Paolo Bonzini
2014-11-20  6:59   ` [question] lots of interrupts injected to vm when pressing somekey " Zhang Haoyu
2014-11-20  7:06     ` Gleb Natapov
2014-11-24  8:58       ` [question] lots of interrupts injected to vm when pressingsomekey " Zhang Haoyu
     [not found] ` <A9667DDFB95DB7438FA9D7D576C3D87E0ABEF25B@SHSMSX104.ccr.corp.intel.com>
2014-11-21 22:31   ` [question] lots of interrupts injected to vm when pressing some key " Paolo Bonzini
     [not found]     ` <A9667DDFB95DB7438FA9D7D576C3D87E0ABF0FE3@SHSMSX104.ccr.corp.intel.com>
2014-11-25  9:49       ` Paolo Bonzini
     [not found]         ` <A9667DDFB95DB7438FA9D7D576C3D87E0ABF396A@SHSMSX104.ccr.corp.intel.com>
2014-12-03 15:42           ` Paolo Bonzini
2014-12-15  9:39             ` Zhang Haoyu
2014-12-15  9:40               ` Paolo Bonzini
2014-11-24 12:17 ` Zhang Haoyu
2014-11-24 12:25   ` Paolo Bonzini
2014-11-25  1:54     ` [question] lots of interrupts injected to vm when pressing somekey " Zhang Haoyu
2014-11-25  7:02       ` Paolo Bonzini
2014-11-25 11:20         ` Zhang Haoyu
2014-11-25 13:52           ` Paolo Bonzini
     [not found]             ` <201411261511537876936@sangfor.com>
     [not found]               ` <A9667DDFB95DB7438FA9D7D576C3D87E0ABF2A95@SHSMSX104.ccr.corp.intel.com>
2014-11-27  7:20                 ` [question] lots of interrupts injected to vm when pressing some key " Zhang Haoyu
     [not found]                   ` <A9667DDFB95DB7438FA9D7D576C3D87E0ABF2C24@SHSMSX104.ccr.corp.intel.com>
2014-11-27  8:54                     ` Zhang Haoyu
2014-11-28  8:27                   ` Wanpeng Li [this message]
2014-11-28  9:44                     ` Zhang Haoyu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141128082706.GA4090@kernel \
    --to=wanpeng.li@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=gleb@cloudius-systems.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=yang.z.zhang@intel.com \
    --cc=zhanghy@sangfor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).