Received: by 2002:a17:90a:b81:0:0:0:0 with SMTP id 1csp1016168pjr; Fri, 30 Aug 2019 11:15:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbAPCHhZpxNio/97xk6ws99k33qOIIqsL1SV+OrDpSOp2tr4frAv+O3Rn59wIrHmkJGksZ X-Received: by 2002:a62:2603:: with SMTP id m3mr20338704pfm.163.1567188953459; Fri, 30 Aug 2019 11:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567188953; cv=none; d=google.com; s=arc-20160816; b=ZB75CYq54clKxnQ7F2M95BJIM4ekteC+QYuD7DYrQhsgl6s+ypYFIlSwEb52fMIfAz H5hdP/e4OeaUrI6LRLmxYD0Hf8KyxrpmqE1XXXaQQ05jYVoMUzML3WTBaXi6ZyLXk15W OtxeiGRHk8/yceyc/+/zuzkNrGICt4HDYAqs5w5y979pJvJaLGXNctHlTEoZDRnJn7EI bLDEzfEG8TB8MTH2PdeJRBzxQxUBTRFxncSTzanW6lPf9TACE3tI3boOkvfbn/1KOhV4 or3u/OSZxPYezDNDo0a2nyytIOSmRlg+JYdh9cKIx/gPXs5XGLqC9FPiX83uWTz8kUWK y2hQ== 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; bh=tcZ7CbFDJuL2UIE4e1E/mRyvfTkPs0zewzMOwmkGiT4=; b=gLAj1ZuueO770b7RuTYDaO8yyOZqjHMZuP4Mf8Pj8ILkTchmn4AIlPR19H4B8P4ciL kNod61dbBu2roYmdLpIYhZtx4KIWcDN8/eGciP5ykHnvEnru8XyTZ4PcFLr7U3eqMY+e Y08WUVFc+DwjcS2SmUeDvA3NvhWQezJkJVbptpQT6ri/4mhaezTABtCNAFc0oMvd4rAX rqJ/v1IvWMHo1UqZn/86S+Zi2Y5ZsIFik7tw9ruRRqsmKmfJ1ZNfn/184aJgjofOfLaE 7h8QKwJk5Emi3CBdoQdj7y3fTYXxDj+nnt1J9zy2Sh7KitHI/Si+fKwpcqCwmoXDrMuU bohg== 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 7si5163929ple.224.2019.08.30.11.15.38; Fri, 30 Aug 2019 11:15:53 -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 S1728263AbfH3SOn (ORCPT + 99 others); Fri, 30 Aug 2019 14:14:43 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:35871 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727979AbfH3SOm (ORCPT ); Fri, 30 Aug 2019 14:14:42 -0400 Received: by mail-ot1-f68.google.com with SMTP id k18so7810817otr.3 for ; Fri, 30 Aug 2019 11:14:42 -0700 (PDT) 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=tcZ7CbFDJuL2UIE4e1E/mRyvfTkPs0zewzMOwmkGiT4=; b=ZOSDP37aDPF+p49nr/Gv1hu2TLa45LVS6+t7kN6/bo2+7Ys5ky7k9aAjsvWQyWcuA0 2j2iFXMxuvNFIY0+83dVBRiCn4rbZxpYzItwwoBWX8bUVeuIeZ5oJnGT6ZC+hRK1swoN IrYkb+/ox9lvt55kUIsOLBAIAMKX1kerrjfPW4H+wh9c0yTARh7N6BdeFaeEvTVW2h5f bSFyRZHiUy0dH5kGtqw0rIXJkpOEzYG0+O/Hi15cD2moR3oZIOICYzHmwIyWyo1a7Jg0 1wuaKNKCo2hn5i1P3TPpJzb2utnc2C/oM4pEGySOoJOS8N70ZBa/l39uARj5TINgbdbh z9WQ== X-Gm-Message-State: APjAAAWSwrxnJB2v27WtvYOgEMGVgB+LyW8PCpEsjqYPSJqelWzuwwaP v5bzgoVLai59KHtb9aNLIjPzml19 X-Received: by 2002:a05:6830:130e:: with SMTP id p14mr13486506otq.339.1567188881552; Fri, 30 Aug 2019 11:14:41 -0700 (PDT) Received: from ?IPv6:2600:1700:65a0:78e0:514:7862:1503:8e4d? ([2600:1700:65a0:78e0:514:7862:1503:8e4d]) by smtp.gmail.com with ESMTPSA id 34sm1469032ots.47.2019.08.30.11.14.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Aug 2019 11:14:40 -0700 (PDT) Subject: Re: [PATCH v2 3/3] nvme: fire discovery log page change events to userspace To: Greg Kroah-Hartman Cc: Christoph Hellwig , linux-nvme@lists.infradead.org, Keith Busch , James Smart , 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> <20190830062036.GA15257@kroah.com> From: Sagi Grimberg Message-ID: <73e3d2ca-33e0-3133-9dfb-62b07e5b09c4@grimberg.me> Date: Fri, 30 Aug 2019 11:14:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190830062036.GA15257@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 >>>>>> You are correct that this information can be derived from sysfs, but the >>>>>> main reason why we add these here, is because in udev rule we can't >>>>>> just go ahead and start looking these up and parsing these.. >>>>>> >>>>>> We could send the discovery aen with NVME_CTRL_NAME and have >>>>>> then have systemd run something like: >>>>>> >>>>>> nvme connect-all -d nvme0 --sysfs >>>>>> >>>>>> and have nvme-cli retrieve all this stuff from sysfs? >>>>> >>>>> Actually that may be a problem. >>>>> >>>>> There could be a hypothetical case where after the event was fired >>>>> and before it was handled, the discovery controller went away and >>>>> came back again with a different controller instance, and the old >>>>> instance is now a different discovery controller. >>>>> >>>>> This is why we need this information in the event. And we verify this >>>>> information in sysfs in nvme-cli. >>>> >>>> Well, that must be a usual issue with uevents, right? Don't we usually >>>> have a increasing serial number for that or something? >>> >>> 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. > > So? You will have gotten the remove and then new addition uevent in > order showing you this. So your userspace code knows that something > went away and then came back properly so you should be kept in sync. Still don't understand how this is ok... I have /dev/nvme0 represents a network endpoint that I would discover from, it is raising me an event to do a discovery operation (namely to issue an ioctl to it) so my udev code calls a systemd script. By the time I actually get to do that, /dev/nvme0 represents now a new network endpoint (where the event is no longer relevant to). I would rather the discovery to explicitly fail than to give me something different, so we pass some arguments that we verify in the operation. Its a stretch case, but it was raised by people as a potential issue.