From owner-freebsd-drivers@FreeBSD.ORG Sun May 26 04:19:17 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9F7B7EF1 for ; Sun, 26 May 2013 04:19:17 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id 7AE7B926 for ; Sun, 26 May 2013 04:19:17 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id r4Q4J8Ua021140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 25 May 2013 21:19:08 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id r4Q4J8ou021139; Sat, 25 May 2013 21:19:08 -0700 (PDT) (envelope-from jmg) Date: Sat, 25 May 2013 21:19:08 -0700 From: John-Mark Gurney To: Jesus Alejandro Padilla Subject: Re: Getting a list of all drivers Message-ID: <20130526041908.GF90852@funkthat.com> Mail-Followup-To: Jesus Alejandro Padilla , freebsd-drivers@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sat, 25 May 2013 21:19:08 -0700 (PDT) Cc: freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 May 2013 04:19:17 -0000 Jesus Alejandro Padilla wrote this message on Tue, May 21, 2013 at 20:31 -0400: > I?m trying to get a comprehensive list of all the drivers in FreeBSD (I?m > talking about all the drivers available, not only the ones installed in my > system). I was thinking of getting them from the kernel source code (/sys), > but I?ve had some problems. Here?s what I?ve tried so far. > > - Get all loadable kernel modules. The problem with this approach is > that there are many modules that are not drivers (like MAC policies). > - Get the ?device? entries in the GENERIC and NOTES configuration files. > However, this has the same problem as the loadable kernel modules; there > are ?devices? that are not drivers, and I think that these files don?t > contain all drivers, only the ones that will be compiled statically with > the kernel, right? > - Get the modules under /sys/dev. The problem is that there are other > drivers that are outside this folder. > > Do you know if there?s a better way of building this list? Is there a file, > like a MAINTAINERS file that contains this information up to date? I?d > really appreciate any help. > > Thank you very much! > > Alex > > PS: I know that some proprietary drivers, like Nvidia's, might be hard to > get, but I?d like to get at least all the list of the drivers included in > the kernel source code (/sys). Getting the complete list might be a bit hard. When I did my How to Write a FreeBSD Device Driver for BSDCan, I put together an awk script (I can't seem to find it right now) that would extract all the DRIVER_MODULE like lines, and build up a dot graph: http://people.freebsd.org/~jmg/drivers/driver.tree.pdf There are also lines: EARLY_DRIVER_MODULE EARLY_DRIVER_MODULE_ORDERED DRIVER_MODULE_ORDERED The lines are like: DRIVER_MODULE(musbotg, atmelarm, musbotg_driver, musbotg_devclass, 0, 0); where the first arg, musbotg is the driver, and atmelarm is the bus it conencts to... A single driver can connect to multiple busses... A good example of that is a driver like ed: if_ed_cbus.c:DRIVER_MODULE(ed, isa, ed_cbus_driver, ed_devclass, 0, 0); if_ed_isa.c:DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); if_ed_pccard.c:DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, 0); if_ed_pccard.c:DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, 0, 0); if_ed_pci.c:DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0); It connects to isa, pci and pccard, but it has a subbus which is the miibus.. The difficulty is that there isn't too much distinction between a driver and a bus... You can't just look for all the leaves, since as I just demonstrated, ed is a driver, but it has a subbus... Good luck! -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-freebsd-drivers@FreeBSD.ORG Wed May 29 00:30:42 2013 Return-Path: Delivered-To: drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1CEDFFF7 for ; Wed, 29 May 2013 00:30:42 +0000 (UTC) (envelope-from co_bounces@high-velocity-media.com) Received: from bx142.blacksun.ca (bx142.blacksun.ca [69.27.114.3]) by mx1.freebsd.org (Postfix) with ESMTP id E02E4806 for ; Wed, 29 May 2013 00:30:41 +0000 (UTC) Received: from www.high-velocity-media.com (bx142.blacksun.ca [69.27.114.2]) by bx142.blacksun.ca (8.13.1/8.13.1) with ESMTP id r4T0Gsa2008209 for ; Tue, 28 May 2013 18:16:55 -0600 Date: Tue, 28 May 2013 19:16:54 -0500 To: drivers@freebsd.org From: Depth Magazine Subject: Summer Issue COMING SOON Message-ID: X-Priority: 3 X-Mailer: PHPMailer [version 1.73] X-Mailer: phplist v2.10.19 X-MessageID: 2 X-ListMember: drivers@freebsd.org Errors-To: co_bounces@high-velocity-media.com MIME-Version: 1.0 X-yoursite-MailScanner-Information: Please contact the ISP for more information X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: co_bounces@high-velocity-media.com Content-Type: text/plain; charset = "UTF-8" Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2013 00:30:42 -0000 Just a quick email, to let everyone know, that we are currently finalizing the Summer issue, and we would like to encourage anyone that has not yet logged in to view the Spring issue, should do it now. PLEASE HELP US GROW, TELL A FRIEND. Doug Smith Depth Magazine If you do not want to receive any more emails, http://www.high-velocity-media.com/lists/?p=unsubscribe&uid= -- powered by phpList, www.phplist.com -- From owner-freebsd-drivers@FreeBSD.ORG Wed May 29 18:16:45 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 75591AB5 for ; Wed, 29 May 2013 18:16:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 54C47E5A for ; Wed, 29 May 2013 18:16:45 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 259A0B96F; Wed, 29 May 2013 14:16:42 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Subject: Re: taskqueues Date: Wed, 29 May 2013 11:56:28 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> In-Reply-To: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201305291156.29230.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 29 May 2013 14:16:42 -0400 (EDT) Cc: Orit Moskovich X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2013 18:16:45 -0000 On Thursday, May 23, 2013 9:47:14 am Orit Moskovich wrote: > Hi, > > Can you please specify the difference between interrupt threads and regular kernel threads in the context of the different default taskqueues? > Meaning, I saw that the taskqueue taskqueue_thread is actually a kernel thread running the function taskqueue_thread_loop, > And the 3 other default taskqueues are working with ithreads. > > Which of the above preempts the other? What should I use if performance is critical (something equivalent to Linux softirq...)? ithreads use the most important priority range: #define PRI_MIN (0) /* Highest priority. */ #define PRI_MAX (255) /* Lowest priority. */ #define PRI_MIN_ITHD (PRI_MIN) #define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1) #define PI_REALTIME (PRI_MIN_ITHD + 0) #define PI_AV (PRI_MIN_ITHD + 4) #define PI_NET (PRI_MIN_ITHD + 8) #define PI_DISK (PRI_MIN_ITHD + 12) #define PI_TTY (PRI_MIN_ITHD + 16) #define PI_DULL (PRI_MIN_ITHD + 20) #define PI_SOFT (PRI_MIN_ITHD + 24) #define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ) For example, an INTR_TYPE_NET interrupt will generally run in an ithread with the PI_NET priority. For software interrupt threads the priority is generally PI_SWI(SWI_xxx). The SWI_xxx constants are: /* * Software interrupt numbers in priority order. The priority determines * the priority of the corresponding interrupt thread. */ #define SWI_TTY 0 #define SWI_NET 1 #define SWI_CAMBIO 2 #define SWI_VM 3 #define SWI_CLOCK 4 #define SWI_TQ_FAST 5 #define SWI_TQ 6 #define SWI_TQ_GIANT 6 For taskqueues you have three global taskqueues to choose from: taskqueue_fast: runs at PI_SWI(SWI_TQ_FAST) = 44 taskqueue_swi: runs at PI_SWI(SWI_TQ) = 48 taskqueue_thread: runs at PWAIT = 108 However, you can create your own thread-backed taskqueue that can run at whatever priority you choose. There is nothing really special about having the taskqueue be an SWI vs a normal thread. If you wanted a taskqueue that ran at PI_NET you could do: TASKQUEUE_DEFINE(foo, taskqueue_thread_enqueue, &taskqueue_foo, taskqueue_start_threads(&taskqueue_foo, 1, PI_NET, "foo taskq"); If you needed to queue tasks from an interrupt filter you would want to use a fast taskqueue instead: TASKQUEUE_FAST_DEFINE(< same args as above >) -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Thu May 30 05:15:46 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1A7C3983; Thu, 30 May 2013 05:15:46 +0000 (UTC) (envelope-from oritm@mellanox.com) Received: from eu1sys200aog107.obsmtp.com (eu1sys200aog107.obsmtp.com [207.126.144.123]) by mx1.freebsd.org (Postfix) with ESMTP id 103BBF02; Thu, 30 May 2013 05:15:44 +0000 (UTC) Received: from MTLCAS02.mtl.com ([193.47.165.155]) (using TLSv1) by eu1sys200aob107.postini.com ([207.126.147.11]) with SMTP ID DSNKUabgavk7Ic40MrzEqmW8Bk8NHaYQ4mpk@postini.com; Thu, 30 May 2013 05:15:45 UTC Received: from MTLDAG01.mtl.com ([10.0.8.75]) by MTLCAS02.mtl.com ([10.0.8.72]) with mapi id 14.03.0123.003; Thu, 30 May 2013 08:12:31 +0300 From: Orit Moskovich To: John Baldwin , "freebsd-drivers@freebsd.org" Subject: RE: taskqueues Thread-Topic: taskqueues Thread-Index: Ac5XuKI6XhgBsdJeSxm0tXVuhEIwAQEs0ywAACHdQmA= Date: Thu, 30 May 2013 05:12:31 +0000 Message-ID: <981733489AB3BD4DB24B48340F53E0A55B0D63D3@MTLDAG01.mtl.com> References: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> <201305291156.29230.jhb@freebsd.org> In-Reply-To: <201305291156.29230.jhb@freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.13.1] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 05:15:46 -0000 >From the SMPng Design Document, I read that interrupt threads run at real-t= ime kernel priority. So wouldn't it be better to define a taskqueue using TASKQUEUE_FAST_DEFINE,= but instead of ' taskqueue_start_threads(&taskqueue_foo, 1, PI_NET, "foo t= askq"); ', use=20 swi_add(NULL, "...", taskqueue_swi_run, NULL, PI_NET, INTR_MPSAFE, &taskqueue_ih)) ? -----Original Message----- From: John Baldwin [mailto:jhb@freebsd.org]=20 Sent: Wednesday, May 29, 2013 09:17 PM To: freebsd-drivers@freebsd.org Cc: Orit Moskovich Subject: Re: taskqueues On Thursday, May 23, 2013 9:47:14 am Orit Moskovich wrote: > Hi, >=20 > Can you please specify the difference between interrupt threads and=20 > regular kernel threads in the context of the different default taskqueues? > Meaning, I saw that the taskqueue taskqueue_thread is actually a=20 > kernel thread running the function taskqueue_thread_loop, > And the 3 other default taskqueues are working with ithreads. >=20 > Which of the above preempts the other? What should I use if=20 > performance is critical (something equivalent to Linux softirq...)? ithreads use the most important priority range: #define PRI_MIN (0) /* Highest priority. */ #define PRI_MAX (255) /* Lowest priority. */ #define PRI_MIN_ITHD (PRI_MIN) #define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1) #define PI_REALTIME (PRI_MIN_ITHD + 0) #define PI_AV (PRI_MIN_ITHD + 4) #define PI_NET (PRI_MIN_ITHD + 8) #define PI_DISK (PRI_MIN_ITHD + 12) #define PI_TTY (PRI_MIN_ITHD + 16) #define PI_DULL (PRI_MIN_ITHD + 20) #define PI_SOFT (PRI_MIN_ITHD + 24) #define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ) For example, an INTR_TYPE_NET interrupt will generally run in an ithread wi= th the PI_NET priority. For software interrupt threads the priority is gen= erally PI_SWI(SWI_xxx). The SWI_xxx constants are: /* * Software interrupt numbers in priority order. The priority determines * the priority of the corresponding interrupt thread. */ #define SWI_TTY 0 #define SWI_NET 1 #define SWI_CAMBIO 2 #define SWI_VM 3 #define SWI_CLOCK 4 #define SWI_TQ_FAST 5 #define SWI_TQ 6 #define SWI_TQ_GIANT 6 For taskqueues you have three global taskqueues to choose from: taskqueue_fast: runs at PI_SWI(SWI_TQ_FAST) =3D 44 taskqueue_swi: runs at PI_SWI(SWI_TQ) =3D 48 taskqueue_thread: runs at PWAIT =3D 108 However, you can create your own thread-backed taskqueue that can run at wh= atever priority you choose. There is nothing really special about having t= he taskqueue be an SWI vs a normal thread. If you wanted a taskqueue that = ran at PI_NET you could do: TASKQUEUE_DEFINE(foo, taskqueue_thread_enqueue, &taskqueue_foo, taskqueue_start_threads(&taskqueue_foo, 1, PI_NET, "foo taskq"); If you needed to queue tasks from an interrupt filter you would want to use= a fast taskqueue instead: TASKQUEUE_FAST_DEFINE(< same args as above >) -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Thu May 30 06:04:58 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 380973FE; Thu, 30 May 2013 06:04:58 +0000 (UTC) (envelope-from oritm@mellanox.com) Received: from eu1sys200aog118.obsmtp.com (eu1sys200aog118.obsmtp.com [207.126.144.145]) by mx1.freebsd.org (Postfix) with ESMTP id 28447F6; Thu, 30 May 2013 06:04:56 +0000 (UTC) Received: from MTLCAS02.mtl.com ([193.47.165.155]) (using TLSv1) by eu1sys200aob118.postini.com ([207.126.147.11]) with SMTP ID DSNKUabsAim/O9uegauP85lK/le4VNY4cmE6@postini.com; Thu, 30 May 2013 06:04:57 UTC Received: from MTLDAG01.mtl.com ([10.0.8.75]) by MTLCAS02.mtl.com ([10.0.8.72]) with mapi id 14.03.0123.003; Thu, 30 May 2013 09:04:49 +0300 From: Orit Moskovich To: John Baldwin , "freebsd-drivers@freebsd.org" Subject: RE: taskqueues Thread-Topic: taskqueues Thread-Index: Ac5XuKI6XhgBsdJeSxm0tXVuhEIwAQEs0ywAACKnorA= Date: Thu, 30 May 2013 06:04:48 +0000 Message-ID: <981733489AB3BD4DB24B48340F53E0A55B0D6417@MTLDAG01.mtl.com> References: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> <201305291156.29230.jhb@freebsd.org> In-Reply-To: <201305291156.29230.jhb@freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.13.1] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 06:04:58 -0000 Also, is it possible to set affinity of a task in a taskqueue? From what I = understood, each interrupt thread handling taskqueues and the ithread of th= e bus_setup_intr is a single thread, not one per cpu. What possibilities I have if I need to defer work from a filter routine to = multiple tasks, and schedule them to work on a specific core? -----Original Message----- From: John Baldwin [mailto:jhb@freebsd.org]=20 Sent: Wednesday, May 29, 2013 09:17 PM To: freebsd-drivers@freebsd.org Cc: Orit Moskovich Subject: Re: taskqueues On Thursday, May 23, 2013 9:47:14 am Orit Moskovich wrote: > Hi, >=20 > Can you please specify the difference between interrupt threads and=20 > regular kernel threads in the context of the different default taskqueues? > Meaning, I saw that the taskqueue taskqueue_thread is actually a=20 > kernel thread running the function taskqueue_thread_loop, > And the 3 other default taskqueues are working with ithreads. >=20 > Which of the above preempts the other? What should I use if=20 > performance is critical (something equivalent to Linux softirq...)? ithreads use the most important priority range: #define PRI_MIN (0) /* Highest priority. */ #define PRI_MAX (255) /* Lowest priority. */ #define PRI_MIN_ITHD (PRI_MIN) #define PRI_MAX_ITHD (PRI_MIN_REALTIME - 1) #define PI_REALTIME (PRI_MIN_ITHD + 0) #define PI_AV (PRI_MIN_ITHD + 4) #define PI_NET (PRI_MIN_ITHD + 8) #define PI_DISK (PRI_MIN_ITHD + 12) #define PI_TTY (PRI_MIN_ITHD + 16) #define PI_DULL (PRI_MIN_ITHD + 20) #define PI_SOFT (PRI_MIN_ITHD + 24) #define PI_SWI(x) (PI_SOFT + (x) * RQ_PPQ) For example, an INTR_TYPE_NET interrupt will generally run in an ithread wi= th the PI_NET priority. For software interrupt threads the priority is gen= erally PI_SWI(SWI_xxx). The SWI_xxx constants are: /* * Software interrupt numbers in priority order. The priority determines * the priority of the corresponding interrupt thread. */ #define SWI_TTY 0 #define SWI_NET 1 #define SWI_CAMBIO 2 #define SWI_VM 3 #define SWI_CLOCK 4 #define SWI_TQ_FAST 5 #define SWI_TQ 6 #define SWI_TQ_GIANT 6 For taskqueues you have three global taskqueues to choose from: taskqueue_fast: runs at PI_SWI(SWI_TQ_FAST) =3D 44 taskqueue_swi: runs at PI_SWI(SWI_TQ) =3D 48 taskqueue_thread: runs at PWAIT =3D 108 However, you can create your own thread-backed taskqueue that can run at wh= atever priority you choose. There is nothing really special about having t= he taskqueue be an SWI vs a normal thread. If you wanted a taskqueue that = ran at PI_NET you could do: TASKQUEUE_DEFINE(foo, taskqueue_thread_enqueue, &taskqueue_foo, taskqueue_start_threads(&taskqueue_foo, 1, PI_NET, "foo taskq"); If you needed to queue tasks from an interrupt filter you would want to use= a fast taskqueue instead: TASKQUEUE_FAST_DEFINE(< same args as above >) -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Thu May 30 12:18:52 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C83CA7A9 for ; Thu, 30 May 2013 12:18:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 80247A7C for ; Thu, 30 May 2013 12:18:52 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A68E5B963; Thu, 30 May 2013 08:18:51 -0400 (EDT) From: John Baldwin To: Orit Moskovich Subject: Re: taskqueues Date: Thu, 30 May 2013 08:06:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> <201305291156.29230.jhb@freebsd.org> <981733489AB3BD4DB24B48340F53E0A55B0D63D3@MTLDAG01.mtl.com> In-Reply-To: <981733489AB3BD4DB24B48340F53E0A55B0D63D3@MTLDAG01.mtl.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201305300806.24399.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 30 May 2013 08:18:51 -0400 (EDT) Cc: "freebsd-drivers@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 12:18:52 -0000 On Thursday, May 30, 2013 1:12:31 am Orit Moskovich wrote: > From the SMPng Design Document, I read that interrupt threads run at real-time kernel priority. The priority ranges have changed since I wrote that (and what I wrote wasn't really accurate). There isn't really a real-time kernel priority range. The ithread priorities are the most important, followed by user real-time priorities, in-kernel sleep priorities, user time-sharing priorities, and finally user idle priorities. > So wouldn't it be better to define a taskqueue using TASKQUEUE_FAST_DEFINE, but instead of ' taskqueue_start_threads(&taskqueue_foo, 1, PI_NET, "foo taskq"); ', use > swi_add(NULL, "...", taskqueue_swi_run, NULL, PI_NET, > INTR_MPSAFE, &taskqueue_ih)) Well, swi_add() doesn't take a direct priority, it takes a SWI_xxx constant that it passes to PI_SWI to generate a priority (so you'd need a gross hack of using a negative number to get a resulting priority of PI_NET). However, the threads created (whether by swi_add() or taskqueue_start_threads()) would be treated exactly the same by the scheduler. There is nothing special about ithreads except that they are assigned to a dedicated priority range by default. Any other thread can use those priorities (and they do for during priority lending), but most other threads in the kernel do not use ithread priorities by convention unless they are doing ithread-type work. -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Thu May 30 12:18:53 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B12847AA for ; Thu, 30 May 2013 12:18:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8ABAAA7D for ; Thu, 30 May 2013 12:18:53 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E8093B968; Thu, 30 May 2013 08:18:52 -0400 (EDT) From: John Baldwin To: Orit Moskovich Subject: Re: taskqueues Date: Thu, 30 May 2013 08:08:12 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p25; KDE/4.5.5; amd64; ; ) References: <981733489AB3BD4DB24B48340F53E0A55B0D5206@MTLDAG01.mtl.com> <201305291156.29230.jhb@freebsd.org> <981733489AB3BD4DB24B48340F53E0A55B0D6417@MTLDAG01.mtl.com> In-Reply-To: <981733489AB3BD4DB24B48340F53E0A55B0D6417@MTLDAG01.mtl.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201305300808.12692.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 30 May 2013 08:18:53 -0400 (EDT) Cc: "freebsd-drivers@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 12:18:53 -0000 On Thursday, May 30, 2013 2:04:48 am Orit Moskovich wrote: > Also, is it possible to set affinity of a task in a taskqueue? From what I understood, each interrupt thread handling taskqueues and the ithread of the bus_setup_intr is a single thread, not one per cpu. Correct. > What possibilities I have if I need to defer work from a filter routine to multiple tasks, and schedule them to work on a specific core? Currently there is no pre-built API to give you per-CPU work queues. However, you could create a taskqueue for each CPU (and schedule an initial task that calls sched_bind() to bind the associated thread to a specific CPU) and then you could schedule a task for a specific CPU by scheduling it on the taskqueue for a specific CPU. -- John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Thu May 30 17:15:49 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0271BB49 for ; Thu, 30 May 2013 17:15:49 +0000 (UTC) (envelope-from jesalepad@gmail.com) Received: from mail-ie0-x236.google.com (mail-ie0-x236.google.com [IPv6:2607:f8b0:4001:c03::236]) by mx1.freebsd.org (Postfix) with ESMTP id CD6E579D for ; Thu, 30 May 2013 17:15:48 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id a14so1256429iee.27 for ; Thu, 30 May 2013 10:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=j4He4PGQCGMoaf1qJt48w+uweK2xAY/OOLEDoFHdkkw=; b=XTNNQCP/5rQnfzMGQCVi3ggNUm77/mEAcCVz+ddq/Wn2HOl2YRML7iEMTwP7Beq73I peXfNZ1+doVHzmBhV8uCDYUFMmZiWgXysUwht7b09PAyQC7kalWEdPrR0Ememqb68CNi dYCmYrci5zdfB8f+aECcbU/fJD4ISCPh8Pl84OZLRGU+sIUoJXEdzsPQpQ5l8cAlnUuj q9s4kFUYlMXCqDMx9iP7LCLvRup7cg5VPKGvoz+8nJMix4S29p3wayt3+tZAPoDbvXrt YJq/WqQOb6Ef32QaOCXV1gfYUvLd+7LKavvJdLOMXkF2iPreAKTk0uXF2fruWNiP2Ybg 1NwQ== MIME-Version: 1.0 X-Received: by 10.50.17.166 with SMTP id p6mr12273645igd.12.1369934148530; Thu, 30 May 2013 10:15:48 -0700 (PDT) Received: by 10.64.44.77 with HTTP; Thu, 30 May 2013 10:15:48 -0700 (PDT) In-Reply-To: <20130526041908.GF90852@funkthat.com> References: <20130526041908.GF90852@funkthat.com> Date: Thu, 30 May 2013 13:15:48 -0400 Message-ID: Subject: Re: Getting a list of all drivers From: Jesus Alejandro Padilla To: freebsd-drivers@freebsd.org, jmg@funkthat.com Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 17:15:49 -0000 Hi John-Mark, Thank you very much for your reply. I've tried other approaches based on what you told me, but I'm still getting stuck in some places... You're right, it's very hard to differentiate between drivers and a bus. Now I'm thinking of building a graph similar to the one you showed me and analyze manually the nodes I'm doubtful about (It's going to be a lot of work). Thank you again, Alex 2013/5/26 John-Mark Gurney > Jesus Alejandro Padilla wrote this message on Tue, May 21, 2013 at 20:31 > -0400: > > I?m trying to get a comprehensive list of all the drivers in FreeBSD (I?m > > talking about all the drivers available, not only the ones installed in > my > > system). I was thinking of getting them from the kernel source code > (/sys), > > but I?ve had some problems. Here?s what I?ve tried so far. > > > > - Get all loadable kernel modules. The problem with this approach is > > that there are many modules that are not drivers (like MAC policies). > > - Get the ?device? entries in the GENERIC and NOTES configuration > files. > > However, this has the same problem as the loadable kernel modules; > there > > are ?devices? that are not drivers, and I think that these files don?t > > contain all drivers, only the ones that will be compiled statically > with > > the kernel, right? > > - Get the modules under /sys/dev. The problem is that there are other > > drivers that are outside this folder. > > > > Do you know if there?s a better way of building this list? Is there a > file, > > like a MAINTAINERS file that contains this information up to date? I?d > > really appreciate any help. > > > > Thank you very much! > > > > Alex > > > > PS: I know that some proprietary drivers, like Nvidia's, might be hard to > > get, but I?d like to get at least all the list of the drivers included in > > the kernel source code (/sys). > > Getting the complete list might be a bit hard. When I did my How > to Write a FreeBSD Device Driver for BSDCan, I put together an awk > script (I can't seem to find it right now) that would extract all > the DRIVER_MODULE like lines, and build up a dot graph: > http://people.freebsd.org/~jmg/drivers/driver.tree.pdf > > There are also lines: > EARLY_DRIVER_MODULE > EARLY_DRIVER_MODULE_ORDERED > DRIVER_MODULE_ORDERED > > The lines are like: > DRIVER_MODULE(musbotg, atmelarm, musbotg_driver, musbotg_devclass, 0, 0); > > where the first arg, musbotg is the driver, and atmelarm is the bus > it conencts to... A single driver can connect to multiple busses... > A good example of that is a driver like ed: > if_ed_cbus.c:DRIVER_MODULE(ed, isa, ed_cbus_driver, ed_devclass, 0, 0); > if_ed_isa.c:DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); > if_ed_pccard.c:DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, > 0); > if_ed_pccard.c:DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, > 0, 0); > if_ed_pci.c:DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0); > > It connects to isa, pci and pccard, but it has a subbus which is the > miibus.. > > The difficulty is that there isn't too much distinction between a > driver and a bus... You can't just look for all the leaves, since as > I just demonstrated, ed is a driver, but it has a subbus... > > Good luck! > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." >