From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: mixture of atomic and non-atomic operations on CPU masks Date: Wed, 10 Sep 2014 11:10:18 +0100 Message-ID: <5410238A.6000200@citrix.com> References: <54100FCC0200007800033118@mail.emea.novell.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 1XRer4-0002kr-Jr for xen-devel@lists.xenproject.org; Wed, 10 Sep 2014 10:10:26 +0000 In-Reply-To: <54100FCC0200007800033118@mail.emea.novell.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: Jan Beulich , xen-devel Cc: Ian Campbell , Ian Jackson , Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org On 10/09/14 07:46, Jan Beulich wrote: > All, > > the inconsistency here has been puzzling me for a while, and I think > we ought to do something about it (perhaps not for 4.5 anymore, > but then right after): cpumask_(test_and_)?(set|clear)_cpu all use > the respective atomic bitops, in contrast to all other operations on > cpumask_t. A good part of the users don't require the atomicity at > all (in particular any of those acting on function scope variables). > Does anyone know of reasons why the default shouldn't be non- > atomic ops across the board, with atomic special cases being made > available for the few cases where they're actually needed? Its entirely possible that the first users of test_and_? required atomicity, and the first users which didn't require atomicity copied the atomic ops as they already existed. Defaulting to non-atomic seems reasonable, as I suspect that there are fairly few cases where atomicity is required. (At least atomic operations on the local stack is not especially bad to other cpus; I really hope other cpus don't have writable cache lines of our stack.) ~Andrew