Skip to contentSkip to conversation

Why using hypercall_page ?

DISCUSSION Wu Bingzheng 4 participants 6 messages Oct 23, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

I am studing Xen hypercall now. I found that hypercall is invoked via hypercall_page, which is only filled with (in no-hypervisor-kernel-mode ):

mov $i, %eax
int $0x82
ret

Why not invoked the hypercall directly by "int $0x82" ? What's the advantage of using hypercall_page?

Thanks,
Wu

#1 lore raw
Quoted 9 lines

From: Wu Bingzheng
Sent: Thursday, October 23, 2008 9:18 AM

Hello,

I am studing Xen hypercall now. I found that hypercall is invoked via hypercall_page, which is only filled with (in no-hypervisor-kernel-mode ):

Quoted 7 lines

mov $i, %eax
int $0x82
ret

Why not invoked the hypercall directly by "int $0x82" ? What's the advantage of using hypercall_page?

This allows guest migrated to a newer/older xen with a different hypercall invocation convention. Xen fills hypercall page by its convention, and thus release guest from hardcoding specific flow.

Thanks
Kevin

#3 lore raw
In reply to Wu Bingzheng

As you know, the old Intel/AMD x86 cpus use INT to invoke kernel's service. But the newer CPUs introduce two instruction pairs:
syscall/sysret, syscenter/sysexit. So, because the hypercall page is filled by Xen, it can hide the difference of this two types. Guest OS only take one uniform format to invoke a hypercall.
I gusee this is the reason.

-Techie

-----邮件原件-----
发件人: [email protected] [mailto:[email protected]] 代表 Wu Bingzheng 发送时间: 2008年10月23日 9:18
收件人: [email protected]
主题: [Xen-devel] Why using hypercall_page ?

Hello,

I am studing Xen hypercall now. I found that hypercall is invoked via hypercall_page, which is only filled with (in no-hypervisor-kernel-mode ):

mov $i, %eax
int $0x82
ret

Why not invoked the hypercall directly by "int $0x82" ? What's the advantage of using hypercall_page?

Thanks,
Wu

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

#2 lore raw
In reply to Tian, Kevin

To invoke hypercall:

1. Not using hypercall_page:

mov $__HYPERCALL_sched_op, %eax
int $0x82

2. Using hypercall_page:

call hypercall_page + __HYPERCALL_sched_op * 32

Besides, using the hypercall_page, guest has to keep a page for hypercall_page.

I do not think the hypercall_page makes the thing much easier.

Is "release guest from hardcoding" the only advantage of using hypercall_page?

Thanks,
Wu

Quoted 23 lines · Kevin
Quoted 9 lines

From: Wu Bingzheng
Sent: Thursday, October 23, 2008 9:18 AM

Hello,

I am studing Xen hypercall now. I found that hypercall is invoked via hypercall_page, which is only filled with (in no-hypervisor-kernel-mode ):

Quoted 7 lines

mov $i, %eax
int $0x82
ret

Why not invoked the hypercall directly by "int $0x82" ? What's the advantage of using hypercall_page?

This allows guest migrated to a newer/older xen with a different hypercall invocation convention. Xen fills hypercall page by its convention, and thus release guest from hardcoding specific flow.

Thanks
Kevin

#4 lore raw
In reply to Li Yaqiong

I think that's the reason too.

Thank you very much.

Wu

Quoted 39 lines · 在 2008-10-23四的 09:31 +0800,Li Yaqiong写道:

As you know, the old Intel/AMD x86 cpus use INT to invoke kernel's service. But the newer CPUs introduce two instruction pairs:
syscall/sysret, syscenter/sysexit. So, because the hypercall page is filled by Xen, it can hide the difference of this two types. Guest OS only take one uniform format to invoke a hypercall.
I gusee this is the reason.

-Techie

-----邮件原件-----
发件人: [email protected] [mailto:[email protected]] 代表 Wu Bingzheng 发送时间: 2008年10月23日 9:18
收件人: [email protected]
主题: [Xen-devel] Why using hypercall_page ?

Hello,

I am studing Xen hypercall now. I found that hypercall is invoked via hypercall_page, which is only filled with (in no-hypervisor-kernel-mode ):

mov $i, %eax
int $0x82
ret

Why not invoked the hypercall directly by "int $0x82" ? What's the advantage of using hypercall_page?

Thanks,
Wu

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

#5 lore raw

Yes, I think Kevin and Techie have explained it clearly.
BTW, for HVM guest's hypercall, we don't use int 0x82 or the sysXXX instructions; we use VMCALL inside VMX guest or something similar (VMMCALL? I'm not sure) inside SVM guest. Even for PV guest, the hypercall stub codes may have different formats/versions...
We can see these differences in the function hypercall_page_initialise().

So considering compatibility and portability, it's really not OK for a guest to assume the underlying stub codes or doing hard coding. Using the hypercall-page method, various guests can use one unified method to invoke hypercalls.

Thanks,
-- Dexuan

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wu Bingzheng
Sent: 2008年10月23日 9:46
To: Li Yaqiong
Cc: [email protected]
Subject: Re: 答复: [Xen-devel] Why using hypercall_page ?

I think that's the reason too.

Thank you very much.

Wu

Quoted 29 lines · 在 2008-10-23四的 09:31 +0800,Li Yaqiong写道:

As you know, the old Intel/AMD x86 cpus use INT to invoke kernel's service. But the newer CPUs introduce two instruction pairs:
syscall/sysret, syscenter/sysexit. So, because the hypercall page is filled by Xen, it can hide the difference of this two types. Guest OS only take one uniform format to invoke a hypercall.
I gusee this is the reason.

-Techie

-----邮件原件-----
发件人: [email protected] [mailto:[email protected]] 代表 Wu Bingzheng 发送时间: 2008年10月23日 9:18
收件人: [email protected]
主题: [Xen-devel] Why using hypercall_page ?

Hello,

I am studing Xen hypercall now. I found that hypercall is invoked via hypercall_page, which is only filled with (in no-hypervisor-kernel-mode ):

mov $i, %eax
int $0x82
ret

Why not invoked the hypercall directly by "int $0x82" ? What's the advantage of using hypercall_page?

Quoted 10 lines

Thanks,
Wu

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

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

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