RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-12 Thread Kanigeri, Hari
Deos any one have any comments on by-passing the get_user_pages function for 
the buffers that meets the following condition ? If not, this code will be 
merged into dspbridge tree.

if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED) &&
+ (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE) &&
+ (~pgprot_val(vma->vm_page_prot) & L_PTE_BUFFERABLE)))

Basically, the logic to get the pages would be as follows instead of calling 
get_user_pages.

static u32 user_va2pa(struct mm_struct *mm, u32 address)
{
pgd_t *pgd;
pmd_t *pmd;
pte_t *ptep, pte;

pgd = pgd_offset(mm, address);
if (!(pgd_none(*pgd) || pgd_bad(*pgd))) {
pmd = pmd_offset(pgd, address);
if (!(pmd_none(*pmd) || pmd_bad(*pmd))) {
ptep = pte_offset_map(pmd, address);
if (ptep) {
pte = *ptep;
if (pte_present(pte))
return pte & PAGE_MASK;
}
}
}

return 0;
}

Thank you,
Best regards,
Hari

> -Original Message-
> From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
> ow...@vger.kernel.org] On Behalf Of Kanigeri, Hari
> Sent: Thursday, June 11, 2009 12:24 PM
> To: Bagadia, Sripal; Hiroshi DOYU; Ramirez Luna, Omar
> Cc: felipe.contre...@gmail.com; ameya.pala...@nokia.com; Menon, Nishanth;
> linux-omap@vger.kernel.org
> Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> 
> Sripal,
> 
> > Currently, display driver maps the video buffers to userspace with
> > VM_RESERVED flag and pgprot_writecombine(). We are considering changing
> > pgprot_writecombine() to pgprot_noncached() to eliminate the need of all
> > cache maintenance overheads for video buffers.
> >
> -- Is this change in the current LO kernel ?
> 
> I agree there is an overhead of flushing the cache by calling
> get_user_pages function. But there is some additional stuff that this
> function does and I am afraid that by-passing this function call for a
> Buffer that has VM_RESERVED flag and the BUFFERABLBE flags might create
> issues.
> 
> The only reason get_user_pages is not used for the buffer that has VM_IO
> flag set is get_user_pages fails if this flag is set for the buffer. I am
> not sure if it is safe to by-pass the get_user_pages function call for
> buffer that has VM_RESERVED flag set though.
> 
> Thank you,
> Best regards,
> Hari
> 
> > -Original Message-
> > From: Bagadia, Sripal
> > Sent: Thursday, June 11, 2009 11:24 AM
> > To: Hiroshi DOYU; Ramirez Luna, Omar
> > Cc: felipe.contre...@gmail.com; ameya.pala...@nokia.com; Menon,
> Nishanth;
> > Kanigeri, Hari; linux-omap@vger.kernel.org
> > Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> >
> > > Would it be possible to tell the case/path, where
> > L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?
> >
> > Currently, display driver maps the video buffers to userspace with
> > VM_RESERVED flag and pgprot_writecombine(). We are considering changing
> > pgprot_writecombine() to pgprot_noncached() to eliminate the need of all
> > cache maintenance overheads for video buffers.
> >
> > Regarding Felipe's comment:
> > > L_PTE_BUFFERABLE is obsolete, isn't it? L_PTE_MT_BUFFERABLE should be
> > used instead.
> >
> > I was working on 2.6.27.10, and agree that this needs to be updated for
> > newer kernels.
> >
> >
> > Regards,
> > Sripal
> >
> > -----Original Message-
> > From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com]
> > Sent: Thursday, June 11, 2009 2:16 AM
> > To: Ramirez Luna, Omar
> > Cc: felipe.contre...@gmail.com; ameya.pala...@nokia.com; Menon,
> Nishanth;
> > Bagadia, Sripal; Kanigeri, Hari; linux-omap@vger.kernel.org
> > Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> >
> > From: Hiroshi DOYU 
> > Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> > Date: Wed, 10 Jun 2009 10:25:39 +0300 (EEST)
> >
> > > From: "ext Ramirez Luna, Omar" 
> > > Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> > > Date: Wed, 10 Jun 2009 01:18:29 +0200
> > >
> > > > Hi,
> > > >
> > > > [sending as plain text to l-o]
> > > >
> > > > Could you please comment on this patch.
> > > >
> > > > From: Sripal Bagadia 
> > > > Date: Tue

RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-11 Thread Kanigeri, Hari
Sripal,

> Currently, display driver maps the video buffers to userspace with
> VM_RESERVED flag and pgprot_writecombine(). We are considering changing
> pgprot_writecombine() to pgprot_noncached() to eliminate the need of all
> cache maintenance overheads for video buffers.
>
-- Is this change in the current LO kernel ?

