From: Nadav Har'El Subject: Re: [PATCH] KVM: nVMX: Improve I/O exit handling Date: Mon, 11 Feb 2013 12:07:21 +0200 Message-ID: <20130211100721.GA11107@fermat.math.technion.ac.il> References: <51180635.3060003@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Gleb Natapov , Marcelo Tosatti , kvm , Orit Wasserman To: Jan Kiszka Return-path: Received: from mailgw13.technion.ac.il ([132.68.225.13]:23360 "EHLO mailgw13.technion.ac.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755017Ab3BKKV3 (ORCPT ); Mon, 11 Feb 2013 05:21:29 -0500 Content-Disposition: inline In-Reply-To: <51180635.3060003@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Feb 10, 2013, Jan Kiszka wrote about "[PATCH] KVM: nVMX: Improve I/O exit handling": > +static bool nested_vmx_exit_handled_io(struct kvm_vcpu *vcpu, > + struct vmcs12 *vmcs12) > +{ > + unsigned long exit_qualification; > + gpa_t bitmap, last_bitmap; > + bool string, rep; > + u16 port; > + int size; > + u8 b; > + > + if (nested_cpu_has(get_vmcs12(vcpu), CPU_BASED_UNCOND_IO_EXITING)) > + return 1; Instead of calling get_vmcs12(vcpu), you can just use "vmcs12" variable which you already have. I see I left the same redundant call also in nested_vmx_exit_handled_msr :( > + if (port < 0x8000) > + bitmap = vmcs12->io_bitmap_a; > + else > + bitmap = vmcs12->io_bitmap_b; > + bitmap += port / 8; In the port >= 0x8000, I believe need to subtract 0x8000 from the port number before using it as an offset into io_bitmap_b? Nadav. -- Nadav Har'El | Monday, Feb 11 2013, 1 Adar 5773 nyh@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |Attention: There will be a rain dance http://nadav.harel.org.il |Friday night, weather permitting.