From: Scott Wood <scottwood@freescale.com>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"agraf@suse.de" <agraf@suse.de>
Subject: Re: [PATCH 2/2 v5] KVM: PPC: booke: Add watchdog emulation
Date: Mon, 23 Jul 2012 15:35:01 +0000 [thread overview]
Message-ID: <500D6F25.2090709@freescale.com> (raw)
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D03DD3D95@039-SN2MPN1-023.039d.mgd.msft.net>
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
WARNING: multiple messages have this Message-ID (diff)
From: Scott Wood <scottwood@freescale.com>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"agraf@suse.de" <agraf@suse.de>
Subject: Re: [PATCH 2/2 v5] KVM: PPC: booke: Add watchdog emulation
Date: Mon, 23 Jul 2012 10:35:01 -0500 [thread overview]
Message-ID: <500D6F25.2090709@freescale.com> (raw)
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D03DD3D95@039-SN2MPN1-023.039d.mgd.msft.net>
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
next prev parent reply other threads:[~2012-07-23 15:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 5:00 [PATCH 2/2 v5] KVM: PPC: booke: Add watchdog emulation Bharat Bhushan
2012-07-20 5:12 ` Bharat Bhushan
2012-07-20 21:29 ` Scott Wood
2012-07-20 21:29 ` Scott Wood
2012-07-21 8:37 ` Bhushan Bharat-R65777
2012-07-21 8:37 ` Bhushan Bharat-R65777
2012-07-23 15:35 ` Scott Wood [this message]
2012-07-23 15:35 ` Scott Wood
2012-07-23 4:10 ` Bhushan Bharat-R65777
2012-07-23 4:10 ` Bhushan Bharat-R65777
2012-07-23 15:32 ` Scott Wood
2012-07-23 15:32 ` Scott Wood
2012-07-23 15:43 ` Bhushan Bharat-R65777
2012-07-23 15:43 ` Bhushan Bharat-R65777
2012-07-23 16:00 ` Scott Wood
2012-07-23 16:00 ` Scott Wood
2012-07-23 16:04 ` Bhushan Bharat-R65777
2012-07-23 16:04 ` Bhushan Bharat-R65777
2012-07-23 16:30 ` Scott Wood
2012-07-23 16:30 ` Scott Wood
2012-07-24 7:45 ` Bhushan Bharat-R65777
2012-07-24 7:45 ` Bhushan Bharat-R65777
2012-07-24 22:32 ` Scott Wood
2012-07-24 22:32 ` Scott Wood
2012-07-25 20:37 ` Marcelo Tosatti
2012-07-25 20:37 ` Marcelo Tosatti
2012-07-25 23:55 ` Scott Wood
2012-07-25 23:55 ` Scott Wood
2012-07-26 0:46 ` Marcelo Tosatti
2012-07-26 0:46 ` Marcelo Tosatti
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=500D6F25.2090709@freescale.com \
--to=scottwood@freescale.com \
--cc=B07421@freescale.com \
--cc=R65777@freescale.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.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.