>-----Original Message-----
>From: Avi Kivity [mailto:[EMAIL PROTECTED]
>Sent: 2007年7月12日 16:16
>To: He, Qing
>Cc: kvm-devel
>Subject: Re: [kvm-devel] [PATCH] SMP: Setup multiple tss for real mode 
>emulation
>
>He, Qing wrote:
>> This patch sets up multiple TSS for real mode emulation on Intel vmx,
>> one for each vcpu. This is a preparation patch for full SMP real mode
>> support.
>>
>>
>
>Why are separate tss's needed?  Can't all vcpus use the same tss?

Yeah, I think it can. At first, I was thinking that using multiple tss is more 
natural, because the real mode of different vcpu are regarded as different 
tasks (in the guest). But now, it appears OK to me since the tss should be read 
only. There's no vm86 task switch inside the guest; and task switch in the 
kernel doesn't really affect the tss. Although I personally prefer the multiple 
tss, current code is OK to me.

>
>> Signed-off-by: Qing He <[EMAIL PROTECTED]>
>>
>>
>> kvm.h      |    1 +
>> kvm_main.c |    1 +
>> vmx.c      |   31 +++++++++++++++++--------------
>> 3 files changed, 19 insertions(+), 14 deletions(-)
>>
>>
>> diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
>> index 65ab268..0f7a4d9 100644
>> --- a/drivers/kvm/kvm.h
>> +++ b/drivers/kvm/kvm.h
>> @@ -328,6 +328,7 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
>>
>>  struct kvm_vcpu {
>>      struct kvm *kvm;
>> +    int vcpu_id;
>>
>
>Switching to ->vcpu_id instead of computing (vcpu - vcpu->kvm->vcpus) is
>a good idea (and necessary when separately allocating vcpus).  But in
>its own patch, please.

OK, that's fine. I'll post a separate patch.

>
>> -    vmcs_write16(GUEST_CS_SELECTOR, 0xf000);
>> -    vmcs_writel(GUEST_CS_BASE, 0x000f0000);
>> -    vmcs_write32(GUEST_CS_LIMIT, 0xffff);
>> -    vmcs_write32(GUEST_CS_AR_BYTES, 0x9b);
>> +    if (vcpu->vcpu_id == 0) {
>> +            vmcs_write16(GUEST_CS_SELECTOR, 0xf000);
>> +            vmcs_writel(GUEST_CS_BASE, 0x000f0000);
>> +            vmcs_write32(GUEST_CS_LIMIT, 0xffff);
>> +            vmcs_write32(GUEST_CS_AR_BYTES, 0x9b);
>> +            vmcs_writel(GUEST_RIP, 0xfff0);
>> +    }
>>
>>
>
>Since you're not initializing these registers for vcpu_id != 0, we might
>as well not touch this code.

Agree. I also think leaving it untouched right now is better, so I'll defer 
this to SIPI patches.

Thanks,
Qing

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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to