Unbind the native serial driver error

Open
#4,159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c

Research direction

Start with drivers/pci/msi.c around free_msi_irqs at line 375, then follow the reported pci_disable_msi and device-driver-detach path triggered by the sysfs unbind operation. Reproduce the failure on the reported BCM2711 setup with the native serial driver and custom PCI/PCIe UART drivers. Done means unbinding no longer causes the kernel BUG or userspace segmentation fault.

Written by the indexing model from the issue text.

Description

When i load custom PCI/PCIe UART drivers,something goes wrong.

The pi info:

image

When i unbind the native serial driver.It print message"Segmentation fault"

image

kernel log
  • [00.598965] printk: console [ttyS0] disabled

  • [00.607696] ------------[ cut here ]------------

  • [00.607705] kernel BUG at drivers/pci/msi.c:375!

  • [00.607710] Internal error: Oops - BUG: 0 [#1] SMP ARM

  • [00.607722] Modules linked in: fuse sha256_generic libsha256 cfg80211 rfkill 8021q garp stp llc vc4 cec bcm2835_isp(C) bcm2835_v4l2(C) bcm2835_codec(C) bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common drm_kms_helper v3d videodev vc_sm_cma(C) gpu_sched mc snd_soc_core snd_bcm2835(C) drm drm_panel_orientation_quirks dwc2 snd_compress snd_pcm_dmaengine snd_pcm raspberrypi_hwmon snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops rpivid_mem uio_pdrv_genirq uio i2c_dev ip_tables x_tables ipv6

  • [00.607883] CPU: 3 PID: 798 Comm: bash Tainted: G C 5.4.79-rt44-v7l #12

  • [00.607891] Hardware name: BCM2711

  • [00.607895] PC is at free_msi_irqs+0x174/0x194

  • [00.607919] LR is at 0xef400130

  • [00.607928] pc : [] lr : [] psr: a0000013

  • [00.607933] sp : d534bd10 ip : ef40022c fp : d534bd3c

  • [00.607937] r10: 00000000 r9 : d534bd94 r8 : ef072600

  • [00.607942] r7 : ef856000 r6 : ef8561b4 r5 : 00000000 r4 : ef071a00

  • [00.607946] r3 : ef298dc0 r2 : 00000000 r1 : 0000003a r0 : ef008d00

  • [00.607951] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user

  • [00.607961] Control: 30c5383d Table: 153c0a00 DAC: 55555555

  • [00.607965] Process bash (pid: 798, stack limit = 0xf1a73058)

  • [00.607974] Stack: (0xd534bd10 to 0xd534c000)

  • [00.607983] bd00: 00000039 c1205008 ef856000 ef071a00

  • [00.607992] bd20: ef856000 ef072600 d534bd94 00000000 d534bd64 d534bd40 c0708910 c07080ac

  • [00.608000] bd40: 00802600 f323a191 d534bd84 ef856078 ef072640 00000005 d534bd84 d534bd68

  • [00.608008] bd60: c06ef314 c070880c ef856078 c1205008 00000005 d534bd94 d534bdcc d534bd88

  • [00.608015] bd80: c0799308 c06ef244 d534bdb4 a0000013 c031fd4c ef072600 ef072400 f323a191

  • [00.608022] bda0: c126fb98 ef856078 ef855878 c126fb98 ef856078 d53f5840 d534bf58 d4d99210

  • [00.608029] bdc0: d534bde4 d534bdd0 c07994a4 c0799144 ef856078 ef855878 d534be04 d534bde8

  • [00.608036] bde0: c079545c c0799470 c1268ac0 0000000c c126fb98 ef856078 d534be14 d534be08

  • [00.608044] be00: c0795540 c0795358 d534be34 d534be18 c07933fc c079552c c079338c d4d99200

  • [00.608051] be20: 00000000 00000000 d534be4c d534be38 c07927c8 c0793398 c0792798 d4d99200

  • [00.608058] be40: d534be64 d534be50 c04a9fc4 c07927a4 0000000c d4d99200 d534be9c d534be68

  • [00.608065] be60: c04a97ec c04a9f88 00000000 00000000 00000040 c1205008 d5cdd540 c04a9700

  • [00.608072] be80: d534bf58 00000000 0000000c 0000000c d534bf24 d534bea0 c040a8d8 c04a970c

  • [00.608080] bea0: ffece000 e468af5f d5a0ea00 00000000 d59f04e0 00000055 00000cc0 c040c438

  • [00.608087] bec0: 0115e000 d5986040 d53c0a00 0000000c 00000000 c0a91288 00000000 d77a4188

  • [00.608094] bee0: d534bf04 d534bef0 c0a91288 c0295740 00000000 f323a191 d534bf24 0000000c

  • [00.608102] bf00: d5cdd540 0115d118 d534bf58 00000000 0115d118 0000000c d534bf54 d534bf28

  • [00.608109] bf20: c040d828 c040a89c c020cf54 c0430d70 d534bf54 c1205008 d5cdd540 00000000

  • [00.608116] bf40: 00000000 d5cdd540 d534bf94 d534bf58 c040dafc c040d780 00000000 00000000

  • [00.608124] bf60: b6f31258 f323a191 d534bfac 0000000c 0115d118 b6f31d90 00000004 c02011c4

  • [00.608131] bf80: d534a000 00000004 d534bfa4 d534bf98 c040db8c c040daa0 00000000 d534bfa8

  • [00.608138] bfa0: c0201000 c040db80 0000000c 0115d118 00000001 0115d118 0000000c 00000000

  • [00.608145] bfc0: 0000000c 0115d118 b6f31d90 00000004 0115d118 0000000c 001042a8 00000000

  • [00.608153] bfe0: 0000006c be8c8f08 b6e507b8 b6eac944 60000010 00000001 00000000 00000000

  • [00.608157] Backtrace:

  • [00.608163] [] (free_msi_irqs) from [] (pci_disable_msi+0x110/0x12c)

  • [00.608185] r10:00000000 r9:d534bd94 r8:ef072600 r7:ef856000 r6:ef071a00 r5:ef856000

  • [00.608190] r4:c1205008 r3:00000039

  • [00.608193] [] (pci_disable_msi) from [] (pcim_release+0xdc/0xe4)

  • [00.608214] r6:00000005 r5:ef072640 r4:ef856078

  • [00.608217] [] (pcim_release) from [] (release_nodes+0x1d0/0x214)

  • [00.608233] r7:d534bd94 r6:00000005 r5:c1205008 r4:ef856078

  • [00.608236] [] (release_nodes) from [] (devres_release_all+0x40/0x60)

  • [00.608251] r10:d4d99210 r9:d534bf58 r8:d53f5840 r7:ef856078 r6:c126fb98 r5:ef855878

  • [00.608255] r4:ef856078

  • [00.608258] [] (devres_release_all) from [] (device_release_driver_internal+0x110/0x1b0)

  • [00.608274] r5:ef855878 r4:ef856078

  • [00.608277] [] (device_release_driver_internal) from [] (device_driver_detach+0x20/0x24)

  • [00.608292] r7:ef856078 r6:c126fb98 r5:0000000c r4:c1268ac0

  • [00.608296] [] (device_driver_detach) from [] (unbind_store+0x70/0xe4)

  • [00.608310] [] (unbind_store) from [] (drv_attr_store+0x30/0x3c)

  • [00.608323] r7:00000000 r6:00000000 r5:d4d99200 r4:c079338c

  • [00.608325] [] (drv_attr_store) from [] (sysfs_kf_write+0x48/0x54)

  • [00.608341] r5:d4d99200 r4:c0792798

  • [00.608343] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xec/0x20c)

  • [00.608357] r5:d4d99200 r4:0000000c

  • [00.608360] [] (kernfs_fop_write) from [] (__vfs_write+0x48/0x1d0)

  • [00.608379] r10:0000000c r9:0000000c r8:00000000 r7:d534bf58 r6:c04a9700 r5:d5cdd540

  • [00.608383] r4:c1205008

  • [00.608385] [] (__vfs_write) from [] (vfs_write+0xb4/0x1d0)

  • [00.608400] r10:0000000c r9:0115d118 r8:00000000 r7:d534bf58 r6:0115d118 r5:d5cdd540

  • [00.608404] r4:0000000c

  • [00.608406] [] (vfs_write) from [] (ksys_write+0x68/0xe0)

  • [00.608420] r8:d5cdd540 r7:00000000 r6:00000000 r5:d5cdd540 r4:c1205008

  • [00.608423] [] (ksys_write) from [] (sys_write+0x18/0x1c)

  • [00.608437] r10:00000004 r9:d534a000 r8:c02011c4 r7:00000004 r6:b6f31d90 r5:0115d118

  • [00.608441] r4:0000000c

  • [00.608444] [] (sys_write) from [] (ret_fast_syscall+0x0/0x28)

  • [00.608456] Exception stack(0xd534bfa8 to 0xd534bff0)

  • [00.608464] bfa0: 0000000c 0115d118 00000001 0115d118 0000000c 00000000

  • [00.608472] bfc0: 0000000c 0115d118 b6f31d90 00000004 0115d118 0000000c 001042a8 00000000

  • [00.608478] bfe0: 0000006c be8c8f08 b6e507b8 b6eac944

  • [00.608488] Code: ebedee61 e590303c e3530000 0afffff5 (e7f001f2)

  • [00.608496] ---[ end trace 3bf3762de396e28c ]---

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.