From: Tim Deegan Subject: Re: [PATCH 08/10] VMX: disable PML in vmx_vcpu_destroy Date: Fri, 10 Apr 2015 10:30:03 +0100 Message-ID: <20150410093003.GC12937@deinos.phlegethon.org> References: <1427423754-11841-1-git-send-email-kai.huang@linux.intel.com> <1427423754-11841-9-git-send-email-kai.huang@linux.intel.com> <20150409120439.GG17031@deinos.phlegethon.org> <55277AD4.2080300@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <55277AD4.2080300@linux.intel.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: Kai Huang Cc: yang.z.zhang@intel.com, andrew.cooper3@citrix.com, kevin.tian@intel.com, jbeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org At 15:25 +0800 on 10 Apr (1428679508), Kai Huang wrote: > > > On 04/09/2015 08:04 PM, Tim Deegan wrote: > > Looking at this and other callers of these enable/disable functions, I > > think it would be better to make those functions idempotent (i.e. > > *_{en,dis}able_pml() should just return success if PML is already > > enabled/disabled). Then you don't need to check in every caller, and > > there's no risk of a crash if one caller is missing the check. > Do you mean something like below? > > bool_t vmx_vcpu_enable_pml(struct vcpu *v) > { > if ( vmx_vcpu_pml_enabled(v) ) > return success; > ...... /* code to enable */ > > return success; > error: > ... > return failure; > } > > This should be also fine. I will do this. But I think > vmx_{vcpu|domain}_disable_pml should remain return value of void. Yes, that sounds fine. Tim.