From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: gnurou@gmail.com, Thomas Hellstrom <thellstrom@vmware.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ttm: dma: Don't crash on memory in the vmalloc range
Date: Mon, 1 Jun 2015 13:28:15 -0400 [thread overview]
Message-ID: <20150601172815.GC13347@x230> (raw)
In-Reply-To: <555B1FA7.1080306@nvidia.com>
On Tue, May 19, 2015 at 08:33:59PM +0900, Alexandre Courbot wrote:
> On 05/16/2015 04:55 AM, Konrad Rzeszutek Wilk wrote:
> >On Fri, May 15, 2015 at 04:09:54PM +0900, Alexandre Courbot wrote:
> >>dma_alloc_coherent() can return memory in the vmalloc range.
> >>virt_to_page() cannot handle such addresses and crashes. This
> >>patch detects such cases and obtains the struct page * using
> >>vmalloc_to_page() instead.
> >>
> >>Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> >>---
> >>This patch is a follow-up of the following discussion:
> >>
> >>https://www.marc.info/?l=dri-devel&m=141579595431254&w=3
> >>
> >>It works for me on both 32-bit and 64-bit Tegra, so I am not convinced
> >>that Thierry's initial change from virt_to_page() to phys_to_page() is
> >>still required - Thierry, can you confirm whether your patch is still
> >>relevant after this one?
> >>
> >> drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 9 ++++++---
> >> 1 file changed, 6 insertions(+), 3 deletions(-)
> >>
> >>diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> >>index 01e1d27eb078..3077f1554099 100644
> >>--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> >>+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> >>@@ -342,9 +342,12 @@ static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool)
> >> d_page->vaddr = dma_alloc_coherent(pool->dev, pool->size,
> >> &d_page->dma,
> >> pool->gfp_flags);
> >>- if (d_page->vaddr)
> >>- d_page->p = virt_to_page(d_page->vaddr);
> >>- else {
> >>+ if (d_page->vaddr) {
> >>+ if (is_vmalloc_addr(d_page->vaddr))
> >>+ d_page->p = vmalloc_to_page(d_page->vaddr);
> >>+ else
> >>+ d_page->p = virt_to_page(d_page->vaddr);
> >>+ } else {
> >
> >
> >Looks OK to me.
>
> Thanks guys. Could we translate these approvals into Acked-bys/Reviewed-bys
> so Dave (?) can merge this patch?
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
David Airlie <airlied@linux.ie>,
Thomas Hellstrom <thellstrom@vmware.com>,
Arnd Bergmann <arnd@arndb.de>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
gnurou@gmail.com
Subject: Re: [PATCH] drm/ttm: dma: Don't crash on memory in the vmalloc range
Date: Mon, 1 Jun 2015 13:28:15 -0400 [thread overview]
Message-ID: <20150601172815.GC13347@x230> (raw)
In-Reply-To: <555B1FA7.1080306@nvidia.com>
On Tue, May 19, 2015 at 08:33:59PM +0900, Alexandre Courbot wrote:
> On 05/16/2015 04:55 AM, Konrad Rzeszutek Wilk wrote:
> >On Fri, May 15, 2015 at 04:09:54PM +0900, Alexandre Courbot wrote:
> >>dma_alloc_coherent() can return memory in the vmalloc range.
> >>virt_to_page() cannot handle such addresses and crashes. This
> >>patch detects such cases and obtains the struct page * using
> >>vmalloc_to_page() instead.
> >>
> >>Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> >>---
> >>This patch is a follow-up of the following discussion:
> >>
> >>https://www.marc.info/?l=dri-devel&m=141579595431254&w=3
> >>
> >>It works for me on both 32-bit and 64-bit Tegra, so I am not convinced
> >>that Thierry's initial change from virt_to_page() to phys_to_page() is
> >>still required - Thierry, can you confirm whether your patch is still
> >>relevant after this one?
> >>
> >> drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 9 ++++++---
> >> 1 file changed, 6 insertions(+), 3 deletions(-)
> >>
> >>diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> >>index 01e1d27eb078..3077f1554099 100644
> >>--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> >>+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> >>@@ -342,9 +342,12 @@ static struct dma_page *__ttm_dma_alloc_page(struct dma_pool *pool)
> >> d_page->vaddr = dma_alloc_coherent(pool->dev, pool->size,
> >> &d_page->dma,
> >> pool->gfp_flags);
> >>- if (d_page->vaddr)
> >>- d_page->p = virt_to_page(d_page->vaddr);
> >>- else {
> >>+ if (d_page->vaddr) {
> >>+ if (is_vmalloc_addr(d_page->vaddr))
> >>+ d_page->p = vmalloc_to_page(d_page->vaddr);
> >>+ else
> >>+ d_page->p = virt_to_page(d_page->vaddr);
> >>+ } else {
> >
> >
> >Looks OK to me.
>
> Thanks guys. Could we translate these approvals into Acked-bys/Reviewed-bys
> so Dave (?) can merge this patch?
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
next prev parent reply other threads:[~2015-06-01 17:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-15 7:09 [PATCH] drm/ttm: dma: Don't crash on memory in the vmalloc range Alexandre Courbot
2015-05-15 7:09 ` Alexandre Courbot
2015-05-15 10:48 ` Thierry Reding
2015-05-15 10:48 ` Thierry Reding
2015-05-15 12:03 ` yalin wang
2015-05-15 12:03 ` yalin wang
2015-05-15 19:55 ` Konrad Rzeszutek Wilk
2015-05-15 19:55 ` Konrad Rzeszutek Wilk
2015-05-19 11:33 ` Alexandre Courbot
2015-05-19 11:33 ` Alexandre Courbot
2015-06-01 17:28 ` Konrad Rzeszutek Wilk [this message]
2015-06-01 17:28 ` Konrad Rzeszutek Wilk
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=20150601172815.GC13347@x230 \
--to=konrad.wilk@oracle.com \
--cc=acourbot@nvidia.com \
--cc=arnd@arndb.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gnurou@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thellstrom@vmware.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.