linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Memory Pre-allocation (mem=xxx)
@ 2002-02-23  0:42 David C. Chiu
  2002-02-23  0:57 ` Wolfgang Denk
  2002-02-23  1:54 ` Jim Lewis
  0 siblings, 2 replies; 9+ messages in thread
From: David C. Chiu @ 2002-02-23  0:42 UTC (permalink / raw)
  To: linuxppc-embedded


We're working on a project that requires a two megabytes block of
contiguous memory in kernel space. Although it is well documented that
memory can be reserved by using mem=xx arguments during boot time, it is
unclear (to me) as to how a driver can automatically detect the size of
the said reserved block.

At this moment I am 'cheating' by inserting a global variable to save a
copy of total_memory before it gets replaced by __max_memory in
arch/ppc/mm/init.c so that the saved total_memory (containing the real
physical memory size passed in from boot block) is available to my
driver. But I can't help but to feel there has to be a better way to
determine the reserved buffer size. Is there something else that will do
this without having to modify the kernel?

Any comment is appreciated.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Memory Pre-allocation (mem=xxx)
  2002-02-23  0:42 David C. Chiu
@ 2002-02-23  0:57 ` Wolfgang Denk
  2002-02-23  1:54 ` Jim Lewis
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2002-02-23  0:57 UTC (permalink / raw)
  To: David C. Chiu; +Cc: linuxppc-embedded


In message <8A098FDFC6EED94B872CA2033711F86F0ABD0C@orion.ariodata.com> you wrote:
>
> We're working on a project that requires a two megabytes block of
> contiguous memory in kernel space. Although it is well documented that
> memory can be reserved by using mem=xx arguments during boot time, it is
> unclear (to me) as to how a driver can automatically detect the size of
> the said reserved block.

Pass an extra boot argument?

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Generally speaking, there are other ways to accomplish whatever it is
that you think you need ...                               - Doug Gwyn

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Memory Pre-allocation (mem=xxx)
@ 2002-02-23  1:21 David C. Chiu
  2002-02-25 12:35 ` Kenneth Johansson
  0 siblings, 1 reply; 9+ messages in thread
From: David C. Chiu @ 2002-02-23  1:21 UTC (permalink / raw)
  To: linuxppc-embedded


Thanks for your comment Wolfgang.

The driver in question is compiled as module, and the last time I
checked (a year ago) there isn't a way to pass an argument to a module
driver during boot time. Has this changed? The kernel is 2.4 series.

-----Original Message-----
From: owner-linuxppc-embedded@lists.linuxppc.org
[mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Wolfgang
Denk
Sent: Friday, February 22, 2002 4:57 PM
To: David C. Chiu
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Memory Pre-allocation (mem=xxx)

In message <8A098FDFC6EED94B872CA2033711F86F0ABD0C@orion.ariodata.com>
you wrote:

> We're working on a project that requires a two megabytes block of
> contiguous memory in kernel space. Although it is well documented that
> memory can be reserved by using mem=xx arguments during boot time, it
is
> unclear (to me) as to how a driver can automatically detect the size
of
> the said reserved block.

Pass an extra boot argument?

Wolfgang Denk

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Memory Pre-allocation (mem=xxx)
  2002-02-23  0:42 David C. Chiu
  2002-02-23  0:57 ` Wolfgang Denk
@ 2002-02-23  1:54 ` Jim Lewis
  1 sibling, 0 replies; 9+ messages in thread
From: Jim Lewis @ 2002-02-23  1:54 UTC (permalink / raw)
  To: David C. Chiu, linuxppc-embedded


Another way to allocate physically contiguous memory in 2.4 is to use
the alloc_bootmem function. It has to be called during kernel
initialization, though.
-Jim Lewis

> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On
> Behalf Of David C.
> Chiu
> Sent: Friday, February 22, 2002 6:43 PM
> To: linuxppc-embedded@lists.linuxppc.org
> Subject: Memory Pre-allocation (mem=xxx)
>
>
>
> We're working on a project that requires a two megabytes block of
> contiguous memory in kernel space. Although it is well
> documented that
> memory can be reserved by using mem=xx arguments during
> boot time, it is
> unclear (to me) as to how a driver can automatically detect
> the size of
> the said reserved block.
>
> At this moment I am 'cheating' by inserting a global
> variable to save a
> copy of total_memory before it gets replaced by __max_memory in
> arch/ppc/mm/init.c so that the saved total_memory
> (containing the real
> physical memory size passed in from boot block) is available to my
> driver. But I can't help but to feel there has to be a better way to
> determine the reserved buffer size. Is there something else
> that will do
> this without having to modify the kernel?
>
> Any comment is appreciated.
>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Memory Pre-allocation (mem=xxx)
@ 2002-02-23  3:11 David C. Chiu
  2002-02-23 17:14 ` Tom Rini
  0 siblings, 1 reply; 9+ messages in thread
