Re: [PATCH] KVM: Add reading critical region for kvm_io_bus_read/write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/06/2010 10:44 AM, Sheng Yang wrote:
Seems we missed it.

Signed-off-by: Sheng Yang<sheng@xxxxxxxxxxxxxxx>
---
Do we need this, or slot_lock covered this?

  virt/kvm/kvm_main.c |   24 ++++++++++++++++--------
  1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c4ee364..3e71b91 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2228,28 +2228,36 @@ static void kvm_io_bus_destroy(struct kvm_io_bus *bus)
  int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
  		     int len, const void *val)
  {
-	int i;
+	int i, idx, r = -EOPNOTSUPP;
  	struct kvm_io_bus *bus;

+	idx = srcu_read_lock(&kvm->srcu);
  	bus = srcu_dereference(kvm->buses[bus_idx],&kvm->srcu);
  	for (i = 0; i<  bus->dev_count; i++)
-		if (!kvm_iodevice_write(bus->devs[i], addr, len, val))
-			return 0;
-	return -EOPNOTSUPP;
+		if (!kvm_iodevice_write(bus->devs[i], addr, len, val)) {
+			r = 0;
+			break;
+		}
+	srcu_read_unlock(&kvm->srcu, idx);
+	return r;
  }

Isn't this already taken care of by srcu_read_lock() in vcpu_enter_guest(), just before calling ->handle_exit()?

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux