All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dexuan Cui <decui-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
To: "Verma,
	Vishal L"
	<vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Williams,
	Dan J" <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"Jiang,
	Dave" <dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org"
	<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>,
	"jthumshirn-l3A5Bk7waGM@public.gmane.org"
	<jthumshirn-l3A5Bk7waGM@public.gmane.org>,
	Michael Kelley <mikelley-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>,
	"qi.fuli-LMvhtfratI1BDgjK7y7TUQ@public.gmane.org"
	<qi.fuli-LMvhtfratI1BDgjK7y7TUQ@public.gmane.org>
Subject: RE: [ndctl PATCH v2 4/4] ndctl, monitor: support NVDIMM_FAMILY_HYPERV
Date: Fri, 22 Mar 2019 02:08:46 +0000	[thread overview]
Message-ID: <PU1P153MB0169CA436F52268DD2BEF745BF430@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <9876fd8a491e339f2f41a47e2195d354bf0d5fb2.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> From: Verma, Vishal L <vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Sent: Wednesday, March 20, 2019 6:55 PM
> ...
> >
> > -static void filter_dimm(struct ndctl_dimm *dimm, struct util_filter_ctx *fctx)
> > +static bool ndctl_dimm_test_and_enable_notification(struct ndctl_dimm
> *dimm)
> >  {
> > -	struct monitor_dimm *mdimm;
> > -	struct monitor_filter_arg *mfa = fctx->monitor;
> >  	const char *name = ndctl_dimm_get_devname(dimm);
> >
> > +	/*
> > +	 * Hyper-V Virtual NVDIMM doesn't use ND_CMD_SMART to get the
> health
> > +	 * info. Instead, it uses ND_CMD_CALL, so the checking here can't
> > +	 * apply, and it doesn't support threshold alarms -- actually it only
> > +	 * supports one event: ND_EVENT_HEALTH_STATE.
> > +	 */
> > +	if (ndctl_dimm_get_cmd_family(dimm) == NVDIMM_FAMILY_HYPERV) {
> > +		if (monitor.event_flags != ND_EVENT_HEALTH_STATE) {
> > +			monitor.event_flags = ND_EVENT_HEALTH_STATE;
> > +
> > +			notice(&monitor,
> > +				"%s: only dimm-health-state can be monitored\n",
> > +				name);
> > +		}
> > +		return true;
> > +	}
> > +
> 
> I'm not sure about the family-specific special casing -- it leaks family
> specific details into the common implementation, something that's been
> avoidable thus far.
> 
> Is there any reason why the ndctl_dimm_is_cmd_supported() can't be made
> to fail appropriately for anything that is not supported, by adding the
> necessary functions to dimm-ops?

IMO there are 2 issues in ndctl/monitor.c: filter_dimm():

1. IMO the cmd numbers ND_CMD_SMART (1) and 
ND_CMD_SMART_THRESHOLD(2) are not really device-neutral. They
work for ndctl/lib/intel.c and it looks they happen to work for 
ndctl/lib/hpe1.c, as hpe "happens" to have:
       NDN_HPE1_CMD_SMART = 1,
       NDN_HPE1_CMD_SMART_THRESHOLD = 2,

But for ndctl/lib/msft.c, 1 and 2 mean different things. See [1].
So the current "ndctl monitor" can't support msft.c.

For ndctl/lib/hyperv.c, 1 and 2 means:
        ND_HYPERV_CMD_GET_HEALTH_INFO = 1,
        ND_HYPERV_CMD_GET_SHUTDOWN_INFO = 2,
They're also incompatible with ND_CMD_SMART and
ND_CMD_SMART_THRESHOLD.
Of source, the current code can "work" since these ND_HYPERV_CMD*
numbers happen to be the same as ND_CMD_SMART and 
ND_CMD_SMART_THRESHOLD. So this may not be an isue for hyperv.c.

2. The current code assumes ND_SMART_ALARM_VALID must be supported.
However, NVDIMM_FAMILY_HYPERV doesn't support it, so currently
ndctl/monitor.c: filter_dimm() reports an error and returns -- for Hyper-V, 
we should not return... hence I made this patch. 

Of source, we can add a new op to dimm->ops, e.g. 
ops->monitor_supported() and then change the common code accordingly,
but I can imagine that would require a lot more changes and I guess it may not
worth that effort? Please share your insights!

> That way if the user enters any of the unsupported options, they will
> just fail normally, and the user will be expected to provide the right
> options for the environment they know they're running in.

When the user enters any of the unsupported options, they will only
get an "no dimms to monitor" error, which gives no hint why the
error happens, and confuses the user...
 
> Indeed, I think that patch 3 of this series should never be required :)
Please see the above.

