From owner-freebsd-arch@FreeBSD.ORG Mon Oct 20 00:53:36 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC0B716A4B3; Mon, 20 Oct 2003 00:53:35 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 98DD743FB1; Mon, 20 Oct 2003 00:53:34 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.10/8.12.10) with ESMTP id h9K7rP4b007363; Mon, 20 Oct 2003 09:53:25 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Andrew Gallatin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Thu, 04 Sep 2003 17:34:30 EDT." <16215.45030.31344.503298@grasshopper.cs.duke.edu> Date: Mon, 20 Oct 2003 09:53:25 +0200 Message-ID: <7362.1066636405@critter.freebsd.dk> cc: arch@freebsd.org cc: current@freebsd.org Subject: Re: DISCUSSION: /dev/fd%d.%d and /dev/{a}cd%d[ac] to be discontinued ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2003 07:53:36 -0000 In message <16215.45030.31344.503298@grasshopper.cs.duke.edu>, Andrew Gallatin writes: > >Poul-Henning Kamp writes: > > > > As soon as these uses of cloning code has been removed, I will move > > the floppy and CD drivers under GEOM, paving the way for the > > significant changes to the buf/VM system which some of you have > > already heard rumours about. (more will emerge after BSDcon'03) > > > > And now comes the bit which I would like to offer for discussion: > > > > Should we do this for 5.2 instead ? > > > >I think this sounds good. > >Can you give a hint as to what you mean by the significant buf/VM >system changes? Are you talking about removing the vnode detour for >drivers and giving drivers who want it access to the struct file? ... and all that stuff yes. It's been discussed in various emails in the past. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Mon Oct 20 05:28:03 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC37B16A4B3 for ; Mon, 20 Oct 2003 05:28:03 -0700 (PDT) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id B6F5D43FBF for ; Mon, 20 Oct 2003 05:28:02 -0700 (PDT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.12.10/8.12.10) with ESMTP id h9KCS1n6010806 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 20 Oct 2003 08:28:01 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id h9KCRup45273; Mon, 20 Oct 2003 08:27:56 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16275.54476.170348.927902@grasshopper.cs.duke.edu> Date: Mon, 20 Oct 2003 08:27:56 -0400 (EDT) To: "Poul-Henning Kamp" In-Reply-To: <7362.1066636405@critter.freebsd.dk> References: <16215.45030.31344.503298@grasshopper.cs.duke.edu> <7362.1066636405@critter.freebsd.dk> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid cc: arch@freebsd.org Subject: Re: DISCUSSION: /dev/fd%d.%d and /dev/{a}cd%d[ac] to be discontinued ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2003 12:28:03 -0000 Poul-Henning Kamp writes: > In message <16215.45030.31344.503298@grasshopper.cs.duke.edu>, Andrew Gallatin > writes: > >system changes? Are you talking about removing the vnode detour for > >drivers and giving drivers who want it access to the struct file? > > ... and all that stuff yes. > > It's been discussed in various emails in the past. > Which is very hard to find. Try searching for things like 'phk + dev + vnode' .. ;) I was hoping you had a writeup or a link to one handy. Drew From owner-freebsd-arch@FreeBSD.ORG Mon Oct 20 06:05:55 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8820516A4B3 for ; Mon, 20 Oct 2003 06:05:55 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8215043FAF for ; Mon, 20 Oct 2003 06:05:54 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.10/8.12.10) with ESMTP id h9KD5n4b010119; Mon, 20 Oct 2003 15:05:49 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Andrew Gallatin From: "Poul-Henning Kamp" In-Reply-To: Your message of "Mon, 20 Oct 2003 08:27:56 EDT." <16275.54476.170348.927902@grasshopper.cs.duke.edu> Date: Mon, 20 Oct 2003 15:05:49 +0200 Message-ID: <10118.1066655149@critter.freebsd.dk> cc: arch@freebsd.org Subject: Re: DISCUSSION: /dev/fd%d.%d and /dev/{a}cd%d[ac] to be discontinued ? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2003 13:05:55 -0000 In message <16275.54476.170348.927902@grasshopper.cs.duke.edu>, Andrew Gallatin writes: > >Poul-Henning Kamp writes: > > In message <16215.45030.31344.503298@grasshopper.cs.duke.edu>, Andrew Gallatin > > writes: > > > >system changes? Are you talking about removing the vnode detour for > > >drivers and giving drivers who want it access to the struct file? > > > > ... and all that stuff yes. > > > > It's been discussed in various emails in the past. > > > >Which is very hard to find. Try searching for things like 'phk + dev >+ vnode' .. ;) I was hoping you had a writeup or a link to one >handy. Not quite. I'll put it on my list. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-freebsd-arch@FreeBSD.ORG Tue Oct 21 20:21:46 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1462716A4B3 for ; Tue, 21 Oct 2003 20:21:46 -0700 (PDT) Received: from sohgo.tanimura.dyndns.org (IP1A0619.kng.mesh.ad.jp [211.13.103.239]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9747743FDF for ; Tue, 21 Oct 2003 20:21:43 -0700 (PDT) (envelope-from tanimura@tanimura.dyndns.org) Received: from sohgo.tanimura.dyndns.org (localhost [IPv6:::1]) ESMTP id h9M3LfB6041132 ; Wed, 22 Oct 2003 12:21:41 +0900 (JST) Received: (from uucp@localhost) (8.12.9/3.7W-submit-carrots-Tokyu-Meguro) with UUCP id h9M3LeP4041131 ; Wed, 22 Oct 2003 12:21:40 +0900 (JST) Received: from urban.nkth.tanimura.dyndns.org (localhost [IPv6:::1]) with ESMTP id h9M3JGI1005225 ; Wed, 22 Oct 2003 12:19:16 +0900 (JST) Message-Id: <200310220319.h9M3JGI1005225@urban> Date: Wed, 22 Oct 2003 12:19:16 +0900 From: Seigo Tanimura To: arch@FreeBSD.org User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 13) (Rational FORTRAN) (i386--freebsd) Organization: My Home MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII cc: Seigo Tanimura Subject: Who should set the priority of a select(2)ing thread being waken up? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2003 03:21:46 -0000 In good old days, only a socket and a pipe were the major file descriptors being select(2)ed. As select(2) was just a socket operation, it was sufficient to set the priority of select(2)ing process to PSOCK(*1), I suppose. Nowadays, quite a few drivers support select(2) as well, including sound, usb, scsi controllers, and so on. I am not convinced whether a process should select(2) those devices at PSOCK as we do for a socket. Suppose that a process select(2)s for a pcm device and a socket at once. If the process is waken up by the pcm driver at PSOCK, another process at a better priority may preempt the first one, which can result in dropping some pcm data. Maybe it would be better if the caller of selwakeup() could determine the priority of a process or a thread. That would let us raise the priority to PRIBIO if pcm data was ready, while the priority would stay at PSOCK if the socket was ready. (*1) I broke that in 5-CURRENT when I modified select(2) and poll(2) to use a conditional variable. -- Seigo Tanimura From owner-freebsd-arch@FreeBSD.ORG Wed Oct 22 03:25:50 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A12BB16A4B3 for ; Wed, 22 Oct 2003 03:25:50 -0700 (PDT) Received: from sohgo.tanimura.dyndns.org (IP1A0619.kng.mesh.ad.jp [211.13.103.239]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30CA643FB1 for ; Wed, 22 Oct 2003 03:25:47 -0700 (PDT) (envelope-from tanimura@tanimura.dyndns.org) Received: from sohgo.tanimura.dyndns.org (localhost [IPv6:::1]) ESMTP id h9MAPiB6044226 ; Wed, 22 Oct 2003 19:25:44 +0900 (JST) Received: (from uucp@localhost) (8.12.9/3.7W-submit-carrots-Tokyu-Meguro) with UUCP id h9MAPiHU044225 ; Wed, 22 Oct 2003 19:25:44 +0900 (JST) Received: from urban.nkth.tanimura.dyndns.org (localhost [IPv6:::1]) with ESMTP id h9MALkUM023905 ; Wed, 22 Oct 2003 19:21:46 +0900 (JST) Message-Id: <200310221021.h9MALkUM023905@urban> Date: Wed, 22 Oct 2003 19:21:46 +0900 From: Seigo Tanimura To: arch@FreeBSD.org In-Reply-To: <200310220319.h9M3JGI1005225@urban> References: <200310220319.h9M3JGI1005225@urban> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 13) (Rational FORTRAN) (i386--freebsd) Organization: My Home MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Wed_Oct_22_19:21:46_2003-1" cc: Seigo Tanimura Subject: Re: Who should set the priority of a select(2)ing thread being waken up? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2003 10:25:50 -0000 --Multipart_Wed_Oct_22_19:21:46_2003-1 Content-Type: text/plain; charset=US-ASCII On Wed, 22 Oct 2003 12:19:16 +0900, Seigo Tanimura said: tanimura> In good old days, only a socket and a pipe were the major file tanimura> descriptors being select(2)ed. As select(2) was just a socket tanimura> operation, it was sufficient to set the priority of select(2)ing tanimura> process to PSOCK(*1), I suppose. tanimura> Nowadays, quite a few drivers support select(2) as well, including tanimura> sound, usb, scsi controllers, and so on. I am not convinced whether a tanimura> process should select(2) those devices at PSOCK as we do for a socket. tanimura> Suppose that a process select(2)s for a pcm device and a socket at tanimura> once. If the process is waken up by the pcm driver at PSOCK, another tanimura> process at a better priority may preempt the first one, which can tanimura> result in dropping some pcm data. tanimura> Maybe it would be better if the caller of selwakeup() could determine tanimura> the priority of a process or a thread. That would let us raise the tanimura> priority to PRIBIO if pcm data was ready, while the priority would tanimura> stay at PSOCK if the socket was ready. tanimura> (*1) I broke that in 5-CURRENT when I modified select(2) and poll(2) tanimura> to use a conditional variable. The attached patch implements selwakeuppri(), which lets you set the priority of a thread being waken up. Also in the patch is a small test code to use selwakeuppri() in pcm(4). Comments are welcome, thanks in advance. -- Seigo Tanimura --Multipart_Wed_Oct_22_19:21:46_2003-1 Content-Type: text/x-patch; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="selwakeuppri.diff" Content-Transfer-Encoding: 7bit diff -urN --exclude-from=/home/urban/tanimura/selwakeuppri.exclude.txt freebsd/sys/dev/sound/pcm/channel.c handoffpri/dev/sound/pcm/channel.c --- freebsd/sys/dev/sound/pcm/channel.c Fri Oct 17 14:53:58 2003 +++ handoffpri/dev/sound/pcm/channel.c Wed Oct 22 18:34:09 2003 @@ -116,7 +116,7 @@ CHN_LOCKASSERT(c); if (SEL_WAITING(sndbuf_getsel(bs)) && chn_polltrigger(c)) - selwakeup(sndbuf_getsel(bs)); + selwakeuppri(sndbuf_getsel(bs), PRIBIO); wakeup(bs); } diff -urN --exclude-from=/home/urban/tanimura/selwakeuppri.exclude.txt freebsd/sys/kern/sys_generic.c handoffpri/kern/sys_generic.c --- freebsd/sys/kern/sys_generic.c Fri Oct 17 14:54:25 2003 +++ handoffpri/kern/sys_generic.c Wed Oct 22 18:34:09 2003 @@ -82,6 +82,7 @@ size_t, off_t, int); static int dofilewrite(struct thread *, struct file *, int, const void *, size_t, off_t, int); +static void doselwakeup(struct selinfo *, int); /* * Read system call. @@ -1162,12 +1163,30 @@ mtx_unlock(&sellock); } +/* Wake up a selecting thread. */ +void +selwakeup(sip) + struct selinfo *sip; +{ + doselwakeup(sip, -1); +} + +/* Wake up a selecting thread, and set its priority. */ +void +selwakeuppri(sip, pri) + struct selinfo *sip; + int pri; +{ + doselwakeup(sip, pri); +} + /* * Do a wakeup when a selectable event occurs. */ -void -selwakeup(sip) +static void +doselwakeup(sip, pri) struct selinfo *sip; + int pri; { struct thread *td; @@ -1188,6 +1207,8 @@ if (td->td_wchan == &selwait) { cv_waitq_remove(td); TD_CLR_SLEEPING(td); + if (pri >= PRI_MIN && pri <= PRI_MAX) + td->td_priority = pri; setrunnable(td); } else td->td_flags &= ~TDF_SELECT; diff -urN --exclude-from=/home/urban/tanimura/selwakeuppri.exclude.txt freebsd/sys/sys/selinfo.h handoffpri/sys/selinfo.h --- freebsd/sys/sys/selinfo.h Fri May 2 11:05:02 2003 +++ handoffpri/sys/selinfo.h Wed Oct 22 18:34:09 2003 @@ -58,6 +58,7 @@ void clear_selinfo_list(struct thread *td); void selrecord(struct thread *selector, struct selinfo *sip); void selwakeup(struct selinfo *sip); +void selwakeuppri(struct selinfo *sip, int pri); #endif #endif /* !_SYS_SELINFO_H_ */ --Multipart_Wed_Oct_22_19:21:46_2003-1-- From owner-freebsd-arch@FreeBSD.ORG Thu Oct 23 11:30:08 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AC2E516A4B3 for ; Thu, 23 Oct 2003 11:30:08 -0700 (PDT) Received: from mail.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D6F443FE0 for ; Thu, 23 Oct 2003 11:30:07 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 3734 invoked from network); 23 Oct 2003 18:30:07 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 23 Oct 2003 18:30:07 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h9NIU3ce099605; Thu, 23 Oct 2003 14:30:03 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Thu, 23 Oct 2003 14:30:15 -0400 (EDT) From: John Baldwin To: arch@FreeBSD.org X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: mckusick@mckusick.com Subject: Convert P_COWINPROGRESS to per-thread lock-less flag.. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2003 18:30:08 -0000 As part of the proc locking, I have a patch that converts the per-process P_COWINPROGRESS flag to a per-thread flag instead. The per-thread flag is a TDP_COWINPROGRESS flag stored in td_pflags which does not require any locks. This removes the last user of p_flag that does not use the proc lock. Are there any problems with making this flag per-thread instead of per-process? http://www.FreeBSD.org/~jhb/patches/cow.patch -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ From owner-freebsd-arch@FreeBSD.ORG Thu Oct 23 13:05:58 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E57D216A4B3; Thu, 23 Oct 2003 13:05:58 -0700 (PDT) Received: from beastie.mckusick.com (beastie.mckusick.com [209.31.233.184]) by mx1.FreeBSD.org (Postfix) with ESMTP id 440EA43F85; Thu, 23 Oct 2003 13:05:58 -0700 (PDT) (envelope-from mckusick@beastie.mckusick.com) Received: from beastie.mckusick.com (localhost [127.0.0.1]) by beastie.mckusick.com (8.12.8/8.12.3) with ESMTP id h9NK5veN007816; Thu, 23 Oct 2003 13:05:57 -0700 (PDT) (envelope-from mckusick@beastie.mckusick.com) Message-Id: <200310232005.h9NK5veN007816@beastie.mckusick.com> To: John Baldwin In-Reply-To: Your message of "Thu, 23 Oct 2003 14:30:15 EDT." Date: Thu, 23 Oct 2003 13:05:57 -0700 From: Kirk McKusick cc: arch@FreeBSD.org Subject: Re: Convert P_COWINPROGRESS to per-thread lock-less flag.. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2003 20:05:59 -0000 Date: Thu, 23 Oct 2003 14:30:15 -0400 (EDT) From: John Baldwin To: arch@FreeBSD.org Subject: Convert P_COWINPROGRESS to per-thread lock-less flag.. Cc: mckusick@mckusick.com X-ASK-Info: Whitelist match As part of the proc locking, I have a patch that converts the per-process P_COWINPROGRESS flag to a per-thread flag instead. The per-thread flag is a TDP_COWINPROGRESS flag stored in td_pflags which does not require any locks. This removes the last user of p_flag that does not use the proc lock. Are there any problems with making this flag per-thread instead of per-process? http://www.FreeBSD.org/~jhb/patches/cow.patch -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ I do not see any problems with it being per-thread. Kirk McKusick