All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linda Knippers <linda.knippers@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>,
	Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: NVDIMM-ML <linux-nvdimm@lists.01.org>
Subject: Re: [RFC/PATCH] ndctl list should show more hardware information
Date: Wed, 05 Jul 2017 14:08:03 -0400	[thread overview]
Message-ID: <595D2B03.6010408@hpe.com> (raw)
In-Reply-To: <CAPcyv4jGTAB7CEWADPWMB5a7kjA=52BfOj6WYQG-WrrRAC88qQ@mail.gmail.com>

On 07/05/2017 01:23 PM, Dan Williams wrote:
> On Wed, Jul 5, 2017 at 2:12 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>> Hello,
>>
>>    The current "id" data of dimm (ndctl list -D) shows the information
>>    of DIMM module vendor or serial number.  However, I think it is not enough.
>>
>>    If a NVDIMM becomes broken, users need to know its physical place
>>    rather than vendor or serial number to replace the NVDIMM.
>>
>>    There are 2 candidate of such information.
>>      a) NFIT Device Handle (_ADR of the NVDIMM device)
>>         This date includes node controller id and socket id.
>>      b) NVDIMM Physical ID (Handle for the SMBIOS Memory Device (Type 17)).
>>         The dmidecode can show this handle with more information like "Locator"
>>         So, user can find the location of NVDIMM.
>>
>>    At first, I think _ADR is enough information.
>>
>>    However, when I talked with our firmware team about this requirement,
>>    they said it may not be good data, because the node contoller ID is not
>>    stable on our server due to "partitioning" feature.
>>    (Our server can have plural partition on one box, and may have plural
>>     node 0.)
>>
>>    So, I make the ndctl shows not only NFIT Device Handle but also
>>    NVDIMM Physical ID. Then, user can find the location with dmidecode.
>>
>>    This is the first trial patch. So any comments are welcome.
> 
> This looks ok to me. The only change I would request is to not assume
> that all NVDIMMs have this NFIT-specific data available.
> 
>>
>> Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
>> ---
>> diff --git a/util/json.c b/util/json.c
>> index b718d74..749a358 100644
>> --- a/util/json.c
>> +++ b/util/json.c
>> @@ -68,6 +68,9 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm)
>>  {
>>         struct json_object *jdimm = json_object_new_object();
>>         const char *id = ndctl_dimm_get_unique_id(dimm);
>> +       unsigned int handle = ndctl_dimm_get_handle(dimm);
>> +       short phys_id = ndctl_dimm_get_phys_id(dimm);

Should phys_id be an unsigned short?

>> +       char buf[11];
>>         struct json_object *jobj;
>>
>>         if (!jdimm)
>> @@ -85,6 +88,18 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm)
>>                 json_object_object_add(jdimm, "id", jobj);
>>         }
>>
>> +       snprintf(buf, 11, "0x%08x", handle);
>> +       jobj = json_object_new_string(buf);
>> +       if (!jobj)
>> +               goto err;
>> +       json_object_object_add(jdimm, "handle", jobj);
> 
> For example, this should be in a "if (handle < UINIT_MAX)" branch...

Is that check actually necessary when handle is an unsigned int?  Is there any illegal value?
> 
>> +
>> +       snprintf(buf, 7, "0x%04x", phys_id );
>> +       jobj = json_object_new_string(buf);
>> +       if (!jobj)
>> +               goto err;
>> +       json_object_object_add(jdimm, "phys_id", jobj);
>> +
> 
> ..., and this should be in a "if (phys < USHORT_MAX)" branch.

Same question here.  What's an illegal value?
> 
> Lastly, I think these should be json_object_new_int() types since they
> are numbers not strings.

Is it possible to get hex values if they're numbers?  For the device handle, hex is
helpful.

-- ljk

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

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

  reply	other threads:[~2017-07-05 18:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05  9:12 [RFC/PATCH] ndctl list should show more hardware information Yasunori Goto
2017-07-05 17:23 ` Dan Williams
2017-07-05 18:08   ` Linda Knippers [this message]
2017-07-05 18:27     ` Dan Williams
2017-07-06  4:13       ` Yasunori Goto
2017-07-06  5:41         ` Dan Williams
2017-07-06  5:48           ` Yasunori Goto
2017-07-06 13:31           ` Linda Knippers
2017-07-06 14:47             ` Dan Williams

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=595D2B03.6010408@hpe.com \
    --to=linda.knippers@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=y-goto@jp.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 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.