Re: [kvm-devel] [PATCH 1/5]Add some trace markers and exposeinterfaces in kernel for tracing
Hollis Blanchard wrote: > On Tuesday 15 April 2008 22:13:28 Liu, Eric E wrote: >> Hollis Blanchard wrote: >>> On Wednesday 09 April 2008 05:01:36 Liu, Eric E wrote: +/* This structure represents a single trace buffer record. */ +struct kvm_trace_rec { + __u32 event:28; + __u32 extra_u32:3; + __u32 cycle_in:1; + __u32 pid; + __u32 vcpu_id; + union { + struct { + __u32 cycle_lo, cycle_hi; + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; + } cycle; + struct { + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; + } nocycle; + } u; +}; >>> >>> Do we really need bitfields here? They are notoriously non-portable. >>> >>> Practically speaking, this will prevent me from copying a trace file >>> from my big-endian target to my little-endian workstation for >>> analysis, at least without some ugly hacking in the userland tool. >> Here the main consideration using bitfields is to save storage space >> for > each record, but as you said it is non-portable for your mentioned > case, so should we need to adjust the struct like this? >> __u32 event; >> __16 extra_u32; >> __16 cycle_in; > > If space really is a worry, you could still combine the fields, and > just use masks to extract the data later. No matter what, > byteswapping is required in the userland tool. I suspect this isn't > there already, but it will be easier to add without the bitfields. > > Hmm, while we're on the subject, I'm not sure what the best way to > automatically byteswap will be. It probably isn't worth it to convert > all trace data to a standard ordering (which would add overhead to > tracing), but I suppose there is no metadata in the trace log? A > command line switch might be inconvenient but inevitable. A tricky approach is that we insert medadata to the trace file before reading the trace log, so that the analysis tool can look at the medadata to check whether we need to convert byte order? - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] Chaning disks from IDE to SCSI on a Windows VM
Jun, what happens when you boot into Windows' safe mode? It usually displays the drivers as it loads them. Would be interesting to see where it hangs. Also try this: * Boot with the IDE disk which works and the dummy SCSI disk attached as per Alberto's instructions * After you confirmed that the SCSI controller and disk are in device manager: delete the currently in use IDE controller from device manager * Reboot into the SCSI setup Good luck, Felix - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH 1/5]Add some trace markers and exposeinterfaces in kernel for tracing
On Tuesday 15 April 2008 22:13:28 Liu, Eric E wrote: > Hollis Blanchard wrote: > > On Wednesday 09 April 2008 05:01:36 Liu, Eric E wrote: > >> +/* This structure represents a single trace buffer record. */ > >> +struct kvm_trace_rec { + __u32 event:28; > >> + __u32 extra_u32:3; > >> + __u32 cycle_in:1; > >> + __u32 pid; > >> + __u32 vcpu_id; > >> + union { > >> + struct { > >> + __u32 cycle_lo, cycle_hi; > >> + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; > >> + } cycle; + struct { > >> + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; > >> + } nocycle; + } u; > >> +}; > > > > Do we really need bitfields here? They are notoriously non-portable. > > > > Practically speaking, this will prevent me from copying a trace file > > from my big-endian target to my little-endian workstation for > > analysis, at least without some ugly hacking in the userland tool. > Here the main consideration using bitfields is to save storage space for each record, but as you said it is non-portable for your mentioned case, so should we need to adjust the struct like this? > __u32 event; > __16 extra_u32; > __16 cycle_in; If space really is a worry, you could still combine the fields, and just use masks to extract the data later. No matter what, byteswapping is required in the userland tool. I suspect this isn't there already, but it will be easier to add without the bitfields. Hmm, while we're on the subject, I'm not sure what the best way to automatically byteswap will be. It probably isn't worth it to convert all trace data to a standard ordering (which would add overhead to tracing), but I suppose there is no metadata in the trace log? A command line switch might be inconvenient but inevitable. -- Hollis Blanchard IBM Linux Technology Center - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH 1/5]Add some trace markers and exposeinterfaces in kernel for tracing
Hollis Blanchard wrote: > On Wednesday 09 April 2008 05:01:36 Liu, Eric E wrote: >> +/* This structure represents a single trace buffer record. */ >> +struct kvm_trace_rec { + __u32 event:28; >> + __u32 extra_u32:3; >> + __u32 cycle_in:1; >> + __u32 pid; >> + __u32 vcpu_id; >> + union { >> + struct { >> + __u32 cycle_lo, cycle_hi; >> + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; >> + } cycle; + struct { >> + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; >> + } nocycle; + } u; >> +}; > > Do we really need bitfields here? They are notoriously non-portable. > > Practically speaking, this will prevent me from copying a trace file > from my big-endian target to my little-endian workstation for > analysis, at least without some ugly hacking in the userland tool. Here the main consideration using bitfields is to save storage space for each record, but as you said it is non-portable for your mentioned case, so should we need to adjust the struct like this? __u32 event; __16 extra_u32; __16 cycle_in; - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] Chaning disks from IDE to SCSI on a Windows VM
On Wed, Apr 16, 2008 at 1:29 AM, Alberto Treviño <[EMAIL PROTECTED]> wrote: > On Tuesday 15 April 2008 12:57:45 am Jun Koi wrote: > > Looks like a problem, however. In his instruction, part 3: > > >3. Shut down the VM. This time, don't include the new temporary > > > image from step 1 and define your disk(s) as SCSI disks: > > > > > > qemu-system-x86_64 -m 256 \ > > >-drive file=hda.img,if=scsi,bus=0,index=0,media=disk,boot=off > > > ... > > > > I think above should have "boot=on", rather than "boot=off". > > Otherwise, you cannot boot from scsi disk, right? > > You are right! That's what happens when you copy and paste code. :-) > > > > I tried the above instructions with WinXP, but WinXP cannot boot > > successfully: it stops somewhere in the middle, and hang there. > > I tried it on a vanilla install of WinXP SP2, no updates. My WinXP is fully updated. > In step #2, did the Device Manager show the SCSI disk? Yes, it does. If you have any progress on this, please let us know. Many thanks, Jun - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] performance with guests running 2.4 kernels (specifically RHEL3)
I have been looking at RHEL3 based guests lately, and to say the least the performance is horrible. Rather than write a long tome on what I've done and observed, I'd like to find out if anyone has some insights or known problem areas running 2.4 guests. The short of it is that % system time spikes from time to time (e.g., on exec of a new process such as running /bin/true). I do not see the problem running RHEL3 on ESX, and an equivalent VM running RHEL4 runs fine. That suggests that the 2.4 kernel is doing something in a way that is not handled efficiently by kvm. Can someone shed some light on it? thanks, david - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH 1/5] PCI DMA API (v3)
This patch introduces a DMA API and plumbs support through the DMA layer. We use a mostly opaque structure, IOVector to represent a scatter/gather list of physical memory. Associated with each IOVector is a read/write function and an opaque pointer. This allows arbitrary transformation/mapping of the data while providing an easy mechanism to short-cut the zero-copy case in the block/net backends. Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> diff --git a/Makefile b/Makefile index adb50a8..a8df278 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) ### # BLOCK_OBJS is code used by both qemu system emulation and qemu-img -BLOCK_OBJS=cutils.o +BLOCK_OBJS=cutils.o iovector.o BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o BLOCK_OBJS+=block-qcow2.o block-parallels.o diff --git a/block.c b/block.c index 0730954..eb610e0 100644 --- a/block.c +++ b/block.c @@ -570,6 +570,55 @@ int bdrv_write(BlockDriverState *bs, int64_t sector_num, } } +int bdrv_readv(BlockDriverState *bs, int64_t sector_num, + IOVector *iovec) +{ +char *buffer; +size_t size; +int ret; + +/* it's possible that we'll see a OOM condition here if the transfer size + * is sufficiently large. + */ +size = iovector_size(iovec); +buffer = qemu_malloc(size); +if (buffer == NULL) + return -ENOMEM; + +ret = bdrv_read(bs, sector_num, buffer, size / 512); + +if (ret >= 0) + memcpy_to_iovector(iovec, 0, size, buffer); + +qemu_free(buffer); + +return ret; +} + +int bdrv_writev(BlockDriverState *bs, int64_t sector_num, + const IOVector *iovec) +{ +char *buffer; +size_t size; +int ret; + +/* it's possible that we'll see a OOM condition here if the transfer size + * is sufficiently large. + */ +size = iovector_size(iovec); +buffer = qemu_malloc(size); +if (buffer == NULL) + return -ENOMEM; + +memcpy_from_iovector(buffer, 0, size, iovec); + +ret = bdrv_write(bs, sector_num, buffer, size / 512); + +qemu_free(buffer); + +return ret; +} + static int bdrv_pread_em(BlockDriverState *bs, int64_t offset, uint8_t *buf, int count1) { diff --git a/block.h b/block.h index b730505..9d30db2 100644 --- a/block.h +++ b/block.h @@ -1,6 +1,8 @@ #ifndef BLOCK_H #define BLOCK_H +#include "iovector.h" + /* block.c */ typedef struct BlockDriver BlockDriver; @@ -67,6 +69,9 @@ int bdrv_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors); int bdrv_write(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); +int bdrv_readv(BlockDriverState *bs, int64_t sector_num, IOVector *iovec); +int bdrv_writev(BlockDriverState *bs, int64_t sector_num, + const IOVector *iovec); int bdrv_pread(BlockDriverState *bs, int64_t offset, void *buf, int count); int bdrv_pwrite(BlockDriverState *bs, int64_t offset, diff --git a/hw/pci.c b/hw/pci.c index bc55989..3282478 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -145,6 +145,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) return 0; } +void pci_device_dma_write(PCIDevice *s, target_phys_addr_t addr, + const void *buffer, size_t len) +{ +cpu_physical_memory_write(addr, buffer, len); +} + +void pci_device_dma_read(PCIDevice *s, target_phys_addr_t addr, +void *buffer, size_t len) +{ +cpu_physical_memory_read(addr, buffer, len); +} + /* -1 for devfn means auto assign */ PCIDevice *pci_register_device(PCIBus *bus, const char *name, int instance_size, int devfn, diff --git a/hw/pci.h b/hw/pci.h index e870987..c885cc5 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -81,6 +81,12 @@ void pci_default_write_config(PCIDevice *d, void pci_device_save(PCIDevice *s, QEMUFile *f); int pci_device_load(PCIDevice *s, QEMUFile *f); +void pci_device_dma_write(PCIDevice *s, target_phys_addr_t addr, + const void *buffer, size_t len); + +void pci_device_dma_read(PCIDevice *s, target_phys_addr_t addr, +void *buffer, size_t len); + typedef void (*pci_set_irq_fn)(qemu_irq *pic, int irq_num, int level); typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num); PCIBus *pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, diff --git a/iovector.c b/iovector.c new file mode 100644 index 000..056a86e --- /dev/null +++ b/iovector.c @@ -0,0 +1,144 @@ +/* + * IO Vectors + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "q
[kvm-devel] [PATCH 5/5] virtio balloon driver (v3)
This patch implements the virtio balloon driver backend. A user can interact with the balloon driver using a newly introduce monitor command 'balloon'. Ballooning is used to request the guest to stop using a certain portion of its memory. The guest notifies the host of this memory so the host can immediately reallocate it. Ballooning is implemented within QEMU via the madvise() system call. This is for Linux hosts only ATM but it should be easy enough to add the right code for other hosts. If you balloon down sufficiently, you can see the resident memory of the QEMU instance decrease when using this driver. Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> diff --git a/Makefile.target b/Makefile.target index 4d695c7..dead372 100644 --- a/Makefile.target +++ b/Makefile.target @@ -535,7 +535,7 @@ OBJS += rtl8139.o OBJS += e1000.o # virtio devices -OBJS += virtio.o virtio-net.o virtio-blk.o +OBJS += virtio.o virtio-net.o virtio-blk.o virtio-balloon.o ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support diff --git a/balloon.h b/balloon.h new file mode 100644 index 000..60b4a5d --- /dev/null +++ b/balloon.h @@ -0,0 +1,27 @@ +/* + * Balloon + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef _QEMU_BALLOON_H +#define _QEMU_BALLOON_H + +#include "cpu-defs.h" + +typedef ram_addr_t (QEMUBalloonEvent)(void *opaque, ram_addr_t target); + +void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque); + +void qemu_balloon(ram_addr_t target); + +ram_addr_t qemu_balloon_status(void); + +#endif diff --git a/hw/pc.c b/hw/pc.c index 2da9413..8d3401a 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1023,6 +1023,8 @@ static void pc_init1(int ram_size, int vga_ram_size, } } +if (pci_enabled) + virtio_balloon_init(pci_bus); } static void pc_init_pci(int ram_size, int vga_ram_size, diff --git a/hw/pc.h b/hw/pc.h index c828cda..67583f7 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -146,4 +146,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd); /* virtio-blk.c */ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs); +/* virtio-balloon.h */ +void *virtio_balloon_init(PCIBus *bus); + #endif diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c new file mode 100644 index 000..d97f4b2 --- /dev/null +++ b/hw/virtio-balloon.c @@ -0,0 +1,134 @@ +/* + * Virtio Block Device + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "qemu-common.h" +#include "virtio.h" +#include "pc.h" +#include "sysemu.h" +#include "cpu.h" +#include "balloon.h" +#include "virtio-balloon.h" + +#if defined(__linux__) +#include +#endif + +typedef struct VirtIOBalloon +{ +VirtIODevice vdev; +VirtQueue *ivq, *dvq; +uint32_t num_pages; +uint32_t actual; +} VirtIOBalloon; + +static VirtIOBalloon *to_virtio_balloon(VirtIODevice *vdev) +{ +return (VirtIOBalloon *)vdev; +} + +static void balloon_page(void *addr, int deflate) +{ +#if defined(__linux__) +madvise(addr, TARGET_PAGE_SIZE, deflate ? MADV_WILLNEED : MADV_DONTNEED); +#endif +} + +static void virtio_balloon_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ +VirtIOBalloon *s = to_virtio_balloon(vdev); +VirtQueueElement *elem; + +while ((elem = virtqueue_pop(vq)) != NULL) { + size_t offset = 0; + uint32_t pfn; + + while (memcpy_from_iovector(&pfn, offset, 4, elem->out) == 4) { + ram_addr_t pa; + ram_addr_t addr; + + pa = (ram_addr_t)ldl_p(&pfn) << TARGET_PAGE_BITS; + offset += 4; + + addr = cpu_get_physical_page_desc(pa); + if ((addr & ~TARGET_PAGE_MASK) != IO_MEM_RAM) + continue; + + balloon_page(phys_ram_base + addr, !!(vq == s->dvq)); + } + + virtqueue_push(vq, elem, offset); + virtio_notify(vdev, vq); +} +} + +static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_data) +{ +VirtIOBalloon *dev = to_virtio_balloon(vdev); +struct virtio_balloon_config config; + +config.num_pages = cpu_to_le32(dev->num_pages); +config.actual = cpu_to_le32(dev->actual); + +memcpy(config_data, &config, 8); +} + +static void virtio_balloon_set_config(VirtIODevice *vdev, + const uint8_t *config_data) +{ +VirtIOBalloon *dev = to_virtio_balloon(vdev); +struct virtio_balloon_config config; +memcpy(&config, config_data, 8); +dev->actual = config.actual; +} + +static uint32_t virtio_balloon_get_features(VirtIODevice *vdev) +{ +return 0; +} + +static ram_addr_t virtio_balloon_to_target(void *opaque, ram_addr_t target) +{ +VirtIOBalloon *dev = opaque; +
[kvm-devel] [PATCH 4/5] virtio block driver (v3)
This patch implements the virtio block driver backend. Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> diff --git a/Makefile.target b/Makefile.target index ea632fa..4d695c7 100644 --- a/Makefile.target +++ b/Makefile.target @@ -535,7 +535,7 @@ OBJS += rtl8139.o OBJS += e1000.o # virtio devices -OBJS += virtio.o virtio-net.o +OBJS += virtio.o virtio-net.o virtio-blk.o ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support diff --git a/hw/pc.c b/hw/pc.c index 4fec2d4..2da9413 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1011,6 +1011,18 @@ static void pc_init1(int ram_size, int vga_ram_size, } } } + +/* Add virtio block devices */ +if (pci_enabled) { + int index; + int unit_id = 0; + + while ((index = drive_get_index(IF_VIRTIO, 0, unit_id)) != -1) { + virtio_blk_init(pci_bus, drives_table[index].bdrv); + unit_id++; + } +} + } static void pc_init_pci(int ram_size, int vga_ram_size, diff --git a/hw/pc.h b/hw/pc.h index 9f83050..c828cda 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -143,4 +143,7 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn, void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd); +/* virtio-blk.c */ +void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs); + #endif diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c new file mode 100644 index 000..534e819 --- /dev/null +++ b/hw/virtio-blk.c @@ -0,0 +1,112 @@ +/* + * Virtio Block Device + * + * Copyright IBM, Corp. 2007 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "virtio.h" +#include "block.h" +#include "block_int.h" +#include "pc.h" +#include "virtio-blk.h" + +typedef struct VirtIOBlock +{ +VirtIODevice vdev; +BlockDriverState *bs; +} VirtIOBlock; + +static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) +{ +return (VirtIOBlock *)vdev; +} + +static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ +VirtIOBlock *s = to_virtio_blk(vdev); +VirtQueueElement *elem; + +while ((elem = virtqueue_pop(vq)) != 0) { + struct virtio_blk_outhdr out; + struct virtio_blk_inhdr in; + unsigned int wlen; + size_t in_size, out_size; + + out_size = iovector_size(elem->out); + in_size = iovector_size(elem->in); + + memcpy_from_iovector(&out, 0, sizeof(out), elem->out); + + if (out.type & VIRTIO_BLK_T_SCSI_CMD) { + wlen = sizeof(in); + in.status = VIRTIO_BLK_S_UNSUPP; + } else if (out.type & VIRTIO_BLK_T_OUT) { + IOVector *sg; + + sg = iovector_trim(elem->out, sizeof(out), + out_size - sizeof(out)); + bdrv_writev(s->bs, out.sector, sg); + iovector_free(sg); + + wlen = sizeof(in); + in.status = VIRTIO_BLK_S_OK; + } else { + IOVector *sg; + + sg = iovector_trim(elem->in, 0, in_size - sizeof(in)); + bdrv_readv(s->bs, out.sector, sg); + iovector_free(sg); + + wlen = in_size; + in.status = VIRTIO_BLK_S_OK; + } + + memcpy_to_iovector(elem->in, in_size - sizeof(in), + sizeof(in), &in); + + virtqueue_push(vq, elem, wlen); + virtio_notify(vdev, vq); +} +} + +static void virtio_blk_get_config(VirtIODevice *vdev, uint8_t *config) +{ +VirtIOBlock *s = to_virtio_blk(vdev); +struct virtio_blk_config blkcfg; +int64_t capacity; + +bdrv_get_geometry(s->bs, &capacity); +blkcfg.capacity = cpu_to_le64(capacity); +blkcfg.seg_max = cpu_to_le32(128 - 2); +memcpy(config, &blkcfg, sizeof(blkcfg)); +} + +static uint32_t virtio_blk_get_features(VirtIODevice *vdev) +{ +return (1 << VIRTIO_BLK_F_SEG_MAX); +} + +void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs) +{ +VirtIOBlock *s; + +s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk", 6900, 0x1001, + 0, VIRTIO_ID_BLOCK, + 0x01, 0x80, 0x00, + 16, sizeof(VirtIOBlock)); + +s->vdev.get_config = virtio_blk_get_config; +s->vdev.get_features = virtio_blk_get_features; +s->bs = bs; + +virtio_add_queue(&s->vdev, 128, virtio_blk_handle_output); + +return s; +} diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h new file mode 100644 index 000..290ff5b --- /dev/null +++ b/hw/virtio-blk.h @@ -0,0 +1,66 @@ +/* + * Virtio Support + * + * Copyright IBM, Corp. 2007-2008 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * Rusty Russell <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef _QEMU_VIRTIO_BLK_H +#define _QEMU_VIRTIO_BLK_H + +/* from Linux's linux/vi
[kvm-devel] [PATCH 3/5] virtio network driver (v3)
This patch implements the virtio network driver backend. In KVM, this driver can achieve 1gbit tx/rx performance. More patches are required to improve the network IO infrastructure to achieve better performance in QEMU. Since v1, I've updated the patch based on the IOVector refactoring. Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> diff --git a/Makefile.target b/Makefile.target index 3e9f7b1..ea632fa 100644 --- a/Makefile.target +++ b/Makefile.target @@ -535,7 +535,7 @@ OBJS += rtl8139.o OBJS += e1000.o # virtio devices -OBJS += virtio.o +OBJS += virtio.o virtio-net.o ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support diff --git a/hw/pci.c b/hw/pci.c index 3282478..94452d3 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -652,9 +652,11 @@ void pci_nic_init(PCIBus *bus, NICInfo *nd, int devfn) pci_e1000_init(bus, nd, devfn); } else if (strcmp(nd->model, "pcnet") == 0) { pci_pcnet_init(bus, nd, devfn); +} else if (strcmp(nd->model, "virtio") == 0) { + virtio_net_init(bus, nd, devfn); } else if (strcmp(nd->model, "?") == 0) { fprintf(stderr, "qemu: Supported PCI NICs: i82551 i82557b i82559er" -" ne2k_pci pcnet rtl8139 e1000\n"); +" ne2k_pci pcnet rtl8139 e1000 virtio\n"); exit (1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); diff --git a/hw/pci.h b/hw/pci.h index c885cc5..e9e5ed3 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -145,4 +145,7 @@ PCIBus *pci_prep_init(qemu_irq *pic); PCIBus *pci_apb_init(target_phys_addr_t special_base, target_phys_addr_t mem_base, qemu_irq *pic); +/* virtio.c */ +PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn); + #endif diff --git a/hw/virtio-net.c b/hw/virtio-net.c new file mode 100644 index 000..e21aa1e --- /dev/null +++ b/hw/virtio-net.c @@ -0,0 +1,162 @@ +/* + * Virtio Network Device + * + * Copyright IBM, Corp. 2007 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "virtio.h" +#include "net.h" +#include "pc.h" +#include "qemu-timer.h" +#include "virtio-net.h" + +#define TX_TIMER_INTERVAL (1000 / 500) + +typedef struct VirtIONet +{ +VirtIODevice vdev; +uint8_t mac[6]; +VirtQueue *rx_vq; +VirtQueue *tx_vq; +VLANClientState *vc; +QEMUTimer *tx_timer; +int tx_timer_active; +} VirtIONet; + +static VirtIONet *to_virtio_net(VirtIODevice *vdev) +{ +return (VirtIONet *)vdev; +} + +static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) +{ +VirtIONet *n = to_virtio_net(vdev); +struct virtio_net_config netcfg; + +memcpy(netcfg.mac, n->mac, 6); +memcpy(config, &netcfg, sizeof(netcfg)); +} + +static uint32_t virtio_net_get_features(VirtIODevice *vdev) +{ +return (1 << VIRTIO_NET_F_MAC); +} + +/* RX */ + +static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq) +{ +} + +static void virtio_net_receive(void *opaque, const uint8_t *buf, int size) +{ +VirtIONet *n = opaque; +VirtQueueElement *elem; +struct virtio_net_hdr hdr; + +/* FIXME: the drivers really need to set their status better */ +if (!virtio_ring_inited(n->rx_vq)) + return; + +if ((elem = virtqueue_pop(n->rx_vq)) == NULL) + /* wait until the guest adds some rx bufs */ + return; + +memset(&hdr, 0, sizeof(hdr)); +hdr.flags = 0; +hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE; + +memcpy_to_iovector(elem->in, 0, sizeof(hdr), &hdr); +memcpy_to_iovector(elem->in, sizeof(hdr), size, buf); + +/* signal other side */ +virtqueue_push(n->rx_vq, elem, sizeof(hdr) + size); +virtio_notify(&n->vdev, n->rx_vq); +} + +/* TX */ +static void virtio_net_flush_tx(VirtIONet *n, VirtQueue *vq) +{ +VirtQueueElement *elem; + +if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) +return; + +while ((elem = virtqueue_pop(vq))) { + IOVector *sg; + size_t out_size; + + /* ignore the header for now */ + out_size = iovector_size(elem->out); + + sg = iovector_trim(elem->out, sizeof(struct virtio_net_hdr), + out_size - sizeof(struct virtio_net_hdr)); + + qemu_sendv_packet(n->vc, sg); + + iovector_free(sg); + + virtqueue_push(vq, elem, out_size); + virtio_notify(&n->vdev, vq); +} +} + +static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) +{ +VirtIONet *n = to_virtio_net(vdev); + +if (n->tx_timer_active && + virtio_ring_avail_size(vq) == 64) { + virtio_ring_set_used_no_notify(vq, 0); + qemu_del_timer(n->tx_timer); + n->tx_timer_active = 0; + virtio_net_flush_tx(n, vq); +} else { + qemu_mod_timer(n->tx_timer, + qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); + n->tx_timer_active = 1; + vi
[kvm-devel] [PATCH 2/5] virtio for QEMU (v3)
This patch introduces virtio support over PCI. virtio is a generic virtual IO framework for Linux first introduced in 2.6.23. Since 2.6.25, virtio has supported a PCI transport which this patch implements. Since the last time these patches were posted to qemu-devel, I've reworked it to use the proper access functions to manipulate guest memory. Signed-off-by: Anthony Liguori <[EMAIL PROTECTED]> diff --git a/Makefile.target b/Makefile.target index 8470164..3e9f7b1 100644 --- a/Makefile.target +++ b/Makefile.target @@ -534,6 +534,9 @@ OBJS += pcnet.o OBJS += rtl8139.o OBJS += e1000.o +# virtio devices +OBJS += virtio.o + ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o diff --git a/cutils.c b/cutils.c index 9ef2fa6..814b3c4 100644 --- a/cutils.c +++ b/cutils.c @@ -95,3 +95,14 @@ time_t mktimegm(struct tm *tm) t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; return t; } + +int fls(int i) +{ +int bit; + +for (bit=31; bit >= 0; bit--) +if (i & (1 << bit)) +return bit+1; + +return 0; +} diff --git a/hw/virtio-pci.h b/hw/virtio-pci.h new file mode 100644 index 000..9262e49 --- /dev/null +++ b/hw/virtio-pci.h @@ -0,0 +1,65 @@ +/* + * Virtio Support + * + * Copyright IBM, Corp. 2007-2008 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * Rusty Russell <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef _VIRTIO_PCI_H +#define _VIRTIO_PCI_H + +/* from Linux's linux/virtio_ring.h */ + +/* This marks a buffer as continuing via the next field. */ +#define VRING_DESC_F_NEXT 1 +/* This marks a buffer as write-only (otherwise read-only). */ +#define VRING_DESC_F_WRITE 2 + +/* This means don't notify other side when buffer added. */ +#define VRING_USED_F_NO_NOTIFY 1 +/* This means don't interrupt guest when buffer consumed. */ +#define VRING_AVAIL_F_NO_INTERRUPT 1 + +#define VIRTIO_PCI_QUEUE_MAX 16 + +/* from Linux's linux/virtio_pci.h */ + +/* A 32-bit r/o bitmask of the features supported by the host */ +#define VIRTIO_PCI_HOST_FEATURES 0 + +/* A 32-bit r/w bitmask of features activated by the guest */ +#define VIRTIO_PCI_GUEST_FEATURES 4 + +/* A 32-bit r/w PFN for the currently selected queue */ +#define VIRTIO_PCI_QUEUE_PFN 8 + +/* A 16-bit r/o queue size for the currently selected queue */ +#define VIRTIO_PCI_QUEUE_NUM 12 + +/* A 16-bit r/w queue selector */ +#define VIRTIO_PCI_QUEUE_SEL 14 + +/* A 16-bit r/w queue notifier */ +#define VIRTIO_PCI_QUEUE_NOTIFY16 + +/* An 8-bit device status register. */ +#define VIRTIO_PCI_STATUS 18 + +/* An 8-bit r/o interrupt status register. Reading the value will return the + * current contents of the ISR and will also clear it. This is effectively + * a read-and-acknowledge. */ +#define VIRTIO_PCI_ISR 19 + +#define VIRTIO_PCI_CONFIG 20 + +/* Virtio ABI version, if we increment this, we break the guest driver. */ +#define VIRTIO_PCI_ABI_VERSION 0 + +#endif diff --git a/hw/virtio.c b/hw/virtio.c new file mode 100644 index 000..f364ef3 --- /dev/null +++ b/hw/virtio.c @@ -0,0 +1,592 @@ +/* + * Virtio Support + * + * Copyright IBM, Corp. 2007-2008 + * + * Authors: + * Anthony Liguori <[EMAIL PROTECTED]> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include +#include + +#include "virtio.h" +#include "sysemu.h" +#include "virtio-pci.h" + +typedef struct VRingDesc +{ +/* Address (guest-physical). */ +uint64_t addr; +/* Length. */ +uint32_t len; +/* The flags as indicated above. */ +uint16_t flags; +/* We chain unused descriptors via this, too */ +uint16_t next; +} VRingDesc; + +typedef struct VRingAvail +{ +uint16_t flags; +uint16_t idx; +uint16_t ring[]; +} VRingAvail; + +typedef struct VRingUsedElem +{ +/* Index of start of used descriptor chain. */ +uint32_t id; +/* Total length of the descriptor chain which was used (written to) */ +uint32_t len; +} VRingUsedElem; + +typedef struct VRingUsed +{ +uint16_t flags; +uint16_t idx; +VRingUsedElem ring[]; +} VRingUsed; + +typedef struct VRing +{ +unsigned int num; +target_phys_addr_t desc; +target_phys_addr_t avail; +target_phys_addr_t used; +} VRing; + +struct VirtQueue +{ +VRing vring; +uint32_t pfn; +uint16_t last_avail_idx; +void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); +int index; +VirtIODevice *vdev; +}; + +/* QEMU doesn't strictly need write barriers since everything runs in + * lock-step. We'll leave the calls to wmb() in though to make it obvious for + * KVM or if kqemu gets SMP support. + */ + +#define wmb() do { } while (0) + +/* FIXME
[kvm-devel] [PATCH] [KVM] Rename debugfs_dir to kvm_debugfs_dir
3 files changed, 7 insertions(+), 7 deletions(-) include/linux/kvm_host.h |2 +- virt/kvm/kvm_main.c |8 virt/kvm/kvm_trace.c |4 ++-- # HG changeset patch # User Hollis Blanchard <[EMAIL PROTECTED]> # Date 1208293411 18000 # Node ID 524092a595b246f17ab56199e3afebded1e987a6 # Parent 8ad2f90233993539c3c919c2c303041611ecdcb4 [KVM] Rename debugfs_dir to kvm_debugfs_dir. It's a globally exported symbol now. Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -315,7 +315,7 @@ struct dentry *dentry; }; extern struct kvm_stats_debugfs_item debugfs_entries[]; -extern struct dentry *debugfs_dir; +extern struct dentry *kvm_debugfs_dir; #ifdef CONFIG_KVM_TRACE int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -60,7 +60,7 @@ static __read_mostly struct preempt_ops kvm_preempt_ops; -struct dentry *debugfs_dir; +struct dentry *kvm_debugfs_dir; static long kvm_vcpu_ioctl(struct file *file, unsigned int ioctl, unsigned long arg); @@ -1392,9 +1392,9 @@ { struct kvm_stats_debugfs_item *p; - debugfs_dir = debugfs_create_dir("kvm", NULL); + kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); for (p = debugfs_entries; p->name; ++p) - p->dentry = debugfs_create_file(p->name, 0444, debugfs_dir, + p->dentry = debugfs_create_file(p->name, 0444, kvm_debugfs_dir, (void *)(long)p->offset, stat_fops[p->kind]); } @@ -1405,7 +1405,7 @@ for (p = debugfs_entries; p->name; ++p) debugfs_remove(p->dentry); - debugfs_remove(debugfs_dir); + debugfs_remove(kvm_debugfs_dir); } static int kvm_suspend(struct sys_device *dev, pm_message_t state) diff --git a/virt/kvm/kvm_trace.c b/virt/kvm/kvm_trace.c --- a/virt/kvm/kvm_trace.c +++ b/virt/kvm/kvm_trace.c @@ -159,12 +159,12 @@ r = -EIO; atomic_set(&kt->lost_records, 0); - kt->lost_file = debugfs_create_file("lost_records", 0444, debugfs_dir, + kt->lost_file = debugfs_create_file("lost_records", 0444, kvm_debugfs_dir, kt, &kvm_trace_lost_ops); if (!kt->lost_file) goto err; - kt->rchan = relay_open("trace", debugfs_dir, kuts->buf_size, + kt->rchan = relay_open("trace", kvm_debugfs_dir, kuts->buf_size, kuts->buf_nr, &kvm_relay_callbacks, kt); if (!kt->rchan) goto err; - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH 1/5]Add some trace markers and expose interfaces in kernel for tracing
On Wednesday 09 April 2008 05:01:36 Liu, Eric E wrote: > +/* This structure represents a single trace buffer record. */ > +struct kvm_trace_rec { > + __u32 event:28; > + __u32 extra_u32:3; > + __u32 cycle_in:1; > + __u32 pid; > + __u32 vcpu_id; > + union { > + struct { > + __u32 cycle_lo, cycle_hi; > + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; > + } cycle; > + struct { > + __u32 extra_u32[KVM_TRC_EXTRA_MAX]; > + } nocycle; > + } u; > +}; Do we really need bitfields here? They are notoriously non-portable. Practically speaking, this will prevent me from copying a trace file from my big-endian target to my little-endian workstation for analysis, at least without some ugly hacking in the userland tool. -- Hollis Blanchard IBM Linux Technology Center - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH] [v3][kvm-userspace] Make "make sync" in kernel dir work for multiple archs
1 file changed, 31 insertions(+), 17 deletions(-) kernel/Makefile | 48 +++- - fix where $(ARCH_DIR) is lower case and for -DCONFIG_? in _unifdef macro it needs to be upper case. This patch add the ability for make sync in the kernel directory to work for mulitiple architectures and not just x86. Signed-off-by: Jerone Young <[EMAIL PROTECTED]> diff --git a/kernel/Makefile b/kernel/Makefile --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,5 +1,10 @@ include ../config.mak include ../config.mak +ARCH_DIR=$(ARCH) +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' + ARCH_DIR=x86 +endif + KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR)) DESTDIR= @@ -18,11 +23,25 @@ _hack = mv $1 $1.orig && \ | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig _unifdef = mv $1 $1.orig && \ - unifdef -DCONFIG_X86 $1.orig > $1; \ + unifdef -DCONFIG_$(shell echo $(ARCH_DIR)|tr '[:lower:]' '[:upper:]') $1.orig > $1; \ [ $$? -le 1 ] && rm $1.orig hack = $(call _hack,tmp/$(strip $1)) unifdef = $(call _unifdef,tmp/$(strip $1)) + +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' +UNIFDEF_FILES = include/linux/kvm.h \ + include/linux/kvm_para.h \ + include/asm-$(ARCH_DIR)/kvm.h \ + include/asm-x86/kvm_para.h + +HACK_FILES = kvm_main.c \ + mmu.c \ + vmx.c \ + svm.c \ + x86.c \ + irq.h +endif all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat @@ -34,26 +53,21 @@ sync: sync: rm -rf tmp include rsync --exclude='*.mod.c' -R \ - "$(LINUX)"/arch/x86/kvm/./*.[ch] \ + "$(LINUX)"/arch/$(ARCH_DIR)/kvm/./*.[ch] \ "$(LINUX)"/virt/kvm/./*.[ch] \ "$(LINUX)"/./include/linux/kvm*.h \ -"$(LINUX)"/./include/asm-x86/kvm*.h \ +"$(LINUX)"/./include/asm-$(ARCH_DIR)/kvm*.h \ tmp/ - mkdir -p include/linux include/asm-x86 - ln -s asm-x86 include/asm - ln -sf asm-x86 include-compat/asm + mkdir -p include/linux include/asm-$(ARCH_DIR) + ln -s asm-$(ARCH_DIR) include/asm + ln -sf asm-$(ARCH_DIR) include-compat/asm - $(call unifdef, include/linux/kvm.h) - $(call unifdef, include/linux/kvm_para.h) - $(call unifdef, include/asm-x86/kvm.h) - $(call unifdef, include/asm-x86/kvm_para.h) - $(call hack, include/linux/kvm.h) - $(call hack, kvm_main.c) - $(call hack, mmu.c) - $(call hack, vmx.c) - $(call hack, svm.c) - $(call hack, x86.c) - $(call hack, irq.h) + for i in $(UNIFDEF_FILES); \ + do $(call unifdef, $$i); done + + for i in $(HACK_FILES); \ + do $(call hack, $$i); done + for i in $$(find tmp -type f -printf '%P '); \ do cmp -s $$i tmp/$$i || cp tmp/$$i $$i; done rm -rf tmp - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH] [v2][kvm-userspace] Make "make sync" in kernel dir work for multiple archs
1 file changed, 31 insertions(+), 17 deletions(-) kernel/Makefile | 48 +++- This patch add the ability for make sync in the kernel directory to work for mulitiple architectures and not just x86. Signed-off-by: Jerone Young <[EMAIL PROTECTED]> diff --git a/kernel/Makefile b/kernel/Makefile --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,5 +1,10 @@ include ../config.mak include ../config.mak +ARCH_DIR=$(ARCH) +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' + ARCH_DIR=x86 +endif + KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR)) DESTDIR= @@ -18,11 +23,25 @@ _hack = mv $1 $1.orig && \ | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig _unifdef = mv $1 $1.orig && \ - unifdef -DCONFIG_X86 $1.orig > $1; \ + unifdef -DCONFIG_$(ARCH_DIR) $1.orig > $1; \ [ $$? -le 1 ] && rm $1.orig hack = $(call _hack,tmp/$(strip $1)) unifdef = $(call _unifdef,tmp/$(strip $1)) + +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' +UNIFDEF_FILES = include/linux/kvm.h \ + include/linux/kvm_para.h \ + include/asm-$(ARCH_DIR)/kvm.h \ + include/asm-x86/kvm_para.h + +HACK_FILES = kvm_main.c \ + mmu.c \ + vmx.c \ + svm.c \ + x86.c \ + irq.h +endif all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat @@ -34,26 +53,21 @@ sync: sync: rm -rf tmp include rsync --exclude='*.mod.c' -R \ - "$(LINUX)"/arch/x86/kvm/./*.[ch] \ + "$(LINUX)"/arch/$(ARCH_DIR)/kvm/./*.[ch] \ "$(LINUX)"/virt/kvm/./*.[ch] \ "$(LINUX)"/./include/linux/kvm*.h \ -"$(LINUX)"/./include/asm-x86/kvm*.h \ +"$(LINUX)"/./include/asm-$(ARCH_DIR)/kvm*.h \ tmp/ - mkdir -p include/linux include/asm-x86 - ln -s asm-x86 include/asm - ln -sf asm-x86 include-compat/asm + mkdir -p include/linux include/asm-$(ARCH_DIR) + ln -s asm-$(ARCH_DIR) include/asm + ln -sf asm-$(ARCH_DIR) include-compat/asm - $(call unifdef, include/linux/kvm.h) - $(call unifdef, include/linux/kvm_para.h) - $(call unifdef, include/asm-x86/kvm.h) - $(call unifdef, include/asm-x86/kvm_para.h) - $(call hack, include/linux/kvm.h) - $(call hack, kvm_main.c) - $(call hack, mmu.c) - $(call hack, vmx.c) - $(call hack, svm.c) - $(call hack, x86.c) - $(call hack, irq.h) + for i in $(UNIFDEF_FILES); \ + do $(call unifdef, $$i); done + + for i in $(HACK_FILES); \ + do $(call hack, $$i); done + for i in $$(find tmp -type f -printf '%P '); \ do cmp -s $$i tmp/$$i || cp tmp/$$i $$i; done rm -rf tmp - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [kvm-ppc-devel] [PATCH] [v2 ][kvm-userspace] Make "make sync" in kern el dir work for multiple archs
On Tuesday 15 April 2008 14:43:12 Jerone Young wrote: > 1 file changed, 31 insertions(+), 17 deletions(-) > kernel/Makefile | 48 +++- > > > This patch add the ability for make sync in the kernel directory to work > for mulitiple architectures and not just x86. > > Signed-off-by: Jerone Young <[EMAIL PROTECTED]> > > diff --git a/kernel/Makefile b/kernel/Makefile > --- a/kernel/Makefile > +++ b/kernel/Makefile > @@ -1,5 +1,10 @@ include ../config.mak > include ../config.mak > > +ARCH_DIR=$(ARCH) > +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' > + ARCH_DIR=x86 > +endif > + > KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR)) > > DESTDIR= > @@ -18,11 +23,25 @@ _hack = mv $1 $1.orig && \ > > | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig > > _unifdef = mv $1 $1.orig && \ > - unifdef -DCONFIG_X86 $1.orig > $1; \ > + unifdef -DCONFIG_$(ARCH_DIR) $1.orig > $1; \ >[ $$? -le 1 ] && rm $1.orig This isn't going to work because you've changed -DCONFIG_X86 to -DCONFIG_x86 . -- Hollis Blanchard IBM Linux Technology Center - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH] [v2][kvm-userspace] Make "make sync" in kernel dir work for multiple archs
1 file changed, 31 insertions(+), 17 deletions(-) kernel/Makefile | 48 +++- This patch add the ability for make sync in the kernel directory to work for mulitiple architectures and not just x86. Signed-off-by: Jerone Young <[EMAIL PROTECTED]> diff --git a/kernel/Makefile b/kernel/Makefile --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,5 +1,10 @@ include ../config.mak include ../config.mak +ARCH_DIR=$(ARCH) +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' + ARCH_DIR=x86 +endif + KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR)) DESTDIR= @@ -18,11 +23,25 @@ _hack = mv $1 $1.orig && \ | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig _unifdef = mv $1 $1.orig && \ - unifdef -DCONFIG_X86 $1.orig > $1; \ + unifdef -DCONFIG_$(ARCH_DIR) $1.orig > $1; \ [ $$? -le 1 ] && rm $1.orig hack = $(call _hack,tmp/$(strip $1)) unifdef = $(call _unifdef,tmp/$(strip $1)) + +ifneq '$(filter $(ARCH_DIR), x86_64 i386)' '' +UNIFDEF_FILES = include/linux/kvm.h \ + include/linux/kvm_para.h \ + include/asm-$(ARCH_DIR)/kvm.h \ + include/asm-x86/kvm_para.h + +HACK_FILES = kvm_main.c \ + mmu.c \ + vmx.c \ + svm.c \ + x86.c \ + irq.h +endif all:: # include header priority 1) $LINUX 2) $KERNELDIR 3) include-compat @@ -34,26 +53,21 @@ sync: sync: rm -rf tmp include rsync --exclude='*.mod.c' -R \ - "$(LINUX)"/arch/x86/kvm/./*.[ch] \ + "$(LINUX)"/arch/$(ARCH_DIR)/kvm/./*.[ch] \ "$(LINUX)"/virt/kvm/./*.[ch] \ "$(LINUX)"/./include/linux/kvm*.h \ -"$(LINUX)"/./include/asm-x86/kvm*.h \ +"$(LINUX)"/./include/asm-$(ARCH_DIR)/kvm*.h \ tmp/ - mkdir -p include/linux include/asm-x86 - ln -s asm-x86 include/asm - ln -sf asm-x86 include-compat/asm + mkdir -p include/linux include/asm-$(ARCH_DIR) + ln -s asm-$(ARCH_DIR) include/asm + ln -sf asm-$(ARCH_DIR) include-compat/asm - $(call unifdef, include/linux/kvm.h) - $(call unifdef, include/linux/kvm_para.h) - $(call unifdef, include/asm-x86/kvm.h) - $(call unifdef, include/asm-x86/kvm_para.h) - $(call hack, include/linux/kvm.h) - $(call hack, kvm_main.c) - $(call hack, mmu.c) - $(call hack, vmx.c) - $(call hack, svm.c) - $(call hack, x86.c) - $(call hack, irq.h) + for i in $(UNIFDEF_FILES); \ + do $(call unifdef, $$i); done + + for i in $(HACK_FILES); \ + do $(call hack, $$i); done + for i in $$(find tmp -type f -printf '%P '); \ do cmp -s $$i tmp/$$i || cp tmp/$$i $$i; done rm -rf tmp - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH 0 of 2] [RESEND] Fix PowerPC cpu initiliaztion
This patch apparently fell through the cracks or I didn't send the rised version to the list. These patches fix cpu initilization for PowerPC. Without them guest cannot be launched. Signed-off-by: Jerone Young <[EMAIL PROTECTED]> 2 files changed, 6 insertions(+), 3 deletions(-) qemu/hw/ppc440_bamboo.c |3 --- qemu/qemu-kvm-powerpc.c |6 ++ - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH 1 of 2] Add kvm_load_registers into qemu_arch_init for PowerPC
1 file changed, 6 insertions(+) qemu/qemu-kvm-powerpc.c |6 ++ This patch adds a call to load_kvm_registers after creation of vcpu. This is required for ppc since we are required to set certain registers before boot. Signed-off-by: Jerone Young <[EMAIL PROTECTED]> diff --git a/qemu/qemu-kvm-powerpc.c b/qemu/qemu-kvm-powerpc.c --- a/qemu/qemu-kvm-powerpc.c +++ b/qemu/qemu-kvm-powerpc.c @@ -121,6 +121,12 @@ void kvm_arch_save_regs(CPUState *env) int kvm_arch_qemu_init_env(CPUState *cenv) { +if (cenv->cpu_index == 0) { +/* load any registers set in env into + kvm for the first guest vcpu */ +kvm_load_registers(cenv); +} + return 0; } - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH 2 of 2] Remove kvm_load_registers from ppc440_bamboo board model
1 file changed, 3 deletions(-) qemu/hw/ppc440_bamboo.c |3 --- This patch removes the call to kvm_load_registers while in board platform setup code. This must now be done later in vcpu initialization. Signed-off-by: Jerone Young <[EMAIL PROTECTED]> diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c --- a/qemu/hw/ppc440_bamboo.c +++ b/qemu/hw/ppc440_bamboo.c @@ -174,9 +174,6 @@ void bamboo_init(ram_addr_t ram_size, in env->gpr[3] = dt_base; #endif env->nip = ep; - - printf("%s: loading kvm registers\n", __func__); - kvm_load_registers(env); } for (i = 0; i < nb_nics; i++) { - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] [kvm-userspace] Make "make sync" in kernel dir work for multiple archs
On Tuesday 15 April 2008 11:20:58 Jerone Young wrote: > > What happened to my suggestion of creating a per-arch HACK_FILES and > > UNIFDEF_FILES variables, and looping over those? > > These macros are only for x86. We don't want them or need them. So I > just left them be as not to accidentally miss or break anything. Right, they are only used for x86. So as I said before, create arch-specific HACK_FILES and UNIFDEF_FILES variables, and use those instead. -- Hollis Blanchard IBM Linux Technology Center - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Avi Kivity wrote: > Anthony Liguori wrote: >> >> With the IO thread, we don't have to worry about lost signals like we >> do in a VCPU thread so it's fine to just use select() and install >> signal handlers IIUC. >> > > What about aio completions? The only race-free way to handle both > posix aio completion and fd readiness is signals AFAIK. We poll aio completion after the select don't we? Worst case scenario we miss a signal and wait to poll after the next select event. That's going to occur very often because of the timer. Regards, Anthony Liguori - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] Chaning disks from IDE to SCSI on a Windows VM
On Tuesday 15 April 2008 12:57:45 am Jun Koi wrote: > Looks like a problem, however. In his instruction, part 3: > >3. Shut down the VM. This time, don't include the new temporary > > image from step 1 and define your disk(s) as SCSI disks: > > > > qemu-system-x86_64 -m 256 \ > >-drive file=hda.img,if=scsi,bus=0,index=0,media=disk,boot=off > > ... > > I think above should have "boot=on", rather than "boot=off". > Otherwise, you cannot boot from scsi disk, right? You are right! That's what happens when you copy and paste code. :-) > I tried the above instructions with WinXP, but WinXP cannot boot > successfully: it stops somewhere in the middle, and hang there. I tried it on a vanilla install of WinXP SP2, no updates. I guess I should try using a fully patched version of XP and see what that does. In step #2, did the Device Manager show the SCSI disk? -- Alberto Treviño [EMAIL PROTECTED] Testing Center Brigham Young University - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] [kvm-userspace] Make "make sync" in kernel dir work for multiple archs
On Tue, 2008-04-15 at 09:08 -0500, Hollis Blanchard wrote: > On Monday 14 April 2008 21:46:43 Jerone Young wrote: > > 1 file changed, 13 insertions(+), 5 deletions(-) > > kernel/Makefile | 18 +- > > > > > > This patch add the ability for make sync in the kernel directory to work > > for mulitiple architectures and not just x86. > > > > Signed-off-by: Jerone Young <[EMAIL PROTECTED]> > > > > diff --git a/kernel/Makefile b/kernel/Makefile > > --- a/kernel/Makefile > > +++ b/kernel/Makefile > > @@ -1,5 +1,10 @@ include ../config.mak > > include ../config.mak > > > > +ASM_DIR=$(ARCH) > > +ifneq '$(filter $(ASM_DIR), x86_64 i386 ia64)' '' > > + ASM_DIR=x86 > > +endif > > Minor complaint: "ASM_DIR" really isn't. You use it as arch/$(ASM_DIR) and > also as include/asm-$(ASM_DIR). I think what you really meant is "ARCH_DIR" > (or similar). I can change it. Not that big of a deal. Oh left the ia64 on there by accident. > > > +ifneq '$(filter $(ASM_DIR), x86_64 i386 ia64)' '' > > $(call unifdef, include/linux/kvm.h) > > $(call unifdef, include/linux/kvm_para.h) > > $(call unifdef, include/asm-x86/kvm.h) > > @@ -54,6 +60,8 @@ sync: > > $(call hack, svm.c) > > $(call hack, x86.c) > > $(call hack, irq.h) > > +endif > > + > > Why are you keeping IA64 touching asm-x86? Accident. Cut and past error from the first mistake. > > What happened to my suggestion of creating a per-arch HACK_FILES and > UNIFDEF_FILES variables, and looping over those? These macros are only for x86. We don't want them or need them. So I just left them be as not to accidentally miss or break anything. > - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Anthony Liguori wrote: > > With the IO thread, we don't have to worry about lost signals like we > do in a VCPU thread so it's fine to just use select() and install > signal handlers IIUC. > What about aio completions? The only race-free way to handle both posix aio completion and fd readiness is signals AFAIK. -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Marcelo Tosatti wrote: > On Tue, Apr 15, 2008 at 05:45:28PM +0300, Avi Kivity wrote: > >> Anthony Liguori wrote: >> >>> Why did we ever need sigtimedwait() anyway? Even if we were >>> select()ing within the VCPU context, we should break out of the >>> select() on signal delivery. >>> >>> >> select() is no good since if the signal is delivered after the select(), >> but before entry into guest mode, it is lost. pselect() might work, but >> its is not supported on all hosts, and it (AFAICT) delivers the signals >> by calling their handlers, which is slow and unnecessary. >> > > Anthony tested a patch using signalfd: > > http://people.redhat.com/~mtosatti/io-thread-select-timeout > > Which is only available on newer hosts. I guess the signals will have to > stay for older hosts. > With the IO thread, we don't have to worry about lost signals like we do in a VCPU thread so it's fine to just use select() and install signal handlers IIUC. Regards, Anthony Liguori - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
On Tue, Apr 15, 2008 at 08:40:09AM -0500, Anthony Liguori wrote: > Avi Kivity wrote: > >Anthony Liguori wrote: > >> > >>BTW, when we set O_ASYNC on the tap fd, we're eliminating > >>O_NONBLOCK. This means that we have to poll loop select() when > >>readv()'ing packets instead of just reading until hitting AGAIN. > >>This means at least an extra syscall per packet. Yeah, I noticed that problem too. > > > >I didn't know that O_ASYNC and O_NONBLOCK were mutually exclusive. > >Can you point me at the relevant documentation? > > I don't know that they are, but we're doing an: > > fcntl(fd, F_SETFL, O_ASYNC); > > F_SETFL is not additive so the previous O_NONBLOCK gets dropped. Fortunately read() will only be issued for the tap fd when select() returns with its fd set. And when that happens there is always a packet available for reading... - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
On Tue, Apr 15, 2008 at 05:45:28PM +0300, Avi Kivity wrote: > Anthony Liguori wrote: > > > >Why did we ever need sigtimedwait() anyway? Even if we were > >select()ing within the VCPU context, we should break out of the > >select() on signal delivery. > > > > select() is no good since if the signal is delivered after the select(), > but before entry into guest mode, it is lost. pselect() might work, but > its is not supported on all hosts, and it (AFAICT) delivers the signals > by calling their handlers, which is slow and unnecessary. Anthony tested a patch using signalfd: http://people.redhat.com/~mtosatti/io-thread-select-timeout Which is only available on newer hosts. I guess the signals will have to stay for older hosts. - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Anthony Liguori wrote: > > Why did we ever need sigtimedwait() anyway? Even if we were > select()ing within the VCPU context, we should break out of the > select() on signal delivery. > select() is no good since if the signal is delivered after the select(), but before entry into guest mode, it is lost. pselect() might work, but its is not supported on all hosts, and it (AFAICT) delivers the signals by calling their handlers, which is slow and unnecessary. -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] Extboot Option Rom rewritten in C
Nguyen Anh Quynh wrote: > On 4/15/08, Nguyen Anh Quynh <[EMAIL PROTECTED]> wrote: > > >> > You should be able to get very far along the Windows boot process with >> > extboot. If you just install the LSI driver in Win2k, you can boot up >> > completely. Someone just posted instructions for doing scsi boot with >> > Windows XP assuming you installed the VM from IDE. >> > >> >> >> I searched around for those scsi boot instructions, but dont see any. >> Any pointer? >> > > Is that the post from Alberto Treviño? Will try it soon. > Yup. Regards, Anthony Liguori > Thanks, > Q > > - > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > ___ > kvm-devel mailing list > kvm-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/kvm-devel > - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Avi Kivity wrote: > Anders wrote: > Why not enable SIGIO on stdio input, like the rest of the fd handling in qemu? >>> Thats a possibility, but I think we've now agreed that doing select() with >>> a timeout is cleaner and possibly half a cent faster. >>> >>> >> Since I can only follow this list as a hobby, I managed to miss that >> discussion. Can somebody point me to the relevant thread, as I would find >> it interesting? >> >> >> > > This was off-list. The point is, that with the iothread we don't need > to rely on signals at all (qemu needs signals to break out of the > emulation loop, kvm without iothread needs them to exit guest mode, but > the iothread can simply sit in select() waiting for an fd to become > active (or for aio to complete via a signal). > Why did we ever need sigtimedwait() anyway? Even if we were select()ing within the VCPU context, we should break out of the select() on signal delivery. Regards, Anthony Liguori - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] [kvm-userspace] Make "make sync" in kernel dir work for multiple archs
On Monday 14 April 2008 21:46:43 Jerone Young wrote: > 1 file changed, 13 insertions(+), 5 deletions(-) > kernel/Makefile | 18 +- > > > This patch add the ability for make sync in the kernel directory to work > for mulitiple architectures and not just x86. > > Signed-off-by: Jerone Young <[EMAIL PROTECTED]> > > diff --git a/kernel/Makefile b/kernel/Makefile > --- a/kernel/Makefile > +++ b/kernel/Makefile > @@ -1,5 +1,10 @@ include ../config.mak > include ../config.mak > > +ASM_DIR=$(ARCH) > +ifneq '$(filter $(ASM_DIR), x86_64 i386 ia64)' '' > + ASM_DIR=x86 > +endif Minor complaint: "ASM_DIR" really isn't. You use it as arch/$(ASM_DIR) and also as include/asm-$(ASM_DIR). I think what you really meant is "ARCH_DIR" (or similar). > +ifneq '$(filter $(ASM_DIR), x86_64 i386 ia64)' '' > $(call unifdef, include/linux/kvm.h) > $(call unifdef, include/linux/kvm_para.h) > $(call unifdef, include/asm-x86/kvm.h) > @@ -54,6 +60,8 @@ sync: > $(call hack, svm.c) > $(call hack, x86.c) > $(call hack, irq.h) > +endif > + Why are you keeping IA64 touching asm-x86? What happened to my suggestion of creating a per-arch HACK_FILES and UNIFDEF_FILES variables, and looping over those? -- Hollis Blanchard IBM Linux Technology Center - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Avi Kivity wrote: > Anthony Liguori wrote: >> >> BTW, when we set O_ASYNC on the tap fd, we're eliminating >> O_NONBLOCK. This means that we have to poll loop select() when >> readv()'ing packets instead of just reading until hitting AGAIN. >> This means at least an extra syscall per packet. > > I didn't know that O_ASYNC and O_NONBLOCK were mutually exclusive. > Can you point me at the relevant documentation? I don't know that they are, but we're doing an: fcntl(fd, F_SETFL, O_ASYNC); F_SETFL is not additive so the previous O_NONBLOCK gets dropped. Regards, Anthony Liguori - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Anthony Liguori wrote: > Avi Kivity wrote: >> Anthony Liguori wrote: >>> >>> BTW, when we set O_ASYNC on the tap fd, we're eliminating >>> O_NONBLOCK. This means that we have to poll loop select() when >>> readv()'ing packets instead of just reading until hitting AGAIN. >>> This means at least an extra syscall per packet. >> >> I didn't know that O_ASYNC and O_NONBLOCK were mutually exclusive. >> Can you point me at the relevant documentation? > > I don't know that they are, but we're doing an: > > fcntl(fd, F_SETFL, O_ASYNC); > > F_SETFL is not additive so the previous O_NONBLOCK gets dropped. > Ah, I thought it's something fundamental I'm missing. The above is just a bug. -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] gfxboot VMX workaround v2
Guillaume Thouvenin wrote: > On Mon, 07 Apr 2008 11:05:06 -0500 > Anthony Liguori <[EMAIL PROTECTED]> wrote: > > >> Perhaps a viable way to fix this upstream would be to catch the vmentry >> failure, look to see if SS.CPL != CS.CPL, and if so, invoke >> x86_emulate() in a loop until SS.CPL == CS.CPL. >> >> There are very few instructions in gfxboot that would need to be added >> to x86_emulate (if they aren't already there). >> > > So to see if I'm on the good way here is an attempt to implement the > solution. It doesn't work yet. > > I'm trying to: > - Disable the code that modifies SS value in order to detect VM entry > failure > - Add the handler that catches the VM entry failure > - Emulate the instruction until we recover a friendly VMX state > => add the jmp far (opcode 0xea) instruction in the emulation. > > With the patch, the VM entry failure is caught but the jmp far > instruction seems to fail. I've got the following dmesg: > > ... > handle_vmentry_failure: invalid guest state > handle_vmentry_failure: start emulation > handle_vmentry_failure: emulation failed > What instruction failed, exactly? > ... > > > Regards, > Guillaume > > --- > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 8e5d664..a56bd83 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -1178,13 +1178,16 @@ static void enter_pmode(struct kvm_vcpu *vcpu) > > update_exception_bitmap(vcpu); > > + fix_pmode_dataseg(VCPU_SREG_SS, &vcpu->arch.rmode.ss); > fix_pmode_dataseg(VCPU_SREG_ES, &vcpu->arch.rmode.es); > fix_pmode_dataseg(VCPU_SREG_DS, &vcpu->arch.rmode.ds); > fix_pmode_dataseg(VCPU_SREG_GS, &vcpu->arch.rmode.gs); > fix_pmode_dataseg(VCPU_SREG_FS, &vcpu->arch.rmode.fs); > You need to drop the fixes rather than add more. > > +#if 0 > vmcs_write16(GUEST_SS_SELECTOR, 0); > vmcs_write32(GUEST_SS_AR_BYTES, 0x93); > +#endif > > vmcs_write16(GUEST_CS_SELECTOR, >vmcs_read16(GUEST_CS_SELECTOR) & ~SELECTOR_RPL_MASK); > @@ -1952,6 +1955,33 @@ static int handle_rmode_exception(struct kvm_vcpu > *vcpu, > return 0; > } > > +static int handle_vmentry_failure(u32 exit_reason, struct kvm_vcpu *vcpu) > +{ > + unsigned int basic_exit_reason = (uint16_t) exit_reason; > + unsigned int cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & > SELECTOR_RPL_MASK; > + unsigned int ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & > SELECTOR_RPL_MASK; > + > + switch (basic_exit_reason) { > + case EXIT_REASON_INVALID_GUEST_STATE: > + printk(KERN_INFO "%s: invalid guest state\n", > __FUNCTION__); > + printk(KERN_INFO "%s: start emulation \n", > __FUNCTION__); > + while (cs_rpl != ss_rpl) { > + if (emulate_instruction(vcpu, NULL, 0, 0, 0) == > EMULATE_FAIL) { > + printk(KERN_INFO "%s: emulation > failed\n", __FUNCTION__); > + return 0; > + } > + cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & > SELECTOR_RPL_MASK; > + ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & > SELECTOR_RPL_MASK; > + } > + printk(KERN_INFO "%s: VMX friendly state recovered\n", > __FUNCTION__); > + break; > + default: > + printk(KERN_INFO "VM-entry failure due to unkown > reason\n"); > + return 0; > + } > + return 1; > +} > + > static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) > { > struct vcpu_vmx *vmx = to_vmx(vcpu); > @@ -2364,6 +2394,9 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, > struct kvm_vcpu *vcpu) > KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)vmcs_readl(GUEST_RIP), > (u32)((u64)vmcs_readl(GUEST_RIP) >> 32), entryexit); > > + if (unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) > + return handle_vmentry_failure(exit_reason, vcpu); > + > if (unlikely(vmx->fail)) { > kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; > kvm_run->fail_entry.hardware_entry_failure_reason > diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h > index 5dff460..200c0f8 100644 > --- a/arch/x86/kvm/vmx.h > +++ b/arch/x86/kvm/vmx.h > @@ -223,7 +223,10 @@ enum vmcs_field { > #define EXIT_REASON_IO_INSTRUCTION 30 > #define EXIT_REASON_MSR_READ31 > #define EXIT_REASON_MSR_WRITE 32 > +#define EXIT_REASON_INVALID_GUEST_STATE 33 > +#define EXIT_REASON_MSR_LOADING 34 > #define EXIT_REASON_MWAIT_INSTRUCTION 36 > +#define EXIT_REASON_MACHINE_CHECK 41 > #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 > #define EXIT_REASON_APIC_ACCESS 44 > #define EXIT_REASON_WBINVD 54 > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
Re: [kvm-devel] Extboot Option Rom rewritten in C
On Tue, Apr 15, 2008 at 12:34 PM, Anthony Liguori <[EMAIL PROTECTED]> wrote: > Nguyen Anh Quynh wrote: > > On 4/15/08, Anthony Liguori <[EMAIL PROTECTED]> wrote: > > > >> Hi Nguyen, > >> > >> Nguyen Anh Quynh wrote: > >> > >> > >>> Hi Anthony, > >>> > >>> I spot a bug and few dead code in the extboot option rom. Perhaps the > >>> reason they are there is because less people want to look at assembly > >>> code, and it looks indeed scary. > >>> > >>> So I decided to rewrite it in C, using .code16gcc directive. Some > >>> > >> advantages: > >> > >>> - C code is easier to understand, find bugs, maintain and hack (so we > >>> can add more features in the future) > >>> - The binary image is same: 1.5K. The actual code size is also about > >>> the same size: around 1.2K. (gcc can optimize really well) > >>> > >>> > >>> > >> I think converting to code16gcc is a good direction to go in. I actually > >> rewrote it myself using code16gcc but I ran into problems with segment > >> assumptions and Windows guests. I tried out your version with a Linux > guest > >> with good success but it fails with a win2k guest. > >> > >> Have you tested with a Windows guest? > >> > > > > Not yet. Last time I tried, the Windows virtio drivers posted a while > > ago dont work with my WinXP. I will try again, though. > > > > I just test with scsi, not virtio. > > You should be able to get very far along the Windows boot process with > extboot. If you just install the LSI driver in Win2k, you can boot up > completely. Someone just posted instructions for doing scsi boot with > Windows XP assuming you installed the VM from IDE. > Anthony, could you post in detail on how to configure LSI with W2k to boot on scsi? I tried hard here, but it never works for me. I always get error at bootup step. W2k reports something like it cannot find Windows kernel :-( Many thanks, Jun - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH] gfxboot VMX workaround v2
On Mon, 07 Apr 2008 11:05:06 -0500 Anthony Liguori <[EMAIL PROTECTED]> wrote: > Perhaps a viable way to fix this upstream would be to catch the vmentry > failure, look to see if SS.CPL != CS.CPL, and if so, invoke > x86_emulate() in a loop until SS.CPL == CS.CPL. > > There are very few instructions in gfxboot that would need to be added > to x86_emulate (if they aren't already there). So to see if I'm on the good way here is an attempt to implement the solution. It doesn't work yet. I'm trying to: - Disable the code that modifies SS value in order to detect VM entry failure - Add the handler that catches the VM entry failure - Emulate the instruction until we recover a friendly VMX state => add the jmp far (opcode 0xea) instruction in the emulation. With the patch, the VM entry failure is caught but the jmp far instruction seems to fail. I've got the following dmesg: ... handle_vmentry_failure: invalid guest state handle_vmentry_failure: start emulation handle_vmentry_failure: emulation failed ... Regards, Guillaume --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 8e5d664..a56bd83 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1178,13 +1178,16 @@ static void enter_pmode(struct kvm_vcpu *vcpu) update_exception_bitmap(vcpu); + fix_pmode_dataseg(VCPU_SREG_SS, &vcpu->arch.rmode.ss); fix_pmode_dataseg(VCPU_SREG_ES, &vcpu->arch.rmode.es); fix_pmode_dataseg(VCPU_SREG_DS, &vcpu->arch.rmode.ds); fix_pmode_dataseg(VCPU_SREG_GS, &vcpu->arch.rmode.gs); fix_pmode_dataseg(VCPU_SREG_FS, &vcpu->arch.rmode.fs); +#if 0 vmcs_write16(GUEST_SS_SELECTOR, 0); vmcs_write32(GUEST_SS_AR_BYTES, 0x93); +#endif vmcs_write16(GUEST_CS_SELECTOR, vmcs_read16(GUEST_CS_SELECTOR) & ~SELECTOR_RPL_MASK); @@ -1952,6 +1955,33 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, return 0; } +static int handle_vmentry_failure(u32 exit_reason, struct kvm_vcpu *vcpu) +{ + unsigned int basic_exit_reason = (uint16_t) exit_reason; + unsigned int cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK; + unsigned int ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK; + + switch (basic_exit_reason) { + case EXIT_REASON_INVALID_GUEST_STATE: + printk(KERN_INFO "%s: invalid guest state\n", __FUNCTION__); + printk(KERN_INFO "%s: start emulation \n", __FUNCTION__); + while (cs_rpl != ss_rpl) { + if (emulate_instruction(vcpu, NULL, 0, 0, 0) == EMULATE_FAIL) { + printk(KERN_INFO "%s: emulation failed\n", __FUNCTION__); + return 0; + } + cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK; + ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK; + } + printk(KERN_INFO "%s: VMX friendly state recovered\n", __FUNCTION__); + break; + default: + printk(KERN_INFO "VM-entry failure due to unkown reason\n"); + return 0; + } + return 1; +} + static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { struct vcpu_vmx *vmx = to_vmx(vcpu); @@ -2364,6 +2394,9 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)vmcs_readl(GUEST_RIP), (u32)((u64)vmcs_readl(GUEST_RIP) >> 32), entryexit); + if (unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY)) + return handle_vmentry_failure(exit_reason, vcpu); + if (unlikely(vmx->fail)) { kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; kvm_run->fail_entry.hardware_entry_failure_reason diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h index 5dff460..200c0f8 100644 --- a/arch/x86/kvm/vmx.h +++ b/arch/x86/kvm/vmx.h @@ -223,7 +223,10 @@ enum vmcs_field { #define EXIT_REASON_IO_INSTRUCTION 30 #define EXIT_REASON_MSR_READ31 #define EXIT_REASON_MSR_WRITE 32 +#define EXIT_REASON_INVALID_GUEST_STATE 33 +#define EXIT_REASON_MSR_LOADING 34 #define EXIT_REASON_MWAIT_INSTRUCTION 36 +#define EXIT_REASON_MACHINE_CHECK 41 #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 #define EXIT_REASON_APIC_ACCESS 44 #define EXIT_REASON_WBINVD 54 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0ce5563..b38065d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3267,7 +3267,7 @@ static int load_segment_descriptor_to_kvm_desct(struct kvm_vcpu *vcpu, return 0; } -static int load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, +int load_segment_descri
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Anders wrote: > >>> Why not enable SIGIO on stdio input, like the rest of the fd handling in >>> qemu? >>> >> Thats a possibility, but I think we've now agreed that doing select() with >> a timeout is cleaner and possibly half a cent faster. >> > > Since I can only follow this list as a hobby, I managed to miss that > discussion. Can somebody point me to the relevant thread, as I would find > it interesting? > > This was off-list. The point is, that with the iothread we don't need to rely on signals at all (qemu needs signals to break out of the emulation loop, kvm without iothread needs them to exit guest mode, but the iothread can simply sit in select() waiting for an fd to become active (or for aio to complete via a signal). -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH 4 of 4] Remove kvm kernel-path option from qemu
Jerone Young wrote: > 2 files changed, 2 insertions(+), 8 deletions(-) > qemu/Makefile.target |3 +-- > qemu/configure |7 +-- > > > Now that kvm headers are synced locally, qemu does not need a specific option > to find the kernel headers as they can now be specified in the > --extra-cflags option. > > I find it quite useful to compile qemu without running 'make sync' too often (using --with-patched-kernel). These days the headers don't change so often, so maybe this is less of an issue. -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [PATCH 1 of 4] Add "make sync" to sync need kernel headers to kvm-userspace
Jerone Young wrote: > 2 files changed, 25 insertions(+), 4 deletions(-) > Makefile | 21 - > configure |8 +--- > > > This patch adds ability for kvm-userspace build system to sync needed kernel > headers locally without the need of compiled kernel source. > > Signed-off-by: Jerone Young <[EMAIL PROTECTED]> > > diff --git a/Makefile b/Makefile > --- a/Makefile > +++ b/Makefile > @@ -7,7 +7,7 @@ rpmrelease = devel > > .PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt > > -all: libkvm qemu > +all: sync libkvm qemu > 'all' shouldn't include 'sync', since it's run by end users that have just the tarball, not an entire kernel. > ifneq '$(filter $(ARCH), x86_64 i386 ia64)' '' > all: $(if $(WANT_MODULE), kernel) user > endif > @@ -69,6 +69,24 @@ install: > make -C libkvm DESTDIR="$(DESTDIR)" install > make -C qemu DESTDIR="$(DESTDIR)" install > > + > +ASM_DIR=$(ARCH) > +ifneq '$(filter $(ARCH), i386 x86_64)' '' > + ASM_DIR=x86 > +endif > + > +sync: > + mkdir -p $(INCLUDES_DIR) > + mkdir -p $(INCLUDES_DIR)/asm-$(ASM_DIR) > + mkdir -p $(INCLUDES_DIR)/linux > + cp -f $(KERNELDIR)/include/asm-$(ASM_DIR)/kvm*.h \ > + $(INCLUDES_DIR)/asm-$(ASM_DIR)/ > + cp -f $(KERNELDIR)/include/linux/kvm*.h \ > + $(KERNELDIR)/include/linux/compiler*.h \ > + $(INCLUDES_DIR)/linux > + ln -sf $(INCLUDES_DIR)/asm-$(ASM_DIR) $(INCLUDES_DIR)/asm > + > + > Please use the existing infrastructure in kernel/Makefile. -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
Re: [kvm-devel] [patch 2/2] QEMU: decrease console "refresh rate" with -nographic
Marcelo Tosatti wrote: > On Mon, Apr 14, 2008 at 07:24:06PM +0300, Avi Kivity wrote: >> Why not enable SIGIO on stdio input, like the rest of the fd handling in >> qemu? > > Thats a possibility, but I think we've now agreed that doing select() with > a timeout is cleaner and possibly half a cent faster. Since I can only follow this list as a hobby, I managed to miss that discussion. Can somebody point me to the relevant thread, as I would find it interesting? Thanks, Anders. - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] KVM Test result, kernel 8d3a833.., userspace e665b72.. --- One Issue Fixed
Hi All, This is today's KVM test result against kvm.git 8d3a833dc9d42f0967e57717f89c518375d6a417 and kvm-userspace.git e665b723bd12c01068879fe8106a8108b070c653. One Issue Fixed: 1. Fails to save/restore ia32e guests https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1936539&group_id=180599 Three Old Issues: 1. Booting four guests likely fails https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1919354&group_id=180599 2. booting smp windows guests has 30% chance of hang https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1910923&group_id=180599 3. Cannot boot guests with hugetlbfs https://sourceforge.net/tracker/?func=detail&atid=893831&aid=1941302&group_id=180599 Test environment PlatformWoodcrest CPU 4 Memory size 8G' Details IA32-pae: 1. boot guest with 256M memory PASS 2. boot two windows xp guest PASS 3. boot 4 same guest in parallelPASS 4. boot linux and windows guest in parallel PASS 5. boot guest with 1500M memory PASS 6. boot windows 2003 with ACPI enabled PASS 7. boot Windows xp with ACPI enabled PASS 8. boot Windows 2000 without ACPI PASS 9. kernel build on SMP linux guestPASS 10. LTP on SMP linux guest PASS 11. boot base kernel linux PASS 12. save/restore 32-bit HVM guests PASS 13. live migration 32-bit HVM guests PASS 14. boot SMP Windows xp with ACPI enabledPASS 15. boot SMP Windows 2003 with ACPI enabled PASS 16. boot SMP Windows 2000 with ACPI enabled PASS IA32e: 1. boot four 32-bit guest in parallel PASS 2. boot four 64-bit guest in parallel PASS 3. boot 4G 64-bit guest PASS 4. boot 4G pae guest PASS 5. boot 32-bit linux and 32 bit windows guest in parallelPASS 6. boot 32-bit guest with 1500M memory PASS 7. boot 64-bit guest with 1500M memory PASS 8. boot 32-bit guest with 256M memory PASS 9. boot 64-bit guest with 256M memory PASS 10. boot two 32-bit windows xp in parallelPASS 11. boot four 32-bit different guest in para PASS 12. save/restore 64-bit linux guests PASS 13. save/restore 32-bit linux guests PASS 14. boot 32-bit SMP windows 2003 with ACPI enabled PASS 15. boot 32-bit SMP Windows 2000 with ACPI enabled PASS 16. boot 32-bit SMP Windows xp with ACPI enabledPASS 17. boot 32-bit Windows 2000 without ACPIPASS 18. boot 64-bit Windows xp with ACPI enabledPASS 19. boot 32-bit Windows xp without ACPIPASS 20. boot 64-bit UP vista PASS 21. boot 64-bit SMP vista PASS 22. kernel build in 32-bit linux guest OS PASS 23. kernel build in 64-bit linux guest OS PASS 24. LTP on SMP 32-bit linux guest OSPASS 25. LTP on SMP 64-bit linux guest OSPASS 26. boot 64-bit guests with ACPI enabled PASS 27. boot 32-bit x-server PASS 28. boot 64-bit SMP windows XP with ACPI enabled PASS 29. boot 64-bit SMP windows 2003 with ACPI enabled PASS 30. live migration 64bit linux guests PASS 31. live migration 32bit linux guests PASS 32. reboot 32bit windows xp guest PASS 33. reboot 32bit windows xp guest PASS Report Summary on IA32-pae Summary Test Report of Last Session = Total PassFailNoResult Crash = control_panel 7 7 0 00
Re: [kvm-devel] [PATCH] [v2] Move kvm_get_pit to libkvm.c common code
Jerone Young wrote: > I just took the old description that was there before. A much better one > would be: > > Remove declarations of kvm_*_pit() on architectures who do not support > not have a PIT. > > That is what I was really intending. It removes a lot of compile > warnings, when compiling anything with libkvm.h on platforms that do not > have a pit. It's mainly because of the structures that are used as > arguments to these function declrations. > Thanks, applied. -- error compiling committee.c: too many arguments to function - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH]kvmtrace:fix a redundant assignment.
>From 193536b1cd96f646b66bea52bc46fdebcdcfc1cf Mon Sep 17 00:00:00 2001 From: Feng (Eric) Liu <[EMAIL PROTECTED]> Date: Wed, 16 Apr 2008 07:05:22 -0400 Subject: [PATCH] KVM: trace: fix a redundant assignment. Romove the redundant assignment, since the variable "extra" will not be used again. Signed-off-by: Feng (Eric) Liu <[EMAIL PROTECTED]> --- virt/kvm/kvm_trace.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_trace.c b/virt/kvm/kvm_trace.c index 5425440..030cfde 100644 --- a/virt/kvm/kvm_trace.c +++ b/virt/kvm/kvm_trace.c @@ -66,8 +66,7 @@ static void kvm_add_trace(void *probe_private, void *call_data, extra = va_arg(*args, u32); WARN_ON(!(extra <= KVM_TRC_EXTRA_MAX)); - extra = min_t(u32, extra, KVM_TRC_EXTRA_MAX); - rec.extra_u32 = extra; + rec.extra_u32 = min_t(u32, extra, KVM_TRC_EXTRA_MAX); rec.cycle_in= p->cycle_in; -- 1.5.1 --Eric (Liu, Feng) 0001-KVM-trace-fix-a-redundant-assignment.patch Description: 0001-KVM-trace-fix-a-redundant-assignment.patch - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH 2/2]kvmtrace: add event mask support(userspace part)
>From 9314f8b249fe6c32f006e6a1cec5d3868b66e6ff Mon Sep 17 00:00:00 2001 From: Feng (Eric) Liu <[EMAIL PROTECTED]> Date: Wed, 16 Apr 2008 05:45:40 -0400 Subject: [PATCH] kvm: user: Add event mask support in kvmtrace. Signed-off-by: Feng (Eric) Liu <[EMAIL PROTECTED]> --- user/kvmtrace.c | 56 -- 1 files changed, 53 insertions(+), 3 deletions(-) diff --git a/user/kvmtrace.c b/user/kvmtrace.c index 876ac27..a7b2071 100644 --- a/user/kvmtrace.c +++ b/user/kvmtrace.c @@ -54,7 +54,7 @@ static char kvmtrace_version[] = "0.1"; #define max(a, b) ((a) > (b) ? (a) : (b)) -#define S_OPTS "r:o:w:?Vb:n:D:" +#define S_OPTS "r:o:w:?Vb:n:D:e:" static struct option l_opts[] = { { .name = "relay", @@ -99,6 +99,12 @@ static struct option l_opts[] = { .val = 'D' }, { + .name = "event_mask", + .has_arg = required_argument, + .flag = NULL, + .val = 'e' + }, + { .name = NULL, } }; @@ -154,6 +160,8 @@ static char *output_dir; static int stop_watch; static unsigned long buf_size = BUF_SIZE; static unsigned long buf_nr = BUF_NR; +static int cat_mask = ~0u; +static unsigned long long act_bitmap[16]; static unsigned int page_size; #define for_each_cpu_online(cpu) \ @@ -175,6 +183,13 @@ static void handle_sigint(__attribute__((__unused__)) int sig) done = 1; } +static inline int valid_mask_opt(int x) +{ + return ((1 << KVM_TRC_SHIFT) <= x) && + (x < (1 << (KVM_TRC_CAT_NR_BITS + KVM_TRC_SHIFT))) && + (0 <= KVM_TRC_ACT(x)) && (KVM_TRC_ACT(x) < 64); +} + static int get_lost_records() { int fd; @@ -473,6 +488,8 @@ static int start_trace(void) memset(&kuts, 0, sizeof(kuts)); kuts.buf_size = trace_information.buf_size = buf_size; kuts.buf_nr = trace_information.buf_nr = buf_nr; + kuts.cat_mask = cat_mask; + memcpy(kuts.act_bitmap, act_bitmap, sizeof(act_bitmap)); if (ioctl(trace_information.fd , KVM_TRACE_ENABLE, &kuts) < 0) { perror("KVM_TRACE_ENABLE"); @@ -587,13 +604,21 @@ static void show_stats(void) static char usage_str[] = \ "[ -r debugfs path ] [ -D output dir ] [ -b buffer size ]\n" \ - "[ -n number of buffers] [ -o ] [ -w time ] [ -V ]\n\n" \ + "[ -n number of buffers] [ -o ] [ -e event mask ]" \ + "[ -w time ] [ -V ]\n\n" \ "\t-r Path to mounted debugfs, defaults to /sys/kernel/debug\n" \ "\t-o File(s) to send output to\n" \ "\t-D Directory to prepend to output file names\n" \ "\t-w Stop after defined time, in seconds\n" \ "\t-b Sub buffer size in KiB\n" \ "\t-n Number of sub buffers\n" \ + "\t-e Only trace specified categories or actions.\n" \ + "\t kvmtrace defaults to collecting all events can be traced.\n" \ + "\t To limit the events being captured, you can specify filter.\n" \ + "\t if you want to trace all the actions of one category," \ + " set action to zero. \n" \ + "\t eg: -e 0x0001 -e 00020001 trace entryexit and PAGE_FAULT \n" \ + "\t -e 0x00020005 -e 00020006 trace IO_READ and IO_WRITE. \n" \ "\t-V Print program version info\n\n"; static void show_usage(char *prog) @@ -604,7 +629,7 @@ static void show_usage(char *prog) void parse_args(int argc, char **argv) { - int c; + int c, cat_mask_tmp = 0; while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) >= 0) { switch (c) { @@ -647,6 +672,26 @@ void parse_args(int argc, char **argv) case 'D': output_dir = optarg; break; + case 'e': { + int index, mask; + + if ((sscanf(optarg, "%x", &mask) != 1) || + !valid_mask_opt(mask)) { + fprintf(stderr, + "Invalid event mask (%u)\n", mask); + exit(EXIT_FAILURE); + } + cat_mask_tmp |= KVM_TRC_CAT(mask); + index = ffs(KVM_TRC_CAT(mask)) - 1; + if (KVM_TRC_ACT(mask) == 0) + act_bitmap[index] = ~0ull; + else { + if (act_bitmap[index] == ~0ull) + act_bitmap[index] = 0; + act_bitmap[index] |= 1 << KVM_TRC_ACT(mask); + } + break; + } default: show_usage(argv[0]); } @@ -654,12 +699,17 @@ void parse_args(int argc, char **argv) if (optind < argc || output_name == NULL) show_usage(argv[0]); + + if (cat_mask_tmp != 0) +
[kvm-devel] [PATCH 1/2]kvmtrace: add event mask support (kernel part)
>From a1b062cfd4d1a91c447b680ac9a2250fe55119ec Mon Sep 17 00:00:00 2001 From: Feng (Eric) Liu <[EMAIL PROTECTED]> Date: Wed, 16 Apr 2008 05:29:37 -0400 Subject: [PATCH] KVM: trace: Add event mask support. Allow user space application to specify one or more filter masks to limit the events being captured via it. Signed-off-by: Feng (Eric) Liu <[EMAIL PROTECTED]> --- include/linux/kvm.h |6 ++ virt/kvm/kvm_trace.c | 24 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/include/linux/kvm.h b/include/linux/kvm.h index c5675e8..12ec084 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -18,6 +18,8 @@ struct kvm_user_trace_setup { __u32 buf_size; /* sub_buffer size of each per-cpu */ __u32 buf_nr; /* the number of sub_buffers of each per-cpu */ + __u16 cat_mask; /* the tracing categories are enabled */ + __u64 act_bitmap[16]; /* the actions are enabled for each category */ }; /* for KVM_CREATE_MEMORY_REGION */ @@ -261,6 +263,7 @@ struct kvm_s390_interrupt { }; #define KVM_TRC_SHIFT 16 +#define KVM_TRC_CAT_NR_BITS 12 /* * kvm trace categories */ @@ -274,6 +277,9 @@ struct kvm_s390_interrupt { #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) +#define KVM_TRC_CAT(evt)(((evt) >> KVM_TRC_SHIFT) & 0x0fff) +#define KVM_TRC_ACT(evt)((evt) & (~0u >> KVM_TRC_SHIFT)) + #define KVM_TRC_HEAD_SIZE 12 #define KVM_TRC_CYCLE_SIZE 8 #define KVM_TRC_EXTRA_MAX 7 diff --git a/virt/kvm/kvm_trace.c b/virt/kvm/kvm_trace.c index 5425440..dfa4162 100644 --- a/virt/kvm/kvm_trace.c +++ b/virt/kvm/kvm_trace.c @@ -26,6 +26,8 @@ struct kvm_trace { int trace_state; + u16 cat_mask; + u64 act_bitmap[16]; struct rchan *rchan; struct dentry *lost_file; atomic_t lost_records; @@ -39,6 +41,23 @@ struct kvm_trace_probe { marker_probe_func *probe_func; }; +static inline int check_event_mask(struct kvm_trace *kt, u32 event) +{ + unsigned long category; + int i; + + category = KVM_TRC_CAT(event); + if (!(category & kt->cat_mask)) + return 1; + + i = find_first_bit(&category, KVM_TRC_CAT_NR_BITS); + + if (!test_bit(KVM_TRC_ACT(event), &kt->act_bitmap[i])) + return 1; + + return 0; +} + static inline int calc_rec_size(int cycle, int extra) { int rec_size = KVM_TRC_HEAD_SIZE; @@ -60,6 +79,9 @@ static void kvm_add_trace(void *probe_private, void *call_data, return; rec.event = va_arg(*args, u32); + if (check_event_mask(kt, rec.event)) + return; + vcpu= va_arg(*args, struct kvm_vcpu *); rec.pid = current->tgid; rec.vcpu_id = vcpu->vcpu_id; @@ -169,6 +191,8 @@ static int do_kvm_trace_enable(struct kvm_user_trace_setup *kuts) if (!kt->rchan) goto err; + kt->cat_mask = kuts->cat_mask; + memcpy(kt->act_bitmap, kuts->act_bitmap, sizeof(kuts->act_bitmap)); kvm_trace = kt; for (i = 0; i < ARRAY_SIZE(kvm_trace_probes); i++) { --Eric (Liu, Feng) 0001-KVM-trace-Add-event-mask-support.patch Description: 0001-KVM-trace-Add-event-mask-support.patch - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
[kvm-devel] [PATCH 0/2]kvmtrace: add event mask to limit tracing data.
Hi, The following two patches add event mask support in kvmtrace and the corresponding kernel code, so that we can specify filter masks to limit the events being captured. --Eric (Liu, Feng) - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel