Bug 199111 - BCM4324B5: bt connection to paired devices is only established when discovery/scan is enabled
Summary: BCM4324B5: bt connection to paired devices is only established when discovery...
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Bluetooth (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-bluetooth@vger.kernel.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-14 08:15 UTC by Stefan Assmann
Modified: 2018-04-16 08:52 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.16-rc4
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg-4.16-rc4.txt (74.76 KB, text/plain)
2018-03-14 08:15 UTC, Stefan Assmann
Details

Description Stefan Assmann 2018-03-14 08:15:51 UTC
Created attachment 274717 [details]
dmesg-4.16-rc4.txt

The chip only connects to paired devices when discovery/scanning is enabled. Otherwise connection is never established.

Device Info:
[   17.617214] Bluetooth: hci0: BCM: chip id 90
[   17.620448] Bluetooth: hci0: BCM: features 0x0f
[   17.626236] Bluetooth: hci0: BCM4324B5

root@tpt10:~ > bluetoothctl --version
bluetoothctl: 5.48
root@tpt10:~ > hciconfig -a
hci0:   Type: Primary  Bus: UART
        BD Address: EC:0E:C4:1D:BB:5A  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING PSCAN ISCAN INQUIRY
        RX bytes:3798 acl:0 sco:0 events:332 errors:0
        TX bytes:35719 acl:0 sco:0 commands:309 errors:0
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'localhost.localdomain'
        Class: 0x0c0110
        Service Classes: Rendering, Capturing
        Device Class: Computer, Handheld
        HCI Version: 4.0 (0x6)  Revision: 0x3492
        LMP Version: 4.0 (0x6)  Subversion: 0x4606
        Manufacturer: Broadcom Corporation (15)

[bluetooth]# show
Controller EC:0E:C4:1D:BB:5A (public)
        Name: localhost.localdomain
        Alias: localhost.localdomain
        Class: 0x000c0110
        Powered: yes
        Discoverable: yes
        Pairable: yes
        UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v1D6Bp0246d0530
        Discovering: yes
[Universal Mobile Keyboard]# info C0:33:5E:75:86:AB
Device C0:33:5E:75:86:AB (public)
        Name: Universal Mobile Keyboard
        Alias: Universal Mobile Keyboard
        Class: 0x00000540
        Icon: input-keyboard
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
        UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v045Ep0802d0099


The following warning is printed on boot:
[   17.231279] ======================================================
[   17.234231] WARNING: possible circular locking dependency detected
[   17.237170] 4.16.0-0.rc4.git3.1.fc27.x86_64 #1 Not tainted
[   17.240115] ------------------------------------------------------
[   17.243049] kworker/u8:1/74 is trying to acquire lock:
[   17.245962]  (bcm_device_lock){+.+.}, at: [<00000000acdc9be0>] bcm_recv+0x68/0xe0 [hci_uart]
[   17.248943]·
               but task is already holding lock:
[   17.254812]  (&buf->lock){+.+.}, at: [<0000000057d725d1>] flush_to_ldisc+0x20/0xa0
[   17.257845]·
               which lock already depends on the new lock.
Attaching full dmesg.
Comment 1 The Linux kernel's regression tracker (Thorsten Leemhuis) 2018-03-19 10:22:52 UTC
Does this work in 4.15? If it's a problem that new with 4.16 I'd include it in my regression reports.

Side note: You better report this to a mailing list, the responsible developer are unlikely to see it here.
Comment 2 Stefan Assmann 2018-03-19 10:34:11 UTC
I haven't seen the warning with 4.15, but the connect never worked before unless discovery/scan is enabled.
Btw, bluetooth bugs are mirrored to linux-bluetooth so it's already exposed to the list.
Comment 3 Stefan Assmann 2018-04-16 08:52:34 UTC
Still in 4.17-rc1
[   16.978701] ======================================================
[   16.981638] WARNING: possible circular locking dependency detected
[   16.984548] 4.17.0-rc1 #74 Not tainted
[   16.987449] ------------------------------------------------------
[   16.990308] kworker/u8:0/6 is trying to acquire lock:
[   16.993062] 00000000be6488d6 (bcm_device_lock){+.+.}, at: bcm_recv+0x68/0x110 [hci_uart]
[   16.995928]
               but task is already holding lock:
[   17.001493] 0000000091379733 (&buf->lock){+.+.}, at: flush_to_ldisc+0x20/0xa0
[   17.004356]
               which lock already depends on the new lock.

[   17.012791]
               the existing dependency chain (in reverse order) is:
[   17.018356]
               -> #3 (&buf->lock){+.+.}:
[   17.023850]        tty_buffer_flush+0x2f/0x90
[   17.026602]        tty_ldisc_flush+0x1d/0x40
[   17.029347]        vt_ioctl+0x56b/0x11c0
[   17.032086]        tty_ioctl+0xef/0x950
[   17.034839]        do_vfs_ioctl+0xa5/0x6e0
[   17.037586]        ksys_ioctl+0x70/0x80
[   17.037589]        __x64_sys_ioctl+0x16/0x20
[   17.037594]        do_syscall_64+0x60/0x200
[   17.037599]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   17.037601]
               -> #2 (&tty->ldisc_sem){++++}:
