Bryan D. Payne
2005-Dec-02 16:42 UTC
[Xen-devel] unexpected results with xc_domain_get_vcpu_context
I''m getting some unexpected results with xc_domain_get_vcpu_context. Basically, I''ve written a simple application in domain 0 to view the vcpu for another domain. However, each time that I call xc_domain_get_vcpu_context, the value for eip is the same. Is this expected behavior? I would have expected eip to be changing continuously as the machine runs. Or does this function not give me the "live" values? Here''s the code that I''m using... int main (int argc, char **argv) { int xc_handle; vcpu_guest_context_t ctxt; struct timespec sleep_timer; uint32_t dom = 6; /* hard code this for easy testing */ /* setup */ if ((xc_handle = xc_interface_open()) == -1){ printf("error opening xc interface\n"); goto error_exit; } sleep_timer.tv_sec = 2; sleep_timer.tv_nsec = 000000000; /* 0.00 seconds */ while (1){ /* sleep for designated time */ if (nanosleep(&sleep_timer, NULL) != 0){ perror("Sleep interrupted, exiting..."); goto error_exit; } if (xc_domain_get_vcpu_context(xc_handle, dom, 1, &ctxt) == -1){ printf("error getting vcpu context\n"); goto error_exit; } /* perform the designated task */ printf("eip = 0x%x\n", ctxt.user_regs.eip); } error_exit: if (xc_handle != -1) xc_interface_close(xc_handle); return 0; } Thanks, -bryan - Bryan D. Payne Graduate Student, Computer Science Georgia Tech Information Security Center http://www.bryanpayne.org _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Dec-02 17:08 UTC
Re: [Xen-devel] unexpected results with xc_domain_get_vcpu_context
On 2 Dec 2005, at 16:42, Bryan D. Payne wrote:> I''m getting some unexpected results with xc_domain_get_vcpu_context. > Basically, I''ve written a simple application in domain 0 to view the > vcpu for another domain. However, each time that I call > xc_domain_get_vcpu_context, the value for eip is the same. Is this > expected behavior? I would have expected eip to be changing > continuously as the machine runs. Or does this function not give me > the "live" values?If the vcpu is idle, you will continually get the address following the ''block'' hypercall in the guest kernel''s idle loop. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Bryan D. Payne
2005-Dec-02 17:33 UTC
Re: [Xen-devel] unexpected results with xc_domain_get_vcpu_context
> If the vcpu is idle, you will continually get the address following > the ''block'' hypercall in the guest kernel''s idle loop.True. I should have mentioned that I was running some apps on the machine at the time of testing to try to avoid this case. Just simple things like top and ls through an ssh shell. Perhaps that''s not enough to get out of the idle loop most of the time? -bryan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Dec-02 17:59 UTC
Re: [Xen-devel] unexpected results with xc_domain_get_vcpu_context
On 2 Dec 2005, at 17:33, Bryan D. Payne wrote:>> If the vcpu is idle, you will continually get the address following >> the ''block'' hypercall in the guest kernel''s idle loop. > > True. I should have mentioned that I was running some apps on the > machine at the time of testing to try to avoid this case. Just simple > things like top and ls through an ssh shell. Perhaps that''s not > enough to get out of the idle loop most of the time?Absolutely it isn''t. Try running ''while true ; do true ; done'' from a shell prompt in the domU and see the difference. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Bryan D. Payne
2005-Dec-05 17:03 UTC
Re: [Xen-devel] unexpected results with xc_domain_get_vcpu_context
> Absolutely it isn''t. Try running ''while true ; do true ; done'' from > a shell prompt in the domU and see the difference.Ok, thanks. I just tried this and can now see eip changing, so I think that everything''s working as it''s supposed to. Cheers, -bryan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel