Skip to contentSkip to conversation

State of current pv_ops backend for KVM?

DISCUSSION Anthony Liguori 6 participants 15 messages May 29, 2007 – May 30, 2007 11 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

Regards,

Anthony Liguori

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 9 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

feel free to pick up the stuff i did - i'm somewhat "distracted" by the CFS scheduler at the moment :) You can find it at:

http://redhat.com/~mingo/kvm-paravirt-patches/kvm-patches.tar.gz

(it has some trivial cleanliness issues and a handful of -rt specific things, plus it's against an older kernel)

later on i'll join the fun too :)

Ingo

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 4 lines · Ingo Molnar

feel free to pick up the stuff i did - i'm somewhat "distracted" by the CFS scheduler at the moment :) You can find it at:

http://redhat.com/~mingo/kvm-paravirt-patches/kvm-patches.tar.gz

and that's all under the GPL of course.

Ingo

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

I think we should aim for a full direct paging implementation, where the cr3 cache is just the cherry on top that makes context switches proceed at native speed. Jun has a paper on it for OLS and I hope patches too.

A minor drawback with direct paging is that you are more or less forced to use pae on the guest, but I think that's acceptable.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 465C12C0.9030906-atKUWr5tajBWk0Htik3J/[email protected]

#7 lore raw
Quoted 7 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Quoted 8 lines
Quoted 3 lines

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

I think we should aim for a full direct paging implementation, where the cr3 cache is just the cherry on top that makes context switches proceed at native speed. Jun has a paper on it for OLS and I hope patches too.

That's a bit more ambitious than I was thinking. I would be very happy with a pv timer, interrupt controller, and some basic CPU optimizations. I'm still not convinced the perf benefits of direct paging justify the annoyances that come with it (guests being aware of pfns). This is especially true with NPT/EPT right around the corner.

Regards,

Anthony Liguori

Quoted 3 lines

A minor drawback with direct paging is that you are more or less forced to use pae on the guest, but I think that's acceptable.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 17 lines · Anthony Liguori
Quoted 7 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Quoted 8 lines
Quoted 3 lines

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

I think we should aim for a full direct paging implementation, where the cr3 cache is just the cherry on top that makes context switches proceed at native speed. Jun has a paper on it for OLS and I hope patches too.

Quoted 5 lines

That's a bit more ambitious than I was thinking. I would be very happy with a pv timer, interrupt controller, and some basic CPU optimizations. I'm still not convinced the perf benefits of direct paging justify the annoyances that come with it (guests being aware of pfns).

I thought that with paravirt_ops, all the awareness is limited to the paravirt implementation, and nothing in the core kernel is actually aware of host pfns.

pv timer and interrupt controller make a lot of sense, especially if steal timer functionality is included.

Quoted 1 line

This is especially true with NPT/EPT right around the corner.

It depends on the workload. It was advanced (by Ingo) that NPT/EPT increase the tlb miss latency, which is important for steady-state workloads, whereas shadow and direct paging do not. It will be interesting to measure this.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 465C31F2.8080007-atKUWr5tajBWk0Htik3J/[email protected]

#11 lore raw
Quoted 24 lines · Avi Kivity
Quoted 17 lines · Anthony Liguori
Quoted 7 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Quoted 8 lines
Quoted 3 lines

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

I think we should aim for a full direct paging implementation, where the cr3 cache is just the cherry on top that makes context switches proceed at native speed. Jun has a paper on it for OLS and I hope patches too.

Quoted 5 lines

That's a bit more ambitious than I was thinking. I would be very happy with a pv timer, interrupt controller, and some basic CPU optimizations. I'm still not convinced the perf benefits of direct paging justify the annoyances that come with it (guests being aware of pfns).

Quoted 3 lines

I thought that with paravirt_ops, all the awareness is limited to the paravirt implementation, and nothing in the core kernel is actually aware of host pfns.

The pv_ops implementation still has to deal with guest pfn => host pfn translation. This means that a guest has to be put into a special mode for save/restore/migrate to work to ensure that no host pfn's are on the stack or in registers. Changing save/restore/migration to from guest-transparent to guest-interactive is a big loss to me.

Quoted 2 lines

pv timer and interrupt controller make a lot of sense, especially if steal timer functionality is included.

Yup :-)

