Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1290168ybl; Fri, 30 Aug 2019 15:25:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwpu66myaxD7/bKKttyWxfMbIHlSC9YZ6MO59eZLdvAVxCjBl+MZZcjuR6R63P9zAu/hBm X-Received: by 2002:a17:90a:3301:: with SMTP id m1mr822700pjb.27.1567203954569; Fri, 30 Aug 2019 15:25:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567203954; cv=none; d=google.com; s=arc-20160816; b=AOf5ETUUP6UNmcOkaw93EDdlHujV9EGS2RkW+EyMFBlafws+AM3k46jxm5gaSvuiGD FOqwx9oEM1JvRXX7krq5xiAIqspzeKciJ2ncQimgdzC5XlSR1xT4RDg6vB5pMR+WwnkV 4sh6+vRN3p1U1p7R+sihR/rHvWZ58YhiErLGcSYKNDiXmtGslR5Dpdp9VoWQzGfq8ZTI bBIwllfiBARpUC4SYzpEaEGMXKpjP4uOieTuYTX+MZn/n0kSl/e7LNur8CtafiS/BUbd gWkubQ8SOr4cJ4IW2prlOVxj//CHEHdUVCTJK7cwAbwkokwzje+xLFVI3UvsMHJ5hH69 msFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Ff6JaWGzUMMDLrrGDBYHz23FoZRhDC8ttvu90YEtwdE=; b=Y+aqK4E5xX4mclgh9lV0WnkXUzKa0RQ4k80b+MW09yxidrbr5nw17+CovjLin7OZWc tbIOw9bUf2B7/o7tEhNwqQM1E99hDjP2OjA7wjBcxlmY7tTHcHDOOXQR6/kAt58USsa6 2PAuzaOmAcClX/X046pRM9BQvmQ+73ympqEetVWvp1WzmuRhWA/WFQnVBTx+ST67QiyB lGEXqrIPYrcD33lrX0xSU8q4dOUVBi1YZ/pUCNFdRZhABvNbaTSpEdOeFAZgqUiBoXhX ne+ZN35B69FwCrWcyZ9A3siMrapHI/9T6WKszZ98XlA6wx+Bq6fnCQRfJcCDOUNHzsk8 Wh7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=VgREfwnT; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si5455630pgu.16.2019.08.30.15.25.38; Fri, 30 Aug 2019 15:25:54 -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=@broadcom.com header.s=google header.b=VgREfwnT; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728182AbfH3WY2 (ORCPT + 99 others); Fri, 30 Aug 2019 18:24:28 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41728 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728294AbfH3WY1 (ORCPT ); Fri, 30 Aug 2019 18:24:27 -0400 Received: by mail-pg1-f196.google.com with SMTP id x15so4197917pgg.8 for ; Fri, 30 Aug 2019 15:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Ff6JaWGzUMMDLrrGDBYHz23FoZRhDC8ttvu90YEtwdE=; b=VgREfwnTxqTwHEtIB/YXXOCG7Q7LzEmcClLOTJU02KAu0wSFLuvmmcZP5qGdljWWsV WxxFX3mBofCfWG4ZDe0gcr+inqPXqpm0L7yuMFp0c+LeZryhyPpEUpKrdwlD4ilZowBu foqsv1jwGDH5hoZicgk+FwV7vOKQPBdhYYcYg= 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-transfer-encoding :content-language; bh=Ff6JaWGzUMMDLrrGDBYHz23FoZRhDC8ttvu90YEtwdE=; b=d2vKbByiVELdsgb3sxlVoz9C0sdJN2NqPMnwBYUTwGhUfhy/opPJJ2U3xVrC7baK7x 9PtzxjOtElZlPkStuTG3G5943fKlbUcpM4PIQ4F2qk4TdF4gx+ZadL9GCUhbAI+AdNeJ ju3OCV7Wgmo5mCgPitqH5XsLuhRz2B2vmuMZfVGgyQh+czmGQ5MTvqhD7mKjwb1dmJc+ DnVpFTpfP0HOdVDD8v7TCoEtBJLlaMlsqigGybm/z/0MV0ZeEWiHn55BMmbLJkehehzi MTfWcsCnMadSq8DvB7gIzWk209uViG6wZaN1GcwKomH5Et/2Ry8v3nILghVpgu59N7c3 1YWg== X-Gm-Message-State: APjAAAWcyyFUO5LQUYLSyM3X/EneCxxi9FvjUJVEYyd1xlttf/D3XlVH sbUv+LHn2Tq37n8ZH1jOOBRffQ== X-Received: by 2002:a62:ab13:: with SMTP id p19mr20845043pff.20.1567203866802; Fri, 30 Aug 2019 15:24:26 -0700 (PDT) Received: from [10.69.45.46] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b126sm17999006pfa.177.2019.08.30.15.24.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Aug 2019 15:24:26 -0700 (PDT) Subject: Re: [PATCH v2 3/3] nvme: fire discovery log page change events to userspace To: Sagi Grimberg , Christoph Hellwig Cc: Greg Kroah-Hartman , linux-nvme@lists.infradead.org, Keith Busch , linux-kernel@vger.kernel.org, Hannes Reinecke 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> From: James Smart Message-ID: <84338eac-c287-1826-4ac1-72cd17ee62cc@broadcom.com> Date: Fri, 30 Aug 2019 15:24:24 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.