From owner-freebsd-virtualization@freebsd.org Tue Sep 25 23:02:28 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6942B1092B11 for ; Tue, 25 Sep 2018 23:02:28 +0000 (UTC) (envelope-from olevole@olevole.ru) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F111484F78 for ; Tue, 25 Sep 2018 23:02:27 +0000 (UTC) (envelope-from olevole@olevole.ru) Received: by mail-io1-xd2d.google.com with SMTP id n18-v6so21822025ioa.9 for ; Tue, 25 Sep 2018 16:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=olevole-ru.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=ID5A46i9skf7SrTod4Y1IGGwjerZZDLUgi547WBLnhQ=; b=khFzIPXqjgfm8h13gYXGeA04CtMuUCdK8u5/yv6+r1CyFo/whmS3TGoNa63vigbEbj L5ddB9FTTHtV5uU5co4Ff+lytiVaN+t8jvuEIqefEr472VmUqTuPU1FLc4h+s1GXvzRs j8ZqhCP0WXFur1lt+32I1uUzdb3jBXuveyXeuBnpt3n01kQ4NfElIngT14IaoXgcKNXl RBXsmOTFvIpzVGXJ8+/jiou3k4lLR/QYN4UzR3WaISI4nOi1pOv56Zq/NVhiqzpI19Ze CwtdgJuqW+C2EuZbIvhAWRrq7VaDdRqOFHvh/dq3Ov3R9EL4s2CDHF8jNGgF0VhRKHrP YW+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ID5A46i9skf7SrTod4Y1IGGwjerZZDLUgi547WBLnhQ=; b=JghWRHjXQnLPXI15+5vukJXzR0HYu7bC60sOGJVRju85MgdGP04GrUNOwjHwaQB3F7 gy4QSudXB6JeypeO1o/zaH4Ig/fISslonD43k24lF891NX6GsQ6ccp6gX9zYa0iVWOC2 A9Moh3yeT4wKpyCXq9CevqVayzXQUaXiAf6huA2qnGmTxMv21rdZLmSCdpHjEMlQHjyD GJKHjLaeGmJnUUGZ+hLwBs82Lp5ChoieuHOxkdaQzA+4XCML1DoSAuxx9IWpw5nF3E5I L0vRQ+FrAEqYJPL/ep4B1Qyv28M1WvwxYGoMBX4HuQasGiOJK3OQQcVFChoN8PB4zDFn Wcww== X-Gm-Message-State: ABuFfohr+/WC0yvzeij+sFe7NPVN65JH0LGnvbfyMbJBY4Xr+HSZAlho wwG2RMu07s96UF9rUW/+R3/pF67ZsUzQOCb2snEDefdy4dM= X-Google-Smtp-Source: ACcGV60xQG2q5r4feQqtyLQLkimGQKnwfghgyUp2IRMgTNtW8msZurFJs6aTCRTgawXr0psiXtuV0k28lpPqQ1g4DBA= X-Received: by 2002:a5e:8215:: with SMTP id l21-v6mr2968323iom.232.1537916546944; Tue, 25 Sep 2018 16:02:26 -0700 (PDT) MIME-Version: 1.0 From: Oleg Ginzburg Date: Wed, 26 Sep 2018 02:02:15 +0300 Message-ID: Subject: NetBSD 8.0/amd64+ bhyve (FreeBSD 12)+xhci = SIGSEGV To: freebsd-virtualization@freebsd.org, tech-kern@netbsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 23:02:28 -0000 Hello. NetBSD works fine in bhyve, except for the case when the bhyve emulates eXtensible Host Controller Interface (xHCI) USB controller. ( -s 30,xhci,tablet ) Perhaps SIGSEGV of bhyve is caused by the abnormal behavior of xhci on the NetBSD guest, so I decided to write both mailing lists. LLDB output upon bhyve crash (guest screen: https://pasteboard.co/HFAqTOk.png ): https://github.com/freebsd/freebsd/blob/ebeb3285f598d6c1214c49598c951493d09e1067/usr.sbin/bhyve/pci_xhci.c#L735 Process 57083 stopped * thread #20, name = 'vcpu 0', stop reason = signal SIGSEGV: invalid address (fault address: 0x0) frame #0: 0x00000000002587d8 bhyve`pci_xhci_insert_event(sc=0x00000008010a5100, evtrb=0x00007fffddbeba78, do_intr=0) at pci_xhci.c:735 732 rts = &sc->rtsregs; 733 734 erdp = rts->intrreg.erdp & ~0xF; -> 735 erdp_idx = (erdp - rts->erstba_p[rts->er_deq_seg].qwEvrsTablePtr) / 736 sizeof(struct xhci_trb); 737 738 DPRINTF(("pci_xhci: insert event 0[%lx] 2[%x] 3[%x]\r\n" (lldb) frame variable erdp_idx (int) erdp_idx = 0 in all likelihood, the problem in the rts->erstba_p structure because when I commenting 735 line ( erdp_idx is used only in DPRINTF debug output ) the next stop when working with this structure again, e.g: Process 58354 stopped * thread #20, name = 'vcpu 0', stop reason = signal SIGSEGV: invalid address (fault address: 0x8) frame #0: 0x0000000000258881 bhyve`pci_xhci_insert_event(sc=0x00000008010a5100, evtrb=0x00007fffddbeba78, do_intr=0) at pci_xhci.c:750 747 evtrbptr = &rts->erst_p[rts->er_enq_idx]; 748 749 /* TODO: multi-segment table */ -> 750 if (rts->er_events_cnt >= rts->erstba_p->dwEvrsTableSize) { 751 DPRINTF(("pci_xhci[%d] cannot insert event; ring full\r\n", 752 __LINE__)); 753 err = XHCI_TRB_ERROR_EV_RING_FULL; What can I do to find out the reasons for this behavior? Thanks!