Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp296700ybe; Tue, 3 Sep 2019 23:07:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTUclP3VttEW8rcwrOeYIX5Vm2r0NlmF/kzPTleHRJmTLkQJGkrVgg3wDe7SmskJFg7FWm X-Received: by 2002:aa7:96c1:: with SMTP id h1mr6779410pfq.111.1567577270952; Tue, 03 Sep 2019 23:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567577270; cv=none; d=google.com; s=arc-20160816; b=swpaOhbUkSPwoiqaSJmKjJ/qv5MBVWyNMEbi8p3f/2Va6hi8cWA9fcdygrxnEMoYdm 3m7JuBhTmiMdlo6F0r+sd+a+l2wgie4xUV51PuaC1C6NPXRYm1+tbFI+uCg/aaW3bpFR BBoXYkcqBU5yIcn/EOs56YHXYJUBRQ/f6wgYOVuCG4QR+yivSU3xGsxE6T0pO1STRvbi w5VUCgvOIN1SObAh4wpr8MXJ8wuBK2CCL626iX1HMuB1Q43mcogiPYZGNX94jfIdrr39 m7tJvnRR0TPUCFrqTpxqIJM3tCmNzK4qKcyXsuFULzTdgaJMqISX6U+EAuQOp6K1/y5F w48Q== 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; bh=KoSwwTiN7x4RNsoQK/l8snqCDNEAnI6inaOHjmR4SUk=; b=p6wsDLgXqCEAyLet5x0q4YbYT/WpcoikKqHzBBvSjSXCDmn8QEFOtYibF9y30BkrEy feeOVIXg0nUKniI09VwqsHAs/Y5Vfsb+ANXZtTYUtldYlhuXMUanzTTDckSwZTCcG3qg Oao0mFwRn/r+AcS+fjWOKOjTY1nhkNatfmZUF7/FDPFp4mbX5ttRlrTL0bxVbg1Pqzns O6MM8i+tMXx6EAcVuR7p77/5GevVTbZFAz6SvefOMZsdWA0/lOXGAsvppSXFqMdjmGpR rpSnqW+nUg5gvQy0Hh5mHP6AsDbOgcNmor3zmLtixDo2sLDrPus+7YiZ862TS990sXbL DmYw== 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 w2si16569076pgs.463.2019.09.03.23.07.34; Tue, 03 Sep 2019 23:07:50 -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 S1728658AbfIDGGH (ORCPT + 99 others); Wed, 4 Sep 2019 02:06:07 -0400 Received: from verein.lst.de ([213.95.11.211]:36258 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726004AbfIDGGH (ORCPT ); Wed, 4 Sep 2019 02:06:07 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 4D026227A8D; Wed, 4 Sep 2019 08:05:59 +0200 (CEST) Date: Wed, 4 Sep 2019 08:05:58 +0200 From: Christoph Hellwig To: Keith Busch Cc: Logan Gunthorpe , Keith Busch , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, Christoph Hellwig , Sagi Grimberg , Jens Axboe , Hannes Reinecke , "Martin K . Petersen" Subject: Re: [PATCH] nvme-core: Fix subsystem instance mismatches Message-ID: <20190904060558.GA10849@lst.de> References: <20190831000139.7662-1-logang@deltatee.com> <20190831152910.GA29439@localhost.localdomain> <33af4d94-9f6d-9baa-01fa-0f75ccee263e@deltatee.com> <20190903164620.GA20847@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190903164620.GA20847@localhost.localdomain> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 10:46:20AM -0600, Keith Busch wrote: > Could we possibly make /dev/nvmeX be a subsystem handle without causing > trouble for anyone? This would essentially be the same thing as today > for non-CMIC controllers with a device-per-controller and only affects > the CMIC ones. A per-subsyste character device doesn't make sense, as a lot of admin command require a specific controller. If this really is an isue for people we'll just need to refcount the handle allocation. That is: - nvme_init_ctrl allocates a new nvme_instance or so object, which does the ida_simple_get. - we allocate a new subsystem that reuses the handle and grabs a reference in nvme_init_subsystem, then if we find an existing subsystem we drop that reference again. - last free of a ctrl or subsystem also drops a reference, with the final free releasing the ida