Skip to contentSkip to conversation

Question about EMULATE_DO_MMIO

DISCUSSION Nitin A Kamble 2 participants 4 messages Oct 16, 2007 – Oct 17, 2007 3 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

Hi Avi,
I was trying to avoid vm86 mode completely, by using emulation for
all the real mode code emulation. It is doing better than vm86 mode, but I am seeing one issue with this approch.

The emulator is failing due to this code. Seems like the execution
need to go back to qemu to finish some pending MMIO.

       if (vcpu->mmio_is_write) {
                vcpu->mmio_needed = 0;
                return EMULATE_DO_MMIO;
        }

Do you have how should it be handled? I am not clear what needs to be done to handle this situation properly.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 1192559057.2488.5.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org

#2 lore raw
Quoted 3 lines · Nitin A Kamble

Hi Avi,
I was trying to avoid vm86 mode completely, by using emulation for
all the real mode code emulation. It is doing better than vm86 mode,

Why do you think it is better? I would have thought that vm86 is much faster.

I thought of doing it this way:

- try to run normally
- if vm entry failed due to invalid guest state (the famous 0x80000021), then emulate 50 instructions
- repeat

That will also handle the few cases where VT can't handle protected mode.

Quoted 6 lines

but
I am seeing one issue with this approch.

The emulator is failing due to this code. Seems like the execution
need to go back to qemu to finish some pending MMIO.

Quoted 8 lines
       if (vcpu->mmio_is_write) {
                vcpu->mmio_needed = 0;
                return EMULATE_DO_MMIO;
        }

Do you have how should it be handled? I am not clear what needs to be done to handle this situation properly.

It should exit to userspace, same as the non-emulating case. However it shouldn't happen for normal writes.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

A message that is not in the archive (sent off-list or not yet received): 47151B38.1070402-atKUWr5tajBWk0Htik3J/[email protected]

#4 lore raw
Quoted 3 lines · Avi Kivity

Why do you think it is better? I would have thought that vm86 is much faster.

I am seeing execution going to strange places in vm86 mode. That issue is not coming in the emulation.

Quoted 7 lines

I thought of doing it this way:

- try to run normally
- if vm entry failed due to invalid guest state (the famous 0x80000021),
then emulate 50 instructions
- repeat

This may be better, I will give it a try.

Quoted 7 lines

That will also handle the few cases where VT can't handle protected mode.

It should exit to userspace, same as the non-emulating case. However it
shouldn't happen for normal writes.

Only thing is if it in the real mode, then returning back to user mode will setup the cpu state as real mode, and because of that vmenter will fail.

Quoted 6 lines

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

Thanks a lot for your input.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 1192566489.2488.10.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org

#6 lore raw
Quoted 11 lines · Nitin A Kamble
Quoted 4 lines · Avi Kivity

Why do you think it is better? I would have thought that vm86 is much faster.

I am seeing execution going to strange places in vm86 mode. That issue is not coming in the emulation.

That means there's a bug somewhere. We need to fix it.

Quoted 12 lines
Quoted 8 lines

That will also handle the few cases where VT can't handle protected mode.

It should exit to userspace, same as the non-emulating case. However it
shouldn't happen for normal writes.

Only thing is if it in the real mode, then returning back to user mode will setup the cpu state as real mode, and because of that vmenter will fail.

It will fail, and we'll see it and go back to emulation.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/