From: David C. Chiu @ 2002-02-23  3:11 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded


Thanks for the response. Would you be so kind to be more specific? I did
a coarse search of the kernel documentation subdirectory contents, but
fail to find what you are referring to (although I have been referred to
as the seeing blind in the past.)

The basic goal was to have a singular location in which buffer size is
specified so that future changes doesn't turn into a nightmare, and
computing the delta between mem=xxx and actual memory size seem logical,
but the present method employed by yours truely felt ugly and... so
wrong. ^^;

-----Original Message-----
From: Tom Rini [mailto:trini@kernel.crashing.org]
Sent: Friday, February 22, 2002 6:38 PM
To: Wolfgang Denk
Cc: David C. Chiu; linuxppc-embedded@lists.linuxppc.org
Subject: Re: Memory Pre-allocation (mem=xxx)


On Sat, Feb 23, 2002 at 01:57:24AM +0100, Wolfgang Denk wrote:
> In message <8A098FDFC6EED94B872CA2033711F86F0ABD0C@orion.ariodata.com>
you wrote:
> >
> > We're working on a project that requires a two megabytes block of
> > contiguous memory in kernel space. Although it is well documented
that
> > memory can be reserved by using mem=xx arguments during boot time,
it is
> > unclear (to me) as to how a driver can automatically detect the size
of
> > the said reserved block.
>
> Pass an extra boot argument?

Basically.  IIRC there's a clean way to do it now (tho it can fail, so
you'd have to catch that in the driver, but early on it shouldn't be a
problem).  Look around in Documentation/

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Memory Pre-allocation (mem=xxx)
  2002-02-23  3:11 David C. Chiu
@ 2002-02-23 17:14 ` Tom Rini
  2002-02-24  0:15   ` Tom Rini
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2002-02-23 17:14 UTC (permalink / raw)
  To: David C. Chiu; +Cc: linuxppc-embedded


On Fri, Feb 22, 2002 at 07:11:00PM -0800, David C. Chiu wrote:

> Thanks for the response. Would you be so kind to be more specific? I did
> a coarse search of the kernel documentation subdirectory contents, but
> fail to find what you are referring to (although I have been referred to
> as the seeing blind in the past.)

Sorry, I don't recall exactly where/what it is.  I do remember there
being a few projects which required a large chunk of contigious memory,
and having to do mem=XXm in 2.0 (2.2?) but in 2.2 (2.4?) there's kernel
calls you can make to get a large contig section of memory, if it
exists.

> The basic goal was to have a singular location in which buffer size is
> specified so that future changes doesn't turn into a nightmare, and
> computing the delta between mem=xxx and actual memory size seem logical,
> but the present method employed by yours truely felt ugly and... so
> wrong. ^^;

Well, if you pass along mem=xxx, then the kernel will not try and figure
ou the actual memory size, unless you do some hacking around.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Memory Pre-allocation (mem=xxx)
  2002-02-23 17:14 ` Tom Rini
@ 2002-02-24  0:15   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2002-02-24  0:15 UTC (permalink / raw)
  To: David C. Chiu; +Cc: linuxppc-embedded


On Sat, Feb 23, 2002 at 10:14:00AM -0700, Tom Rini wrote:
>
> On Fri, Feb 22, 2002 at 07:11:00PM -0800, David C. Chiu wrote:
>
> > Thanks for the response. Would you be so kind to be more specific? I did
> > a coarse search of the kernel documentation subdirectory contents, but
> > fail to find what you are referring to (although I have been referred to
> > as the seeing blind in the past.)
>
> Sorry, I don't recall exactly where/what it is.  I do remember there
> being a few projects which required a large chunk of contigious memory,
> and having to do mem=XXm in 2.0 (2.2?) but in 2.2 (2.4?) there's kernel
> calls you can make to get a large contig section of memory, if it
> exists.

... and it might even be the 'alloc_bootmem' call Jim Lewis mentioned,
now that I think about it..

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Memory Pre-allocation (mem=xxx)
  2002-02-23  1:21 Memory Pre-allocation (mem=xxx) David C. Chiu
@ 2002-02-25 12:35 ` Kenneth Johansson
  0 siblings, 0 replies; 9+ messages in thread
