From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCHv4 2/3] grant_table: convert grant table rwlock to percpu rwlock Date: Fri, 18 Dec 2015 04:41:03 -0700 Message-ID: <5673FEDF02000078000C125D@prv-mh.provo.novell.com> References: <1450433179-17827-1-git-send-email-malcolm.crossley@citrix.com> <1450433179-17827-3-git-send-email-malcolm.crossley@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9tPG-0001yC-Jy for xen-devel@lists.xenproject.org; Fri, 18 Dec 2015 11:41:06 +0000 In-Reply-To: <1450433179-17827-3-git-send-email-malcolm.crossley@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: malcolm.crossley@citrix.com Cc: keir@xen.org, ian.campbell@citrix.com, george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, Marcos.Matsunaga@oracle.com, stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 18.12.15 at 11:06, wrote: > --- a/xen/include/xen/grant_table.h > +++ b/xen/include/xen/grant_table.h > @@ -51,13 +51,35 @@ > /* The maximum size of a grant table. */ > extern unsigned int max_grant_frames; > > +DECLARE_PERCPU_RWLOCK_GLOBAL(grant_rwlock); > + > +static inline void grant_percpu_read_lock(percpu_rwlock_t *lock) > +{ > + percpu_read_lock(grant_rwlock, lock); > +} > + > +static inline void grant_percpu_read_unlock(percpu_rwlock_t *lock) > +{ > + percpu_read_unlock(grant_rwlock, lock); > +} > + > +static inline void grant_percpu_write_lock(percpu_rwlock_t *lock) > +{ > + percpu_write_lock(grant_rwlock, lock); > +} > + > +static inline void grant_percpu_write_unlock(percpu_rwlock_t *lock) > +{ > + percpu_write_unlock(grant_rwlock, lock); > +} These should all be taking struct grant_table * arguments, so they can't be accidentally used on some other per-CPU r/w lock. I also question the need for the "percpu" in their names. Jan