target-arm: Provide '-cpu host' when running KVM
cover target-arm: Provide '-cpu host' when running KVM
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing KVM_ARM_VCPU_INIT supports a new 'target' value KVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' with KVM_ARM_TARGET_CORTEX_A15.
In order to find out details of the vCPU so we can correctly set up our ARMCPU objects, we create a scratch VM and a single cpu within it; we can then use the existing "read registers" API to access the ID registers. We do this once at startup when we register the new QOM type.
('-cpu host' is also going to be useful for AArch64 because it gives us a path to providing KVM support without having to implement a model of a specific v8 CPU and all its system registers...)
Peter Maydell (2):
target-arm: Don't hardcode KVM target CPU to be A15
target-arm: Provide '-cpu host' when running KVM
target-arm/helper.c | 6 ++ target-arm/kvm.c | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 231 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
RFC 1/2 target-arm: Don't hardcode KVM target CPU to be A15
Instead of assuming that a KVM target CPU must always be a Cortex-A15 and hardcoding this in kvm_arch_init_vcpu(), look up the KVM_ARM_TARGET_* value based on the ARMCPU object type. This is slightly overengineered for a single supported CPU but provides a place to put support for future CPUs and for "-cpu host".
--- target-arm/kvm.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
target-arm/kvm.c +30 -2
@@ -70,6 +70,32 @@ static int compare_u64(const void *a, const void *b)return *(uint64_t *)a - *(uint64_t *)b; } +static bool kvm_arm_get_init_args (ARMCPU *cpu,struct kvm_vcpu_init *init) +{ +/* Fill in the kvm_vcpu_init struct appropriately for this CPU. +* Return true on success, false on failure (ie unsupported CPU). +*/ +Object *obj =OBJECT (cpu); +int i; +static const struct { +const char *name; +uint32_t target; + } kvm_cpus[] = { + {"cortex-a15-" TYPE_ARM_CPU ,KVM_ARM_TARGET_CORTEX_A15 }, + }; + +memset (init->features,0 ,sizeof (init->features)); + +for (i =0 ; i <ARRAY_SIZE (kvm_cpus); i++) { +if (object_dynamic_cast (obj, kvm_cpus[i].name)) { + init->target = kvm_cpus[i].target; +return true; + } + } + +return false; +} +int kvm_arch_init_vcpu (CPUState *cs) {struct kvm_vcpu_init init;
@@ -80,8 +106,10 @@ int kvm_arch_init_vcpu(CPUState *cs)struct kvm_reg_list *rlp;ARMCPU *cpu =ARM_CPU (cs); - init.target =KVM_ARM_TARGET_CORTEX_A15 ; -memset (init.features,0 ,sizeof (init.features)); +if (!kvm_arm_get_init_args (cpu, &init)) { +fprintf (stderr,"KVM is not supported for this guest CPU type\n" ); +return -EINVAL ; + } ret =kvm_vcpu_ioctl (cs,KVM_ARM_VCPU_INIT , &init);if (ret) {return ret;
Signature · 1 line
1.7.9.5
RFC 2/2 target-arm: Provide '-cpu host' when running KVM
In reply to Peter MaydellImplement '-cpu host' for ARM when we're using KVM, broadly in line with other KVM-supporting architectures.
--- target-arm/helper.c | 6 ++ target-arm/kvm.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+)
target-arm/helper.c +6 -0
@@ -1573,6 +1573,12 @@ void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf) (*cpu_fprintf)(f,"Available CPUs:\n" );g_slist_foreach (list, arm_cpu_list_entry, &s);g_slist_free (list); +#ifdef CONFIG_KVM +/* The 'host' CPU type is dynamically registered only if KVM is +* enabled, so we have to special-case it here: +*/ + (*cpu_fprintf)(f," host (only available in KVM mode)\n" ); +#endif } void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
target-arm/kvm.c +195 -0
213 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Quoted 5 lines · Peter Maydell
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
Quoted 7 lines
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing
KVM_ARM_VCPU_INITsupports a new 'target' valueKVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' withKVM_ARM_TARGET_CORTEX_A15.
How do you know what core specific registers QEMU can expect from this particular CPU? Imagine ARM changes the MMU implementation in the next ARMv8 CPU. With -cpu host you wouldn't be able to support gdbstub anymore, because you wouldn't know whether the MMU format is the old or the new one.
I really prefer the "probe the host, match it fuzzily with our own list, pick a specific own core" way of doing -cpu host. Then it's really only ever an alias and you don't have to worry about all these odd special cases.
Alex
Quoted 27 lines
In order to find out details of the vCPU so we can correctly set up our ARMCPU objects, we create a scratch VM and a single cpu within it; we can then use the existing "read registers" API to access the ID registers. We do this once at startup when we register the new QOM type.
('-cpu host' is also going to be useful for AArch64 because it gives us a path to providing KVM support without having to implement a model of a specific v8 CPU and all its system registers...)
Peter Maydell (2):
target-arm: Don't hardcode KVM target CPU to be A15
target-arm: Provide '-cpu host' when running KVM
target-arm/helper.c| 6 ++target-arm/kvm.c| 227 ++++++++++++++++++++++++++++++++++++++++++++++++++-2 files changed, 231 insertions(+), 2 deletions(-)Signature · 6 lines
1.7.9.5 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
Quoted 15 lines · Alexander Graf
Quoted 5 lines · Peter Maydell
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
Quoted 7 lines
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing
KVM_ARM_VCPU_INITsupports a new 'target' valueKVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' withKVM_ARM_TARGET_CORTEX_A15.
Quoted 5 lines
How do you know what core specific registers QEMU can expect from this particular CPU? Imagine ARM changes the MMU implementation in the next ARMv8 CPU. With -cpu host you wouldn't be able to support gdbstub anymore, because you wouldn't know whether the MMU format is the old or the new one.
Well, we're already there. A15 supports both classic page tables and LPAE.
You can discover which one is being used by inspecting the guest, and I'd fully expect future versions of the architecture to expose bits in the ID registers indicating the various supported extensions.
M.
Signature · 1 line
Fast, cheap, reliable. Pick two.
Quoted 22 lines · Marc Zyngier
Quoted 15 lines · Alexander Graf
Quoted 5 lines · Peter Maydell
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
Quoted 7 lines
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing
KVM_ARM_VCPU_INITsupports a new 'target' valueKVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' withKVM_ARM_TARGET_CORTEX_A15.Quoted 5 lines
How do you know what core specific registers QEMU can expect from this particular CPU? Imagine ARM changes the MMU implementation in the next ARMv8 CPU. With -cpu host you wouldn't be able to support gdbstub anymore, because you wouldn't know whether the MMU format is the old or the new one.
Quoted 5 lines
Well, we're already there. A15 supports both classic page tables and LPAE.
You can discover which one is being used by inspecting the guest, and I'd fully expect future versions of the architecture to expose bits in the ID registers indicating the various supported extensions.
Can you fetch those from user space? If so, we should probably create a "host" CPU type class on the fly from the host's ID registers that adjusts itself to the correct callbacks.
Alex
Quoted 26 lines · Alexander Graf
Quoted 24 lines · Marc Zyngier
Quoted 15 lines · Alexander Graf
Quoted 5 lines · Peter Maydell
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
Quoted 7 lines
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing
KVM_ARM_VCPU_INITsupports a new 'target' valueKVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' withKVM_ARM_TARGET_CORTEX_A15.Quoted 5 lines
How do you know what core specific registers QEMU can expect from this particular CPU? Imagine ARM changes the MMU implementation in the next ARMv8 CPU. With -cpu host you wouldn't be able to support gdbstub anymore, because you wouldn't know whether the MMU format is the old or the new one.
Well, we're already there. A15 supports both classic page tables and LPAE.
Quoted 7 lines
Quoted 3 lines
You can discover which one is being used by inspecting the guest, and I'd fully expect future versions of the architecture to expose bits in the ID registers indicating the various supported extensions.
Can you fetch those from user space? If so, we should probably create a "host" CPU type class on the fly from the host's ID registers that adjusts itself to the correct callbacks.
All the ID registers are available to userspace as part of the one-reg API. What the guest actually uses (for example classic vs LPAE) can be found out by looking at other registers (in this example SCTRL) that have to be exported anyway (at least for VM migration).
M.
Signature · 1 line
Fast, cheap, reliable. Pick two.
Quoted 31 lines · Marc Zyngier
Quoted 30 lines · Alexander Graf
Quoted 27 lines · Marc Zyngier
Quoted 15 lines · Alexander Graf
Quoted 5 lines · Peter Maydell
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
Quoted 7 lines
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing
KVM_ARM_VCPU_INITsupports a new 'target' valueKVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' withKVM_ARM_TARGET_CORTEX_A15.Quoted 5 lines
How do you know what core specific registers QEMU can expect from this particular CPU? Imagine ARM changes the MMU implementation in the next ARMv8 CPU. With -cpu host you wouldn't be able to support gdbstub anymore, because you wouldn't know whether the MMU format is the old or the new one.
Well, we're already there. A15 supports both classic page tables and LPAE.
You can discover which one is being used by inspecting the guest, and I'd fully expect future versions of the architecture to expose bits in the ID registers indicating the various supported extensions.
Quoted 5 lines
Quoted 3 lines
Can you fetch those from user space? If so, we should probably create a "host" CPU type class on the fly from the host's ID registers that adjusts itself to the correct callbacks.
All the ID registers are available to userspace as part of the one-reg API. What the guest actually uses (for example classic vs LPAE) can be found out by looking at other registers (in this example SCTRL) that have to be exported anyway (at least for VM migration).
So can we access those even when the vcpu hasn't been init'ed yet? If so, how about the following flow of things for -cpu host:
- QEMU fetches host target type via ioctl (how will this work for big-little?)
- QEMU fetches ID registers, feature flags, etc via one-reg (or are they also available via auxv?), puts them into its internal "this is my cpu type" fields for the cpu object / class.
- QEMU calls VCPU_INIT with the type it fetched via ioctl.
Or would it make sense to model it like it's done on x86 where we also filter feature flags in QEMU and KVM to make sure we only expose a compatible subset?
Alex
Quoted 5 lines · Alexander Graf
So can we access those even when the vcpu hasn't been init'ed yet? If so, how about the following flow of things for -cpu host:
- QEMU fetches host target type via ioctl (how will this work for big-little?)
- QEMU fetches ID registers, feature flags, etc via one-reg (or are they also available via auxv?), puts them into its internal "this is my cpu type" fields for the cpu object / class.
- QEMU callsVCPU_INITwith the type it fetched via ioctl.
Curiously enough this is pretty much exactly what this patch actually does (except we don't bother to actually stash the ID register values because we know they'll never be used).
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 5 lines · Alexander Graf
So can we access those even when the vcpu hasn't been init'ed yet? If so, how about the following flow of things for -cpu host:
- QEMU fetches host target type via ioctl (how will this work for big-little?)
- QEMU fetches ID registers, feature flags, etc via one-reg (or are they also available via auxv?), puts them into its internal "this is my cpu type" fields for the cpu object / class.
- QEMU callsVCPU_INITwith the type it fetched via ioctl.Curiously enough this is pretty much exactly what this patch actually does (except we don't bother to actually stash the ID register values because we know they'll never be used).
Heh, you mean I should read patches after 0/x too? :)
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from VCPU_INIT onwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.
I'm still puzzled on how this will work with BIG.little btw.
Alex
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Alex
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
-Christoffer
Quoted 25 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Quoted 7 lines
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
Alex
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 45 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
Quoted 4 lines
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Alex
Quoted 48 lines · Alexander Graf
Quoted 45 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
Quoted 7 lines
Quoted 4 lines
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
-Christoffer
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
if (cpu == host_cpu) {
vgic_version = get_host_vgic_version();
}
would be an example :). Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 11 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Quoted 4 lines
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
Alex
Quoted 1 line · Alexander Graf
Everything -cpu host does has to be reproducible without -cpu host,
This is in general not going to be possible (the obvious case being "QEMU doesn't know about the host CPU type at all", or in minor variants "QEMU knows about the host CPU type but QEMU's version has a slightly different feature set").
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 1 line · Alexander Graf
Everything -cpu host does has to be reproducible without -cpu host,
This is in general not going to be possible (the obvious case being "QEMU doesn't know about the host CPU type at all", or in minor variants "QEMU knows about the host CPU type but QEMU's version has a slightly different feature set").
That's a shortcoming in that particular version of QEMU then. The KVM interface still allows to do everything you could do with -cpu host with an explicit CPU define. If user space wants, it could write away the host CPU type and try to live migrate that machine to another machine then with the explicit target vcpu id.
Please keep in mind that we're talking about the generic KVM / user space interface here, not the actual QEMU implementation.
Alex
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {
vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 18 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 11 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Quoted 4 lines
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
Quoted 4 lines
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed
decision about which "best CPU target" value to return on any given new core, where TARGET_HOST may simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...
Disclaimer: I haven't really thought this through, just thinking out loud.
-Christoffer
Quoted 90 lines · Christoffer Dall
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {
vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 18 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 15 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
Quoted 6 lines
Quoted 3 lines
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed decision about which "best CPU target" value to return on any given new core
We have to make that decision internally anyways, because we have to choose some CPU target for the host one.
Quoted 4 lines
, where
TARGET_HOSTmay simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...
Yes.
target_vcpu_id = kvm_vm_ioctl(KVM_VM_GET_BEST_CPU_TARGET);
/* Old kernels only support A15 hosts */
if (target_vcpu_id < 0)
target_vcpu_id = VCPU_CORTEX_A15;
kvm_vcpu_ioctl(vcpu_fd, KVM_INIT_VCPU, target_vcpu_id);
Alex
Quoted 93 lines · Alexander Graf
Quoted 90 lines · Christoffer Dall
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {
vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 18 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 15 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed decision about which "best CPU target" value to return on any given new core
We have to make that decision internally anyways, because we have to choose some CPU target for the host one.
Are we sure that will always be the case? That's how it's structured now, yes, but maybe we can do something more intelligent (which is what I meant with "generic handling" below). It's a bit fuzzy for me to think about right now, but I just want to make sure we don't shoot ourselves in the foot with the choice of ABI.
Quoted 7 lines
Quoted 4 lines
, where
TARGET_HOSTmay simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...Yes.
Quoted 8 lines
target_vcpu_id=kvm_vm_ioctl(KVM_VM_GET_BEST_CPU_TARGET);/* Old kernels only support A15 hosts */
if (target_vcpu_id< 0)
target_vcpu_id=VCPU_CORTEX_A15;
kvm_vcpu_ioctl(vcpu_fd, KVM_INIT_VCPU, target_vcpu_id);
I get this part, but imagine the kernel not knowing the target_cpu id, but just passing through whatever the hardware gives you to the guest.
I'm not saying that's necessarily going to happen or that it would be a great thing, but do we want to prevent this from ever happening through our choice of ABI?
Quoted 101 lines · Christoffer Dall
Quoted 100 lines · Alexander Graf
Quoted 96 lines · Christoffer Dall
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 13 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 11 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Quoted 8 lines
Quoted 4 lines
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed decision about which "best CPU target" value to return on any given new core
Quoted 8 lines
Quoted 2 lines
We have to make that decision internally anyways, because we have to choose some CPU target for the host one.
Are we sure that will always be the case? That's how it's structured now, yes, but maybe we can do something more intelligent (which is what I meant with "generic handling" below). It's a bit fuzzy for me to think about right now, but I just want to make sure we don't shoot ourselves in the foot with the choice of ABI.
Exactly that cleverness is what I'd prefer to avoid, as it breaks reproducibility with cross-chip environments.
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
, where
TARGET_HOSTmay simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...Yes.
target_vcpu_id=kvm_vm_ioctl(KVM_VM_GET_BEST_CPU_TARGET);/* Old kernels only support A15 hosts */
if (target_vcpu_id< 0)
target_vcpu_id=VCPU_CORTEX_A15;
Quoted 5 lines
Quoted 2 lines
kvm_vcpu_ioctl(vcpu_fd, KVM_INIT_VCPU, target_vcpu_id);I get this part, but imagine the kernel not knowing the
target_cpuid, but just passing through whatever the hardware gives you to the guest.
Don't you have to handle core specific registers anyway?
Quoted 3 lines
I'm not saying that's necessarily going to happen or that it would be a great thing, but do we want to prevent this from ever happening through our choice of ABI?
I think so, yes. Can you run Linux on a core that hasn't been enabled? Why should you be able to run KVM on a core that hasn't been enabled? I'm not talking about QEMU here - that one should be happy to be ignorant. But the kernel side needs to know about the core either way, no?
Alex
Quoted 135 lines · Alexander Graf
Quoted 101 lines · Christoffer Dall
Quoted 100 lines · Alexander Graf
Quoted 96 lines · Christoffer Dall
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any
idea what a "host" style CPU is. It only knows how to report to QEMU
what the current host CPU would be, so that anything from VCPU_INIT
onwards is 100% identical regardless of whether the user said
-cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 13 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 11 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Quoted 8 lines
Quoted 4 lines
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed decision about which "best CPU target" value to return on any given new core
Quoted 8 lines
Quoted 2 lines
We have to make that decision internally anyways, because we have to choose some CPU target for the host one.
Are we sure that will always be the case? That's how it's structured now, yes, but maybe we can do something more intelligent (which is what I meant with "generic handling" below). It's a bit fuzzy for me to think about right now, but I just want to make sure we don't shoot ourselves in the foot with the choice of ABI.
Exactly that cleverness is what I'd prefer to avoid, as it breaks reproducibility with cross-chip environments.
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
, where
TARGET_HOSTmay simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...Yes.
target_vcpu_id=kvm_vm_ioctl(KVM_VM_GET_BEST_CPU_TARGET);/* Old kernels only support A15 hosts */
if (target_vcpu_id< 0)
target_vcpu_id=VCPU_CORTEX_A15;Quoted 5 lines
Quoted 2 lines
kvm_vcpu_ioctl(vcpu_fd, KVM_INIT_VCPU, target_vcpu_id);I get this part, but imagine the kernel not knowing the
target_cpuid, but just passing through whatever the hardware gives you to the guest.
Quoted 9 lines
Don't you have to handle core specific registers anyway?
Quoted 3 lines
I'm not saying that's necessarily going to happen or that it would be a great thing, but do we want to prevent this from ever happening through our choice of ABI?
I think so, yes. Can you run Linux on a core that hasn't been enabled? Why should you be able to run KVM on a core that hasn't been enabled? I'm not talking about QEMU here - that one should be happy to be ignorant. But the kernel side needs to know about the core either way, no?
I guess so, maybe. So far we haven't seen a lot of cores, so we definietely want to know about the specific cores that we want to support.
But, if there really are going to be hundreds, or thousands, or hundreds of thousands of virtualization-enabled ARM cores (ok, maybe not) then maybe we want to come up with a way to not add code in KVM for every new core we wish to support. But then again, if ARM achieves true world domination and inflicts us with that many core types, we can always add a new ABI.
So at this point, I don't really care if we do it once way or another.
-Christoffer
Quoted 145 lines · Christoffer Dall
Quoted 135 lines · Alexander Graf
Quoted 101 lines · Christoffer Dall
Quoted 100 lines · Alexander Graf
Quoted 96 lines · Christoffer Dall
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 18 lines · Peter Maydell
On 14 August 2013 10:11, Alexander Graf <[email protected]> wrote:
You're right, the main difference is that KVM doesn't have any
idea what a "host" style CPU is. It only knows how to report to QEMU
what the current host CPU would be, so that anything from VCPU_INIT
onwards is 100% identical regardless of whether the user said
-cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
The rough idea is that for BIG.little the kernel must trap the
ID registers at least (so that the vcpu seems consistent to the
guest whether it's running on the big or the little core). For
"-cpu host" the guest would see whatever is the most low-overhead
for the kernel to provide (ie assuming the big and little CPUs
are roughly-similar you could make -cpu host provide something
that looks to the guest like the big CPU and don't have to trap
quite as much as you would for providing a vcpu that wasn't the
same as either the big or little one).Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 13 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 11 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Quoted 8 lines
Quoted 4 lines
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed decision about which "best CPU target" value to return on any given new core
Quoted 8 lines
Quoted 2 lines
We have to make that decision internally anyways, because we have to choose some CPU target for the host one.
Are we sure that will always be the case? That's how it's structured now, yes, but maybe we can do something more intelligent (which is what I meant with "generic handling" below). It's a bit fuzzy for me to think about right now, but I just want to make sure we don't shoot ourselves in the foot with the choice of ABI.
Exactly that cleverness is what I'd prefer to avoid, as it breaks reproducibility with cross-chip environments.
Quoted 14 lines
Quoted 14 lines
Quoted 5 lines
, where
TARGET_HOSTmay simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...Yes.
target_vcpu_id=kvm_vm_ioctl(KVM_VM_GET_BEST_CPU_TARGET);/* Old kernels only support A15 hosts */
if (target_vcpu_id< 0)target_vcpu_id=VCPU_CORTEX_A15;Quoted 5 lines
Quoted 2 lines
kvm_vcpu_ioctl(vcpu_fd, KVM_INIT_VCPU, target_vcpu_id);I get this part, but imagine the kernel not knowing the
target_cpuid, but just passing through whatever the hardware gives you to the guest.Quoted 9 lines
Don't you have to handle core specific registers anyway?
Quoted 3 lines
I'm not saying that's necessarily going to happen or that it would be a great thing, but do we want to prevent this from ever happening through our choice of ABI?
I think so, yes. Can you run Linux on a core that hasn't been enabled? Why should you be able to run KVM on a core that hasn't been enabled? I'm not talking about QEMU here - that one should be happy to be ignorant. But the kernel side needs to know about the core either way, no?
Quoted 6 lines
I guess so, maybe. So far we haven't seen a lot of cores, so we definietely want to know about the specific cores that we want to support.
But, if there really are going to be hundreds, or thousands, or hundreds of thousands of virtualization-enabled ARM cores (ok, maybe not) then
We're talking about cores here. My take is that we're rather looking at dozens at most.
Quoted 4 lines
maybe we want to come up with a way to not add code in KVM for every new core we wish to support. But then again, if ARM achieves true world domination and inflicts us with that many core types, we can always add a new ABI.
If the need really emerges we can always still add a TARGET_HOST target type that the enumeration function returns. But I don't think we'll ever hit that case.
Quoted 1 line
So at this point, I don't really care if we do it once way or another.
Great :).
Alex
Quoted 109 lines · Alexander Graf
Quoted 90 lines · Christoffer Dall
Quoted 63 lines · Alexander Graf
Quoted 54 lines · Christoffer Dall
Quoted 53 lines · Alexander Graf
Quoted 49 lines · Christoffer Dall
Quoted 32 lines · Alexander Graf
Quoted 29 lines · Christoffer Dall
Quoted 22 lines · Alexander Graf
Quoted 9 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
You're right, the main difference is that KVM doesn't have any idea what a "host" style CPU is. It only knows how to report to QEMU what the current host CPU would be, so that anything from
VCPU_INITonwards is 100% identical regardless of whether the user said -cpu host or -cpu xxx.I'm still puzzled on how this will work with BIG.little btw.
Quoted 9 lines
The rough idea is that for BIG.little the kernel must trap the ID registers at least (so that the vcpu seems consistent to the guest whether it's running on the big or the little core). For "-cpu host" the guest would see whatever is the most low-overhead for the kernel to provide (ie assuming the big and little CPUs are roughly-similar you could make -cpu host provide something that looks to the guest like the big CPU and don't have to trap quite as much as you would for providing a vcpu that wasn't the same as either the big or little one).
Quoted 2 lines
So -cpu host in this case wouldn't actually expose the host CPU 1:1, but instead a cortex-a15 even when it's run on an a7 BIG.little core. I see.
Yes, from the discussion we've had the whole picture just becomes to blurry when you start presenting multiple different CPUs to the guest and there's really no need to that I'm aware of.
Quoted 7 lines
Quoted 3 lines
In fact the -cpu host case fits quite nicely with this state of mind; the kernel is free to decide based on the specific hardware and config on which it's running how to handle VMs on BL.
So why not have a vm ioctl to fetch the "best match" vcpu type? I don't like the idea of adding any awareness of a "host" type to the normal vcpu creation process.
That's actually what I suggested initially. I'm not really a QEMU expert, but I think Peter already answered this question: he doesn't want to support hundreds of CPU models in QEMU just to be able to run KVM when it's not necessary.
If his argument holds in that you can support -cpu host without having a model for that specific cpu in QEMU, then indeed it is a strong argument, and we have the problem with ARMv8 already, and this goes a long way to solve that. No?
Quoted 5 lines
Quoted 2 lines
That's up for QEMU to decide. With the "fetch and push" model we can support both flavors from user space. It also makes the kernel side more reproducible and obvious. There's simply no way to add hacks like "If I'm a -cpu host type do xxx" in KVM, because KVM never knows that it is running -cpu host.
Do we have historical examples of this knowledge being abused inside the kernel for other archs? If not, can we come up with a technical scenario where it may happen on ARM?
Quoted 5 lines
if (cpu ==
host_cpu) {
vgic_version=get_host_vgic_version();
}would be an example :).
Not really, this is driven from user space, but ok.
Quoted 18 lines
Everything -cpu host does has to be reproducible without -cpu host, otherwise our compatibility layering is broken. So why not model the API like it from the beginning?
Quoted 15 lines
Also, not really sure if such code should be controlled through the user space API; ideally we would catch bad coding behavior in the kernel during code review.
The only reason I originally suggested the "fetch and push" model was that I thought user space would need to know the specific CPU model for things to work and possibly for things like debugging and migration, but since I have been almost convinced otherwise, I don't see any real technical arguments for not adding -cpu host support in the kernel side.
Note that this doesn't prevent us from adding an IOCTL later that gives you the host CPU type in KVM terminology if we find it useful. But, I think the reduced headache with ARMv8 right now is a good argument to proceed with Peter's RFC and kernel support for same.
Quoted 6 lines
Quoted 3 lines
There's really almost no difference from the QEMU point of view if Peter choses to implement it the way he does today. He can ask the kernel for the vcpu target and pass that exact number back into the kernel.
From the kernel point of view though we have to make some informed decision about which "best CPU target" value to return on any given new core
We have to make that decision internally anyways, because we have to choose some CPU target for the host one.
Quoted 4 lines
, where
TARGET_HOSTmay simply work through generic handling of id registers, traps etc. and provide better performance than say, "I don't really know this host CPU, so I'm just going to tell you A15 and trap everything"...Yes.
Quoted 8 lines
target_vcpu_id=kvm_vm_ioctl(KVM_VM_GET_BEST_CPU_TARGET);/* Old kernels only support A15 hosts */
if (target_vcpu_id< 0)
target_vcpu_id=VCPU_CORTEX_A15;
kvm_vcpu_ioctl(vcpu_fd, KVM_INIT_VCPU, target_vcpu_id);
Are ARM cpu features not enumerable and the only way to know what is supported by a core is by its id? I do see feature registers in the spec, so why wouldn't we want to be able to disable/enable features individually?
--
Gleb.
Quoted 4 lines · Gleb Natapov
Are ARM cpu features not enumerable and the only way to know what is supported by a core is by its id? I do see feature registers in the spec, so why wouldn't we want to be able to disable/enable features individually?
It's complicated. There are feature registers which have various bits, but only some combinations are architecturally valid. In any case a guest might reasonably legitimately assume "this is an A15 so it will have architected timers", for example, and not bother testing feature bits. Some feature bits really do have to match the real hardware, like ones that say "you need to explicitly flush the branch predictor". A lot are feature bits that are simply mandatory for any ARMv7 or later processor (which is what you need for KVM to work at all). And buried in there might possibly be a few features that it might actually make sense to enable/disable separately (like "do we have Neon?").
So what we have for now is that the INIT_VCPU ioctl has space for feature flags (currently unused in v7; in v8 there's a "make the VM be a 32 bit VM on a 64 bit CPU" flag), so we could wire those up some day. (We don't have any support in QEMU for saying "I want an ARM CPU with features X and Y but not Z" yet either.)
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 4 lines · Gleb Natapov
Are ARM cpu features not enumerable and the only way to know what is supported by a core is by its id? I do see feature registers in the spec, so why wouldn't we want to be able to disable/enable features individually?
It's complicated. There are feature registers which have various bits, but only some combinations are architecturally valid. In any case a guest might reasonably legitimately assume "this is an A15 so it will have architected timers", for example, and not bother testing feature bits.
That's sad. If feature bit is available I would expect well behaved guest to test it. BTW is there architectural way to tell OS that it runs as a guest? There is dedicated CPUID bit on x86 for that which is obviously never set on real CPUs.
Quoted 5 lines
Some feature bits really do have to match the
real hardware, like ones that say "you need to explicitly flush the branch predictor". A lot are feature bits that are simply mandatory for any ARMv7 or later processor (which is what you need for KVM to work at all).
What if you want to emulate older arm arch for a guest?
Quoted 10 lines
And buried in there might possibly be a few features
that it might actually make sense to enable/disable separately (like "do we have Neon?").So what we have for now is that the
INIT_VCPUioctl has space for feature flags (currently unused in v7; in v8 there's a "make the VM be a 32 bit VM on a 64 bit CPU" flag), so we could wire those up some day. (We don't have any support in QEMU for saying "I want an ARM CPU with features X and Y but not Z" yet either.)
Do we have a way to ask KVM if it can support those features?
--
Gleb.
Quoted 5 lines · Gleb Natapov
Quoted 3 lines · Peter Maydell
A lot are feature bits that are simply mandatory
for any ARMv7 or later processor (which is what you need for KVM to work at all).What if you want to emulate older arm arch for a guest?
I don't believe that was a design goal architecturally and it's not a design goal for KVM/ARM either. If anybody actually cares about that use case they're welcome to submit patches. In any case, feature bits are probably the least of your worries (in that if the guest looks at them and uses features not strictly present on the older CPU it's still going to run, and if it doesn't look at them then it doesn't care what the bit says); to pick some random examples:
* no way to make a v7 core provide v5 unaligned-access behaviour
* a v6 OS is unlikely to be able to correctly manage/clean/ invalidate the kind of cache a v7 CPU has
* no support for the ARM v5 legacy pagetable format
There are no doubt others.
-- PMM
Quoted 1 line · Alexander Graf
So why not have a vm ioctl to fetch the "best match" vcpu type?
I don't object to that particularly, but
(a) we're not going to use the extra flexibility because the only thing we'll do is just bounce the answer back at the kernel
(b) it requires an actual new ioctl rather than just defining another supported value for the existing one
(c) the code is less neat if you have to do "ask kernel for best-match, if it has it use it otherwise fall back to [small list of legacy cpus]" than if you just have "try best-match/legacy1/legacy2/legacy3".
If the consensus is that a 'fetch best match' ioctl is the preferred API that's fine.
-- PMM
Quoted 7 lines · Peter Maydell
Quoted 1 line · Alexander Graf
So why not have a vm ioctl to fetch the "best match" vcpu type?
I don't object to that particularly, but
(a) we're not going to use the extra flexibility because the only thing we'll do is just bounce the answer back at the kernel
It makes the API more robust to abuse. I think that's a good thing.
Quoted 2 lines
(b) it requires an actual new ioctl rather than just defining another supported value for the existing one
Yup :).
Quoted 4 lines
(c) the code is less neat if you have to do "ask kernel for best-match, if it has it use it otherwise fall back to [small list of legacy cpus]" than if you just have "try best-match/legacy1/legacy2/legacy3".
I don't understand this point. Could you please elaborate?
Alex
Quoted 7 lines · Alexander Graf
Quoted 4 lines · Peter Maydell
(c) the code is less neat if you have to do "ask kernel for best-match, if it has it use it otherwise fall back to [small list of legacy cpus]" than if you just have "try best-match/legacy1/legacy2/legacy3".
I don't understand this point. Could you please elaborate?
See the code in the patch that basically says "try each value in this array until one works". For v7 the only two things we need to try are 'host' and 'a15' (because any kernel which doesn't know about 'host' must be an a15-only one); for v8 we have three legacy entries in the array. If you have to ask the kernel for the best-match then it's a special case before hand rather than just another entry in the list.
This is frankly a pretty weak argument though; I just liked that bit of code when I wrote it :-)
-- PMM
Quoted 16 lines · Alexander Graf
Quoted 5 lines · Peter Maydell
These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
Quoted 7 lines
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing
KVM_ARM_VCPU_INITsupports a new 'target' valueKVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' withKVM_ARM_TARGET_CORTEX_A15.
Quoted 2 lines
How do you know what core specific registers QEMU can expect from this particular CPU?
For 99% of them we simply don't care...
Quoted 4 lines
Imagine ARM changes the MMU implementation in the next ARMv8 CPU. With -cpu host you wouldn't be able to support gdbstub anymore, because you wouldn't know whether the MMU format is the old or the new one.
...and for the other 1% we can add a bit to the VCPU_INIT features field saying "this QEMU can handle CPUs with $weird-new-thing" and have the kernel fail CPU creation otherwise.
Quoted 4 lines
I really prefer the "probe the host, match it fuzzily with our own list, pick a specific own core" way of doing -cpu host. Then it's really only ever an alias and you don't have to worry about all these odd special cases.
I really don't want to be trying to model five hundred different CPUs inside QEMU half of which I probably won't have the documentation for. That is just going to mean "KVM+QEMU won't work on a lot of hardware when there is no reason it shouldn't".
-- PMM