Commit Graph

1293 Commits (2d74b2c62cf8867d0762f6e6b5ed8906cb6a745f)

Author SHA1 Message Date
Wu Zhangjin 2d74b2c62c scripts/Makefile.lib: Align the output of LZO
The output of LZO is not aligned with the other output:
  ...
  CC      drivers/usb/mon/usbmon.mod.o
  LZO    arch/mips/boot/compressed/vmlinux.lzo
  ...

This patch fixes it.

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-11 11:01:15 +01:00
Michal Marek e93bc1a0ca Revert "kbuild: specify absolute paths for cscope"
This reverts commit eb8f844c0a. Ian
Campbell writes:
> I keep my kernel source tree on a more powerful build box where I run my
> builds etc (including "make cscope") but run my editor from my
> workstation with an NFS mount to the source. This worked fine for me
> using relative paths for cscope. Using absolute paths in cscope breaks
> this previously working setup because the root path is not the same on
> both systems. I guess this is similar to moving the source tree around.
>
> Without wanting to start a flamewar it really sounds to me like we are
> working around a vim (or cscope) bug here, emacs with cscope bindings
> works fine in this configuration.

Given that absolute paths can be forced by make O=. cscope, change the
default back to relative paths.

Ian Campbell <ijc@hellion.org.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-08 10:26:22 +01:00
Stephen Hemminger bae4cecc09 headers_install: use local file handles
Better practice to use 3 arg open and local file handles.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: WANG Cong <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:43:49 +01:00
Stephen Hemminger dbbe33e99f headers_check: fix perl warnings
According to PBP; best way practice is to use local reference for file
handle and three argument open. Also perl prototypes are a mistake.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: WANG Cong <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:43:07 +01:00
Stephen Hemminger 91416cfdf9 export_report: fix perl warnings
Use local file handles, use three argument open.
Don't modify arguments in perl grep (use sed instead)

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: WANG Cong <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:41:04 +01:00
Stephen Hemminger 9c49fd307a profile2linkerlist: fix perl warnings
Turn on strict checking.
Simplify code by using "unless" statement.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: WANG Cong <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:39:33 +01:00
Stephen Hemminger 86d08e569f namespace: perlcritic warnings
Use local file handle not global.
Make loop and other variables local in scope.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Hui Zhu <teawater@gmail.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:38:32 +01:00
Stephen Hemminger a208868fc0 checkversion: perl cleanup
Turn on strict checking.
Use three arguement open
Standard practice in perl is to use undef not zero for false

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:22:56 +01:00
Stephen Hemminger 3da2715731 checkincludes: fix perlcritic warnings
Turn on strict checking.
Use local file handles.
Use three argument open.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:19:57 +01:00
Stephen Hemminger 1f2a144f5a scripts: improve checkstack
Cleanup checkstack script:
  * Turn on strict checking
  * Fix resulting error message because the declaration syntax
    was incorrect.
  * Remove incorrect and misleading use of prototype
     - prototype not required for this type of sort function
       because $a and $b are being used in this contex
     - if prototype was being used it should be for both arguments
  * Use closure for sort function

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Cong Wang <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 21:19:09 +01:00
FEJES Jozsef b59a122584 kbuild: deb-pkg md5sums
This patch creates the standard md5sums file for 'make deb-pkg' just
like the dh_md5sums debhelper script.

