All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH 3/8] KVM: Adds ability	to	preempt	an	executing VCPU
Date: Wed, 16 May 2007 15:18:07 +0300	[thread overview]
Message-ID: <464AF67F.9060801@qumranet.com> (raw)
In-Reply-To: <464ABC67.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>

Gregory Haskins wrote:
>>>> On Wed, May 16, 2007 at  6:05 AM, in message <464AD772.4050007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
>>>>         
> Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote: 
>   
>> Gregory Haskins wrote:
>>     
>>>   
>>>       
>>>> Later we'll have vcpu and thread_info point to each other and then you
>>>> can do that kind of optimization.
>>>>     
>>>>         
>>> I am not familiar with thread_info, but if it solves the dangling pointer 
>>>       
>> problem, that sounds great.
>>
>> It's fairly tricky, but it's the right way forward.  It means a 1:1 
>> association of a vcpu and a thread for the lifetime of the vcpu.
>>     
>
> Any pointers would be appreciated.  Otherwise I will hit up google.
>
>   

task_struct (include/linux/sched.h) is probably a better fit.  
Basically, like each task has attributes like its registers, fpu state, 
and open file table, it would also have a vcpu attribute if it's part of 
a virtual machine.

>>>   It sounds like you are in favor of leaving this optimization for a later 
>>>       
>> time.  As long as you are ok with every interrupt related ioctl such as 
>> KVM_APIC_MSG, and KVM_ISA_INTERRUPT posting a signal to itself, we can pull 
>> this for now.
>>
>> Perhaps you can disable this by noticing that you're injecting an 
>> interrupt now (another icky variable in struct kvm_vcpu).
>>     
>
> I don't think this can be made to work without having the same problem that we face already.  Detecting self-injection is the same problem at ioctl entry point as it is at irqdevice::intr
>   

Ok.
>   
>>>   Conversely, if the thread_info approach isn't hard, I would prefer to get 
>>>       
>> this right now, as the double interrupt thing seems nasty to me.
>>     
>>> Alternatively, perhaps I can just replace irq.task with irq.pid?  And I 
>>>       
>> could also replace irq.guest_mode with irq.guest_cpu.  I will then record the 
>> pid where today I record the task.  Likewise, I can extract the guest_cpu 
>> (using task_cpu(current)) where today I assign irq.guest_mode = 1.  That 
>> would effectively remove the dangling pointer problem while retaining the 
>> features that I like.  
>>     
>>>   
>>>       
>> pid can dangle just the same as a task pointer, only much worse.
>>     
>
> I agree that it can dangle briefly if userspace is using something like thread-pooling to execute VCPUs.  I don't see how it can be worse, however.  And also note that having it dangling doesn't have the nasty problem that the task pointer does: dereferencing an invalid pointer.
>
> However, that being said: I do see how either of these solutions leave a potential race condition against missing some signals:  If a thread that was executing the VCPU changes roles, AND it injects an interrupt before the new thread starts executing...we would miss the signal.  This is not a realistic scenario today, but it is a hole.  Hmmm..... how does that thread_info stuff work? ;)
>   

These corner cases don't need to work well as VMs, they just need not to 
be expoitable.


-- 
error compiling committee.c: too many arguments to function


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

  parent reply	other threads:[~2007-05-16 12:18 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09  3:03 [PATCH 0/8] in-kernel APIC support "v1" Gregory Haskins
     [not found] ` <20070509023731.23443.86578.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-09  3:03   ` [PATCH 1/8] KVM: Adds support for in-kernel mmio handlers Gregory Haskins
     [not found]     ` <20070509030315.23443.93779.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-09  9:51       ` [PATCH 1/8] KVM: Adds support for in-kernel mmiohandlers Dor Laor
2007-05-09  3:03   ` [PATCH 2/8] KVM: Add irqdevice object Gregory Haskins
     [not found]     ` <20070509030320.23443.51197.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-09 15:16       ` Dor Laor
     [not found]         ` <64F9B87B6B770947A9F8391472E032160BBA6157-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-05-09 18:04           ` Gregory Haskins
     [not found]             ` <4641D4D8.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-09 22:12               ` Dor Laor
     [not found]                 ` <64F9B87B6B770947A9F8391472E032160BBA6471-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-05-09 22:47                   ` Gregory Haskins
     [not found]                     ` <4642170B.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-13 12:05                       ` Avi Kivity
2007-05-09  3:03   ` [PATCH 3/8] KVM: Adds ability to preempt an executing VCPU Gregory Haskins
     [not found]     ` <20070509030325.23443.90129.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-14  9:34       ` Avi Kivity
     [not found]         ` <46482D2E.7040809-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 15:19           ` Gregory Haskins
     [not found]             ` <464845AD.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-14 15:45               ` Avi Kivity
     [not found]                 ` <46488426.8090705-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 18:19                   ` Gregory Haskins
     [not found]                     ` <46486FD4.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-15  7:28                       ` Avi Kivity
     [not found]                         ` <46496125.5020909-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-15 11:56                           ` Gregory Haskins
     [not found]                             ` <4649679C.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-16 10:05                               ` Avi Kivity
     [not found]                                 ` <464AD772.4050007-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-16 12:10                                   ` Gregory Haskins
     [not found]                                     ` <464ABC67.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-16 12:18                                       ` Avi Kivity [this message]
2007-05-09  3:03   ` [PATCH 4/8] KVM: Adds ability to signal userspace using a file-descriptor Gregory Haskins
2007-05-09  3:03   ` [PATCH 5/8] KVM: Add support for in-kernel LAPIC model Gregory Haskins
2007-05-09  3:03   ` [PATCH 6/8] KVM: Adds support for real NMI injection on VMX processors Gregory Haskins
     [not found]     ` <20070509030340.23443.84153.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-14  9:38       ` Avi Kivity
2007-05-09  3:03   ` [PATCH 7/8] KVM: Adds basic plumbing to support TPR shadow features Gregory Haskins
2007-05-09  3:03   ` [PATCH 8/8] KVM: Adds support for TPR shadowing under VMX processors Gregory Haskins
     [not found]     ` <20070509030350.23443.35387.stgit-sLgBBP33vUGnsjUZhwzVf9HuzzzSOjJt@public.gmane.org>
2007-05-14 11:09       ` Avi Kivity
     [not found]         ` <46484376.6090304-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-14 15:28           ` Gregory Haskins
2007-05-13 12:02   ` [PATCH 0/8] in-kernel APIC support "v1" Avi Kivity
     [not found]     ` <4646FE71.5080009-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-05-13 14:09       ` Gregory Haskins
     [not found]         ` <4646E3D1.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
2007-05-13 15:45           ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=464AF67F.9060801@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.