* [Qemu-devel] Tracing guest memory accesses
@ 2006-12-17 3:42 Diwaker Gupta
2006-12-17 3:53 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Diwaker Gupta @ 2006-12-17 3:42 UTC (permalink / raw)
To: qemu-devel
Hi list,
I've searched the archives and the forums, but couldn't get a specific
solution (I think my search terms might have been too general).
Anyways, I think what I'm trying to do should be relatively easy and
hopefully experts here will be able to quickly point me in the right
direction :)
So I'm just trying to trace all the memory accesses (virtual
addresses) by the guest. I need to trace both reads and writes. If I
can get the exact address, thats great. Otherwise I'm happy with
simply logging the relevant page.
I've uncommented DEBUG_IOMMU in hw/iommu.c and I've added some debug
statements to the io_read and io_write calls in softmmu_template.h. At
this point I have two questions:
o do these changes seem correct? As in, do they actually track the
read/write memory accesses done by the guest? I was concerned because
when I start a guest, I see a whole lot of writes and not as many
reads, which seems a little counter intuitive.
o are these changes complete? As in, are there other entry/exit points
in the code for memory accesses that I'm missing.
Thanks,
Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Tracing guest memory accesses
2006-12-17 3:42 [Qemu-devel] Tracing guest memory accesses Diwaker Gupta
@ 2006-12-17 3:53 ` Daniel Jacobowitz
2006-12-17 7:19 ` Diwaker Gupta
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-12-17 3:53 UTC (permalink / raw)
To: qemu-devel
On Sat, Dec 16, 2006 at 07:42:46PM -0800, Diwaker Gupta wrote:
> o do these changes seem correct? As in, do they actually track the
> read/write memory accesses done by the guest? I was concerned because
> when I start a guest, I see a whole lot of writes and not as many
> reads, which seems a little counter intuitive.
No. Those are I/O device accesses, not memory accesses. Look at the
softmmu code instead.
It may be easiest to add some new instrumentation in the translation
code for whatever target you're interested in.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Tracing guest memory accesses
2006-12-17 3:53 ` Daniel Jacobowitz
@ 2006-12-17 7:19 ` Diwaker Gupta
2006-12-17 11:52 ` maestro
0 siblings, 1 reply; 6+ messages in thread
From: Diwaker Gupta @ 2006-12-17 7:19 UTC (permalink / raw)
To: qemu-devel
On 12/16/06, Daniel Jacobowitz <drow@false.org> wrote:
> On Sat, Dec 16, 2006 at 07:42:46PM -0800, Diwaker Gupta wrote:
> > o do these changes seem correct? As in, do they actually track the
> > read/write memory accesses done by the guest? I was concerned because
> > when I start a guest, I see a whole lot of writes and not as many
> > reads, which seems a little counter intuitive.
>
> No. Those are I/O device accesses, not memory accesses. Look at the
> softmmu code instead.
Like I said, I did add some debugging code to softmmu_template.h. The
read/writes I'm seeing are being generated by that softmmu debugging
code, not the iommu code. Sorry if I wasn't clear. Is there some other
softmmu code I should be looking at?
> It may be easiest to add some new instrumentation in the translation
> code for whatever target you're interested in.
I'm just focusing on Linux i386. I'm only beginning to explore the
qemu source, so any pointer to files/functions I should look at will
be much appreciated!
TIA,
Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Tracing guest memory accesses
2006-12-17 7:19 ` Diwaker Gupta
@ 2006-12-17 11:52 ` maestro
2006-12-18 8:56 ` Diwaker Gupta
0 siblings, 1 reply; 6+ messages in thread
From: maestro @ 2006-12-17 11:52 UTC (permalink / raw)
To: qemu-devel
Am Samstag, den 16.12.2006, 23:19 -0800 schrieb Diwaker Gupta:
> On 12/16/06, Daniel Jacobowitz <drow@false.org> wrote:
> > On Sat, Dec 16, 2006 at 07:42:46PM -0800, Diwaker Gupta wrote:
> > > o do these changes seem correct? As in, do they actually track the
> > > read/write memory accesses done by the guest? I was concerned because
> > > when I start a guest, I see a whole lot of writes and not as many
> > > reads, which seems a little counter intuitive.
> >
> > No. Those are I/O device accesses, not memory accesses. Look at the
> > softmmu code instead.
>
> Like I said, I did add some debugging code to softmmu_template.h. The
> read/writes I'm seeing are being generated by that softmmu debugging
> code, not the iommu code. Sorry if I wasn't clear. Is there some other
> softmmu code I should be looking at?
as far as i remember i had to put the same code into softmmu_header.h to
get "correct" results.
i found it easiest to do this in the ld/st macros in these files (~6
places in code)
hope this helps
cheers
m.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Tracing guest memory accesses
2006-12-17 11:52 ` maestro
@ 2006-12-18 8:56 ` Diwaker Gupta
2006-12-18 19:49 ` maestro
0 siblings, 1 reply; 6+ messages in thread
From: Diwaker Gupta @ 2006-12-18 8:56 UTC (permalink / raw)
To: qemu-devel
> as far as i remember i had to put the same code into softmmu_header.h to
> get "correct" results.
> i found it easiest to do this in the ld/st macros in these files (~6
> places in code)
This probably sounds stupid but whats the best way to get debug
output? Due to the code generation magic qemu does, simply adding
printfs doesn't seem to work well. In particular, all my attempts to
add printfs to softmmu_header.h have resulted in broken builds. Are
there any global macros I should be using?
Thanks,
Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Tracing guest memory accesses
2006-12-18 8:56 ` Diwaker Gupta
@ 2006-12-18 19:49 ` maestro
0 siblings, 0 replies; 6+ messages in thread
From: maestro @ 2006-12-18 19:49 UTC (permalink / raw)
To: qemu-devel
Am Montag, den 18.12.2006, 00:56 -0800 schrieb Diwaker Gupta:
> > as far as i remember i had to put the same code into softmmu_header.h to
> > get "correct" results.
> > i found it easiest to do this in the ld/st macros in these files (~6
> > places in code)
>
> This probably sounds stupid but whats the best way to get debug
> output? Due to the code generation magic qemu does, simply adding
> printfs doesn't seem to work well. In particular, all my attempts to
> add printfs to softmmu_header.h have resulted in broken builds. Are
> there any global macros I should be using?
>
hello Diwaker!
you can always call a function that is defined extern that uses fprintf
et. al. i doubt it's the prettiest way but at least it works.
cheers
m.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-12-18 19:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-17 3:42 [Qemu-devel] Tracing guest memory accesses Diwaker Gupta
2006-12-17 3:53 ` Daniel Jacobowitz
2006-12-17 7:19 ` Diwaker Gupta
2006-12-17 11:52 ` maestro
2006-12-18 8:56 ` Diwaker Gupta
2006-12-18 19:49 ` maestro
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).