Received: by 10.192.165.148 with SMTP id m20csp5025302imm; Tue, 1 May 2018 07:54:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZppiA2dS2giQLzUSKc5kyylzCVQDaJizYYixXmu8aejPVgK9Hpmvhyo16QLOIZJLi2qvcx2 X-Received: by 2002:a63:6a04:: with SMTP id f4-v6mr13355147pgc.225.1525186490944; Tue, 01 May 2018 07:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525186490; cv=none; d=google.com; s=arc-20160816; b=QirhHww/jQ/wx0qPXV8WaHgt0n3NvwoLJQCn+4Vtq66JOhxcrRtz44MpM1LfiSlhE/ YNflE7kxGVSk+GSazvebxBwQQJlxOJoRn8CeaPIuEfiqx5Q5gUj8NbOg0EbmZ9eBuHHN 4C/y7w9oLhbrEkABfpRsKQHSzR5RjWruqkwVrpt+sGbEXuUo8uIbgnuwtj85CMdzX0u7 nxzkU2GLD+Tj6s55PhBQYqNtnXcLU6PzNw87FfgxDWP+n2ycoBQ3ULo+tdRjeKwM11/i iGJSFOVCUwbo6GOA8zOsHNzXhgDZXM3PiWbBSmTxV4pDXrqSMHKyy/neBI+06/BAWtPj Kc6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=tAzfTI/IjRmiFk/qPZhCl6Y82REQF+iCMdwnYkX5lbo=; b=lNNZHMeZzwDBw5gX0Mcvko9NGcZzaglGj0lnhAkA2JTbK/Fn7PcFEusDVtvEwbeJtb gMivi/+3kVNMqZZePjn43NNTdprVvJlKgwaJ9NhnQ3cWo0OhTGeoYOL1HJ8q8gWZ1nPO tVyOhxR9O2RK2OaZlJk3/hWwWq8eQfUDrE8mTR7Wbrj+VReqUV6TEegpJIXJYIQOUoCW o/8b1zHKV6+CWaCPieVmDJFsw09S3Ebj/txMgjgXsk874jmvPlrtm37zYNrjvIeESg0u 87ppcChZkv5Lo7zfzrX691I8owuYs4cZIZbtnKp0gltJ7qN/4L7t+PONtFhpbA97CBzV DMDA== 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 z80si7956944pfi.7.2018.05.01.07.54.36; Tue, 01 May 2018 07:54:50 -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 S1755066AbeEAOy0 (ORCPT + 99 others); Tue, 1 May 2018 10:54:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:34654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753789AbeEAOyY (ORCPT ); Tue, 1 May 2018 10:54:24 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A64F23691; Tue, 1 May 2018 14:54:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A64F23691 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Tue, 1 May 2018 10:54:20 -0400 From: Steven Rostedt To: changbin.du@intel.com Cc: 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: <20180501105420.07e41578@gandalf.local.home> In-Reply-To: <1525179614-14571-4-git-send-email-changbin.du@intel.com> References: <1525179614-14571-1-git-send-email-changbin.du@intel.com> <1525179614-14571-4-git-send-email-changbin.du@intel.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > + > + Use only if you want to debug the kernel. The proper way to say the above is: If unsure, select N -- Steve > + > config ENABLE_WARN_DEPRECATED > bool "Enable __deprecated logic" > default y