* Allocating a page of memory with a given physical address
@ 2000-06-08 21:44 Timur Tabi
2000-06-08 21:47 ` Stephen C. Tweedie
0 siblings, 1 reply; 11+ messages in thread
From: Timur Tabi @ 2000-06-08 21:44 UTC (permalink / raw)
To: Linux MM mailing list
I have an application that needs to allocate a page of RAM on a given physical
address. IOW, say I have a physical address (e.g. 0x0CDB5000 on a 256MB
machine), and I know (via the mem_map array) that it's not being used by
anything. What I need to do know is allocate that page of memory so that no one
else can allocate it (via a memory allocation function like get_free_page or
malloc).
Is this currently possible? If not, is anyone working on adding it to a future
kernel? And if not, is anyone willing to help me implement it or at least tell
me how I should proceed?
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 21:44 Allocating a page of memory with a given physical address Timur Tabi
@ 2000-06-08 21:47 ` Stephen C. Tweedie
2000-06-08 21:58 ` Timur Tabi
0 siblings, 1 reply; 11+ messages in thread
From: Stephen C. Tweedie @ 2000-06-08 21:47 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux MM mailing list
Hi,
On Thu, Jun 08, 2000 at 04:44:21PM -0500, Timur Tabi wrote:
> I have an application that needs to allocate a page of RAM on a given physical
> address. IOW, say I have a physical address (e.g. 0x0CDB5000 on a 256MB
> machine), and I know (via the mem_map array) that it's not being used by
> anything. What I need to do know is allocate that page of memory so that no one
> else can allocate it (via a memory allocation function like get_free_page or
> malloc).
>
> Is this currently possible?
No, nor is it likely to be added without a compelling reason. Why do
you need this?
Cheers,
Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 21:47 ` Stephen C. Tweedie
@ 2000-06-08 21:58 ` Timur Tabi
2000-06-08 22:15 ` Juan J. Quintela
0 siblings, 1 reply; 11+ messages in thread
From: Timur Tabi @ 2000-06-08 21:58 UTC (permalink / raw)
To: Linux MM mailing list
** Reply to message from "Stephen C. Tweedie" <sct@redhat.com> on Thu, 8 Jun
2000 22:47:44 +0100
> No, nor is it likely to be added without a compelling reason. Why do
> you need this?
Unfortunately, it's part of my company's upcoming product, and I can't give a
detailed explanation. I understand that such a response does not endear me to
the Linux community, but my hands are tied. All I can say is that all of us
software guys here have given it a lot of thought, and we're absolutely positive
that we need this functionality. We need to be able to read/write memory to
specific DIMMs.
In fact, it's one of the reasons why we support only Windows 2000, not Windows
NT or 95/98, because those older products don't have this kind of feature.
Hmmm... I just thought of something. Knowing that there's a direct linear
mapping between virtual memory and physical memory in kernel space, I could
simply allocate a block of memory at a specific virtual address. Would that be
any easier?
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 21:58 ` Timur Tabi
@ 2000-06-08 22:15 ` Juan J. Quintela
2000-06-08 22:27 ` Timur Tabi
0 siblings, 1 reply; 11+ messages in thread
From: Juan J. Quintela @ 2000-06-08 22:15 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux MM mailing list
>>>>> "timur" == Timur Tabi <ttabi@interactivesi.com> writes:
timur> ** Reply to message from "Stephen C. Tweedie" <sct@redhat.com> on Thu, 8 Jun
timur> 2000 22:47:44 +0100
>> No, nor is it likely to be added without a compelling reason. Why do
>> you need this?
timur> Unfortunately, it's part of my company's upcoming product, and I can't give a
timur> detailed explanation. I understand that such a response does not endear me to
timur> the Linux community, but my hands are tied. All I can say is that all of us
timur> software guys here have given it a lot of thought, and we're absolutely positive
timur> that we need this functionality. We need to be able to read/write memory to
timur> specific DIMMs.
Try to grep the kernel for mem_map_reserve uses, it does something
similar, and can be similar to what you want to do. Notice that you
need to reserve the page *soon* in the boot process.
Later, Juan.
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 22:15 ` Juan J. Quintela
@ 2000-06-08 22:27 ` Timur Tabi
2000-06-08 23:03 ` Stephen C. Tweedie
2000-06-08 23:09 ` Rik van Riel
0 siblings, 2 replies; 11+ messages in thread
From: Timur Tabi @ 2000-06-08 22:27 UTC (permalink / raw)
To: Linux MM mailing list
** Reply to message from "Juan J. Quintela" <quintela@fi.udc.es> on 09 Jun 2000
00:15:39 +0200
> Try to grep the kernel for mem_map_reserve uses, it does something
> similar, and can be similar to what you want to do. Notice that you
> need to reserve the page *soon* in the boot process.
Unfortunately, that's not an option. We need to be able to reserve/allocate
pages in a driver's init_module() function, and I don't mean drivers that are
compiled with the kernel. We need to be able to ship a stand-alone driver that
can work with pretty much any Linux distro of a particular version (e.g. we can
say that only 2.4.14 and above is supported).
For the time being, we can work with a patch to the kernel, but that patch be
relatively generic, and it must support our dynamically loadable driver.
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 22:27 ` Timur Tabi
@ 2000-06-08 23:03 ` Stephen C. Tweedie
2000-06-08 23:09 ` Rik van Riel
1 sibling, 0 replies; 11+ messages in thread
From: Stephen C. Tweedie @ 2000-06-08 23:03 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux MM mailing list
Hi,
On Thu, Jun 08, 2000 at 05:27:42PM -0500, Timur Tabi wrote:
>
> Unfortunately, that's not an option. We need to be able to reserve/allocate
> pages in a driver's init_module() function, and I don't mean drivers that are
> compiled with the kernel. We need to be able to ship a stand-alone driver that
> can work with pretty much any Linux distro of a particular version (e.g. we can
> say that only 2.4.14 and above is supported).
About the only thing you could do would be to keep allocating pages until
you get one with the desired properties. The kernel won't make any
guarantees about being able to free specific pages for you.
Cheers,
Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 22:27 ` Timur Tabi
2000-06-08 23:03 ` Stephen C. Tweedie
@ 2000-06-08 23:09 ` Rik van Riel
2000-06-08 23:29 ` Timur Tabi
1 sibling, 1 reply; 11+ messages in thread
From: Rik van Riel @ 2000-06-08 23:09 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux MM mailing list
On Thu, 8 Jun 2000, Timur Tabi wrote:
> ** Reply to message from "Juan J. Quintela" <quintela@fi.udc.es> on 09 Jun 2000
> 00:15:39 +0200
>
> > Try to grep the kernel for mem_map_reserve uses, it does something
> > similar, and can be similar to what you want to do. Notice that you
> > need to reserve the page *soon* in the boot process.
>
> Unfortunately, that's not an option. We need to be able to
> reserve/allocate pages in a driver's init_module() function, and
> I don't mean drivers that are compiled with the kernel. We need
> to be able to ship a stand-alone driver that can work with
> pretty much any Linux distro of a particular version (e.g. we
> can say that only 2.4.14 and above is supported).
>
> For the time being, we can work with a patch to the kernel, but
> that patch be relatively generic, and it must support our
> dynamically loadable driver.
Linus his policy on this is pretty strict. We won't kludge
stuff into our kernel just to support some proprietary driver.
Since nothing else seems to need the contorted functionality
you're asking for, I guess you should look for another way
to do things...
(or opensource the driver, of course)
regards,
Rik
--
The Internet is not a network of computers. It is a network
of people. That is its real strength.
Wanna talk about the kernel? irc.openprojects.net / #kernelnewbies
http://www.conectiva.com/ http://www.surriel.com/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 23:09 ` Rik van Riel
@ 2000-06-08 23:29 ` Timur Tabi
2000-06-09 21:20 ` Jamie Lokier
2000-06-09 21:34 ` Rik van Riel
0 siblings, 2 replies; 11+ messages in thread
From: Timur Tabi @ 2000-06-08 23:29 UTC (permalink / raw)
To: Linux MM mailing list
** Reply to message from Rik van Riel <riel@conectiva.com.br> on Thu, 8 Jun
2000 20:09:57 -0300 (BRST)
> Linus his policy on this is pretty strict. We won't kludge
> stuff into our kernel just to support some proprietary driver.
Well, the idea is to make it some kind of elegant enhancement that Linus would
approve of.
My idea is to create a new API, call it alloc_phys() or get_phys_page() or
whatever, that will scan the ???? (whatever the virtual memory manager calls
those things that keep track of unused virtual memory) until it finds a block
that points to the given physical address. It then allocates that particular
block.
Of course, from what little I know of the Linux VM, it looks like I'm in for a
rocky trip. For one thing, I don't understand how kernel virtual memory can
have a one-to-one mapping with physical memory, but user virtual memory has to
go through three levels of page tables. When I call get_free_page, it updates
some entry in mem_map. What is the mechanism that updates the page tables? I
figure the page tables need to be updated, so that a user process can't allocate
the same physical memory.
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 23:29 ` Timur Tabi
@ 2000-06-09 21:20 ` Jamie Lokier
2000-06-09 23:04 ` Timur Tabi
2000-06-09 21:34 ` Rik van Riel
1 sibling, 1 reply; 11+ messages in thread
From: Jamie Lokier @ 2000-06-09 21:20 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux MM mailing list
Timur Tabi wrote:
> My idea is to create a new API, call it alloc_phys() or get_phys_page() or
> whatever, that will scan the ???? (whatever the virtual memory manager calls
> those things that keep track of unused virtual memory) until it finds a block
> that points to the given physical address. It then allocates that particular
> block.
Even if you implement that, there will be times when you simply can't
have the page. Sometimes the current owner of the page can't allow it
to be moved. This happens for vmalloc()ed memory and user processes
that that use mlock(). This includes MP3 players and security
products...
-- Jamie
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-09 21:20 ` Jamie Lokier
@ 2000-06-09 23:04 ` Timur Tabi
0 siblings, 0 replies; 11+ messages in thread
From: Timur Tabi @ 2000-06-09 23:04 UTC (permalink / raw)
To: Linux MM mailing list
** Reply to message from Jamie Lokier <lk@tantalophile.demon.co.uk> on Fri, 9
Jun 2000 23:20:58 +0200
> Even if you implement that, there will be times when you simply can't
> have the page. Sometimes the current owner of the page can't allow it
> to be moved. This happens for vmalloc()ed memory and user processes
> that that use mlock(). This includes MP3 players and security
> products...
That's okay. If it page is taken, then the caller will have to deal with it.
--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Allocating a page of memory with a given physical address
2000-06-08 23:29 ` Timur Tabi
2000-06-09 21:20 ` Jamie Lokier
@ 2000-06-09 21:34 ` Rik van Riel
1 sibling, 0 replies; 11+ messages in thread
From: Rik van Riel @ 2000-06-09 21:34 UTC (permalink / raw)
To: Timur Tabi; +Cc: Linux MM mailing list
On Thu, 8 Jun 2000, Timur Tabi wrote:
> Well, the idea is to make it some kind of elegant enhancement
> that Linus would approve of.
>
> My idea is to create a new API, call it alloc_phys() or
> get_phys_page() or whatever, that will scan the ???? (whatever
> the virtual memory manager calls those things that keep track of
> unused virtual memory) until it finds a block that points to the
> given physical address. It then allocates that particular
> block.
I've got two comments on this.
1) it's a horrible kludge, not elegant at all
2) why would the kernel need this? I see absolutely
no use for this...
regards,
Rik
--
The Internet is not a network of computers. It is a network
of people. That is its real strength.
Wanna talk about the kernel? irc.openprojects.net / #kernelnewbies
http://www.conectiva.com/ http://www.surriel.com/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2000-06-09 23:04 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-08 21:44 Allocating a page of memory with a given physical address Timur Tabi
2000-06-08 21:47 ` Stephen C. Tweedie
2000-06-08 21:58 ` Timur Tabi
2000-06-08 22:15 ` Juan J. Quintela
2000-06-08 22:27 ` Timur Tabi
2000-06-08 23:03 ` Stephen C. Tweedie
2000-06-08 23:09 ` Rik van Riel
2000-06-08 23:29 ` Timur Tabi
2000-06-09 21:20 ` Jamie Lokier
2000-06-09 23:04 ` Timur Tabi
2000-06-09 21:34 ` Rik van Riel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox