linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* how to tell if arbitrary kernel memory address is backed by physical memory?
@ 2009-04-16 15:37 Chris Friesen
  2009-04-16 20:58 ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Friesen @ 2009-04-16 15:37 UTC (permalink / raw)
  To: linux-kernel, linux-mm

Hi all,

Quick question to the memory management folks.

Is there a portable way to tell whether a particular virtual address in 
the lowmem address range is backed by physical memory and is readable?

For background...we have some guys working on a software memory scrubber 
for an embedded board.  The memory controller supports ECC but doesn't 
support scrubbing  in hardware.  What we want to do is walk all of 
lowmem, reading in memory.  If a fault is encountered, it will be 
handled by other code.

Thanks,

Chris

--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: how to tell if arbitrary kernel memory address is backed by physical memory?
  2009-04-16 15:37 how to tell if arbitrary kernel memory address is backed by physical memory? Chris Friesen
@ 2009-04-16 20:58 ` Christoph Lameter
  2009-04-17 16:15   ` Chris Friesen
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2009-04-16 20:58 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linux-kernel, linux-mm

On Thu, 16 Apr 2009, Chris Friesen wrote:

> Quick question to the memory management folks.
>
> Is there a portable way to tell whether a particular virtual address in the
> lowmem address range is backed by physical memory and is readable?
>
> For background...we have some guys working on a software memory scrubber for
> an embedded board.  The memory controller supports ECC but doesn't support
> scrubbing  in hardware.  What we want to do is walk all of lowmem, reading in
> memory.  If a fault is encountered, it will be handled by other code.

Virtual address in the lowmem address range? lowmem address ranges exist
for physical addresses.

If you walk lowmem (physical) then you will never see a missing page.

So I guess you have a process that wants to determine if its memory is
present? See

	man 2 mincore

which describes a glibc call that shows which pages of a process are
present.


--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: how to tell if arbitrary kernel memory address is backed by physical memory?
  2009-04-16 20:58 ` Christoph Lameter
@ 2009-04-17 16:15   ` Chris Friesen
  2009-04-17 16:27     ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Friesen @ 2009-04-17 16:15 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-kernel, linux-mm

Christoph Lameter wrote:
> On Thu, 16 Apr 2009, Chris Friesen wrote:

>> Is there a portable way to tell whether a particular virtual address in the
>> lowmem address range is backed by physical memory and is readable?
>>
>> For background...we have some guys working on a software memory scrubber for
>> an embedded board.  The memory controller supports ECC but doesn't support
>> scrubbing  in hardware.  What we want to do is walk all of lowmem, reading in
>> memory.  If a fault is encountered, it will be handled by other code.
> 
> Virtual address in the lowmem address range? lowmem address ranges exist
> for physical addresses.
> 
> If you walk lowmem (physical) then you will never see a missing page.

We have a mips board that appears to have holes in the lowmem mappings 
such that blindly walking all of it causes problems.  I assume the 
allocator knows about these holes and simply doesn't assign memory at 
those addresses.

We may have found a solution though...it looks like virt_addr_valid() 
returns false for the problematic addresses.  Would it be reasonable to 
call this once for each page before trying to access it?

Chris

--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: how to tell if arbitrary kernel memory address is backed by physical memory?
  2009-04-17 16:15   ` Chris Friesen
@ 2009-04-17 16:27     ` Christoph Lameter
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2009-04-17 16:27 UTC (permalink / raw)
  To: Chris Friesen; +Cc: linux-kernel, linux-mm


On Fri, 17 Apr 2009, Chris Friesen wrote:

> We have a mips board that appears to have holes in the lowmem mappings such
> that blindly walking all of it causes problems.  I assume the allocator knows
> about these holes and simply doesn't assign memory at those addresses.

Yes memory is registered in distinct ranges during boot.

> We may have found a solution though...it looks like virt_addr_valid() returns
> false for the problematic addresses.  Would it be reasonable to call this once
> for each page before trying to access it?

Sure. Note that virt_addr_valid only ensures that there is a page
struct for that address. You may need to ensure that PageReserved(page) is
false if you want to make sure that you have actual memory there that is
valid to use.

--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-04-17 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-16 15:37 how to tell if arbitrary kernel memory address is backed by physical memory? Chris Friesen
2009-04-16 20:58 ` Christoph Lameter
2009-04-17 16:15   ` Chris Friesen
2009-04-17 16:27     ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox