All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Vishal Verma <vishal.l.verma@intel.com>
Cc: linux-nvdimm@lists.01.org, linux-block@vger.kernel.org,
	linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org,
	Jens Axboe <axboe@fb.com>, NeilBrown <neilb@suse.com>,
	Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH v2 2/3] block: Add badblock management for gendisks
Date: Fri, 04 Dec 2015 15:33:38 -0800	[thread overview]
Message-ID: <1449272018.27077.29.camel@HansenPartnership.com> (raw)
In-Reply-To: <1448477013-9174-3-git-send-email-vishal.l.verma@intel.com>

On Wed, 2015-11-25 at 11:43 -0700, Vishal Verma wrote:
> NVDIMM devices, which can behave more like DRAM rather than block
> devices, may develop bad cache lines, or 'poison'. A block device
> exposed by the pmem driver can then consume poison via a read (or
> write), and cause a machine check. On platforms without machine
> check recovery features, this would mean a crash.
> 
> The block device maintaining a runtime list of all known sectors that
> have poison can directly avoid this, and also provide a path forward
> to enable proper handling/recovery for DAX faults on such a device.
> 
> Use the new badblock management interfaces to add a badblocks list to
> gendisks.
> 
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  block/genhd.c         | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/genhd.h |  6 ++++
>  2 files changed, 87 insertions(+)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 0c706f3..84fd65c 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -20,6 +20,7 @@
>  #include <linux/idr.h>
>  #include <linux/log2.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/badblocks.h>
>  
>  #include "blk.h"
>  
> @@ -505,6 +506,20 @@ static int exact_lock(dev_t devt, void *data)
>  	return 0;
>  }
>  
> +static void disk_alloc_badblocks(struct gendisk *disk)
> +{
> +	disk->bb = kzalloc(sizeof(*(disk->bb)), GFP_KERNEL);
> +	if (!disk->bb) {
> +		pr_warn("%s: failed to allocate space for badblocks\n",
> +			disk->disk_name);
> +		return;
> +	}
> +
> +	if (badblocks_init(disk->bb, 1))
> +		pr_warn("%s: failed to initialize badblocks\n",
> +			disk->disk_name);
> +}
> +
>  static void register_disk(struct gendisk *disk)
>  {
>  	struct device *ddev = disk_to_dev(disk);
> @@ -609,6 +624,7 @@ void add_disk(struct gendisk *disk)
>  	disk->first_minor = MINOR(devt);
>  
>  	disk_alloc_events(disk);
> +	disk_alloc_badblocks(disk);

Why unconditionally do this?  No-one currently uses the interface, but
every disk will now pay the price of an additional structure plus a page
for no benefit.  You should probably either export the initializer for
those who want to use it or, perhaps even better, make it lazily
allocated the first time anyone tries to set a bad block.

If you come up with a really good reason for allocating it
unconditionally, then it should probably be an embedded structure in the
gendisk.

James



  reply	other threads:[~2015-12-04 23:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 18:43 [PATCH v2 0/3] Badblock tracking for gendisks Vishal Verma
2015-11-25 18:43 ` [PATCH v2 1/3] badblocks: Add core badblock management code Vishal Verma
2015-12-04 23:30   ` James Bottomley
2015-12-04 23:58     ` Verma, Vishal L
2015-12-05  0:06       ` James Bottomley
2015-12-05  0:11         ` Verma, Vishal L
2015-12-08 21:03       ` NeilBrown
2015-12-08 21:08         ` Verma, Vishal L
2015-12-08 21:18           ` Dan Williams
2015-12-08 23:47             ` Verma, Vishal L
2015-12-22  5:34       ` NeilBrown
2015-12-22 22:13         ` Verma, Vishal L
2015-12-22 23:06           ` NeilBrown
2015-12-23  0:38             ` Verma, Vishal L
2015-11-25 18:43 ` [PATCH v2 2/3] block: Add badblock management for gendisks Vishal Verma
2015-12-04 23:33   ` James Bottomley [this message]
2015-12-05  0:17     ` Verma, Vishal L
2015-11-25 18:43 ` [PATCH v2 3/3] md: convert to use the generic badblocks code Vishal Verma
2015-12-01 18:55   ` Shaohua Li
2015-12-01 19:52     ` Verma, Vishal L
2015-12-04 22:53 ` [PATCH v2 0/3] Badblock tracking for gendisks Verma, Vishal L
2015-12-08  2:52 Vishal Verma
2015-12-08  2:52 ` [PATCH v2 2/3] block: Add badblock management " Vishal Verma

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=1449272018.27077.29.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=axboe@fb.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=neilb@suse.com \
    --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 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.