From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 2/8] x86: handle CQM resource when creating/destroying guests Date: Mon, 25 Nov 2013 16:02:07 +0000 Message-ID: <5293747F.1030701@citrix.com> References: <1385018444-104477-1-git-send-email-dongxiao.xu@intel.com> <1385018444-104477-3-git-send-email-dongxiao.xu@intel.com> <528DFDB0.8090304@citrix.com> <40776A41FC278F40B59438AD47D147A9118BB2F0@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: <40776A41FC278F40B59438AD47D147A9118BB2F0@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: Tim Deegan , Keir Fraser , Jan Beulich , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 25/11/13 03:21, Xu, Dongxiao wrote: > >>> + >>> + spin_lock_irqsave(&cqm_lock, flags); >>> + /* We do not free system reserved "RMID=0" */ >>> + if ( rmid > 0 ) >>> + { >>> + cqm_res_array[rmid].inuse = 0; >>> + cqm_res_array[rmid].domain_id = 0; >> Would DOMID_INVALID be more appropriate here? 0 is valid domain >> identifier. It would also mean that you could remove the inuse flag >> from the structure, and the structure itself degrades to an array of >> domid_t's >> >> You can then further use cmpxchg() and avoid the spinlock. >> >> I guess this all depends on whether you are expecting to add new >> information into the structure or not. > Per my understanding, DOMID_xxx is somewhat related with memory management, e.g., DOMID_INVALID is used to identify pages with unknown owner. Is it appropriate to use it in CQM feature? > > According to your proposal: > - DOMID_INVALID is for RMIDs that are not allocated yet; > - A valid domain number stands for the RMID is used for a certain domain; > - Maybe DOMID_SELF or DOMID_XEN for the system reserved RMID=0? > > Do you think it is OK if we introduce extra meanings (CQM specific) for those macros? CC'ing the relevant maintainers for their opinion. I would suggest that DOMID_INVALID should have its formal meaning expanded to any case where there can logically be a domid needing a specific invalid state. ~Andrew