Vinod Chegu | 1 Feb 02:53
Picon

vCPU hotplug


Dear All,

I am using version 1.0 of qemu-kvm along with 3.2.x host+guest kernels on an 
X86_64 server. I was unable to trigger a hotplug of a vCPU from the qemu's 
monitor prompt (tripped over an assertion in qemu). 

Tried to look through the recent archives and noticed a couple of proposed 
fixes. One for this assertion and another to trigger the actual 
SCI notification. Not sure if they were official fixes or not...

I tried it out with these  2 fixes. I noticed that the cpuX showed up in 
the /sys/devices/system/cpu/ subdir. 

I was however not able to activate the newly hotplug'd vCPU via 
"echo 1 > cpuX/online".  Looks like the vCPU isn't waking up in the guest.

If there is any [proposed|official] fix available that I could try out 
for this issue..pl point me to the same.

Thanks in anticipation!

Vinod  

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

(Continue reading)

Zhi Yong Wu | 1 Feb 02:53
Picon

Re: VMXON region vs VMCS region?

On Tue, Jan 31, 2012 at 8:29 PM, Orit Wasserman <owasserm <at> redhat.com> wrote:
> On 01/31/2012 05:35 AM, Zhi Yong Wu wrote:
>> HI,
>>
>> Can anyone let me know know the difference  between VMXON region and
>> VMCS region? relationship?
>>
>
> There is no relationship between them:
> VMXON region is created per logical processor and used by it for VMX ops.
> VMCS region is created for each guest vcpu and used both by the hypervisor and the processor.
Great, thanks.
>
>> It will be appreciated if you can make some comments.
>>
>>
>

--

-- 
Regards,

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

Sasha Levin | 1 Feb 03:07
Picon

[PATCH] kvm tools: Fix segfault when failing to initialize KVM

Might happen when hardware virtualization is not supported.

Reported-by: Ingo Molnar <mingo <at> elte.hu>
Signed-off-by: Sasha Levin <levinsasha928 <at> gmail.com>
---
 tools/kvm/builtin-run.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 6ded1d2..a67faf8 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -997,6 +997,10 @@ static int kvm_cmd_run_init(int argc, const char **argv)
 	}

 	kvm = kvm__init(dev, hugetlbfs_path, ram_size, guest_name);
+	if (IS_ERR_OR_NULL(kvm)) {
+		r = PTR_ERR(kvm);
+		goto fail;
+	}

 	kvm->single_step = single_step;

--

-- 
1.7.8.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Continue reading)

Alex Williamson | 1 Feb 05:22
Picon
Favicon

Re: [PATCH 3/9] pci-assign: Update MSI-X MMIO to Memory API

On Tue, 2012-01-31 at 14:13 -0700, Alex Williamson wrote:
> On Tue, 2012-01-31 at 14:45 +0200, Avi Kivity wrote:
> > On 01/28/2012 04:21 PM, Alex Williamson wrote:
> > > Stop using compatibility mode and at the same time fix available
> > > access sizes.  The PCI spec indicates that the MSI-X table may
> > > only be accessed as DWORD or QWORD.
> > >
> > >  
> > >  static const MemoryRegionOps msix_mmio_ops = {
> > > -    .old_mmio = {
> > > -        .read = { msix_mmio_readb, msix_mmio_readw, msix_mmio_readl, },
> > > -        .write = { msix_mmio_writeb, msix_mmio_writew, msix_mmio_writel, },
> > > -    },
> > > +    .read = msix_mmio_read,
> > > +    .write = msix_mmio_write,
> > >      .endianness = DEVICE_NATIVE_ENDIAN,
> > > +    .impl = {
> > > +        .min_access_size = 4,
> > > +        .max_access_size = 8,
> > > +    },
> > >  };
> > >  
> > 
> > .impl.min_access_size = 4 means the core will convert 1-byte I/O to
> > 4-byte I/O (using rmw if needed).  That's not what we want, I think you
> > can leave it at 1 and explicitly ignore small accesses in the callbacks.
> > 
> > Have you tested 8-byte I/O?  This is the first user.  Don't you need to
> > set .valid.max_access_size?
> 
(Continue reading)

Alex Williamson | 1 Feb 06:32
Picon
Favicon

[PATCH v2 0/8] pci-assign: better MSI-X table support

This series enables better runtime MSI-X table support so
that we can track vector updates for routing, enabling
guest interrupt smp_affinity, as well as vectors setup
after the MSI-X PCI capability is enabled, allowing for
MSI-X on devices assigned to FreeBSD guests.  Thanks,

Alex

v2:
 - Dropping mem64, we can work on this elsewhere
 - Fixed MemoryRegionOps to use .valid, tested 8-byte access
 - Endian conversions when testing MSI-X vector mask bit
 - Patch description updates
 - Misc cleanups

---

Alex Williamson (8):
      pci-assign: Update MSI-X config based on table writes
      pci-assign: Use MSIX_PAGE_SIZE
      pci-assign: Allocate entries for all MSI-X vectors
      pci-assign: Proper initialization for MSI-X table
      pci-assign: Only calculate maximum MSI-X vector entries once
      pci-assign: Use struct for MSI-X table
      pci-assign: Update MSI-X MMIO to Memory API
      pci-assign: Fix warnings with DEBUG enabled

 hw/device-assignment.c |  262 +++++++++++++++++++++++++++++-------------------
 hw/device-assignment.h |   10 ++
 2 files changed, 169 insertions(+), 103 deletions(-)
(Continue reading)

