Received: by 10.192.165.148 with SMTP id m20csp420250imm; Wed, 2 May 2018 02:37:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrHjzg+d4xEa9FsJJ30yypUtScgLSzxFZwAMi10UObCfKTvvFA3+QFXLKjRMtFCU9q7vU7D X-Received: by 2002:a63:6245:: with SMTP id w66-v6mr15598596pgb.55.1525253855901; Wed, 02 May 2018 02:37:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525253855; cv=none; d=google.com; s=arc-20160816; b=ISNbgfMPYH90OBiboumfFL2vk5KhXrRza8GJ/nKRmXYO/Sn29o0i7Jsb1p6J7UMpeV 8t8LQmpmQkbReW8wveCyI6RmFFvrWwWpc31UmX6oXKU70EHifsp2Pqcv4uCI/J1h0+YW R69ChrcfMKOHhXiVxyg7L1vpnQZLIgBwcE6EyrTy15YpweAlfiABAMay4PdtQXucFAoP 5eOWI1MxrKgNRBrF8wdU5fTCQOBO9iC9IBh5GLBhZVW4TTj9Bza0EiR7J2UwoDtr2Svq xyWf1VWWQBzfMY9tLBJb0F4ObrRnTZOu4vgmgA3N4Qbfksnaudll3lks9eZJRPooxew2 FBWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=RPDkmuhbLatG89PhgYIXKFxBgglvEi6ptJ+UsQlnIw0=; b=vHFzw9XnLQe0ydj/tD51SGqryCZtk8dDFBsHHxetskLM2os4EsgHqEu+62YuyBq2rF uHZ/jyEC7eNyTj40ikNBeaQxk5SpbqzPDGnfY+cUISSPXmfPuobloIKdnrcxyCJibIZ/ oUjK4abyE8Hlq+8cizgF470/pQwVLnPFIQE428vCigBJmrIbgEIeHkhWinJWgCVodI/I xzGd08wnT8H7dPN+oersRiZyxR5Ntr/7yQVsJ8fsF10x3OgzEYibkqqcReIpL0uRGkBt MYWz8UHKngZVq8zV3Dq+4zKbG0t86S9xwSTgTwtOAlrogZc/TidyN5HAONnjPipSY8Ux mBHw== 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 s204-v6si2005269pgs.164.2018.05.02.02.37.21; Wed, 02 May 2018 02:37:35 -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 S1751426AbeEBJhC (ORCPT + 99 others); Wed, 2 May 2018 05:37:02 -0400 Received: from mga01.intel.com ([192.55.52.88]:47635 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbeEBJhA (ORCPT ); Wed, 2 May 2018 05:37:00 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2018 02:37:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,354,1520924400"; d="scan'208";a="46134581" Received: from gvt-dell.bj.intel.com (HELO intel.com) ([10.238.154.59]) by FMSMGA003.fm.intel.com with SMTP; 02 May 2018 02:36:57 -0700 Date: Wed, 2 May 2018 17:27:01 +0800 From: "Du, Changbin" To: Steven Rostedt Cc: changbin.du@intel.com, yamada.masahiro@socionext.com, michal.lkml@markovi.net, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.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 Subject: Re: [PATCH 3/5] kernel hacking: new config NO_AUTO_INLINE to disable compiler atuo-inline optimizations Message-ID: <20180502092700.i4tpyi7gbf7jz7ax@intel.com> References: <1525179614-14571-1-git-send-email-changbin.du@intel.com> <1525179614-14571-4-git-send-email-changbin.du@intel.com> <20180501105420.07e41578@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180501105420.07e41578@gandalf.local.home> User-Agent: NeoMutt/20180323-6-5ca392 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 01, 2018 at 10:54:20AM -0400, Steven Rostedt wrote: > On Tue, 1 May 2018 21:00:12 +0800 > changbin.du@intel.com wrote: > > > 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. > > I'm not against this patch, but it's up to others if this gets included > or not. > > > > > 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" > > typo: s/atuo/auto/ > > > + 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. > > Some grammar updates: > > 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. > Thanks for your kind grammar updates. I will update them. :) > > + > > + Use only if you want to debug the kernel. > > The proper way to say the above is: > > If unsure, select N > Agree. > -- Steve > > > + > > config ENABLE_WARN_DEPRECATED > > bool "Enable __deprecated logic" > > default y > -- Thanks, Changbin Du