From: Igor Konopko <igor.j.konopko@intel.com>
To: "Javier González" <javier@javigon.com>
Cc: "Matias Bjørling" <mb@lightnvm.io>,
"Hans Holmberg" <hans.holmberg@cnexlabs.com>,
linux-block@vger.kernel.org
Subject: Re: [PATCH 10/18] lightnvm: pblk: ensure that emeta is written
Date: Thu, 21 Mar 2019 14:34:42 +0100 [thread overview]
Message-ID: <c9c5bcf0-314a-9d00-6aa7-14df39ea86e6@intel.com> (raw)
In-Reply-To: <23A8B9B8-21F8-4A8D-BBEE-EC4286AB4B13@javigon.com>
On 18.03.2019 19:26, Javier González wrote:
>> On 18 Mar 2019, at 14.02, Igor Konopko <igor.j.konopko@intel.com> wrote:
>>
>>
>>
>> On 17.03.2019 20:44, Matias Bjørling wrote:
>>> On 3/14/19 9:04 AM, Igor Konopko wrote:
>>>> When we are trying to switch to the new line, we need to ensure that
>>>> emeta for n-2 line is already written. In other case we can end with
>>>> deadlock scenario, when the writer has no more requests to write and
>>>> thus there is no way to trigger emeta writes from writer thread. This
>>>> is a corner case scenario which occurs in a case of multiple writes
>>>> error and thus kind of early line close due to lack of line space.
>>>>
>>>> Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
>>>> ---
>>>> drivers/lightnvm/pblk-core.c | 2 ++
>>>> drivers/lightnvm/pblk-write.c | 24 ++++++++++++++++++++++++
>>>> drivers/lightnvm/pblk.h | 1 +
>>>> 3 files changed, 27 insertions(+)
>>>>
>>>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>>>> index 38e26fe..a683d1f 100644
>>>> --- a/drivers/lightnvm/pblk-core.c
>>>> +++ b/drivers/lightnvm/pblk-core.c
>>>> @@ -1001,6 +1001,7 @@ static void pblk_line_setup_metadata(struct pblk_line *line,
>>>> struct pblk_line_mgmt *l_mg,
>>>> struct pblk_line_meta *lm)
>>>> {
>>>> + struct pblk *pblk = container_of(l_mg, struct pblk, l_mg);
>>>> int meta_line;
>>>> lockdep_assert_held(&l_mg->free_lock);
>>>> @@ -1009,6 +1010,7 @@ static void pblk_line_setup_metadata(struct pblk_line *line,
>>>> meta_line = find_first_zero_bit(&l_mg->meta_bitmap, PBLK_DATA_LINES);
>>>> if (meta_line == PBLK_DATA_LINES) {
>>>> spin_unlock(&l_mg->free_lock);
>>>> + pblk_write_emeta_force(pblk);
>>>> io_schedule();
>>>> spin_lock(&l_mg->free_lock);
>>>> goto retry_meta;
>>>> diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c
>>>> index 4e63f9b..4fbb9b2 100644
>>>> --- a/drivers/lightnvm/pblk-write.c
>>>> +++ b/drivers/lightnvm/pblk-write.c
>>>> @@ -505,6 +505,30 @@ static struct pblk_line *pblk_should_submit_meta_io(struct pblk *pblk,
>>>> return meta_line;
>>>> }
>>>> +void pblk_write_emeta_force(struct pblk *pblk)
>>>> +{
>>>> + struct pblk_line_meta *lm = &pblk->lm;
>>>> + struct pblk_line_mgmt *l_mg = &pblk->l_mg;
>>>> + struct pblk_line *meta_line;
>>>> +
>>>> + while (true) {
>>>> + spin_lock(&l_mg->close_lock);
>>>> + if (list_empty(&l_mg->emeta_list)) {
>>>> + spin_unlock(&l_mg->close_lock);
>>>> + break;
>>>> + }
>>>> + meta_line = list_first_entry(&l_mg->emeta_list,
>>>> + struct pblk_line, list);
>>>> + if (meta_line->emeta->mem >= lm->emeta_len[0]) {
>>>> + spin_unlock(&l_mg->close_lock);
>>>> + io_schedule();
>>>> + continue;
>>>> + }
>>>> + spin_unlock(&l_mg->close_lock);
>>>> + pblk_submit_meta_io(pblk, meta_line);
>>>> + }
>>>> +}
>>>> +
>>>> static int pblk_submit_io_set(struct pblk *pblk, struct nvm_rq *rqd)
>>>> {
>>>> struct ppa_addr erase_ppa;
>>>> diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
>>>> index 0a85990..a42bbfb 100644
>>>> --- a/drivers/lightnvm/pblk.h
>>>> +++ b/drivers/lightnvm/pblk.h
>>>> @@ -877,6 +877,7 @@ int pblk_write_ts(void *data);
>>>> void pblk_write_timer_fn(struct timer_list *t);
>>>> void pblk_write_should_kick(struct pblk *pblk);
>>>> void pblk_write_kick(struct pblk *pblk);
>>>> +void pblk_write_emeta_force(struct pblk *pblk);
>>>> /*
>>>> * pblk read path
>>> Hi Igor,
>>> Is this an error that qemu can force pblk to expose? Can you provide a specific example on what is needed to force the error?
>>
>> So I hit this error on PBLKs with low number of LUNs and multiple
>> write IO errors (should be reproducible with error injection). Then
>> pblk_map_remaining() quickly mapped all the sectors in line and thus
>> writer thread was not able to issue all the necessary emeta IO writes,
>> so it stucks when trying to replace line to new one. So this is
>> definitely an error/corner case scenario.
>
> If the cause if emeta writes, then there is a bug in
> pblk_line_close_meta(), as the logic to prevent this case is in place.
>
So I definitely saw this functions to be called few times in corner
series scenarios, but I will drop this patch for now and I'll try to
find out what is the reason of such a behavior, since this patch more
looks like a workaround that a real fix for me now after the discussion.
Thanks
Igor
next prev parent reply other threads:[~2019-03-21 13:34 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 16:04 [PATCH 00/18] lightnvm: next set of improvements for 5.2 Igor Konopko
2019-03-14 16:04 ` [PATCH 01/18] lightnvm: pblk: fix warning in pblk_l2p_init() Igor Konopko
2019-03-16 22:29 ` Javier González
2019-03-18 16:25 ` Matias Bjørling
2019-03-14 16:04 ` [PATCH 02/18] lightnvm: pblk: warn when there are opened chunks Igor Konopko
2019-03-16 22:36 ` Javier González
2019-03-17 19:39 ` Matias Bjørling
2019-03-14 16:04 ` [PATCH 03/18] lightnvm: pblk: simplify partial read path Igor Konopko
2019-03-14 21:35 ` Heiner Litz
2019-03-15 9:52 ` Igor Konopko
2019-03-16 22:28 ` Javier González
2019-03-18 12:44 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 04/18] lightnvm: pblk: OOB recovery for closed chunks fix Igor Konopko
2019-03-16 22:43 ` Javier González
2019-03-17 19:24 ` Matias Bjørling
2019-03-18 12:50 ` Igor Konopko
2019-03-18 19:25 ` Javier González
2019-03-14 16:04 ` [PATCH 05/18] lightnvm: pblk: propagate errors when reading meta Igor Konopko
2019-03-16 22:48 ` Javier González
2019-03-18 11:54 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 06/18] lightnvm: pblk: recover only written metadata Igor Konopko
2019-03-16 23:46 ` Javier González
2019-03-18 12:54 ` Igor Konopko
2019-03-18 15:04 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 07/18] lightnvm: pblk: wait for inflight IOs in recovery Igor Konopko
2019-03-17 19:33 ` Matias Bjørling
2019-03-18 12:58 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 08/18] lightnvm: pblk: fix spin_unlock order Igor Konopko
2019-03-16 23:49 ` Javier González
2019-03-18 11:55 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 09/18] lightnvm: pblk: kick writer on write recovery path Igor Konopko
2019-03-16 23:54 ` Javier González
2019-03-18 11:58 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 10/18] lightnvm: pblk: ensure that emeta is written Igor Konopko
2019-03-17 19:44 ` Matias Bjørling
2019-03-18 13:02 ` Igor Konopko
2019-03-18 18:26 ` Javier González
2019-03-21 13:34 ` Igor Konopko [this message]
2019-03-18 7:46 ` Javier González
2019-03-14 16:04 ` [PATCH 11/18] lightnvm: pblk: fix update line wp in OOB recovery Igor Konopko
2019-03-18 6:56 ` Javier González
2019-03-18 13:06 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 12/18] lightnvm: pblk: do not read OOB from emeta region Igor Konopko
2019-03-17 19:56 ` Matias Bjørling
2019-03-18 13:05 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 13/18] lightnvm: pblk: store multiple copies of smeta Igor Konopko
2019-03-18 7:33 ` Javier González
2019-03-18 13:12 ` Igor Konopko
2019-03-14 16:04 ` [PATCH 14/18] lightnvm: pblk: GC error handling Igor Konopko
2019-03-18 7:39 ` Javier González
2019-03-18 12:14 ` Hans Holmberg
2019-03-18 13:22 ` Igor Konopko
2019-03-18 14:14 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 15/18] lightnvm: pblk: fix in case of lack of lines Igor Konopko
2019-03-18 7:42 ` Javier González
2019-03-18 13:28 ` Igor Konopko
2019-03-18 19:21 ` Javier González
2019-03-21 13:21 ` Igor Konopko
2019-03-22 12:17 ` Hans Holmberg
2019-03-14 16:04 ` [PATCH 16/18] lightnvm: pblk: use nvm_rq_to_ppa_list() Igor Konopko
2019-03-18 7:48 ` Javier González
2019-03-14 16:04 ` [PATCH 17/18] lightnvm: allow to use full device path Igor Konopko
2019-03-18 7:49 ` Javier González
2019-03-18 10:28 ` Hans Holmberg
2019-03-18 13:18 ` Igor Konopko
2019-03-18 14:41 ` Hans Holmberg
2019-03-21 13:18 ` Igor Konopko
2019-03-25 11:40 ` Matias Bjørling
2019-03-14 16:04 ` [PATCH 18/18] lightnvm: track inflight target creations Igor Konopko
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=c9c5bcf0-314a-9d00-6aa7-14df39ea86e6@intel.com \
--to=igor.j.konopko@intel.com \
--cc=hans.holmberg@cnexlabs.com \
--cc=javier@javigon.com \
--cc=linux-block@vger.kernel.org \
--cc=mb@lightnvm.io \
/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;
as well as URLs for NNTP newsgroup(s).