Received: by 10.192.165.148 with SMTP id m20csp1624413imm; Sat, 5 May 2018 17:31:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr88POLSCjMZAt89XKrxqecseMx7Oc6gbi8uycFurfCmWEES/MO/q5Wb5t12HJhnv6DrnP5 X-Received: by 2002:a17:902:a714:: with SMTP id w20-v6mr1699856plq.374.1525566692709; Sat, 05 May 2018 17:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525566692; cv=none; d=google.com; s=arc-20160816; b=RVnX0+o4hgYvxAsj8o/Z++aZ/4+8/gayA0FZWLRX0R5SaCWKqFGXCwAyJ0DhqpsHkd ZxgUie4tKbkS9055jFe6e0jtRfhTfMJXCC6BRgVCsHtenLrLFSqkDlT6377ZaE40Lmtj WSwxbSq0OXtOojrLIuFu5SWrsWySFKL3jh5zwwzrdKVFEZefotRjxIRqXQidMssFdChW jqHYU+BAr7hyltL3kQI9wfOQNdQp67E6IcdNAg4LXjf0J9CTnCyRQeQ5m+LHjupxumvm RmMEhO7uMUosbI41mLYMIdUefduTuIpT8VC+Itwol/JZhy3H1xDwchKpaFPYsmuphQjw ihug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=4IxJBb4LGfPQnzfTptHuv2bAogw4UsSFfLA5QHaBz5w=; b=GrBBiUFBhH+PE8792RrKXW4f0wy8rqEe6QTRmSO78exdl3Y7HBfX2HgShgNbC9eqfV a7Uyy7AGLgrAaN9BYXQldCREQBkgcquvvpyVNF4eI3N5E9cwHyn+t6KrmySHRYNh9iEF Nacfuw9leui9dbGJDTvOBkDcC2AJwqttQpSH1GRdgUYXltaIczJlDAYNRA63hDbqvNZt iZ1KYPCHyLeFCw60cNdgn8wI+13nDhTkmVmu6E1JQAONRyuxvM5NZCv0qfHA6ZGzzNIf dU4TtSuvvAU7m82kx6rQ+kJcJvMCMNslsGS+2wWOQgB9tuoQGXkdYxNI44BHlW77Tv0f sdHA== 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 37-v6si18569001plq.288.2018.05.05.17.31.18; Sat, 05 May 2018 17:31:32 -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 S1752000AbeEFAaz (ORCPT + 99 others); Sat, 5 May 2018 20:30:55 -0400 Received: from mga06.intel.com ([134.134.136.31]:51493 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751984AbeEFAau (ORCPT ); Sat, 5 May 2018 20:30:50 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2018 17:30:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,367,1520924400"; d="scan'208";a="226149339" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga006.fm.intel.com with ESMTP; 05 May 2018 17:30:44 -0700 From: changbin.du@intel.com To: yamada.masahiro@socionext.com, michal.lkml@markovi.net, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org Cc: rostedt@goodmis.org, rdunlap@infradead.org, x86@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, arnd@arndb.de, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Changbin Du Subject: [PATCH v3 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations Date: Sun, 6 May 2018 08:20:14 +0800 Message-Id: <1525566016-30172-4-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525566016-30172-1-git-send-email-changbin.du@intel.com> References: <1525566016-30172-1-git-send-email-changbin.du@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changbin Du This patch add a new kernel hacking option NO_AUTO_INLINE. Selecting this option will prevent the compiler from optimizing the kernel by auto-inlining functions not marked with the inline keyword. With this option, only functions explicitly marked with "inline" will be inlined. This will allow the function tracer to trace more functions because it only traces functions that the compiler has not inlined. Signed-off-by: Changbin Du Cc: Steven Rostedt --- v2: Some grammar updates from Steven. --- Makefile | 6 ++++++ lib/Kconfig.debug | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Makefile b/Makefile index 619a85a..eb694f6 100644 --- a/Makefile +++ b/Makefile @@ -775,6 +775,12 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ $(call cc-option,-fno-var-tracking) endif +ifdef CONFIG_NO_AUTO_INLINE +KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions) \ + $(call cc-option, -fno-inline-small-functions) \ + $(call cc-option, -fno-inline-functions-called-once) +endif + ifdef CONFIG_FUNCTION_TRACER ifndef CC_FLAGS_FTRACE CC_FLAGS_FTRACE := -pg diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index c40c7b7..da52243 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -198,6 +198,23 @@ config GDB_SCRIPTS instance. See Documentation/dev-tools/gdb-kernel-debugging.rst for further details. +config NO_AUTO_INLINE + bool "Disable compiler auto-inline optimizations" + help + This will prevent the compiler from optimizing the kernel by + auto-inlining functions not marked with the inline keyword. + With this option, only functions explicitly marked with + "inline" will be inlined. This will allow the function tracer + to trace more functions because it only traces functions that + the compiler has not inlined. + + Enabling this function can help debugging a kernel if using + the function tracer. But it can also change how the kernel + works, because inlining functions may change the timing, + which could make it difficult while debugging race conditions. + + If unsure, select N. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y -- 2.7.4