RE: [patch] fix kvm_arch_vcpu_ioctl_[gs]et_regs()

"Zhang, Xiantao" <[email protected]>
Newsgroups org.kernel.vger.kvm-ia64
Message-ID <706158FABBBA044BAD4FE898A02E4BC219CABACD@pdsmsx503.ccr.corp.intel.com>
Avi Kivity wrote:
> Jes Sorensen wrote:
>> Hi,
>> 
>> This patch makes these two macros do something sensible on ia64 and
>> work the way qemu expects to use them. The old versions clearly
>> couldn't have worked since the get_regs() call expected pointers in
>> the kvm_regs struct which were never copied in.
>> 
>> Fix kvm_arch_vcpu_ioctl_[gs]et_regs() to do something meaningful on
>> ia64. Old versions could never have worked since they required
>> pointers to be set in the ioctl payload which were never being set by
>> the ioctl handler for get_regs.
>> 
>> This version doesn't support copying the KVM kernel stack in/out of
>> the kernel. This should be implemented in a seperate ioctl call if
>> ever needed.
>> 
>> 
>>  struct kvm_regs {
>> -	char *saved_guest;
>> -	char *saved_stack;
>>  	struct saved_vpd vpd;
>>  	/*Arch-regs*/
>>  	int mp_state;
>> @@ -233,6 +231,8 @@
>>  	unsigned long fp_psr;       /*used for lazy float register */ 
>>  	unsigned long saved_gp; /*for phycial  emulation */
>> +
>> +	union context saved_guest;
>>  };
>> 
>> 
> 
> This makes several tons of sense, but breaks backwards compatibility.
> If I understand correctly, get/set was never used so this shouldn't
> matter? 

It doesn't matter, we haven't enabled  userspace code for save/restore and live migration before, so shouldn't result in the issue.   

> I suggest reserving some space at the end of kvm_regs in case further
> state needs to be added.
> Please add a KVM_CAP_ entry to advertise the fixup.  This way
> userspace can determine that it's compiling or running on an old
> kernel and error out gracefully.

Agree. 

Xiantao
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.