From: Kenneth Johansson @ 2002-02-25 12:35 UTC (permalink / raw)
  To: David C. Chiu; +Cc: linuxppc-embedded


I'am not shure what you mean with a module driver during boot but If you want
to pass a option that was entered in the bootline you can read the bootline
from /proc/cmdline and with some small shell script extract the part you want
and pass that to the module when you insert it.

"David C. Chiu" wrote:
>
> Thanks for your comment Wolfgang.
>
> The driver in question is compiled as module, and the last time I
> checked (a year ago) there isn't a way to pass an argument to a module
> driver during boot time. Has this changed? The kernel is 2.4 series.
>
> -----Original Message-----
> Wolfgang Denk
> Sent: Friday, February 22, 2002 4:57 PM
>
> In message <8A098FDFC6EED94B872CA2033711F86F0ABD0C@orion.ariodata.com>
> you wrote:
>
> > We're working on a project that requires a two megabytes block of
> > contiguous memory in kernel space. Although it is well documented that
> > memory can be reserved by using mem=xx arguments during boot time, it
> is
> > unclear (to me) as to how a driver can automatically detect the size
> of
> > the said reserved block.
>
> Pass an extra boot argument?

--
Kenneth Johansson
Ericsson Telecom                  Tel: +46 8 404 71 83
Viderögatan 3                     Fax: +46 8 404 72 72
164 80 Stockholm                  kenneth.johansson@etx.ericsson.se

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: Memory Pre-allocation (mem=xxx)
@ 2002-02-27 21:23 David C. Chiu
  0 siblings, 0 replies; 9+ messages in thread
From: David C. Chiu @ 2002-02-27 21:23 UTC (permalink / raw)
  To: linuxppc-embedded


Thanks for all that replied. It would seem that the best possible choice
is probably to just the /proc/cmdline to pass the buffer allocation
size.

-----Original Message-----
From: innkeon@etx.ericsson.se [mailto:innkeon@etx.ericsson.se]On Behalf
Of Kenneth Johansson
Sent: Monday, February 25, 2002 4:36 AM
To: David C. Chiu
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Memory Pre-allocation (mem=xxx)


I'am not shure what you mean with a module driver during boot but If you
want
to pass a option that was entered in the bootline you can read the
bootline
from /proc/cmdline and with some small shell script extract the part you
want
and pass that to the module when you insert it.

"David C. Chiu" wrote:
>
> Thanks for your comment Wolfgang.
>
> The driver in question is compiled as module, and the last time I
> checked (a year ago) there isn't a way to pass an argument to a module
> driver during boot time. Has this changed? The kernel is 2.4 series.
>
> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of
Wolfgang
> Denk
> Sent: Friday, February 22, 2002 4:57 PM
> To: David C. Chiu
> Cc: linuxppc-embedded@lists.linuxppc.org
> Subject: Re: Memory Pre-allocation (mem=xxx)
>
> In message <8A098FDFC6EED94B872CA2033711F86F0ABD0C@orion.ariodata.com>
> you wrote:
>
> > We're working on a project that requires a two megabytes block of
> > contiguous memory in kernel space. Although it is well documented
that
> > memory can be reserved by using mem=xx arguments during boot time,
it
> is
> > unclear (to me) as to how a driver can automatically detect the size
> of
> > the said reserved block.
>
> Pass an extra boot argument?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2002-02-27 21:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-23  1:21 Memory Pre-allocation (mem=xxx) David C. Chiu
2002-02-25 12:35 ` Kenneth Johansson
  -- strict thread matches above, loose matches on Subject: below --
2002-02-27 21:23 David C. Chiu
2002-02-23  3:11 David C. Chiu
2002-02-23 17:14 ` Tom Rini
2002-02-24  0:15   ` Tom Rini
2002-02-23  0:42 David C. Chiu
2002-02-23  0:57 ` Wolfgang Denk
2002-02-23  1:54 ` Jim Lewis

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