On Tue, Mar 15, 2016 at 12:08 PM, Mike Larkin <[email protected]> wrote:
> On Sat, Mar 12, 2016 at 01:49:08PM +0100, Hiltjo Posthuma wrote:
>> >Synopsis: crash with performance counter (RDPMC) on OpenBSD as QEMU
>> >quest VM
>> >Category: Crash / system hang
>> >Environment:
>> System : OpenBSD 5.8 and -current (snapshot: 2016-03-11)
>> Details : OpenBSD 5.8 (GENERIC) #0: Fri Oct 23 11:15:05 CEST 2015
>>
>> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
>>
>> Architecture: OpenBSD.amd64
>> Machine : amd64
>> >Description:
>> I run OpenBSD on my VPS as a QEMU quest VM, when I run `pctr` as a user
>> the system hangs and shows the ddb console.
>> >How-To-Repeat:
>> run as user in QEMU VM the command: pctr
>> >Fix:
>> I don't know the correct fix for this issue, below is a workaround
>> and additional information:
>>
>> trace from ddb console:
>>
>> kernel: protection fault trap, code=0
>> Stopped at pctrioctl+0x140: rdpmc
>> ddb> trace
>> pctrioctl() at pctrioctl+0x140
>> VOP_IOCTL() at VOP_IOCTL+0x44
>> vn_ioctl() at vn_ioctl+0x77
>> sys_ioctl() at sys_ioctl+0x18b
>> syscall() at syscall+0x19e
>> --- syscall (number 54) ---
>> end of kernel
>> end trace frame: 0x3, count: -5
>>
>
> I looked through the pctr code and it appears that we are only querying
> counters 0 and 1, which appear to be valid counters on all supported CPUs.
> (At least for Intel, which is what your qemu instance reports)
>
> Can you repeat this crash and do a "show registers" after it breaks into
> DDB? I'm interested in ECX/RCX content.
>
> Possible related issue: http://www.spinics.net/lists/kvm/msg128775.html
>
> -ml
Thanks for looking into this. The rcx register is 0:
kernel: privileged instruction fault trap, code=0
Stopped at pctrioctl+0x140: rdpmc
ddb{0}> show registers
rdi 0x4
rsi 0xffff80000e4cad90
rbp 0xffff80000e4cac10
rbx 0x19
rdx 0xca27d5dda2
rcx 0
rax 0x27d5dda2
r8 0xc0010000
r9 0xffff80000e4cad90
r10 0x10ec0a0b428a
r11 0xffffffff815b4880 pctrioctl
r12 0xffffff001e7e3390
r13 0xffffff001d6269f0
r14 0x40386301
r15 0xffffff001f531010
rip 0xffffffff815b49c0 pctrioctl+0x140
cs 0x8
rflags 0x46
rsp 0xffff80000e4cac00
ss 0x10
pctrioctl+0x140: rdpmc
Kind regards,
Hiltjo