Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1769321ybe; Sat, 7 Sep 2019 02:31:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTQ4c3guzicVnnP9DisY+Hzug6c5c/TkjDiFsXrc62vtKOjzxpdQeNaHKbVIlfqCohAMeS X-Received: by 2002:aa7:9735:: with SMTP id k21mr16208684pfg.174.1567848698274; Sat, 07 Sep 2019 02:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567848698; cv=none; d=google.com; s=arc-20160816; b=bpDzABQTbLx5vqUQ9IY4dOf8wqGM1wjoJ+cx7ScBuWg9htpjJ5OixGiFqFXDuyxReH xv2iAyLdiFm8DxxGur8MAaw7zZz6tTuNImxkkFaE/Rfq+aSXiVYDlPwarHaowHQON4pW 5zKwrabHqQOYmIbwWJJYVpBSzYfmtyp1ShG3g/kaU72ekaGDW/a8Bfesoj88GQNoqBgT 1HgxOTNsBI8IDroDqyHZVzScSbJ30QmfRKOVBF9hYFkOnSydJvGgxQtz+jsWRw+LsvPt nOFNngx8ddsJ/BhV3yjxwDLHkc8nmehVolQkIl6s70zPpNNp/IAY+Spq/FgV45hp0A3w Pg9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=px6LlxUmzkx1m0e18cjKznO/fFTclAviZPrgSZRKBVI=; b=pcZULWyf3zn/HIOafNj0d+bPL1N3EZDJjDfxu17ib9opTOlH85GHI7PxOhvFtTQUF6 UMeswaieS+KU/CfnbIMgv6eGYI4wHdNFjlWn+7en5iMzmcD0Di15RwXBOgR6VkF3nI9S rXkJFaF8pufupsm9CXYgVcSY1oxnzUjIY4jwrba61U7uNdKA1pL8AfJItJ7qZuVuSar4 zakkrLlistyjXFHCoD9axX505WNR/VXiPzNb1IVmbJv/BwhYvAEb2Ao9mjMVAPVGuY5+ 1UL/A0eILMW+zpco1t7Cl65/gQNvLUTnURK2iTNy8vawztNu5D/ZM6yCDNpuowDmYEfT KsoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=MCWoYx3w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si5310804pjt.14.2019.09.07.02.31.22; Sat, 07 Sep 2019 02:31:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=MCWoYx3w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405986AbfIFRIU (ORCPT + 99 others); Fri, 6 Sep 2019 13:08:20 -0400 Received: from mail-lj1-f175.google.com ([209.85.208.175]:43117 "EHLO mail-lj1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395137AbfIFRIT (ORCPT ); Fri, 6 Sep 2019 13:08:19 -0400 Received: by mail-lj1-f175.google.com with SMTP id d5so6656278lja.10 for ; Fri, 06 Sep 2019 10:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=px6LlxUmzkx1m0e18cjKznO/fFTclAviZPrgSZRKBVI=; b=MCWoYx3wwPNe3ejnJN5r5oIxq9QPmZRawZ44NCyAtTl3MEC96N3xYQha1TuJooW6hy 9YlTT61GP1L5xuTti11KucisLSfvTL5wG4swlhrjsZCCW2j7m8wFJW8y7EMIvNgAYJy+ xzirKOyunebm6EAqZhhsgW62bHn0OrSMJb0FQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=px6LlxUmzkx1m0e18cjKznO/fFTclAviZPrgSZRKBVI=; b=M0I+YjUsuBZhUdgO3UVAl0ynzWiPW7HetPnmKY5c/L14Jj1GpqU/0DwBUiB1BRixtX ARmEnpQh2GCGcF3q6slnKSJk+vSELM+Xz0ZqzMpaNa8OYWzHVM6oXhCGTsX+px7uayd/ G5YkehQvJM5CISf8lPUMsnl0aGYv9M4dy7UfniDbbsIQNEEDNYbTdaOItYT2N5SIrSGH R5XlX9+1yuleWOkmAkVA5JSXxSv/K9a3qLosacuzZmHMF7l5/fxKSQSSy2vn0Nr2JmsT nHcADXZzf1TtyD8y00GIaitsrumWIB2lBlxb0IEGO8v8DvgNm13fCZdxf5fx0MbX+tr1 an4g== X-Gm-Message-State: APjAAAX8A1w5AG+N3Y+3Y2wSAZyoV4GfTADiIJhrdA0f3Gn5pf2OhJPU BR2KsoS/xTB7K+fhJkOO3orr3TRfRzI= X-Received: by 2002:a2e:780c:: with SMTP id t12mr6255391ljc.226.1567789696543; Fri, 06 Sep 2019 10:08:16 -0700 (PDT) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id w77sm1218168lff.49.2019.09.06.10.08.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Sep 2019 10:08:15 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id l1so6639569lji.12 for ; Fri, 06 Sep 2019 10:08:15 -0700 (PDT) X-Received: by 2002:a2e:3a0e:: with SMTP id h14mr6369908lja.180.1567789694898; Fri, 06 Sep 2019 10:08:14 -0700 (PDT) MIME-Version: 1.0 References: <156763534546.18676.3530557439501101639.stgit@warthog.procyon.org.uk> <17703.1567702907@warthog.procyon.org.uk> <5396.1567719164@warthog.procyon.org.uk> <14883.1567725508@warthog.procyon.org.uk> <27732.1567764557@warthog.procyon.org.uk> <8e60555e-9247-e03f-e8b4-1d31f70f1221@redhat.com> In-Reply-To: <8e60555e-9247-e03f-e8b4-1d31f70f1221@redhat.com> From: Linus Torvalds Date: Fri, 6 Sep 2019 10:07:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Why add the general notification queue and its sources To: Steven Whitehouse Cc: David Howells , Ray Strode , Greg Kroah-Hartman , Nicolas Dichtel , raven@themaw.net, keyrings@vger.kernel.org, linux-usb@vger.kernel.org, linux-block , Christian Brauner , LSM List , linux-fsdevel , Linux API , Linux List Kernel Mailing , Al Viro , "Ray, Debarshi" , Robbie Harwood Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 6, 2019 at 9:12 AM Steven Whitehouse wrote: > > The events are generally not independent - we would need ordering either > implicit in the protocol or explicit in the messages. Note that pipes certainly would never re-order messages. It's just that _if_ you have two independent and concurrent readers of the same pipe, they could read one message each, and you couldn't tell which was first in user space. Of course, I would suggest that anything that actually has non-independent messages should always use a sequence number or something like that in the message anyway. But then it would have to be on a protocol level. And it's not clear that all notifications need it. If it's just a random "things changed" notification, mnaybe that doesn't need a sequence number or anything else. So being on a protocol/data stream level might be the right thing regardless. Another possibility is to just say "don't do that then". If you want multiple concurrent readers, open multiple pipes for them and use separate events, and be happy in the knowledge that you don't have any complicated cases. > We also need to > know in case messages are dropped too - doesn't need to be anything > fancy, just some idea that since we last did a read, there are messages > that got lost, most likely due to buffer overrun. Pipes don't have that, but another flag certainly wouldn't be _hard_ to add. But one problem (and this is fundamental) is that while O_DIRECT works today (and works with kernels going back years), any new features like overflow notification would obviously not work with legacy kernels. On the user write side, with an O_NONBLOCK pipe, you currently just get an -EAGAIN, so you _see_ the drop happening. But (again) there's no sticky flag for it anywhere else, and there's no clean automatic way for the reader to see "ok, the writer overflowed". That's not a problem for any future extensions - the feature sounds like a new flag and a couple of lines to do it - but it's a problem for the whole "prototype in user space using existing pipe support" that I personally find so nice, and which I think is such a good way to prove the user space _need_ for anything like this. But if people are ok with the pipe model in theory, _that_ kind of small and directed feature I have absolutely no problem with adding. It's just whole new untested character mode drivers with odd semantics that I find troublesome. Hmm. Maybe somebody can come up with a good legacy signaling solution (and "just use another pipe for error notification and OOB data" for the first one may _work_, but that sounds pretty hacky and just not very convenient). Linus