From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH RFC V4 5/5] Documentation/kvm : Add documentation on Hypercalls and features used for PV spinlock Date: Tue, 17 Jan 2012 11:14:13 +0200 Message-ID: <20120117091413.GM2167@redhat.com> References: <20120114182501.8604.68416.sendpatchset@oc5400248562.ibm.com> <20120114182710.8604.22277.sendpatchset@oc5400248562.ibm.com> <4F13E739.7040300@redhat.com> <20120116094020.GA6019@linux.vnet.ibm.com> <4F13F883.5090002@redhat.com> <20120116141117.GB6019@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Jeremy Fitzhardinge , Raghavendra K T , KVM , linux-doc@vger.kernel.org, Peter Zijlstra , Jan Kiszka , Virtualization , Paul Mackerras , "H. Peter Anvin" , Stefano Stabellini , Xen , Dave Jiang , Glauber Costa , X86 , Ingo Molnar , Avi Kivity , Rik van Riel , Konrad Rzeszutek Wilk , Sasha Levin , Sedat Dilek , Thomas Gleixner , Greg Kroah-Hartman , LKML , Dave Hansen Return-path: Content-Disposition: inline In-Reply-To: <20120116141117.GB6019@linux.vnet.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Id: kvm.vger.kernel.org On Mon, Jan 16, 2012 at 07:41:17PM +0530, Srivatsa Vaddagiri wrote: > * Avi Kivity [2012-01-16 12:14:27]: > > > > One option is to make the kick hypercall available only when > > > yield_on_hlt=1? > > > > It's not a good idea to tie various options together. Features should > > be orthogonal. > > > > Can't we make it work? Just have different handling for > > KVM_REQ_PVLOCK_KICK (let 's rename it, and the hypercall, PV_UNHALT, > > since we can use it for non-locks too). > > The problem case I was thinking of was when guest VCPU would have issued > HLT with interrupts disabled. I guess one option is to inject an NMI, > and have the guest kernel NMI handler recognize this and make > adjustments such that the vcpu avoids going back to HLT instruction. > Just kick vcpu out of a guest mode and adjust rip to point after HLT on next re-entry. Don't forget to call vmx_clear_hlt(). > Having another hypercall to do yield/sleep (rather than effecting that > via HLT) seems like an alternate clean solution here .. > > - vatsa -- Gleb. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH RFC V4 5/5] Documentation/kvm : Add documentation on Hypercalls and features used for PV spinlock Date: Tue, 17 Jan 2012 11:14:13 +0200 Message-ID: <20120117091413.GM2167@redhat.com> References: <20120114182501.8604.68416.sendpatchset@oc5400248562.ibm.com> <20120114182710.8604.22277.sendpatchset@oc5400248562.ibm.com> <4F13E739.7040300@redhat.com> <20120116094020.GA6019@linux.vnet.ibm.com> <4F13F883.5090002@redhat.com> <20120116141117.GB6019@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20120116141117.GB6019@linux.vnet.ibm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Srivatsa Vaddagiri Cc: Jeremy Fitzhardinge , Raghavendra K T , KVM , linux-doc@vger.kernel.org, Peter Zijlstra , Jan Kiszka , Virtualization , Paul Mackerras , "H. Peter Anvin" , Stefano Stabellini , Xen , Dave Jiang , Glauber Costa , X86 , Ingo Molnar , Avi Kivity , Rik van Riel , Konrad Rzeszutek Wilk , Sasha Levin , Sedat Dilek , Thomas Gleixner , Greg Kroah-Hartman , LKML Dave Hansen List-Id: virtualization@lists.linuxfoundation.org On Mon, Jan 16, 2012 at 07:41:17PM +0530, Srivatsa Vaddagiri wrote: > * Avi Kivity [2012-01-16 12:14:27]: > > > > One option is to make the kick hypercall available only when > > > yield_on_hlt=1? > > > > It's not a good idea to tie various options together. Features should > > be orthogonal. > > > > Can't we make it work? Just have different handling for > > KVM_REQ_PVLOCK_KICK (let 's rename it, and the hypercall, PV_UNHALT, > > since we can use it for non-locks too). > > The problem case I was thinking of was when guest VCPU would have issued > HLT with interrupts disabled. I guess one option is to inject an NMI, > and have the guest kernel NMI handler recognize this and make > adjustments such that the vcpu avoids going back to HLT instruction. > Just kick vcpu out of a guest mode and adjust rip to point after HLT on next re-entry. Don't forget to call vmx_clear_hlt(). > Having another hypercall to do yield/sleep (rather than effecting that > via HLT) seems like an alternate clean solution here .. > > - vatsa -- Gleb.