From: Scott Wood <scottwood@freescale.com>
To: Bharat Bhushan <r65777@freescale.com>
Cc: <kvm-ppc@vger.kernel.org>, <kvm@vger.kernel.org>, <agraf@suse.de>,
Bharat Bhushan <Bharat.Bhushan@freescale.com>
Subject: Re: [PATCH 2/2 v5] KVM: PPC: booke: Add watchdog emulation
Date: Fri, 20 Jul 2012 16:29:08 -0500 [thread overview]
Message-ID: <5009CDA4.3080004@freescale.com> (raw)
In-Reply-To: <1342760428-10858-1-git-send-email-Bharat.Bhushan@freescale.com>
On 07/20/2012 12:00 AM, Bharat Bhushan wrote:
> This patch adds the watchdog emulation in KVM. The watchdog
> emulation is enabled by KVM_ENABLE_CAP(KVM_CAP_PPC_WDT) ioctl.
> The kernel timer are used for watchdog emulation and emulates
> h/w watchdog state machine. On watchdog timer expiry, it exit to QEMU
> if TCR.WRC is non ZERO. QEMU can reset/shutdown etc depending upon how
> it is configured.
>
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> [bharat.bhushan@freescale.com: reworked patch]
Typically the [] note goes immediately before your signoff (but after
the others).
> +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.
> @@ -386,13 +387,23 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
> #ifdef CONFIG_KVM_EXIT_TIMING
> mutex_init(&vcpu->arch.exit_timing_lock);
> #endif
> -
> +#ifdef CONFIG_BOOKE
> + spin_lock_init(&vcpu->arch.wdt_lock);
> + /* setup watchdog timer once */
> + setup_timer(&vcpu->arch.wdt_timer, kvmppc_watchdog_func,
> + (unsigned long)vcpu);
> +#endif
> return 0;
> }
Can you do this in kvmppc_booke_init()?
>
> void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
> {
> kvmppc_mmu_destroy(vcpu);
> +#ifdef CONFIG_BOOKE
> + spin_lock(&vcpu->arch.wdt_lock);
> + del_timer(&vcpu->arch.wdt_timer);
> + spin_unlock(&vcpu->arch.wdt_lock);
> +#endif
> }
Don't acquire the lock here, but use del_timer_sync().
-Scott
next prev parent reply other threads:[~2012-07-20 21:29 UTC|newest]
Thread overview: 15+ 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 21:29 ` Scott Wood [this message]
2012-07-21 8:37 ` Bhushan Bharat-R65777
2012-07-23 15:35 ` Scott Wood
2012-07-23 4:10 ` Bhushan Bharat-R65777
2012-07-23 15:32 ` Scott Wood
2012-07-23 15:43 ` Bhushan Bharat-R65777
2012-07-23 16:00 ` Scott Wood
2012-07-23 16:04 ` Bhushan Bharat-R65777
2012-07-23 16:30 ` Scott Wood
2012-07-24 7:45 ` Bhushan Bharat-R65777
2012-07-24 22:32 ` Scott Wood
2012-07-25 20:37 ` Marcelo Tosatti
2012-07-25 23:55 ` Scott Wood
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=5009CDA4.3080004@freescale.com \
--to=scottwood@freescale.com \
--cc=Bharat.Bhushan@freescale.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=r65777@freescale.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).