From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v3] nested SVM: adjust guest handling of structure mappings Date: Mon, 11 Nov 2013 14:40:43 +0000 Message-ID: <5280EC6B.4080108@citrix.com> References: <5280A4640200007800101A29@nat28.tlf.novell.com> <5280C8830200007800101BCD@nat28.tlf.novell.com> <5280BE9E.1060209@citrix.com> <5280E13E0200007800101D43@nat28.tlf.novell.com> <5280D8A9.5060107@citrix.com> <5280EB290200007800101E07@nat28.tlf.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 1VfsfX-0007KM-9U for xen-devel@lists.xenproject.org; Mon, 11 Nov 2013 14:40:47 +0000 In-Reply-To: <5280EB290200007800101E07@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , Boris Ostrovsky , Christoph Egger , suravee.suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org On 11/11/13 13:35, Jan Beulich wrote: >>>> On 11.11.13 at 14:16, Andrew Cooper wrote: >> On 11/11/13 12:53, Jan Beulich wrote: >>> + for ( io_bitmap = hvm_map_guest_frame_ro(gfn, 0); ; ) >>> + { >>> + enabled = io_bitmap && test_bit(port, io_bitmap); >>> + if ( !enabled || !--size ) >>> + break; >>> + if ( unlikely(++port == 8 * PAGE_SIZE) ) >>> + { >>> + hvm_unmap_guest_frame(io_bitmap, 0); >>> + io_bitmap = hvm_map_guest_frame_ro(++gfn, 0); >>> + port -= 8 * PAGE_SIZE; >>> + } >>> } >> Ok - this safe now, but I don't understand the reasoning for introducing >> this loop? >> >> The ioio exit value gives us a single port, and the size of access on >> that specific port. >> >> The switch statement tells us exactly which gfn the relevant bit refers >> to, surely a single hvm_map_guest_frame_ro() is sufficient? > When the operation spans multiple ports (INW, INL, etc), multiple > bits need to be looked at. And when the access is misaligned and > crosses a 32k (port number) boundary, more than one page needs > looking at. > > Jan > Ah of course. Reviewed-by: Andrew Cooper