본문 바로가기

Core BSP 분석/리눅스 커널 핵심 분석

[라즈베리 파이] 'RT 리눅스 커널'을 라즈베리 파이에서 빌드하기

config.c
0.17MB
ftrace_log.c
1.00MB
vmlinux.zip
3.55MB

command

$ git clone --branch rpi-4.19.y-rt https://github.com/raspberrypi/linux

.config

  79 CONFIG_PREEMPT=y
  80 CONFIG_PREEMPT_RT_BASE=y
  81 CONFIG_HAVE_PREEMPT_LAZY=y
  82 CONFIG_PREEMPT_LAZY=y
  83 # CONFIG_PREEMPT_NONE is not set
  84 # CONFIG_PREEMPT_VOLUNTARY is not set
  85 # CONFIG_PREEMPT__LL is not set
  86 # CONFIG_PREEMPT_RTB is not set
  87 CONFIG_PREEMPT_RT_FULL=y
  88 CONFIG_PREEMPT_COUNT=y

Ftrace message

1. preemption at rt_spin_lock()

kworker/u8:0-7     [002] d...2..   765.163489: sched_switch: prev_comm=kworker/u8:0 prev_pid=7 prev_prio=120 prev_state=D ==> next_comm=swapper/2 next_pid=0 next_prio=120
     kworker/0:1-48    [000] d...211   765.163502: <stack trace>
 => __schedule+0x65c/0x7d8
 => preempt_schedule_common+0x40/0xa8
 => preempt_schedule+0x58/0x5c
 => migrate_disable+0x180/0x278
 => rt_spin_lock+0x3c/0x80
 => worker_thread+0x10c/0x5b8
 => kthread+0x16c/0x174
 => ret_from_fork+0x14/0x20
 => 0

Assembly instruction around worker_thread+0x10c address

______addr/line|label_______|mnemonic________________|comment
   NSR:C023FD1C|             bl      0xC09B8E40       ; schedule
   NSR:C023FD20|woke_up:     cpy     r0,r6            ; r0,pool
   NSR:C023FD24|             bl      0xC09BD4AC       ; rt_spin_lock
   NSR:C023FD28|             ldr     r3,[r4,#0x30]
   NSR:C023FD2C|             tst     r3,#0x2          ; r3,#2
   NSR:C023FD30|             bne     0xC023FF38
   NSR:C023FD34|             tst     r3,#0x4          ; r3,#4
   NSR:C023FD38|             ldr     r5,[r4,#0x20]    ; pool,[r4,#32]
   NSR:C023FD3C|             beq     0xC024008C
 
2. preemption at rt_spin_lock()

irq/39-s-mmc1-98    [000] d...2..   763.500866: sched_switch: prev_comm=irq/39-s-mmc1 prev_pid=98 prev_prio=50 prev_state=R+ ==> next_comm=irq/39-mmc1 next_pid=97 next_prio=49
   irq/39-s-mmc1-98    [000] d...2..   763.500895: <stack trace>
 => __schedule+0x65c/0x7d8
 => preempt_schedule_common+0x40/0xa8
 => preempt_schedule+0x58/0x5c
 => migrate_enable+0x1d8/0x4b0
 => rt_spin_unlock+0x68/0x90
 => bcm2835_mmc_request+0x64/0xb8
 => __mmc_start_request+0x98/0x1dc
 => mmc_start_request+0x94/0xb8
 => mmc_wait_for_req+0x74/0xe0
 => mmc_io_rw_extended+0x258/0x314
 => sdio_io_rw_ext_helper+0x144/0x1c0
 => sdio_writel+0x3c/0x4c
 => brcmf_sdiod_writel+0x60/0x88 [brcmfmac]
 => brcmf_sdio_intr_rstatus+0xa8/0xdc [brcmfmac]
 => brcmf_sdio_isr+0x9c/0xe4 [brcmfmac]
 => brcmf_sdiod_ib_irqhandler+0x3c/0x40 [brcmfmac]
 => process_sdio_pending_irqs+0xdc/0x198
 => sdio_run_irqs+0x4c/0x68
 => bcm2835_mmc_thread_irq+0x50/0x8c
 => irq_thread_fn+0x2c/0x88
 => irq_thread+0x148/0x234
 => kthread+0x16c/0x174
 => ret_from_fork+0x14/0x20

Assembly instruction around bcm2835_mmc_request+0x64 address

______addr/line|label_|mnemonic________________|comment
   NSR:C0828D74|       ldr     r1,[r5]
   NSR:C0828D78|       cmp     r1,#0x0          ; r1,#0
   NSR:C0828D7C|       beq     0xC0828D8C
   NSR:C0828D80|       ldr     r3,[r4,#0x4D4]
   NSR:C0828D84|       tst     r3,#0x80         ; r3,#128
   NSR:C0828D88|       beq     0xC0828D90
   NSR:C0828D8C|       ldr     r1,[r5,#0x4]
   NSR:C0828D90|       cpy     r0,r6
   NSR:C0828D94|       bl      0xC082852C       ; bcm2835_mmc_send_command
   NSR:C0828D98|       cpy     r0,r6
   NSR:C0828D9C|       bl      0xC09BD67C       ; rt_spin_unlock
   NSR:C0828DA0|       ldr     r3,[r5]
   NSR:C0828DA4|       cmp     r3,#0x0          ; r3,#0
   NSR:C0828DA8|       beq     0xC0828DB8
   NSR:C0828DAC|       ldr     r3,[r4,#0x4D4]
   NSR:C0828DB0|       tst     r3,#0x80         ; r3,#128