mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal L Verma <vishal.l.verma@intel.com>,
	"Knippers, Linda" <linda.knippers@hpe.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] libnvdimm, pmem: Add sysfs notifications to badblocks
Date: Sat, 17 Jun 2017 00:35:52 +0000	[thread overview]
Message-ID: <CS1PR84MB0104A87F4AAB23AADF88656282C60@CS1PR84MB0104.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAPcyv4i03dU37tgqyRaMugGTqjagWeZ+WAtc7deJyZkkAbO9mA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

> On Mon, Jun 12, 2017 at 3:25 PM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > Sysfs "badblocks" information may be updated during run-time that:
> >  - MCE, SCI, and sysfs "scrub" may add new bad blocks
> >  - Writes and ioctl() may clear bad blocks
> >
> > Add support to send sysfs notifications to sysfs "badblocks" file
> > under region and pmem directories when their badblocks information
> > is re-evaluated (but is not necessarily changed) during run-time.
> >
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Vishal Verma <vishal.l.verma@intel.com>
> > Cc: Linda Knippers <linda.knippers@hpe.com>
> > ---
> > v2: Send notifications for the clearing case
> > ---
> 
> This looks good to me, I've applied it, but I also want to extend the
> ndctl unit tests to cover this mechanism.

Right.  For the time being, would you mind to use the attached test
program for your sanity tests?  It simply monitors sysfs notifications
and prints badblocks info...  Sorry for inconvenience.

Since I am not familiar with the ndctl unit tests and I am traveling for
the rest of the month, I may have to look into it after I am back.

Thanks!
-Toshi



[-- Attachment #2: test_sysfs_notify.c --]
[-- Type: text/plain, Size: 1160 bytes --]

/*
 * Copyright (C) 2017  Hewlett Packard Enterprise Development LP
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h> 
#include <sys/stat.h> 

int main(int argc, char **argv)
{
	int fd, ret;
	fd_set fds;
	char buf[256];

	if (argc != 2) {
		printf("USAGE: test_sysfs_notify badblocks-path\n");
		exit(1);
	}

	if ((fd = open(argv[1], O_RDONLY)) < 0) {
		printf("Unable to open %s\n", argv[1]);
		exit(1);
	}
	printf("Monitoring %s - ctl-c to stop\n", argv[1]);

	while (1) {
		memset(buf, 0, sizeof(buf));
		ret = lseek(fd, 0, SEEK_SET);
		ret = read(fd, buf, sizeof(buf));
		printf("%s\n", buf);

		FD_ZERO(&fds);
		FD_SET(fd, &fds);

		ret = select(fd + 1, NULL, NULL, &fds, NULL);
		if (ret <= 0) {
			printf("error (%d)\n", ret);
			exit(1);
		} else if (FD_ISSET(fd, &fds)) {
			printf("NOTIFIED!!\n");
		}
	}

	close(fd);
}

  reply	other threads:[~2017-06-17  0:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 22:25 Toshi Kani
2017-06-15 21:33 ` Dan Williams
2017-06-17  0:35   ` Kani, Toshimitsu [this message]
2017-06-17  0:46     ` Dan Williams
2017-06-17  0:51       ` Kani, Toshimitsu
2017-06-30 16:47 ` Dan Williams
2017-07-01  0:41   ` Kani, Toshimitsu

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=CS1PR84MB0104A87F4AAB23AADF88656282C60@CS1PR84MB0104.NAMPRD84.PROD.OUTLOOK.COM \
    --to=toshi.kani@hpe.com \
    --cc=dan.j.williams@intel.com \
    --cc=linda.knippers@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.l.verma@intel.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

all inboxes | Powered by JetHome®