linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* How to disable dcache on MPC82xx platform
@ 2005-08-09  2:30 Prashant Alange
  2005-08-09 14:37 ` Dan Malek
  0 siblings, 1 reply; 6+ messages in thread
From: Prashant Alange @ 2005-08-09  2:30 UTC (permalink / raw)
  To: linuxppc-embedded

Hi all,

I am using alloc_bootmem_page() function to allocate memory required
in my custom ethernet driver . This driver reads buffer descriptors &
data from the memory allocated by bootmem page. This memory is updated
by CPM module. I am experiencing reliability issues with this driver.
It works fine for some time & then behaves abnormally. When driver
fails,  the values read from the allocated memory does not make any
sense. So I am thinking this could be because of cache since this
driver is working fine on non-os platform. I want to disable the
dcache for this memory region.

I am allocating about 700K of memory using alloc_bootmem_page() function.

Can anyone tell me how to do this?=20

I am running linux-2.4 on MCP8270 processor.

I tried flushing the dcache before accessing the memory but no luck.

Thanks for your time,
Prashant

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to disable dcache on MPC82xx platform
  2005-08-09  2:30 How to disable dcache on MPC82xx platform Prashant Alange
@ 2005-08-09 14:37 ` Dan Malek
  2005-08-09 14:57   ` Prashant Alange
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Malek @ 2005-08-09 14:37 UTC (permalink / raw)
  To: Prashant Alange; +Cc: linuxppc-embedded


On Aug 8, 2005, at 10:30 PM, Prashant Alange wrote:

> I am using alloc_bootmem_page() function to allocate memory required
> in my custom ethernet driver.

Why?  Just use the normal Linux memory allocators.

>  So I am thinking this could be because of cache since this
> driver is working fine on non-os platform. I want to disable the
> dcache for this memory region.

This is a fully cache coherent processor, there is no need to
disable caching, nor is there any easy way to do this in the
current Linux implementation.  This would require a custom
kernel, and you couldn't take advantage of the general
performance gain using BATs.

Thanks.

	-- Dan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to disable dcache on MPC82xx platform
  2005-08-09 14:37 ` Dan Malek
@ 2005-08-09 14:57   ` Prashant Alange
  2005-08-09 16:37     ` Dan Malek
  0 siblings, 1 reply; 6+ messages in thread
From: Prashant Alange @ 2005-08-09 14:57 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded

Since the existing UART/ethernet drivers are using cpm_hostalloc() so
I am also using the same function. Then can I use kmalloc() to alloc
such huge memory. If at all I have to configure BATx to just test how
it behaves. How/where to configure BATx. One more thing is that
totally I am allocating about 1MB memory in a chunk of 200K. I really
dont know whether I can do such allocation in driver. But this much is
very much required for my driver. If you have any other idea of
achieving this then please point me in that direction. I need to get
rid of this problme as early as possible to meet my schedule. please
help.

Thanks,
Prashant

On 8/9/05, Dan Malek <dan@embeddededge.com> wrote:
>=20
> On Aug 8, 2005, at 10:30 PM, Prashant Alange wrote:
>=20
> > I am using alloc_bootmem_page() function to allocate memory required
> > in my custom ethernet driver.
>=20
> Why?  Just use the normal Linux memory allocators.
>=20
> >  So I am thinking this could be because of cache since this
> > driver is working fine on non-os platform. I want to disable the
> > dcache for this memory region.
>=20
> This is a fully cache coherent processor, there is no need to
> disable caching, nor is there any easy way to do this in the
> current Linux implementation.  This would require a custom
> kernel, and you couldn't take advantage of the general
> performance gain using BATs.
>=20
> Thanks.
>=20
>        -- Dan
>=20
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to disable dcache on MPC82xx platform
  2005-08-09 14:57   ` Prashant Alange
@ 2005-08-09 16:37     ` Dan Malek
  2005-08-09 21:50       ` Prashant Alange
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Malek @ 2005-08-09 16:37 UTC (permalink / raw)
  To: Prashant Alange; +Cc: linuxppc-embedded


On Aug 9, 2005, at 10:57 AM, Prashant Alange wrote:

> Since the existing UART/ethernet drivers are using cpm_hostalloc() so
> I am also using the same function.

As I have said too many times before, cpm_hostalloc() is only used
to allocate small memory regions that would otherwise be wasteful
with the normal Linux memory allocators.  This function does not
do anything special with the memory, aside from allowing us have
multiple drivers share a page for efficiency.

>  Then can I use kmalloc() to alloc
> such huge memory.

Yes, and you should.

>  If at all I have to configure BATx to just test how
> it behaves.

No, that's not all you have to do.  It's not a trivial process
easily described here.

> .....   One more thing is that
> totally I am allocating about 1MB memory in a chunk of 200K.

I can't comprehend a reason why you need to allocate so much
space in a driver, especially for CPM devices.  The driver is just
a temporary FIFO for data flowing to/from other consumer/producers
of the data in the system.  If the software above a driver needs
that kind of buffering, it should manage that itself.

If you do need so much space, use the beauty of the CPM and
link multiple BDs with reasonable sized buffers more easily
managed by the existing Linux allocators.

The other alternative is just reserve memory using the 'mem='
start parameter so it isn't know to Linux, and manage entirely
yourself.


	-- Dan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to disable dcache on MPC82xx platform
  2005-08-09 16:37     ` Dan Malek
