Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5318427ybe; Tue, 10 Sep 2019 01:40:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNad4Q7qUH+3XlEulktfckFgIXuJg75vmAsTVe6wBV7+FbPB0YO98RgKzIqYj9gS5jFws1 X-Received: by 2002:a17:906:edcb:: with SMTP id sb11mr23290849ejb.144.1568104845711; Tue, 10 Sep 2019 01:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568104845; cv=none; d=google.com; s=arc-20160816; b=rbc44Z3XOqimyOO+iqnD1r5xecXhkzYLN1EYk9Mn2T1AcgZvXOVVVDWV3PVsvKNEBN Csv9MX/CbhnkTZQ4P4CFFayVccFXo0nPrhlgMY7+dY45AOJmKdon9eR8g8a7B9gRvPHK 1+aQhVN2dp1FAuI6+8zh7NBTtMCachoy7gp+O4fbpiLFfW9OZdwaUpa5EOvh50Ls9F9s PUMEaX57atFk6D4t5pOmuVPhvFV4DmyoJ2R7EsfO/HqwIawVuSzOy4P2nKOtYSdfSljH Fhg5KOjZQZSvwl7bPxkaDktHOqQzRVcJ4c1byL366t7I/gVJffadlD4QkzjmSD6fDbep SvKQ== 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:autocrypt:openpgp:from:references:cc:to:subject; bh=LtqeLnpwzXhwy6wm1xtsDQrfhofyDnsfz/o+8pSHekU=; b=ai43j7y0gryOT/Fv/GJs7E1ixiXkgsNxMXfzlF+ldYzhOoCOMjDwGLFvQKfZxXSl9Y HB3qQHBiGZ9jiB/JMlLWYQOrn4UjZVHC5m6EEP9/eRY9HjzwlDUYqkBO8wnOU6SSgmJG 1ctyRHqsb7Ry3otNJGKVMS3eHZBkS0i/Cad3/BbgbrCSGDyTXzXcIQAIq3TNYXAQRC+1 MKD9IUN2/s7dko+yYjizRrVWJT9ROcdt7BwmOVqNG50TxGpOYO7akJmqDZvs0yzLysbJ JrVXi9Bqx8RJ1WCbRV8XpJ/nemypoUG7N/GO1U0jIj57iRYPBRprWnmXSeUD5H5Oz9SF /t0w== ARC-Authentication-Results: i=1; mx.google.com; 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 l50si10174567edd.273.2019.09.10.01.40.21; Tue, 10 Sep 2019 01:40:45 -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; 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 S1733158AbfIIPLB (ORCPT + 99 others); Mon, 9 Sep 2019 11:11:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:37550 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726900AbfIIPLA (ORCPT ); Mon, 9 Sep 2019 11:11:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DBA01AE8B; Mon, 9 Sep 2019 15:10:57 +0000 (UTC) Subject: Re: [PATCH v2 3/3] nvme: fire discovery log page change events to userspace To: James Smart , Sagi Grimberg , Christoph Hellwig Cc: Greg Kroah-Hartman , linux-nvme@lists.infradead.org, Keith Busch , linux-kernel@vger.kernel.org References: <20190712180211.26333-1-sagi@grimberg.me> <20190712180211.26333-4-sagi@grimberg.me> <20190822002328.GP9511@lst.de> <205d06ab-fedc-739d-323f-b358aff2cbfe@grimberg.me> <20190826065639.GA11036@lst.de> <20190826075916.GA30396@kroah.com> <20190830055514.GC8492@lst.de> <4555a281-3cbc-0890-ce85-385c06ca912b@grimberg.me> <3c58613f-9380-6887-434a-0db31136e7aa@broadcom.com> <84338eac-c287-1826-4ac1-72cd17ee62cc@broadcom.com> From: Hannes Reinecke Openpgp: preference=signencrypt Autocrypt: addr=hare@suse.de; prefer-encrypt=mutual; keydata= mQINBE6KyREBEACwRN6XKClPtxPiABx5GW+Yr1snfhjzExxkTYaINHsWHlsLg13kiemsS6o7 qrc+XP8FmhcnCOts9e2jxZxtmpB652lxRB9jZE40mcSLvYLM7S6aH0WXKn8bOqpqOGJiY2bc 6qz6rJuqkOx3YNuUgiAxjuoYauEl8dg4bzex3KGkGRuxzRlC8APjHlwmsr+ETxOLBfUoRNuE b4nUtaseMPkNDwM4L9+n9cxpGbdwX0XwKFhlQMbG3rWA3YqQYWj1erKIPpgpfM64hwsdk9zZ QO1krgfULH4poPQFpl2+yVeEMXtsSou915jn/51rBelXeLq+cjuK5+B/JZUXPnNDoxOG3j3V VSZxkxLJ8RO1YamqZZbVP6jhDQ/bLcAI3EfjVbxhw9KWrh8MxTcmyJPn3QMMEp3wpVX9nSOQ tzG72Up/Py67VQe0x8fqmu7R4MmddSbyqgHrab/Nu+ak6g2RRn3QHXAQ7PQUq55BDtj85hd9 W2iBiROhkZ/R+Q14cJkWhzaThN1sZ1zsfBNW0Im8OVn/J8bQUaS0a/NhpXJWv6J1ttkX3S0c QUratRfX4D1viAwNgoS0Joq7xIQD+CfJTax7pPn9rT////hSqJYUoMXkEz5IcO+hptCH1HF3 qz77aA5njEBQrDRlslUBkCZ5P+QvZgJDy0C3xRGdg6ZVXEXJOQARAQABtCpIYW5uZXMgUmVp bmVja2UgKFN1U0UgTGFicykgPGhhcmVAc3VzZS5kZT6JAkEEEwECACsCGwMFCRLMAwAGCwkI BwMCBhUIAgkKCwQWAgMBAh4BAheABQJOisquAhkBAAoJEGz4yi9OyKjPOHoQAJLeLvr6JNHx GPcHXa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Date: Mon, 9 Sep 2019 17:10:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <84338eac-c287-1826-4ac1-72cd17ee62cc@broadcom.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/31/19 12:24 AM, James Smart wrote: > On 8/30/2019 2:07 PM, Sagi Grimberg wrote: >> >>>>>>> Yes we do, userspace should use it to order events.  Does udev not >>>>>>> handle that properly today? >>>>>> >>>>>> The problem is not ordering of events, its really about the fact that >>>>>> the chardev can be removed and reallocated for a different controller >>>>>> (could be a completely different discovery controller) by the time >>>>>> that userspace handles the event. >>>>> >>>>> The same is generally true for lot of kernel devices.  We could reduce >>>>> the chance by using the idr cyclic allocator. >>>> >>>> Well, it was raised by Hannes and James, so I'll ask them respond here >>>> because I don't mind having it this way. I personally think that this >>>> is a better approach than having a cyclic idr allocator. In general, I >>>> don't necessarily think that this is a good idea to have cyclic >>>> controller enumerations if we don't absolutely have to... >>> >>> We hit it right and left without the cyclic allocator, but that won't >>> necessarily remove it. >>> >>> Perhaps we should have had a unique token assigned to the controller, >>> and have the event pass the name and the token.  The cli would then, >>> if the token is present, validate it via an ioctl before proceeding >>> with other ioctls. >>> >>> Where all the connection arguments were added we due to the reuse >>> issue and then solving the question of how to verify and/or lookup >>> the desired controller, by using the shotgun approach rather than >>> being very pointed, which is what the name/token would do. >> >> This unique token is: trtype:traddr:trsvcid:host-traddr ... > > well yes :)  though rather verbose.   There is still a minute window as > we're comparing values in sysfs, prior to opening the device, so > technically something could change in that window between when we > checked sysfs and when we open'd.   We can certain check after we open > the device to solve that issue. > > There is some elegance to a 32-bit token for the controller (can be an > incrementing value) passed in the event and used when servicing the > event that avoids a bunch of work. > > Doing either of these would eliminate what Hannes liked - looking for > the discovery controller with those attributes. Although, I don't know > that looking for it is all that meaningful. > yeah, we do have this fundamental problem with uevents; they do refer to a '/dev/nvmeX' device with those parameters, but this device might be long gone (or have been reallocated) by the time the event is processed. From my POV we have two choices here: - rely on the transport options to find a matching controller (ignoring the device name) and use that for sending out discovery requests. In the end, it shouldn't really matter device we're using if the transport options are identical. Although I'm not sure for RDMA; here we don't necessarily have a host transport address, so we _might_ send the discovery via the wrong controller in a CMIC enviroment. - Match the options in nvme-cli, and just discard the event if it doesn't match. Which is some additional coding in nvme-cli and might ran afoul if we ever miss events. I'd go for the second option; after considering the first introduces far too many conditions rendering debugging impractical. Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 247165 (AG München), GF: Felix Imendörffer