Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6652002imu; Mon, 21 Jan 2019 12:59:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN5gMOPAYrBWcWq5MQMushPJEHLDWg8EhjDahzQy7b53Y13UYRDIYiddpeAw0sjRVKH4jckn X-Received: by 2002:a62:6f88:: with SMTP id k130mr30914246pfc.234.1548104386711; Mon, 21 Jan 2019 12:59:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548104386; cv=none; d=google.com; s=arc-20160816; b=oXQrYxJoQhLD4FZPu8/RN3wvff6RYYLLdAQ+lEqXQtahDMNdwebMM0WwL/zWW2g8Tt eiL0XxcGulwsLMMUdhh8ISCDDtZM6OulFib/0KvR/zSUnSh2EZuTOB42g7dwkpFszMYt dq1E2gj+TOzeGJQb4qPuUe53/ZuEPzFwmTD+bAMvFCPR0dQOPgmLq8EASYH+LOmFzCOl d8N4XIcU1TEsZBRFLQefQC4ixHWkXbSytwQOKRzKfMjMmlyN3qP+LNXwHtVUv5dUJwcX RAPf1lFNVaI5tHZn68NAuGIpXKIyfgYyNnLbu+5JhaC6Ol5ep6+XO/fwnb3iAcieggY7 PJJA== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=1fA3qrPhkd5M2hoTKAJoUYCXDOy3vvddagKUT6nokP4=; b=kJqS9jmfHDokQYXVP9pao6SX7Occ1TjzTOZMNuoMZMLdBMBIqkO0pxblFCaR8z9HsO d5yJ2YaYBRFX6Q5udZKIzyO0JaZOI6fI9GCxv8JGt1qE60zkC7GO/MV7LzViCj+JNbhe 0nnx46P98vwOdjD0JAwgCLYkUVtqi6o04XDVMavae7zD24fqI1rigaUFyTz5Swf5lCCU dlJMHH/aTum2nVVYS3fIBWh1xWeyWXOU3+q32Hea04NFHFoBpu2AO1lVAKwC6mLgArCZ /4oICGulF/Lo6HKJeAkbbUv2NM/Tn/feXWO9+LUeP4tDGfvgMBzF0LCik/5G0EMpAyZU QYWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Aafs4w34; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 135si13568680pge.572.2019.01.21.12.59.30; Mon, 21 Jan 2019 12:59:46 -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=@gmail.com header.s=20161025 header.b=Aafs4w34; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727496AbfAUU5Q (ORCPT + 99 others); Mon, 21 Jan 2019 15:57:16 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38067 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726004AbfAUU5Q (ORCPT ); Mon, 21 Jan 2019 15:57:16 -0500 Received: by mail-ed1-f66.google.com with SMTP id h50so17621467ede.5 for ; Mon, 21 Jan 2019 12:57:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1fA3qrPhkd5M2hoTKAJoUYCXDOy3vvddagKUT6nokP4=; b=Aafs4w34IFcwpaDvzGsZcD9LjOdSvhQR8TWmicHTZVMAZ3johE0QgHT0ODXOIY8pc4 z5Hx5ITSdoDVd05CoqmqE7oUwb5EMtVGymgQ9LFdGvA2ZHnpbKQg2zOGAthf8cHQcJX6 nnmupHIGCAJHtvXBbLHxziZRGvxqymbeLco5LAwM0SNRS9QKRAgl/bsd6zQ7Zte/Johy kFiqehTXxYqd6GaUdd5tOG20Rr9FD4V8xoUDpxazIPdA5ld48O+YpxFZ8PtOfHk4F45j vN95/uL7SHtPDgHUvUOCcmHKMSEOUS81Wj1oaK2reAwpebGy1qymBHDRjtjGrSkFRhI8 9Zdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=1fA3qrPhkd5M2hoTKAJoUYCXDOy3vvddagKUT6nokP4=; b=BnWhZesrJwLtx4Deoff0AwbN1NgPZQGbgvHC9nmgzEZ5W2jTqws7x3X6ht2U05jwwW POi+ARZhAbxGSy+ufFZ6kqXVegWilsPUyaLUZ+osHq+meqxLgnU4tzGzeEz8ldSdoezW KFT/6/V81y8Yp5A8VQXUWVCFy1Z7+eoLkkf+aV5T5fqmv3Bf81YEG2+30PmS+8Z7hSI3 mohPIXrahs+8wkMFBxE3Y2cM80LaJcchc7Ta30rOUXvTJmG6AwDYPiHSqznV1jIZR5iP WTYJ27w/28/T7ru0aqzftimSBmquGXt0UcDmUIqhPr9o+uCEgffYTWXSYqiJVjLrFWXm n+8A== X-Gm-Message-State: AJcUukfNpS6PHS31xK8HcXX4310oYrNjr0v99VKf+A2h2wz9KXvQF2X2 TylQ03LK6JbEQlJPx2rRi1A= X-Received: by 2002:a17:906:2ec6:: with SMTP id s6-v6mr25718105eji.93.1548104234652; Mon, 21 Jan 2019 12:57:14 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id t10-v6sm4895811ejg.41.2019.01.21.12.57.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 12:57:13 -0800 (PST) Date: Mon, 21 Jan 2019 20:57:13 +0000 From: Wei Yang To: Dan Williams Cc: Wei Yang , linux-nvdimm , Linux Kernel Mailing List Subject: Re: [PATCH] libnvdimm: Clarify nd_pfn_init() flow Message-ID: <20190121205713.vai2oor3saopcja7@master> Reply-To: Wei Yang References: <154785884329.2202034.3295476681016958230.stgit@dwillia2-desk3.amr.corp.intel.com> <20190121075102.GA3758@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 21, 2019 at 10:04:40AM -0800, Dan Williams wrote: >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. I may have another opinion here. The probe return error means the device will not attach to this driver. But the device itself it not released. We allocate devm on one device and those memory will be released when the device is destroyed. If I am correct. This means at this point, pfn_sb's memory still exists in the system. Even finally we will release it, when namespace0.0 is destroyed. >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. -- Wei Yang Help you, Help me