From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Kuznetsov Subject: Re: [PATCH v6 07/10] libxc: introduce soft reset for HVM domains Date: Wed, 20 May 2015 17:20:19 +0200 Message-ID: <87pp5v46oc.fsf@vitty.brq.redhat.com> References: <1431510585-12544-1-git-send-email-vkuznets@redhat.com> <1431510585-12544-8-git-send-email-vkuznets@redhat.com> <555CA3CC.2080003@citrix.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 1Yv5nI-0003hc-Co for xen-devel@lists.xenproject.org; Wed, 20 May 2015 15:20:28 +0000 In-Reply-To: <555CA3CC.2080003@citrix.com> (Julien Grall's message of "Wed, 20 May 2015 16:10:04 +0100") List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Wei Liu , Andrew Jones , Keir Fraser , Ian Campbell , Stefano Stabellini , Andrew Cooper , Julien Grall , Ian Jackson , Olaf Hering , Tim Deegan , David Vrabel , Jan Beulich , xen-devel@lists.xenproject.org, Daniel De Graaf List-Id: xen-devel@lists.xenproject.org Julien Grall writes: > Hi Vitaly, > > On 13/05/15 10:49, Vitaly Kuznetsov wrote: >> +int xc_domain_soft_reset(xc_interface *xch, uint32_t source_dom, >> + uint32_t dest_dom, domid_t console_domid, >> + unsigned long *console_mfn, domid_t store_domid, >> + unsigned long *store_mfn) >> +{ >> + xc_dominfo_t old_info, new_info; >> + int rc = 1; >> + >> + uint32_t hvm_buf_size = 0; >> + uint64_t nr_trans; >> + uint8_t *hvm_buf = NULL; >> + unsigned long console_pfn, store_pfn, io_pfn, buffio_pfn; >> + uint64_t hvm_params[HVM_NR_PARAMS]; >> + xen_pfn_t sharedinfo_pfn; >> + >> + DPRINTF("%s: soft reset domid %u -> %u", __func__, source_dom, dest_dom); >> + >> + if ( xc_domain_getinfo(xch, source_dom, 1, &old_info) != 1 ) >> + { >> + PERROR("Could not get old domain info"); >> + return 1; >> + } >> + >> + if ( xc_domain_getinfo(xch, dest_dom, 1, &new_info) != 1 ) >> + { >> + PERROR("Could not get new domain info"); >> + return 1; >> + } > > xc_domain_getinfo returns the first domain ID used from dest_dom. If > dest_dom doesn't exist it may return another domain. > > Therefore you have to check that the info correspond to the correct domain. Oh, thanks, I fixed xc_get_tot_pages() a while ago: commit 5dcd0dcb85941bd92336e01ae3f8c44730099c96 Author: Vitaly Kuznetsov Date: Tue Dec 2 16:18:08 2014 +0100 libxc: check in xc_get_tot_pages() that the proper domain is reported but I already managed to forget that xc_domain_getinfo() needs additional check. Its interface is a bit misleading :-( > > Regards, -- Vitaly