From: Scott Wood <scottwood@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: paravirt: Avoid patching paravirt template
Date: Mon, 28 Nov 2011 17:32:02 +0000 [thread overview]
Message-ID: <4ED3C592.8070907@freescale.com> (raw)
In-Reply-To: <1322042732-10285-1-git-send-email-yu.liu@freescale.com>
On 11/23/2011 04:05 AM, Liu Yu wrote:
> Currently we patch the whole code include paravirt template code.
> This doesn't lead into issue for now,
> but it makes some previlege instructions branch to paravirt code twice.
Ouch. This will do bad things to the scratch area.
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> arch/powerpc/kernel/kvm.c | 17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index 3953fbd..485748c 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -171,6 +171,10 @@ static void kvm_patch_ins_mtmsrd(u32 *inst, u32 rt)
> if (!p)
> return;
>
> + if ((inst > kvm_emulate_mtmsrd) &&
> + (inst < kvm_emulate_mtmsrd + kvm_emulate_mtmsrd_len))
> + return;
> +
> /* Find out where we are and put everything there */
> distance_start = (ulong)p - (ulong)inst;
> next_inst = ((ulong)inst + 4);
> @@ -220,6 +224,11 @@ static void kvm_patch_ins_mtmsr(u32 *inst, u32 rt)
> int distance_end;
> ulong next_inst;
>
> + if ((inst > kvm_emulate_mtmsr) &&
> + (inst < kvm_emulate_mtmsr + kvm_emulate_mtmsr_len))
> + return;
> +
> +
> p = kvm_alloc(kvm_emulate_mtmsr_len * 4);
> if (!p)
> return;
> @@ -281,6 +290,10 @@ static void kvm_patch_ins_wrtee(u32 *inst, u32 rt, int imm_one)
> int distance_end;
> ulong next_inst;
>
> + if ((inst > kvm_emulate_wrtee) &&
> + (inst < kvm_emulate_wrtee + kvm_emulate_wrtee_len))
> + return;
> +
> p = kvm_alloc(kvm_emulate_wrtee_len * 4);
> if (!p)
> return;
> @@ -338,6 +351,10 @@ static void kvm_patch_ins_wrteei_0(u32 *inst)
> int distance_end;
> ulong next_inst;
>
> + if ((inst > kvm_emulate_wrteei_0) &&
> + (inst < kvm_emulate_wrteei_0 + kvm_emulate_wrteei_0_len))
> + return;
> +
> p = kvm_alloc(kvm_emulate_wrteei_0_len * 4);
> if (!p)
> return;
Instead of excluding only the template code for the instruction type
being patched, we should exclude the entire template region in the main
loop.
-Scott
prev parent reply other threads:[~2011-11-28 17:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 10:05 [PATCH] KVM: PPC: paravirt: Avoid patching paravirt template code Liu Yu
2011-11-28 17:32 ` Scott Wood [this message]
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=4ED3C592.8070907@freescale.com \
--to=scottwood@freescale.com \
--cc=kvm-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox