From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 4/8] x86: dynamically attach/detach CQM service for a guest Date: Mon, 25 Nov 2013 16:05:45 +0000 Message-ID: <52937559.7070202@citrix.com> References: <1385018444-104477-1-git-send-email-dongxiao.xu@intel.com> <1385018444-104477-5-git-send-email-dongxiao.xu@intel.com> <528E0194.8000904@citrix.com> <40776A41FC278F40B59438AD47D147A9118BB311@SHSMSX104.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <40776A41FC278F40B59438AD47D147A9118BB311@SHSMSX104.ccr.corp.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: "Xu, Dongxiao" Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 25/11/13 03:26, Xu, Dongxiao wrote: >> -----Original Message----- >> From: Andrew Cooper [mailto:andrew.cooper3@citrix.com] >> Sent: Thursday, November 21, 2013 8:50 PM >> To: Xu, Dongxiao >> Cc: xen-devel@lists.xen.org >> Subject: Re: [Xen-devel] [PATCH v2 4/8] x86: dynamically attach/detach CQM >> service for a guest >> >> On 21/11/13 07:20, dongxiao.xu@intel.com wrote: >>> From: Dongxiao Xu >>> >>> Add hypervisor side support for dynamically attach and detach CQM >>> services for a certain guest. >>> >>> Signed-off-by: Jiongxi Li >>> Signed-off-by: Dongxiao Xu >>> --- >>> xen/arch/x86/domctl.c | 40 >> ++++++++++++++++++++++++++++++++++++++++ >>> xen/include/public/domctl.h | 14 ++++++++++++++ >>> 2 files changed, 54 insertions(+) >>> >>> diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c >>> index f7e4586..5ef21f9 100644 >>> --- a/xen/arch/x86/domctl.c >>> +++ b/xen/arch/x86/domctl.c >>> @@ -35,6 +35,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> >>> static int gdbsx_guest_mem_io( >>> domid_t domid, struct xen_domctl_gdbsx_memio *iop) >>> @@ -1223,6 +1224,45 @@ long arch_do_domctl( >>> } >>> break; >>> >>> + case XEN_DOMCTL_attach_pqos: >>> + { >>> + if ( domctl->u.qos_res.flags & XEN_DOMCTL_ADF_pqos_cqm ) >>> + { >>> + if ( !system_supports_cqm() ) >>> + ret = -ENODEV; >>> + else if ( d->arch.pqos_cqm_rmid > 0 ) >>> + ret = -EINVAL; >> EEXISTS perhaps? > EEXIST stands for "File exists" while EINVAL stands for "Invalid argument ". > Here I used EINVAL because if the domain is already CQM enabled, then the "domid" parameter in "xl pqos-attach cqm domid" should be an invalid argument. > Do you think it is OK? I am looking for some way to distinguish "you passed an invalid flag" (which is appropriately EINVAL), from "you are trying to attach to a guest which already has qpos attached". Personally, I would think that EEXISTS is fine from a hypercall, as Xen will never have files to report about. On the other hand, there appear to be 0 current uses of it in Xen. ~Andrew