From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Subject: Re: [PATCH 2/2 v5] KVM: PPC: booke: Add watchdog emulation Date: Mon, 23 Jul 2012 10:35:01 -0500 Message-ID: <500D6F25.2090709@freescale.com> References: <1342760428-10858-1-git-send-email-Bharat.Bhushan@freescale.com> <5009CDA4.3080004@freescale.com> <6A3DF150A5B70D4F9B66A25E3F7C888D03DD3D95@039-SN2MPN1-023.039d.mgd.msft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Wood Scott-B07421 , "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" , "agraf@suse.de" To: Bhushan Bharat-R65777 Return-path: Received: from co1ehsobe002.messaging.microsoft.com ([216.32.180.185]:4745 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753599Ab2GWPfG (ORCPT ); Mon, 23 Jul 2012 11:35:06 -0400 In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D03DD3D95@039-SN2MPN1-023.039d.mgd.msft.net> Sender: kvm-owner@vger.kernel.org List-ID: On 07/21/2012 03:37 AM, Bhushan Bharat-R65777 wrote: > > >> -----Original Message----- >> From: Wood Scott-B07421 >> Sent: Saturday, July 21, 2012 2:59 AM >> To: Bhushan Bharat-R65777 >> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; agraf@suse.de; Bhushan Bharat- >> R65777 >> Subject: Re: [PATCH 2/2 v5] KVM: PPC: booke: Add watchdog emulation >> >> On 07/20/2012 12:00 AM, Bharat Bhushan wrote: >>> +static void arm_next_watchdog(struct kvm_vcpu *vcpu) { >>> + unsigned long nr_jiffies; >>> + >>> + spin_lock(&vcpu->arch.wdt_lock); >>> + nr_jiffies = watchdog_next_timeout(vcpu); >>> + /* >>> + * If the number of jiffies of watchdog timer >= NEXT_TIMER_MAX_DELTA >>> + * then do not run the watchdog timer as this can break timer APIs. >>> + */ >>> + if (nr_jiffies < NEXT_TIMER_MAX_DELTA) >>> + mod_timer(&vcpu->arch.wdt_timer, jiffies + nr_jiffies); >>> + else >>> + del_timer(&vcpu->arch.wdt_timer); >>> + spin_unlock(&vcpu->arch.wdt_lock); >>> +} >> >> This needs to be an irqsave lock. > > Ok, I want to understood why irqsave lock should be used here? > > irqsave_lock is used when the critical section within lock can be > referenced from interrupt context also. What part of critical section > above can get affected from local irq? Is it jiffies here? This can be called from the watchdog timer. Timers run in interrupt context. -Scott