From patchwork Tue Jun 20 23:12:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Rientjes X-Patchwork-Id: 9800397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC4E660329 for ; Tue, 20 Jun 2017 23:13:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC3127F88 for ; Tue, 20 Jun 2017 23:13:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF8FA283AE; Tue, 20 Jun 2017 23:13:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5CAFC27F88 for ; Tue, 20 Jun 2017 23:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A+VEUyLfiXmU51QUVoNpLKDipZL4ktfg0mpCMbbgFLc=; b=WqrfwjKloQ97kw MqCHr/ALp0SXlyM3Rou8rCREj43fL5+SRLYXnKvWGxj4cDQggXxvgS3G8J0nPnxzXj1XKtd+oP1O6 7+AE5Rhem0osBTaraNrLOPfewxekI3nBnKLMC7RGRA2IwUiFxwwR5D6ixWM9Hxpd6Jf8JphOBhdyV AucSiDKtjj23/bZnup+cYvknMTtm35SjDwi6e4DpHxXQbPwWDuOS40U9HCFK73bhOKsmhSoXlMAJ8 NwoWuC68AxQOA+SxaW6imnnXHE0DbI67/zeboaP5LTXPJ7mh0Lfi5+rsLB+AznUbPXRCMGnZ9TUxh FCUMg3mkeRVc5bN5KCjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dNSKQ-0008Fl-Iw; Tue, 20 Jun 2017 23:12:58 +0000 Received: from mail-pg0-x22f.google.com ([2607:f8b0:400e:c05::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNSKN-0008EZ-Lf for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2017 23:12:57 +0000 Received: by mail-pg0-x22f.google.com with SMTP id f185so69023843pgc.0 for ; Tue, 20 Jun 2017 16:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=sJAw8+HZjkAEHVjnRJ+WPTyib7ljvmilX1TyRTiV9lc=; b=IWDjcg/Ubf2yeU8c/dBSZfPcGsypzuv4HItn+RC5ET5aYWQlbzutE6W+KidIT/ktqt qdHDeFbxKhDFgshsiOyc+6nEWEBkl6RjCZrrOYmfykPrOOxG2gn95O6d6ruB4qi1Kq3+ uRumFPCDxFJCjcfhQtcnM09y2PZZ6Zc/+E1FKhR0nea1OxfGw5Lw+UnxHBAYc244U59f oVCw+XRGkQMXITJw1k3h2omY3wv8SJ2KSEqiC0kZmo1lULVYC2QyIQd7t5tV3+UJu6C0 NN0INUAoV8Rw6lURlpzYxFvKeNbDAF4aA6BVc9tu8Vg31DVZvtvDYOhgyXmilJ36CtXM QrQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=sJAw8+HZjkAEHVjnRJ+WPTyib7ljvmilX1TyRTiV9lc=; b=EJ9VG73qIxhUDic7tb+UTT1UR5+56CWl/FPyXcm+pwJtwzGsUXbN4HImIvY2CZxqeH 0AiJYUP5Eto4xjQjKk6j2dRvyWy354zhXv2wbAL1morOotDh1uvOrO3+ouX2jwGjjWSd psHkbmQStF99ZkaZCuKm3PTl1dJ1gI1XTDFX67xJPJCeTWb/jAt4KO1FyPRfZJAIuBAp /c18gpdMe+LbM/e2Ko2B6FtKf6JZVdDUi1ieMJZWZ4PJjAvtsZO0FOMMrYgorgqBLfNZ At2oJhdt5dL6P/lun29DENb56Piny0CXZI88bfQVnrxZQVk/6b1NwC2lITm4FCtsyrK4 Ar8w== X-Gm-Message-State: AKS2vOyn0e3F/dmLarBgZDMPuLjmgycsc3wVaoZlTnTFFp/aPWsDCbQX cLOAW0/ypA092zKV X-Received: by 10.99.44.67 with SMTP id s64mr34234575pgs.111.1498000354068; Tue, 20 Jun 2017 16:12:34 -0700 (PDT) Received: from [2620:15c:17:3:c15e:1fb6:d4f1:22b7] ([2620:15c:17:3:c15e:1fb6:d4f1:22b7]) by smtp.gmail.com with ESMTPSA id m81sm28342791pfj.121.2017.06.20.16.12.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 16:12:33 -0700 (PDT) Date: Tue, 20 Jun 2017 16:12:32 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Mark Rutland Subject: Re: [PATCH] compiler, clang: Add always_inline attribute to inline In-Reply-To: <20170620105937.GD28157@leverpostej> Message-ID: References: <20170615155440.GC26471@leverpostej> <1497887596-8731-1-git-send-email-psodagud@codeaurora.org> <47bd7df20466d5f7f557ca087b0189cf@codeaurora.org> <20170620105937.GD28157@leverpostej> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170620_161255_767559_AE746530 X-CRM114-Status: GOOD ( 16.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peterz@infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, Sodagudi Prasad , mingo@kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 20 Jun 2017, Mark Rutland wrote: > As with my reply to David, my preference would be that we: > > 1) Align compiler-clang.h with the compiler-gcc.h inlining behaviour, so > that things work by default. > > 2) Fix up the arm64 core code (and drivers for architected / common > peripherals) to use __always_inline where we always require inlining. > > 3) Have arm64 select CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING, and have > people test-build configurations with CONFIG_OPTIMIZE_INLINING, with > both GCC and clang. > > 4) Fix up drivers, etc, as appropriate. > > 5) Once that's largely stable, and if there's a benefit, have arm64 > select CONFIG_OPTIMIZE_INLINING by default. > > That should avoid undue breakage, while enabling this ASAP. > Sounds good, but I think we should simply deal with the __attribute__((unused)) needed for clang as part of compiler-gcc.h by simply adding it to the inline override there to avoid duplicated code. diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -15,11 +15,3 @@ * with any version that can compile the kernel */ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) - -/* - * GCC does not warn about unused static inline functions for - * -Wunused-function. This turns out to avoid the need for complex #ifdef - * directives. Suppress the warning in clang as well. - */ -#undef inline -#define inline inline __attribute__((unused)) notrace diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0efef9cf014f..71fe0994cf1a 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -66,18 +66,22 @@ /* * Force always-inline if the user requests it so via the .config, - * or if gcc is too old: + * or if gcc is too old. + * GCC does not warn about unused static inline functions for + * -Wunused-function. This turns out to avoid the need for complex #ifdef + * directives. Suppress the warning in clang as well by using "unused" + * function attribute, which is redundant but not harmful for gcc. */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) -#define inline inline __attribute__((always_inline)) notrace -#define __inline__ __inline__ __attribute__((always_inline)) notrace -#define __inline __inline __attribute__((always_inline)) notrace +#define inline inline __attribute__((always_inline,unused)) notrace +#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace +#define __inline __inline __attribute__((always_inline,unused)) notrace #else /* A lot of inline functions can cause havoc with function tracing */ -#define inline inline notrace -#define __inline__ __inline__ notrace -#define __inline __inline notrace +#define inline inline __attribute__((unused)) notrace +#define __inline__ __inline__ __attribute__((unused)) notrace +#define __inline __inline __attribute__((unused)) notrace #endif #define __always_inline inline __attribute__((always_inline))