Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6821877imu; Mon, 21 Jan 2019 17:02:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Oz8tkCQtPCiouw2whOe8+pfzxbfl1BBhMNp0Mq9PUrwlLh4SloiqCIl1WuO9augQ7Pl3o X-Received: by 2002:a62:2082:: with SMTP id m2mr31052831pfj.163.1548118943739; Mon, 21 Jan 2019 17:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548118943; cv=none; d=google.com; s=arc-20160816; b=R5IJbJY3+i4B2ft1sF8SaCwYDBaZnheHIIMDKfg/flpSkzOpHNAOoFjxWate9Bqxip qcD/R3gEIi6gNgUFbIuWst7Jk9cLrAIXoJQOZKYYcfxp4fHkbE1Z9rIsp9R6Q19Ljb6M ijQ8RpFhrx6cWI7SLw+HCCR44UF6nz5yl2Lu3/6G25Ot0+kIrZPEEvzkBloEqtm026rm yHFauN6O907/ekf8za4bOj7WeSJkOFbJPETF1NxG5qHYg9iR+EBf6+5ux1WgxgjrkR9o 0U4JDHO+TQduYk+mGuk3+DS6VH/iistCaMxiwHXcE3CqJfMfVqxpaEcQeDnO54sT90la OxNA== 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=h1skLVYct8+bIxnDMaRew62Ki/2P0urZDZUEYKn1S/U=; b=z1zCReTeqBrTzDOResjAQ9/3d8MONqP7ovph9eoDP7MhK4z9lqqkGgl4nT00cL+ftf XDpi6grzHa6/C+hz1cW1E425Hj1aM+vSr3bzvuygaW3h+eb82ZZnSUFVp8IRqueKUcvD lP2HDbWRO0qwHymX9JaXlWHXDjOa/KKtN55iZsDjj8ZGVgGPjpXARAB7a+HD1rKlNkws ZSDtZtbtDBJiCCEvqtk+OhQyKHSu7RnreOFGYBzsFRCZvyFQoxhem+NOr8I6cvXYrYNr 6EcGqUcC6YBj/aISFcKSxXEjYSbvULyZl0Lks2q9NYneHH+kBsiyyEiHpUq8opLHxfNI Fk+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=l5pKLiFO; 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 b26si953215pgl.539.2019.01.21.17.02.06; Mon, 21 Jan 2019 17:02:23 -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=l5pKLiFO; 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 S1726546AbfAVBA7 (ORCPT + 99 others); Mon, 21 Jan 2019 20:00:59 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:39800 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbfAVBA7 (ORCPT ); Mon, 21 Jan 2019 20:00:59 -0500 Received: by mail-ot1-f68.google.com with SMTP id n8so22184924otl.6 for ; Mon, 21 Jan 2019 17:00:58 -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=h1skLVYct8+bIxnDMaRew62Ki/2P0urZDZUEYKn1S/U=; b=l5pKLiFOtvtdJGkSnP8DHtCa57MqidgH+8wxJUMFFHiLyW77Mvezzicpr278Dbwm8f XNboLh+U49Jx7EGv96M6LqzbDWFki0Hudy72n1zZ9FRfIv2Fi9G1IetLHeXnaSjRBvPX i9c4SF3uMqiQLXjuYIX+jhplLqEnx7STUKHA5Ss0fm8NJAopD8jdFrAJC5sytP9Peb7N MoXJPS9L1f2kusGjeo+ZD/xnT0zTGrfDcJC+e85qD3Qkmq7Vc4IvLUJlMuYR8jbo+X/j YZL1U1hA6lUxTqOhYe1lZ6jzB+YVsHBkFI9f+AlxTfIDcHsuRDlBs6/N26DsKbd5E44Z SAiA== 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=h1skLVYct8+bIxnDMaRew62Ki/2P0urZDZUEYKn1S/U=; b=JuA+lX6vK5cR1C1hcXxwOLlBt9CE4GcytqaROGFwkrP0hItHos9suHzVv+ZxwyBzFp Eotq5Fj1k3KLiphYnZQ6MjJYXnXBH6befnN6zx8buDvlVmm7ZSGdFiH/N2+pRn47SBTv jWuinMqyUXR/2Ll99tFtbiTXklHnh7+ZIINGk+NCHsPAE/iL7aN8fDuu6BStmGxQ4Olw Aaagvqeunm27Y4P0un9xcug5eShCJ75LhceIHCuBa+UONQXY2/qsIsO5EQTIIO9O9H/7 QpoS8xxb+acjyu1ruVVsZFmT0nyhfHlq8Dfaz1XrdZ4vnOcWYh6rhQ0z7hy7Y28s6L+z rwsA== X-Gm-Message-State: AJcUukcIUwsNYq2vR8mH01xM1OAegJJyfeoh4n9sqQFVPaFBHZk32PVI yYppka9XhuyhcgcY8bbEbN3fCnOvglQhX/vNyaWBgw== X-Received: by 2002:a9d:394:: with SMTP id f20mr19794870otf.98.1548118858400; Mon, 21 Jan 2019 17:00:58 -0800 (PST) MIME-Version: 1.0 References: <154785884329.2202034.3295476681016958230.stgit@dwillia2-desk3.amr.corp.intel.com> <20190122002615.GB5855@richard> <20190122004647.GA6575@richard> In-Reply-To: <20190122004647.GA6575@richard> From: Dan Williams Date: Mon, 21 Jan 2019 17:00:47 -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 Mon, Jan 21, 2019 at 4:47 PM Wei Yang wrote: > > On Mon, Jan 21, 2019 at 04:29:08PM -0800, Dan Williams wrote: > >On Mon, Jan 21, 2019 at 4:26 PM Wei Yang wrote: > >[..] > >> >@@ -706,6 +711,22 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) > >> > sig = DAX_SIG; > >> > else > >> > sig = PFN_SIG; > >> >+ > >> >+ /* > >> >+ * Check for an existing 'pfn' superblock before writing a new > >> >+ * one. The intended flow is that on the first probe of an > >> >+ * nd_{pfn,dax} device the superblock is calculated and written > >> >+ * to the namespace. In this case nd_pfn_validate() returns > >> >+ * -ENODEV because no valid superblock exists currently. > >> > >> As you replied in following mail: > >> > >> 3/ If present, nd_pfn_validate() returns 0 and nd_dax_probe() > >> registers the dax0.1 device (this is a libnvdimm 'personality device). > >> > >> So at this point, nd_pfn_validate() return 0 or -ENODEV? > > > >In this case 0, because the configuration was successfully validated. > > > >-ENODEV, is only returned for the initial case where we want the > >kernel to write the configuration. > > > >All other error codes are an actual failure and the probe procedure stops. > > To be honest, this maybe crystal clear for you. But I still feel a little > confused. Especially on differentiating those cases. How many cases we have? There are 4 cases: 1/ namespace probed, no personality info-block found, namespace results in 'raw' mode 2/ namespace probed, {pfn,btt,dax} info-block found, {pfn,btt,dax} device created and attached to the corresponding personality driver 3/ namespace probing ends in failure like -ENOMEM, or a -EIO error reading namespace capacity, for example due to a bad block. 4/ namespace force assigned to a {pfn,btt,dax} device instance, {pfn,btt,dax} device force enabled leading to the info-block being written out to the device > And what's your first probe mean? This the nd_btt/pfn/dax_probe()? or the > linux driver probe? The first probe is always nd_pmem_probe(). nd_{pfn,btt,dax}_probe() are secondary.