On Sun, Feb 21, 2010 at 04:18:38PM -0700, Brandon Bennett wrote:
> > On Sat, Feb 20, 2010 at 9:05 PM, Kevin O'Connor <kevin(a)koconnor.net> wrote:
> >> Should a kernel fail during boot, I'd suspect it doesn't like one of
> >> the apm/pcibios callbacks, or it doesn't like one of the
> >> smbios/mptable/acpi tables. You could try compiling the SeaBIOS code
> >> (see http://seabios.org/Download ) and increasing the debugging by
> >> modifying src/config.h. Specifically, you could increase
> >> CONFIG_DEBUG_LEVEL, and set DEBUG_HDL_pcibios32 and DEBUG_HDL_apm to
> >> 1. Also, you could try disabling some of the features to see if that
> >> prevents the fault (eg, disabling CONFIG_ACPI / CONFIG_SMBIOS /
> >> CONFIG_MPTABLE).
> >
>
> I have narrowed it down to SMBIOS. If I disable CONFIG_SMBIOS the
> image boots up fine.
Gleb, have you seen this thread?
Some of the recent changes to smbios that look like possible culprits
are:
Make SMBIOS table pass MS SVVP test
Use MaxCountCPUs during building of per cpu tables.
Add malloc_high/fseg() and rework bios table creation to use them.
There were other changes, but the comments indicate they were only
ports of changes already in bochs. I suppose it's also possible the
lack of smbios is turning off some other feature in the guest (eg,
acpi) that's the real culprit.
-Kevin
Hi,
We were looking at the dmidecode output from qemu-kvm pre-seabios and
current qemu-kvm and noticed some of the strings have changed.
The main problem with this is that certain OSes are quite sensitive to
system changes and avoiding to change things unnecessarily would
probably be a good thing.
I wanted to check with the lists if there are any strong feelings about
this, and whether some of these changes were made for specific reasons?
For example:
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
- Vendor: QEMU
- Version: QEMU
+ Vendor: Bochs
+ Version: Bochs
Release Date: 01/01/2007
Address: 0xE8000
Runtime Size: 96 kB
and this:
Handle 0x0401, DMI type 4, 32 bytes
Processor Information
- Socket Designation: CPU 1
+ Socket Designation: CPU01
Type: Central Processor
Family: Other
- Manufacturer: QEMU
- ID: 63 06 00 00 FD FB 8B 07
+ Manufacturer: Bochs
+ ID: 23 06 00 00 FD FB 8B 07
Version: Not Specified
Voltage: Unknown
External Clock: Unknown
I guess the Socket Designation in particular might have been done for a
reason?
Otherwise, if there are no objections, I'll look at adding some patches
to make it more backwards compatible.
Cheers,
Jes
cleanup memory barrier usage bringing it
in sync with what linux guest does.
The rules are simple:
- read barrier after index read
- write barrier before index write
Also, call macros smp_rmb/smp_wmb to stress
we are not syncing with a real io device here.
While I don't think compiler is crazy/powerful
enough to reorder these, anyway, the bogus
barriers we currently have in code will confuse
anyone who tries to copy/reuse it.
Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com>
Cc: Gleb Natapov <gleb(a)redhat.com>
---
This depends on the NO_NOTIFY patch I sent earlier.
Note: compile-tested only
Gleb, could you try it out pls?
src/virtio-ring.c | 13 ++++++-------
src/virtio-ring.h | 5 +++--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/virtio-ring.c b/src/virtio-ring.c
index 493d8b5..97a3ffe 100644
--- a/src/virtio-ring.c
+++ b/src/virtio-ring.c
@@ -38,8 +38,10 @@
int vring_more_used(struct vring_virtqueue *vq)
{
struct vring_used *used = GET_FLATPTR(vq->vring.used);
- wmb();
- return GET_FLATPTR(vq->last_used_idx) != GET_FLATPTR(used->idx);
+ int more = GET_FLATPTR(vq->last_used_idx) != GET_FLATPTR(used->idx);
+ /* Make sure ring reads are done after idx read above. */
+ smp_rmb();
+ return more;
}
/*
@@ -63,7 +65,6 @@ void vring_detach(struct vring_virtqueue *vq, unsigned int head)
/* link it with free list and point to it */
SET_FLATPTR(desc[i].next, GET_FLATPTR(vq->free_head));
- wmb();
SET_FLATPTR(vq->free_head, head);
}
@@ -85,7 +86,6 @@ int vring_get_buf(struct vring_virtqueue *vq, unsigned int *len)
// BUG_ON(!vring_more_used(vq));
elem = &used->ring[GET_FLATPTR(vq->last_used_idx) % GET_FLATPTR(vr->num)];
- wmb();
id = GET_FLATPTR(elem->id);
if (len != NULL)
*len = GET_FLATPTR(elem->len);
@@ -136,7 +136,6 @@ void vring_add_buf(struct vring_virtqueue *vq,
av = (GET_FLATPTR(avail->idx) + num_added) % GET_FLATPTR(vr->num);
SET_FLATPTR(avail->ring[av], head);
- wmb();
}
void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
@@ -144,9 +143,9 @@ void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
struct vring *vr = &vq->vring;
struct vring_avail *avail = GET_FLATPTR(vr->avail);
- wmb();
+ /* Make sure idx update is done after ring write. */
+ smp_wmb();
SET_FLATPTR(avail->idx, GET_FLATPTR(avail->idx) + num_added);
- mb();
vp_notify(ioaddr, GET_FLATPTR(vq->queue_index));
}
diff --git a/src/virtio-ring.h b/src/virtio-ring.h
index 3fb86fe..8b546f4 100644
--- a/src/virtio-ring.h
+++ b/src/virtio-ring.h
@@ -9,8 +9,9 @@
#define virt_to_phys(v) (unsigned long)(v)
#define phys_to_virt(p) (void*)(p)
-#define wmb() barrier()
-#define mb() barrier()
+/* Compiler barrier is enough as an x86 CPU does not reorder reads or writes */
+#define smp_rmb() barrier()
+#define smp_wmb() barrier()
/* Status byte for guest to report progress, and synchronize features. */
/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
--
1.7.1.12.g42b7f
On Tue, May 18, 2010 at 05:08:29PM +0800, Liu, Jinsong wrote:
> Hi, Kevin, Gleb, Avi, and Yunhong
>
> I have updated vcpu hotplug seabios infrastructure, as attached. Please kindly review it, thanks!
>
Applied it to upstream Seabios, but can't compile:
src/acpi.c:274:28: error: acpi-ssdt-15.hex: No such file or directory
src/acpi.c:275:32: error: acpi-ssdt-anycpu.hex: No such file or
directory
src/acpi.c: In function 'build_fadt':
src/acpi.c:307: error: 'acpi_dsdt' undeclared (first use in this
function)
src/acpi.c:307: error: (Each undeclared identifier is reported only once
src/acpi.c:307: error: for each function it appears in.)
src/acpi.c: In function 'build_ssdt':
src/acpi.c:435: error: 'acpi_ssdt_anycpu' undeclared (first use in this
function)
src/acpi.c:436: error: 'acpi_ssdt_15' undeclared (first use in this
function)
make: *** [out/ccode32flat.o] Error 1
--
Gleb.
Some real machine can apparently have a flaky real-time-clock. So,
don't use it for timing the boot menu - the regular timer irq is fine
for this purpose.
Kevin O'Connor (4):
Allow wait_irq to be called in 32bit code.
Rename check_time() to check_tsc().
Generalize timer based delay code.
Don't use RTC to time boot menu delay.
Makefile | 2 +-
src/ata.c | 8 +++---
src/boot.c | 2 +-
src/cdrom.c | 2 +-
src/clock.c | 36 +++++++++++++++++++++---
src/ps2port.c | 2 +-
src/serial.c | 37 ++++---------------------
src/stacks.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++-------
src/usb-ehci.c | 10 +++---
src/usb-hub.c | 4 +-
src/usb-ohci.c | 8 +++---
src/usb-uhci.c | 6 ++--
src/util.c | 54 ++----------------------------------
src/util.h | 20 +++++--------
14 files changed, 144 insertions(+), 130 deletions(-)
Kevin O'Connor (4):
Make sure virtio-blk is fully compiled out if not wanted.
Minor ata cleanups.
Minor - compile out usb-msc code if CONFIG_USB_MSC not set.
Improve optionrom debugging statements.
src/ata.c | 14 ++++++++++----
src/optionroms.c | 12 +++++++-----
src/pci.h | 10 ++++++++++
src/usb-msc.c | 2 ++
src/virtio-blk.c | 4 +++-
5 files changed, 32 insertions(+), 10 deletions(-)
NO_NOTIFY is an optimization to reduce the number of exits,
but using it requires careful synchronization with host,
forcing read/write ordering for the CPU. Otherwise we
risk not kicking a host when it is waiting for more buffers,
resulting in a deadlock.
Let's just always kick, it's way simpler.
Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com>
Cc: Gleb Natapov <gleb(a)redhat.com>
---
The following is compile-tested only. Gleb, could you
try it out please?
src/virtio-ring.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/src/virtio-ring.c b/src/virtio-ring.c
index 7565688..493d8b5 100644
--- a/src/virtio-ring.c
+++ b/src/virtio-ring.c
@@ -143,12 +143,10 @@ void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
{
struct vring *vr = &vq->vring;
struct vring_avail *avail = GET_FLATPTR(vr->avail);
- struct vring_used *used = GET_FLATPTR(vq->vring.used);
wmb();
SET_FLATPTR(avail->idx, GET_FLATPTR(avail->idx) + num_added);
mb();
- if (!(GET_FLATPTR(used->flags) & VRING_USED_F_NO_NOTIFY))
- vp_notify(ioaddr, GET_FLATPTR(vq->queue_index));
+ vp_notify(ioaddr, GET_FLATPTR(vq->queue_index));
}
--
1.7.1.12.g42b7f
Hi, Kevin, Gleb, Avi, and Yunhong
I have updated vcpu hotplug seabios infrastructure, as attached. Please kindly review it, thanks!
--------------------------------------------
This patch is to support KVM vcpu hotplug feature.
It ported from KVM bochs bios, and update some points to KVM seabios:
1. build ssdt with 15/255 processor obj, which separately support Win2000 and other oses;
2. build madt accordingly, protect it as 'E820_NVS', and keep madt checksum and lapic flag correctly when cpu hotplug;
3. define Processor under \_SB instead of \_PR, so that it works better with latest linux like 2.6.32 later;
4. for Processor _MAT method, explicitly transfer it 'ToBuffer' so that os will not confused with 'Integer' which will result in parse failure;
5. for Processor _STA method, use 0x0 instead of 0x9 for cpu hot-remove, which matchs better with ACPI 4.0 spec, and works better with latest linux;
6. add Processor _EJ0 method, so that 'eject' appear under linux /sys, and triggered by uevent to make cpu hot-remove;
-------------------------------------------
Thanks,
Jinsong