Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp207980pxk; Fri, 11 Sep 2020 04:51:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwepSNfaoFy4NFeqYoCIMHXsAzWQOXkymRSit91zzKav4GEE7T7MwZcfDVQwstV1hl38njF X-Received: by 2002:a17:906:4c8b:: with SMTP id q11mr1530569eju.531.1599825092907; Fri, 11 Sep 2020 04:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599825092; cv=none; d=google.com; s=arc-20160816; b=sOS/4+YbiD6Tee8DZuhNiAHyx37hNsYgGCLXNfXvY2ug6r0rYwm9NthaNpwo36clZx EyHC8RPSgO4vGqrN/ROpyn3KbIfX/jRKfkBqjJPkLwCAevRfE8dnnaZSCDuH/sm585lY ifeh2hs+zDiGgkE4ro1xWbGsGVjCXZhrOb80KlGzh/Y5LXYbJC7PFXSJdoZpcPurE7Rt GAAvjLuJV7B9ueFUl/NDTW6JORcH+Oxx+z3DB5bDd628vZVfdfPJ5HcUigzq4bHk4W+c Z4GwaMm97LK7EWfQ7RyCfYLJrsNAeHHOfhczKnHNT5AZ+P/Pk//mvd/tg3wq1sJ92liT Wd4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=r7iKwByK7Ggxs8fF2MRwOWTinXH26LnGp7HdZEqOG6Q=; b=ynW04P/y3mtzIa+CJ/4D9DYjXwMPitrzG0lHMgxecGYt4V62MXAnFttH9l3Nl3OnvE JI02TecG31Yp8SP26H0prQAqAQsGwBfHilf6MNkpOjciSzXLRs3cc6VrgtlrZTpLmnSx qSDajPI7QDS5ajm3n+xv+KEREEv/on1sfcT1aKUFHxjFta5gHL9BfeT2zgU58ArYtBLT YuCqsiyREsDjmwDuiGZqIs1XHBT4ZQmIQ3WJDwFrEsZt/9nPrXbwWBSkU2Bs1fnrUlXg Oe7z1wSbx0tDsoXr5WznEpR4098vCLX7170zUPnQYbjXs3jCWd8iVdNAjNYPOCyqISs0 mg9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=qZhud8Wj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si1184857edq.278.2020.09.11.04.51.10; Fri, 11 Sep 2020 04:51:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=qZhud8Wj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725868AbgIKLth (ORCPT + 99 others); Fri, 11 Sep 2020 07:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725841AbgIKLrl (ORCPT ); Fri, 11 Sep 2020 07:47:41 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15FBFC061756 for ; Fri, 11 Sep 2020 04:22:02 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id d9so7098212pfd.3 for ; Fri, 11 Sep 2020 04:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=r7iKwByK7Ggxs8fF2MRwOWTinXH26LnGp7HdZEqOG6Q=; b=qZhud8Wj7fz6kWEmRxUNxCQIon3sPVCHBPTOPWLKdt1awlufpCoSZ+Hl9NGNiQ1GIX y1xfSkU4FNQwuAvg2z09TsRBDrOfpPeQozYvSzPFCM8DJzOv4g7gOIt8xJa9xSlc4bWV 8f/s9RvyymcxC4dyCWxFK1zTsKgdZoAg9x5qY2PIWPxM2dK+xDneaVGDdHVI0QOORdoX qIG8e6DQOSIZlU4GOnGuiqT+Z3a1FIj6XmbXRe9/ggtKLXeaIsxqxSKbJJ4oAq6C1q7Y COtHCsjrKZFmJKNtlxykIKp0ozB1/rjA01mG/4PnuoDy2XFjsykNaEzdjreT+TwabLeT ocwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r7iKwByK7Ggxs8fF2MRwOWTinXH26LnGp7HdZEqOG6Q=; b=UQ4JgCqdRiZhElX48hLproyXlIm5/QcyK+ONdC0gv1z+2R50lzWE+T598GksTzOtGi aLGTBMYJUo0fkvCV03iZpU2VNOfdNqwb8JC5RvCopuF//XgIcyBKHGLEZWBQyN9+ZUXp Sgc5E1XRvyZ6ckuyET5LOvQ+9wXgeM6LQjhJYNvGaSGayC8a3TuZI4uTe8CFBDzqI4ML 48dKioXKcj+P/kt1WVNP2KE0QclJdBHKm3nwb1wnGKuBl/XmjMJaG+He/COKUf+2hhFC oMj38MpSCnu2jNajojvRGdVc0ra6ZSuqj0eN/3Coc4JXQcxr1X/WzFAgtcBnmHnStKuQ EXmg== X-Gm-Message-State: AOAM533yixZJRyZC1YLyipbFF36OJ2jBF3zwvGgNewQPkTrTInuihWOr E61CycWBuysg4JkxaPqVl8dD36EvAAlpq45f X-Received: by 2002:a17:902:c411:b029:d0:589f:6e1c with SMTP id k17-20020a170902c411b02900d0589f6e1cmr1955532plk.0.1599823321403; Fri, 11 Sep 2020 04:22:01 -0700 (PDT) Received: from [192.168.1.182] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id n127sm1981068pfn.155.2020.09.11.04.21.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Sep 2020 04:22:00 -0700 (PDT) Subject: Re: [PATCH] pipe: honor IOCB_NOWAIT To: Al Viro Cc: linux-fsdevel , "linux-kernel@vger.kernel.org" References: <20200911011205.GG1236603@ZenIV.linux.org.uk> From: Jens Axboe Message-ID: <719f095d-43fa-7e93-e8c8-bb22f2505501@kernel.dk> Date: Fri, 11 Sep 2020 05:21:59 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200911011205.GG1236603@ZenIV.linux.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/10/20 7:12 PM, Al Viro wrote: > On Mon, Sep 07, 2020 at 09:21:02AM -0600, Jens Axboe wrote: >> Pipe only looks at O_NONBLOCK for non-blocking operation, which means that >> io_uring can't easily poll for it or attempt non-blocking issues. Check for >> IOCB_NOWAIT in locking the pipe for reads and writes, and ditto when we >> decide on whether or not to block or return -EAGAIN. >> >> Signed-off-by: Jens Axboe >> >> --- >> >> If this is acceptable, then I can add S_ISFIFO to the whitelist on file >> descriptors we can IOCB_NOWAIT try for, then poll if we get -EAGAIN >> instead of using thread offload. > > Will check. Thanks! > In the meanwhile, blacklist eventpoll again. Because your > attempts at "nonblocking" there had been both ugly as hell *AND* fail > to prevent blocking. And frankly, I'm very tempted to rip that crap > out entirely. Seriously, *look* at the code you've modified in > do_epoll_ctl(). And tell me why the hell is grabbing ->mtx in that > function needs to be infested with trylocks, while exact same mutex > taken in loop_check_proc() called under those is fine with mutex_lock(). > Ditto for calls of vfs_poll() inside ep_insert(), GFP_KERNEL allocations > in ep_ptable_queue_proc(), synchronize_rcu() callable from ep_modify() > (from the same function), et sodding cetera. Ugh missed the loop_check_proc() part :/ The original patch wasn't that pretty, in my defense the whole thing is pretty ugly to begin with. It'd need serious rewriting to become palatable. If you want to yank the patch, I've got no problem with that. > No, this is _not_ an invitation to spread the same crap over even more > places in there; I just want to understand where had that kind of voodoo > approach comes from. And that's directly relevant for this patch, > because it looks like the same kind of thing. The pipe patch is way cleaner, and pretty much to the point. Don't think that's a fair comparison. > What is your semantics for IOCB_NOWAIT? What should and what should _not_ > be waited for? Basically it's don't wait for space (if write) if it's full, don't wait for data if it's empty. O_NONBLOCK for the operation, instead of as a file state. The locking isn't strictly required, and it's basically impossible to avoid various deeper down items like memory allocations potentially blocking, so... -- Jens Axboe