All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Which functions writes to memory?
@ 2010-04-16  5:56 Jun Koi
  2010-04-16  6:17 ` malc
  0 siblings, 1 reply; 6+ messages in thread
From: Jun Koi @ 2010-04-16  5:56 UTC (permalink / raw)
  To: qemu-devel

Hi,

I am writing a small tool to trace all the activities that write to an
area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below
macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions,
I believe that Qemu has another code writing data to memory, which
happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using
above function?

The memory area I am tracking for written events belong to normal area
in OS kernel, where usually only normal code (kernel, not something
like SMM handler)  write to.

Thanks a lot,
Jun

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

* Re: [Qemu-devel] Which functions writes to memory?
  2010-04-16  5:56 [Qemu-devel] Which functions writes to memory? Jun Koi
@ 2010-04-16  6:17 ` malc
  2010-04-16  6:38   ` Jun Koi
  0 siblings, 1 reply; 6+ messages in thread
From: malc @ 2010-04-16  6:17 UTC (permalink / raw)
  To: Jun Koi; +Cc: qemu-devel

On Fri, 16 Apr 2010, Jun Koi wrote:

> Hi,
> 
> I am writing a small tool to trace all the activities that write to an
> area of (virtual) memory in Qemu.
> I am currently doing that by putting my code at the top of the below
> macro in softmmu_header.h
> 
> static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....
> 
> However, it seems I still miss some written events: in some occasions,
> I believe that Qemu has another code writing data to memory, which
> happens even before this macro.
> Is it true that elsewhere, Qemu also writes into memory besides using
> above function?
> 
> The memory area I am tracking for written events belong to normal area
> in OS kernel, where usually only normal code (kernel, not something
> like SMM handler)  write to.

Once the TLB is properly set up st helpers are bypassed entirely and
tcg generated code writes to it directly, it's quite easy to "workaround"
that at the expense of much slower execution.

-- 
mailto:av1474@comtv.ru

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

* Re: [Qemu-devel] Which functions writes to memory?
  2010-04-16  6:17 ` malc
@ 2010-04-16  6:38   ` Jun Koi
  2010-04-16  6:50     ` malc
  0 siblings, 1 reply; 6+ messages in thread
From: Jun Koi @ 2010-04-16  6:38 UTC (permalink / raw)
  To: malc; +Cc: qemu-devel

On Fri, Apr 16, 2010 at 3:17 PM, malc <av1474@comtv.ru> wrote:
> On Fri, 16 Apr 2010, Jun Koi wrote:
>
>> Hi,
>>
>> I am writing a small tool to trace all the activities that write to an
>> area of (virtual) memory in Qemu.
>> I am currently doing that by putting my code at the top of the below
>> macro in softmmu_header.h
>>
>> static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....
>>
>> However, it seems I still miss some written events: in some occasions,
>> I believe that Qemu has another code writing data to memory, which
>> happens even before this macro.
>> Is it true that elsewhere, Qemu also writes into memory besides using
>> above function?
>>
>> The memory area I am tracking for written events belong to normal area
>> in OS kernel, where usually only normal code (kernel, not something
>> like SMM handler)  write to.
>
> Once the TLB is properly set up st helpers are bypassed entirely and
> tcg generated code writes to it directly, it's quite easy to "workaround"
> that at the expense of much slower execution.
>

This saves me a lot of frustrated time, thanks!

Now I can see that tcg code calls to __stb*_mmu(), but cannot find any
code call to st*_mmu().
Do you have any hint?

Thanks a lot,
J

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

* Re: [Qemu-devel] Which functions writes to memory?
  2010-04-16  6:38   ` Jun Koi
@ 2010-04-16  6:50     ` malc
  2010-04-16  6:59       ` Jun Koi
  0 siblings, 1 reply; 6+ messages in thread
From: malc @ 2010-04-16  6:50 UTC (permalink / raw)
  To: Jun Koi; +Cc: qemu-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1456 bytes --]

On Fri, 16 Apr 2010, Jun Koi wrote:

> On Fri, Apr 16, 2010 at 3:17 PM, malc <av1474@comtv.ru> wrote:
> > On Fri, 16 Apr 2010, Jun Koi wrote:
> >
> >> Hi,
> >>
> >> I am writing a small tool to trace all the activities that write to an
> >> area of (virtual) memory in Qemu.
> >> I am currently doing that by putting my code at the top of the below
> >> macro in softmmu_header.h
> >>
> >> static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....
> >>
> >> However, it seems I still miss some written events: in some occasions,
> >> I believe that Qemu has another code writing data to memory, which
> >> happens even before this macro.
> >> Is it true that elsewhere, Qemu also writes into memory besides using
> >> above function?
> >>
> >> The memory area I am tracking for written events belong to normal area
> >> in OS kernel, where usually only normal code (kernel, not something
> >> like SMM handler)  write to.
> >
> > Once the TLB is properly set up st helpers are bypassed entirely and
> > tcg generated code writes to it directly, it's quite easy to "workaround"
> > that at the expense of much slower execution.
> >
> 
> This saves me a lot of frustrated time, thanks!
> 
> Now I can see that tcg code calls to __stb*_mmu(), but cannot find any
> code call to st*_mmu().
> Do you have any hint?

The tcg generated code fetches appropriate helper's address from the
qemu_st/ld_helpers array and calls it indirectly.

-- 
mailto:av1474@comtv.ru

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

* Re: [Qemu-devel] Which functions writes to memory?
  2010-04-16  6:50     ` malc
