From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/3] KVM: fix apic timer save/migration when inactive Date: Sun, 09 Sep 2007 10:39:10 +0300 Message-ID: <46E3A31E.7060107@qumranet.com> References: <37E52D09333DE2469A03574C88DBF40FA9C20B@pdsmsx414.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1446437008==" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: "He, Qing" Return-path: In-Reply-To: <37E52D09333DE2469A03574C88DBF40FA9C20B-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org --===============1446437008== Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 7bit He, Qing wrote: > >>>> + if (atomic_read(&apic->timer.active)) >>>> >>>> >>> Or here? >>> >>> >>>> + hrtimer_start(timer, timer->expires, >>>> + HRTIMER_MODE_ABS); >>>> } >>>> EXPORT_SYMBOL_GPL(kvm_migrate_apic_timer); >>>> >>>> >>>> >> I think you could use the return value of hrtimer_cancel() here: >> >> if (hrtimer_cancel(...)) >> hrtimer_start(...); >> > > Thanks for commenting, previously I have thought of something like: > if (hrtimer_active(...)) { > hrtimer_cancel(...); > hrtimer_start(...); > } > > But it is not able to handle pending state this way. Seems the return value of hrtimer_cancel is fine. Another question is, when the hrtimer function returns HRTIMER_NORESTART, does the state finally turn to HRTIMER_STATE_INACTIVE? > >>From my reading of the hrtimer code, yes. But I would view any code which depends on the state with suspicion. -- error compiling committee.c: too many arguments to function --===============1446437008== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ --===============1446437008== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============1446437008==--