From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [PATCH v1 3/8]: PVH startup changes (enlighten.c) Date: Tue, 2 Oct 2012 18:36:19 -0700 Message-ID: <20121002183619.70734b7a@mantra.us.oracle.com> References: <20120921121659.5a723de9@mantra.us.oracle.com> <20120924154335.097d3fb9@mantra.us.oracle.com> <20120925180416.0137d61a@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "Xen-devel@lists.xensource.com" , Ian Campbell , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On Wed, 26 Sep 2012 12:33:39 +0100 Stefano Stabellini wrote: > > Wish it was simple. But for PV and PVH, domU, it's already setup > > the shared page. All we need to do is __va(shared_info). But for > > HVM domUs and PVH dom0, we need to hcall with pfn to get it > > remapped. > > For PVH domU is already setup as a pfn only because in > tools/libxc/xc_dom_x86.c:alloc_magic_pages we have this code: > > if ( xc_dom_feature_translated(dom) ) > dom->shared_info_pfn = xc_dom_alloc_page(dom, "shared info"); > > and in tools/libxc/xc_dom_x86.c:start_info_x86_64 we have: > > xen_pfn_t shinfo = > xc_dom_feature_translated(dom) ? dom->shared_info_pfn : dom-> > shared_info_mfn; > > if we simply get rid of the two "if xc_dom_feature_translated(dom)" > wouldn't we get an mfn for PVH domU too? AFAICT all the other cases > would remain unmodified, but PVH domU would start getting an mfn for > shared_info. > > > Changing the > > tool to map pfn, would result in unnecessary hcall for all PV and > > PVH domUs. It's only two lines of code, so lets just leave it. I'll > > make the comment better. > > Yes, there would be one more unnecessary hypercall but we would get > rid of 4 "if". I think is a good trade off. Well, not really unfortunately! There are two fields in the library shared_info_mfn and shared_info_pfn in struct xc_dom_image. For xlated, pfn is set, otherwise, mfn is set. If I set mfn for auto xlated also, I end up changing/adding more code in the library where it tries to map the shared page. Moreover, it's better to stick with the library assumption that for auto xlated, pfn is set, otherwise, mfn is set. Hope that makes sense. I tried it, btw. thanks, Mukesh