Thanks,
-- Dexuan

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/storage/-dsm-interface-for-byte-addressable-energy-backed-function-class--function-interface-1-

  parent reply	other threads:[~2019-03-22  2:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20  5:11 [ndctl PATCH v2 4/4] ndctl, monitor: support NVDIMM_FAMILY_HYPERV Dexuan Cui
2019-02-21  8:40 ` qi.fuli
     [not found]   ` <OSBPR01MB50009900A5FE2E8588AA6367F77E0-zhdMvvdcU0ZckHoPmfvix3colHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-02-21 18:30     ` Dexuan Cui
2019-02-25  4:48       ` qi.fuli
     [not found]         ` <OSAPR01MB4993163079F35EEF06DFBB44F77A0-OxqQCv4d1nTzcNm8D4NKs3colHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-02-25  5:16           ` Dexuan Cui
2019-03-21  1:54 ` Verma, Vishal L
     [not found]   ` <9876fd8a491e339f2f41a47e2195d354bf0d5fb2.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-03-22  2:08     ` Dexuan Cui [this message]
2019-03-22  3:31       ` Dan Williams
     [not found]       ` <PU1P153MB0169CA436F52268DD2BEF745BF430-7hHSCQUTt08p9lVGRpUb+2HfQuWdHs3hiGd9ebBGJoev3QGu/rdwKA@public.gmane.org>
2019-03-22  4:05         ` Dexuan Cui
2019-03-22  4:13           ` Dan Williams
     [not found]             ` <CAPcyv4hVZLW2OSMZ9NqqsQWMg7vxyS9J1ekDZW8G44cmD9_YCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-22  5:09               ` Dexuan Cui
2019-03-22  5:36                 ` Dan Williams
     [not found]                   ` <CAPcyv4hM_DTcMJdWhWbtPFfVH_V-kYxXSSCg=MQZLoxVka=Mng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-22  6:03                     ` Dexuan Cui
2019-03-22  6:11                       ` Dan Williams
     [not found]                         ` <CAPcyv4h4tAydacTbmZRKy7hmTqWTM22r6hD+Ucm_f3H2tQUm3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-22 17:55                           ` Dexuan Cui
2019-03-22 18:03                             ` Dan Williams
     [not found]                               ` <CAPcyv4gMexBmWduqR8G=1H3gKkxbqfBADOLG595nVRipAxVukA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-22 18:09                                 ` Dexuan Cui
2019-03-22 18:28                             ` Verma, Vishal L
     [not found]                               ` <837eed30b0da59f91e5114aad97e919068a077e8.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-03-23  4:24                                 ` 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=PU1P153MB0169CA436F52268DD2BEF745BF430@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM \
    --to=decui-0li6otcxbfhby3ivrkzq2a@public.gmane.org \
    --cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dave.jiang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=jthumshirn-l3A5Bk7waGM@public.gmane.org \
    --cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=mikelley-0li6OtcxBFHby3iVrkZq2A@public.gmane.org \
    --cc=qi.fuli-LMvhtfratI1BDgjK7y7TUQ@public.gmane.org \
    --cc=vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.