From: "Liuqiming (John)" <john.liuqiming@huawei.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>,
"Hanweidong (Randy)" <hanweidong@huawei.com>,
Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Zhangwei (FF)" <zw.zhang@huawei.com>
Subject: Re: [PATCH] Remove a set operation for VCPU_KICK_SOFTIRQ when post interrupt to vm.
Date: Tue, 8 Sep 2015 12:07:18 +0800 [thread overview]
Message-ID: <55EE5EF6.50406@huawei.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E0AD999C1@SHSMSX104.ccr.corp.intel.com>
Ok, I will try to explain, correct me if I got anything wrong:
The problem here is not interrupts lost but interrupts not delivered in
time.
there are basically two path to inject an interrupt into VM (or vCPU to
another vCPU):
Path 1, the traditional way:
1) set bit in vlapic IRR field which represent an interrupt,
then kick vcpu
2) a VCPU_KICK_SOFTIRQ softirq raised
3) if VCPU_KICK_SOFTIRQ bit not set, then set it, otherwise
return and do nothing
4) send an EVENT_CHECK_VECTOR IPI to target vcpu
5) target vcpu will VMEXIT due to EXIT_REASON_EXTERNAL_INTERRUPT
6) the interrupt handler basically do nothing
7) interrupt in IRR will be evaluated
8) VCPU_KICK_SOFTIRQ will be cleared when do_softirq
9) there will be an interrupt inject into vcpu when VMENTRY
Path 2, the Posted-interrupt way (current logic):
1) set bit in posted-interrupt descriptor which represent an
interrupt
2) if VCPU_KICK_SOFTIRQ bit not set, then set it, otherwise
return and do nothing
3) send an POSTED_INTR_NOTIFICATION_VECTOR IPI to target vcpu
4) if target vcpu in non-ROOT mode it will receive the interrupt
immediately otherwise interrupt will be injected when VMENTRY
As the first operation in both path is setting a interrupt represent
bit, so no interrupts will lost.
The issue is:
in path 2, the first interrupt will cause VCPU_KICK_SOFTIRQ set to 1,
and unless a VMEXIT occured or somewhere called do_softirq directly,
VCPU_KICK_SOFTIRQ will not cleared, that will make the later interrupts
injection ignored at step 2),
which will delay irq handler process in VM.
And because path 2 set VCPU_KICK_SOFTIRQ to 1, the kick vcpu logic in
path 1 will also return in step 3),
which make this vcpu only can handle interrupt when some other reason
cause VMEXIT.
On 2015/9/8 10:46, Zhang, Yang Z wrote:
> Hanweidong (Randy) wrote on 2015-09-08:
>> Jan Beulich wrote on ent: 2015年9月7日 22:46:
>>> Subject: Re: [Xen-devel] [PATCH] Remove a set operation for
>>> VCPU_KICK_SOFTIRQ when post interrupt to vm.
>>>
>>>>>> On 07.09.15 at 16:24, <john.liuqiming@huawei.com> wrote:
>>>> I believe this also has something to do with a windows guest boot hang
>>>> issue.
>>>>
>>>> It randomly occured, when boot a guest has windows 2008 os and pv-
>>>> driver installed. The boot process hangs when wait xenstored replay
>>>> event signal.
>>>>
>>>> It can be reproduced after hundreds reboot using the xen staging
>>>> branch. But after I changed this code the hang issue can not reproduce.
>>> The change below (which I don't think was ever posted to xen-devel)
>>> does not make any sense, as it prohibits timely delivery of guest
>>> interrupts. If there is an issue, I think you'd need to start with
>>> clearly
>> This change won't prohibit timely delivery of guest interrupts,
>> intead, it helps to deliver guest interrupt timely. Posted interrupt
>> delivery doesn't kick cpu, so it should not set VCPU_KICK_SOFTIRQ bit,
>> and doesn't care about if VCPU_KICK_SOFTIRQ is set or not. if
>> VCPU_KICK_SOFTIRQ is set, next interrupt will not be delivered due to
>> test_and_set_bit check. What's more, it also impacts vcpu_kick() to
>> kick cpu (smp_send_event_check_cpu) when VCPU_KICK_SOFTIRQ is set.
> The patch seems wrong to me since the interrupt will lost in some corner cases with those changes. Can you explain more detail like why next interrupt will get lost if set the softirq here?
>
> Best regards,
> Yang
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-09-08 4:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1441637175-18070-1-git-send-email-john.liuqiming@huawei.com>
2015-09-07 14:24 ` [PATCH] Remove a set operation for VCPU_KICK_SOFTIRQ when post interrupt to vm Liuqiming (John)
2015-09-07 14:45 ` Jan Beulich
2015-09-08 0:39 ` Hanweidong (Randy)
2015-09-08 2:46 ` Zhang, Yang Z
2015-09-08 4:07 ` Liuqiming (John) [this message]
2015-09-08 8:10 ` Zhang, Yang Z
2015-09-08 8:49 ` Jan Beulich
2015-09-18 0:29 ` Zhang, Yang Z
2015-09-18 5:30 ` Jan Beulich
2015-09-18 11:40 ` Zhang, Yang Z
2015-09-18 11:44 ` Andrew Cooper
2015-09-18 11:50 ` Zhang, Yang Z
2015-09-18 12:56 ` Dario Faggioli
2015-09-23 3:50 ` Zhang, Yang Z
2015-09-23 7:42 ` Jan Beulich
2015-09-23 9:08 ` George Dunlap
2015-09-23 9:18 ` Zhang, Yang Z
2015-09-23 10:01 ` George Dunlap
2015-09-23 9:21 ` Jan Beulich
2015-09-23 9:15 ` Zhang, Yang Z
2015-09-23 9:31 ` Jan Beulich
2015-09-23 13:02 ` Zhang, Yang Z
2015-09-23 13:38 ` Hanweidong (Randy)
2015-09-23 13:41 ` Zhang, Yang Z
2015-09-24 2:41 ` Liuqiming (John)
2015-09-24 3:25 ` Zhang, Yang Z
2015-09-24 7:07 ` Liuqiming (John)
2015-09-24 8:07 ` Zhang, Yang Z
2015-10-10 6:32 ` Zhang, Yang Z
2015-10-10 9:55 ` Liuqiming (John)
2015-11-10 1:15 ` Zhang, Yang Z
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=55EE5EF6.50406@huawei.com \
--to=john.liuqiming@huawei.com \
--cc=JBeulich@suse.com \
--cc=hanweidong@huawei.com \
--cc=xen-devel@lists.xenproject.org \
--cc=yang.z.zhang@intel.com \
--cc=zw.zhang@huawei.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).