[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] Qemu: AARCH64: Single Step exception does not work

From: David Long
Subject: Re: [Qemu-discuss] Qemu: AARCH64: Single Step exception does not work
Date: Thu, 08 Jan 2015 10:39:42 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/08/15 00:32, Pratyush Anand wrote:
Hi All,

Have anyone tried to test single step exception with ARM64 on Qemu? I
was testing ARM64 uprobe patches[1] with qemu and I noticed that it does
not generate single step exception. I also tried kprobe[2], which uses
single step exception and it does not work. However, these code works
fine with real silicon.

Test case can be summarized as under:

1. After kernel code is executed, it programs ELR_EL1 with the address
of instruction which is to be single stepped. Lets say 0x7ffffff004 is
the address of instruction which is to be single stepped. So, ELR_EL1
has been programmed with 0x7ffffff004.

2. MDSCR_EL1.SS is set to 1

3. ERET has been called to execute instruction to be single stepped.

With Qemu, I always see
undefined instruction: pc=0000007ffffff008
Code: bad PC value

It seems that Qemu could not notice MDSCR_EL1.SS = 1 and since, kernel
had written a single valid instruction at location 0x7ffffff004, so it
raised an undefined exception while executing next invalid instruction.

My Qemu version is:

QEMU emulator version 2.1.2, Copyright (c) 2003-2008 Fabrice Bellard

You may use code in [3] to test single steping.

Please let me know, if any more input is needed to reproduce it.


[1] https://lkml.org/lkml/2014/12/31/151
[2] https://lkml.org/lkml/2014/11/18/33
[3] https://github.com/pratyushanand/linux.git:ml_arm64_uprobe_devel_v2

The singlestep support in QEMU is relatively recent. Make sure you're running a fairly recent QEMU.

At one point QEMU was not setting ELR_EL* properly. I'll forward you an email from Peter Maydell that has some relevance. This was fixed.

Note that you have to both set SS *and* be sure debug exceptions are enabled in order to get the single-step exception. My kprobes patch [2] should work in that regard. Today I plan to post a v4 version of that patch, but I think the only thing it fixes relative to single-stepping is very intermittent failures due to interrupts not being properly disabled (you have to disabke interrupts uring single-stepping or you could end up single-stepping an ingterrupt handler).

Note that testing under QEMU will not reveal SMP issues.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]