Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp298124ybl; Thu, 29 Aug 2019 23:22:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKAw/Bv/ZWnGEuy8/jIROPKKwipRLxvXIDJK3R9KipKG6D8/wPMIA1XoFURHFEsilBNGGR X-Received: by 2002:a65:6454:: with SMTP id s20mr11647896pgv.15.1567146130211; Thu, 29 Aug 2019 23:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567146130; cv=none; d=google.com; s=arc-20160816; b=uH/V7cZS7CeNLXvWQQOaQ1KgkHvcY13eHKdqYh+dzg2KFhR1Xe58F++tESXCiUO9Mx UnrbpbijwMa5V34g/Pv3MoVuFc/Bow1BRo1JiCewzAbzIOCagSAaPeN+oEK12Qtnfz4B lrEk6DSnXAj35/FPcyipIa70qmTOX/ifyLFzjeA1S7TIx1rprLLUczb6Jy1XpCVJ/EMN 82W7a0plEywgLofJObf68uVAkkCFOmRcTEXLqfofjhKSdBPh2BsVW615yxrNe4K3ctqd NruJMe1+0evVi6Vast2xmqKjdlGGxQrjpTrDko48b9zmaoZwQKPFyms5flS3LobNWur6 aF4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0yyM7MtqLRpl8RKdZ4IojxRDb9ZIanl/a4vxQqtFTGU=; b=j87Gae3x1frpxJcgyO0xqD+S8J4jsmk5qCCdehgMEv6qpwX3JVJr6kHE4gBDGXUayh gaFYjgi8ruOMDfoX55aORVhF8L21ggXGZalroH4YUUr/fcdQ6Cj0RGwqxWmDg2VrN3Bf mvfcRk4qsgPIRdtVLXmPm2dQJ1zY9EbdKu7tzVfXEZpBzP+oxrELLOJDxUbl+z3rTrUQ ulifC4N/cIkfgtjbokskgs1LMAsr5IJNr1DZ9JXVZeE1wkrcAl7bwbJhUYMnsAydbF6e 4aZJLmjVAZIHyu1VsnFcRneDvScFjle748oEDK4MTDDi30f0zbSC5A5glB10qdgR5ygq pXvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JOn8NYBJ; 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 s17si4899641pfc.69.2019.08.29.23.21.54; Thu, 29 Aug 2019 23:22:10 -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=@kernel.org header.s=default header.b=JOn8NYBJ; 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 S1727768AbfH3GUl (ORCPT + 99 others); Fri, 30 Aug 2019 02:20:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbfH3GUk (ORCPT ); Fri, 30 Aug 2019 02:20:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DD4F2087F; Fri, 30 Aug 2019 06:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567146039; bh=FXijohpD1xppY/Izswf5sHL2hci61FgO5kTCmkEc/7Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JOn8NYBJdF+nYZk35tKx1gQbjgVNO4Q23JKoMz8AtE9l31oifYcJ2t0+OjDXXvrcv yShLLClcyqW1Y+rBw7sg3u++MbBTXHPHfp2B6Vl/dFtdMJrBHsy/ybWYhB2Z4YhKib xroYwIZOsz/2Drf5WkfiL0nCLbIziN4Fw4mVsTmo= Date: Fri, 30 Aug 2019 08:20:36 +0200 From: Greg Kroah-Hartman To: Sagi Grimberg Cc: Christoph Hellwig , linux-nvme@lists.infradead.org, Keith Busch , James Smart , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] nvme: fire discovery log page change events to userspace Message-ID: <20190830062036.GA15257@kroah.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 29, 2019 at 11:21:02AM -0700, Sagi Grimberg wrote: > > > > > > 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. thanks, greg k-h