Re: [PATCH RFC 1/4] Generic BUG handling.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Sep 2006 15:54:45 -0700
Jeremy Fitzhardinge <[email protected]> wrote:

> This patch adds common handling for kernel BUGs, for use by
> architectures as they wish.  The code is derived from arch/powerpc.
> 
> The advantages of having common BUG handling are:
>  - consistent BUG reporting across architectures
>  - shared implementation of out-of-line file/line data
> 
> This means that in inline impact of BUG is just the illegal
> instruction itself, which is an improvement for i386 and x86-64.
> 
> A BUG is represented in the instruction stream as an illegal
> instruction, which has file/line/function information associated with
> it.  This extra information is stored in the __bug_table section in
> the ELF file.
> 
> When the kernel gets an illegal instruction, it first confirms it
> might possibly be from a BUG (ie, in kernel mode, the right illegal
> instruction).  It then calls report_bug().  This searches __bug_table
> for a matching instruction pointer, and if found, prints the
> corresponding file/line/function information.
> 
> Some architectures (powerpc) implement WARN using the same mechanism;
> if the illegal instruction was the result of a WARN, then report_bug()
> returns 1; otherwise it returns 0.

Neato.

> lib/bug.c keeps a list of loaded modules which can be searched for
> __bug_table entries.  The architecture must call
> module_bug_finalize()/module_bug_cleanup() from its corresponding
> module_finalize/cleanup functions.

What is the locking for these lists?  I don't see much in here.  It has
implications for code which wants to do BUG while holding that lock..

> This patch also converts i386, x86-64 and powerpc to use this
> infrastructure.  I have only tested i386; x86-64 and powerpc are not
> even compile-tested in this patch.
> 
> Because powerpc also records the function name, I added this to i386
> and x86-64 for consistency.  Strictly speaking the function name is
> redundant with kallsyms, so perhaps it can be dropped from powerpc.

I agree that the function name is a rather gratuitous space-consumer.

> +#ifdef CONFIG_GENERIC_BUG
> +	/* Support for BUG */
> +	struct list_head bug_list;
> +	struct bug_entry *bug_table;
> +	unsigned num_bugs;

Shouldn't this be u64? ;)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux