Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Lock bugfixes - missing lock deinits This also adds deinit calls in the linux_module...
Peter Dinda [Tue, 28 May 2013 22:24:04 +0000 (17:24 -0500)]
18 files changed:
linux_module/iface-console.c
linux_module/iface-file.c
linux_module/iface-host-dev.c
linux_module/iface-host-pci-hw.h
linux_module/iface-host-pci.c
linux_module/iface-keyed-stream.c
linux_module/iface-packet.c
linux_module/iface-stream.c
linux_module/palacios-vnet-brg.c
linux_module/palacios-vnet-ctrl.c
linux_module/util-queue.c
palacios/src/devices/apic.c
palacios/src/devices/keyboard.c
palacios/src/devices/lnx_virtio_nic.c
palacios/src/devices/lnx_virtio_vnet.c
palacios/src/devices/nvram.c
palacios/src/devices/telnet_cons.c
palacios/src/palacios/vmm_intr.c

index e91b46e..9364496 100644 (file)
@@ -417,6 +417,8 @@ static void palacios_tty_close(void * console) {
 
     remove_guest_ctrl(cons->guest, V3_VM_CONSOLE_CONNECT);
     deinit_queue(cons->queue);
+    
+    palacios_spinlock_deinit(&(cons->lock));
        
     palacios_free(cons);
 }
