Skip to contentSkip to conversation

Last Branch Record (LBR) in Xen

DISCUSSION Abhinav Srivastava 2 participants 2 messages Jun 26, 2009

lore
Share & tools
lore
#0 lore raw

Hi Jan,

Thanks for your reply. I am referring to the second patch (however, could you please confirm and point to me to the right patch).

As far as I understand (please correct me if I am wrong), you meant that HVM guests have to enable the LBR recording, and this action cannot be initiated/controlled by Xen. I was thinking like other kind of actions, such as single stepping on instruction, single stepping on branch etc. that can be controlled from the hypervisor and guests behave accordingly, the LBR feature can also be set/reset from the hypervisor. And, if that is not the case then I think any malicious programs can turn off this feature inside HVM guests and can bypass the debugger. Moreover, I assumed anything that a guest can do, can also be done from the hypervisor by setting guest MSR registers or bitmap from the hypervisor.

However, if that is the case that you described and LBR recording cannot be enable Xen then could you please give me some idea what things need to be done from HVM guests side to enable this feature?

Thanks,
Abhinav

Quoted 45 lines · Jan Beulich

From: Jan Beulich <[email protected]>
Subject: Re: [Xen-devel] Last Branch Record (LBR) in Xen
To: "Abhinav Srivastava" <[email protected]>
Cc: [email protected]
Date: Friday, 26 June, 2009, 1:11 PM

Quoted 1 line
Quoted 1 line
Quoted 1 line

Abhinav Srivastava

<[email protected]>
25.06.09 18:57 >>>

Quoted 1 line

I am trying to achieve Last Branch Recording (LBR)

functionality on Intel Core 2 Quad processor from Xen hypervisor. However, I

Quoted 1 line

could not get it working. I am using Xen-3.2.2 (which I

agree is a bit old, however, there is not much change in the code related to

Quoted 3 lines

this functionality in Xen-3.4).

I looked into the patch provided by Keir and Jan

Beulich, and still I did not understand how to make it work. I got some success in

Quoted 1 line

creating single step on branch feature by setting bit 1

of GUEST_DEBUGCTL_MSR register. However, when I am trying to achieve

Quoted 1 line

LBR functionality (which requires reading

LASTBRANCH_TO_IP and LASTBRANC_FROM_IP registers too), it is not working.

Not sure what you actually want to do: There are two possible patches you might be talking about: One was simply to add (command line triggerable) support for printing out LBR values during register dumps (i.e. in particular when Xen crashes - which it will never do ;-) ). The other was to allow HVM guests to enable LBR recording on their own.

Quoted 1 line

I must admit that by looking into the patch I got

little bit confused. It would be really good if someone could tell me what are the

Quoted 1 line

steps required in the hypervisor to enable this

feature. Since I want to control this feature from the hypervisor without doing

Quoted 1 line

anything inside guest, how should I approach to this

problem.

If you refer to the second of the described patches, the guest has to do action on it own.

Quoted 8 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Cricket on your mind? Visit the ultimate cricket website. Enter http://cricket.yahoo.com

#1 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Abhinav Srivastava <[email protected]> 26.06.09 15:50 >>>

As far as I understand (please correct me if I am wrong), you meant that HVM guests have to enable the LBR recording, and this action cannot be initiated/controlled by Xen. I was thinking like other kind of actions, such as single stepping on instruction, single stepping on branch etc. that can be controlled from the hypervisor and guests behave accordingly, the LBR feature can also be set/reset from the hypervisor. And, if that is not the case then I think any malicious programs can turn off this feature inside HVM guests and can bypass the debugger. Moreover, I assumed anything that a guest can do, can also be done from the hypervisor by setting guest MSR registers or bitmap from the hypervisor.

Oh, of course this can be done from the hypervisor, but that wasn't the purpose of the patch. You'd have to code this for yourself.

Jan