Hi Gabe,

This is an interesting problem. I believe Jordi Varquero is doing some work in 
a related area. The KVM CPU currently doesn't support per-PC events. There 
wasn't an easy way to implement this with the APIs that KVM exposed when I 
originally wrote the code. However, it supports stopping at a specific 
instruction count.

I'm leaning towards TC as well. That would be the natural mechanism to transfer 
breakpoints when switching CPUs as well and there is already a well-defined way 
to implement CPU-specific TCs. A system-wide interface could be built on top of 
the per-thread interface. Another option would be to keep the central queue and 
add a callback mechanism that notifies CPUs of changes. Either should work for 
KVM.

Cheers,
Andreas

On 09/10/2019 00:47, Gabe Black wrote:
I'm leaning towards putting the onus for scheduling PC and various count based 
events into the ThreadContext. Then the ThreadContext could check with whatever 
structures which list what events it's supposed to already have to bring itself 
up to date somehow? Not sure of the specifics.

Gabe

On Tue, Oct 8, 2019 at 4:21 PM Gabe Black 
<[email protected]<mailto:[email protected]>> wrote:
Hey folks. I'm looking into making the remote GDB stub work with fast model 
CPUs in gem5, and one major obstacle is that breakpoints are implemented using 
a PCEventQueue which is stored as part of the System object. Events that are 
supposed to happen at particular PCs are registered with it, and the the CPUs 
check every instruction whether they've hit an interesting PC.

In the fast model CPUs and in the KVM cpus (I think) the CPUs chew through lots 
of instructions without stopping to check their PCs at each one. At least in 
fast model there's an API to set breakpoints, but I'm not sure about KVM.

In any case, it seems to me that having a single polling based mechanism to 
check for PC based events is not good enough when we have non-polling based CPU 
implementations. Could someone more familiar with the KVM implementations 
comment on what (if anything) they do to handle breakpoints? Is there a way 
around this problem I'm just not aware of?

Also, has there been any discussion about how to replace the PCEventQueue? I 
considered delegating the mechanism to the CPUs like the instruction and load 
count based mechanisms, but there isn't a convenient list of all CPUs in a 
system, and PCEvents are a more long lived type of entity. For example, you 
might want to create an event that happens every time printk would print 
something, and you want that to happen on all contexts/CPUs in a system no 
matter when they came into existence or got set up. Once nice property of the 
centralized event queue is that this is handled automatically since it's a 
central source of truth.

Gabe


IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to