From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 13 08:17:47 2011 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35AA5106566B; Tue, 13 Dec 2011 08:17:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id C870F8FC14; Tue, 13 Dec 2011 08:17:45 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA06506; Tue, 13 Dec 2011 10:17:38 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RaNYP-000LLp-EZ; Tue, 13 Dec 2011 10:17:37 +0200 Message-ID: <4EE70A1F.8040406@FreeBSD.org> Date: Tue, 13 Dec 2011 10:17:35 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111206 Thunderbird/8.0 MIME-Version: 1.0 To: Hans Petter Selasky References: <4EE51CB5.1060505@FreeBSD.org> <201112121658.22864.hselasky@c2i.net> <201112121405.38322.jhb@freebsd.org> <201112122009.12557.hselasky@c2i.net> <4EE67E4F.3010906@FreeBSD.org> In-Reply-To: <4EE67E4F.3010906@FreeBSD.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: usb@FreeBSD.org, freebsd-hackers@FreeBSD.org, John Baldwin , mdf@FreeBSD.org Subject: Re: kern_yield vs ukbd_yield X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2011 08:17:47 -0000 on 13/12/2011 00:21 Andriy Gapon said the following: > on 12/12/2011 21:09 Hans Petter Selasky said the following: >> On Monday 12 December 2011 20:05:38 John Baldwin wrote: >>>> Hi, >>>> >>>> >>>> >>>>> hselasky@ or someone else familiar with the various usb threads would >>>>> have to answer that. >>>> >>>> >>>> >>>> The problem is only during init() where the init thread has highest >>>> priority and that doesn't allow other threads to run even if the >>>> scheduler is >>> >>> running! >>> >>> Hmm, that should be fixed by lowering the relevant thread's priority. >>> Do you mean thread0 (the one doing all the SYSINIT's or thread we create >>> for init (pid 1) before it executes init? >> >> Yes, thread0. Correct! > > Mmm, my short debugging session with qemu shows that it is actually pid 1: And in the view of the below data I would like us to revisit this problem. I looked over usb code and it seems that all usb threads are created with priorities of either USB_PRI_MED or USB_PRI_HIGH, which translates to PI_SWI(SWI_CAMBIO) and PI_SWI(SWI_NET). These priorities should be in the ithread range, so it's kind of surprising that the init thread (with PVM priority) can cause troubles for them. > Breakpoint 1, ukbd_do_poll (sc=0xffffff8000764000, wait=0 '\0') at > /usr/src/sys/dev/usb/input/ukbd.c:403 > 403 { > (kgdb) bt > #0 ukbd_do_poll (sc=0xffffff8000764000, wait=0 '\0') at > /usr/src/sys/dev/usb/input/ukbd.c:403 > #1 0xffffffff803ee57e in ukbd_check (kbd=Variable "kbd" is not available. > ) at /usr/src/sys/dev/usb/input/ukbd.c:1418 > #2 0xffffffff803ee674 in ukbd_check_char (kbd=0xffffff8000764000) at > /usr/src/sys/dev/usb/input/ukbd.c:1450 > #3 0xffffffff8035c794 in kbdmux_read_char (kbd=0xfffffe00021d2c00, > wait=Variable "wait" is not available. > ) at /usr/src/sys/dev/kbdmux/kbdmux.c:665 > #4 0xffffffff803bf4aa in scgetc (sc=0xffffffff81835dc0, flags=Variable "flags" > is not available. > ) at /usr/src/sys/dev/syscons/syscons.c:3373 > #5 0xffffffff803c2d03 in sc_cngetc (cd=Variable "cd" is not available. > ) at /usr/src/sys/dev/syscons/syscons.c:1753 > #6 0xffffffff804ae489 in cncheckc () at /usr/src/sys/kern/kern_cons.c:402 > #7 0xffffffff804ae4c7 in cngetc () at /usr/src/sys/kern/kern_cons.c:383 > #8 0xffffffff804ae9a7 in cngets (cp=0xffffff8000326aa0 "", size=80, visible=1) > at /usr/src/sys/kern/kern_cons.c:421 > #9 0xffffffff80594d4e in vfs_mountroot () at /usr/src/sys/kern/vfs_mountroot.c:490 > #10 0xffffffff804a6e65 in start_init (dummy=Variable "dummy" is not available. > ) at /usr/src/sys/kern/init_main.c:683 > #11 0xffffffff804c5a9a in fork_exit (callout=0xffffffff804a6e00 , > arg=0x0, frame=0xffffff8000326c50) at /usr/src/sys/kern/kern_fork.c:995 > #12 0xffffffff806bb72e in fork_trampoline () at > /usr/src/sys/amd64/amd64/exception.S:602 > #13 0x0000000000000000 in ?? () > (kgdb) p td->td_proc->p_pid > $7 = 1 > (kgdb) p td->td_proc->p_comm > $8 = "kernel", '\0' > (kgdb) p td->td_tid > $9 = 100002 > > Also: > (kgdb) p/d td->td_user_pri > $10 = 139 > (kgdb) p/d td->td_base_pri > $11 = 84 > -- Andriy Gapon