From: Marcelo Tosatti <mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Greg Edwards <gedwards-LfVdkaOWEx8@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] KVM: IOMMU: hva align mapping page size
Date: Mon, 4 Nov 2013 18:14:03 -0200 [thread overview]
Message-ID: <20131104201403.GA15044@amt.cnet> (raw)
In-Reply-To: <20131104160812.GA6026@psuche>
On Mon, Nov 04, 2013 at 09:08:12AM -0700, Greg Edwards wrote:
> When determining the page size we could use to map with the IOMMU, the
> page size should also be aligned with the hva, not just the gfn. The
> gfn may not reflect the real alignment within the hugetlbfs file.
>
> Signed-off-by: Greg Edwards <gedwards-LfVdkaOWEx8@public.gmane.org>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> virt/kvm/iommu.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index 72a130b..c329c8f 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
> @@ -103,6 +103,10 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
> while ((gfn << PAGE_SHIFT) & (page_size - 1))
> page_size >>= 1;
>
> + /* Make sure hva is aligned to the page size we want to map */
> + while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))
> + page_size >>= 1;
> +
> /*
> * Pin all pages we are about to map in memory. This is
> * important because we unmap and unpin in 4kb steps later.
> --
> 1.8.3.2
Reviewed-by: Marcelo Tosatti <mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Greg Edwards <gedwards@ddn.com>
Cc: kvm@vger.kernel.org,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] KVM: IOMMU: hva align mapping page size
Date: Mon, 4 Nov 2013 18:14:03 -0200 [thread overview]
Message-ID: <20131104201403.GA15044@amt.cnet> (raw)
In-Reply-To: <20131104160812.GA6026@psuche>
On Mon, Nov 04, 2013 at 09:08:12AM -0700, Greg Edwards wrote:
> When determining the page size we could use to map with the IOMMU, the
> page size should also be aligned with the hva, not just the gfn. The
> gfn may not reflect the real alignment within the hugetlbfs file.
>
> Signed-off-by: Greg Edwards <gedwards@ddn.com>
> Cc: stable@vger.kernel.org
> ---
> virt/kvm/iommu.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index 72a130b..c329c8f 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
> @@ -103,6 +103,10 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
> while ((gfn << PAGE_SHIFT) & (page_size - 1))
> page_size >>= 1;
>
> + /* Make sure hva is aligned to the page size we want to map */
> + while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))
> + page_size >>= 1;
> +
> /*
> * Pin all pages we are about to map in memory. This is
> * important because we unmap and unpin in 4kb steps later.
> --
> 1.8.3.2
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
next prev parent reply other threads:[~2013-11-04 20:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 16:08 [PATCH] KVM: IOMMU: hva align mapping page size Greg Edwards
2013-11-01 16:08 ` Greg Edwards
2013-11-02 1:14 ` Marcelo Tosatti
2013-11-02 1:14 ` Marcelo Tosatti
[not found] ` <20131102011433.GA30381-I4X2Mt4zSy4@public.gmane.org>
2013-11-04 16:08 ` [PATCH v2] " Greg Edwards
2013-11-04 16:08 ` Greg Edwards
2013-11-04 20:14 ` Marcelo Tosatti [this message]
2013-11-04 20:14 ` Marcelo Tosatti
2013-11-05 7:56 ` 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=20131104201403.GA15044@amt.cnet \
--to=mtosatti-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=gedwards-LfVdkaOWEx8@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.