@ 2010-04-16  6:59       ` Jun Koi
  2010-04-16  8:15         ` malc
  0 siblings, 1 reply; 6+ messages in thread
From: Jun Koi @ 2010-04-16  6:59 UTC (permalink / raw)
  To: malc; +Cc: qemu-devel

2010/4/16 malc <av1474@comtv.ru>:
> On Fri, 16 Apr 2010, Jun Koi wrote:
>
>> On Fri, Apr 16, 2010 at 3:17 PM, malc <av1474@comtv.ru> wrote:
>> > On Fri, 16 Apr 2010, Jun Koi wrote:
>> >
>> >> Hi,
>> >>
>> >> I am writing a small tool to trace all the activities that write to an
>> >> area of (virtual) memory in Qemu.
>> >> I am currently doing that by putting my code at the top of the below
>> >> macro in softmmu_header.h
>> >>
>> >> static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....
>> >>
>> >> However, it seems I still miss some written events: in some occasions,
>> >> I believe that Qemu has another code writing data to memory, which
>> >> happens even before this macro.
>> >> Is it true that elsewhere, Qemu also writes into memory besides using
>> >> above function?
>> >>
>> >> The memory area I am tracking for written events belong to normal area
>> >> in OS kernel, where usually only normal code (kernel, not something
>> >> like SMM handler)  write to.
>> >
>> > Once the TLB is properly set up st helpers are bypassed entirely and
>> > tcg generated code writes to it directly, it's quite easy to "workaround"
>> > that at the expense of much slower execution.
>> >
>>
>> This saves me a lot of frustrated time, thanks!
>>
>> Now I can see that tcg code calls to __stb*_mmu(), but cannot find any
>> code call to st*_mmu().
>> Do you have any hint?
>
> The tcg generated code fetches appropriate helper's address from the
> qemu_st/ld_helpers array and calls it indirectly.

Sorry if that was not clear, but my question is: which code called
st*mmu() macros (in softmmu_header.h)

I searched around everywhere, but dont see which calls these macros.

Thanks,
J

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

* Re: [Qemu-devel] Which functions writes to memory?
  2010-04-16  6:59       ` Jun Koi
@ 2010-04-16  8:15         ` malc
  0 siblings, 0 replies; 6+ messages in thread
From: malc @ 2010-04-16  8:15 UTC (permalink / raw)
  To: Jun Koi; +Cc: qemu-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1955 bytes --]

On Fri, 16 Apr 2010, Jun Koi wrote:

> 2010/4/16 malc <av1474@comtv.ru>:
> > On Fri, 16 Apr 2010, Jun Koi wrote:
> >
> >> On Fri, Apr 16, 2010 at 3:17 PM, malc <av1474@comtv.ru> wrote:
> >> > On Fri, 16 Apr 2010, Jun Koi wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> I am writing a small tool to trace all the activities that write to an
> >> >> area of (virtual) memory in Qemu.
> >> >> I am currently doing that by putting my code at the top of the below
> >> >> macro in softmmu_header.h
> >> >>
> >> >> static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....
> >> >>
> >> >> However, it seems I still miss some written events: in some occasions,
> >> >> I believe that Qemu has another code writing data to memory, which
> >> >> happens even before this macro.
> >> >> Is it true that elsewhere, Qemu also writes into memory besides using
> >> >> above function?
> >> >>
> >> >> The memory area I am tracking for written events belong to normal area
> >> >> in OS kernel, where usually only normal code (kernel, not something
> >> >> like SMM handler)  write to.
> >> >
> >> > Once the TLB is properly set up st helpers are bypassed entirely and
> >> > tcg generated code writes to it directly, it's quite easy to "workaround"
> >> > that at the expense of much slower execution.
> >> >
> >>
> >> This saves me a lot of frustrated time, thanks!
> >>
> >> Now I can see that tcg code calls to __stb*_mmu(), but cannot find any
> >> code call to st*_mmu().
> >> Do you have any hint?
> >
> > The tcg generated code fetches appropriate helper's address from the
> > qemu_st/ld_helpers array and calls it indirectly.
> 
> Sorry if that was not clear, but my question is: which code called
> st*mmu() macros (in softmmu_header.h)
> 
> I searched around everywhere, but dont see which calls these macros.
> 

It's being called by automatically generated code, code generators for
various platforms leave in tcg/platform/tcg-target.c

-- 
mailto:av1474@comtv.ru

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

end of thread, other threads:[~2010-04-16  8:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-16  5:56 [Qemu-devel] Which functions writes to memory? Jun Koi
2010-04-16  6:17 ` malc
2010-04-16  6:38   ` Jun Koi
2010-04-16  6:50     ` malc
2010-04-16  6:59       ` Jun Koi
2010-04-16  8:15         ` malc

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.