From: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
To: Christophe Lombard <clombard@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org, vaibhav@linux.vnet.ibm.com,
andrew.donnellan@au1.ibm.com
Subject: Re: [PATCH V2] cxl: Fix memory page not handled
Date: Mon, 25 Sep 2017 14:24:18 +0200 [thread overview]
Message-ID: <5fce0f8f-745d-37d4-1bf1-1e0124583995@linux.vnet.ibm.com> (raw)
In-Reply-To: <1506329896-2417-1-git-send-email-clombard@linux.vnet.ibm.com>
Le 25/09/2017 à 10:58, Christophe Lombard a écrit :
> The in-kernel 'library' API can be called by drivers to help
> interaction with an IBM XSL on a POWER9 system.
>
> The cxllib_handle_fault() API is used to handle memory fault. All memory
> pages of the specified buffer have to be handled but under certain
> conditions,the last page may not be touched, and the address the
> adapter is trying to access is never sent to the kernel for resolution.
>
> This patch reworks start address of the loop with an address aligned on
> the page size. In this context, the last page is not missed.
>
> Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
>
> Fixes: 3ced8d730063 ("cxl: Export library to support IBM XSL");
>
> ---
Thanks,
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Changelog[v2]
> - Rebase to latest upstream.
> - Change the start address of the loop.
> - Rewrite the commit message.
> ---
> drivers/misc/cxl/cxllib.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/cxl/cxllib.c b/drivers/misc/cxl/cxllib.c
> index 5dba23c..ff7492d 100644
> --- a/drivers/misc/cxl/cxllib.c
> +++ b/drivers/misc/cxl/cxllib.c
> @@ -219,8 +219,17 @@ int cxllib_handle_fault(struct mm_struct *mm, u64 addr, u64 size, u64 flags)
>
> down_read(&mm->mmap_sem);
>
> - for (dar = addr; dar < addr + size; dar += page_size) {
> - if (!vma || dar < vma->vm_start || dar > vma->vm_end) {
> + vma = find_vma(mm, addr);
> + if (!vma) {
> + pr_err("Can't find vma for addr %016llx\n", addr);
> + rc = -EFAULT;
> + goto out;
> + }
> + /* get the size of the pages allocated */
> + page_size = vma_kernel_pagesize(vma);
> +
> + for (dar = (addr & ~(page_size - 1)); dar < (addr + size); dar += page_size) {
> + if (dar < vma->vm_start || dar > vma->vm_end) {
> vma = find_vma(mm, addr);
> if (!vma) {
> pr_err("Can't find vma for addr %016llx\n", addr);
>
next prev parent reply other threads:[~2017-09-25 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-25 8:58 [PATCH V2] cxl: Fix memory page not handled Christophe Lombard
2017-09-25 12:24 ` Frederic Barrat [this message]
2017-09-26 1:20 ` Andrew Donnellan
2017-09-26 1:44 ` Vaibhav Jain
2017-09-26 2:00 ` Andrew Donnellan
2017-09-26 8:15 ` christophe lombard
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=5fce0f8f-745d-37d4-1bf1-1e0124583995@linux.vnet.ibm.com \
--to=fbarrat@linux.vnet.ibm.com \
--cc=andrew.donnellan@au1.ibm.com \
--cc=clombard@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=vaibhav@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).