Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp489822imm; Fri, 11 May 2018 01:23:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqub9l+KLD2kWa9iv61ZWUj6D2MamQCVwW/bmYapeOSoeCjPNyCwibMWcWC+56uKUjXNvOZ X-Received: by 2002:a17:902:758d:: with SMTP id j13-v6mr4636586pll.188.1526027015038; Fri, 11 May 2018 01:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526027015; cv=none; d=google.com; s=arc-20160816; b=QLN6Hzu8XrQNY+ZF4Gf8nlkff1ZX2Cc1M16ocxKCz1M/cRo2FMJ0dmTPcB4Ja6jtbS jq+afAjlfWS1RaNOlIegw04+TP8FQq3SGOE9ocX8pIHzdEigX8QM28aIB9QnQVxUnOCe O+BNMbXPah5j1eAy/X/JcRVYZik+rhWgxk7sf1j3DAYfaNY1wnuCnVr8xpRf3JIiueuk VKk8sKNdESnjGnLsQeoSVsNOYbRz4L1bL13G3VKZfUaYfO3ejQRg8jcZp7S3L3ZRbXm6 BSo9bPzCuDk2cnEf7PJRj8qm4fu7udEMWNJOcl7tfOmFgGikkOmAf7xDIICruzG8rheM xdlQ== 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=lLSHMKHJ9/V9hSn/hszJ4iS10SasxU0myDMUyk46x5M10Oz/WCQZT/cgMdJ8lWfjf9 XF0uvucH9qa3m33a7HIlUQAPQnoIuBVMbw15AZDHM+sS6jsZNCjIehmC7kF3aT5IpI4E wBJo372BqwrOQr1Gh7AIXIWq9bvY/ElM98Vcl8vUdNsmEE0FfWIrHoG9XyDgix3S6rua Eznc9JqYlM/G4Zbh1LB4kxH39NHPBkFaaw9OoTeLovCx3AZfFlAv8brbf7dODyJea7YN OwKqj0c3QezlUNoRJaUJj1VD3mgT5YaDg5YC+fybitiEqivnLodKpLTXl7y+QB4T28zS h/Ww== 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 k17-v6si2704257pfj.310.2018.05.11.01.23.07; Fri, 11 May 2018 01:23:34 -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 S1752717AbeEKIUW (ORCPT + 99 others); Fri, 11 May 2018 04:20:22 -0400 Received: from mga02.intel.com ([134.134.136.20]:35885 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752661AbeEKIUT (ORCPT ); Fri, 11 May 2018 04:20:19 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2018 01:20:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,387,1520924400"; d="scan'208";a="55002610" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.65]) by orsmga001.jf.intel.com with ESMTP; 11 May 2018 01:20:15 -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 v5 2/4] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations Date: Fri, 11 May 2018 16:09:45 +0800 Message-Id: <1526026187-11782-3-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526026187-11782-1-git-send-email-changbin.du@intel.com> References: <1526026187-11782-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