All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "Dong, Eddie" <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: kernel device reset support
Date: Tue, 09 Oct 2007 12:17:12 +0200	[thread overview]
Message-ID: <470B5528.2010605@qumranet.com> (raw)
In-Reply-To: <10EA09EFD8728347A513008B6B0DA77A0231C1AA-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>

Dong, Eddie wrote:
> Avi Kivity wrote:
>   
>>> In native, RESET signal force every processor enter "RESET" status,
>>> and then immediately after RESET signal is removed, all CPUs will
>>> compete for BSP role, the winner continue execution, and failor will
>>> be blocked till INIT/SIPI/SIPI. 
>>>
>>>       
>> I meant, you could set both to VCPU_MP_STATE_UNINITIALIZED and let the
>> vcpu code do the reset differently depending on vcpu_id.  This way you
>> don't run into locking issues (kvm_lapic_reset() needs the vcpu lock?)
>>     
>
> If BSP mp_state becomes VCPU_MP_STATE_UNINITIALIZED, current code
> can't wakeup it. We need additional code that I am not aware of now.
>
> Current VCPU must be BSP, otherwise the code executing in Qemu will have
> problem too.
>   

But, for an ungraceful reset, nothing prevents an AP from issuing a reset?


>   
>>> For a graceful reboot, this one is not needed since every APs are
>>> already brought to HALT status before BSP issue RESET signal. But in
>>> case of non-graceful reboot, it is possible the VCPUs are still
>>> executing guest instruction, so we kick the VCPU and then use this
>>> logic to force the exception handler to be a heavy VM Exit and
>>> execute following code at beginning of kvm_vcpu_ioctl_run. (Let
>>> VCPU_MP_STATE_UNINITIALIZED take effective)
>>>
>>>         if (unlikely(vcpu->mp_state ==
>>>       
>> VCPU_MP_STATE_UNINITIALIZED)) {
>>     
>>>                 if (irqchip_in_kernel(vcpu->kvm) && vcpu->apic)
>>>                         kvm_lapic_reset(vcpu);
>>>                 kvm_vcpu_block(vcpu);
>>>                 vcpu_put(vcpu);
>>>                 return -EAGAIN;
>>>         }
>>>
>>> Whether we need to handle those un-graceful reboot case is up to you
>>> :-) If not, then those code can be removed.
>>>
>>>       
>> We do need to support ungraceful resets.  But this could
>> easily be done
>> via vcpu->requests.
>>     
>
> Mmm, almost Yes, then it is same with force_to_quit.
> But reset doesn't mean lapic_reset only, it needs to 
> enter wait for INIT/SIPI cycles. So using mp_state is
> much closer.
>
>   

What I mean is to use mp_state within the vcpu code (while holding the 
vcpu mutex) and to use vcpu->requests as a means to tell the vcpu it 
needs to change state.


>> To reset a vcpu:
>>
>>    set_bit(KVM_REQ_RESET, &vcpu->requests)
>>    kvm_vcpu_kick(vcpu);
>>
>> And in __vcpu_run():
>>
>>   if (vcpu_requests) {
>>         if (test_and_reset_bit(KVM_REQ_RESET, &vcpu->requests))      
>>   .... }
>>
>>     
>>> Mmm, I will move this to be after VCPU reset.
>>> If a VCPU is still accessing (write)  devices register, we always
>>> have problem. So move after all the processors enetring frozen state
>>> will be simple and safer. 
>>>
>>> Any opnion? Will post after your new comments.
>>>
>>>
>>>       
>> Sounds good.  But the BSP starts executing immediately, no?
>>     
>
> Yes, BSP will continue. current VCPU=BSP.
>   

It's a vm ioctl, there is no current vcpu!

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


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

  parent reply	other threads:[~2007-10-09 10:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 10:17 kernel device reset support Dong, Eddie
     [not found] ` <10EA09EFD8728347A513008B6B0DA77A0231BB36-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-08 10:24   ` Avi Kivity
     [not found]     ` <470A0556.80903-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-09  1:58       ` Dong, Eddie
     [not found]         ` <10EA09EFD8728347A513008B6B0DA77A0231BD83-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-09  9:34           ` Avi Kivity
     [not found]             ` <470B4B2E.1000500-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-09  9:53               ` Avi Kivity
2007-10-09 10:11               ` Dong, Eddie
     [not found]                 ` <10EA09EFD8728347A513008B6B0DA77A0231C1AA-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-09 10:17                   ` Avi Kivity [this message]
     [not found]                     ` <470B5528.2010605-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-09 10:36                       ` Dong, Eddie
     [not found]                         ` <10EA09EFD8728347A513008B6B0DA77A0231C1B2-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-09 10:55                           ` Avi Kivity
     [not found]                             ` <470B5E3B.4060006-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-10  6:17                               ` Dong, Eddie
     [not found]                                 ` <10EA09EFD8728347A513008B6B0DA77A02364242-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-10 10:23                                   ` Avi Kivity
     [not found]                                     ` <470CA814.9050907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-11  1:32                                       ` Dong, Eddie
     [not found]                                         ` <10EA09EFD8728347A513008B6B0DA77A02364638-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-11  7:24                                           ` Dong, Eddie
2007-10-11 12:11                                           ` Avi Kivity
     [not found]                                             ` <470E130D.6080808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-12  1:07                                               ` Dong, Eddie
     [not found]                                                 ` <10EA09EFD8728347A513008B6B0DA77A02364C43-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-12  6:18                                                   ` Avi Kivity
     [not found]                                                     ` <470F11B9.4050501-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-12  7:17                                                       ` Dong, Eddie
     [not found]                                                         ` <10EA09EFD8728347A513008B6B0DA77A02364F85-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-13  7:16                                                           ` Avi Kivity
     [not found]                                                             ` <471070D8.7030402-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-15  4:40                                                               ` Dong, Eddie
     [not found]                                                                 ` <10EA09EFD8728347A513008B6B0DA77A023A6DFE-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-15  9:10                                                                   ` Avi Kivity
     [not found]                                                                     ` <47132E9D.7030500-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-16  8:44                                                                       ` Dong, Eddie
     [not found]                                                                         ` <10EA09EFD8728347A513008B6B0DA77A023A763C-wq7ZOvIWXbNpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-16 10:25                                                                           ` Avi Kivity
     [not found]                                                                         ` <471491A9. 8040207@qumranet.com>
     [not found]                                                                           ` <471491A9.8040207-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-17  1:40                                                                             ` Dong, Eddie
2007-10-08 10:27   ` 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=470B5528.2010605@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=eddie.dong-ral2JQCrhuEAvxtiuMwx3w@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.