I agree there is an overhead of flushing the cache by calling get_user_pages 
function. But there is some additional stuff that this function does and I am 
afraid that by-passing this function call for a Buffer that has VM_RESERVED 
flag and the BUFFERABLBE flags might create issues. 

The only reason get_user_pages is not used for the buffer that has VM_IO flag 
set is get_user_pages fails if this flag is set for the buffer. I am not sure 
if it is safe to by-pass the get_user_pages function call for buffer that has 
VM_RESERVED flag set though.

Thank you,
Best regards,
Hari

> -Original Message-
> From: Bagadia, Sripal
> Sent: Thursday, June 11, 2009 11:24 AM
> To: Hiroshi DOYU; Ramirez Luna, Omar
> Cc: felipe.contre...@gmail.com; ameya.pala...@nokia.com; Menon, Nishanth;
> Kanigeri, Hari; linux-omap@vger.kernel.org
> Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> 
> > Would it be possible to tell the case/path, where
> L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?
> 
> Currently, display driver maps the video buffers to userspace with
> VM_RESERVED flag and pgprot_writecombine(). We are considering changing
> pgprot_writecombine() to pgprot_noncached() to eliminate the need of all
> cache maintenance overheads for video buffers.
> 
> Regarding Felipe's comment:
> > L_PTE_BUFFERABLE is obsolete, isn't it? L_PTE_MT_BUFFERABLE should be
> used instead.
> 
> I was working on 2.6.27.10, and agree that this needs to be updated for
> newer kernels.
> 
> 
> Regards,
> Sripal
> 
> -Original Message-
> From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com]
> Sent: Thursday, June 11, 2009 2:16 AM
> To: Ramirez Luna, Omar
> Cc: felipe.contre...@gmail.com; ameya.pala...@nokia.com; Menon, Nishanth;
> Bagadia, Sripal; Kanigeri, Hari; linux-omap@vger.kernel.org
> Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> 
> From: Hiroshi DOYU 
> Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> Date: Wed, 10 Jun 2009 10:25:39 +0300 (EEST)
> 
> > From: "ext Ramirez Luna, Omar" 
> > Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> > Date: Wed, 10 Jun 2009 01:18:29 +0200
> >
> > > Hi,
> > >
> > > [sending as plain text to l-o]
> > >
> > > Could you please comment on this patch.
> > >
> > > From: Sripal Bagadia 
> > > Date: Tue, 9 Jun 2009 16:05:09 -0500
> > > Subject: [PATCH] DSPBRIDGE: Video Playback Cache Optimization
> > >
> > > Avoid get_user_pages cache flush overheads for uncached & reserved
> > > buffers (e.g. display & camera buffers).
> >
> > Would it be possible to tell the case/path, where no
> > L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?
> 
> To be correct,
>   "where L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED"
> 
> > >
> > > Signed-off-by: Sripal Bagadia 
> > > ---
> > >  drivers/dsp/bridge/wmd/tiomap3430.c |    4 +++-
> > >  1 files changed, 3 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c
> > > b/drivers/dsp/bridge/wmd/tiomap3430.c
> > > index 7a9603d..a2f32e8 100644
> > > --- a/drivers/dsp/bridge/wmd/tiomap3430.c
> > > +++ b/drivers/dsp/bridge/wmd/tiomap3430.c
> > > @@ -1461,7 +1461,9 @@ static DSP_STATUS WMD_BRD_MemMap(struct
> > > WMD_DEV_CONTEXT *hDevContext,
> > >     goto func_cont;
> > >   }
> > >
> > > - if (vma->vm_flags & VM_IO) {
> > > + if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED)
> > > +&&
> > > + (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE)
> > > +&&
> > > + (~pgprot_val(vma->vm_page_prot) &
> > > +L_PTE_BUFFERABLE))) {
> > >     numUsrPgs =  ulNumBytes / PG_SIZE_4K;
> > >     mpuAddr = ulMpuAddr;
> > >     DBG_Trace(DBG_LEVEL4,
> "WMD_BRD_MemMap:numOfActualTabEntries=%d,"
> > > --
> > > 1.6.2.4
> > >

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-11 Thread Bagadia, Sripal
> Would it be possible to tell the case/path, where 
> L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?

Currently, display driver maps the video buffers to userspace with VM_RESERVED 
flag and pgprot_writecombine(). We are considering changing 
pgprot_writecombine() to pgprot_noncached() to eliminate the need of all cache 
maintenance overheads for video buffers.

Regarding Felipe's comment:
> L_PTE_BUFFERABLE is obsolete, isn't it? L_PTE_MT_BUFFERABLE should be used 
> instead. 

I was working on 2.6.27.10, and agree that this needs to be updated for newer 
kernels. 


Regards,
Sripal

-Original Message-
From: Hiroshi DOYU [mailto:hiroshi.d...@nokia.com] 
Sent: Thursday, June 11, 2009 2:16 AM
To: Ramirez Luna, Omar
Cc: felipe.contre...@gmail.com; ameya.pala...@nokia.com; Menon, Nishanth; 
Bagadia, Sripal; Kanigeri, Hari; linux-omap@vger.kernel.org
Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

From: Hiroshi DOYU 
Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
Date: Wed, 10 Jun 2009 10:25:39 +0300 (EEST)

> From: "ext Ramirez Luna, Omar" 
> Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> Date: Wed, 10 Jun 2009 01:18:29 +0200
> 
> > Hi,
> > 
> > [sending as plain text to l-o]
> > 
> > Could you please comment on this patch.
> > 
> > From: Sripal Bagadia 
> > Date: Tue, 9 Jun 2009 16:05:09 -0500
> > Subject: [PATCH] DSPBRIDGE: Video Playback Cache Optimization
> > 
> > Avoid get_user_pages cache flush overheads for uncached & reserved 
> > buffers (e.g. display & camera buffers).
> 
> Would it be possible to tell the case/path, where no 
> L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?

To be correct,
  "where L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED"

> > 
> > Signed-off-by: Sripal Bagadia 
> > ---
> >  drivers/dsp/bridge/wmd/tiomap3430.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
> > b/drivers/dsp/bridge/wmd/tiomap3430.c
> > index 7a9603d..a2f32e8 100644
> > --- a/drivers/dsp/bridge/wmd/tiomap3430.c
> > +++ b/drivers/dsp/bridge/wmd/tiomap3430.c
> > @@ -1461,7 +1461,9 @@ static DSP_STATUS WMD_BRD_MemMap(struct 
> > WMD_DEV_CONTEXT *hDevContext,
> >     goto func_cont;
> >   }
> >  
> > - if (vma->vm_flags & VM_IO) {
> > + if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED) 
> > +&&
> > + (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE) 
> > +&&
> > + (~pgprot_val(vma->vm_page_prot) & 
> > +L_PTE_BUFFERABLE))) {
> >     numUsrPgs =  ulNumBytes / PG_SIZE_4K;
> >     mpuAddr = ulMpuAddr;
> >     DBG_Trace(DBG_LEVEL4, "WMD_BRD_MemMap:numOfActualTabEntries=%d,"
> > --
> > 1.6.2.4
> > 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-11 Thread Hiroshi DOYU
From: Hiroshi DOYU 
Subject: Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
Date: Wed, 10 Jun 2009 10:25:39 +0300 (EEST)

> From: "ext Ramirez Luna, Omar" 
> Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
> Date: Wed, 10 Jun 2009 01:18:29 +0200
> 
> > Hi,
> > 
> > [sending as plain text to l-o]
> > 
> > Could you please comment on this patch.
> > 
> > From: Sripal Bagadia 
> > Date: Tue, 9 Jun 2009 16:05:09 -0500
> > Subject: [PATCH] DSPBRIDGE: Video Playback Cache Optimization
> > 
> > Avoid get_user_pages cache flush overheads for uncached & reserved
> > buffers (e.g. display & camera buffers).
> 
> Would it be possible to tell the case/path,
> where no L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?

To be correct,
  "where L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED"

> > 
> > Signed-off-by: Sripal Bagadia 
> > ---
> >  drivers/dsp/bridge/wmd/tiomap3430.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
> > b/drivers/dsp/bridge/wmd/tiomap3430.c
> > index 7a9603d..a2f32e8 100644
> > --- a/drivers/dsp/bridge/wmd/tiomap3430.c
> > +++ b/drivers/dsp/bridge/wmd/tiomap3430.c
> > @@ -1461,7 +1461,9 @@ static DSP_STATUS WMD_BRD_MemMap(struct 
> > WMD_DEV_CONTEXT *hDevContext,
> >     goto func_cont;
> >   }
> >  
> > - if (vma->vm_flags & VM_IO) {
> > + if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED) && 
> > + (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE) &&
> > + (~pgprot_val(vma->vm_page_prot) & L_PTE_BUFFERABLE))) {
> >     numUsrPgs =  ulNumBytes / PG_SIZE_4K;
> >     mpuAddr = ulMpuAddr;
> >     DBG_Trace(DBG_LEVEL4, "WMD_BRD_MemMap:numOfActualTabEntries=%d,"
> > -- 
> > 1.6.2.4
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-10 Thread Hiroshi DOYU
From: "ext Ramirez Luna, Omar" 
Subject: RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization
Date: Wed, 10 Jun 2009 01:18:29 +0200

> Hi,
> 
> [sending as plain text to l-o]
> 
> Could you please comment on this patch.
> 
> From: Sripal Bagadia 
> Date: Tue, 9 Jun 2009 16:05:09 -0500
> Subject: [PATCH] DSPBRIDGE: Video Playback Cache Optimization
> 
> Avoid get_user_pages cache flush overheads for uncached & reserved
> buffers (e.g. display & camera buffers).

Would it be possible to tell the case/path,
where no L_PTE_CACHEABLE/L_PTE_BUFFERABLE is set with VM_IO/VM_RESERVED ?

> 
> Signed-off-by: Sripal Bagadia 
> ---
>  drivers/dsp/bridge/wmd/tiomap3430.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
> b/drivers/dsp/bridge/wmd/tiomap3430.c
> index 7a9603d..a2f32e8 100644
> --- a/drivers/dsp/bridge/wmd/tiomap3430.c
> +++ b/drivers/dsp/bridge/wmd/tiomap3430.c
> @@ -1461,7 +1461,9 @@ static DSP_STATUS WMD_BRD_MemMap(struct WMD_DEV_CONTEXT 
> *hDevContext,
>     goto func_cont;
>   }
>  
> - if (vma->vm_flags & VM_IO) {
> + if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED) && 
> + (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE) &&
> + (~pgprot_val(vma->vm_page_prot) & L_PTE_BUFFERABLE))) {
>     numUsrPgs =  ulNumBytes / PG_SIZE_4K;
>     mpuAddr = ulMpuAddr;
>     DBG_Trace(DBG_LEVEL4, "WMD_BRD_MemMap:numOfActualTabEntries=%d,"
> -- 
> 1.6.2.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-09 Thread Ramirez Luna, Omar
Hi,

[sending as plain text to l-o]

Could you please comment on this patch.

From: Sripal Bagadia 
Date: Tue, 9 Jun 2009 16:05:09 -0500
Subject: [PATCH] DSPBRIDGE: Video Playback Cache Optimization

Avoid get_user_pages cache flush overheads for uncached & reserved
buffers (e.g. display & camera buffers).

Signed-off-by: Sripal Bagadia 
---
 drivers/dsp/bridge/wmd/tiomap3430.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c 
b/drivers/dsp/bridge/wmd/tiomap3430.c
index 7a9603d..a2f32e8 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -1461,7 +1461,9 @@ static DSP_STATUS WMD_BRD_MemMap(struct WMD_DEV_CONTEXT 
*hDevContext,
    goto func_cont;
  }
 
- if (vma->vm_flags & VM_IO) {
+ if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED) && 
+ (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE) &&
+ (~pgprot_val(vma->vm_page_prot) & L_PTE_BUFFERABLE))) {
    numUsrPgs =  ulNumBytes / PG_SIZE_4K;
    mpuAddr = ulMpuAddr;
    DBG_Trace(DBG_LEVEL4, "WMD_BRD_MemMap:numOfActualTabEntries=%d,"
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH] DSPBRIDGE: Video Playback Cache Optimization

2009-06-09 Thread Felipe Contreras
On Wed, Jun 10, 2009 at 12:39 AM, Ramirez Luna, Omar wrote:
> Hi,
>
>
>
> Could you please comment on this patch.
>
>
>
> From: Sripal Bagadia 
>
> Date: Tue, 9 Jun 2009 16:05:09 -0500
>
> Subject: [PATCH] DSPBRIDGE: Video Playback Cache Optimization
>
>
>
> Avoid get_user_pages cache flush overheads for uncached & reserved
>
> buffers (e.g. display & camera buffers).
>
>
>
> Signed-off-by: Sripal Bagadia 
>
> ---
>
>  drivers/dsp/bridge/wmd/tiomap3430.c |    4 +++-
>
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
>
>
> diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c
> b/drivers/dsp/bridge/wmd/tiomap3430.c
>
> index 7a9603d..a2f32e8 100644
>
> --- a/drivers/dsp/bridge/wmd/tiomap3430.c
>
> +++ b/drivers/dsp/bridge/wmd/tiomap3430.c
>
> @@ -1461,7 +1461,9 @@ static DSP_STATUS WMD_BRD_MemMap(struct
> WMD_DEV_CONTEXT *hDevContext,
>
>     goto func_cont;
>
>   }
>
>
>
> - if (vma->vm_flags & VM_IO) {
>
> + if ((vma->vm_flags & VM_IO) | ((vma->vm_flags & VM_RESERVED) &&
>
> + (~pgprot_val(vma->vm_page_prot) & L_PTE_CACHEABLE) &&
>
> + (~pgprot_val(vma->vm_page_prot) & L_PTE_BUFFERABLE))) {

L_PTE_BUFFERABLE is obsolete, isn't it? L_PTE_MT_BUFFERABLE should be
used instead.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html