linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	Paul Mackerras <paulus@samba.org>,
	kvm-ppc@vger.kernel.org
Subject: Re: [PATCH kernel] KVM: PPC: Align the table size to system page size
Date: Tue, 18 Apr 2017 12:16:09 +1000	[thread overview]
Message-ID: <20170418021609.GC12235@umbus.fritz.box> (raw)
In-Reply-To: <20170413070420.16927-1-aik@ozlabs.ru>

[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]

On Thu, Apr 13, 2017 at 05:04:20PM +1000, Alexey Kardashevskiy wrote:
> At the moment the userspace can request a table smaller than a page size
> and this value will be stored as kvmppc_spapr_tce_table::size.
> However the actual allocated size will still be aligned to the system
> page size as alloc_page() is used there.
> 
> This aligns the table size up to the system page size. It should not
> change the existing behaviour but when in-kernel TCE acceleration patchset
> reaches the upstream kernel, this will allow small TCE tables be
> accelerated as well: PCI IODA iommu_table allocator already aligns
> the size and, without this patch, an IOMMU group won't attach to LIOBN
> due to the mismatching table size.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> 
> For sake of bisectability (otherwise in-kernel acceleration won't work
> hugepages braking DMA completely), this is better be put before
> [PATCH kernel v11 00/10] powerpc/kvm/vfio: Enable in-kernel acceleration
> 
> ---
>  arch/powerpc/kvm/book3s_64_vio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
> index aea3a5b74fb6..45941af9c6d7 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -333,7 +333,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
>  			return -EBUSY;
>  	}
>  
> -	size = args->size;
> +	size = _ALIGN_UP(args->size, PAGE_SIZE >> 3);
>  	npages = kvmppc_tce_pages(size);
>  	ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
>  	if (ret) {

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2017-04-18  3:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  7:04 [PATCH kernel] KVM: PPC: Align the table size to system page size Alexey Kardashevskiy
2017-04-18  2:16 ` David Gibson [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=20170418021609.GC12235@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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).