Hi Avi, 

I've been work on other things for long time, so this patch delayed for
a while. I am planning to post it out recently, but found that, because
of userspace allocate memory patch, rmap was moved to memslot. So your
suggestion on deal it with gfn_to_page seems got a little trouble. And I
don't perfer to use one memslot to do this kind of thing alone. 

Any suggestions?

Avi Kivity wrote:
> Yang, Sheng wrote:
>> These patches enable memory mapped TPR shadow (FlexPriority).
>> 
>> Since TPR is accessed very frequently by 32bit Windows, especially
SMP
>> guest, with FlexPriority enabled, we saw significant performance
gain.
>> 
>> The issue is: FlexPriority needs to add a memory slot to the vm to
make
>> shadow work with APIC access page.
>> 
>> We don't like the idea to add a memory slot, but no better choice
now.
>> Our propose is to add p2m table to KVM, while seems this is still a
long
>> way to go. 
>> 
>> BTW: I didn't use the offset(or other info) provide by CPU when
handling
>> APIC access vmexit. Instead, I used a bit in cmd_type(including
>> no_decode) to tell emulator decode memory operand by itself when
>> necessary. That's because I only got the guest physical address when
>> handling APIC access vmexit, but emulator need a guest virtual
address
>> to fit its flow. I have tried some ways, and current solution seems
the
>> most proper one. 
>> 
>> 
> 
>> These patches enable memory mapped TPR shadow (FlexPriority).
>> 
>> Since TPR is accessed very frequently by 32bit Windows, especially
SMP
>> guest, with FlexPriority enabled, we saw significant performance
gain.
>> 
>> The issue is: FlexPriority needs to add a memory slot to the vm to
make
>> shadow work with APIC access page.
>> 
>> We don't like the idea to add a memory slot, but no better choice
now.
>> Our propose is to add p2m table to KVM, while seems this is still a
long
>> way to go. 
>> 
>> BTW: I didn't use the offset(or other info) provide by CPU when
handling
>> APIC access vmexit. Instead, I used a bit in cmd_type(including
>> no_decode) to tell emulator decode memory operand by itself when
>> necessary. That's because I only got the guest physical address when
>> handling APIC access vmexit, but emulator need a guest virtual
address
>> to fit its flow. I have tried some ways, and current solution seems
the
>> most proper one. 
>> 
>> +    struct kvm_memory_region apic_memory = {
>> +            .slot = 5,
>> +            .memory_size = PAGE_SIZE,
>> +            .guest_phys_addr = apicmem,
>> +    };
>> 
>>      if (memory >= pcimem)
>>              extended_memory.memory_size = pcimem - exmem;
>> @@ -302,9 +308,16 @@ int kvm_create(kvm_context_t kvm, unsigned long
>> phys_mem_bytes, void **vm_mem)
>>              }
>>      }
>> 
>> +    r = ioctl(fd, KVM_SET_MEMORY_REGION, &apic_memory); +   if (r ==
-1) {
>> +            fprintf(stderr, "kvm_create_memory_region: %m\n"); +
return -1;
>> +    }
>> 
> 
> Older kernels support only 4 memory slots, so you need to tolerate
> failures here (this isn't an issue for large memory, because there's
no
> way the older kernel can run with large memory, so you can't continue.
> but new userspace should be able to run with an older kernel if is not
> using newer features.
> 
> I don't like userspace involvement in this.  Perhaps we can have a
> memory slot controlled by the kernel for this?  It would be activated
by
> the feature, so it we won't have it on AMD or when the feature isn't
> available.
> 
> It can also be just a special case in gfn_to_page.

Thanks
Yang, Sheng

-------------------------------------------------------------------------
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

Reply via email to