Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp908979imm; Tue, 15 May 2018 10:54:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpOrt/bAdz8I/wCfyrXWt1v0Y9WJ+4QGP1X+JtHNRH+n02w1n9hw07JGa3zmZkg8w9xJv7Z X-Received: by 2002:a63:7344:: with SMTP id d4-v6mr12783712pgn.273.1526406881464; Tue, 15 May 2018 10:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526406881; cv=none; d=google.com; s=arc-20160816; b=w832YWp+4yOYjrDCuFIpq77MzfQ3hhzhhh7nAMp8fMAO81Rgng+B6sHksd/UWl0nes TgkJiLhDGL74BzTNTja3UWjSkawQwdC/kOMdo9CvJGsNjeWLngN4tLsFWDhfTHgAdNGa sSGST/d5CQxW9P78Aet8tAwb5itjmEvcoqOA0GU9ZxeqQvPoEJO0HQz+9fjJpqTUnM+p FJtDCpq1rjHaNe5K66QLaMgmA46syAWDZJxxzQKwI/Dw9NGku5Sp/1y9iprSl289uS9N 6kn5XxY4giNkDwZ18l5Wmsa5v1gs5rGRD9ozkI2+DRV46Ul3fQB4PHm3b5PHBFpY6M5T 8gug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=yP36+y3e+bsF6hTGBGJPkNpebUQT6MLjabIMeXH4Ywc=; b=W7ER+5pKWjN6iD4JTb7Mj0QZbIoMvQAA6lku+eUF7ZTUKB+QMKSq/iW0JQod8cZNEW TiFzVyQEd50q/4syPWj8qJOcyvy9ouLy/NyOBEvQ5ypX9K3V63s3cuPO3i59YO0/Uk/U NDwkdb9w9BCrsb2jUyH0SaLKoRKRcgLzcZ0zxwonsRdfAnUeUAWA3279qS6su6et3XHo XYnTFcGUt5Dazb1lx+0AtmJZQP105qGzXIusAnQVU801LrHNso/TiGx9uuJzoJdA30mn aA2V6cRVDRUP/zI2unqokzJjONZQxBTwNDrsDlzqJAQGvHNtXWUXKZG5CoAHV6gkALye rvTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si555806pfb.204.2018.05.15.10.54.27; Tue, 15 May 2018 10:54:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753402AbeEORx2 (ORCPT + 99 others); Tue, 15 May 2018 13:53:28 -0400 Received: from foss.arm.com ([217.140.101.70]:36598 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752495AbeEORx1 (ORCPT ); Tue, 15 May 2018 13:53:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2CED61435; Tue, 15 May 2018 10:53:27 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 62DC63F25D; Tue, 15 May 2018 10:53:25 -0700 (PDT) Date: Tue, 15 May 2018 18:53:08 +0100 From: Mark Rutland To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, will.deacon@arm.com, torvalds@linux-foundation.org, paulmck@linux.vnet.ibm.com, tglx@linutronix.de, hpa@zytor.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:locking/core] locking/atomics: Simplify the op definitions in atomic.h some more Message-ID: <20180515175307.m4xbkbicdrzo4qhb@lakrids.cambridge.arm.com> References: <20180505083635.622xmcvb42dw5xxh@gmail.com> <20180509073327.GE12217@hirez.programming.kicks-ass.net> <20180515083556.GA30420@gmail.com> <20180515114144.GX12217@hirez.programming.kicks-ass.net> <20180515154333.bszh4nuowhocozuc@lakrids.cambridge.arm.com> <20180515171021.GI12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180515171021.GI12217@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 15, 2018 at 07:10:21PM +0200, Peter Zijlstra wrote: > On Tue, May 15, 2018 at 04:43:33PM +0100, Mark Rutland wrote: > > I *think* the table can encode enough info to generate atomic-long.h, > > atomic-instrumented.h, and the atomic.h ordering fallbacks. I'll need to > > flesh out the table and check that we don't end up clashing with > > some of the regular fallbacks. > > Yes, details details ;-) > > > # name meta args... > > # > > # Where meta contains a string of: > > # * B - bool: returns bool, fully ordered > > # * V - void: returns void, fully ordered > > void retuns are relaxed How about: V - void: returns void, no ordering variants (implicitly relaxed) > > # * I - int: returns base type, all orderings > > # * R - return: returns base type, all orderings > > # * F - fetch: returns base type, all orderings > > # * T - try: returns bool, all orderings > > Little more verbose than mine, I think we can get there with X and XB > instead of I and T, but whatever :-) Mhmm. I found it easier to do switch-like things this way, but it works regardless. > > # Where args contains list of type[:name], where type is: > > # * v - pointer to atomic base type (atomic or atomic64) > > # * i - base type (int or long) > > # * I - pointer to base type (int or long) > > # > > add VRF i v > > sub VRF i v > > inc VRF v > > dec VRF v > > or VF i v > > and VF i v > > andnot VF i v > > xor VF i v > > xchg I v i > > cmpxchg I v i:old i:new > > try_cmpxchg T v I:old i:new > > add_and_test B i v > > sub_and_test B i v > > dec_and_test B v > > inc_and_test B v > > Cute, that [:name]. :D Thanks, Mark.