kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm: fix MMIO/PIO collision misdetection
Date: Sun, 7 Apr 2013 14:54:07 +0300	[thread overview]
Message-ID: <20130407115407.GS17919@redhat.com> (raw)
In-Reply-To: <20130404102720.GA5707@redhat.com>

On Thu, Apr 04, 2013 at 01:27:21PM +0300, Michael S. Tsirkin wrote:
> PIO and MMIO are separate address spaces, but
> ioeventfd registration code mistakenly detected
> two eventfds as duplicate if they use the same address,
> even if one is PIO and another one MMIO.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Applied, thanks.

> ---
>  virt/kvm/eventfd.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> index adb17f2..93e5b05 100644
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
> @@ -577,6 +577,7 @@ struct _ioeventfd {
>  	struct eventfd_ctx  *eventfd;
>  	u64                  datamatch;
>  	struct kvm_io_device dev;
> +	u8                   bus_idx;
>  	bool                 wildcard;
>  };
>  
> @@ -669,7 +670,8 @@ ioeventfd_check_collision(struct kvm *kvm, struct _ioeventfd *p)
>  	struct _ioeventfd *_p;
>  
>  	list_for_each_entry(_p, &kvm->ioeventfds, list)
> -		if (_p->addr == p->addr && _p->length == p->length &&
> +		if (_p->bus_idx == p->bus_idx &&
> +		    _p->addr == p->addr && _p->length == p->length &&
>  		    (_p->wildcard || p->wildcard ||
>  		     _p->datamatch == p->datamatch))
>  			return true;
> @@ -717,6 +719,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
>  
>  	INIT_LIST_HEAD(&p->list);
>  	p->addr    = args->addr;
> +	p->bus_idx = bus_idx;
>  	p->length  = args->len;
>  	p->eventfd = eventfd;
>  
> @@ -775,7 +778,8 @@ kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
>  	list_for_each_entry_safe(p, tmp, &kvm->ioeventfds, list) {
>  		bool wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
>  
> -		if (p->eventfd != eventfd  ||
> +		if (p->bus_idx != bus_idx ||
> +		    p->eventfd != eventfd  ||
>  		    p->addr != args->addr  ||
>  		    p->length != args->len ||
>  		    p->wildcard != wildcard)
> -- 
> MST

--
			Gleb.

      parent reply	other threads:[~2013-04-07 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 10:27 [PATCH] kvm: fix MMIO/PIO collision misdetection Michael S. Tsirkin
2013-04-05  7:58 ` Paolo Bonzini
2013-04-07 11:54 ` Gleb Natapov [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=20130407115407.GS17919@redhat.com \
    --to=gleb@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=sasha.levin@oracle.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).