Quoted 6 lines
Quoted 1 line

This is especially true with NPT/EPT right around the corner.

It depends on the workload. It was advanced (by Ingo) that NPT/EPT increase the tlb miss latency, which is important for steady-state workloads, whereas shadow and direct paging do not. It will be interesting to measure this.

There will most certainly be trade-offs, but I certainly don't expect direct paging to beat out NPT/EPT in certain areas.

Regards,

Anthony Liguori

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 10 lines
Quoted 6 lines

That's a bit more ambitious than I was thinking. I would be very happy with a pv timer, interrupt controller, and some basic CPU optimizations. I'm still not convinced the perf benefits of direct paging justify the annoyances that come with it (guests being aware of pfns).

I thought that with paravirt_ops, all the awareness is limited to the paravirt implementation, and nothing in the core kernel is actually aware of host pfns.

Quoted 5 lines

The pv_ops implementation still has to deal with guest pfn => host pfn translation. This means that a guest has to be put into a special mode for save/restore/migrate to work to ensure that no host pfn's are on the stack or in registers. Changing save/restore/migration to from guest-transparent to guest-interactive is a big loss to me.

I think it can be done without guest awareness, by having a special code section where the translation is done. The hypervisor can choose not to transfer control when rip points there.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

This is especially true with NPT/EPT right around the corner.

It depends on the workload. It was advanced (by Ingo) that NPT/EPT increase the tlb miss latency, which is important for steady-state workloads, whereas shadow and direct paging do not. It will be interesting to measure this.

There will most certainly be trade-offs, but I certainly don't expect direct paging to beat out NPT/EPT in certain areas.

Sure. Like I said, we'll need measurements to decide this.

Signature · 8 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
#14 lore raw
In reply to a message not in the archive
Quoted 13 lines · Avi Kivity
Quoted 11 lines · Anthony Liguori
Quoted 4 lines · Avi Kivity

I think we should aim for a full direct paging implementation, where the cr3 cache is just the cherry on top that makes context switches proceed at native speed. Jun has a paper on it for OLS and I hope patches too.

That's a bit more ambitious than I was thinking. I would be very happy with a pv timer, interrupt controller, and some basic CPU optimizations. I'm still not convinced the perf benefits of direct paging justify the annoyances that come with it (guests being aware of pfns).

Quoted 3 lines

I thought that with paravirt_ops, all the awareness is limited to the paravirt implementation, and nothing in the core kernel is actually aware of host pfns.

It is, but now you've broken the abstraction you get other messes. You can no longer simply swap out pages behind the guest's back, copy on write or combine identical pages or other tricks without synchronizing with the guest.

It can be done, but it's not clear to me that verifying PTEs is that much faster than shadowing them if you're prepared to be that invasive in the guest anyway.

Cheers,
Rusty.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 1180492544.30202.72.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#16 lore raw
Quoted 22 lines · Rusty Russell
Quoted 15 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity

I think we should aim for a full direct paging implementation, where the cr3 cache is just the cherry on top that makes context switches proceed at native speed. Jun has a paper on it for OLS and I hope patches too.

Quoted 6 lines

That's a bit more ambitious than I was thinking. I would be very happy with a pv timer, interrupt controller, and some basic CPU optimizations. I'm still not convinced the perf benefits of direct paging justify the annoyances that come with it (guests being aware of pfns).

Quoted 4 lines

I thought that with paravirt_ops, all the awareness is limited to the paravirt implementation, and nothing in the core kernel is actually aware of host pfns.

Quoted 6 lines

It is, but now you've broken the abstraction you get other messes. You can no longer simply swap out pages behind the guest's back, copy on write or combine identical pages or other tricks without synchronizing with the guest.

These are good points.

Quoted 1 line

It can be done,

Maybe we'll get something from the s390 port.

Quoted 4 lines

but it's not clear to me that verifying PTEs is that
much faster than shadowing them if you're prepared to be that invasive in the guest anyway.

This can probably be measured on Xen which can switch from direct to shadow mode on runtime.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 465D051F.20706-atKUWr5tajBWk0Htik3J/[email protected]

#18 lore raw
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Rusty Russell

