Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp69875ybe; Thu, 12 Sep 2019 15:51:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKKY0ZiCxUri15p5Nvai8iWrHNzIY9P5eMZ61K5VPSVdId5zrYPw8pV4hE/MH6JEmh+EZW X-Received: by 2002:a05:6402:611:: with SMTP id n17mr45406251edv.33.1568328708968; Thu, 12 Sep 2019 15:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568328708; cv=none; d=google.com; s=arc-20160816; b=qQmFq2MwbeGBvXUYDDSsKLNQIF+tmMAzrkjO1CPV1eoRaeP94Jk7zrlccYLDEcpB5n suCwpHbrQC/BfImhUNaXAh9dAZ5/JYKSYHT/3Abk7HGw+GdoLkYG3xuKoeUmmuwyKiTR ZTIgjzE02KKPVcrTTpsrbXGY16vfDuV38tqKFRIgSaV+KuYCrZtzzgr2yQ6s0u56GWkQ UMHnIzXWVWXURwSbGjfBxeQxh/Sf0wfUPd33JCUHkXkOd4rKMhyMXDx17kwDoX/MAcgq 9Ss6WwJ/miG7pLUXdrIig33c0DYkZdbedVdjVALTUc62FsenxQSgoy+br8cyEM5cP6dk FpDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JgLR6Eqt8jfsgQZgs5aBVeUPiD11IsQFXRalFsn+2h4=; b=ljynmnFD9e+aDt8VyKyfVOTSYbeVlhwbBvMB1WbXeT9ctckKUrwtvwuVbkfW8U1mBY Sf6QRF1UFabzZzTKO4kwzA9IYsK5EE34FmVTb21TOKoscTaMMjM1oMBnzSJtWToNE/wH R3O78fGWuJhO4Ly/hrxgMm/lFwS5lti+8kFUqdGxHdA8jwoV2ZOJn1ndcvmOVDNGKmiV FDM3SE/nJGwqxllrNzEUl+25uvIZ38nssXBsR+gnLymLskI4iEC9tECSKLxUaL4KP+3C 0P26a1ValccVC/UtFZ/iSdUKX+DMehKpz9I2YPFQxP6YIBiCOSy8td+Ddl4zkdsNQvv1 PnnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=emaSQFCs; 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 x24si13724634ejs.168.2019.09.12.15.51.24; Thu, 12 Sep 2019 15:51:48 -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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=emaSQFCs; 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 S1729557AbfILWT6 (ORCPT + 99 others); Thu, 12 Sep 2019 18:19:58 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:43755 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729376AbfILWTv (ORCPT ); Thu, 12 Sep 2019 18:19:51 -0400 Received: by mail-ed1-f65.google.com with SMTP id c19so25284625edy.10 for ; Thu, 12 Sep 2019 15:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JgLR6Eqt8jfsgQZgs5aBVeUPiD11IsQFXRalFsn+2h4=; b=emaSQFCsNxR0TOUbWEOIul/RdEc3pNYGCkF3wFh/69CjFZ9x7ltYEeLfJ99AwF5KG4 qH9jEvtbCSNU/hbGeZL+riq2yqkwnkyGkgQS4d7wa4AY0kAHJ5rqkmjDuXbIHeLebnul QtiXYOsivkfV8ug9UswoQKKfHgkKF8i9dhs34= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JgLR6Eqt8jfsgQZgs5aBVeUPiD11IsQFXRalFsn+2h4=; b=L62stRleA9Gc20Ic66pIdjzjOoq3aiSJi5c+z26crDK+rHbqmjQiG3Fr0r5B+ugYGZ SHV/z9IRixw4leq2G2w+ZGNVwJfEIU6PCEs2V2AKTfn+hdDiMNPQ4eZcYKyEXu49CpzU hkNkhzDmbFgz3eIGdjAGiLXVocWvtcxK8ItOaU9a+ZSdJHxM67FFQycCZpqUJ3dNKuG9 w1df1sEqAIs4Fbuwq595sllx075yLcbQ89AfTl2giyH57k/V7WIRbEF33mcgAb85RCwi /2G2Am1p59AW1CpWh4TLw6lln3+FanIUBYC8XxV9pPPaLRqFeayd/wuHXDQ8tNmh8iDx yd/w== X-Gm-Message-State: APjAAAWQl6ddN/A8kBcOI5eI+R/kuLfFWpulFhvRIe/4kUUEAxQ5rLdc LDTiWS7+cDaR2/NWk6Dyt3dPnQ== X-Received: by 2002:aa7:da8b:: with SMTP id q11mr44338366eds.19.1568326789172; Thu, 12 Sep 2019 15:19:49 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-115-35.cgn.fibianet.dk. [5.186.115.35]) by smtp.gmail.com with ESMTPSA id 36sm4305228edz.92.2019.09.12.15.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2019 15:19:48 -0700 (PDT) From: Rasmus Villemoes To: Miguel Ojeda , ndesaulniers@google.com, Masahiro Yamada Cc: Greg Kroah-Hartman , Ingo Molnar , Linus Torvalds , Nadav Amit , x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , Rasmus Villemoes Subject: [PATCH v3 6/6] x86: bug.h: use asm_inline in _BUG_FLAGS definitions Date: Fri, 13 Sep 2019 00:19:27 +0200 Message-Id: <20190912221927.18641-7-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190912221927.18641-1-linux@rasmusvillemoes.dk> References: <20190830231527.22304-1-linux@rasmusvillemoes.dk> <20190912221927.18641-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This helps preventing a BUG* or WARN* in some static inline from preventing that (or one of its callers) being inlined, so should allow gcc to make better informed inlining decisions. For example, with gcc 9.2, tcp_fastopen_no_cookie() vanishes from net/ipv4/tcp_fastopen.o. It does not itself have any BUG or WARN, but it calls dst_metric() which has a WARN_ON_ONCE - and despite that WARN_ON_ONCE vanishing since the condition is compile-time false, dst_metric() is apparently sufficiently "large" that when it gets inlined into tcp_fastopen_no_cookie(), the latter becomes too large for inlining. Overall, if one asks size(1), .text decreases a little and .data increases by about the same amount (x86-64 defconfig) $ size vmlinux.{before,after} text data bss dec hex filename 19709726 5202600 1630280 26542606 195020e vmlinux.before 19709330 5203068 1630280 26542678 1950256 vmlinux.after while bloat-o-meter says add/remove: 10/28 grow/shrink: 103/51 up/down: 3669/-2854 (815) ... Total: Before=14783683, After=14784498, chg +0.01% Signed-off-by: Rasmus Villemoes --- arch/x86/include/asm/bug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index 6804d6642767..facba9bc30ca 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -32,7 +32,7 @@ #define _BUG_FLAGS(ins, flags) \ do { \ - asm volatile("1:\t" ins "\n" \ + asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ @@ -49,7 +49,7 @@ do { \ #define _BUG_FLAGS(ins, flags) \ do { \ - asm volatile("1:\t" ins "\n" \ + asm_inline volatile("1:\t" ins "\n" \ ".pushsection __bug_table,\"aw\"\n" \ "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ "\t.word %c0" "\t# bug_entry::flags\n" \ -- 2.20.1