diff mbox

Give an error when using -icount option with kvm accelerator

Message ID 1320995379-20861-1-git-send-email-mars@linux.vnet.ibm.com
State New
Headers show

Commit Message

Mars.cao Nov. 11, 2011, 7:09 a.m. UTC
With -icount, the vm_clock is updated with help from TCG (it counts instructions at 2^ICOUNT ns/instructions).  With KVM, the instruction count is not available so KVM cannot provide this help. 

Signed-off-by: Cao,Bing Bu <mars@linux.vnet.ibm.com>
---
 vl.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Comments

Mars.cao Nov. 14, 2011, 6:17 a.m. UTC | #1
On 11/11/2011 03:09 PM, Cao,Bing Bu wrote:
> With -icount, the vm_clock is updated with help from TCG (it counts instructions at 2^ICOUNT ns/instructions).  With KVM, the instruction count is not available so KVM cannot provide this help.
>
> Signed-off-by: Cao,Bing Bu<mars@linux.vnet.ibm.com>
> ---
>   vl.c |    8 ++++++--
>   1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index f169aac..d2857a4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3226,8 +3226,12 @@ int main(int argc, char **argv, char **envp)
>           fprintf(stderr, "could not initialize alarm timer\n");
>           exit(1);
>       }
> -    configure_icount(icount_option);
> -
> +    if (!kvm_enabled()) {
> +        configure_icount(icount_option);
> +    } else {
> +        fprintf(stderr, "-icount option only allowed without kvm accelerator\n");
> +        exit(1);
> +    }
>       if (net_init_clients()<  0) {
>           exit(1);
>       }
This patch has a obvious bug,so bad!

Sorry for that, and the new patch has been added by Max Filippov.

+    if (icount_option && (kvm_enabled() || xen_enabled())) {
+        fprintf(stderr, "-icount is not allowed with kvm or xen\n");
+        exit(1);
+    }

     configure_icount(icount_option);
diff mbox

Patch

diff --git a/vl.c b/vl.c
index f169aac..d2857a4 100644
--- a/vl.c
+++ b/vl.c
@@ -3226,8 +3226,12 @@  int main(int argc, char **argv, char **envp)
         fprintf(stderr, "could not initialize alarm timer\n");
         exit(1);
     }
-    configure_icount(icount_option);
-
+    if (!kvm_enabled()) {
+        configure_icount(icount_option);
+    } else {
+        fprintf(stderr, "-icount option only allowed without kvm accelerator\n");
+        exit(1);
+    }
     if (net_init_clients() < 0) {
         exit(1);
     }