Alex Williamson | 1 Feb 06:32
Picon
Favicon

[PATCH v2 1/8] pci-assign: Fix warnings with DEBUG enabled

Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
---

 hw/device-assignment.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 7f4a5ec..d82f274 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -74,7 +74,7 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,

     if (fd >= 0) {
         if (data) {
-            DEBUG("pwrite data=%x, size=%d, e_phys=%x, addr=%x\n",
+            DEBUG("pwrite data=%lx, size=%d, e_phys=%lx, addr=%lx\n",
                   *data, size, addr, addr);
             if (pwrite(fd, data, size, addr) != size) {
                 fprintf(stderr, "%s - pwrite failed %s\n",
@@ -86,14 +86,14 @@ static uint64_t assigned_dev_ioport_rw(AssignedDevRegion *dev_region,
                         __func__, strerror(errno));
                 val = (1UL << (size * 8)) - 1;
             }
-            DEBUG("pread val=%x, size=%d, e_phys=%x, addr=%x\n",
+            DEBUG("pread val=%lx, size=%d, e_phys=%lx, addr=%lx\n",
                   val, size, addr, addr);
         }
     } else {
         uint32_t port = addr + dev_region->u.r_baseport;

(Continue reading)

Alex Williamson | 1 Feb 06:32
Picon
Favicon

[PATCH v2 2/8] pci-assign: Update MSI-X MMIO to Memory API

Stop using compatibility mode and at the same time fix available
access sizes.  The PCI spec indicates that the MSI-X table may
only be accessed as DWORD or QWORD.  8-byte accesses are still
getting split in exec.c, but this will pre-enable it.

Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
---

 hw/device-assignment.c |   60 +++++++++++++++---------------------------------
 1 files changed, 19 insertions(+), 41 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index d82f274..67c417b 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1430,62 +1430,40 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
     return 0;
 }

-static uint32_t msix_mmio_readl(void *opaque, target_phys_addr_t addr)
+static uint64_t msix_mmio_read(void *opaque, target_phys_addr_t addr,
+                               unsigned size)
 {
     AssignedDevice *adev = opaque;
-    unsigned int offset = addr & 0xfff;
-    void *page = adev->msix_table_page;
-    uint32_t val = 0;
+    uint64_t val;

-    memcpy(&val, (void *)((char *)page + offset), 4);
(Continue reading)

Alex Williamson | 1 Feb 06:32
Picon
Favicon

[PATCH v2 3/8] pci-assign: Use struct for MSI-X table

This makes access much easier.

Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
---

 hw/device-assignment.c |   55 ++++++++++++++++++++++--------------------------
 hw/device-assignment.h |    9 +++++++-
 2 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 67c417b..53c843e 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -966,10 +966,9 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
     AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev);
     uint16_t entries_nr = 0, entries_max_nr;
     int pos = 0, i, r = 0;
-    uint32_t msg_addr, msg_upper_addr, msg_data, msg_ctrl;
     struct kvm_assigned_msix_nr msix_nr;
     struct kvm_assigned_msix_entry msix_entry;
-    void *va = adev->msix_table_page;
+    MSIXTableEntry *entry = adev->msix_table;

     pos = pci_find_capability(pci_dev, PCI_CAP_ID_MSIX);

@@ -978,12 +977,11 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
     entries_max_nr += 1;

     /* Get the usable entry number for allocating */
-    for (i = 0; i < entries_max_nr; i++) {
(Continue reading)

Alex Williamson | 1 Feb 06:32
Picon
Favicon

[PATCH v2 4/8] pci-assign: Only calculate maximum MSI-X vector entries once

We'll use this in a few more places for reseting the MSI-X
table and ignoring certain accesses, so it seems worth two
bytes to not recalculate all the time.

Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
---

 hw/device-assignment.c |   17 +++++++----------
 hw/device-assignment.h |    1 +
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 53c843e..25dff2c 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -964,20 +964,14 @@ static void assigned_dev_update_msi(PCIDevice *pci_dev)
 static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev)
 {
     AssignedDevice *adev = DO_UPCAST(AssignedDevice, dev, pci_dev);
-    uint16_t entries_nr = 0, entries_max_nr;
-    int pos = 0, i, r = 0;
+    uint16_t entries_nr = 0;
+    int i, r = 0;
     struct kvm_assigned_msix_nr msix_nr;
     struct kvm_assigned_msix_entry msix_entry;
     MSIXTableEntry *entry = adev->msix_table;

-    pos = pci_find_capability(pci_dev, PCI_CAP_ID_MSIX);
-
-    entries_max_nr = *(uint16_t *)(pci_dev->config + pos + 2);
(Continue reading)

Alex Williamson | 1 Feb 06:32
Picon
Favicon

[PATCH v2 5/8] pci-assign: Proper initialization for MSI-X table

Per the PCI spec, all vectors should be masked at handoff.

Signed-off-by: Alex Williamson <alex.williamson <at> redhat.com>
---

 hw/device-assignment.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 25dff2c..a33e5b9 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1459,6 +1459,22 @@ static const MemoryRegionOps msix_mmio_ops = {
     },
 };

+static void msix_reset(AssignedDevice *dev)
+{
+    MSIXTableEntry *entry;
+    int i;
+
+    if (!dev->msix_table) {
+        return;
+    }
+
+    memset(dev->msix_table, 0, 0x1000);
+
+    for (i = 0, entry = dev->msix_table; i < dev->msix_max; i++, entry++) {
+        entry->ctrl = cpu_to_le32(0x1); /* Masked */
+    }
(Continue reading)


Gmane