Received: by 10.192.165.148 with SMTP id m20csp666556imm; Wed, 2 May 2018 06:57:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpP0D4LqWGrQRURUJIFVlvhxabjFND6tJLkYJn/w4MolpyU6+Yf+tALDMmcNEA1QM0J5Qxl X-Received: by 2002:a17:902:6f16:: with SMTP id w22-v6mr19933957plk.216.1525269464412; Wed, 02 May 2018 06:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525269464; cv=none; d=google.com; s=arc-20160816; b=aGmwKJTsdXSH7MTrGepXvWNaNEUSZkL+GDTADi0oUuvYr0JoErQRMnjDg5JEXITQOu IY25MmAzZWlbA1b+FB+lSlvDNluL1jDjmFof3PCkd4WF/9chmJYOleqF7QkChrUqNkg8 HKWoLBM2IhswBds98ceWyj6y86x5rMwlorhmY8KhWeQ2z7fKLHTP2AiL7DMCVhNZeWFY 113Zl9YQ/i387oNIkLvqcyVUfXdcYaSxB072jqTtTwgoBzbN7W+4PyAkNIeNHVvfHknj NKyd+NpciTc5yPMDnpVQ6Kt+/2etQic29O2Yc27XHWek274YoGnpcUhFX02rcQBUaMfk tNbg== 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=HlNPNT/wp7eycde1/cNnalUIVDoTOEPVZiwhx+mGgYY=; b=0KN0tm3bBPhiyzD34ctmvto4gsSmleBuMOcXD2IqXO0ftR6Z+rZv9M3dZstGeomgIf ByZI7tyPPfgwSL36IjXVsONY4gaauKeu4KRTWBQ90IU9QtaqHWLGxvUs9WhGWQRTCOzY vuqG3lkrvGsgGVnpbhVeDJAQ74UwtXopTaf757AkoSMPu7B6W0WJUynzpTzCu2aoKb1F nLWeGyuiXJzkdgk8xdLBh85TFPO8Y3WS6uCeU0VtB2OvEkLcg+4P2hbAi7TFJtIHLNiw e1hSgRHWWIASoGPADKmXioib13ScdkbRjU2J7/outgrQNZKuTzMEUcL9ZNoSd/LK/n2e FRzA== 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 l81si11573822pfj.127.2018.05.02.06.57.30; Wed, 02 May 2018 06:57:44 -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 S1751731AbeEBN4n (ORCPT + 99 others); Wed, 2 May 2018 09:56:43 -0400 Received: from mga01.intel.com ([192.55.52.88]:58147 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751476AbeEBNzi (ORCPT ); Wed, 2 May 2018 09:55:38 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2018 06:55:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,354,1520924400"; d="scan'208";a="225150760" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga005.fm.intel.com with ESMTP; 02 May 2018 06:55:35 -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 v2 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations Date: Wed, 2 May 2018 21:44:58 +0800 Message-Id: <1525268700-10631-4-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525268700-10631-1-git-send-email-changbin.du@intel.com> References: <1525268700-10631-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 | 18 ++++++++++++++++++ 2 files changed, 24 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..ab55801 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -198,6 +198,24 @@ 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" + default n + 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