From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Tiejun" Subject: Re: [v10][PATCH 11/16] tools/libxl: detect and avoid conflicts with RDM Date: Mon, 20 Jul 2015 23:08:47 +0800 Message-ID: <55AD0EFF.8020405@intel.com> References: <1437373023-14884-1-git-send-email-tiejun.chen@intel.com> <1437373023-14884-12-git-send-email-tiejun.chen@intel.com> <21932.63595.566823.211293@mariner.uk.xensource.com> <55AD0842.1010906@intel.com> <21933.2931.10827.7353@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21933.2931.10827.7353@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Stefano Stabellini , Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>>> +int libxl__domain_device_construct_rdm(libxl__gc *gc, >>>> + libxl_domain_config *d_config, >>>> + uint64_t rdm_mem_boundary, >>>> + struct xc_hvm_build_args *args) >>>> +{ >>> ... >>>> + /* Query all RDM entries in this platform */ >>>> + if (strategy == LIBXL_RDM_RESERVE_STRATEGY_HOST) { >>> ... >>>> + } else { >>>> + d_config->num_rdms = 0; >>>> + } >>> >>> Does this not override the domain configuration's num_rdms ? I don't >> >> We don't have the specific "num_rdms" parameter in .cfg so I don't >> understand what you mean here. > > The domain configuration specified to libxl might contain some rdms. > Then num_rdms in the incoming config would be nonzero. We never set d_config->num_rdms/d_config->rdms before we goes inside libxl__domain_device_construct_rdm(). And actually libxl__domain_device_construct_rdm is only one place to set d_config->num_rdms/d_config->rdms. I guess this line make you or other guys confused so lets delete this line directly. And if you still worry about something, I can add assert() at the beginning of this function like this, assert(!d_config->num_rdms && !d_config->rdms). Thanks Tiejun > > So I think there are two problems here: > > 1. If that were the case you would leak the application's rdms array. > > 2. Anyway, if the caller specifies such an array you should use it. > (Fixing this would avoid (1) in any case.) > > Ian. >