Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp859966imm; Tue, 15 May 2018 10:11:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrKJKMUdAkHb+Y53lS8HbOOXt5g62LU9i93PoSyqzjNOdTvHfJ9JIys8BnxXy5DM9sS1wps X-Received: by 2002:a63:a41a:: with SMTP id c26-v6mr13097789pgf.311.1526404264261; Tue, 15 May 2018 10:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526404264; cv=none; d=google.com; s=arc-20160816; b=yEpDArt1Fws0ao0SzSHcxDvHkV/ZlR+0ncGPNMACZRcCEyryeHOnLhM7aUQRSYNHJy Q5kcA6eSF71EQtuC7eWTybT+NqrBvZfsU0lyMSuJHf50mKjXOzAiqls/o4ltX1TeVMhq AC3crkAlpcJvNV5jJ5VIfKFNHnwTQsura0RJJxTQJ3VhLq2+g778EF88JU2hDf37LURZ CVk6n10fErcEs/nG8yY3g7nSJ/wPSL0C0dozZSDHuXz+W7n0DC5vRipAi4dR4G/sTuCe 9eYBcFFGJgAiBl7m/dC7D+XadWMoPj3IUlxr2LzcJOlK4yRBmg77wB1+lWI9M86pJ0Vr ixwg== 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:dkim-signature:arc-authentication-results; bh=WcmUG77+/RrRdseNNiG7oi17cJLNGT6KiJbp8zMNkZ8=; b=qE37cT0Ne6DqGsw8bRfKiKMuC3GiweIBSOV1GSrMW2I62wmG20qCt717JtLVPZannY +MlnhYhB3p68jT9Vu1jh9XLgHwwf8keAbEXSgkivR8zG9qxqtQLwrmPlZIJix3X5RvEd g1MRSKiwJUQD1sPNnLteh/Ej+9DSidovU2e+HZ83QXF0Xh57E2pPszyi4y0uHKPU6FEZ 4OBj5Wt1w+qckhBnkH8he2tPIJA5apwPVcGj/RDeUmE8ERG95Jt8HcA4c2qsJnJt3owR VXi5JM4THkGg9gFcKG/2WHF9rqJZBkdi18t56Ec6xtijK50HMxngwHO/TN14r1I9qStl mgqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uA1gqdGk; 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 q2-v6si356356pgr.149.2018.05.15.10.10.40; Tue, 15 May 2018 10:11:04 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uA1gqdGk; 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 S932111AbeEORKa (ORCPT + 99 others); Tue, 15 May 2018 13:10:30 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44808 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751578AbeEORK3 (ORCPT ); Tue, 15 May 2018 13:10:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WcmUG77+/RrRdseNNiG7oi17cJLNGT6KiJbp8zMNkZ8=; b=uA1gqdGkiq4k5wQUbmiAyPPMW 0ysl5ikBUYYg0VCZHVOmINEO03BchZ7JZnj68o+JNb8PSlgjpx/W930hzAtBgrKM6hACOlhk9skJK qKMxFzayB1PlmQZSado0QOA0gQTMicmt5Bn5Q7T4zTbl1IvNY8e7oBduyTlVRZPOBNO70ZrxvV7Zi t5BDbx0Gajy/emnYTS5GPC5nAiFEyw9bfNK3PCRlvOoA6XEk3K9wNCqSmXCAMSY12OPpg0A7aGEpF OsJTHhyitfoumuZLsUV0WhlWV+7ZSrqgfeKihKYk97qJpdVgwDGZwWdfcJtcfuNfnBvxc5HX08Ze5 dBvm0Y26w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIdSx-0000W9-BO; Tue, 15 May 2018 17:10:23 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6E0E32029F870; Tue, 15 May 2018 19:10:21 +0200 (CEST) Date: Tue, 15 May 2018 19:10:21 +0200 From: Peter Zijlstra To: Mark Rutland 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: <20180515171021.GI12217@hirez.programming.kicks-ass.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180515154333.bszh4nuowhocozuc@lakrids.cambridge.arm.com> User-Agent: Mutt/1.9.5 (2018-04-13) 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 04:43:33PM +0100, Mark Rutland wrote: > I put together the following while trying to avoid bash magic (i.e the > arrays, and keeping the option of naming the params. My local copy of > dash seems happy with it. Very nice; clearly your sh foo is stronger than mine ;-) > 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 > # * 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 :-) > # 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].