@ 2005-08-09 21:50       ` Prashant Alange
  2005-08-09 22:28         ` Dan Malek
  0 siblings, 1 reply; 6+ messages in thread
From: Prashant Alange @ 2005-08-09 21:50 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded

Thanks Dan for your explaination. I am linking multiple BDs only but
no of BDs are very large in my case so I am allocating the memory and
updating the BD pointer for all BDs. I am thinking of using mem start
parameter option. I even tried using __get_free_page instead of using
cpm_hostalloc() but that also did not help.
If i use mem=3D option as kernel command line argument then I will have
to just ioremap() this reserved address in my driver and start
accessing the memory.  I do not have to worry about cache related
things.  right?

Thanks again,
Prashant


On 8/9/05, Dan Malek <dan@embeddededge.com> wrote:
>=20
> On Aug 9, 2005, at 10:57 AM, Prashant Alange wrote:
>=20
> > Since the existing UART/ethernet drivers are using cpm_hostalloc() so
> > I am also using the same function.
>=20
> As I have said too many times before, cpm_hostalloc() is only used
> to allocate small memory regions that would otherwise be wasteful
> with the normal Linux memory allocators.  This function does not
> do anything special with the memory, aside from allowing us have
> multiple drivers share a page for efficiency.
>=20
> >  Then can I use kmalloc() to alloc
> > such huge memory.
>=20
> Yes, and you should.
>=20
> >  If at all I have to configure BATx to just test how
> > it behaves.
>=20
> No, that's not all you have to do.  It's not a trivial process
> easily described here.
>=20
> > .....   One more thing is that
> > totally I am allocating about 1MB memory in a chunk of 200K.
>=20
> I can't comprehend a reason why you need to allocate so much
> space in a driver, especially for CPM devices.  The driver is just
> a temporary FIFO for data flowing to/from other consumer/producers
> of the data in the system.  If the software above a driver needs
> that kind of buffering, it should manage that itself.
>=20
> If you do need so much space, use the beauty of the CPM and
> link multiple BDs with reasonable sized buffers more easily
> managed by the existing Linux allocators.
>=20
> The other alternative is just reserve memory using the 'mem=3D'
> start parameter so it isn't know to Linux, and manage entirely
> yourself.
>=20
>=20
>        -- Dan
>=20
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to disable dcache on MPC82xx platform
  2005-08-09 21:50       ` Prashant Alange
@ 2005-08-09 22:28         ` Dan Malek
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Malek @ 2005-08-09 22:28 UTC (permalink / raw)
  To: Prashant Alange; +Cc: linuxppc-embedded


On Aug 9, 2005, at 5:50 PM, Prashant Alange wrote:

> ....... I am linking multiple BDs only but
> no of BDs are very large in my case so I am allocating the memory and
> updating the BD pointer for all BDs.

I don't understand what you mean here.

> If i use mem= option as kernel command line argument then I will have
> to just ioremap() this reserved address in my driver and start
> accessing the memory.  I do not have to worry about cache related
> things.  right?

Yes.

	-- Dan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-08-09 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-09  2:30 How to disable dcache on MPC82xx platform Prashant Alange
2005-08-09 14:37 ` Dan Malek
2005-08-09 14:57   ` Prashant Alange
2005-08-09 16:37     ` Dan Malek
2005-08-09 21:50       ` Prashant Alange
2005-08-09 22:28         ` Dan Malek

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).