linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/2] KVM: X86: remove read buffer for mmio read
Date: Mon, 09 Jul 2012 14:15:37 +0300	[thread overview]
Message-ID: <4FFABD59.2070108@redhat.com> (raw)
In-Reply-To: <4FFA9E16.10001@linux.vnet.ibm.com>

On 07/09/2012 12:02 PM, Xiao Guangrong wrote:
> After commit f78146b0f9230765c6315b2e14f56112513389ad:
> 
>  KVM: Fix page-crossing MMIO
> 
>     MMIO that are split across a page boundary are currently broken - the
>     code does not expect to be aborted by the exit to userspace for the
>     first MMIO fragment.
> 
>     This patch fixes the problem by generalizing the current code for handling
>     16-byte MMIOs to handle a number of "fragments", and changes the MMIO
>     code to create those fragments.
> 
>     Signed-off-by: Avi Kivity <avi@redhat.com>
>     Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> Multiple MMIO reads can be merged into mmio_fragments, the read buffer is not
> needed anymore
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
> ---
>  arch/x86/include/asm/kvm_emulate.h |    1 -
>  arch/x86/kvm/emulate.c             |   43 ++++-------------------------------
>  arch/x86/kvm/x86.c                 |    2 -
>  3 files changed, 5 insertions(+), 41 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
> index 1ac46c22..339d7c6 100644
> --- a/arch/x86/include/asm/kvm_emulate.h
> +++ b/arch/x86/include/asm/kvm_emulate.h
> @@ -286,7 +286,6 @@ struct x86_emulate_ctxt {
>  	struct operand *memopp;
>  	struct fetch_cache fetch;
>  	struct read_cache io_read;
> -	struct read_cache mem_read;
>  };
> 

Suppose we have a RMW instruction.  On the first entry to
x86_emulate_insn() we'll drop to userspace and perform the read, and the
seconds we'll read from the cache and complete the write.

Without the read cache this cannot work.

kvm-unit-tests.git has a test for xchg to mmio.  Does it still work?

I agree this code has to go, but it needs to be replaced by something.
Maybe a .valid flag in struct operand.

-- 
error compiling committee.c: too many arguments to function



  parent reply	other threads:[~2012-07-09 11:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09  9:02 [PATCH 1/2] KVM: X86: remove read buffer for mmio read Xiao Guangrong
2012-07-09  9:03 ` [PATCH 2/2] KVM: X86: introduce set_mmio_exit_info Xiao Guangrong
2012-07-09 11:15 ` Avi Kivity [this message]
2012-07-09 11:23   ` [PATCH 1/2] KVM: X86: remove read buffer for mmio read Gleb Natapov
2012-07-09 12:48     ` Avi Kivity
2012-07-09 12:49     ` Avi Kivity
2012-07-09 13:23       ` Xiao Guangrong
2012-07-09 13:26         ` Gleb Natapov
2012-07-09 13:34         ` Avi Kivity
2012-07-10 10:36           ` Gleb Natapov
2012-07-10 10:45             ` Avi Kivity
2012-07-10 10:48               ` Gleb Natapov
2012-07-10 12:50                 ` Avi Kivity
2012-07-10 13:01                   ` Gleb Natapov
2012-07-10 16:04                     ` Avi Kivity
2012-07-09 13:26       ` Gleb Natapov

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=4FFABD59.2070108@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=xiaoguangrong@linux.vnet.ibm.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).