mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Zhang Haoyu" <zhanghy@sangfor.com>
To: "Wanpeng Li" <wanpeng.li@linux.intel.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" <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 17:44:51 +0800	[thread overview]
Message-ID: <201411281744512071221@sangfor.com> (raw)
In-Reply-To: <20141128082706.GA4090@kernel>

>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.
>
Yang's patch indeed can fix the problem.
Our rtc optimization together with Yang' patch causes the stuck happened at boot stage.

Thanks,
Zhang Haoyu

>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


      reply	other threads:[~2014-11-28  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201411201020560455720@sangfor.com>
     [not found] ` <201411242017440822890@sangfor.com>
     [not found]   ` <547323A7.8050104@redhat.com>
     [not found]     ` <201411250953587250205@sangfor.com>
     [not found]       ` <54742995.7010209@redhat.com>
     [not found]         ` <201411251920494491538@sangfor.com>
     [not found]           ` <547489AA.3080509@redhat.com>
     [not found]             ` <201411261511537876936@sangfor.com>
     [not found]               ` <A9667DDFB95DB7438FA9D7D576C3D87E0ABF2A95@SHSMSX104.ccr.corp.intel.com>
     [not found]                 ` <201411271520408455055@sangfor.com>
2014-11-28  8:27                   ` Wanpeng Li
2014-11-28  9:44                     ` Zhang Haoyu [this message]

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=201411281744512071221@sangfor.com \
    --to=zhanghy@sangfor.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=wanpeng.li@linux.intel.com \
    --cc=yang.z.zhang@intel.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

all inboxes | Powered by JetHome®