From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 17 21:54:59 2007 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 37AEF16A419 for ; Mon, 17 Dec 2007 21:54:59 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.183]) by mx1.freebsd.org (Postfix) with ESMTP id 0009213C447 for ; Mon, 17 Dec 2007 21:54:58 +0000 (UTC) (envelope-from kip.macy@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so3745399waf.3 for ; Mon, 17 Dec 2007 13:54:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=PiLJrZUG/7Q4r0PQhgaC8pNFOIOv/0ChbjWxmJNTtoI=; b=VG4Vu4xdekNuwx+iHeueXfZRvLoL24F1sr21AX96AFxDJougUO9y/UMQZFYFTEZ84n7Ed9xu3oRDb5aX4KOFEmQYScm0+mlJbyQxkD2ybiPoizsTlRPgyIErNeNbvB0EBZ4rNjkO3Z2/mzrB65ZdKNITiRa8/Lv812rBw4W9TDM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jicrl5VhnHLK/zHyy/6/YKXO315tDhn6uul2k6750REpVN/XKUfqgXIc+eG8q1Wu9txLVKW+TKXUtkhcXhetiR93PE0jXZNZY2LEpdDd3KXT4nxUzVhZtexUxo3bQ+T2TBHGxb1T79ydfFXpFNkFQnYxYiT8HvPeOfcJf6Z0Oko= Received: by 10.114.174.2 with SMTP id w2mr3662373wae.17.1197928497138; Mon, 17 Dec 2007 13:54:57 -0800 (PST) Received: by 10.114.255.11 with HTTP; Mon, 17 Dec 2007 13:54:57 -0800 (PST) Message-ID: Date: Mon, 17 Dec 2007 13:54:57 -0800 From: "Kip Macy" To: "James Mansion" In-Reply-To: <4766E92C.6020703@mansionfamily.plus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4763A398.2040109@mansionfamily.plus.com> <47644BFE.3060003@elischer.org> <4766E92C.6020703@mansionfamily.plus.com> Cc: freebsd-hackers@freebsd.org, Julian Elischer Subject: Re: kqueue and libev 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: Mon, 17 Dec 2007 21:54:59 -0000 On Dec 17, 2007 1:25 PM, James Mansion wrote: > Kip Macy wrote: > >> he's just plain misinforme > > Until we know what he is referring to we can't actually say that. > > -Kip > > > > OK he said I could post from our private email so here goes. There were > bits in and around relating to the > Solaris /dev/poll support (and the mechanism's limitations) which I've > elided. > > I think the most telling thing is probably that drivers need to provide > support and that a single mechanism > in the driver doesn't support select and poll at the same time - which I > guess lines up with the reported failure > with USB serial. > > Does kqueue work with USB for example? How about an AIO request to read > from a USB endpoint? > > It may well just be a case of 'fessing up to system limitations. > > James > > ============================================================================ > > Compile and install rxvt-unicode on freebsd and run it with: > > urxvt # works, uses select (or maybe poll) > LIBEV_FLAGS=8 urxvt # acts weird, uses kqueue > > (note: only works when urxvt isn't set[gu]id) > > The typical symptoms are either delayed notificatrions, no notifications at > all or _continuous_ notifications and read failing with EAGAIN. Here is a > ktrace showing the latter: http://ue.tst.eu/45eb8a3c3e812933cbe3172af2ee4a6c.txt > > kqueue works well with sockets (or with about anything on netbsd), but > fails on more exotic types such as ptys. (I test on Freebsd 6.2 RELEASE, > but got reports about problems with earlier and later versions, too, > as well as on openbsd (which I didn't verify) and on darwin (which is > completely broken)). > > > > You normally don't get useful writeable/readable state for files, > > > No, I only want the same readyness notifications as with select or poll, > as is documented in the manpage. (even on platforms where kqueue works > this requires some heuristics and workarounds with kqueue due to design > limitations (for example problems with close() or fork() that force > constant rearming), but thats common in interfaces like kqueue, and by now > well understood and handled by libev). > > > > Actually, until recently it was broken on pipes. We've never received > > any PRs to that effect so there is no way of knowing. You'll have > > better luck asking the author himself. To be more precise, this only manifested itself in erlang. > > Well, one should better document the types with which it works (which on > freebsd apparently includes sockets and nothing else). I also think one > should rethink the internal design if every driver needs its own kqueue > support, as that will always force kqueue into a second-class citizen not > suitable as replacement for select, as it's unreasonable to expect kqueue > to just work when its so little used and requires such a high maintainance > (linux' epoll for example works fine with everything because it doesn't > require drivers to support epoll specifically, so it is unlikely that > epoll fails when select would work for example, which is the case on > freebsd and darwin). > > The fact that it works fine on everything I threw at it on netbsd is > probably not the result of better design, but more better maintainance, so > I wouldn't be surprised if some future version of netbsd failed in similar > ways (OTOH, in the past, netbsd consistently was the less buggy platform > regardless of topic, wether it was threads, ptys or kqueue, so I might get > quite disappointed if that happened :) Interesting, that has been completely counter to my experience. However, I rely on a completely different set of subsystems. Do you have a set of regression tests for libev? It sounds like they would worth having to regression test kqueue. Thanks for your feedback. -Kip