1. 05 11月, 2009 2 次提交
  2. 02 10月, 2009 1 次提交
  3. 23 9月, 2009 1 次提交
  4. 22 9月, 2009 1 次提交
  5. 18 9月, 2009 2 次提交
    • S
      vsnprintf: remove duplicate comment of vsnprintf · 0efb4d20
      Steven Rostedt 提交于
      Remove the duplicate comment of bstr_printf that is the same as the
      vsnprintf.
      
      Add the 's' option to the comment for the pointer function. This is
      more of an internal function so the little duplication of the comment
      here is OK.
      Reported-by: NZhaolei <zhaolei@cn.fujitsu.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      0efb4d20
    • S
      vsprintf: add %ps that is the same as %pS but is like %pf · 91adcd2c
      Steven Rostedt 提交于
      On PowerPC64 function pointers do not point directly at the functions,
      but instead point to pointers to the functions. The output of %pF expects
      to point to a pointer to the function, whereas %pS will show the function
      itself.
      
      mcount returns the direct pointer to the function and not the pointer to
      the pointer. Thus %pS must be used to show this. The function tracer
      requires printing of the functions without offsets and uses the %pf
      instead.
      
       %pF produces run_local_timers+0x4/0x1f
       %pf produces just run_local_timers
      
      For PowerPC64, we need to use the direct pointer, and we only have
      %pS which will produce .run_local_timers+0x4/0x1f
      
      This patch creates a %ps that matches the %pf as %pS matches %pF.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      91adcd2c
  6. 29 8月, 2009 1 次提交
  7. 30 4月, 2009 1 次提交
    • F
      vsprintf: introduce %pf format specifier · 0c8b946e
      Frederic Weisbecker 提交于
      A printf format specifier which would allow us to print a pure
      function name has been suggested by Andrew Morton a couple of
      months ago.
      
      The current %pF is very convenient to print a function symbol,
      but often we only want to print the name of the function, without
      its asm offset.
      
      That's what  %pf does in this patch.  The lowecase f has been chosen
      for its intuitive meaning of a 'weak kind of %pF'.
      
      The support for this new format would be welcome by the tracing code
      where the need to print pure function names is often needed. This is
      also true for other parts of the kernel:
      
      $ git-grep -E "kallsyms_lookup\(.+?\)"
      arch/blackfin/kernel/traps.c:   symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
      arch/powerpc/xmon/xmon.c:               name = kallsyms_lookup(pc, &size, &offset, NULL, tmpstr);
      arch/sh/kernel/cpu/sh5/unwind.c:        sym = kallsyms_lookup(pc, NULL, &offset, NULL, namebuf);
      arch/x86/kernel/ftrace.c:       kallsyms_lookup((unsigned long) syscall, NULL, NULL, NULL, str);
      kernel/kprobes.c:               sym = kallsyms_lookup((unsigned long)p->addr, NULL,
      kernel/lockdep.c:       return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup((unsigned long)rec->ops->func, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, &modname, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(*ptr, NULL, NULL, NULL, str);
      kernel/trace/trace_functions.c: kallsyms_lookup(ip, NULL, NULL, NULL, str);
      kernel/trace/trace_output.c:    kallsyms_lookup(address, NULL, NULL, NULL, str);
      
      Changes in v2:
      
      - Add the explanation of the %pf role for vsnprintf() and bstr_printf()
      
      - Change the comments by dropping the "asm offset" notion and only
        define the %pf against the actual function offset notion.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NMike Frysinger <vapier@gentoo.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090415154817.GC5989@nowhere>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0c8b946e
  8. 08 4月, 2009 2 次提交
  9. 14 3月, 2009 2 次提交
  10. 10 3月, 2009 1 次提交
    • F
      vsprintf: fix bug in negative value printing · 39e874f8
      Frederic Weisbecker 提交于
      Sitsofe Wheeler found and bisected that while unifying the
      vsprintf format decoding in:
      
        fef20d9c: vsprintf: unify the format decoding layer for its 3 users
      
      The sign flag has been dropped out in favour of
      precise types (ie: LONG/ULONG).
      
      But the format helper number() still needs this flag to keep track of
      the signedness unless it will consider all numbers as unsigned.
      
      Also add an explicit cast to int (for %d) while parsing with va_arg()
      to ensure the highest bit is well extended on the 64 bits number that
      hosts the value in case of negative values.
      Reported-Bisected-Tested-by: NSitsofe Wheeler <sitsofe@yahoo.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <20090309201503.GA5010@nowhere>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      39e874f8
  11. 07 3月, 2009 2 次提交
    • F
      vsprintf: unify the format decoding layer for its 3 users · fef20d9c
      Frederic Weisbecker 提交于
      An new optimization is making its way to ftrace. Its purpose is to
      make trace_printk() consuming less memory and be faster.
      
      Written by Lai Jiangshan, the approach is to delay the formatting
      job from tracing time to output time.
      
      Currently, a call to trace_printk() will format the whole string and
      insert it into the ring buffer. Then you can read it on /debug/tracing/trace
      file.
      
      The new implementation stores the address of the format string and
      the binary parameters into the ring buffer, making the packet more compact
      and faster to insert.
      Later, when the user exports the traces, the format string is retrieved
      with the binary parameters and the formatting job is eventually done.
      
      The new implementation rewrites a lot of format decoding bits from
      vsnprintf() function, making now 3 differents functions to maintain
      in their duplicated parts of printf format decoding bits.
      
      Suggested by Ingo Molnar, this patch tries to factorize the most
      possible common bits from these functions.
      The real common part between them is the format decoding. Although
      they do somewhat similar jobs, their way to export or import the parameters
      is very different. Thus, only the decoding layer is extracted, unless you see
      other parts that could be worth factorized.
      
      Changes in V2:
      
      - Address a suggestion from Linus to group the format_decode() parameters inside
        a structure.
      
      Changes in v3:
      
      - Address other cleanups suggested by Ingo and Linus such as passing the
        printf_spec struct to the format helpers: pointer()/number()/string()
        Note that this struct is passed by copy and not by address. This is to
        avoid side effects because these functions often change these values and the
        changes shoudn't be persistant when a callee helper returns.
        It would be too risky.
      
      - Various cleanups (code alignement, switch/case instead of if/else fountains).
      
      - Fix a bug that printed the first format specifier following a %p
      
      Changes in v4:
      
      - drop unapropriate const qualifier loss while casting fmt to a char *
        (thanks to Vegard Nossum for having pointed this out).
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-6-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fef20d9c
    • L
      vsprintf: add binary printf · 4370aa4a
      Lai Jiangshan 提交于
      Impact: add new APIs for binary trace printk infrastructure
      
      vbin_printf(): write args to binary buffer, string is copied
      when "%s" is occurred.
      
      bstr_printf(): read from binary buffer for args and format a string
      
      [fweisbec@gmail.com: rebase]
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <1236356510-8381-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4370aa4a
  12. 07 1月, 2009 1 次提交
  13. 04 1月, 2009 1 次提交
  14. 25 11月, 2008 1 次提交
  15. 04 11月, 2008 1 次提交
  16. 30 10月, 2008 2 次提交
  17. 29 10月, 2008 1 次提交
  18. 28 10月, 2008 1 次提交
  19. 21 10月, 2008 1 次提交
  20. 17 10月, 2008 5 次提交
  21. 10 9月, 2008 2 次提交
  22. 13 8月, 2008 1 次提交
  23. 07 7月, 2008 4 次提交
    • L
      vsprintf: add support for '%pS' and '%pF' pointer formats · 0fe1ef24
      Linus Torvalds 提交于
      They print out a pointer in symbolic format, if possible (ie using
      symbolic KALLSYMS information).  The '%pS' format is for regular direct
      pointers (which can point to data or code and that you find on the stack
      during backtraces etc), while '%pF' is for C function pointer types.
      
      On most architectures, the two mean exactly the same thing, but some
      architectures use an indirect pointer for C function pointers, where the
      function pointer points to a function descriptor (which in turn contains
      the actual pointer to the code).  The '%pF' code automatically does the
      appropriate function descriptor dereference on such architectures.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0fe1ef24
    • L
      vsprintf: add infrastructure support for extended '%p' specifiers · 4d8a743c
      Linus Torvalds 提交于
      This expands the kernel '%p' handling with an arbitrary alphanumberic
      specifier extension string immediately following the '%p'.  Right now
      it's just being ignored, but the next commit will start adding some
      specific pointer type extensions.
      
      NOTE! The reason the extension is appended to the '%p' is to allow
      minimal gcc type checking: gcc will still see the '%p' and will check
      that the argument passed in is indeed a pointer, and yet will not
      complain about the extended information that gcc doesn't understand
      about (on the other hand, it also won't actually check that the pointer
      type and the extension are compatible).
      
      Alphanumeric characters were chosen because there is no sane existing
      use for a string format with a hex pointer representation immediately
      followed by alphanumerics (which is what such a format string would have
      traditionally resulted in).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4d8a743c
    • L
      vsprintf: split out '%p' handling logic · 78a8bf69
      Linus Torvalds 提交于
      The actual code is the same, just split out into a helper function.
      This makes it easier to read, and allows for simple future extension
      of %p handling.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      78a8bf69
    • L
      vsprintf: split out '%s' handling logic · 0f9bfa56
      Linus Torvalds 提交于
      The actual code is the same, just split out into a helper function.
      This makes it easier to read, and allows for future sharing of the
      string code.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0f9bfa56
  24. 24 2月, 2008 1 次提交
  25. 10 2月, 2008 1 次提交
    • D
      x86: trivial printk optimizations · 9b706aee
      Denys Vlasenko 提交于
      In arch/x86/boot/printf.c gets rid of unused tail of digits: const char
      *digits = "0123456789abcdefghijklmnopqrstuvwxyz"; (we are using 0-9a-f
      only)
      
      Uses smaller/faster lowercasing (by ORing with 0x20)
      if we know that we work on numbers/digits. Makes
      strtoul smaller, and also we are getting rid of
      
        static const char small_digits[] = "0123456789abcdefx";
        static const char large_digits[] = "0123456789ABCDEFX";
      
      since this works equally well:
      
        static const char digits[16] = "0123456789ABCDEF";
      
      Size savings:
      
      $ size vmlinux.org vmlinux
         text    data     bss     dec     hex filename
       877320  112252   90112 1079684  107984 vmlinux.org
       877048  112252   90112 1079412  107874 vmlinux
      
      It may be also a tiny bit faster because code has less
      branches now, but I doubt it is measurable.
      
      [ hugh@veritas.com: uppercase pointers fix ]
      Signed-off-by: NDenys Vlasenko <vda.linux@googlemail.com>
      Cc: Andi Kleen <ak@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      9b706aee
  26. 09 2月, 2008 1 次提交
    • Y
      Add new string functions strict_strto* and convert kernel params to use them · 06b2a76d
      Yi Yang 提交于
      Currently, for every sysfs node, the callers will be responsible for
      implementing store operation, so many many callers are doing duplicate
      things to validate input, they have the same mistakes because they are
      calling simple_strtol/ul/ll/uul, especially for module params, they are
      just numeric, but you can echo such values as 0x1234xxx, 07777888 and
      1234aaa, for these cases, module params store operation just ignores
      succesive invalid char and converts prefix part to a numeric although input
      is acctually invalid.
      
      This patch tries to fix the aforementioned issues and implements
      strict_strtox serial functions, kernel/params.c uses them to strictly
      validate input, so module params will reject such values as 0x1234xxxx and
      returns an error:
      
      write error: Invalid argument
      
      Any modules which export numeric sysfs node can use strict_strtox instead of
      simple_strtox to reject any invalid input.
      
      Here are some test results:
      
      Before applying this patch:
      
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0x1000 > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0x1000g > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0x1000gggggggg > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 010000 > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0100008 > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 010000aaaaa > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]#
      
      After applying this patch:
      
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0x1000 > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0x1000g > /sys/module/e1000/parameters/copybreak
      -bash: echo: write error: Invalid argument
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo 0x1000gggggggg > /sys/module/e1000/parameters/copybreak
      -bash: echo: write error: Invalid argument
      [root@yangyi-dev /]# echo 010000 > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# echo 0100008 > /sys/module/e1000/parameters/copybreak
      -bash: echo: write error: Invalid argument
      [root@yangyi-dev /]# echo 010000aaaaa > /sys/module/e1000/parameters/copybreak
      -bash: echo: write error: Invalid argument
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]# echo -n 4096 > /sys/module/e1000/parameters/copybreak
      [root@yangyi-dev /]# cat /sys/module/e1000/parameters/copybreak
      4096
      [root@yangyi-dev /]#
      
      [akpm@linux-foundation.org: fix compiler warnings]
      [akpm@linux-foundation.org: fix off-by-one found by tiwai@suse.de]
      Signed-off-by: NYi Yang <yi.y.yang@intel.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Hugh Dickins <hugh@veritas.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      06b2a76d