From owner-freebsd-arch@FreeBSD.ORG Sun Nov 7 00:15:36 2004 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 B622016A526 for ; Sun, 7 Nov 2004 00:15:19 +0000 (GMT) Received: from beastie.mckusick.com (dsl081-247-227.sfo1.dsl.speakeasy.net [64.81.247.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id C261B43D41 for ; Sun, 7 Nov 2004 00:15:18 +0000 (GMT) (envelope-from mckusick@mckusick.com) Received: from beastie.mckusick.com (localhost [127.0.0.1]) by beastie.mckusick.com (8.12.8/8.12.9) with ESMTP id iA70FFCW074582; Sat, 6 Nov 2004 16:15:17 -0800 (PST) (envelope-from mckusick@beastie.mckusick.com) Message-Id: <200411070015.iA70FFCW074582@beastie.mckusick.com> To: Poul-Henning Kamp In-Reply-To: Your message of "Sun, 07 Nov 2004 00:39:20 +0100." Date: Sat, 06 Nov 2004 16:15:15 -0800 From: Kirk McKusick cc: arch@freebsd.org Subject: Re: Multi-threading access to device drivers. 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: Sun, 07 Nov 2004 00:15:37 -0000 > To: arch@freebsd.org > From: Poul-Henning Kamp > Date: Sun, 07 Nov 2004 00:39:20 +0100 > Subject: Multi-threading access to device drivers. > X-ASK-Info: Whitelist match > > Assume a device driver which is not Giant-handicapped. > > Assume an I/O path which does not need Giant to get from > read(2) to the device driver. > > Assume a SMP machine. > > Assume a process with two threads on two CPUs, both > doing read(fd, buf, len) at the same time. > > Should we let both reads into the driver at the same time ? > > If so, which uio_offset do we hand them ? > > -- > 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. Historically, reads on a file descriptor are serialized. I believe that they still should. An an example, if two threads are trying to read a stream of commands, then they should not both get the same one as the above example would allow. Kirk McKusick