Signed-off-by: Jozsef Fejes <fejes@joco.name>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07 13:33:00 +01:00
John Kacur bc75cc6b56 tags: Add the ability to make tags for all archs using "all"
make ALLSOURCE_ARCHS=all tags
- Document this in kbuild.txt
Without this change you have to type each arch separately.

Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-03 10:47:09 +01:00
John Kacur 4431d4ce99 tags: Fix spelling error in comment (is->if)
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-03 10:45:22 +01:00
Michal Marek a8bac511c8 tags: Use $SRCARCH
$ make mrproper
$ make tags
  GEN     tags
  find: `arch/x86_64/': No such file or directory

Caused by commit f81b1be (tags: include headers before source files)

Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-22 11:23:23 +01:00
Guennadi Liakhovetski f81b1be40c tags: include headers before source files
Currently looking up a structure definition in TAGS / tags takes one to
one of multiple "static struct X" definitions in arch sources, which makes
it for many structs practically impossible to get to the required header.
This patch changes the order of sources being tagged to first scan
architecture includes, then the top-level include/ directory, and only
then the rest. It also takes into account, that many architectures have
more than one include directory, i.e., not only arch/$ARCH/include, but
also arch/$ARCH/mach-X/include etc.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
[mmarek@suse.cz: fix 'var+=text' bashism]
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-17 13:59:13 +01:00
Hui Zhu 59dde3853e markup_oops.pl: minor fixes
1. Fix a little format issue.
2. Check the return of "Getopt::Long::GetOptions".  Output usage and
   exit if it get error.
3. Change $ARGV[$#ARGV] to $ARGV[0].
4. Change the code which get $modulefile from modinfo.  Replace the
   pipeline with `modinfo -F filename $module`.
4. Change usage from "Specify the module directory name" to "Specify the
   module filename".

Signed-off-by: Hui Zhu <teawater@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-05 22:33:43 +01:00
Hui Zhu 52e13e219d markup_oops.pl: add options to improve cross-sompilation environments
The markup_oops.pl have 3 troubles to support cross-compiler environment:
1.  It use objdump directly.
2.  It use modinfo to get the message of module.
3.  It use hex function that cannot support 64-bit number in 32-bit arch.

This patch add 3 options to markup_oops.pl:
1. -c CROSS_COMPILE	Specify the prefix used for toolchain.
2. -m MODULE_DIRNAME	Specify the module directory name.
3. Change hex function to Math::BigInt->from_hex.

After this patch, parse the x8664 oops in x86, we can:
cat amd64m | perl ~/kernel/tmp/m.pl -c /home/teawater/kernel/bin/x8664- -m ./e.ko vmlinux

Thanks,
Hui

Signed-off-by: Hui Zhu <teawater@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: ozan@pardus.org.tr
Cc: Matthew Wilcox <willy@linux.intel.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-05 22:32:23 +01:00
Michal Marek d224a94ab9 Merge branch 'modpost' of git://git.pengutronix.de/git/ukl/linux-2.6 into kbuild/for-next
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 16:21:08 +01:00
John Saalwaechter 880df92fa0 scripts: use %_tmppath in "make rpm-pkg"
The mkspec script hardcodes "/var/tmp" into the generated rpm spec file's
BuildRoot. The user, however, may have a custom setting for %_tmppath,
which should be used in BuildRoot.  This patch changes mkspec's
BuildRoot output to appropriately use %_tmppath.

Signed-off-by: John Saalwaechter <saalwaechter@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:56 +01:00
Hui Zhu 0139f1d953 markup_oops.pl: fix for faulting instruction in the first line of a range
I got a "No matching code found" when I use markup_oops.pl parse a error
in a x86_64 module.

cat e.c

int init_module(void)
{
	char	*buf = 0;

	buf[0] = 3;

	return 0;
}

void cleanup_module(void)
{
	//char	*buf = 0;

	//buf[0] = 3;
}

MODULE_AUTHOR("Hui Zhu");
MODULE_LICENSE("GPL");

0000000000000000 <init_module>:
init_module():
/home/teawater/study/kernel/stack2core/example/e.c:10
   0:	c6 04 25 00 00 00 00 	movb   $0x3,0x0
   7:	03
/home/teawater/study/kernel/stack2core/example/e.c:13
   8:	31 c0                	xor    %eax,%eax
   a:	c3                   	retq
   b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

0000000000000010 <cleanup_module>:
cleanup_module():
/home/teawater/study/kernel/stack2core/example/e.c:20
  10:	f3 c3                	repz retq
  12:	90                   	nop
  13:	90                   	nop
Disassembly of section .modinfo:

This is because the faulting instruction "movb   $0x3,0x0" is the first
line of the range.

In the markup_oops.pl:
main::(./scripts/markup_oops.pl:245):
245:				if (InRange($1, $target)) {
  DB<2> p $line
ffffffffa001b000:	c6 04 25 00 00 00 00 	movb   $0x3,0x0
  DB<3> p $counter
0

It just set $center in next loop. So it cannot get the $center.

And even if $center is set to the right value 0.
if ($center == 0) {
	print "No matching code found \n";
	exit;
}
The first line $center will be 0, so I change the default value to -1.

Signed-off-by: Hui Zhu <teawater@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:56 +01:00
Don Zickus 94a4708352 scripts: change scripts to use system python instead of env
Just a small change to a couple of scripts to go from

 #!/usr/bin/env python

to

 #!/usr/bin/python

This shouldn't effect anyone, unless they don't install python there.

In preparation for python3, Fedora is doing a big push to change the scripts
to use the system python.  This allows developers to put the python3 in
their path without fear of breaking existing scripts.

Now I am pretty sure anyone using python3 for testing purposes will probably
not run any of the scripts I changed, but Fedora has this automated tool
that checks for this stuff so I thought I would try to push it upstream.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:56 +01:00
Himanshu Chauhan 71d41aed94 scripts/kallsyms: suppress build warning
Suppress a warn_unused_result warning.

fgets is called as a part of error handling.  It is called just to drop a
line and return immediately.  read_map is reading the file in a loop and
read_symbol reads line by line.  So I think there is no point in using
return value for useful checking.  Other checks like 3 items were returned
or !EOF have already been done.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:56 +01:00
Michal Marek d4987bd7ae scripts/mkcompile_h: don't test for hardcoded paths
Don't test for /bin/{dnsdomainname,domainname}, simply try to execute
the command and check if it returned something.

Reported-by: Glenn Sommer <glemsom@gmail.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Tested-by: Glenn Sommer <glemsom@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:56 +01:00
Andi Kleen e66f25d7d1 Improve kconfig symbol hashing
While looking for something else I noticed that the symbol
hash function used by kconfig is quite poor. It doesn't
use any of the standard hash techniques but simply
adds up the string and then uses power of two masking,
which is both known to perform poorly.

The current x86 kconfig has over 7000 symbols.

When I instrumented it showed that the minimum hash chain
length was 16 and a significant number of them was over
30.

It didn't help that the hash table size was only 256 buckets.

This patch increases the hash table size to a larger prime
and switches to a FNV32 hash. I played around with a couple of hash
functions, but that one seemed to perform best with reasonable
hash table sizes.

Increasing the hash table size even further didn't
seem like a good idea, because there are a couple of global
walks which walk the complete hash table.

I also moved the unnamed bucket to 0. It's still the longest
of all the buckets (44 entries), but hopefully it's not
often hit except for the global walk which doesn't care.

The result is a much nicer distribution:
(first column bucket length, second number of buckets with that length)

1: 3505
2: 1236
3: 294
4: 52
5: 3
47: 1		<--- this is the unnamed symbols bucket

There are still some 5+ buckets, but increasing the hash table
even more would be likely not worth it.

This also cleans up the code slightly by removing hard coded
magic numbers.

I didn't notice a big performance difference either way
on my Nehalem system, but I presume it'll help somewhat
on slower systems.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:55 +01:00
Nir Tzachar 68c16edddf nconfig: minor fix
This patch fixes two problems reported by Jan Engelhardt:
1) Border is now properly placed, to always be visible
2) Long menu items are properly displayed

Reported-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:55 +01:00
Michal Marek 851190c930 nconfig: mark local functions as such
scripts/kconfig/nconf.gui.c:23: warning: no previous prototype for 'set_normal_colors'
scripts/kconfig/nconf.gui.c:68: warning: no previous prototype for 'normal_color_theme'
scripts/kconfig/nconf.gui.c💯 warning: no previous prototype for 'no_colors_theme'
scripts/kconfig/nconf.c:455: warning: no previous prototype for 'process_special_keys'
scripts/kconfig/nconf.c:487: warning: no previous prototype for 'get_next_hot'
scripts/kconfig/nconf.c:506: warning: no previous prototype for 'canbhot'
scripts/kconfig/nconf.c:514: warning: no previous prototype for 'is_hot'
scripts/kconfig/nconf.c:522: warning: no previous prototype for 'make_hot'
scripts/kconfig/nconf.c:582: warning: no previous prototype for 'item_make'
scripts/kconfig/nconf.c:626: warning: no previous prototype for 'item_add_str'
scripts/kconfig/nconf.c:656: warning: no previous prototype for 'item_tag'
scripts/kconfig/nconf.c:668: warning: no previous prototype for 'curses_item_index'
scripts/kconfig/nconf.c:673: warning: no previous prototype for 'item_data'
scripts/kconfig/nconf.c:684: warning: no previous prototype for 'item_is_tag'
scripts/kconfig/nconf.c:691: warning: no previous prototype for 'set_config_filename'

Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:55 +01:00
nir.tzachar@gmail.com 692d97c380 kconfig: new configuration interface (nconfig)
This patch was inspired by the kernel projects page, where an ncurses
replacement for menuconfig was mentioned (by Sam Ravnborg).

Building on menuconfig, this patch implements a more modern look
interface using ncurses and ncurses' satellite libraries (menu, panel,
form). The implementation does not depend on lxdialog, which is
currently distributed with the kernel.

Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:55 +01:00
Alexander Beregalov c64152bfd0 genksyms: close ref_file after use
It is the last place when the file is read, so close it.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:55 +01:00
Vadim Bendebury (вб) da60fbbcb6 menuconfig: wrap long help lines
Help text for certain config options is very extensive (the text
includes the names of all  other options the option in question depends
on). Long lines are not wrapped, making it impossible to see the list
without scrolling horizontally.

This patch adds some logic which wraps help screen lines at word
boundaries to prevent truncating.

Tested by running

  ARCH=powerpc make menuconfig O=/tmp/build

which shows that the long lines are now wrapped, and

 ARCH=powerpc make xconfig O=/tmp/build

to demonstrate that it still compiles and operates as expected.

Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:55 +01:00
Rabin Vincent 5358db0b0e scripts: add ARM support to decodecode
This patch adds support for decoding ARM oopses to scripts/decodecode.
The following things are handled:

 - ARCH and CROSS_COMPILE environment variables are respected.

 - The Code: in x86 oopses is in bytes, while it is in either words (4
   bytes) or halfwords for ARM.

 - Some versions of ARM objdump refuse to disassemble instructions
   generated by literal constants (".word 0x...").  The workaround is to
   strip the object file first.

 - The faulting instruction is marked (liked so) in ARM, but <like so>
   in x86.

 - ARM mnemonics may include characters such as [] which need to be
   escaped before being passed to sed for the "<- trapping instruction"
   substitution.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:54 +01:00
Jiafu He 4b024242e8 kbuild: Fix linking error built-in.o no such file or directory
This patch fixes the link error "built-in.o: no such file or directory".
The problem happens if "dirx/Makefile" contains only "obj-m += diry/
dirz/" and the empty "dirx/built-in.o" is missing. Adding $(subdir-m)
into check for builtin-target fixes this error.

Signed-off-by: Jiafu He <jay@goldhive.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-02-02 14:33:54 +01:00
Uwe Kleine-König 0db2524523 modpost: don't allow *driver to reference .init.*
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-30 21:14:23 +01:00
Uwe Kleine-König af92a82d0f modpost: make symbol white list a per mismatch type variable
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-30 20:52:50 +01:00
Uwe Kleine-König fc2f7efadb modpost: remove now unused NO_MISMATCH constant
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-30 17:23:34 +01:00
Uwe Kleine-König 0d2a636ee6 modpost: pass around const struct sectioncheck * instead of enum mismatch
This prepares having a per-check whitelist of symbol names.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-30 17:20:52 +01:00
Uwe Kleine-König bbd3f4fb84 modpost: give most mismatch constants a better name
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-30 16:54:30 +01:00
Uwe Kleine-König 4a31a229fb modpost: define ALL_XXX{IN,EX}IT_SECTIONS
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-29 21:57:00 +01:00
Uwe Kleine-König b75dcabd6c modpost: members of *driver structs should not point to __init functions
Either the functions referred to in a driver struct should live in
.devinit or the driver should be registered using platform_driver_probe
(or equivalent for different driver types) with ->probe being NULL.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2010-01-29 21:56:55 +01:00
Mike Frysinger 3a5dd791ab modpost: fix segfault in sym_is() with prefixed arches
The sym_is() compares a symbol in an attempt to automatically skip symbol
prefixes.  It does this first by searching the real symbol with the normal
unprefixed symbol.  But then it uses the length of the original symbol to
check the end of the substring instead of the length of the symbol it is
looking for.  On non-prefixed arches, this is effectively the same thing,
so there is no problem.  On prefixed-arches, since this is exceeds by just
one byte, a crash is rare and it is usually a NUL byte anyways.  But every
once in a blue moon, you get the right page alignment and it segfaults.

For example, on the Blackfin arch, sym_is() will be called with the real
symbol "___mod_usb_device_table" as "symbol" when looking for the normal
symbol "__mod_usb_device_table" as "name".  The substring will thus return
one byte into "symbol" and store it into "match".  But then "match" will
be indexed with the length of "symbol" instead of "name" and so we will
exceed the storage.  i.e. the code ends up doing:
	char foo[] = "abc"; return foo[strlen(foo)+1] == '\0';

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-17 11:00:53 -08:00
Linus Torvalds 6ccc347b69 Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  tracing/filters: Add comment for match callbacks
  tracing/filters: Fix MATCH_FULL filter matching for PTR_STRING
  tracing/filters: Fix MATCH_MIDDLE_ONLY filter matching
  lib: Introduce strnstr()
  tracing/filters: Fix MATCH_END_ONLY filter matching
  tracing/filters: Fix MATCH_FRONT_ONLY filter matching
  ftrace: Fix MATCH_END_ONLY function filter
  tracing/x86: Derive arch from bits argument in recordmcount.pl
  ring-buffer: Add rb_list_head() wrapper around new reader page next field
  ring-buffer: Wrap a list.next reference with rb_list_head()
2010-01-16 12:27:25 -08:00
Hui Zhu 1f8cdae439 markup_oops.pl: fix error with x86
When I try to use markup_oops.pl in x86, I always get:

cat 1 | perl markup_oops.pl ./vmlinux
objdump: --start-address: bad number: NaN
No matching code found

This is because in line:
	if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+0x([0-9a-f]+)\/[a-f0-9]/) {
 		$function = $1;
 		$func_offset = $2;
 	}

$func_offset will get a number like "0x2"

But in follow code:

my $decodestart = Math::BigInt->from_hex("0x$target") -
Math::BigInt->from_hex("0x$func_offset");

It add other ox to ox2.  Then this value will be set to NaN.

So I made a small patch to fix it.

Signed-off-by: Hui Zhu <teawater@gmail.com>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-16 12:15:37 -08:00
Jonathan Nieder 1373411ae4 kbuild: really fix bzImage build with non-bash sh
In an x86 build with CONFIG_KERNEL_LZMA enabled and dash as sh,
arch/x86/boot/compressed/vmlinux.bin.lzma ends with
'\xf0\x7d\x39\x00' (16 bytes) instead of the 4 bytes intended and
the resulting vmlinuz fails to boot.  This improves on the
previous behavior, in which the file contained the characters
'-ne ' as well, but not by much.

Previous commits replaced "echo -ne" first with "/bin/echo -ne",
then "printf" in the hope of improving portability, but none of
these commands is guaranteed to support hexadecimal escapes on
POSIX systems.  So use the shell to convert from hexadecimal to
octal.

With this change, an LZMA-compressed kernel built with dash as sh
boots correctly again.

Reported-by: Sebastian Dalfuß <sd@sedf.de>
Reported-by: Oliver Hartkopp <oliver@hartkopp.net>
Reported-by: Michael Guntsche <mike@it-loops.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: Alek Du <alek.du@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-01-13 13:27:24 +01:00
Dave Jones dbf004d788 remove my email address from checkpatch.
Maybe this will stop people emailing me about it.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-12 20:56:52 -08:00
Jan Kiszka b82a4045f7 tracing/x86: Derive arch from bits argument in recordmcount.pl
Let the arch argument be overruled by bits. Otherwise, building of
external modules against a i386 target on a x86-64 host (and likely vice
versa as well) fails unless ARCH=i386 is explicitly passed to make.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
LKML-Reference: <4B4AFE10.8050109@siemens.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2010-01-11 23:49:35 -05:00
Joe Perches 272a897904 scripts/get_maintainer.pl: fix file exclusion X: logic
The following command doesn't generate any output.
`./scripts/get_maintainer.pl --no-git -f drivers/net/wireless/wl12xx/wl1271_acx.c`

An excluded "X:" pattern match in any section would cause a file not to
match any other section.

Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-11 09:34:05 -08:00
Albin Tonnerre 7dd65feb6c lib: add support for LZO-compressed kernels
This patch series adds generic support for creating and extracting
LZO-compressed kernel images, as well as support for using such images on
the x86 and ARM architectures, and support for creating and using
LZO-compressed initrd and initramfs images.

Russell King said:

: Testing on a Cortex A9 model:
: - lzo decompressor is 65% of the time gzip takes to decompress a kernel
: - lzo kernel is 9% larger than a gzip kernel
:
: which I'm happy to say confirms your figures when comparing the two.
:
: However, when comparing your new gzip code to the old gzip code:
: - new is 99% of the size of the old code
: - new takes 42% of the time to decompress than the old code
:
: What this means is that for a proper comparison, the results get even better:
: - lzo is 7.5% larger than the old gzip'd kernel image
: - lzo takes 28% of the time that the old gzip code took
:
: So the expense seems definitely worth the effort.  The only reason I
: can think of ever using gzip would be if you needed the additional
: compression (eg, because you have limited flash to store the image.)
:
: I would argue that the default for ARM should therefore be LZO.

This patch:

The lzo compressor is worse than gzip at compression, but faster at
extraction.  Here are some figures for an ARM board I'm working on:

Uncompressed size: 3.24Mo
gzip  1.61Mo 0.72s
lzo   1.75Mo 0.48s

So for a compression ratio that is still relatively close to gzip, it's
much faster to extract, at least in that case.

This part contains:
 - Makefile routine to support lzo compression
 - Fixes to the existing lzo compressor so that it can be used in
   compressed kernels
 - wrapper around the existing lzo1x_decompress, as it only extracts one
   block at a time, while we need to extract a whole file here
 - config dialog for kernel compression

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: cleanup]
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Tested-by: Wu Zhangjin <wuzhangjin@gmail.com>
Acked-by: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Russell King <rmk@arm.linux.org.uk>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-11 09:34:04 -08:00
Linus Torvalds dbfc985195 Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: (71 commits)
  MIPS: Lasat: Fix botched changes to sysctl code.
  RTC: rtc-cmos.c: Fix warning on MIPS
  MIPS: Cleanup random differences beween lmo and Linus' kernel.
  MIPS: No longer hardwire CONFIG_EMBEDDED to y
  MIPS: Fix and enhance built-in kernel command line
  MIPS: eXcite: Remove platform.
  MIPS: Loongson: Cleanups of serial port support
  MIPS: Lemote 2F: Suspend CS5536 MFGPT Timer
  MIPS: Excite: move iodev_remove to .devexit.text
  MIPS: Lasat: Convert to proc_fops / seq_file
  MIPS: Cleanup signal code initialization
  MIPS: Modularize COP2 handling
  MIPS: Move EARLY_PRINTK to Kconfig.debug
  MIPS: Yeeloong 2F: Cleanup reset logic using the new ec_write function
  MIPS: Yeeloong 2F: Add LID open event as the wakeup event
  MIPS: Yeeloong 2F: Add basic EC operations
  MIPS: Move several variables from .bss to .init.data
  MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address
  MIPS: Tracing: Reserve $12(t0) for mcount-ra-address of gcc 4.5
  MIPS: Tracing: Make ftrace for MIPS work without -fno-omit-frame-pointer
  ...
2009-12-17 16:38:06 -08:00
Linus Torvalds 5a865c0606 Merge branch 'for-33' of git://repo.or.cz/linux-kbuild
* 'for-33' of git://repo.or.cz/linux-kbuild: (29 commits)
  net: fix for utsrelease.h moving to generated
  gen_init_cpio: fixed fwrite warning
  kbuild: fix make clean after mismerge
  kbuild: generate modules.builtin
  genksyms: properly consider  EXPORT_UNUSED_SYMBOL{,_GPL}()
  score: add asm/asm-offsets.h wrapper
  unifdef: update to upstream revision 1.190
  kbuild: specify absolute paths for cscope
  kbuild: create include/generated in silentoldconfig
  scripts/package: deb-pkg: use fakeroot if available
  scripts/package: add KBUILD_PKG_ROOTCMD variable
  scripts/package: tar-pkg: use tar --owner=root
  Kbuild: clean up marker
  net: add net_tstamp.h to headers_install
  kbuild: move utsrelease.h to include/generated
  kbuild: move autoconf.h to include/generated
  drop explicit include of autoconf.h
  kbuild: move compile.h to include/generated
  kbuild: drop include/asm
  kbuild: do not check for include/asm-$ARCH
  ...

Fixed non-conflicting clean merge of modpost.c as per comments from
Stephen Rothwell (modpost.c had grown an include of linux/autoconf.h
that needed to be changed to generated/autoconf.h)
2009-12-17 07:23:42 -08:00
Wu Zhangjin 538f19526e MIPS: Tracing: Add dynamic function tracer support
With dynamic function tracer, by default, _mcount is defined as an
"empty" function, it returns directly without any more action . When
enabling it in user-space, it will jump to a real tracing
function(ftrace_caller), and do the real job for us.

Differ from the static function tracer, dynamic function tracer provides
two functions ftrace_make_call()/ftrace_make_nop() to enable/disable the
tracing of some indicated kernel functions(set_ftrace_filter).

In the -v4 version, the implementation of this support is basically the same as
X86 version does: _mcount is implemented as an empty function and ftrace_caller
is implemented as a real tracing function respectively.

But in this version, to support module tracing with the help of
-mlong-calls in arch/mips/Makefile:

MODFLAGS += -mlong-calls.

The stuff becomes a little more complex. We need to cope with two
different type of calling to _mcount.

For the kernel part, the calling to _mcount(result of "objdump -hdr
vmlinux"). is like this:

	108:   03e0082d        move    at,ra
	10c:   0c000000        jal     0 <fpcsr_pending>
                        10c: R_MIPS_26  _mcount
                        10c: R_MIPS_NONE        *ABS*
                        10c: R_MIPS_NONE        *ABS*
	110:   00020021        nop

For the module with -mlong-calls, it looks like this:

	c:	3c030000 	lui	v1,0x0
			c: R_MIPS_HI16	_mcount
			c: R_MIPS_NONE	*ABS*
			c: R_MIPS_NONE	*ABS*
	10:	64630000 	daddiu	v1,v1,0
			10: R_MIPS_LO16	_mcount
			10: R_MIPS_NONE	*ABS*
			10: R_MIPS_NONE	*ABS*
	14:	03e0082d 	move	at,ra
	18:	0060f809 	jalr	v1

In the kernel version, there is only one "_mcount" string for every
kernel function, so, we just need to match this one in mcount_regex of
scripts/recordmcount.pl, but in the module version, we need to choose
one of the two to match. Herein, I choose the first one with
"R_MIPS_HI16 _mcount".

and In the kernel verion, without module tracing support, we just need
to replace "jal _mcount" by "jal ftrace_caller" to do real tracing, and
filter the tracing of some kernel functions via replacing it by a nop
instruction.

but as we have described before, the instruction "jal ftrace_caller" only left
32bit length for the address of ftrace_caller, it will fail when calling from
the module space. so, herein, we must replace something else.

the basic idea is loading the address of ftrace_caller to v1 via changing these
two instructions:

	lui	v1,0x0
	addiu	v1,v1,0

If we want to enable the tracing, we need to replace the above instructions to:

	lui	v1, HI_16BIT_ftrace_caller
	addiu	v1, v1, LOW_16BIT_ftrace_caller

If we want to stop the tracing of the indicated kernel functions, we
just need to replace the "jalr v1" to a nop instruction. but we need to
replace two instructions and encode the above two instructions
oursevles.

Is there a simpler solution? Yes! Here it is, in this version, we put _mcount
and ftrace_caller together, which means the address of _mcount and
ftrace_caller is the same:

_mcount:
ftrace_caller:
	j	ftrace_stub
	 nop

	...(do real tracing here)...

ftrace_stub:
	jr	ra
	 move	ra, at

By default, the kernel functions call _mcount, and then jump to ftrace_stub and
return. and when we want to do real tracing, we just need to remove that "j
ftrace_stub", and it will run through the two "nop" instructions and then do
the real tracing job.

what about filtering job? we just need to do this:

	 lui v1, hi_16bit_of_mcount        <--> b 1f (0x10000004)
	 addiu v1, v1, low_16bit_of_mcount
	 move at, ra
	 jalr v1
	 nop
	 				     1f: (rec->ip + 12)

In linux-mips64, there will be some local symbols, whose name are
prefixed by $L, which need to be filtered. thanks goes to Steven for
writing the mips64-specific function_regex.

In a conclusion, with RISC, things becomes easier with such a "stupid"
trick, RISC is something like K.I.S.S, and also, there are lots of
"simple" tricks in the whole ftrace support, thanks goes to Steven and
the other folks for providing such a wonderful tracing framework!

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Nicholas Mc Guire <der.herr@hofr.at>
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/675/
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:23 +00:00
Wu Zhangjin e6299d2677 MIPS: Tracing: Add an endian argument to scripts/recordmcount.pl
MIPS and some other architectures need this argument to handle
big/little endian respectively.

Signed-off-by: Wu Zhangjin <wuzj@lemote.com>
Cc: Nicholas Mc Guire <der.herr@hofr.at>
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/674/
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:22 +00:00