免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 776 | 回复: 0
打印 上一主题 下一主题

13.Kernel hacking [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-07 22:25 |只看该作者 |倒序浏览

       
       
       
       
       
       
       
       
  • Kernel
            hacking
           
           
  • Show
                    timing information on printks PRINTK_TIME
           
    Selecting
    this option causes timing information to be
    included
    in printk output.  This allows you to measure
    the
    interval between kernel operations, including bootup
    operations.
    This is useful for identifying long delays
    in
    kernel startup.
  • Magic
                    SysRq key MAGIC_SYSRQ
           
    If
    you say Y here, you will have some control over the system even
    if
    the system crashes for example during kernel debugging (e.g., you
    will
    be able to flush the buffer cache to disk, reboot the system
    immediately
    or dump some status information). This is accomplished
    by
    pressing various keys while holding SysRq (Alt+PrintScreen). It
    also
    works on a serial console (on PC hardware at least), if you
    send
    a BREAK and then within 5 seconds a command keypress. The
    keys
    are documented in . Don't say Y
    unless
    you really know what this hack does.
  • Kernel
                    debugging DEBUG_KERNEL
           
    Say
    Y here if you are developing drivers or trying to debug and
    identify
    kernel problems.
  • Kernel
                            log buffer size (16 => 64KB, 17 => 128KB) LOG_BUF_SHIFT
                   
    Select
    kernel log buffer size as a power of 2.
    Defaults
    and Examples:
              17 => 128 KB
    for S/390
              16 => 64 KB for
    x86 NUMAQ or IA-64
              15 => 32 KB for
    SMP
              14 => 16 KB for
    uniprocessor
              13 =>  8 KB
              12 =>  4 KB
  • Detect
                            Soft Lockups DETECT_SOFTLOCKUP
                   
    Say
    Y here to enable the kernel to detect "soft lockups",
    which
    are bugs that cause the kernel to loop in kernel
    mode
    for more than 10 seconds, without giving other tasks a
    chance
    to run.
    When
    a soft-lockup is detected, the kernel will print the
    current
    stack trace (which you should report), but the
    system
    will stay locked up. This feature has negligible
    [color="#008080"]overhead.
    (Note
    that "hard lockups" are separate type of bugs that
    can be detected via the
    NMI-watchdog, on platforms that
    support it.)
  • Collect
                            scheduler statistics SCHEDSTATS
                   
    If
    you say Y here, additional code will be inserted into the
    scheduler
    and related routines to collect statistics about
    scheduler
    behavior and provide them in /proc/schedstat.  These
    stats
    may be useful for both tuning and debugging the scheduler
    If
    you aren't debugging the scheduler or trying to tune a specific
    application,
    you can say N to avoid the very slight overhead
    this
    adds.
  • Debug
                            memory allocations DEBUG_SLAB
                   
    Say
    Y here to have the kernel do limited verification on memory
    allocation
    as well as poisoning memory on free to catch use of freed
    memory.
    This can make kmalloc/kfree-intensive workloads much slower.
  • Mutex
                            debugging, deadlock detection DEBUG_MUTEXES
                   
    This
    allows mutex semantics violations and mutex related deadlocks
    (lockups)
    to be detected and reported automatically.
  • Spinlock
                            debugging DEBUG_SPINLOCK
                   
    Say
    Y here and build SMP to catch missing spinlock initialization
    and
    certain other kinds of spinlock errors commonly made.  This is
    best
    used in conjunction with the NMI watchdog so that spinlock
    deadlocks
    are also debuggable.
  • Sleep-inside-spinlock
                            checking DEBUG_SPINLOCK_SLEEP
                   
    If
    you say Y here, various routines which may sleep will become very
    noisy
    if they are called with a spinlock held.
  • kobject
                            debugging DEBUG_KOBJECT
                   
    If
    you say Y here, some extra kobject debugging messages will be sent
    to
    the syslog.
  • Highmem
                            debugging DEBUG_HIGHMEM
                   
    This
    options enables addition error checking for high memory systems.
    Disable
    for production systems.
  • Compile
                            the kernel with debug info DEBUG_INFO
                   
    If
    you say Y here the resulting kernel image will include
    debugging
    info resulting in a larger kernel image.
    Say
    Y here only if you plan to debug the kernel.
    If
    unsure, say N.
  • Debug
                            Filesystem DEBUG_FS
                   
    debugfs
    is a virtual file system that kernel developers use to put
    debugging
    files into.  Enable this option to be able to read and
    write
    to these files.
    If
    unsure, say N.
  • Debug
                            VM DEBUG_VM
                   
    Enable
    this to turn on extended checks in the virtual-memory system
    that
    may impact performance.
    If
    unsure, say N.
  • Compile
                            the kernel with frame pointers FRAME_POINTER
                   
    If
    you say Y here the resulting kernel image will be slightly larger
    and
    slower, but it might give very useful debugging information on
    some
    architectures or if you use external debuggers.
    If
    you don't debug the kernel, you can say N.
  • Force
                            gcc to inline functions marked 'inline' FORCED_INLINING
                   
    This
    option determines if the kernel forces gcc to inline the functions
    developers
    have marked 'inline'. Doing so takes away freedom from gcc to
    do
    what it thinks is best, which is desirable for the gcc 3.x series of
    compilers.
    The gcc 4.x series have a rewritten inlining algorithm and
    disabling
    this option will generate a smaller kernel there. Hopefully
    this
    algorithm is so good that allowing gcc4 to make the decision can
    become
    the default in the future, until then this option is there to
    test
    gcc for this.
  • torture
                            tests for RCU RCU_TORTURE_TEST
                   
    This
    option provides a kernel module that runs torture tests
    on
    the RCU infrastructure.  The kernel module may be built
    after
    the fact on the running kernel to be tested, if desired.
    Say
    Y here if you want RCU torture tests to start automatically
    at
    boot time (you probably don't).
    Say
    M if you want the RCU torture tests to build as a module.
    Say
    N if you are unsure.
  • Check
                            for stack overflows DEBUG_STACKOVERFLOW
                   
    This
    option will cause messages to be printed if free stack space
    drops
    below a certain limit.
  • Stack
                            utilization instrumentation DEBUG_STACK_USAGE
                   
    Enables
    the display of the minimum amount of free stack which each
    task
    has ever had available in the sysrq-T and sysrq-P debug output.
    This
    option will slow down process creation somewhat.
  • Page
                            alloc debug is incompatible with Software Suspend on i386
                           
                   
  • Write
                            protect kernel read-only data structures DEBUG_RODATA
                   
    Mark
    the kernel read-only data as write-protected in the pagetables,
    in
    order to catch accidental (and incorrect) writes to such const
    data.
    This option may have a slight performance impact because a
    portion
    of the kernel code won't be covered by a 2MB TLB anymore.
    If
    in doubt, say "N".
  • Use
                            4Kb for kernel stacks instead of 8Kb 4KSTACKS
                   
    If
    you say Y here the kernel will use a 4Kb stacksize for the
    kernel
    stack attached to each process/thread. This facilitates
    running
    more threads on a system and also reduces the pressure
    on
    the VM subsystem for higher order allocations. This option
    will
    also use IRQ stacks to compensate for the reduced stackspace.
                   
                   
                   

    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17431/showart_137802.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP