WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Merged.

# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 43676a50998205fff080c329bea1409df75ff115
# Parent  127d856ce124f77adb93e2242475b98833c7bbfd
# Parent  32695e99cfc88f00e881f1bee5a1963877adbc57
Merged.

diff -r 127d856ce124 -r 43676a509982 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sun Oct 30 
18:22:31 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sun Oct 30 
18:23:36 2005
@@ -879,6 +879,7 @@
        if (gnttab_alloc_grant_references(NETIF_TX_RING_SIZE,
                                          &np->gref_tx_head) < 0) {
                printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
+               err = -ENOMEM;
                goto exit;
        }
        /* A grant for every rx ring slot */
@@ -886,6 +887,7 @@
                                          &np->gref_rx_head) < 0) {
                printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n");
                gnttab_free_grant_references(np->gref_tx_head);
+               err = -ENOMEM;
                goto exit;
        }
 
diff -r 127d856ce124 -r 43676a509982 tools/ioemu/hw/ne2000.c
--- a/tools/ioemu/hw/ne2000.c   Sun Oct 30 18:22:31 2005
+++ b/tools/ioemu/hw/ne2000.c   Sun Oct 30 18:23:36 2005
@@ -327,6 +327,7 @@
             break;
         }
     }
+    update_select_wakeup_events();
 }
 
 static uint32_t ne2000_ioport_read(void *opaque, uint32_t addr)
@@ -373,6 +374,7 @@
             break;
         }
     }
+    update_select_wakeup_events();
 #ifdef DEBUG_NE2000
     printf("NE2000: read addr=0x%x val=%02x\n", addr, ret);
 #endif
@@ -476,6 +478,7 @@
         ne2000_mem_writeb(s, s->rsar, val);
         ne2000_dma_update(s, 1);
     }
+    update_select_wakeup_events();
 }
 
 static uint32_t ne2000_asic_ioport_read(void *opaque, uint32_t addr)
@@ -492,6 +495,7 @@
         ret = ne2000_mem_readb(s, s->rsar);
         ne2000_dma_update(s, 1);
     }
+    update_select_wakeup_events();
 #ifdef DEBUG_NE2000
     printf("NE2000: asic read val=0x%04x\n", ret);
 #endif
@@ -510,6 +514,7 @@
     /* 32 bit access */
     ne2000_mem_writel(s, s->rsar, val);
     ne2000_dma_update(s, 4);
+    update_select_wakeup_events();
 }
 
 static uint32_t ne2000_asic_ioport_readl(void *opaque, uint32_t addr)
@@ -520,6 +525,7 @@
     /* 32 bit access */
     ret = ne2000_mem_readl(s, s->rsar);
     ne2000_dma_update(s, 4);
+    update_select_wakeup_events();
 #ifdef DEBUG_NE2000
     printf("NE2000: asic readl val=0x%04x\n", ret);
 #endif
@@ -535,6 +541,7 @@
 {
     NE2000State *s = opaque;
     ne2000_reset(s);
+    update_select_wakeup_events();
     return 0;
 }
 
diff -r 127d856ce124 -r 43676a509982 tools/ioemu/hw/pcnet.c
--- a/tools/ioemu/hw/pcnet.c    Sun Oct 30 18:22:31 2005
+++ b/tools/ioemu/hw/pcnet.c    Sun Oct 30 18:23:36 2005
@@ -50,7 +50,6 @@
 struct PCNetState_st {
     PCIDevice dev;
     NetDriverState *nd;
-    QEMUTimer *poll_timer;
     int mmio_io_addr, rap, isr, lnkst;
     target_phys_addr_t rdra, tdra;
     uint8_t prom[16];
@@ -640,8 +639,6 @@
 {
     PCNetState *s = opaque;
 
-    qemu_del_timer(s->poll_timer);
-
     if (CSR_TDMD(s)) {
         pcnet_transmit(s);
     }
@@ -660,8 +657,6 @@
             } else
                 CSR_POLL(s) = t;
         }
-        qemu_mod_timer(s->poll_timer, 
-            pcnet_get_next_poll_time(s,qemu_get_clock(vm_clock)));
     }
 }
 
@@ -941,6 +936,7 @@
         }
     }
     pcnet_update_irq(s);
+    update_select_wakeup_events();
 }
 
 static uint32_t pcnet_ioport_readw(void *opaque, uint32_t addr)
@@ -966,6 +962,7 @@
         }
     }
     pcnet_update_irq(s);
+    update_select_wakeup_events();
 #ifdef PCNET_DEBUG_IO
     printf("pcnet_ioport_readw addr=0x%08x val=0x%04x\n", addr, val & 0xffff);
 #endif
@@ -1000,6 +997,7 @@
 #endif        
     }
     pcnet_update_irq(s);
+    update_select_wakeup_events();
 }
 
 static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr)
@@ -1025,6 +1023,7 @@
         }
     }
     pcnet_update_irq(s);
+    update_select_wakeup_events();
 #ifdef PCNET_DEBUG_IO
     printf("pcnet_ioport_readl addr=0x%08x val=0x%08x\n", addr, val);
 #endif
@@ -1210,8 +1209,6 @@
     pci_register_io_region((PCIDevice *)d, 1, PCNET_PNPMMIO_SIZE, 
                            PCI_ADDRESS_SPACE_MEM, pcnet_mmio_map);
                            
-    d->poll_timer = qemu_new_timer(vm_clock, pcnet_poll_timer, d);
-
     d->nd = nd;
 
     pcnet_h_reset(d);
diff -r 127d856ce124 -r 43676a509982 tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Sun Oct 30 18:22:31 2005
+++ b/tools/ioemu/target-i386-dm/helper2.c      Sun Oct 30 18:23:36 2005
@@ -387,12 +387,6 @@
        }
 }
 
-void
-cpu_timer_handler(CPUState *env)
-{
-       cpu_handle_ioreq(env);
-}
-
 int xc_handle;
 
 static __inline__ void atomic_set_bit(long nr, volatile void *addr)
@@ -413,6 +407,8 @@
         fprintf(logfile, "%s failed.!\n", destroy_cmd);
 }
 
+fd_set wakeup_rfds;
+int    highest_fds;
 int main_loop(void)
 {
        fd_set rfds;
@@ -425,8 +421,9 @@
         extern void main_loop_wait(int);
 
        /* Watch stdin (fd 0) to see when it has input. */
-       FD_ZERO(&rfds);
-
+       FD_ZERO(&wakeup_rfds);
+       FD_SET(evtchn_fd, &wakeup_rfds);
+       highest_fds = evtchn_fd;
        while (1) {
                 if (vm_running) {
                     if (shutdown_requested) {
@@ -441,14 +438,16 @@
                /* Wait up to one seconds. */
                tv.tv_sec = 0;
                tv.tv_usec = 100000;
-               FD_SET(evtchn_fd, &rfds);
 
                env->send_event = 0;
-               retval = select(evtchn_fd+1, &rfds, NULL, NULL, &tv);
+               retval = select(highest_fds+1, &wakeup_rfds, NULL, NULL, &tv);
                if (retval == -1) {
                        perror("select");
                        return 0;
                }
+        rfds = wakeup_rfds;
+        FD_ZERO(&wakeup_rfds);
+        FD_SET(evtchn_fd, &wakeup_rfds);
 
 #if __WORDSIZE == 32
 #define ULONGLONG_MAX   0xffffffffffffffffULL
@@ -460,7 +459,10 @@
 #ifdef APIC_SUPPORT
                ioapic_update_EOI();
 #endif
-               cpu_timer_handler(env);
+        tun_receive_handler(&rfds);
+        if ( FD_ISSET(evtchn_fd, &rfds) ) {
+            cpu_handle_ioreq(env);
+        }
 #ifdef APIC_SUPPORT
                if (ioapic_has_intr())
                     do_ioapic();
diff -r 127d856ce124 -r 43676a509982 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Sun Oct 30 18:22:31 2005
+++ b/tools/ioemu/vl.c  Sun Oct 30 18:23:36 2005
@@ -1528,7 +1528,7 @@
                                 IOCanRWHandler *fd_can_read, 
                                 IOReadHandler *fd_read, void *opaque)
 {
-    qemu_add_fd_read_handler(nd->fd, fd_can_read, fd_read, opaque);
+    qemu_add_fd_event_read_handler(nd->fd, fd_can_read, fd_read, opaque);
 }
 
 static int net_tun_init(NetDriverState *nd)
@@ -1536,11 +1536,13 @@
     int pid, status;
     char *args[3];
     char **parg;
+    extern int highest_fds;
 
     nd->fd = tun_open(nd->ifname, sizeof(nd->ifname));
     if (nd->fd < 0)
         return -1;
 
+    if ( nd->fd > highest_fds ) highest_fds = nd->fd;
     /* try to launch network init script */
     pid = fork();
     if (pid >= 0) {
@@ -1628,6 +1630,7 @@
 } IOHandlerRecord;
 
 static IOHandlerRecord *first_io_handler;
+static IOHandlerRecord *first_eventio_handler;
 
 int qemu_add_fd_read_handler(int fd, IOCanRWHandler *fd_can_read, 
                              IOReadHandler *fd_read, void *opaque)
@@ -1643,6 +1646,23 @@
     ioh->opaque = opaque;
     ioh->next = first_io_handler;
     first_io_handler = ioh;
+    return 0;
+}
+
+int qemu_add_fd_event_read_handler(int fd, IOCanRWHandler *fd_can_read, 
+                             IOReadHandler *fd_read, void *opaque)
+{
+    IOHandlerRecord *ioh;
+
+    ioh = qemu_mallocz(sizeof(IOHandlerRecord));
+    if (!ioh)
+        return -1;
+    ioh->fd = fd;
+    ioh->fd_can_read = fd_can_read;
+    ioh->fd_read = fd_read;
+    ioh->opaque = opaque;
+    ioh->next = first_eventio_handler;
+    first_eventio_handler = ioh;
     return 0;
 }
 
@@ -3257,3 +3277,44 @@
     quit_timers();
     return 0;
 }
+
+extern fd_set wakeup_rfds;
+void tun_receive_handler(fd_set *rfds)
+{
+    IOHandlerRecord *ioh;
+    static uint8_t buf[4096];
+    int n, max_size;
+
+    for (ioh = first_eventio_handler; ioh != NULL; ioh = ioh->next) {
+        if ( FD_ISSET(ioh->fd, rfds) ) {
+            max_size = ioh->fd_can_read(ioh->opaque);
+            if (max_size > 0) {
+                if (max_size > sizeof(buf))
+                    max_size = sizeof(buf);
+                n = read(ioh->fd, buf, max_size);
+                if (n >= 0) {
+                    ioh->fd_read(ioh->opaque, buf, n);
+                } 
+            }
+        }
+    }
+    update_select_wakeup_events();
+}
+
+void update_select_wakeup_events(void)
+{
+    IOHandlerRecord *ioh;
+    int max_size;
+
+    for(ioh = first_eventio_handler; ioh != NULL; ioh = ioh->next) {
+        FD_CLR(ioh->fd, &wakeup_rfds);
+        if (ioh->fd_can_read) {
+             max_size = ioh->fd_can_read(ioh->opaque);
+             if (max_size > 0) {
+                 FD_SET(ioh->fd, &wakeup_rfds);
+             }
+        }
+    }
+}
+
+
diff -r 127d856ce124 -r 43676a509982 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Sun Oct 30 18:22:31 2005
+++ b/tools/ioemu/vl.h  Sun Oct 30 18:23:36 2005
@@ -178,6 +178,8 @@
 
 int qemu_add_fd_read_handler(int fd, IOCanRWHandler *fd_can_read, 
                              IOReadHandler *fd_read, void *opaque);
+int qemu_add_fd_event_read_handler(int fd, IOCanRWHandler *fd_can_read, 
+                             IOReadHandler *fd_read, void *opaque);
 void qemu_del_fd_read_handler(int fd);
 
 /* character device */
@@ -791,5 +793,7 @@
 #define DEFAULT_GDBSTUB_PORT 1234
 
 int gdbserver_start(int port);
+void update_select_wakeup_events(void);
+void tun_receive_handler();
 
 #endif /* VL_H */
diff -r 127d856ce124 -r 43676a509982 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     Sun Oct 30 18:22:31 2005
+++ b/xen/arch/x86/shadow.c     Sun Oct 30 18:23:36 2005
@@ -1381,7 +1381,8 @@
             perfc_incrc(resync_l1);
             perfc_incr_histo(wpt_updates, changed, PT_UPDATES);
             perfc_incr_histo(l1_entries_checked, max_shadow - min_shadow + 1, 
PT_UPDATES);
-            if (unshadow_l1) {
+            if ( d->arch.ops->guest_paging_levels == PAGING_L4 &&
+                 unshadow_l1 ) {
                 pgentry_64_t l2e;
 
                 __shadow_get_l2e(entry->v, entry->va, &l2e);
diff -r 127d856ce124 -r 43676a509982 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      Sun Oct 30 18:22:31 2005
+++ b/xen/include/asm-x86/shadow.h      Sun Oct 30 18:23:36 2005
@@ -387,7 +387,7 @@
     nl1e = l1e;
     l1e_remove_flags(nl1e, _PAGE_GLOBAL);
 
-    if ( unlikely(l1e_get_flags(l1e) & L1_DISALLOW_MASK) )
+    if ( unlikely(l1e_get_flags(nl1e) & L1_DISALLOW_MASK) )
         return 0;
 
     res = get_page_from_l1e(nl1e, d);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>