From: "Jan Beulich" Subject: Re: [PATCH v4 5/8] ioreq-server: add support for multiple servers Date: Wed, 09 Apr 2014 14:46:41 +0100 Message-ID: <53456B610200007800007373@nat28.tlf.novell.com> References: <1396451496-5716-1-git-send-email-paul.durrant@citrix.com> <1396451496-5716-6-git-send-email-paul.durrant@citrix.com> <53455C7502000078000071FF@nat28.tlf.novell.com> <9AAE0902D5BC7E449B7C8E4E778ABCD02D3D2A@AMSPEX01CL01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <9AAE0902D5BC7E449B7C8E4E778ABCD02D3D2A@AMSPEX01CL01.citrite.net> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Paul Durrant Cc: Ian Jackson , Stefano Stabellini , Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 09.04.14 at 15:32, wrote: >> From: Jan Beulich [mailto:JBeulich@suse.com] >> >>> On 02.04.14 at 17:11, wrote: >> Also, I didn't see a limit being enforced on the number of elements >> that can be added to these lists, yet allowing this to be unlimited is >> a latent security issue. >> > > Guest domains cannot add to the lists, only the emulating domain, but if > that is unprivileged then, yes, that is a security issue. And hence it needs to be fixed, or the operation added to the list of disaggregation-unsafe ones (which XSA-77 added). I'd clearly favor the former... >> > struct hvm_domain { >> > + /* Guest page range used for non-default ioreq servers */ >> > + unsigned long ioreq_gmfn_base; >> > + unsigned int ioreq_gmfn_count; >> > + unsigned long ioreq_gmfn_mask; >> > + >> > + /* Lock protects all other values in the following block */ >> > spinlock_t ioreq_server_lock; >> > - struct hvm_ioreq_server *ioreq_server; >> > + ioservid_t ioreq_server_id; >> > + struct list_head ioreq_server_list; >> > + unsigned int ioreq_server_count; >> > + struct hvm_ioreq_server *default_ioreq_server; >> > + >> > + /* Cached CF8 for guest PCI config cycles */ >> > + uint32_t pci_cf8; >> > + spinlock_t pci_lock; >> >> Please consider padding when adding new fields here - try grouping >> 64-bit quantities together rather than alternating between 32- and >> 64-bit ones. > > Why do we need to care about padding? Re-ordering for efficiency of space is > reasonable. That's what I meant - try to avoid unnecessary padding. >> > --- a/xen/include/asm-x86/hvm/hvm.h >> > +++ b/xen/include/asm-x86/hvm/hvm.h >> > @@ -228,7 +228,8 @@ int prepare_ring_for_helper(struct domain *d, >> unsigned long gmfn, >> > struct page_info **_page, void **_va); >> > void destroy_ring_for_helper(void **_va, struct page_info *page); >> > >> > -bool_t hvm_send_assist_req(struct vcpu *v, const ioreq_t *p); >> > +bool_t hvm_send_assist_req(struct vcpu *v, ioreq_t *p); >> >> Any reason you couldn't avoid adding the const in one of the earlier >> patches? >> > > You asked for it in a previous review. I'm happy to lose the const again. If it doesn't persist through the series, there's little point in adding it. >> And for this to be usable with other architectures that may have >> address spaces other than memory and I/O ports it would seem >> desirable to not consider this a boolean, but an enumerator. > > Maybe it would be better to consolidate io ranges and pci devs then and the > existing ioreq type values in the interface. I.e: > > #define IOREQ_TYPE_PIO 0 /* pio */ > #define IOREQ_TYPE_COPY 1 /* mmio ops */ Right, except that "COPY" is sort of odd here - why not "MMIO"? Jan