but it's not clear to me that verifying PTEs is that
much faster than shadowing them if you're prepared to be that invasive in the guest anyway.

This can probably be measured on Xen which can switch from direct to shadow mode on runtime.

Sorry, I was a little oblique here. The Xen shadow mode code is aimed at supporting full virtualization, so it's not really a fair comparison.

Their direct page access code hooks deep into the guest; the outstanding question is how efficient would a shadow implementation which made similar guest changes be?

Unfortunately, there's a lot of coding between here and the answer 8)

Rusty.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

#19 lore raw
In reply to a message not in the archive
Quoted 9 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

"Me too". It's at least worth toying with the mmu batching stuff to see if that can shave some cycles there: it seems that cr3 caching is the main win for context switch so batching there won't help.

IIRC Ingo used a magic MSR to detect kvm, and there was a question mark over that. VMI uses a different technique, which is probably worth considering...

Cheers,
Rusty.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): 1180491861.30202.61.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

#21 lore raw
Quoted 8 lines · Rusty Russell
Quoted 6 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Quoted 9 lines
Quoted 4 lines

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

"Me too". It's at least worth toying with the mmu batching stuff to see if that can shave some cycles there: it seems that cr3 caching is the main win for context switch so batching there won't help.

I'm working on a simple patch that just adds the infrastructure.

Quoted 2 lines

IIRC Ingo used a magic MSR to detect kvm, and there was a question mark over that.

I am not too worried about using an MSR. There's really no fool proof method here. The only thing to do IMHO is move the kvm pv_ops backend into a separate file and add appropriate Kconfig stuff.

Quoted 3 lines

VMI uses a different technique, which is probably worth
considering...

VMI can determine that it's under VMware since VMware has to publish an option ROM. It's quite neat, but overkill for what we're doing (since we're not going to be using a ROM anyway).

Regards,

Anthony Liguori

Quoted 5 lines

Cheers,
Rusty.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#23 lore raw
Quoted 28 lines · Anthony Liguori
Quoted 8 lines · Rusty Russell
Quoted 6 lines · Anthony Liguori

Howdy,

Does anyone know what the state of a pv_ops backend for KVM is? I know Ingo has an implementation that implements CR3 caching but I don't see any branches in Avi's git tree.

Quoted 9 lines
Quoted 4 lines

Perhaps we should try for a simple pv_ops backend for 2.6.23 seeing as how the host infrastructure is there? I'd be willing to do some leg work here...

"Me too". It's at least worth toying with the mmu batching stuff to see if that can shave some cycles there: it seems that cr3 caching is the main win for context switch so batching there won't help.

I'm working on a simple patch that just adds the infrastructure.

Quoted 2 lines

IIRC Ingo used a magic MSR to detect kvm, and there was a question mark over that.

I am not too worried about using an MSR. There's really no fool proof method here. The only thing to do IMHO is move the kvm pv_ops backend into a separate file and add appropriate Kconfig stuff.

Quoted 7 lines
Quoted 3 lines

VMI uses a different technique, which is probably worth
considering...

VMI can determine that it's under VMware since VMware has to publish an option ROM. It's quite neat, but overkill for what we're doing (since we're not going to be using a ROM anyway).

The near to being blessed way to do this is to use a CPUID leaf (I believe it is 0x40000000) to identify the hypervisor. I don't have the exact details, but making CPUID 0x40000000 return 'KVMKVMKVMKVM' sounds like a pretty safe detection technique.

We're probably dropping the ROM probing in favor of this for 64-bit.

Zach

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#25 lore raw
Quoted 8 lines · Zachary Amsden
Quoted 3 lines

VMI can determine that it's under VMware since VMware has to publish an option ROM. It's quite neat, but overkill for what we're doing (since we're not going to be using a ROM anyway).

The near to being blessed way to do this is to use a CPUID leaf (I believe it is 0x40000000) to identify the hypervisor. I don't have the exact details, but making CPUID 0x40000000 return 'KVMKVMKVMKVM' sounds like a pretty safe detection technique.

I apparently missed the memo :-) I'll update the patch.

Regards,

Anthony Liguori

Quoted 5 lines

We're probably dropping the ROM probing in favor of this for 64-bit.

Zach

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/