linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"dexuan.cui@gmail.com" <dexuan.cui@gmail.com>,
	"mikelley@microsoft.com" <mikelley@microsoft.com>
Cc: "qi.fuli@fujitsu.com" <qi.fuli@fujitsu.com>
Subject: Re: [ndctl PATCH v3 4/5] libndctl: Add a new dimm-op cmd_is_supported()
Date: Tue, 26 Mar 2019 21:56:02 +0000	[thread overview]
Message-ID: <072e59f43a276b9daa93c131866fc26fabaad626.camel@intel.com> (raw)
In-Reply-To: <20190323042028.4310-5-decui@microsoft.com>


On Sat, 2019-03-23 at 04:20 +0000, Dexuan Cui wrote:
> A NVDIMM family may need to report that it supports a command, even if
> the command is not set in dimm->cmd_mask, e.g. a non-NVDIMM_FAMILY_INTEL
> famimy may support ND_CMD_SMART or some kind of variant of ND_CMD_SMART,
> while the kernel only sets ND_CMD_SMART in the nvdimm->cmd_mask for
> NVDIMM_FAMILY_INTEL.

Hi Dexuan,

Thanks for making the changes, this revision /mostly/ looks good to me
except - 

The kernel dsm mask just seems to be hard-coded in [1]

So is there any reason that that can't simply be allowed to advertise
"everything is supported", similar to what the MSFT family does, and
that should remove the need for playing games with dimm-ops (i.e. now
there is another layer that can affect command support detection).

[1]: https://patchwork.kernel.org/patch/10785277/

> 
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
>  ndctl/lib/libndctl.c | 5 +++++
>  ndctl/lib/private.h  | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index 24b8ad3..4acfb03 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -1769,6 +1769,11 @@ NDCTL_EXPORT int ndctl_dimm_failed_map(struct ndctl_dimm *dimm)
>  NDCTL_EXPORT int ndctl_dimm_is_cmd_supported(struct ndctl_dimm *dimm,
>  		int cmd)
>  {
> +	struct ndctl_dimm_ops *ops = dimm->ops;
> +
> +	if (ops && ops->cmd_is_supported)
> +		return ops->cmd_is_supported(dimm, cmd);
> +
>  	return !!(dimm->cmd_mask & (1ULL << cmd));
>  }
>  
> diff --git a/ndctl/lib/private.h b/ndctl/lib/private.h
> index a9d35c5..2ddc1d2 100644
> --- a/ndctl/lib/private.h
> +++ b/ndctl/lib/private.h
> @@ -292,6 +292,7 @@ struct ndctl_bb {
>  
>  struct ndctl_dimm_ops {
>  	const char *(*cmd_desc)(int);
> +	bool (*cmd_is_supported)(struct ndctl_dimm *, int);
>  	struct ndctl_cmd *(*new_smart)(struct ndctl_dimm *);
>  	unsigned int (*smart_get_flags)(struct ndctl_cmd *);
>  	unsigned int (*smart_get_health)(struct ndctl_cmd *);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2019-03-26 21:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23  4:20 [ndctl PATCH v3 0/5] Add the support for Hyper-V virtual NVDIMM Dexuan Cui
2019-03-23  4:20 ` [ndctl PATCH v3 1/5] libndctl: Implement the "smart_get_health" dimm-op for Hyper-V Dexuan Cui
2019-03-23  4:20 ` [ndctl PATCH v3 2/5] libndctl: Implement the smart_get_shutdown_count " Dexuan Cui
2019-03-23  4:20 ` [ndctl PATCH v3 3/5] ndctl, monitor: Don't require the support of ND_CMD_SMART_THRESHOLD Dexuan Cui
2019-03-23  4:20 ` [ndctl PATCH v3 4/5] libndctl: Add a new dimm-op cmd_is_supported() Dexuan Cui
2019-03-26 21:56   ` Verma, Vishal L [this message]
     [not found]     ` <072e59f43a276b9daa93c131866fc26fabaad626.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-03-26 23:29       ` Dexuan Cui
2019-03-26 23:42         ` Dan Williams
2019-03-27 16:17         ` Verma, Vishal L
     [not found]           ` <2e75cba1e02c5ed1701eaf397476a3256130e9b9.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-03-27 17:05             ` Dexuan Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=072e59f43a276b9daa93c131866fc26fabaad626.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dexuan.cui@gmail.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=mikelley@microsoft.com \
    --cc=qi.fuli@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).