mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: javier@cnexlabs.com
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] lightnvm: encapsule rqd dma allocations
Date: Wed, 29 Aug 2018 15:42:57 +0200	[thread overview]
Message-ID: <c6414a97-607d-2bd8-c575-4c54e5ee84e1@lightnvm.io> (raw)
In-Reply-To: <1CF9AE13-2C0C-426C-8B62-E0B111EDEB5E@cnexlabs.com>

On 08/29/2018 03:41 PM, Javier Gonzalez wrote:
> 
>> On 29 Aug 2018, at 15.36, Matias Bjørling <mb@lightnvm.io> wrote:
>>
>> On 08/29/2018 03:18 PM, Javier Gonzalez wrote:
>>>> On 29 Aug 2018, at 15.00, Matias Bjørling <mb@lightnvm.io> wrote:
>>>>
>>>> On 08/29/2018 10:56 AM, Javier González wrote:
>>>>> dma allocations for ppa_list and meta_list in rqd are replicated in
>>>>> several places across the pblk codebase. Make helpers to encapsulate
>>>>> creation and deletion to simplify the code.
>>>>> Signed-off-by: Javier González <javier@cnexlabs.com>
>>>>> ---
>>>>>   drivers/lightnvm/pblk-core.c     | 69 +++++++++++++++++++++++++---------------
>>>>>   drivers/lightnvm/pblk-read.c     | 35 ++++++++++----------
>>>>>   drivers/lightnvm/pblk-recovery.c | 29 ++++++-----------
>>>>>   drivers/lightnvm/pblk-write.c    | 15 ++-------
>>>>>   drivers/lightnvm/pblk.h          |  3 ++
>>>>>   5 files changed, 74 insertions(+), 77 deletions(-)
>>>>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>>>>> index 09160ec02c5f..767178185f19 100644
>>>>> --- a/drivers/lightnvm/pblk-core.c
>>>>> +++ b/drivers/lightnvm/pblk-core.c
>>>>> @@ -237,6 +237,34 @@ static void pblk_invalidate_range(struct pblk *pblk, sector_t slba,
>>>>>   	spin_unlock(&pblk->trans_lock);
>>>>>   }
>>>>>   +int pblk_setup_rqd(struct pblk *pblk, struct nvm_rq *rqd, gfp_t mem_flags,
>>>>> +		   bool is_vector)
>>>>
>>>>
>>>> The mem_flags argument can be removed. It is GFP_KERNEL from all the
>>>> places it is called.
>>> Thought it was better to have the flexibility in a helper function, but
>>> we can always add it later on if needed...
>>>> is_vector, will be better to do nr_ppas (or similar name). Then
>>>> pblk_submit_read/pblk_submit_read_gc are a bit cleaner.
>>> We can do that too, yes.
>>>>> +{
>>>>> +	struct nvm_tgt_dev *dev = pblk->dev;
>>>>> +
>>>>> +	rqd->meta_list = nvm_dev_dma_alloc(dev->parent, mem_flags,
>>>>> +							&rqd->dma_meta_list);
>>>>> +	if (!rqd->meta_list)
>>>>> +		return -ENOMEM;
>>>>> +
>>>>> +	if (!is_vector)
>>>>> +		return 0;
>>>>> +
>>>>> +	rqd->ppa_list = rqd->meta_list + pblk_dma_meta_size;
>>>>> +	rqd->dma_ppa_list = rqd->dma_meta_list + pblk_dma_meta_size;
>>>>
>>>> Wrt to is_vector, does it matter if we just set ppa_list and
>>>> dma_ppa_list? If we have them, we use them, else leave them alone?
>>> If we only have 1 address then ppa_addr is set and the ppa_list attempt
>>> to free in the completion path interpreting ppa_addr as the dma address.
>>> So I don't think so - unless I'm missing something?
>>
>> In that case, we could drop is_vector/nr_ppas all together? That would be nice.
>>
> 
> The problem is that the metadata region still needs to be used, even if
> the ppa_list is not set. Thing that the oob area can be larger than
> 64bits, so we cannot do the dma address is the actual value trick.
> 
> So if encapsulating, we need to know if we need to allocate the ppa_list
> or not.
> 
> Does it make sense?

Cool. We'll just leave it as is.

  reply	other threads:[~2018-08-29 13:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  8:56 [V4 PATCH 0/2] lightnvm: pblk: take write semaphore on metadata Javier González
2018-08-29  8:56 ` [PATCH 1/3] lightnvm: pblk: refactor metadata paths Javier González
2018-08-29 13:02   ` Matias Bjørling
2018-08-29 13:19     ` Javier Gonzalez
2018-08-29  8:56 ` [PATCH 2/3] lightnvm: encapsule rqd dma allocations Javier González
2018-08-29 13:00   ` Matias Bjørling
2018-08-29 13:18     ` Javier Gonzalez
2018-08-29 13:36       ` Matias Bjørling
2018-08-29 13:41         ` Javier Gonzalez
2018-08-29 13:42           ` Matias Bjørling [this message]
2018-08-29  8:56 ` [PATCH 3/3] lightnvm: pblk: take write semaphore on metadata Javier González
2018-08-29 13:08   ` Matias Bjørling
2018-08-29 13:21     ` Javier Gonzalez
2018-08-29 13:40       ` Matias Bjørling
2018-08-29 13:41         ` Javier Gonzalez

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=c6414a97-607d-2bd8-c575-4c54e5ee84e1@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=axboe@kernel.dk \
    --cc=javier@cnexlabs.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®