[   17.037609]        tty_ldisc_lock+0x12/0x30
[   17.037612]        tty_init_dev+0x90/0x1e0
[   17.037614]        tty_open+0x295/0x450
[   17.037617]        chrdev_open+0xa7/0x1d0
[   17.037621]        do_dentry_open+0x1c7/0x370
[   17.037623]        path_openat+0x592/0xd00
[   17.037625]        do_filp_open+0x9b/0x110
[   17.037628]        do_sys_open+0x1bd/0x250
[   17.037632]        kernel_init_freeable+0x243/0x2d0
[   17.037636]        kernel_init+0xa/0x110
[   17.037638]        ret_from_fork+0x3a/0x50
[   17.037639]
               -> #1 (&tty->legacy_mutex){+.+.}:
[   17.037645]        tty_init_dev+0x52/0x1e0
[   17.037649]        ttyport_open+0x37/0x150
[   17.037661]        bcm_open+0x88/0x1e0 [hci_uart]
[   17.037667]        hci_uart_register_device+0x31/0x200 [hci_uart]
[   17.037671]        driver_probe_device+0x30b/0x480
[   17.037674]        __driver_attach+0xbc/0xe0
[   17.037676]        bus_for_each_dev+0x79/0xc0
[   17.037679]        driver_attach_async+0xe/0x40
[   17.037682]        async_run_entry_fn+0x39/0x160
[   17.037686]        process_one_work+0x266/0x6b0
[   17.037689]        worker_thread+0x3a/0x390
[   17.037691]        kthread+0x121/0x140
[   17.037693]        ret_from_fork+0x3a/0x50
[   17.037694]
               -> #0 (bcm_device_lock){+.+.}:
[   17.037701]        __mutex_lock+0x7f/0xa40
[   17.037708]        bcm_recv+0x68/0x110 [hci_uart]
[   17.037715]        hci_uart_receive_buf+0x49/0x70 [hci_uart]
[   17.037717]        ttyport_receive_buf+0x50/0xd0
[   17.037720]        flush_to_ldisc+0x81/0xa0
[   17.037723]        process_one_work+0x266/0x6b0
[   17.037726]        worker_thread+0x3a/0x390
[   17.037728]        kthread+0x121/0x140
[   17.037730]        ret_from_fork+0x3a/0x50
[   17.037731]
               other info that might help us debug this:

[   17.037732] Chain exists of:
                 bcm_device_lock --> &tty->ldisc_sem --> &buf->lock

[   17.037738]  Possible unsafe locking scenario:

[   17.037739]        CPU0                    CPU1
[   17.037740]        ----                    ----
[   17.037741]   lock(&buf->lock);
[   17.037744]                                lock(&tty->ldisc_sem);
[   17.037746]                                lock(&buf->lock);
[   17.037748]   lock(bcm_device_lock);
[   17.037750]
                *** DEADLOCK ***

[   17.037753] 3 locks held by kworker/u8:0/6:
[   17.037753]  #0: 000000000601b32c ((wq_completion)"events_unbound"){+.+.}, at: process_one_work+0x1da/0x6b0
[   17.037762]  #1: 00000000a7b86b78 ((work_completion)(&buf->work)){+.+.}, at: process_one_work+0x1da/0x6b0
[   17.037769]  #2: 0000000091379733 (&buf->lock){+.+.}, at: flush_to_ldisc+0x20/0xa0
[   17.037776]
               stack backtrace:
[   17.037780] CPU: 1 PID: 6 Comm: kworker/u8:0 Not tainted 4.17.0-rc1 #74
[   17.037782] Hardware name: LENOVO 20C10026UK/20C10026UK, BIOS GWET46WW (1.46) 02/01/2018
[   17.037787] Workqueue: events_unbound flush_to_ldisc
[   17.037789] Call Trace:
[   17.037801]  dump_stack+0x85/0xcb
[   17.037807]  print_circular_bug.isra.40+0x1ce/0x1db
[   17.037812]  __lock_acquire+0x1299/0x1340
[   17.037822]  ? lock_acquire+0x9f/0x200
[   17.037825]  lock_acquire+0x9f/0x200
[   17.037834]  ? bcm_recv+0x68/0x110 [hci_uart]
[   17.037843]  ? bcm_recv+0x68/0x110 [hci_uart]
[   17.037847]  __mutex_lock+0x7f/0xa40
[   17.037855]  ? bcm_recv+0x68/0x110 [hci_uart]
[   17.037858]  ? trace_hardirqs_on_caller+0xed/0x180
[   17.037889]  ? hci_recv_frame+0x5e/0x90 [bluetooth]
[   17.037897]  ? h4_recv_buf+0x184/0x300 [hci_uart]
[   17.037906]  ? bcm_recv+0x68/0x110 [hci_uart]
[   17.037914]  bcm_recv+0x68/0x110 [hci_uart]
[   17.037922]  hci_uart_receive_buf+0x49/0x70 [hci_uart]
[   17.037927]  ttyport_receive_buf+0x50/0xd0
[   17.037932]  flush_to_ldisc+0x81/0xa0
[   17.037937]  process_one_work+0x266/0x6b0
[   17.037943]  worker_thread+0x3a/0x390
[   17.037947]  ? process_one_work+0x6b0/0x6b0
[   17.037950]  kthread+0x121/0x140
[   17.037954]  ? kthread_create_worker_on_cpu+0x70/0x70
[   17.037957]  ret_from_fork+0x3a/0x50

Note You need to log in before you can comment on or make changes to this bug.