qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU?
@ 2011-03-08 17:30 Gunasekaran Dharman
  2011-03-08 19:00 ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Gunasekaran Dharman @ 2011-03-08 17:30 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

>From guest application, Iam passing some virtual addresses to QEMU through
device I/O operation. Now I want to convert these guest virtual addresses to
host virtual addresses so that I can perform some operation using them. In
QEMU, is there any macro or function available to convert guest virtual
address to host virtual address?
My objective is to perform guest's memcpy operation in host so that it will
be faster.

Regards
Guna

[-- Attachment #2: Type: text/html, Size: 500 bytes --]

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

* Re: [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU?
  2011-03-08 17:30 [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU? Gunasekaran Dharman
@ 2011-03-08 19:00 ` Stefan Hajnoczi
  2011-03-09  9:34   ` Gunasekaran Dharman
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2011-03-08 19:00 UTC (permalink / raw)
  To: Gunasekaran Dharman; +Cc: qemu-devel

On Tue, Mar 8, 2011 at 5:30 PM, Gunasekaran Dharman <guna.spam@gmail.com> wrote:
> From guest application, Iam passing some virtual addresses to QEMU through
> device I/O operation. Now I want to convert these guest virtual addresses to
> host virtual addresses so that I can perform some operation using them. In
> QEMU, is there any macro or function available to convert guest virtual
> address to host virtual address?
> My objective is to perform guest's memcpy operation in host so that it will
> be faster.

That's not really possible.  On architectures with a software-managed
TLB you don't know the layout of the virtual memory structures
(because they are defined in software and not standardized).

I suggest learning about and optimizing TCG instead of inventing a
memcpy device because it can benefit all code and does not require a
custom device and guest drivers.

Stefan

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

* Re: [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU?
  2011-03-08 19:00 ` Stefan Hajnoczi
@ 2011-03-09  9:34   ` Gunasekaran Dharman
  2011-03-09 11:27     ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Gunasekaran Dharman @ 2011-03-09  9:34 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1432 bytes --]

Hi Stefan

Thanks for the reply.
Sure, I will look into TCG for improvement as a long term plan.
But for now, I have to solve this memcpy performance issue.

Regarding calculating host virtual address from guest virtual address, I
think, QEMU must be doing this somehow.
I would like to know how QEMU is handling the guest virtual address?
It will be very much helpful if you can throw some light on this.

Regards
Guna

On Wed, Mar 9, 2011 at 12:30 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:

>  On Tue, Mar 8, 2011 at 5:30 PM, Gunasekaran Dharman <guna.spam@gmail.com>
> wrote:
> > From guest application, Iam passing some virtual addresses to QEMU
> through
> > device I/O operation. Now I want to convert these guest virtual addresses
> to
> > host virtual addresses so that I can perform some operation using them.
> In
> > QEMU, is there any macro or function available to convert guest virtual
> > address to host virtual address?
> > My objective is to perform guest's memcpy operation in host so that it
> will
> > be faster.
>
> That's not really possible.  On architectures with a software-managed
> TLB you don't know the layout of the virtual memory structures
> (because they are defined in software and not standardized).
>
> I suggest learning about and optimizing TCG instead of inventing a
> memcpy device because it can benefit all code and does not require a
> custom device and guest drivers.
>
> Stefan
>

[-- Attachment #2: Type: text/html, Size: 1998 bytes --]

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

* Re: [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU?
  2011-03-09  9:34   ` Gunasekaran Dharman
@ 2011-03-09 11:27     ` Stefan Hajnoczi
  2011-03-10  6:39       ` Gunasekaran Dharman
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2011-03-09 11:27 UTC (permalink / raw)
  To: Gunasekaran Dharman; +Cc: qemu-devel

On Wed, Mar 9, 2011 at 9:34 AM, Gunasekaran Dharman <guna.spam@gmail.com> wrote:
> Regarding calculating host virtual address from guest virtual address, I
> think, QEMU must be doing this somehow.
> I would like to know how QEMU is handling the guest virtual address?
> It will be very much helpful if you can throw some light on this.

Sorry but I've tried to explain twice that this approach is not the
way to go.  The hardware does not necessarily know how to translate
any virtual address by itself and QEMU doesn't either, guest
assistance may be required.  It's not as simple as handing a (kernel
or userspace?) virtual address to a custom device and having it
perform a memcpy.

If you really want to do a custom hack try adding a custom memcpy
instruction and look at how x86 targets rep; mov or other instances of
memory copy on other architectures are done.  You'll need to write a
custom memcpy implementation in the guest to make use of this
function.

Stefan

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

* Re: [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU?
  2011-03-09 11:27     ` Stefan Hajnoczi
@ 2011-03-10  6:39       ` Gunasekaran Dharman
  0 siblings, 0 replies; 5+ messages in thread
From: Gunasekaran Dharman @ 2011-03-10  6:39 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

Hi Stefan

Thanks for your valuable suggestion.

I will try the custom memcpy instruction. I have a question regarding
virtual machine's CPU frequency.
Compared to real processor how QEMU is emulating the processor speed?
Can we configure the virtual machine's CPU frequency? If yes, what are the
limitations and impact
of changing the CPU frequency.

Regards
Guna


On Wed, Mar 9, 2011 at 4:57 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:

> On Wed, Mar 9, 2011 at 9:34 AM, Gunasekaran Dharman <guna.spam@gmail.com>
> wrote:
> > Regarding calculating host virtual address from guest virtual address, I
> > think, QEMU must be doing this somehow.
> > I would like to know how QEMU is handling the guest virtual address?
> > It will be very much helpful if you can throw some light on this.
>
> Sorry but I've tried to explain twice that this approach is not the
> way to go.  The hardware does not necessarily know how to translate
> any virtual address by itself and QEMU doesn't either, guest
> assistance may be required.  It's not as simple as handing a (kernel
> or userspace?) virtual address to a custom device and having it
> perform a memcpy.
>
> If you really want to do a custom hack try adding a custom memcpy
> instruction and look at how x86 targets rep; mov or other instances of
> memory copy on other architectures are done.  You'll need to write a
> custom memcpy implementation in the guest to make use of this
> function.
>
> Stefan
>

[-- Attachment #2: Type: text/html, Size: 2009 bytes --]

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

end of thread, other threads:[~2011-03-10  6:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-08 17:30 [Qemu-devel] how to convert guest virtual address to host virtual address in QEMU? Gunasekaran Dharman
2011-03-08 19:00 ` Stefan Hajnoczi
2011-03-09  9:34   ` Gunasekaran Dharman
2011-03-09 11:27     ` Stefan Hajnoczi
2011-03-10  6:39       ` Gunasekaran Dharman

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).