Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp513752imm; Tue, 15 May 2018 05:13:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrTdowaZbOX/TtchrR5Ar/Q+8xCvF8mx1TwJ8wDFWZj8NAoVCdEz+UV0Ed8UeY9T6U5Un7m X-Received: by 2002:a62:4589:: with SMTP id n9-v6mr14879462pfi.158.1526386431641; Tue, 15 May 2018 05:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526386431; cv=none; d=google.com; s=arc-20160816; b=mT8NsBIHlPB4IciSPdXB8FhQRT/n6X+6V2Ze32/WUJJTWu+vESzagSlKd2EwfdvfkQ GASzXuPM7HSPwUrJIF5a/uS5cpygtHxGwNTYUJx2zxNXakz1bP+VoJiqgF/WEdLj7zb+ fSRyVDfomVU7rgmvOoe28uPlMMGf+t8fBPBdcIC+maggzl2yhwv6CH0DoOaNs+3hq0dy ax3wpXBTRqL60cq+jnjB0NkNBQ3aVdCQFl0KB78e4kZXPG31F+Vrhe2KqMU+bpsmzepQ pXDwLacxEIv5eKKK78/v1nLqvulfg510rZmdScspdSgQWwHooUYw2oTwVdHJUfT9hOlV bjDQ== 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=hMyeQSJBZdQL7TlvsV8OzjctjbtoAtyVb3MqdJAJKSw=; b=Y2O+5pfK69WKdzPuDVczSBGVK3ypmz23IdwPHGsgOaeyiNwjsQMTSDeuz+SO6eq5jb SSVZ3d5xCwxn0hinj9wNwucQP9y2lpF7M2t4WBZG+g9Czul/3wHSqkW94Ixf7K7nUJje X6SlcDuRHtYZ14Bnl04Y46k8x4Gj/+kXf2RslVY3UaNuqqzgK+PNgQbPunmaH4X3q8hP sYxYHq3xMVOwyi23VmSNYJ1JItneytUU5qvVA1vu7JUldPe9W2gSRyUZ4CGGQCg0EIWS v0H761V4L/N3RDVr3dGfkNEucQz5RP+AqhG8KQ/FGoT205lE7fUhf0nCM1ezufutEk1M 7PuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ccu7MIEC; 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 j5-v6si5251891pgs.281.2018.05.15.05.13.36; Tue, 15 May 2018 05:13:51 -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=ccu7MIEC; 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 S1753250AbeEOMNR (ORCPT + 99 others); Tue, 15 May 2018 08:13:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35092 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752804AbeEOMNP (ORCPT ); Tue, 15 May 2018 08:13:15 -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=hMyeQSJBZdQL7TlvsV8OzjctjbtoAtyVb3MqdJAJKSw=; b=ccu7MIECJSGYKJLpe8coTOTRw vg6HYcnghuYjhFaQH0fWq5LdapWdoKCFDWTfF8e2Dayp/C+hwd8tSShYOJ7vRF56iJ4oshm7L4zR8 DfyHWxk/BI2fY2rx/NcvkXTDFYJDZXzVBBjNuh5okQrEW37+cxI8NdNmCSfyZLgz4pbPsa8YWl5x9 HgTQzam1rr2uD5/6Mzp3x446ov9j2Z/8/gYCUX3U6ufesonz6F/Rpt2J1EbgwN1PdUNQBkaLE1HbC QC4o9asKdAz0zERwIzrAfEZjEBgOboy2atvUlUXWhZMNQyL/R/CQooePHM8QkUuYkB7Vme2tbctZy MdpOM9LOQ==; 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 1fIYpL-0007L4-0V; Tue, 15 May 2018 12:13:11 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 650EF2029F86C; Tue, 15 May 2018 14:13:09 +0200 (CEST) Date: Tue, 15 May 2018 14:13:09 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, will.deacon@arm.com, mark.rutland@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: <20180515121309.GL12235@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180515114144.GX12217@hirez.programming.kicks-ass.net> 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 01:41:44PM +0200, Peter Zijlstra wrote: > #!/bin/bash > > gen_proto() { > local cnt=0; > > proto=$1; shift; > ret=$1; shift; > pfx=$1; shift; > sfx=$1; shift; > > echo -n "${ret} "; > > name=${proto%(*}; > echo -n "${pfx}${name}${sfx}(" > > args=${proto#*\(}; > for arg in ${args//[,)]/ }; > do > if [ $cnt -gt 0 ] > then > echo -n ", "; > fi > let cnt++; > echo -n "${TYPES[$arg]} ${arg}" > done > echo ");" > } > > gen_proto_order() { > gen_proto $1 $2 $3 $4 > gen_proto $1 $2 $3 $4_acquire > gen_proto $1 $2 $3 $4_release > gen_proto $1 $2 $3 $4_relaxed > } > > gen_void_protos() { > grep -v -e "^$" -e "^#" atomic.tbl | while read proto meta; > do > gen_proto ${proto} "void" ${TYPES[pfx]} "" > done > } > > gen_return_protos() { > grep -v -e "^$" -e "^#" atomic.tbl | while read proto meta; > do > if [[ $meta =~ "R" ]]; then > gen_proto_order ${proto} ${TYPES[i]} ${TYPES[pfx]} "_return" > fi > done > } > > gen_fetch_protos() { > grep -v -e "^$" -e "^#" atomic.tbl | while read proto meta; > do > if [[ $meta =~ "F" ]]; then > gen_proto_order ${proto} ${TYPES[i]} "${TYPES[pfx]}fetch_" "" > fi > done > } > > gen_exchange_protos() { > grep -v -e "^$" -e "^#" atomic.tbl | while read proto meta; > do > if [[ $meta =~ "X" ]]; then ret=${TYPES[i]}; if [[ $meta =~ "B" ]]; then ret="bool" fi gen_proto_order ${proto} ${ret} ${TYPES[pfx]} "" > fi > done > } > > gen_protos() { > gen_void_protos > gen_return_protos > gen_fetch_protos > gen_exchange_protos > } > > declare -A TYPES=( [pfx]="atomic_" [v]="atomic_t *" [i]="int" [j]="int" [I]="int *" ) > > gen_protos > > declare -A TYPES=( [pfx]="atomic64_" [v]="atomic64_t *" [i]="s64" [j]="s64" [I]="s64 *" ) > > gen_protos > > declare -A TYPES=( [pfx]="atomic_long_" [v]="atomic_long_t *" [i]="long" [j]="long" [I]="long *" ) > > gen_protos > >