|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6 07/10] libxc: introduce soft reset for HVM domains
On 20/05/15 16:20, Vitaly Kuznetsov wrote:
> Julien Grall <julien.grall@xxxxxxxxxx> 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 <vkuznets@xxxxxxxxxx>
> 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 :-(
Agreed. There is multiple place in libxc and other xen related software
where this function is misused.
It would be worth to introduce a new xc function to return an error if
it's not possible to return the info of the specified domid.
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |