* kvm_regs vs kvm_sregs?
@ 2007-03-16 15:00 Hollis Blanchard
2007-03-18 5:13 ` Avi Kivity
0 siblings, 1 reply; 3+ messages in thread
From: Hollis Blanchard @ 2007-03-16 15:00 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
What is the distinction between kvm_regs and kvm_sregs? As far as I can
see, kvm_regs is only used when emulating IO, emulating MMIO, and
emulating CPUID, where guest GPRs are directly modified. kvm_sregs is
only used for full CPU state save (for later restore).
When the kernel had to use copy_to_user() to transfer state to userland,
I can see that this split resulted in less memory copying. However, now
that userland can directly map register state without a copy, why not
combine the two structures?
I guess it takes longer to copy state out of the VMCS into kvm_sregs, so
why bother if userspace isn't going to use it?
-Hollis
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: kvm_regs vs kvm_sregs?
2007-03-16 15:00 kvm_regs vs kvm_sregs? Hollis Blanchard
@ 2007-03-18 5:13 ` Avi Kivity
[not found] ` <45FCCA6D.3070207-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2007-03-18 5:13 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Hollis Blanchard wrote:
> What is the distinction between kvm_regs and kvm_sregs? As far as I can
> see, kvm_regs is only used when emulating IO, emulating MMIO, and
> emulating CPUID, where guest GPRs are directly modified. kvm_sregs is
> only used for full CPU state save (for later restore).
>
After the userspace interface changes, neither of them are used except
for migration, savevm/loadvm, and debugging. Theoretically they could be
unified, practically SET_SREGS is a dangerous operation on Intel cpus
due to kvm's very imperfect real mode support.
> When the kernel had to use copy_to_user() to transfer state to userland,
> I can see that this split resulted in less memory copying. However, now
> that userland can directly map register state without a copy, why not
> combine the two structures?
>
We don't map the register state as that would require us to sync it on
every exit.
> I guess it takes longer to copy state out of the VMCS into kvm_sregs, so
> why bother if userspace isn't going to use it?
>
When it's needed, it's really needed. Or did I misunderstand the question?
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: kvm_regs vs kvm_sregs?
[not found] ` <45FCCA6D.3070207-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-03-23 1:17 ` Hollis Blanchard
0 siblings, 0 replies; 3+ messages in thread
From: Hollis Blanchard @ 2007-03-23 1:17 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Sun, 2007-03-18 at 07:13 +0200, Avi Kivity wrote:
> Hollis Blanchard wrote:
> > What is the distinction between kvm_regs and kvm_sregs? As far as I can
> > see, kvm_regs is only used when emulating IO, emulating MMIO, and
> > emulating CPUID, where guest GPRs are directly modified. kvm_sregs is
> > only used for full CPU state save (for later restore).
> >
>
> After the userspace interface changes, neither of them are used except
> for migration, savevm/loadvm, and debugging. Theoretically they could be
> unified, practically SET_SREGS is a dangerous operation on Intel cpus
> due to kvm's very imperfect real mode support.
>
> > When the kernel had to use copy_to_user() to transfer state to userland,
> > I can see that this split resulted in less memory copying. However, now
> > that userland can directly map register state without a copy, why not
> > combine the two structures?
> >
>
> We don't map the register state as that would require us to sync it on
> every exit.
>
> > I guess it takes longer to copy state out of the VMCS into kvm_sregs, so
> > why bother if userspace isn't going to use it?
> >
>
> When it's needed, it's really needed. Or did I misunderstand the question?
I guess I misunderstood. I thought the mmap was for userspace to access
kvm_regs, which previously was needed when emulating IO.
Apparently this is no longer the case: instead the data is copied
somewhere into mmap space and then complete_pio() is responsible for
loading that raw data into the guest register state.
Seems a bit more convoluted, but I guess you've managed to divorce user
and kernel data structures, if that was the goal.
-Hollis
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-23 1:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-16 15:00 kvm_regs vs kvm_sregs? Hollis Blanchard
2007-03-18 5:13 ` Avi Kivity
[not found] ` <45FCCA6D.3070207-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-03-23 1:17 ` Hollis Blanchard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox