From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] Remove a set operation for VCPU_KICK_SOFTIRQ when post interrupt to vm. Date: Fri, 18 Sep 2015 12:44:47 +0100 Message-ID: <55FBF92F.2090505@citrix.com> References: <1441637175-18070-1-git-send-email-john.liuqiming@huawei.com> <55ED9E00.2010105@huawei.com> <55EDBF4002000078000A07B1@prv-mh.provo.novell.com> <55EE5EF6.50406@huawei.com> <55FBAF8D02000078000D8FB4@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zcu63-0003Uu-LR for xen-devel@lists.xenproject.org; Fri, 18 Sep 2015 11:44:55 +0000 In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Zhang, Yang Z" , Jan Beulich , "hanweidong@huawei.com" , "john.liuqiming@huawei.com" Cc: "xen-devel@lists.xenproject.org" , "dario.faggioli@citrix.com" , "zw.zhang@huawei.com" List-Id: xen-devel@lists.xenproject.org On 18/09/15 12:40, Zhang, Yang Z wrote: > Jan Beulich wrote on 2015-09-18: >>>>> "Zhang, Yang Z" 09/18/15 2:29 AM >>> >>> Zhang, Yang Z wrote on 2015-09-08: >>> I have a quick check on current code. I am curious that is current Xen >>> preemptive? >>> >>> Also, when return from an interrupt handler, hypervisor didn't check >>> whether reschedule is needed if the interrupt is occurred in kernel context. >>> ENTRY(ret_from_intr) >>> GET_CURRENT(%rbx) >>> testb $3,UREGS_cs(%rsp) >>> jz restore_all_xen //call iret directly to restore >> previous context where interrupt occur if it is in kernel space. >> >>> If Xen isn't preemptive, the above case I mentioned should never happen since >>> the VCPU still run in the same PCPU. Am I right? >> I have to admit that I don't see the connection to preemptiveness: The >> reference above is to a code section with interrupts disabled. > Ok. Maybe I am asking a wrong question. My initial question is how Xen to support the preemption. For example, if VCPU is running in hypervisor (executing any code), can this VCPU be preempted immediately? If yes, how to achieve it because I didn't find any related code. I know if the PCPU get an SCHED_SOFTIRQ, the VCPU will do the schedule before do vmentry. But it only happens before do vmentry. Is it possible that VCPU been preempted at any time when running in hypervisor mode? All vcpus may be preempted at any time by the Xen scheduler. However, paths through the hypervisor are synchronous, so a vcpu will notice that it has been preempted on the return-to-guest path, and a context switch will occur as appropriate. ~Andrew