From owner-freebsd-current@freebsd.org Thu Aug 29 04:04:33 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24AECC8344 for ; Thu, 29 Aug 2019 04:04:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46JpsC5QNBz48fY for ; Thu, 29 Aug 2019 04:04:31 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82a.google.com with SMTP id b11so2162990qtp.10 for ; Wed, 28 Aug 2019 21:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=J0cvyNAzBhu4BKzCy2uifHgFJvZrDFN2AOQ6Qunjn90=; b=W9G/1p3ZlHAROEk5qKfPm5LlSSNSZmjnmeUzbK1WBD4Kkd26u0hpOLw291Zc4ItQn7 FiPLbEqyw7E/V+jU1dANi2hbwV2zC6v1lzlt/k7zFfNoizyj9vRjz2/JKrJMKmlzNEq7 L+GSto4o83AsC1OMA/Zcihi/6WIMf3Uc2z8HkO/iyAkSQe9dTOS00b/B/e69G+jhkLBN GUqGL2XjaQosbyvqPuPJhS2QfC3uPntdgzsIsqUbeyWqhcML6/XqfDoGbSvQ7QIs94NL wbH8feriQUOyyAMEGuGxi9St2lQEm8IaN5HVEQjyjUEONGY9k4rvxElM4N3CcMSLW6Ph 8dNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J0cvyNAzBhu4BKzCy2uifHgFJvZrDFN2AOQ6Qunjn90=; b=IgY2Vr2f2e6eixQRmLM5xW5iJBt5g9w5NLcBP0yaLWPELC+7bLfLXYqqbZwEGS1Ir/ xo5dJKeDuzfmTbfeDZI3uFHp2NHDuB0IBY5FoT92C1IdFeWK+gcrz2dqNYa9b8COLefX SvqlSNgdaFi6/QDyu2P+U69kuaLVE4lhIDMTZqmzihMsJir9g3WRK3n7mqPAWR7O0nBi NR4YdDA8GjlfRmodFlrpKkt4apIIEqPGJd5bJgcQ73D1/hBCeqHfHQOxjEKiB9SdYpqi RLkIi/vaKzfomK5M/U+i+LjMueBJmP7m2qOxPPXcltacNqmv8P7TKTfCjVeAPBd2aCiL UCPg== X-Gm-Message-State: APjAAAX0jaxzWWDM+IWij291v8aDryQy+Rb0UuJn7HdChLu8aQzNER6J CWKGXe+9j/mAiPfdj2rUO8rLmpql/7ZDYbwwogTg3Q== X-Google-Smtp-Source: APXvYqx5yFwpG46pDKRNy1HRRB82L0IYQlkZy+NpJZJuK9sm+NIC9XXTGRboaQ6uqmWlOC0Fho2SRUK3VKi4yYh25j4= X-Received: by 2002:ac8:760e:: with SMTP id t14mr3068449qtq.175.1567051470492; Wed, 28 Aug 2019 21:04:30 -0700 (PDT) MIME-Version: 1.0 References: <1115053193.64543.1567031661382.ref@mail.yahoo.com> <1115053193.64543.1567031661382@mail.yahoo.com> In-Reply-To: From: Warner Losh Date: Wed, 28 Aug 2019 22:04:17 -0600 Message-ID: Subject: Re: Kernel-Crash when working with ubt0 To: Miranda Maria Sophie Van den Breukelingen Cc: Maksim Yevmenkin , Konstantin Belousov , Hans Petter Selasky , "freebsd-current@freebsd.org" X-Rspamd-Queue-Id: 46JpsC5QNBz48fY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=W9G/1p3Z; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82a) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.92 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.99)[-0.992,0]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.93)[ip: (-9.44), ipnet: 2607:f8b0::/32(-2.85), asn: 15169(-2.32), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TAGGED_RCPT(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[a.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_CC(0.00)[gmail.com] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2019 04:04:33 -0000 On Wed, Aug 28, 2019, 8:57 PM Miranda Maria Sophie Van den Breukelingen < mms.vanbreukelingen@gmail.com> wrote: > > > On Thu, 29 Aug 2019 at 03:48, Warner Losh wrote: > >> >> >> On Wed, Aug 28, 2019, 4:34 PM mms.vanbreukelingen@gmail.com < >> mms.vanbreukelingen@gmail.com> wrote: >> >>> @Maksim, I first did a "git apply -R bt.diff" and then >>> >>> root@freeBSD13:/usr/src # git apply --stat --check --ignore-whitespace >>> ng_btsocket_hci_raw.c.diff.txt >>> error: patch failed: >>> head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c:1156 >>> error: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c: patch >>> does not apply >>> >> >> patch -p1 worked for me to apply it. >> >> And it worked just fine for everything once I rebooted. The patch looked >> fine to my eye. >> >> Warner >> >> >> Rebuilding with MTX_SPIN=y (withouth patch)... >>> On Wed, 28 Aug 2019 at 19:10, Maksim Yevmenkin < >>> maksim.yevmenkin@gmail.com> wrote: >>> >>> > > > Hmm... interesting.... >>> > > > >>> > > > I only took a brief look at it. I suppose I can ensure user space >>> address is wired and then copyout() can be called with mutex held >>> > > >>> > > >No, you cannot do this, at least without making the kernel to panic. >>> > > User might unmap the wired mapping at any time still. >>> > >>> > Kostik, >>> > >>> > i was thinking along the lines of vslock/vsunlock and copyout_nofault. >>> > basically similar to the sysctl code. do you think this would not >>> > work? >>> >>> actually, i dont think i need to hold lock over copyout. attached is >>> my version of the patch (untested) >>> >>> thank >>> max >>> >>> > > > oh, didn't patch it with the -p1 option, maybe this is why. I rebuild the > kernel and removed the WITNESS option, > option MTX_SPIN # is an illtusion for > not locking yourself out > > and it does work. When using the built-in-adapter you not just have to > reboot but to turn it off for at least 10 secs., and then reboot into > freeBSD again. Here's what I'm having right now: > > /etc/rc.d/bluetooth start ubt0 > /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device > ubt0 > > *root@freeBSD13:/usr/home/miranda # /etc/rc.d/bluetooth start ubt0 > root@freeBSD13:/usr/home/miranda # * > > So, you got to tell it at least twice because of dmesg often calling: > *ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command > OGF=0x3, OCF=0x3. Timeout* > > The ubt0 is the Asus stack, I can't setup the internal ubt1 anymore at > all. Maybe I'm gonna patch with the -p1 flag tomorrow. > > @warner Is there a way to patch a running kernel and just reboot or is it > always in a new buildkernel environment? I did "patch bt.diff"; > > @maksim; special way to patch correctly? > > > > > *bluetooth-config scan Scanning for new Bluetooth devices (Attempt 1 of 5) > ... done. Found 1 new bluetooth device (now scanning for names): [ 1] > c0:7a:a5:00:c7:11 "Ubittek MagicBox" (Ubittek_MagicBox) * > > *Select device to pair with [1, or 0 to rescan]: 1 * > > > > > > *Warning: An entry for device c0:7a:a5:00:c7:11 is already present in > /etc/bluetooth/hcsecd.conf. To modify pairing information, edit this file > and run service hcsecd restart Continue? [yes]: yes * > Entry in /etc/bluetooth/hcsecd.conf: > > > > > > *device { bdaddr c0:7a:a5:00:c7:11; name "Ubittek > MagicBox"; key nokey; pin nopin; }* > > l2ping: > *l2ping -a c0:7a:a5:00:c7:11 * > *16 bytes from Ubittek_MagicBox seq_no=0 time=2611.842 ms result=0 * > *16 bytes from Ubittek_MagicBox seq_no=1 time=6.274 ms result=0 * > *16 bytes from Ubittek_MagicBox seq_no=2 time=6.862 ms result=0 * > [not 0 bytes??] > > *but*, and this is the status for now: > > > > *l2control -a c0:7a:a5:00:c7:11 read_channel_list l2control: Could not > bind socket, bdaddr=c0:7a:a5:00:c7:11: Network is down * > I think it is paired correctly but doesn't know how to connect; in linux > with bluethothctl I get normally "device paired" ---- self-connection-trial > ---- "device connected" and 5 secs later "device disconnected". It has to > do a salvating "bip" at the box and then it's connected. > > kldstat: > > > > > > > *Id Refs Address Size Name 1 87 0xffffffff80200000 > 2288f58 kernel 2 1 0xffffffff824ad000 3170 splash_bmp.ko 3 1 > 0xffffffff824b1000 a468 ng_ubt.ko 4 3 0xffffffff824bc000 12d10 > ng_hci.ko 5 4 0xffffffff824cf000 2dc0 ng_bluetooth.ko 6 7 > 0xffffffff824d2000 18d50 netgraph.ko * > > > * 7 1 0xffffffff824eb000 18c28 ng_l2cap.ko 8 1 0xffffffff82504000 > 68840 if_em_updated.ko 9 1 0xf**fffffff8256d000 96fa0 > linux64.ko * > > > > > > > > > > > > *10 3 0xffffffff82604000 b760 linux_common.ko 11 1 > 0xffffffff82610000 b4bf0 linux.ko 12 1 0xffffffff826c5000 2a78 > ubtbcmfw.ko 13 1 0xffffffff82d18000 7b040 i915kms.ko 14 1 > 0xffffffff82d94000 3d9e8 drm2.ko 15 4 0xffffffff82dd2000 1f40 > iicbus.ko 16 1 0xffffffff82dd4000 f70 iic.ko 17 1 > 0xffffffff82dd5000 1570 iicbb.ko 18 1 0xffffffff82dd7000 15720 > if_iwm.ko 19 1 0xffffffff82ded000 e045f iwm3160fw.ko 20 1 > 0xffffffff82ece000 1840 uhid.ko 21 1 0xffffffff82ed0000 2928 > ums.ko * > > > > *22 1 0xffffffff82ed3000 19690 ng_btsocket.ko 23 1 > 0xffffffff82eed000 20f0 ng_socket.ko 24 1 0xffffffff82ef0000 > 4570 autofs.ko 25 1 0xffffffff82ef5000 acf mac_ntpd.ko * > > *26 1 0xffffffff82ef6000 19738 ext2fs.ko 27 1 0xffffffff82f10000 > 3a8c geom_linux_lvm.ko* > > 13 and 14 is new here with llvm-devel! > > > > *hccontrol -n ubt0hci read_connection_list Remote BD_ADDR > Handle Type Mode Role Encrypt Pending Queue State Ubittek_MagicBox > 12 ACL 0 MAST NONE 0 0 OPEN* > > > > > *btsockstat Active L2CAP sockets PCB Recv-Q Send-Q Local address/PSM > Foreign address CID State fffff8000331db00 0 0 * > /1 * 0 LISTEN* > > So it's now a problem with the L2CAP and there's no A2DP-fix anymore for > BSD, AFAIK. Suggestions? > https://wiki.freebsd.org/SteveWills/BTSpeaker Might be interesting. I've not tried this yet, so I don't know if it is too old, but it references bluetooth-config, which is fairly new... My goals are more modest: I just want to get the keyboard I have working, with the modified keypad I have... :) Warner Miranda >