Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLxyk-00FF2q-2c for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Nov 2025 06:17:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vLxyj-00HPys-1W for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Nov 2025 06:17:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLqvO-00G4iL-1X for pgsql-hackers@lists.postgresql.org; Wed, 19 Nov 2025 22:45:19 +0000 Received: from eggs.gnu.org ([2001:470:142:3::10]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLqvL-000RGq-2M for pgsql-hackers@lists.postgresql.org; Wed, 19 Nov 2025 22:45:18 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vLqvF-0003So-TG; Wed, 19 Nov 2025 17:45:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=q9hmOKl2QwzZdGGnJUBX7Yo9L2pdCU7FITunNDVPehc=; b=akmo2QkJYdjdpsn2ZvuC 17LPgxi9jsPUqysjT2+vRL9z3UPY86YStupmmH0joxFPKZiTpXKUq8xENrpIh5yhufQWCRsLczaca 3vAK9/8RbuzuBlY9Uz+2IRQNIoYyNERtHYMfCaFUnGa7ZJQGX3jpXIkroSDNgSNlJtC5e/gHiOFmf PXbM1S6GiBOR3wvkkxS2f2cWd5AUp74TwEOJRpSgXIPwWLR2ILeMDIp2xIsTi+hQiyWFsmXJfh1uC Zjt9GzOjA/bJ9LE9n2uFU2z8EKAMUo80ppzGm8ydPZ2DP17nIIEwsEFAfcK8pCey8TkFsNeZlv+6A LrQql34ld+stjw==; Date: Wed, 19 Nov 2025 23:45:07 +0100 From: Samuel Thibault To: Thomas Munro Cc: Michael Banck , Alexander Lakhin , Tom Lane , Michael Paquier , pgsql-hackers@lists.postgresql.org Subject: Re: GNU/Hurd portability patches Message-ID: Mail-Followup-To: Samuel Thibault , Thomas Munro , Michael Banck , Alexander Lakhin , Tom Lane , Michael Paquier , pgsql-hackers@lists.postgresql.org References: <68d629f2.050a0220.3685b9.5ce2@mx.google.com> <69125dd5.170a0220.d19df.23dcSMTPIN_ADDED_BROKEN@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: I am not organized List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, Thomas Munro, le mar. 18 nov. 2025 18:32:38 +1300, a ecrit: > On Tue, Nov 18, 2025 at 12:31 PM Samuel Thibault > > > Possibly too private/undocumented anyway, > > > > It's not really documented much, but it's completely public. One > > can include and call e.g. io_read_request(port, > > reply_port, offset, amount). One then has to run a msgserver loop on the > > reply_port to get the reply messages. An example can be seen in the hurd > > source in trans/streamio.c, for e.g. device_open_request() calls. > > OK, to continue the thought experiment... someone could invent write > io_method=hurd, and it'd have to be more efficient than handing the > work off to I/O worker processes (what you get with the default > io_method=worker), since the worker process clearly has to do exactly > the same thing internally in a synchronous wrapper function anyway, > just with extra steps to reach it. Yes, you'd avoid having to block a whole thread for just one request, and instead just queue requests, and process replies. > They'd need to be able to consume from each other's reply port > occasionally, but I assume that's possible with an exclusive lock and > a temporary transfer of receive rights. Yes, you can transfer ports between processes. > I doubt it'd be much good without a readv/writev operations, though. > It looks they aren't in io_request.defs yet? They have not been defined so far indeed. > Does that also imply that preadv() has to loop over the vectors > sending tons of messages and waiting for replies? Currently glibc's preadv performs copies. > (And then to get more and more pie-in-the-sky: (1) O_DIRECT is highly > desirable for zero-copy DMA to/from a user space buffer pool, We don't currently have that defined. > (2) starting more than one I/O with a single context switch and likewise > for consuming replies, That would be possible by introducing in gnumach a multi-message variant of the mach_msg() system call. > (3) registering/locking memory pages and descriptors with a port so > they don't have to be pinned/unpinned by the I/O subsystem all the > time. That could be introduced too indeed. > And then, if Hurd works the way I think it might, (4) to avoid chains > of pipe-like scheduling overheads when starting a direct I/O and > maybe also some already-cached buffered I/O, you'd ideally want ports > to have a "fast" send path that behaves like the old Spring/Solaris > doors, where the caller's thread would yield directly to a thread in > the receiving server, That was proposed/experimented, called migrating threads: https://www.gnu.org/software/hurd/open_issues/mach_migrating_threads Samuel