Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR instructions on a 32 bit pentium machine. However, when I''m trying to make a hypercall on it the hypercall on it I''m unable to succeed and it fails. I tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and they both are returning < 0 values. I was wondering whether there is any way in which I can verify whether the hypercall pages have actually been mapped. I could take a dump of the pages that wrmsr maps into my domain and look through it for hypercall opcodes but if there is an easier way to confirm that, like a signature in the page mapped, please let me know. Thanks. Bhaskar. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
You can only execute hypercalls from ring 0 (kernel context), not user space. Is that your problem? -- Keir On 1/11/08 08:15, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR > instructions on a 32 bit pentium machine. However, when I''m trying to make a > hypercall on it the hypercall on it I''m unable to succeed and it fails. I > tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and they > both are returning < 0 values. > I was wondering whether there is any way in which I can verify whether the > hypercall pages have actually been mapped. I could take a dump of the pages > that wrmsr maps into my domain and look through it for hypercall opcodes but > if there is an easier way to confirm that, like a signature in the page > mapped, please let me know. > Thanks. > Bhaskar. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jayaraman, Bhaskar
2008-Nov-02 07:28 UTC
RE: [Xen-devel] Checking hypercall page existence!
No Keir, VxWorks doesn''t have a user, kernel context and everything runs in kernel mode in it. All tasks are scheduled in Ring0 on it so I''m not entirely sure why my hypercalls are failing, although I''m able to load the hypercall page. I''ll try invoking a few more calls and check if all the hypercalls are failing. I''m hoping that if I call more hypercalls and if the hypercall page hasn''t even loaded properly maybe I''m missing an instruction segment interrupt (Invalid opcode etc) as the hypercall branch is probably going to a legitimate instruction address for the ones I''m calling right now. On the other hand I was also thinking of dumping the whole 4k page laoded by wrmsr onto the terminal and check for hypercall opcodes within it to see if the page was actually loaded. If there''s some other way of checking if the page has loaded properly, or if you think I may have to do something else to make the calls work please let me know. Bhaskar. ________________________________________ From: Keir Fraser [keir.fraser@eu.citrix.com] Sent: Saturday, November 01, 2008 4:40 AM To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] Checking hypercall page existence! You can only execute hypercalls from ring 0 (kernel context), not user space. Is that your problem? -- Keir On 1/11/08 08:15, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR > instructions on a 32 bit pentium machine. However, when I''m trying to make a > hypercall on it the hypercall on it I''m unable to succeed and it fails. I > tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and they > both are returning < 0 values. > I was wondering whether there is any way in which I can verify whether the > hypercall pages have actually been mapped. I could take a dump of the pages > that wrmsr maps into my domain and look through it for hypercall opcodes but > if there is an easier way to confirm that, like a signature in the page > mapped, please let me know. > Thanks. > Bhaskar. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Dumping the page contents and disassembling would be sensible. -- Keir On 2/11/08 07:28, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> No Keir, VxWorks doesn''t have a user, kernel context and everything runs in > kernel mode in it. All tasks are scheduled in Ring0 on it so I''m not entirely > sure why my hypercalls are failing, although I''m able to load the hypercall > page. I''ll try invoking a few more calls and check if all the hypercalls are > failing. I''m hoping that if I call more hypercalls and if the hypercall page > hasn''t even loaded properly maybe I''m missing an instruction segment interrupt > (Invalid opcode etc) as the hypercall branch is probably going to a legitimate > instruction address for the ones I''m calling right now. > On the other hand I was also thinking of dumping the whole 4k page laoded by > wrmsr onto the terminal and check for hypercall opcodes within it to see if > the page was actually loaded. If there''s some other way of checking if the > page has loaded properly, or if you think I may have to do something else to > make the calls work please let me know. > Bhaskar. > ________________________________________ > From: Keir Fraser [keir.fraser@eu.citrix.com] > Sent: Saturday, November 01, 2008 4:40 AM > To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Checking hypercall page existence! > > You can only execute hypercalls from ring 0 (kernel context), not user > space. Is that your problem? > > -- Keir > > On 1/11/08 08:15, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote: > >> Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR >> instructions on a 32 bit pentium machine. However, when I''m trying to make a >> hypercall on it the hypercall on it I''m unable to succeed and it fails. I >> tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and they >> both are returning < 0 values. >> I was wondering whether there is any way in which I can verify whether the >> hypercall pages have actually been mapped. I could take a dump of the pages >> that wrmsr maps into my domain and look through it for hypercall opcodes but >> if there is an easier way to confirm that, like a signature in the page >> mapped, please let me know. >> Thanks. >> Bhaskar. >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jayaraman, Bhaskar
2008-Nov-03 08:49 UTC
RE: [Xen-devel] Checking hypercall page existence!
Keir, from a dump of the hypercall page loaded by the VM, I''m able to see the vmcall instruction in the hypercall page; please see attached file and you''ll find the opcode 0xc1010f00 for VMCALL instruction. In the Intel instruction set reference the opcode given is 0F01C1 for VMCALL and I guess that''s in big endian notation?? I also checked with a Linux HVM 2.6.18 kernel where I printed the hypercall page into the kernel log and the dmesg on that VM also throws the same output as you see in the attached file. So I''m not sure why any hypercalls should return a -1 value (I hope I''m supposed to check the return value), especially the two that I''m invoking. I''ll now try invoking other hypercalls one by one and see if they all fail on VxWorks. This is the code portion that''s breaking: - for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) { fi.submap_idx = i; if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0) { break; } ............. } The xen_feature_info_t structure has NULL initialized fields and I pass it with the hypercall but it doesn''t contain any values when the hypercall returns. I''m assuming that this means the hypercall fails but I''m not sure if the structure is supposed to conatain anything other than 0 filled values in it after the hypercall returns to an HVM. Bhaskar. -----Original Message----- From: Keir Fraser [mailto:keir.fraser@eu.citrix.com] Sent: Sunday, November 02, 2008 1:44 PM To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] Checking hypercall page existence! Dumping the page contents and disassembling would be sensible. -- Keir On 2/11/08 07:28, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> No Keir, VxWorks doesn''t have a user, kernel context and everything runs in > kernel mode in it. All tasks are scheduled in Ring0 on it so I''m not entirely > sure why my hypercalls are failing, although I''m able to load the hypercall > page. I''ll try invoking a few more calls and check if all the hypercalls are > failing. I''m hoping that if I call more hypercalls and if the hypercall page > hasn''t even loaded properly maybe I''m missing an instruction segment interrupt > (Invalid opcode etc) as the hypercall branch is probably going to a legitimate > instruction address for the ones I''m calling right now. > On the other hand I was also thinking of dumping the whole 4k page laoded by > wrmsr onto the terminal and check for hypercall opcodes within it to see if > the page was actually loaded. If there''s some other way of checking if the > page has loaded properly, or if you think I may have to do something else to > make the calls work please let me know. > Bhaskar. > ________________________________________ > From: Keir Fraser [keir.fraser@eu.citrix.com] > Sent: Saturday, November 01, 2008 4:40 AM > To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Checking hypercall page existence! > > You can only execute hypercalls from ring 0 (kernel context), not user > space. Is that your problem? > > -- Keir > > On 1/11/08 08:15, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote: > >> Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR >> instructions on a 32 bit pentium machine. However, when I''m trying to make a >> hypercall on it the hypercall on it I''m unable to succeed and it fails. I >> tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and they >> both are returning < 0 values. >> I was wondering whether there is any way in which I can verify whether the >> hypercall pages have actually been mapped. I could take a dump of the pages >> that wrmsr maps into my domain and look through it for hypercall opcodes but >> if there is an easier way to confirm that, like a signature in the page >> mapped, please let me know. >> Thanks. >> Bhaskar. >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Add some tracing to the hypercall function in xen/arch/x86/hvm/hvm.c and see if you are getting that far and, if so, what error path you are taking. -- Keir On 3/11/08 08:49, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> Keir, from a dump of the hypercall page loaded by the VM, I''m able to see the > vmcall instruction in the hypercall page; please see attached file and you''ll > find the opcode 0xc1010f00 for VMCALL instruction. In the Intel instruction > set reference the opcode given is 0F01C1 for VMCALL and I guess that''s in big > endian notation?? > > I also checked with a Linux HVM 2.6.18 kernel where I printed the hypercall > page into the kernel log and the dmesg on that VM also throws the same output > as you see in the attached file. So I''m not sure why any hypercalls should > return a -1 value (I hope I''m supposed to check the return value), especially > the two that I''m invoking. I''ll now try invoking other hypercalls one by one > and see if they all fail on VxWorks. > > This is the code portion that''s breaking: - > for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) { > fi.submap_idx = i; > if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0) { > break; > } > ............. > } > > The xen_feature_info_t structure has NULL initialized fields and I pass it > with the hypercall but it doesn''t contain any values when the hypercall > returns. I''m assuming that this means the hypercall fails but I''m not sure if > the structure is supposed to conatain anything other than 0 filled values in > it after the hypercall returns to an HVM. > > Bhaskar. > -----Original Message----- > From: Keir Fraser [mailto:keir.fraser@eu.citrix.com] > Sent: Sunday, November 02, 2008 1:44 PM > To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Checking hypercall page existence! > > Dumping the page contents and disassembling would be sensible. > > -- Keir > > On 2/11/08 07:28, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote: > >> No Keir, VxWorks doesn''t have a user, kernel context and everything runs in >> kernel mode in it. All tasks are scheduled in Ring0 on it so I''m not entirely >> sure why my hypercalls are failing, although I''m able to load the hypercall >> page. I''ll try invoking a few more calls and check if all the hypercalls are >> failing. I''m hoping that if I call more hypercalls and if the hypercall page >> hasn''t even loaded properly maybe I''m missing an instruction segment >> interrupt >> (Invalid opcode etc) as the hypercall branch is probably going to a >> legitimate >> instruction address for the ones I''m calling right now. >> On the other hand I was also thinking of dumping the whole 4k page laoded by >> wrmsr onto the terminal and check for hypercall opcodes within it to see if >> the page was actually loaded. If there''s some other way of checking if the >> page has loaded properly, or if you think I may have to do something else to >> make the calls work please let me know. >> Bhaskar. >> ________________________________________ >> From: Keir Fraser [keir.fraser@eu.citrix.com] >> Sent: Saturday, November 01, 2008 4:40 AM >> To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com >> Subject: Re: [Xen-devel] Checking hypercall page existence! >> >> You can only execute hypercalls from ring 0 (kernel context), not user >> space. Is that your problem? >> >> -- Keir >> >> On 1/11/08 08:15, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote: >> >>> Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR >>> instructions on a 32 bit pentium machine. However, when I''m trying to make a >>> hypercall on it the hypercall on it I''m unable to succeed and it fails. I >>> tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and >>> they >>> both are returning < 0 values. >>> I was wondering whether there is any way in which I can verify whether the >>> hypercall pages have actually been mapped. I could take a dump of the pages >>> that wrmsr maps into my domain and look through it for hypercall opcodes but >>> if there is an easier way to confirm that, like a signature in the page >>> mapped, please let me know. >>> Thanks. >>> Bhaskar. >>> >>> _______________________________________________ >>> Xen-devel mailing list >>> Xen-devel@lists.xensource.com >>> http://lists.xensource.com/xen-devel >> >> > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jayaraman, Bhaskar
2008-Nov-03 13:14 UTC
RE: [Xen-devel] Checking hypercall page existence!
Keir, I was passing a bad argument in one of the registers for HYPERVISOR_xen_version and now the hypercall works fine. The reason HYPERVISOR_vm_assist hypercalls is failing is because it isn''t implemented for HVMs. I''m now in the process of checking if the other calls that are enabled for HVMs are working. Thanks very much for you time on this. Bhaskar. -----Original Message----- From: Keir Fraser [mailto:keir.fraser@eu.citrix.com] Sent: Sunday, November 02, 2008 1:44 PM To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] Checking hypercall page existence! Dumping the page contents and disassembling would be sensible. -- Keir On 2/11/08 07:28, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> No Keir, VxWorks doesn''t have a user, kernel context and everything runs in > kernel mode in it. All tasks are scheduled in Ring0 on it so I''m not entirely > sure why my hypercalls are failing, although I''m able to load the hypercall > page. I''ll try invoking a few more calls and check if all the hypercalls are > failing. I''m hoping that if I call more hypercalls and if the hypercall page > hasn''t even loaded properly maybe I''m missing an instruction segment interrupt > (Invalid opcode etc) as the hypercall branch is probably going to a legitimate > instruction address for the ones I''m calling right now. > On the other hand I was also thinking of dumping the whole 4k page laoded by > wrmsr onto the terminal and check for hypercall opcodes within it to see if > the page was actually loaded. If there''s some other way of checking if the > page has loaded properly, or if you think I may have to do something else to > make the calls work please let me know. > Bhaskar. > ________________________________________ > From: Keir Fraser [keir.fraser@eu.citrix.com] > Sent: Saturday, November 01, 2008 4:40 AM > To: Jayaraman, Bhaskar; xen-devel@lists.xensource.com > Subject: Re: [Xen-devel] Checking hypercall page existence! > > You can only execute hypercalls from ring 0 (kernel context), not user > space. Is that your problem? > > -- Keir > > On 1/11/08 08:15, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote: > >> Hi, I''ve mapped hypercall pages onto a VxWorks HVM using the CPUID and WRMSR >> instructions on a 32 bit pentium machine. However, when I''m trying to make a >> hypercall on it the hypercall on it I''m unable to succeed and it fails. I >> tried the HYPERVISOR_xen_version and HYPERVISOR_vm_assist hypercalls and they >> both are returning < 0 values. >> I was wondering whether there is any way in which I can verify whether the >> hypercall pages have actually been mapped. I could take a dump of the pages >> that wrmsr maps into my domain and look through it for hypercall opcodes but >> if there is an easier way to confirm that, like a signature in the page >> mapped, please let me know. >> Thanks. >> Bhaskar. >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xensource.com >> http://lists.xensource.com/xen-devel > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel