All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>
Cc: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH v2 5/6] libnvdimm, btt: rework error clearing
Date: Mon, 17 Jul 2017 22:20:56 +0000	[thread overview]
Message-ID: <1500329958.6401.56.camel@intel.com> (raw)
In-Reply-To: <CAPcyv4jcy1VN4O9fSy-mDgnxYtWWiVOqDaGqbqFYt7_5TX=hsw@mail.gmail.com>

On Mon, 2017-07-17 at 15:00 -0700, Dan Williams wrote:
> On Mon, Jul 17, 2017 at 2:27 PM, Vishal Verma <vishal.l.verma@intel.co
> m> wrote:
> > Clearing errors or badblocks during a BTT write requires sending an
> > ACPI
> > DSM, which means potentially sleeping. Since a BTT IO happens in
> > atomic
> > context (preemption disabled, spinlocks may be held), we cannot
> > perform
> > error clearing in the course of an IO. Due to this error clearing
> > for
> > BTT IOs has hitherto been disabled.
> > 
> > In this patch we move error clearing out of the atomic section, and
> > thus
> > re-enable error clearing with BTTs. When we are about to add a block
> > to
> > the free list, we check if it was previously marked as an error, and
> > if
> > it was, we add it to the freelist, but also set a flag that says
> > error
> > clearing will be required. We then drop the lane (ending the atomic
> > context), and send a zero buffer so that the error can be cleared.
> > The
> > error flag in the free list is protected by the nd 'lane', and is
> > set
> > only be a thread while it holds that lane. When the error is
> > cleared,
> > the flag is cleared, but while holding a mutex for that freelist
> > index.
> > 
> > When writing, we check for two things -
> > 1/ If the freelist mutex is held or if the error flag is set. If so,
> > this is an error block that is being (or about to be) cleared.
> > 2/ If the block is a known badblock based on nsio->bb
> > 
> > The second check is required because the BTT map error flag for a
> > map
> > entry only gets set when an error LBA is read. If we write to a new
> > location that may not have the map error flag set, but still might
> > be in
> > the region's badblock list, we can trigger an EIO on the write,
> > which is
> > undesirable and completely avoidable.
> > 
> > Cc: Jeff Moyer <jmoyer@redhat.com>
> > Cc: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> >  drivers/nvdimm/btt.c   | 89
> > +++++++++++++++++++++++++++++++++++++++++++++-----
> >  drivers/nvdimm/btt.h   |  5 +++
> >  drivers/nvdimm/claim.c |  8 -----
> >  3 files changed, 85 insertions(+), 17 deletions(-)
> > 

<>

> > +static int arena_clear_freelist_error(struct arena_info *arena, u32
> > lane)
> > +{
> > +       int ret = 0;
> > +
> > +       if (arena->freelist[lane].has_err) {
> > +               u32 lba = arena->freelist[lane].block;
> > +               u64 nsoff = to_namespace_offset(arena, lba);
> > +               void *zerobuf;
> > +
> > +               zerobuf = kzalloc(arena->sector_size, GFP_KERNEL);
> > +               if (!zerobuf)
> > +                       return -ENOMEM;
> 
> Hmm, can this just use the system zero page (empty_zero_page)? Also,
> even if it can't, I'd prefer the NOIO fix for this case be folded into
> this patch. The NOIO fixup for the acpi dsm path should be separate.
> 
> Another consideration if we can't use the system zero page, do we need
> to allocate this on demand? Seems like something we could just
> pre-allocate at init time.

I had started out using the empty_zero_page, but to use that you have to
kmap_atomic the page, which ends up creating an atomic section again :)

Sounds good on preallocating a zero page at init.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-07-17 22:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 21:27 [PATCH v2 0/6] BTT error clearing rework Vishal Verma
2017-07-17 21:27 ` [PATCH v2 1/6] btt: fix a missed NVDIMM_IO_ATOMIC case in the write path Vishal Verma
2017-07-17 21:27 ` [PATCH v2 2/6] btt: refactor map entry operations with macros Vishal Verma
2017-07-17 21:27 ` [PATCH v2 3/6] btt: ensure that flags were also unchanged during a map_read Vishal Verma
2017-07-17 21:27 ` [PATCH v2 4/6] btt: cache sector_size in arena_info Vishal Verma
2017-07-17 21:27 ` [PATCH v2 5/6] libnvdimm, btt: rework error clearing Vishal Verma
2017-07-17 22:00   ` Dan Williams
2017-07-17 22:20     ` Verma, Vishal L [this message]
2017-07-17 22:32       ` Dan Williams
2017-07-17 21:27 ` [PATCH v2 6/6] pmem, btt: fix potential deadlock while clearing errors Vishal Verma
2017-07-17 21:27   ` 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=1500329958.6401.56.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=rafael.j.wysocki@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.