kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: <kvm-ppc@vger.kernel.org>, KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH 8/8] KVM: PPC: Add cache flush on page map
Date: Tue, 7 Aug 2012 16:01:21 -0500	[thread overview]
Message-ID: <50218221.1000609@freescale.com> (raw)
In-Reply-To: <1344337036-22244-9-git-send-email-agraf@suse.de>

On 08/07/2012 05:57 AM, Alexander Graf wrote:
> When we map a page that wasn't icache cleared before, do so when first
> mapping it in KVM using the same information bits as the Linux mapping
> logic. That way we are 100% sure that any page we map does not have stale
> entries in the icache.
> 
> What we really would need is a method to flush the icache only when we
> actually map a page executable for the guest. But with the current
> abstraction that is hard to do, and this way we don't have a huge performance
> penalty, so better be safe now and micro optimize things later.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/powerpc/include/asm/kvm_host.h |   10 ++++++++++
>  arch/powerpc/mm/mem.c               |    1 +
>  2 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index ed75bc9..c0a2fc1 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -33,6 +33,7 @@
>  #include <asm/kvm_asm.h>
>  #include <asm/processor.h>
>  #include <asm/page.h>
> +#include <asm/cacheflush.h>
>  
>  #define KVM_MAX_VCPUS		NR_CPUS
>  #define KVM_MAX_VCORES		NR_CPUS
> @@ -550,5 +551,14 @@ struct kvm_vcpu_arch {
>  #define KVM_MMIO_REG_FQPR	0x0060
>  
>  #define __KVM_HAVE_ARCH_WQP
> +#define __KVM_HAVE_ARCH_MAP_PAGE
> +static inline void kvm_arch_map_page(struct page *page)
> +{
> +	/* Need to invalidate the icache for new pages */
> +	if (!test_bit(PG_arch_1, &page->flags)) {
> +		flush_dcache_icache_page(page);
> +		set_bit(PG_arch_1, &page->flags);
> +	}
> +}

Shouldn't this test CPU_FTR_COHERENT_ICACHE?

-Scott

  reply	other threads:[~2012-08-07 21:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 10:57 [PATCH 0/8] KVM: PPC: E500: Implement MMU Notifiers Alexander Graf
2012-08-07 10:57 ` [PATCH 1/8] KVM: PPC: BookE: Expose remote TLB flushes in debugfs Alexander Graf
2012-08-07 10:57 ` [PATCH 2/8] KVM: PPC: E500: Fix clear_tlb_refs Alexander Graf
2012-08-07 10:57 ` [PATCH 3/8] KVM: PPC: PR: Use generic tracepoint for guest exit Alexander Graf
2012-08-07 10:57 ` [PATCH 4/8] KVM: PPC: Expose SYNC cap based on mmu notifiers Alexander Graf
2012-08-07 10:57 ` [PATCH 5/8] KVM: Add hva_to_memslot Alexander Graf
2012-08-08  4:55   ` [kvmarm] " Christoffer Dall
2012-08-08 17:30     ` Alexander Graf
2012-08-09 10:34   ` Takuya Yoshikawa
2012-08-09 10:36     ` Avi Kivity
2012-08-09 17:02       ` Alexander Graf
2012-08-12  9:24         ` Avi Kivity
2012-08-12 11:03           ` Alexander Graf
2012-08-12 11:21             ` Avi Kivity
2012-08-12 12:47               ` Alexander Graf
2012-08-07 10:57 ` [PATCH 6/8] KVM: PPC: E500: Implement MMU notifiers Alexander Graf
2012-08-07 13:30   ` Avi Kivity
2012-08-07 13:52     ` Alexander Graf
2012-08-07 14:14       ` Avi Kivity
2012-08-07 14:24         ` Alexander Graf
2012-08-08  3:31   ` Paul Mackerras
2012-08-08  8:03     ` Alexander Graf
2012-08-07 10:57 ` [PATCH 7/8] KVM: Add page map arch callback Alexander Graf
2012-08-07 13:32   ` Avi Kivity
2012-08-07 13:44     ` Alexander Graf
2012-08-07 13:58       ` Avi Kivity
2012-08-07 14:08         ` Alexander Graf
2012-08-07 14:10           ` Avi Kivity
2012-08-07 14:14             ` Alexander Graf
2012-08-07 14:20               ` Avi Kivity
2012-08-07 14:24                 ` Alexander Graf
2012-08-07 14:31                   ` Avi Kivity
2012-08-07 10:57 ` [PATCH 8/8] KVM: PPC: Add cache flush on page map Alexander Graf
2012-08-07 21:01   ` Scott Wood [this message]
2012-08-08  7:59     ` Alexander Graf
2012-08-08 17:31 ` [PATCH 0/8] KVM: PPC: E500: Implement MMU Notifiers 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=50218221.1000609@freescale.com \
    --to=scottwood@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 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).