Received: by 10.192.165.148 with SMTP id m20csp5258138imm; Wed, 9 May 2018 01:58:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoerYSkLXokkgFNXufxSbm/NHotYcNzNGPw2QXAWFqip01bou922zrzYVr4X+ZcDzOE4qXZ X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr12749361plb.30.1525856311869; Wed, 09 May 2018 01:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525856311; cv=none; d=google.com; s=arc-20160816; b=ey6UuMiocdJW5CcZ2qIru0sSLMfRIkWfFux9woC9Qtq9rREriP3FQgtIl3tbNVGF/e 0zjiGNqXzGWa3xPkKELsPKJ/jNeF4OSXqL/94V3oPU9E+2JLCoGh+UTNxqsnnPbBBDds DdTYG/ZWKTvYjYNOTpPLGUEWhr2Z3h2a1J3v58Dv8M1xHlouTaSjsqtZGIrJ1usXZ4Kl JYAMTd7pw5u9E8/SaumNdGULG0iJ2UKqkjivox+TFTHgjw/voiTWUjpRZXDDTisSd3no 7YdSX5O/V5sP/rKT0OFpS3XkcHGud27jJ4frlkqeJC41Qo14ma060ct020G9z8rGnwEk 0fhg== 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=SCY3M8EGeoseuz2JSw2R854/Gdi4n99kSIzB9EwAnus=; b=O+zDX0l/GB5fPQY6WCb2Ism5x+ND3QLc2LG3OunrlV6gy6+4b4BvE0J4b1Nd23PKMO YgT1Sq5KZCLlCxvKrR3rXxGS8w3aoUx+UA17u3tNnryebg+QwZ3ufP4HA/GOJV56L1fO RFeU9vpg3ZX2OnKPFLI/PYjWcM4yPEelWg2p/n0aauVAZQdpdU0R/WJ5GP9VhhrZuuQ0 Z3FYFilup/8XcwK39hXoJK08WhPaIDMhWc6r/3FmouyW21QErAhbytCiU0jCyo7+MciJ KE0ufT6ZLFLkhlmhlYaXbQVAh5okfwGuX5bfNNC7SSZ4O8VndSgNN/rOqeHExpW1tLzi QKcw== 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 e26si1574126pfn.244.2018.05.09.01.58.17; Wed, 09 May 2018 01:58:31 -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 S934472AbeEII5n (ORCPT + 99 others); Wed, 9 May 2018 04:57:43 -0400 Received: from mga09.intel.com ([134.134.136.24]:47882 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934229AbeEII4V (ORCPT ); Wed, 9 May 2018 04:56:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 01:56:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,381,1520924400"; d="scan'208";a="38541942" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga008.fm.intel.com with ESMTP; 09 May 2018 01:56:17 -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 v4 2/4] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations Date: Wed, 9 May 2018 16:43:14 +0800 Message-Id: <1525855396-7908-3-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525855396-7908-1-git-send-email-changbin.du@intel.com> References: <1525855396-7908-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 d0d2652..6720c40 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