From: "Jan Beulich" Subject: Re: [PATCH 2/5] xen/vm_access: Support for memory-content hiding Date: Mon, 08 Jun 2015 11:20:19 +0100 Message-ID: <557588830200007800081F4C@mail.emea.novell.com> References: <1430932352-4289-1-git-send-email-rcojocaru@bitdefender.com> <1430932352-4289-3-git-send-email-rcojocaru@bitdefender.com> <554CFB760200007800078703@mail.emea.novell.com> <5575683E.4030807@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5575683E.4030807@bitdefender.com> 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: Razvan Cojocaru Cc: tim@xen.org, kevin.tian@intel.com, wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, jun.nakajima@intel.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, eddie.dong@intel.com, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com, keir@xen.org, boris.ostrovsky@oracle.com List-Id: xen-devel@lists.xenproject.org >>> On 08.06.15 at 12:02, wrote: > On 05/08/2015 07:07 PM, Jan Beulich wrote: >>> > --- a/xen/include/asm-x86/domain.h >>> > +++ b/xen/include/asm-x86/domain.h >>> > @@ -512,6 +513,7 @@ struct arch_vcpu >>> > uint32_t emulate_flags; >>> > unsigned long gpa; >>> > unsigned long eip; >>> > + struct vm_event_emul_read_data emul_read_data; >> Considering the size of this structure I don't think this should be >> there for all vCPU-s of all guests. IOW - please allocate this >> dynamically only on domains where it's needed. > > Looking at the code, it's not immediately clear how to differentiate > between a domain where this is needed and one where it is not. At domain > init time we don't know, because it might become needed as soon as a > vm_event client becomes attached to the domain. Then again, even once a > vm_event client attaches to the domain, it might still not be necessary > to allocate that structure, as the client might never reply with > MEM_ACCESS_SET_EMUL_READ_DATA. > > The only place where we know for sure that it's needed is in > p2m_mem_access_check(), when receiving a vm_event response with > MEM_ACCESS_SET_EMUL_READ_DATA (lazy allocation). Would this be alright? I can't really judge about that; the farther you can safely defer it, the better. For the sake of addressing my complaint it would probably suffice to defer it until a vm_event client attaches to the guest. Jan