index da5aabb..1e3d1ad 100644 (file)
@@ -256,6 +256,8 @@ static int palacios_file_close(void * file_ptr) {
     
     list_del(&(pfile->file_node));
 
+    palacios_spinlock_deinit(&(pfile->lock));
+
     palacios_free(pfile->path);    
     palacios_free(pfile);
 
index 6edc26b..86b0e0c 100644 (file)
@@ -839,6 +839,8 @@ static int palacios_host_dev_close(v3_host_dev_t hostdev)
     palacios_spinlock_unlock_irqrestore(&(dev->lock),f2);
     palacios_spinlock_unlock_irqrestore(&(host_dev->lock),f1);
     
+    palacios_spinlock_deinit(&(dev->lock));
+
     palacios_host_dev_user_free(dev);
 
     return 0;
@@ -1343,7 +1345,9 @@ static int host_dev_guest_init(struct v3_guest * guest, void ** vm_data ) {
 
 static int host_dev_guest_deinit(struct v3_guest * guest, void * vm_data) {
 
-    palacios_free(vm_data);
+    struct palacios_host_dev * host_dev = (struct palacios_host_dev *) vm_data;
+    palacios_spinlock_deinit(&(host_dev->lock));
+    palacios_free(host_dev);
     return 0;
 }
 
index e897e13..7254edc 100644 (file)
@@ -451,3 +451,9 @@ static int read_hw_pci_config(struct host_pci_device * host_dev, u32 reg, void *
 
     return 0; 
 }
+
+
+//
+// Should be a matching teardown function here, otherwise we
+// are at least leaking the lock from the lockchecker's perspective
+// we would like to be able to do a palacios_spinlock_deinit() here...
index 13897ab..d9622c9 100644 (file)
@@ -232,11 +232,15 @@ static int host_pci_init( void ) {
     return 0;
 }
 
-
+static int host_pci_deinit(void) {
+  palacios_spinlock_deinit(&lock);
+  return 0;
+}
 
 static struct linux_ext host_pci_ext = {
     .name = "HOST_PCI",
     .init = host_pci_init,
+    .deinit = host_pci_deinit,
 };
 
 
index 34b39dc..3fa8ebe 100644 (file)
@@ -3156,6 +3156,8 @@ static int deinit_keyed_streams( void )
 {
     palacios_free_htable(mem_streams,1,1);
 
+    palacios_spinlock_deinit(&(user_streams->lock));
+
     palacios_free(user_streams);
 
     WARNING("Deinit of Palacios Keyed Streams likely leaked memory\n");
index bf19b0d..6ec4de0 100644 (file)
@@ -361,6 +361,8 @@ static int packet_deinit( void ) {
        deinit_raw_interface(iface);
        palacios_free(iface);
     }
+
+    palacios_spinlock_deinit(&(packet_state.lock));
     
     return 0;
 }
index 8604254..d6c6331 100644 (file)
@@ -280,6 +280,7 @@ static void palacios_stream_close(struct v3_stream * v3_stream) {
 
     free_ringbuf(stream->out_ring);
     list_del(&(stream->stream_node));
+    palacios_spinlock_deinit(&(stream->lock));
     palacios_free(stream);
 
 }
index 451b5e4..1dfe8a8 100644 (file)
@@ -610,6 +610,8 @@ void vnet_bridge_deinit(void){
 
     vnet_brg_s.status = 0;
 
+    palacios_spinlock_deinit(&(vnet_brg_s.lock));
+
     INFO("VNET LNX Bridge Deinit Finished\n");
 }
 
index 308a559..fc9f195 100644 (file)
@@ -1010,6 +1010,8 @@ void vnet_ctrl_deinit(void){
 
     vnet_ctrl_s.status = 0;
 
+    palacios_spinlock_deinit(&(vnet_ctrl_s.lock));
+
     INFO("VNET Control Deinit Finished\n");
 }
 
index 249b034..0dba00b 100644 (file)
@@ -20,6 +20,7 @@ void deinit_queue(struct gen_queue * queue) {
     while (dequeue(queue)) {
        ERROR("Freeing non-empty queue. PROBABLE MEMORY LEAK DETECTED\n");
     }
+    palacios_spinlock_deinit(&(queue->lock));
 }
 
 struct gen_queue * create_queue(unsigned int max_entries) {
index b6c2416..86286ce 100644 (file)
@@ -283,7 +283,7 @@ static int apic_write(struct guest_info * core, addr_t guest_addr, void * src, u
 static void set_apic_tpr(struct apic_state *apic, uint32_t val);
 
 
-// No lcoking done
+// No locking done
 static void init_apic_state(struct apic_state * apic, uint32_t id) {
     apic->base_addr = DEFAULT_BASE_ADDR;
 
@@ -1872,12 +1872,16 @@ static int apic_free(struct apic_dev_state * apic_dev) {
            v3_remove_timer(core, apic->timer);
        }
 
+       v3_lock_deinit(&(apic->irq_queue.lock));
+
        // unhook memory
 
     }
 
     v3_unhook_msr(vm, BASE_ADDR_MSR);
 
+    v3_lock_deinit(&(apic_dev->state_lock));
+
     V3_Free(apic_dev);
     return 0;
 }
index f0d0c3a..2751cc0 100644 (file)
@@ -1074,6 +1074,8 @@ static int keyboard_free(struct keyboard_internal * kbd) {
 
     // unhook host events
 
+    v3_lock_deinit(&(kbd->kb_lock));
+
     V3_Free(kbd);
     return 0;
 }
index da3dd9d..7ead43d 100644 (file)
@@ -753,6 +753,9 @@ static int virtio_free(struct virtio_dev_state * virtio) {
        V3_Free(backend);
     }
 
+    v3_lock_deinit(&(virtio->rx_lock));
+    v3_lock_deinit(&(virtio->tx_lock));
+
     V3_Free(virtio);
 
     return 0;
index eb889ed..69c1836 100644 (file)
@@ -552,7 +552,10 @@ static int virtio_free(struct virtio_vnet_state * vnet_state) {
 
     // unregister from PCI
 
+    v3_lock_deinit(&(vnet_state->lock));
+
     V3_Free(vnet_state);
+
     return 0;
 }
 
index 912b5f5..f75a227 100644 (file)
@@ -779,6 +779,8 @@ static int nvram_free(struct nvram_internal * nvram_state) {
        v3_remove_timer(info,nvram_state->timer);
     }
 
+    v3_lock_deinit(&(nvram_state->nvram_lock));
+
     V3_Free(nvram_state);
     return 0;
 }
index 98562af..4e7471b 100644 (file)
@@ -397,6 +397,8 @@ static int cons_free(struct cons_state * state) {
 
     // kill thread... ?
 
+    v3_lock_deinit(&(state->cons_lock));
+
     V3_Free(state);
     return 0;
 }
index 5b5dad6..2e78872 100644 (file)
@@ -72,6 +72,9 @@ void v3_deinit_intr_controllers(struct guest_info * core) {
     list_for_each_entry_safe(ctrlr, tmp, &(intr_state->controller_list), ctrl_node) {
        v3_remove_intr_controller(core, ctrlr);
     }
+
+    v3_lock_deinit(&(intr_state->irq_lock));
+
 }
 
 
@@ -93,6 +96,8 @@ void v3_deinit_intr_routers(struct v3_vm_info * vm) {
     list_for_each_entry_safe(rtr, tmp, &(vm->intr_routers.router_list), router_node) {
        v3_remove_intr_router(vm, rtr);
     }  
+
+    v3_lock_deinit(&(vm->intr_routers.irq_lock));
 }
 
 void * v3_register_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * priv_data) {