Received: by 10.192.165.148 with SMTP id m20csp4915049imm; Tue, 1 May 2018 06:11:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpqVdeWGwezKMUeWxhpFC62yIAeJf+wsS7wZppZgHfX7/3YreBTfJ/m52+kb6CT4fzTS+bc X-Received: by 2002:a17:902:bb8c:: with SMTP id m12-v6mr16422459pls.53.1525180317984; Tue, 01 May 2018 06:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525180317; cv=none; d=google.com; s=arc-20160816; b=OP7Pd3SuKjV239DxuxKgSR+byg2LZtUIMnQEjo2AhpA8CrP2lKmJRcomSu7ojPH3ik ketR0JqjyzfrGAJsJeDcf8iUczemWVbIRUjaGdc5iaVPV3n8GO3Yh33AtDJ3fLdYcj6+ 5U00KyI+NtImK81aONiApJqulNum7DZZ25d7l7PGq4aGw/5ysVdth0CCiBTQjcOlcqgs DIIGuqDJtZm8vG2WF1nSHOVivqtHkOPU32OKlI8UQLc1o3IFNW9YTMt3/FiBXZg3CX7/ JVFFUWbc0ZWzVVKjp/e8XsEi18O4GmpYK8DN08CQiO1ESHEqBkvaIY+M5ObmarepHe7j pjkg== 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=7qa8rZZxG0fVTOXsNFadNXkN0mrnLvLwT4vVXBg+pbU=; b=lnzQDgMYSBktrR4SXYzGi8xxAKvI0O8jt3seioc+9tuPdnOKeYulBZaJVg6INwrHnz Mkt5UeXYvkjQgnmsjUY3qSpw+xlh0KmzkCZ3vmOlHUyv4aoFo6XTOXAYHU/DPja3R34o zQ+nM/g8HVaYpWmnGDpPHg8CjVox01iiBxHv82gpaXcQYDKY/mCgiaWVNPYmaWRWIihU lEpf7eT+MS9brsKXoOL2qmF4pqilieWS09ryJHQ1L1Dgb0r/j3b08rG738yQnit8Y4in QxqGRR0JzYO9u2T/8HY9XxnnoAWzUPBO4HhGOxrXOjGz8AO8n7BhAx/nKlEY3A3vQsRF /a4Q== 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 g18-v6si9520894plo.586.2018.05.01.06.11.44; Tue, 01 May 2018 06:11:57 -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 S1755453AbeEANLB (ORCPT + 99 others); Tue, 1 May 2018 09:11:01 -0400 Received: from mga06.intel.com ([134.134.136.31]:65261 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755345AbeEANK4 (ORCPT ); Tue, 1 May 2018 09:10:56 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 06:10:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,351,1520924400"; d="scan'208";a="38382556" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by orsmga006.jf.intel.com with ESMTP; 01 May 2018 06:10:53 -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: 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 , Steven Rostedt Subject: [PATCH 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler atuo-inline optimizations Date: Tue, 1 May 2018 21:00:12 +0800 Message-Id: <1525179614-14571-4-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525179614-14571-1-git-send-email-changbin.du@intel.com> References: <1525179614-14571-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 make compiler not auto-inline kernel functions. By enabling this option, all the kernel functions (including static ones) will not be optimized out except those marked as inline or always_inline. This is useful when you are using ftrace to understand the control flow of kernel code or tracing some static functions. Signed-off-by: Changbin Du Cc: Steven Rostedt --- Makefile | 6 ++++++ lib/Kconfig.debug | 13 +++++++++++++ 2 files changed, 19 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..90f35ad 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -198,6 +198,19 @@ config GDB_SCRIPTS instance. See Documentation/dev-tools/gdb-kernel-debugging.rst for further details. +config NO_AUTO_INLINE + bool "Disable compiler atuo-inline optimizations" + default n + help + This will make compiler not auto-inline kernel functions for + optimization. By enabling this option, all the kernel functions + (including static ones) will not be optimized out except those + marked as inline or always_inline. This is useful when you are + using ftrace to understand the control flow of kernel code or + tracing some static functions. + + Use only if you want to debug the kernel. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y -- 2.7.4