All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anup Patel <anup@brainfault.org>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: "kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	KVM General <kvm@vger.kernel.org>, patches <patches@apm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Subject: Re: [RFC PATCH 0/6] ARM64: KVM: PMU infrastructure support
Date: Tue, 11 Nov 2014 14:48:25 +0530	[thread overview]
Message-ID: <CAAhSdy3iyMpXLh1Qq-TqZ-1W368kG0Oz9iE2McnJkYbA9ZaNPg@mail.gmail.com> (raw)
In-Reply-To: <CAMJs5B8VqS2-3dhSX+PBaQruzyXiYwaYRQ7vvWEMrHbvbjn+9A@mail.gmail.com>

Hi All,

I have second thoughts about rebasing KVM PMU patches
to Marc's irq-forwarding patches.

The PMU IRQs (when virtualized by KVM) are not exactly
forwarded IRQs because they are shared between Host
and Guest.

Scenario1
-------------

We might have perf running on Host and no KVM guest
running. In this scenario, we wont get interrupts on Host
because the kvm_pmu_hyp_init() (similar to the function
kvm_timer_hyp_init() of Marc's IRQ-forwarding
implementation) has put all host PMU IRQs in forwarding
mode.

The only way solve this problem is to not set forwarding
mode for PMU IRQs in kvm_pmu_hyp_init() and instead
have special routines to turn on and turn off the forwarding
mode of PMU IRQs. These routines will be called from
kvm_arch_vcpu_ioctl_run() for toggling the PMU IRQ
forwarding state.

Scenario2
-------------

We might have perf running on Host and Guest simultaneously
which means it is quite likely that PMU HW trigger IRQ meant
for Host between "ret = kvm_call_hyp(__kvm_vcpu_run, vcpu);"
and "kvm_pmu_sync_hwstate(vcpu);" (similar to timer sync routine
of Marc's patchset which is called before local_irq_enable()).

In this scenario, the updated kvm_pmu_sync_hwstate(vcpu)
will accidentally forward IRQ meant for Host to Guest unless
we put additional checks to inspect VCPU PMU state.

Am I missing any detail about IRQ forwarding for above
scenarios?

If not then can we consider current mask/unmask approach
for forwarding PMU IRQs?

Marc?? Will??

Regards,
Anup

WARNING: multiple messages have this Message-ID (diff)
From: anup@brainfault.org (Anup Patel)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/6] ARM64: KVM: PMU infrastructure support
Date: Tue, 11 Nov 2014 14:48:25 +0530	[thread overview]
Message-ID: <CAAhSdy3iyMpXLh1Qq-TqZ-1W368kG0Oz9iE2McnJkYbA9ZaNPg@mail.gmail.com> (raw)
In-Reply-To: <CAMJs5B8VqS2-3dhSX+PBaQruzyXiYwaYRQ7vvWEMrHbvbjn+9A@mail.gmail.com>

Hi All,

I have second thoughts about rebasing KVM PMU patches
to Marc's irq-forwarding patches.

The PMU IRQs (when virtualized by KVM) are not exactly
forwarded IRQs because they are shared between Host
and Guest.

Scenario1
-------------

We might have perf running on Host and no KVM guest
running. In this scenario, we wont get interrupts on Host
because the kvm_pmu_hyp_init() (similar to the function
kvm_timer_hyp_init() of Marc's IRQ-forwarding
implementation) has put all host PMU IRQs in forwarding
mode.

The only way solve this problem is to not set forwarding
mode for PMU IRQs in kvm_pmu_hyp_init() and instead
have special routines to turn on and turn off the forwarding
mode of PMU IRQs. These routines will be called from
kvm_arch_vcpu_ioctl_run() for toggling the PMU IRQ
forwarding state.

Scenario2
-------------

We might have perf running on Host and Guest simultaneously
which means it is quite likely that PMU HW trigger IRQ meant
for Host between "ret = kvm_call_hyp(__kvm_vcpu_run, vcpu);"
and "kvm_pmu_sync_hwstate(vcpu);" (similar to timer sync routine
of Marc's patchset which is called before local_irq_enable()).

In this scenario, the updated kvm_pmu_sync_hwstate(vcpu)
will accidentally forward IRQ meant for Host to Guest unless
we put additional checks to inspect VCPU PMU state.

Am I missing any detail about IRQ forwarding for above
scenarios?

If not then can we consider current mask/unmask approach
for forwarding PMU IRQs?

Marc?? Will??

Regards,
Anup

  reply	other threads:[~2014-11-11  9:18 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05  9:24 [RFC PATCH 0/6] ARM64: KVM: PMU infrastructure support Anup Patel
2014-08-05  9:24 ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 1/6] ARM64: Move PMU register related defines to asm/pmu.h Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 2/6] ARM64: perf: Re-enable overflow interrupt from interrupt handler Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-06 14:24   ` Will Deacon
2014-08-06 14:24     ` Will Deacon
2014-08-07  9:03     ` Anup Patel
2014-08-07  9:03       ` Anup Patel
2014-08-07  9:06       ` Will Deacon
2014-08-07  9:06         ` Will Deacon
2014-08-05  9:24 ` [RFC PATCH 3/6] ARM: " Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 4/6] ARM/ARM64: KVM: Add common code PMU IRQ routing Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 5/6] ARM64: KVM: Implement full context switch of PMU registers Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:24 ` [RFC PATCH 6/6] ARM64: KVM: Upgrade to lazy " Anup Patel
2014-08-05  9:24   ` Anup Patel
2014-08-05  9:32 ` [RFC PATCH 0/6] ARM64: KVM: PMU infrastructure support Anup Patel
2014-08-05  9:32   ` Anup Patel
2014-08-05  9:35   ` Anup Patel
2014-08-05  9:35     ` Anup Patel
2014-11-07 20:23 ` Christoffer Dall
2014-11-07 20:23   ` Christoffer Dall
2014-11-07 20:25 ` Christoffer Dall
2014-11-07 20:25   ` Christoffer Dall
2014-11-08  9:36   ` Anup Patel
2014-11-08  9:36     ` Anup Patel
2014-11-08 12:39     ` Christoffer Dall
2014-11-08 12:39       ` Christoffer Dall
2014-11-11  9:18       ` Anup Patel [this message]
2014-11-11  9:18         ` Anup Patel
2014-11-18  3:24         ` Anup Patel
2014-11-18  3:24           ` Anup Patel
2014-11-19 15:29         ` Christoffer Dall
2014-11-19 15:29           ` Christoffer Dall
2014-11-20 14:47           ` Anup Patel
2014-11-20 14:47             ` Anup Patel
2014-11-21  9:59             ` Christoffer Dall
2014-11-21  9:59               ` Christoffer Dall
2014-11-21 10:36               ` Anup Patel
2014-11-21 10:36                 ` Anup Patel
2014-11-21 11:49                 ` Christoffer Dall
2014-11-21 11:49                   ` Christoffer Dall
2014-11-24  8:44                   ` Anup Patel
2014-11-24  8:44                     ` Anup Patel
2014-11-24 14:37                     ` Christoffer Dall
2014-11-24 14:37                       ` Christoffer Dall
2014-11-25 12:47                       ` Anup Patel
2014-11-25 12:47                         ` Anup Patel
2014-11-25 13:42                         ` Christoffer Dall
2014-11-25 13:42                           ` Christoffer Dall
2014-11-27 10:22                           ` Anup Patel
2014-11-27 10:22                             ` Anup Patel
2014-11-27 10:40                             ` Marc Zyngier
2014-11-27 10:40                               ` Marc Zyngier
2014-11-27 10:54                               ` Anup Patel
2014-11-27 10:54                                 ` Anup Patel
2014-11-27 11:06                                 ` Marc Zyngier
2014-11-27 11:06                                   ` Marc Zyngier
2014-12-30  5:49                                   ` Anup Patel
2014-12-30  5:49                                     ` Anup Patel
2015-01-08  4:02                                     ` Anup Patel
2015-01-08  4:02                                       ` Anup Patel
2015-01-11 19:11                                     ` Christoffer Dall
2015-01-11 19:11                                       ` Christoffer Dall
2015-01-12  4:19                                       ` Anup Patel
2015-01-12  4:19                                         ` Anup Patel
2015-02-15 15:33                                         ` Christoffer Dall
2015-02-15 15:33                                           ` Christoffer Dall
2015-02-16 12:16                                           ` Anup Patel
2015-02-16 12:16                                             ` Anup Patel
2015-02-16 12:23                                             ` Christoffer Dall
2015-02-16 12:23                                               ` Christoffer Dall
2015-01-14  4:28                                       ` Anup Patel
2015-01-14  4:28                                         ` Anup Patel

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=CAAhSdy3iyMpXLh1Qq-TqZ-1W368kG0Oz9iE2McnJkYbA9ZaNPg@mail.gmail.com \
    --to=anup@brainfault.org \
    --cc=christoffer.dall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=patches@apm.com \
    --cc=pranavkumar@linaro.org \
    --cc=will.deacon@arm.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 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.