Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp618996imm; Tue, 5 Jun 2018 01:26:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJXmZ1GiX8tXxTxfG4eMICX/sp5rXgF4/0lWv7PARszhpvgYOiQH1ZihOtfYhk7g8iUkD3F X-Received: by 2002:a17:902:7e42:: with SMTP id a2-v6mr25369920pln.151.1528187192702; Tue, 05 Jun 2018 01:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528187192; cv=none; d=google.com; s=arc-20160816; b=LoV3rBH0joxMpmdEwYyW2BDH63JBvheOjco62Lu957d7XfYSW2hJlSo0ouz+lvDwyh TaPQXXTaqPtIC+r7L6xjd40w/RCM0+tWuIokFxVTMfKvPgW210hSAE/26BnKsyEpEXdk Bb5/DRoQnn66s0Zqh66IKUXKYM34KUKx/kdMeuKg256s4zsB+tixrD/1dJMNdaPEz8UL V6Vyji+Vu95RygA5X8Yo3Gvj7ucMMH4BelbiiEo10LCOYsqNL1q2V0V+81VV4RbvOCFP 2288sEJ4+x5XdLwzKZ1WtU9PzzC1i88N/pHA2Oduq3D+BYwqUdZmMj0mvHD+E0dGtaIP ktgw== 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=maDR2MWxKor7yAfKPela0FRjEIKj1btDLM1q4dQgO+o=; b=Fxjv5trPv22lUkCS1e7JLvEkq/XxNBirm2OBfa5sZeD89XPru/q6PM20cU/wnm5lPI 4fDfkVFMYTzWOfBhhlEWp4fSMwFvdDZ5yXyjTx4YqyTwpr5HJVtyvTk0NuhV1VOvdxG8 tH9l2uwBLdvOsYw+tsGmL56hW7UiCQOb1k/MkUIFUo72XRJlwFbZbIbQ9lnrKXPkpRQl pwfWOWrO1Xda+Wyx8Od2QMoP/WTUvHaWgKB1+Vf1KzdPhZvbJ8MPJa939uCX4hq8YUiO Ej5mpSNWv3jhsJU+7Q28vaxf9VRQRlHZof05X5tDTUb3yV83VjNuKhtH0FCpst+x7Nwz Lkgg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si48351106plb.394.2018.06.05.01.26.18; Tue, 05 Jun 2018 01:26: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923AbeFEIYn (ORCPT + 99 others); Tue, 5 Jun 2018 04:24:43 -0400 Received: from mga07.intel.com ([134.134.136.100]:33944 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbeFEIYk (ORCPT ); Tue, 5 Jun 2018 04:24:40 -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 orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 01:24:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,478,1520924400"; d="scan'208";a="45352152" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.65]) by fmsmga008.fm.intel.com with ESMTP; 05 Jun 2018 01:24:35 -0700 From: changbin.du@intel.com To: mingo@redhat.com, akpm@linux-foundation.org, yamada.masahiro@socionext.com, michal.lkml@markovi.net Cc: rostedt@goodmis.org, tglx@linutronix.de, rdunlap@infradead.org, x86@kernel.org, linux@armlinux.org.uk, lgirdwood@gmail.com, broonie@kernel.org, arnd@arndb.de, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, changbin.du@gmail.com, Changbin Du Subject: [PATCH v5 2/4] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations Date: Tue, 5 Jun 2018 16:13:38 +0800 Message-Id: <1528186420-6615-3-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528186420-6615-1-git-send-email-changbin.du@intel.com> References: <1528186420-6615-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 Acked-by: Steven Rostedt (VMware) --- 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