Re: [PATCH] New phys_addr() syscall

Richard Gooch (Richard.Gooch@atnf.CSIRO.AU)
Sun, 19 Jul 1998 17:35:56 +1000


H. Peter Anvin writes:
> > Hi, all. I've implemented a simple new system call called
> > phys_addr() which converts a virtual address to a physical
> > address. This is useful for memory testing programmes so you can find
> > out which SIMM/DIMM is causing trouble (yeah, I've got intermittent
> > memory problems in one of my machines, and I want to nail the bugger).
> > Sure, I know about memtest86, but it doesn't seem to find the problem,
> > whereas my userspace tester does.
> >=20
> > People writing pure userspace network drivers may also find this handy
> > if they want to DMA directly into userspace.
> >=20
> > I've only bothered with ix86 syscalls for now. Comments welcome. Patch
> > against 2.1.109 below.
> >=20
>
> Question: how do you know when this is still accurate? The kernel can
> change the mapping without notice, except perhaps when using mlock()
> (even then?)

For the purposes of a memory tester, the result is accurate enough
(who cares if the physical address changes: it's only being used for
display).

For other purposes (such as pure userspace network drivers), I'd
assume that the memory has been pinned down by mlock(2). In any case,
I see the job of phys_addr(2) telling you what the state is
*now*. Ensuring that things remain stable is someone else's problem
(i.e. mlock(2) or similar).

Finally, as fas as I can tell, mlock(2) should ensure a virtual page
stays pinned to the same physical page, since to do otherwise implies
one of two things:

- page out and page back in to a block device (most likely)

- copying one page to another (why on earth???).

In either case, it tends to defeat the point of mlock(2). So this
shouldn't happen, IMHO.

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html