linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Radosław Smogura" <mail@smogura.eu>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-mm@kvack.org, Yongqiang Yang <xiaoqiangnk@gmail.com>,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH 01/18] Added hacking menu for override optimization by  GCC.
Date: Thu, 16 Feb 2012 21:26:00 +0100	[thread overview]
Message-ID: <76ede790fcc4ab73f969761034554e92@rsmogura.net> (raw)
In-Reply-To: <op.v9sctsrj3l0zgt@mpn-glaptop>

On Thu, 16 Feb 2012 11:09:18 -0800, Michal Nazarewicz wrote:
> On Thu, 16 Feb 2012 06:31:28 -0800, RadosA?aw Smogura 
> <mail@smogura.eu> wrote:
>> Supporting files, like Kconfig, Makefile are auto-generated due to 
>> large amount
>> of available options.
>
> So why not run the script as part of make rather then store generated
> files in
> repository?
Idea to run this script through make is quite good, and should work, 
because new mane will be generated before "config" starts.

"Bashizms" are indeed unneeded, I will try to replace this with sed.

>> diff --git a/scripts/debug/make_config_optim.sh 
>> b/scripts/debug/make_config_optim.sh
>> new file mode 100644
>> index 0000000..26865923
>> --- /dev/null
>> +++ b/scripts/debug/make_config_optim.sh
>> @@ -0,0 +1,88 @@
>> +#!/bin/sh
>
> The below won't run on POSIX-compatible sh.  Address my comments
> below to fix that.
>
>> +
>> +## Utility script for generating optimization override options
>> +## for kernel compilation.
>> +##
>> +## Distributed under GPL v2 license
>> +## (c) RadosA?aw Smogura, 2011
>> +
>> +# Prefix added for variable
>> +CFG_PREFIX="HACK_OPTIM"
>> +
>> +KCFG="Kconfig.debug.optim"
>> +MKFI="Makefile.optim.inc"
>
> How about names that mean something?
>
> KCONFIG=...
> MAKEFILE=...
>
>> +
>> +OPTIMIZATIONS_PARAMS="-fno-inline-functions-called-once \
>> + -fno-combine-stack-adjustments \
>> + -fno-tree-dce \
>> + -fno-tree-dominator-opts \
>> + -fno-dse "
>
> Slashes at end of lines are not necessary here.
>
>> +
>> +echo "# This file was auto generated. It's utility configuration" > 
>> $KCFG
>> +echo "# Distributed under GPL v2 License" >> $KCFG
>> +echo >> $KCFG
>> +echo "menuconfig ${CFG_PREFIX}" >> $KCFG
>> +echo -e "\tbool \"Allows to override GCC optimization\"" >> $KCFG
>> +echo -e "\tdepends on DEBUG_KERNEL && EXPERIMENTAL" >> $KCFG
>> +echo -e "\thelp" >> $KCFG
>> +echo -e "\t  If you say Y here you will be able to override" >> 
>> $KCFG
>> +echo -e "\t  how GCC optimize kernel code. This will create" >> 
>> $KCFG
>> +echo -e "\t  more debug friendly, but with not guarentee"    >> 
>> $KCFG
>> +echo -e "\t  about same runi, like production, kernel."      >> 
>> $KCFG
>> +echo >> $KCFG
>> +echo -e "\t  If you say Y here probably You will want say"   >> 
>> $KCFG
>> +echo -e "\t  for all suboptions" >> $KCFG
>> +echo >> $KCFG
>> +echo "if ${CFG_PREFIX}" >> $KCFG
>> +echo >> $KCFG
>
> Use:
>
> cat > $KCFG <<EOF
> ...
> EOF
>
> through the file (of course, in next runs you'll need to use a??>> 
> $KCFGa??).
> More readable and also a??-ea?? argument to echo is bash-specific.
>
> Alternatively to using a??> $KCFGa?? all the time, you can also do:
>
> exec 3> Kconfig.debug.optim
> exec 4> Makefile.optim.inc
>
> at the beginning of the script and later use >&3 and >&4, which will 
> save
> you some open/close calls and make the strangely named $KCFG and 
> $MKFI
> variables no longer needed.
>
>> +
>> +echo "# This file was auto generated. It's utility configuration" > 
>> $MKFI
>> +echo "# Distributed under GPL v2 License" >> $MKFI
>> +echo >> $MKFI
>> +
>> +# Insert standard override optimization level
>> +# This is exception, and this value will not be included
>> +# in auto generated makefile. Support for this value
>> +# is hard coded in main Makefile.
>> +echo -e "config ${CFG_PREFIX}_FORCE_O1_LEVEL" >> $KCFG
>> +echo -e "\tbool \"Forces -O1 optimization level\"" >> $KCFG
>> +echo -e "\t---help---" >> $KCFG
>> +echo -e "\t  This will change how GCC optimize code. Code" >> $KCFG
>> +echo -e "\t  may be slower and larger but will be more debug" >> 
>> $KCFG
>> +echo -e "\t  \"friendly\"." >> $KCFG
>> +echo >> $KCFG
>> +echo -e "\t  In some cases there is low chance that kernel" >> 
>> $KCFG
>> +echo -e "\t  will run different then normal, reporting or not" >> 
>> $KCFG
>> +echo -e "\t  some bugs or errors. Refere to GCC manual for" >> 
>> $KCFG
>> +echo -e "\t  more details." >> $KCFG
>> +echo >> $KCFG
>> +echo -e "\t  You SHOULD say N here." >> $KCFG
>> +echo >> $KCFG
>> +
>> +for o in $OPTIMIZATIONS_PARAMS ; do
>> +	cfg_o="${CFG_PREFIX}_${o//-/_}";
>
> cfg_o=$CFG_PREFIX_$(echo "$o" | tr '[:lower:]-' '[:upper:]_')
>
>> +	echo "Processing param ${o} config variable will be $cfg_o";
>> +
>> +	# Generate kconfig entry
>> +	echo -e "config ${cfg_o}" >> $KCFG
>> +	echo -e "\tbool \"Adds $o parameter to gcc invoke line.\"" >> 
>> $KCFG
>> +	echo -e "\t---help---" >> $KCFG
>> +	echo -e "\t  This will change how GCC optimize code. Code" >> 
>> $KCFG
>> +	echo -e "\t  may be slower and larger but will be more debug" >> 
>> $KCFG
>> +	echo -e "\t  \"friendly\"." >> $KCFG
>> +	echo >> $KCFG
>> +	echo -e "\t  In some cases there is low chance that kernel" >> 
>> $KCFG
>> +	echo -e "\t  will run different then normal, reporting or not" >> 
>> $KCFG
>> +	echo -e "\t  some bugs or errors. Refere to GCC manual for" >> 
>> $KCFG
>> +	echo -e "\t  more details." >> $KCFG
>> +	echo >> $KCFG
>> +	echo -e "\t  You SHOULD say N here." >> $KCFG
>> +	echo >> $KCFG
>> +
>> +	#Generate Make for include
>> +	echo "ifdef CONFIG_${cfg_o}" >> $MKFI
>> +	echo -e "\tKBUILD_CFLAGS += $o" >> $MKFI
>> +	echo "endif" >> $MKFI
>> +	echo  >> $MKFI
>> +done;
>> +echo "endif #${CFG_PREFIX}" >> $KCFG

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-02-16 20:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 14:31 Radosław Smogura
2012-02-16 14:31 ` [PATCH 02/18] Change of refcounting method for compound pages and atomic heads Radosław Smogura
2012-02-16 14:31 ` [PATCH 03/18] Compound read / write locking aka get / put Radosław Smogura
2012-02-16 14:31 ` [PATCH 04/18] Page flag for tracking compound deque Radosław Smogura
2012-02-16 14:31 ` [PATCH 05/18] Various VM_BUG_ON for securing tail pages usage Radosław Smogura
2012-02-16 14:31 ` [PATCH 06/18] Make migrate pages fucntion more flexible Radosław Smogura
2012-02-16 14:31 ` [PATCH 07/18] Configuration menu for Huge Page Cache Radosław Smogura
2012-02-16 14:31 ` [PATCH 08/18] Generic routines for defragmenting pagecache Radosław Smogura
2012-02-16 14:31 ` [PATCH 09/18] Allowing usage of MAP_HUGETLB in mmap Radosław Smogura
2012-02-16 14:31 ` [PATCH 10/18] Support for huge page faulting Radosław Smogura
2012-02-16 14:31 ` [PATCH 11/18] Basic support (faulting) for huge pages for shmfs Radosław Smogura
2012-02-16 14:31 ` [PATCH 12/18] Additional macros for pmd operations Radosław Smogura
2012-02-16 14:31 ` [PATCH 13/18] Zapping and freeing huge mappings Radosław Smogura
2012-02-16 14:31 ` [PATCH 14/18] Fixes for proc memory Radosław Smogura
2012-02-16 14:31 ` [PATCH 15/18] Splitting and truncating Radosław Smogura
2012-02-16 14:31 ` [PATCH 16/18] SHM: Support for splitting on truncation Radosław Smogura
2012-02-16 14:31 ` [PATCH 17/18] [Experimental] Support for huge pages in EXT 4 Radosław Smogura
2012-02-16 14:31 ` [PATCH 18/18] [WIP] Dummy patch for details Radosław Smogura
2012-02-16 15:44 ` [PATCH 01/18] Added hacking menu for override optimization by GCC Randy Dunlap
2012-02-16 16:11   ` Radosław Smogura
2012-02-16 19:09 ` Michal Nazarewicz
2012-02-16 20:26   ` Radosław Smogura [this message]
2012-02-16 21:59     ` Michal Nazarewicz
2012-02-16 22:40       ` Radosław Smogura
2012-02-16 23:11         ` Michal Nazarewicz
2012-02-17 14:33           ` [PATCH] " Radosław Smogura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76ede790fcc4ab73f969761034554e92@rsmogura.net \
    --to=mail@smogura.eu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mina86@mina86.com \
    --cc=xiaoqiangnk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox