[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip |
Date: |
Fri, 10 Aug 2012 01:36:32 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.5) Gecko/20120624 Icedove/10.0.5 |
On 10.08.2012 00:47, Marcelo Tosatti wrote:
[]
>>> calibrate_tsc (void)
>>> {
>>> /* First calibrate the TSC rate (relative, not absolute time). */
>>> grub_uint64_t start_tsc;
>>> grub_uint64_t end_tsc;
>>>
>>> start_tsc = grub_get_tsc ();
>>> grub_pit_wait (0xffff);
>>> end_tsc = grub_get_tsc ();
>>>
>>> tsc_ticks_per_ms = grub_divmod64 (end_tsc - start_tsc, 55, 0);
>>> }
>>
>> Emulation of grub_pit_wait sequence by in-kernel PIT is probably broken.
This is grub_pit_wait():
#define TIMER2_REG_CONTROL 0x42
#define TIMER_REG_COMMAND 0x43
#define TIMER2_REG_LATCH 0x61
#define TIMER2_SELECT 0x80
#define TIMER_ENABLE_LSB 0x20
#define TIMER_ENABLE_MSB 0x10
#define TIMER2_LATCH 0x20
#define TIMER2_SPEAKER 0x02
#define TIMER2_GATE 0x01
void
grub_pit_wait (grub_uint16_t tics)
{
/* Disable timer2 gate and speaker. */
grub_outb (grub_inb (TIMER2_REG_LATCH) & ~ (TIMER2_SPEAKER | TIMER2_GATE),
TIMER2_REG_LATCH);
/* Set tics. */
grub_outb (TIMER2_SELECT | TIMER_ENABLE_LSB | TIMER_ENABLE_MSB,
TIMER_REG_COMMAND);
grub_outb (tics & 0xff, TIMER2_REG_CONTROL);
grub_outb (tics >> 8, TIMER2_REG_CONTROL);
/* Enable timer2 gate, keep speaker disabled. */
grub_outb ((grub_inb (TIMER2_REG_LATCH) & ~ TIMER2_SPEAKER) | TIMER2_GATE,
TIMER2_REG_LATCH);
/* Wait. */
while ((grub_inb (TIMER2_REG_LATCH) & TIMER2_LATCH) == 0x00);
/* Disable timer2 gate and speaker. */
grub_outb (grub_inb (TIMER2_REG_LATCH) & ~ (TIMER2_SPEAKER | TIMER2_GATE),
TIMER2_REG_LATCH);
}
>> QEMU PIT emulation is also affected by miscalibration.
>>
>> Please provide steps to reproduce.
>
> I mean verbose on the steps (does it happen always when setting timeout=10000,
> how to set timeout=10000, etc).
untested:
mkdir /tmp/grub
cd /tmp/grub
mkdir boot boot/grub
cat > boot/grub/grub.cfg <<EOF
set timeout=10000
menuentry 'test' {
echo "booted:"; read line
}
EOF
grub-mkrescue -o ../grub.iso .
kvm -cdrom ../grub.iso
This should show a menu with single entry "test",
and wait for 10000 seconds, with a countdown.
10000 is enough to actually see it -- with reasonable
timeout it isn't easy to see that it displays the
menu, instead it immediately goes to the booting,
displaying the "booted:" line.
kvm -cdrom ../grub.iso -cpu host,-tsc
kvm -cdrom ../grub.iso -no-kvm-irqchip
...
-- these works fine.
Tried with grub from debian wheezy (1.99-22.1) and
from ubuntu 12.04, but i guess it should be the
same with various versions of grub.
Thanks!
/mjt
- [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Michael Tokarev, 2012/08/09
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Marcelo Tosatti, 2012/08/09
- Message not available
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip,
Michael Tokarev <=
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Gleb Natapov, 2012/08/10
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Michael Tokarev, 2012/08/10
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Gleb Natapov, 2012/08/12
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Michael Tokarev, 2012/08/12
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Jan Kiszka, 2012/08/13
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Michael Tokarev, 2012/08/13
- Re: [Qemu-devel] TSC in qem[-kvm] 1.1+ and in-kernel irqchip, Jan Kiszka, 2012/08/13
- [Qemu-devel] [PATCH uq/master] kvm: i8254: Finish time conversion fix, Jan Kiszka, 2012/08/13
- Re: [Qemu-devel] [PATCH uq/master] kvm: i8254: Finish time conversion fix, Michael Tokarev, 2012/08/13
- Re: [Qemu-devel] [PATCH uq/master] kvm: i8254: Finish time conversion fix, Jan Kiszka, 2012/08/14