From: labbott@redhat.com (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] staging: ion: make the pte default none PTE_RDONLY
Date: Fri, 15 Jan 2016 15:03:42 -0800 [thread overview]
Message-ID: <56997ACE.80604@redhat.com> (raw)
In-Reply-To: <1452825753-36364-1-git-send-email-puck.chen@hisilicon.com>
(adding linux-arm and a few people)
On 01/14/2016 06:42 PM, Chen Feng wrote:
> The page is already alloc at ion_alloc function,
> ion_mmap map the alloced pages to user-space.
>
> The default prot can be PTE_RDONLY. Take a look at
> here:
> set_pte_at()
> arch/arm64/include/asm:
> if (pte_dirty(pte) && pte_write(pte))
> pte_val(pte) &= ~PTE_RDONLY;
> else
> pte_val(pte) |= PTE_RDONLY;
>
> So with the dirty bit,it can improve the efficiency
> and donnot need to handle memory fault when use access.
>
> Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
> Signed-off-by: Wei Dong <weidong2@hisilicon.com>
> Reviewed-by: Zhuangluan Su <suzhuangluan@hisilicon.com>
> ---
> drivers/staging/android/ion/ion.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index e237e9f..dba5942 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -1026,6 +1026,9 @@ static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
> if (!(buffer->flags & ION_FLAG_CACHED))
> vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
>
> + /*Default writeable*/
> + vma->vm_page_prot = pte_mkdirty(vma->vm_page_prot);
> +
> mutex_lock(&buffer->lock);
> /* now map it to userspace */
> ret = buffer->heap->ops->map_user(buffer->heap, buffer, vma);
>
The extra fault is unfortunate but I'm skeptical about just setting
pte_mkdirty.
Catalin/Will, do you have any thoughts? Right now it seems like any
range mapped with remap_pfn_range will have this extra fault
behavior. Is marking the range dirty the best solution?
Thanks,
Laura
WARNING: multiple messages have this Message-ID (diff)
From: Laura Abbott <labbott@redhat.com>
To: Chen Feng <puck.chen@hisilicon.com>,
gregkh@linuxfoundation.org, arve@android.com,
riandrews@android.com, paul.gortmaker@windriver.com,
gioh.kim@lge.com, tranmanphong@gmail.com,
mitchelh@codeaurora.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, yudongbin@hisilicon.com,
saberlily.xia@hisilicon.com, suzhuangluan@hisilicon.com,
kong.kongxinwei@hisilicon.com, xuyiping@hisilicon.com,
z.liuxinliang@hisilicon.com, weidong2@hisilicon.com,
w.f@huawei.com, puck.chen@foxmail.com, shimingxing@hisilicon.com,
oliver.fu@hisilicon.com, albert.lubing@hisilicon.com,
chenxiang9@huawei.com, liuzixing@huawei.com,
haojian.zhuang@linaro.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Cc: qijiwen@hisilicon.com, peter.panshilin@hisilicon.com,
dan.zhao@hisilicon.com, linuxarm@huawei.com,
dev@lists.96boards.org,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] staging: ion: make the pte default none PTE_RDONLY
Date: Fri, 15 Jan 2016 15:03:42 -0800 [thread overview]
Message-ID: <56997ACE.80604@redhat.com> (raw)
In-Reply-To: <1452825753-36364-1-git-send-email-puck.chen@hisilicon.com>
(adding linux-arm and a few people)
On 01/14/2016 06:42 PM, Chen Feng wrote:
> The page is already alloc at ion_alloc function,
> ion_mmap map the alloced pages to user-space.
>
> The default prot can be PTE_RDONLY. Take a look at
> here:
> set_pte_at()
> arch/arm64/include/asm:
> if (pte_dirty(pte) && pte_write(pte))
> pte_val(pte) &= ~PTE_RDONLY;
> else
> pte_val(pte) |= PTE_RDONLY;
>
> So with the dirty bit,it can improve the efficiency
> and donnot need to handle memory fault when use access.
>
> Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
> Signed-off-by: Wei Dong <weidong2@hisilicon.com>
> Reviewed-by: Zhuangluan Su <suzhuangluan@hisilicon.com>
> ---
> drivers/staging/android/ion/ion.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index e237e9f..dba5942 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -1026,6 +1026,9 @@ static int ion_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
> if (!(buffer->flags & ION_FLAG_CACHED))
> vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
>
> + /*Default writeable*/
> + vma->vm_page_prot = pte_mkdirty(vma->vm_page_prot);
> +
> mutex_lock(&buffer->lock);
> /* now map it to userspace */
> ret = buffer->heap->ops->map_user(buffer->heap, buffer, vma);
>
The extra fault is unfortunate but I'm skeptical about just setting
pte_mkdirty.
Catalin/Will, do you have any thoughts? Right now it seems like any
range mapped with remap_pfn_range will have this extra fault
behavior. Is marking the range dirty the best solution?
Thanks,
Laura
next prev parent reply other threads:[~2016-01-15 23:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 2:42 [PATCH] staging: ion: make the pte default none PTE_RDONLY Chen Feng
2016-01-15 2:58 ` kbuild test robot
2016-01-15 3:10 ` kbuild test robot
2016-01-15 23:03 ` Laura Abbott [this message]
2016-01-15 23:03 ` Laura Abbott
2016-01-15 23:23 ` Russell King - ARM Linux
2016-01-15 23:23 ` Russell King - ARM Linux
2016-01-18 3:44 ` chenfeng
2016-01-18 3:44 ` chenfeng
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=56997ACE.80604@redhat.com \
--to=labbott@redhat.com \
--cc=linux-arm-kernel@lists.infradead.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 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.