Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6510493imu; Mon, 21 Jan 2019 10:07:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN4n9yCw49t5dTv5+6/lvzjNn/JfMlzB6uvDCA7PfekEGcN1sIFWVXfi5cpXgbbisBlY5bfu X-Received: by 2002:a63:ca02:: with SMTP id n2mr29222352pgi.187.1548094041896; Mon, 21 Jan 2019 10:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548094041; cv=none; d=google.com; s=arc-20160816; b=LFn4S0boCT5ROi6akCYW6BDZLRqs7yZr4jAaTrTq8Z9z+b7BObZvClCP4/BOvstiEE uj/ZqwnccWiuD/iDBGdUMHg91qShHa8LiHcju8zO6dbKoKW/EQVcvQtohcKreh67y1xj TcXevc952Ob5+W3ucQg6YvWBSIZ7ujNKag4Y7BFY0H6cnA91GFJtcqofkfEENdMUKN2/ 90razWFpF4HtTMPcvtb4IsRokRVGh65fRTfEcqpsQDS3nqLDHsa26w2DrBjvzzI51C8j 75oe7X3yjADgStMzEBrWeXOGmtrrsfo1WtjxGG5Oo09qwo1Fqiz1hGHfZrUYoJAoxmFf hf2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6eZbr9IlqZkiHLUSATqRtFo5RPhXCxT327ubvp0394Y=; b=Yb4UvKorLlHfHioWQC8zKe92dXL2f0X5ZymdqVYvexuxxIzpz/AjDDZM/bHM7DgZl+ Bz5OjZEQQZudIN4hnLpX4znGQzJW8ZFg7k1kFjvwOcL5vm/QRO5KvYj2M+gsZaXcpRKG Zililp/mF05fMgOZoSMT9wMcoQfXRrOJQQul0an9avv/x1HvmOR+EUPpHc4zAbDLSjH/ ngXjo4C+tHIECmAVcuolS3sHoMaVGaT9OU7aTCrCs3yQULoclrIjBnfgT4CfoMMND+uw HELnLA5rOirkn98u2cYNlso7AaQW1EVyCmgyIM/k9IqVu2TyfBF0RaVSlI8+3sPJ2D/A TkvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=YO95x1KF; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj11si13034140plb.21.2019.01.21.10.07.05; Mon, 21 Jan 2019 10:07:21 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=YO95x1KF; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727422AbfAUSEx (ORCPT + 99 others); Mon, 21 Jan 2019 13:04:53 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:36894 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfAUSEx (ORCPT ); Mon, 21 Jan 2019 13:04:53 -0500 Received: by mail-oi1-f195.google.com with SMTP id y23so15243373oia.4 for ; Mon, 21 Jan 2019 10:04:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6eZbr9IlqZkiHLUSATqRtFo5RPhXCxT327ubvp0394Y=; b=YO95x1KFQNGHZKJXtr4YnGnLjNqzergs4SfxO4XyId/1JLxBqV6ToHfajAMhVpoxhY zXsfvs8igZ0nC0RKQTjEvpfE9KW90tHKu3yodfSDtlIagp04zAaUGnSz3707c0I7xBhr 1DP8f96nC7h8627q94WC+sRvFIYuwEvyKaRfz5JyrO6p9d6snOS6/RW1Uw6VYihDQeU9 vX9UbVb0uttGH72GEMMYZSx1tAI9zKetfq1Rihb79G3fEjP35r0uf7W9C+id+uASj+OT r6zcgICU7axAJHE/DLQ5j53wjIElJ49wFfJltpVD94tR2XvyNn1YCA+vTf9Hp5GAiaiT 8MCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6eZbr9IlqZkiHLUSATqRtFo5RPhXCxT327ubvp0394Y=; b=qWywjySLQKVZQI56VtHvXgviXmYIVg747FwVPvMgQsprU/8/xp6QSkx9a4jaqBig95 gme63+jRW3bk/4nH+wRWZH8dgi9JdPI3Ovmti+jXFCZ4oouUfo0yFx5ZaMAjuo/eiXSG bVjOyaF+z1/oQz9c/hMpGxOyK05jYukzUDDbCLq+BNfatYCF7FD8PqIsHNgUVdScQ9NB kRfVtQC0Pju1FdgVEzaac6LSI0Axfh9s8Mk2oC3WJYlJxH5Qs/dXdbsZZZKWV7ciAALR zUc6JLgh919OkDXWAK5sSx69+uooNzQYrMwjIfxUOrE6xP6u6XOykCq8i0SSgJffqJdL 9Tkw== X-Gm-Message-State: AJcUukewM9k1S4f+8QEVfmfsNVEMHAepY0QkX9FTAgit18fJEyyCwA4+ wADp7PjeGLswOm66LBJ+96vJY3+znLtL9lB77afgZKYcBVo= X-Received: by 2002:aca:f4c2:: with SMTP id s185mr6538239oih.244.1548093891955; Mon, 21 Jan 2019 10:04:51 -0800 (PST) MIME-Version: 1.0 References: <154785884329.2202034.3295476681016958230.stgit@dwillia2-desk3.amr.corp.intel.com> <20190121075102.GA3758@richard> In-Reply-To: <20190121075102.GA3758@richard> From: Dan Williams Date: Mon, 21 Jan 2019 10:04:40 -0800 Message-ID: Subject: Re: [PATCH] libnvdimm: Clarify nd_pfn_init() flow To: Wei Yang Cc: linux-nvdimm , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 20, 2019 at 11:51 PM Wei Yang wrote: > On Fri, Jan 18, 2019 at 04:47:23PM -0800, Dan Williams wrote: [..] > Also, I have one confusion about your saying: two probes. > > If the two probes are: > > * for dax%d.%d: 1. nd_dax_probe 2. dax_pmem_probe > * for pfn%d.%d: 1. nd_pfn_probe 2. nd_pmem_probe > > Then, if the first probe fails, the device itself would be destroyed. How the > second probe do its job? > > > rc = nd_pfn_validate(nd_pfn, sig); > > if (rc != -ENODEV) > > return rc; Here is an example path for a device-dax instance: /sys/devices/platform/e820_pmem/ndbus0/region0/dax0.1/dax0.0 In this case the order of events is: 1/ region0 discovers it contains a pmem namespace and registers namespace0.0 2/ The pmem namespace driver calls nd_dax_probe() to check for the presence of a device-dax configuration 3/ If present, nd_pfn_validate() returns 0 and nd_dax_probe() registers the dax0.1 device (this is a libnvdimm 'personality device). 4/ When nd_pmem_probe() sees nd_dax_probe() return 0 it in turn fails the probe of namespace0.0 with -ENXIO. All devm allocations during the probe of namespace0.0 are released. 5/ Meanwhile the created dax0.1 device is recognized by the dax_pmem device. 6/ dax_pmem_probe() uses nd_pfn_init() to validate the configuration and ultimately creates the dax0.0 character device The pmem namepsace driver is effectively a router to other personality drivers that may be layered on top of the base namespace capacity.