958e1b
From 34488aa0dd2c4c0a0dcc57a0557ec07750170f67 Mon Sep 17 00:00:00 2001
eb5a2f
From: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Date: Mon, 19 May 2014 09:57:40 +0200
eb5a2f
Subject: [PATCH 2/2] kvm: skip system call when msi route is unchanged
eb5a2f
eb5a2f
RH-Author: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Message-id: <1400493448-29146-3-git-send-email-mst@redhat.com>
eb5a2f
Patchwork-id: 58949
eb5a2f
O-Subject: [PATCH qemu-kvm RHEL7.1 2/2] kvm: skip system call when msi route is unchanged
958e1b
Bugzilla: 1098976
eb5a2f
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
eb5a2f
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
eb5a2f
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
eb5a2f
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
eb5a2f
eb5a2f
Some guests do a large number of mask/unmask
eb5a2f
calls which currently trigger expensive route update
eb5a2f
system calls.
eb5a2f
Detect that route in unchanged and skip the system call.
eb5a2f
eb5a2f
Reported-by: "Zhanghaoyu (A)" <haoyu.zhang@huawei.com>
eb5a2f
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
eb5a2f
Signed-off-by: Gleb Natapov <gleb@redhat.com>
eb5a2f
(cherry picked from commit 40509f7f52672fe41c2cce895e187352fc09f53a)
eb5a2f
---
eb5a2f
 kvm-all.c | 4 ++++
eb5a2f
 1 file changed, 4 insertions(+)
eb5a2f
eb5a2f
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
eb5a2f
---
eb5a2f
 kvm-all.c |    4 ++++
eb5a2f
 1 files changed, 4 insertions(+), 0 deletions(-)
eb5a2f
eb5a2f
diff --git a/kvm-all.c b/kvm-all.c
eb5a2f
index 592301a..f7f621b 100644
eb5a2f
--- a/kvm-all.c
eb5a2f
+++ b/kvm-all.c
eb5a2f
@@ -1008,6 +1008,10 @@ static int kvm_update_routing_entry(KVMState *s,
eb5a2f
             continue;
eb5a2f
         }
eb5a2f
 
eb5a2f
+        if(!memcmp(entry, new_entry, sizeof *entry)) {
eb5a2f
+            return 0;
eb5a2f
+        }
eb5a2f
+
eb5a2f
         *entry = *new_entry;
eb5a2f
 
eb5a2f
         kvm_irqchip_commit_routes(s);
eb5a2f
-- 
eb5a2f
1.7.1
eb5a2f