From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 36/37] KVM: PPC: booke: expose guest registers on irq reinject
Date: Mon, 27 Feb 2012 13:45:39 -0600 [thread overview]
Message-ID: <4F4BDD63.4020801@freescale.com> (raw)
In-Reply-To: <810950A7-CD5A-46A5-865B-1209A5532DCC@suse.de>
On 02/26/2012 05:59 AM, Alexander Graf wrote:
>
> On 25.02.2012, at 00:40, Scott Wood wrote:
>
>> On 02/24/2012 08:26 AM, Alexander Graf wrote:
>>> +static void kvmppc_fill_pt_regs(struct kvm_vcpu *vcpu, struct pt_regs *regs)
>>> {
>>> - int r = RESUME_HOST;
>>> + int i;
>>>
>>> - /* update before a new last_exit_type is rewritten */
>>> - kvmppc_update_timing_stats(vcpu);
>>> + for (i = 0; i < 32; i++)
>>> + regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
>>> + regs->nip = vcpu->arch.pc;
>>> + regs->msr = vcpu->arch.shared->msr;
>>> + regs->ctr = vcpu->arch.ctr;
>>> + regs->link = vcpu->arch.lr;
>>> + regs->xer = kvmppc_get_xer(vcpu);
>>> + regs->ccr = kvmppc_get_cr(vcpu);
>>> + regs->dar = get_guest_dear(vcpu);
>>> + regs->dsisr = get_guest_esr(vcpu);
>>> +}
>>
>> How much overhead does this add to every interrupt? Can't we keep this
>> to the minimum that perf cares about?
>
> I would rather not make assumptions on what perf cares about - maybe we want to one day implement "perf kvm" and then perf could rely on pretty much anything in there.
In that case I think we should be populating a real pt_regs from the
start, as in my original patchset.
I only agreed to take it out because I thought the set of things we'd
copy would be minimal. This seems like a lot of overhead.
I'm not familiar with "perf kvm", but if it's kvm-specific surely the
KVM code should know/dictate what it can rely on? Or maybe there can be
a debug option that enables full pt_regs (similar to exit timing)?
Could we just set regs to NULL when the debug option isn't enabled?
>>> +static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>> + unsigned int exit_nr)
>>> +{
>>> + struct pt_regs regs = *current->thread.regs;
>>>
>>> + kvmppc_fill_pt_regs(vcpu, ®s);
>>
>> Why are you copying out of current->thread.regs? That's old junk data,
>> set by some previous exception and possibly overwritten since.
>
> Because it gives us good default values for anything we don't set. Do you have other recommendations?
It does not give good default values for anything. It is junk,
unallocated memory, overwritten by who knows what. Same as the memory
you're copying to.
To avoid garbage in fields we don't set, fill it with zeroes first.
-Scott
next prev parent reply other threads:[~2012-02-27 19:45 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 14:25 [PATCH 00/37] KVM: PPC: e500mc support v2 Alexander Graf
2012-02-24 14:25 ` [PATCH 01/37] powerpc/booke: Set CPU_FTR_DEBUG_LVL_EXC on 32-bit Alexander Graf
2012-02-24 14:25 ` [PATCH 02/37] powerpc/e500: split CPU_FTRS_ALWAYS/CPU_FTRS_POSSIBLE Alexander Graf
2012-02-24 14:25 ` [PATCH 03/37] KVM: PPC: factor out lpid allocator from book3s_64_mmu_hv Alexander Graf
2012-02-24 14:25 ` [PATCH 04/37] KVM: PPC: booke: add booke-level vcpu load/put Alexander Graf
2012-02-24 14:25 ` [PATCH 05/37] KVM: PPC: booke: Move vm core init/destroy out of booke.c Alexander Graf
2012-02-24 14:26 ` [PATCH 06/37] KVM: PPC: e500: rename e500_tlb.h to e500.h Alexander Graf
2012-02-24 14:26 ` [PATCH 07/37] KVM: PPC: e500: merge <asm/kvm_e500.h> into arch/powerpc/kvm/e500.h Alexander Graf
2012-02-24 14:26 ` [PATCH 08/37] KVM: PPC: e500: clean up arch/powerpc/kvm/e500.h Alexander Graf
2012-02-24 14:26 ` [PATCH 09/37] KVM: PPC: e500: refactor core-specific TLB code Alexander Graf
2012-02-24 14:26 ` [PATCH 10/37] KVM: PPC: e500: Track TLB1 entries with a bitmap Alexander Graf
2012-02-24 14:26 ` [PATCH 11/37] KVM: PPC: e500: emulate tlbilx Alexander Graf
2012-02-24 14:26 ` [PATCH 12/37] powerpc/booke: Provide exception macros with interrupt name Alexander Graf
2012-02-24 14:26 ` [PATCH 13/37] KVM: PPC: booke: category E.HV (GS-mode) support Alexander Graf
2012-02-24 14:26 ` [PATCH 14/37] KVM: PPC: booke: standard PPC floating point support Alexander Graf
2012-02-24 14:26 ` [PATCH 15/37] KVM: PPC: e500mc support Alexander Graf
2012-02-24 14:26 ` [PATCH 16/37] KVM: PPC: e500mc: Add doorbell emulation support Alexander Graf
2012-02-24 14:26 ` [PATCH 17/37] KVM: PPC: e500mc: implicitly set MSR_GS Alexander Graf
2012-02-24 14:26 ` [PATCH 18/37] KVM: PPC: e500mc: Move r1/r2 restoration very early Alexander Graf
2012-02-24 14:26 ` [PATCH 19/37] KVM: PPC: e500mc: add load inst fixup Alexander Graf
2012-02-24 14:26 ` [PATCH 20/37] KVM: PPC: rename CONFIG_KVM_E500 -> CONFIG_KVM_E500V2 Alexander Graf
2012-02-24 14:26 ` [PATCH 21/37] KVM: PPC: make e500v2 kvm and e500mc cpu mutually exclusive Alexander Graf
2012-02-24 14:26 ` [PATCH 22/37] KVM: PPC: booke: remove leftover debugging Alexander Graf
2012-02-24 14:26 ` [PATCH 23/37] KVM: PPC: booke: deliver program int on emulation failure Alexander Graf
2012-02-24 14:26 ` [PATCH 24/37] KVM: PPC: booke: rework rescheduling checks Alexander Graf
2012-02-27 16:34 ` Bhushan Bharat-R65777
2012-02-27 17:33 ` Alexander Graf
2012-02-27 18:23 ` Alexander Graf
2012-02-27 18:29 ` Bhushan Bharat-R65777
2012-02-27 19:28 ` Scott Wood
2012-02-28 11:03 ` Alexander Graf
2012-02-28 17:21 ` Scott Wood
2012-02-24 14:26 ` [PATCH 25/37] KVM: PPC: booke: BOOKE_IRQPRIO_MAX is n+1 Alexander Graf
2012-02-24 14:26 ` [PATCH 26/37] KVM: PPC: bookehv: fix exit timing Alexander Graf
2012-02-24 14:26 ` [PATCH 27/37] KVM: PPC: bookehv: remove negation for CONFIG_64BIT Alexander Graf
2012-02-24 14:26 ` [PATCH 28/37] KVM: PPC: bookehv: remove SET_VCPU Alexander Graf
2012-02-24 14:26 ` [PATCH 29/37] KVM: PPC: bookehv: disable MAS register updates early Alexander Graf
2012-02-24 14:26 ` [PATCH 30/37] KVM: PPC: bookehv: add comment about shadow_msr Alexander Graf
2012-02-24 14:26 ` [PATCH 31/37] KVM: PPC: booke: Readd debug abort code for machine check Alexander Graf
2012-02-24 14:26 ` [PATCH 32/37] KVM: PPC: booke: add GS documentation for program interrupt Alexander Graf
2012-02-24 14:26 ` [PATCH 33/37] KVM: PPC: bookehv: remove unused code Alexander Graf
2012-02-24 23:31 ` Scott Wood
2012-02-24 14:26 ` [PATCH 34/37] KVM: PPC: e500: fix typo in tlb code Alexander Graf
2012-02-24 14:26 ` [PATCH 35/37] KVM: PPC: booke: Support perfmon interrupts Alexander Graf
2012-02-24 23:33 ` Scott Wood
2012-02-26 11:58 ` Alexander Graf
2012-02-24 14:26 ` [PATCH 36/37] KVM: PPC: booke: expose guest registers on irq reinject Alexander Graf
2012-02-24 23:40 ` Scott Wood
2012-02-26 11:59 ` Alexander Graf
2012-02-27 19:45 ` Scott Wood [this message]
2012-02-24 14:26 ` [PATCH 37/37] KVM: PPC: booke: Reinject performance monitor interrupts Alexander Graf
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=4F4BDD63.4020801@freescale.com \
--to=scottwood@freescale.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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 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).