All of lore.kernel.org
 help / color / mirror / Atom feed
* Translating physical/linear address to virtual address
@ 2015-10-02 19:58 martin
       [not found] ` <CAK7N6vpy3g022b+Au_uQqAEF4aK3g24702VcFnvxXCeJVe8SLw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: martin @ 2015-10-02 19:58 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I'm working with a kernel module that, through hardware events, gets a  
list of physical and linear memory addresses accessed by a program. I  
would like to convert these to the virtual addresses, as seen from the  
user space.

I saw there's phys_to_virt(), but as I understood it's only valid for  
kernel addresses.

What would be the correct approach? Pointers to the correct structs  
and functions are greatly appreciated.

Thank you.

Martin

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

* Translating physical/linear address to virtual address
       [not found] ` <CAK7N6vpy3g022b+Au_uQqAEF4aK3g24702VcFnvxXCeJVe8SLw@mail.gmail.com>
@ 2015-10-03  4:04   ` Martin Ichilevici de Oliveira
  2015-10-03  4:29     ` Ruben Safir
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Ichilevici de Oliveira @ 2015-10-03  4:04 UTC (permalink / raw)
  To: kernelnewbies

Hello Anish,

On Fri, Oct 02, 2015 at 08:37:25PM -0700, anish singh wrote:
> On Fri, Oct 2, 2015 at 12:58 PM, martin <iomartin@iomartin.net> wrote:
> 
> > Hello,
> >
> > I'm working with a kernel module that, through hardware events, gets a
> > list of physical and linear memory addresses accessed by a program. I
> > would like to convert these to the virtual addresses, as seen from the
> > user space.
> >
> 
> what are you trying to achieve?

I'm collecting some stats about these addresses, namely the amount of
accesses to each page that happen under specific conditions (and thus
why I use hardware events, instead of a simple memory trace).

My goal is to use this data to make informed decisions on pages
distribution in NUMA machines (with libnuma). The problem is that, as
far as I understood, physical and linear addresses won't necessarily be
the same between runs of the same program. Virtual addresses, on the
other hand, can be made to be consistent (by turning address space layout
randomization off).

Using virtual addresses also have the advantage that I can do all memory
management in userspace, with libnuma.

Thank you,
Martin

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

* Translating physical/linear address to virtual address
  2015-10-03  4:04   ` Martin Ichilevici de Oliveira
@ 2015-10-03  4:29     ` Ruben Safir
  0 siblings, 0 replies; 3+ messages in thread
From: Ruben Safir @ 2015-10-03  4:29 UTC (permalink / raw)
  To: kernelnewbies

On 10/03/2015 12:04 AM, Martin Ichilevici de Oliveira wrote:
> My goal is to use this data to make informed decisions on pages
> distribution in NUMA machines (with libnuma). The problem is that, as
> far as I understood, physical and linear addresses won't necessarily be
> the same between runs of the same program. Virtual addresses, on the
> other hand, can be made to be consistent (by turning address space layout
> randomization off).
> 
> Using virtual addresses also have the advantage that I can do all memory
> management in userspace, with libnuma.


Your not really understanding some basic architectural problems.  Memory
is shifted from segment to segment, the OS has paging, the hardware
hides memory addressing as well, and then there is DME.  How the
motherboard chips lays out and allows access to memory segments is not
something that can be manually controlled, even by the OS because it is
firmware driven.

I'm not saying that what you are doing is impossible, but it doesn't
sound like you approach is likely to work.


http://www.nylxs.com/docs/grad_school/arch/memory.pdf

http://www.nylxs.com/docs/grad_school/arch/

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

end of thread, other threads:[~2015-10-03  4:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-02 19:58 Translating physical/linear address to virtual address martin
     [not found] ` <CAK7N6vpy3g022b+Au_uQqAEF4aK3g24702VcFnvxXCeJVe8SLw@mail.gmail.com>
2015-10-03  4:04   ` Martin Ichilevici de Oliveira
2015-10-03  4:29     ` Ruben Safir

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.