FAQ: [#6707] build kgdb kernel fails at kgdb_test.c(2011)

Document created by Aaronwu Employee on Sep 12, 2013
Version 1Show Document
  • View in full screen mode

[#6707] build kgdb kernel fails at kgdb_test.c

Submitted By: Mingquan Pan

Open Date

2011-07-28 05:02:06     Close Date

2011-09-04 22:29:41

Priority:

Medium     Assignee:

Sonic Zhang

Status:

Closed     Fixed In Release:

N/A

Found In Release:

2011R1     Release:

Category:

N/A     Board:

N/A

Processor:

ALL     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

    Toolchain version or rev.:

5013

App binary format:

N/A     

Summary: build kgdb kernel fails at kgdb_test.c

Details:

 

build kgdb kernel fails at kgdb_test.c.

 

  CC      mm/filemap.o^M

  CC      fs/open.o^M

  CC      arch/blackfin/kernel/binfmt_elf_fdpic.o^M

  CC      kernel/sched.o^M

  CC      arch/blackfin/kernel/cplbinfo.o^M

  CC      arch/blackfin/kernel/module.o^M

  CC      fs/read_write.o^M

  CC      mm/mempool.o^M

  CC      arch/blackfin/kernel/kgdb.o^M

  CC      fs/file_table.o^M

  CC      mm/oom_kill.o^M

  CC      arch/blackfin/kernel/kgdb_test.o^M

In file included from include/linux/sysctl.h:933,^M

                 from include/linux/kmod.h:27,^M

                 from include/linux/module.h:13,^M

                 from arch/blackfin/kernel/kgdb_test.c:9:^M

include/linux/rcupdate.h: In function ‘__kfree_rcu’:^M

include/linux/rcupdate.h:822: error: size of array ‘type name’ is negative^M

  CC      fs/super.o^M

make[2]: *** [arch/blackfin/kernel/kgdb_test.o] Error 1^M

make[1]: *** [arch/blackfin/kernel] Error 2^M

  CC      kernel/fork.o^M

make[1]: *** Waiting for unfinished jobs....^M

  CC      mm/fadvise.o^M

  CC      mm/maccess.o^M

 

Follow-ups

 

--- Sonic Zhang                                              2011-08-12 06:13:47

Fixed.

__kfree_rcu() in rcupdate.h bugs on parameter offset is not a constant

at compile time. kgdb_test module includes head file rcupdate.h. kgdb_test

module is compiled with flag O0. Parameter offset is not optimized into

a constant with flag O0.

 

--- Mingquan Pan                                             2011-08-15 22:58:44

It can build now, but test still fails and it looks like the breakpoint doesn't

function now.

 

....

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1,

mdc_clk=2500000Hz(mdc_div=24)@sclk=125MHz)

bfin_mac bfin_mac.0: eth0: Blackfin on-chip Ethernet MAC driver, Version 1.1

console [netcon0] enabled

netconsole: network logging started

kgdboe: local port 6443

kgdboe: local IP 10.100.4.50

kgdboe: interface 'eth0'

kgdboe: remote port 6442

kgdboe: remote IP 10.100.4.174

kgdboe: remote ethernet address ff:ff:ff:ff:ff:ff

kgdboe: device eth0 not up yet, forcing it

kgdboe: carrier detect appears untrustworthy, waiting 4 seconds

PHY: 0:01 - Link is Up - 100/Full

kgdb: Registered I/O driver kgdboe.

kgdboe: debugging over ethernet enabled

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

TCP cubic registered

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting system clock to 1970-09-12 13:17:02 UTC (21993422)

dma_alloc_init: dma_page @ 0x0286b000 - 256 pages at 0x03f00000

Freeing unused kernel memory: 6908k freed

                           _____________________________________

        a8888b.           / Welcome to the uClinux distribution \

       d888888b.         /       _     _                         \

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |

       8'    .88       \        | |   | |  _ \| | | | \  /        |

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |

     dP   .    Y8b.       \   For embedded processors including   |

    d8:'  "  `::88b        \    the Analog Devices Blackfin      /

   d8"         'Y88b        \___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

._/"Yaa_:   .| 88P|            - http://blackfin.uclinux.org/

\    YP"    `| 8P  `.          - http://docs.blackfin.uclinux.org/

/     \.___.d|    .'           - http://www.uclinux.org/

`--..__)8888P`._.'  jgs/a:f    - http://www.analog.com/blackfin

 

Have a lot of fun...

 

 

BusyBox v1.18.4 (2011-08-14 13:01:21 CST) hush - the humble shell

 

root:/> version

kernel:    Linux release 3.0.0-ADI-2011R1-pre-svn10056, build #162 Sun Aug 14

16:34:33 CST 2011

toolchain: bfin-uclinux-gcc release gcc version 4.3.5 (ADI-trunk/svn-5013)

user-dist: release svn-10302, build #2326 Sun Aug 14 16:33:49 CST 2011

root:/> successful boot attempt

************** STEP 3: Start KGDB TEST (ethernet)

 

ifconfig eth0 10.100.4.50

root:/> spawn bfin-uclinux-gdb

/home/test/work/cruise/checkouts/uclinux-dist/linux-2.6.x/vmlinux

GNU gdb 6.6

Copyright (C) 2006 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for

details.

This GDB was configured as "--host=i686-pc-linux-gnu

--target=bfin-uclinux"...

(gdb)

Case 1 ...PASS

 

Case 1 ...PASS

target remote udp:10.100.4.50:6443

warning: The remote protocol may be unreliable over UDP.

Some events may be lost, rendering further debugging impossible.

Remote debugging using udp:10.100.4.50:6443

 

Case 2 ...PASS

 

Case 2 ...PASS

kgdb_breakpoint () at

/home/test/work/cruise/checkouts/uclinux-dist/linux-2.6.x/arch/blackfin/include/asm/irqflags.h:29

29        asm volatile("cli %0;" : "=d" (flags));

(gdb) break kgdb_test

Breakpoint 1 at 0x7f56: file arch/blackfin/kernel/kgdb_test.c, line 55.

 

Case 3 ...PASS

 

Case 3 ...PASS

(gdb) c

Continuing.

 

Case 4 ...PASS

 

Case 4 ...PASS

 

root:/> spawn /bin/sh

uclinux52-bf537-spinet:~/work/cruise/checkouts/uclinux-dist/testsuites/kgdb>

ps aux | grep bfin-uclinux-gdb

test     21915  1.0  1.4  36500 30432 pts/3    Ss+  16:35   0:00

bfin-uclinux-gdb

/home/test/work/cruise/checkouts/uclinux-dist/linux-2.6.x/vmlinux

test     21926  0.0  0.0   3064   728 pts/4    S+   16:36   0:00 grep

bfin-uclinux-gdb

uclinux52-bf537-spinet:~/work/cruise/checkouts/uclinux-dist/testsuites/kgdb>

kill -9 `pidof  bfin-uclinux-gdb`

uclinux52-bf537-spinet:~/work/cruise/checkouts/uclinux-dist/testsuites/kgdb>

 

Last passed time: 2011_Jul_22_15_02.

Uclinux-dist version: 10258.

Kernel verion: 10031, git-id: 1a44e426a3033db9be15a81dd87c5ff64fb997b1

 

Case 5 ...FAIL

 

Case 5 ...FAIL

 

KGDB TEST (ethernet) FAIL

 

--- Robert Berger                                            2011-08-29 15:06:23

I have a similar problem with a PPC and the 3.0.0 kernel. This fixes it for me:

 

From 0006424ed194ba8b12f4473be6ea2b81953d7443 Mon Sep 17 00:00:00 2001

From: Robert Berger <git.rber@gmail.com>

Date: Mon, 29 Aug 2011 19:49:15 +0300

Subject: [PATCH] -O0 is overriding "__always_inline" in toolchain

 

This means that the compiler cannot determine whether or not

"offset"

will be a compile-time constant, or for that matter, what value it will

have.

 

Comment out the first BUILD_BUG_ON() in __kfree_rcu() and replace the

second BUILD_BUG_ON() with a WARN_ON_ONCE().

 

Signed-off-by: Robert Berger <git.rber@gmail.com>

---

include/linux/rcupdate.h |    5 +++--

1 files changed, 3 insertions(+), 2 deletions(-)

 

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h

index 99f9aa7..6ef0f9f 100644

--- a/include/linux/rcupdate.h

+++ b/include/linux/rcupdate.h

@@ -819,10 +819,11 @@ void __kfree_rcu(struct rcu_head *head, unsigned long

offset)

{

     typedef void (*rcu_callback)(struct rcu_head *);

 

-    BUILD_BUG_ON(!__builtin_constant_p(offset));

+    /*BUILD_BUG_ON(!__builtin_constant_p(offset));*/

 

     /* See the kfree_rcu() header comment. */

-    BUILD_BUG_ON(!__is_kfree_rcu_offset(offset));

+    /* BUILD_BUG_ON(!__is_kfree_rcu_offset(offset));*/

+    WARN_ON_ONCE(!__is_kfree_rcu_offset(offset));

 

     call_rcu(head, (rcu_callback)offset);

}

--

1.7.0.4

 

--- Sonic Zhang                                              2011-08-30 03:10:56

Fixed after add gcc attribute __noinline__ to kgdb_test().

 

--- Mingquan Pan                                             2011-09-04 22:29:41

Yes, it fixed and test passed  now. Close.

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes