All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, Alexey Kardashevskiy <aik@ozlabs.ru>,
	kvm-ppc@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH kernel v3 0/6] powerpc/powernv/iommu: Optimize memory use
Date: Wed,  4 Jul 2018 16:13:43 +1000	[thread overview]
Message-ID: <20180704061349.20742-1-aik@ozlabs.ru> (raw)


This patchset aims to reduce actual memory use for guests with
sparse memory. The pseries guest uses dynamic DMA windows to map
the entire guest RAM but it only actually maps onlined memory
which may be not be contiguous. I hit this when tried passing
through NVLink2-connected GPU RAM of NVIDIA V100 and trying to
map this RAM at the same offset as in the real hardware
forced me to rework I handle these windows.

This moves userspace-to-host-physical translation table
(iommu_table::it_userspace) from VFIO TCE IOMMU subdriver to
the platform code and reuses the already existing multilevel
TCE table code which we have for the hardware tables.
At last in 6/6 I switch to on-demand allocation so we do not
allocate huge chunks of the table if we do not have to;
there is some math in 6/6.

Changes:
v3:
* rebased on v4.18-rc3 and fixed compile error in 6/6

v2:
* bugfix and error handling in 6/6


This is based on sha1
021c917 Linus Torvalds "Linux 4.18-rc3".

Please comment. Thanks.



Alexey Kardashevskiy (6):
  powerpc/powernv: Remove useless wrapper
  powerpc/powernv: Move TCE manupulation code to its own file
  KVM: PPC: Make iommu_table::it_userspace big endian
  powerpc/powernv: Add indirect levels to it_userspace
  powerpc/powernv: Rework TCE level allocation
  powerpc/powernv/ioda: Allocate indirect TCE levels on demand

 arch/powerpc/platforms/powernv/Makefile       |   2 +-
 arch/powerpc/include/asm/iommu.h              |  11 +-
 arch/powerpc/platforms/powernv/pci.h          |  44 ++-
 arch/powerpc/kvm/book3s_64_vio.c              |  11 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c           |  18 +-
 arch/powerpc/platforms/powernv/pci-ioda-tce.c | 399 ++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/pci-ioda.c     | 184 ++----------
 arch/powerpc/platforms/powernv/pci.c          | 158 ----------
 drivers/vfio/vfio_iommu_spapr_tce.c           |  65 +----
 9 files changed, 478 insertions(+), 414 deletions(-)
 create mode 100644 arch/powerpc/platforms/powernv/pci-ioda-tce.c

-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	David Gibson <david@gibson.dropbear.id.au>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Russell Currey <ruscur@russell.cc>
Subject: [PATCH kernel v3 0/6] powerpc/powernv/iommu: Optimize memory use
Date: Wed,  4 Jul 2018 16:13:43 +1000	[thread overview]
Message-ID: <20180704061349.20742-1-aik@ozlabs.ru> (raw)


This patchset aims to reduce actual memory use for guests with
sparse memory. The pseries guest uses dynamic DMA windows to map
the entire guest RAM but it only actually maps onlined memory
which may be not be contiguous. I hit this when tried passing
through NVLink2-connected GPU RAM of NVIDIA V100 and trying to
map this RAM at the same offset as in the real hardware
forced me to rework I handle these windows.

This moves userspace-to-host-physical translation table
(iommu_table::it_userspace) from VFIO TCE IOMMU subdriver to
the platform code and reuses the already existing multilevel
TCE table code which we have for the hardware tables.
At last in 6/6 I switch to on-demand allocation so we do not
allocate huge chunks of the table if we do not have to;
there is some math in 6/6.

Changes:
v3:
* rebased on v4.18-rc3 and fixed compile error in 6/6

v2:
* bugfix and error handling in 6/6


This is based on sha1
021c917 Linus Torvalds "Linux 4.18-rc3".

Please comment. Thanks.



Alexey Kardashevskiy (6):
  powerpc/powernv: Remove useless wrapper
  powerpc/powernv: Move TCE manupulation code to its own file
  KVM: PPC: Make iommu_table::it_userspace big endian
  powerpc/powernv: Add indirect levels to it_userspace
  powerpc/powernv: Rework TCE level allocation
  powerpc/powernv/ioda: Allocate indirect TCE levels on demand

 arch/powerpc/platforms/powernv/Makefile       |   2 +-
 arch/powerpc/include/asm/iommu.h              |  11 +-
 arch/powerpc/platforms/powernv/pci.h          |  44 ++-
 arch/powerpc/kvm/book3s_64_vio.c              |  11 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c           |  18 +-
 arch/powerpc/platforms/powernv/pci-ioda-tce.c | 399 ++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/pci-ioda.c     | 184 ++----------
 arch/powerpc/platforms/powernv/pci.c          | 158 ----------
 drivers/vfio/vfio_iommu_spapr_tce.c           |  65 +----
 9 files changed, 478 insertions(+), 414 deletions(-)
 create mode 100644 arch/powerpc/platforms/powernv/pci-ioda-tce.c

-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, Alexey Kardashevskiy <aik@ozlabs.ru>,
	kvm-ppc@vger.kernel.org,
	Alex Williamson <alex.williamson@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH kernel v3 0/6] powerpc/powernv/iommu: Optimize memory use
Date: Wed, 04 Jul 2018 06:13:43 +0000	[thread overview]
Message-ID: <20180704061349.20742-1-aik@ozlabs.ru> (raw)


This patchset aims to reduce actual memory use for guests with
sparse memory. The pseries guest uses dynamic DMA windows to map
the entire guest RAM but it only actually maps onlined memory
which may be not be contiguous. I hit this when tried passing
through NVLink2-connected GPU RAM of NVIDIA V100 and trying to
map this RAM at the same offset as in the real hardware
forced me to rework I handle these windows.

This moves userspace-to-host-physical translation table
(iommu_table::it_userspace) from VFIO TCE IOMMU subdriver to
the platform code and reuses the already existing multilevel
TCE table code which we have for the hardware tables.
At last in 6/6 I switch to on-demand allocation so we do not
allocate huge chunks of the table if we do not have to;
there is some math in 6/6.

Changes:
v3:
* rebased on v4.18-rc3 and fixed compile error in 6/6

v2:
* bugfix and error handling in 6/6


This is based on sha1
021c917 Linus Torvalds "Linux 4.18-rc3".

Please comment. Thanks.



Alexey Kardashevskiy (6):
  powerpc/powernv: Remove useless wrapper
  powerpc/powernv: Move TCE manupulation code to its own file
  KVM: PPC: Make iommu_table::it_userspace big endian
  powerpc/powernv: Add indirect levels to it_userspace
  powerpc/powernv: Rework TCE level allocation
  powerpc/powernv/ioda: Allocate indirect TCE levels on demand

 arch/powerpc/platforms/powernv/Makefile       |   2 +-
 arch/powerpc/include/asm/iommu.h              |  11 +-
 arch/powerpc/platforms/powernv/pci.h          |  44 ++-
 arch/powerpc/kvm/book3s_64_vio.c              |  11 +-
 arch/powerpc/kvm/book3s_64_vio_hv.c           |  18 +-
 arch/powerpc/platforms/powernv/pci-ioda-tce.c | 399 ++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/pci-ioda.c     | 184 ++----------
 arch/powerpc/platforms/powernv/pci.c          | 158 ----------
 drivers/vfio/vfio_iommu_spapr_tce.c           |  65 +----
 9 files changed, 478 insertions(+), 414 deletions(-)
 create mode 100644 arch/powerpc/platforms/powernv/pci-ioda-tce.c

-- 
2.11.0


             reply	other threads:[~2018-07-04  6:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04  6:13 Alexey Kardashevskiy [this message]
2018-07-04  6:13 ` [PATCH kernel v3 0/6] powerpc/powernv/iommu: Optimize memory use Alexey Kardashevskiy
2018-07-04  6:13 ` Alexey Kardashevskiy
2018-07-04  6:13 ` [PATCH kernel v3 1/6] powerpc/powernv: Remove useless wrapper Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-17  2:05   ` [kernel,v3,1/6] " Michael Ellerman
2018-07-17  2:05     ` Michael Ellerman
2018-07-17  2:05     ` Michael Ellerman
2018-07-04  6:13 ` [PATCH kernel v3 2/6] powerpc/powernv: Move TCE manupulation code to its own file Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13 ` [PATCH kernel v3 3/6] KVM: PPC: Make iommu_table::it_userspace big endian Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-15 23:37   ` Paul Mackerras
2018-07-15 23:37     ` Paul Mackerras
2018-07-15 23:37     ` Paul Mackerras
2018-07-04  6:13 ` [PATCH kernel v3 4/6] powerpc/powernv: Add indirect levels to it_userspace Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13 ` [PATCH kernel v3 5/6] powerpc/powernv: Rework TCE level allocation Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13 ` [PATCH kernel v3 6/6] powerpc/powernv/ioda: Allocate indirect TCE levels on demand Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-04  6:13   ` Alexey Kardashevskiy
2018-07-13  5:26 ` [PATCH kernel v3 0/6] powerpc/powernv/iommu: Optimize memory use Alexey Kardashevskiy
2018-07-13  5:26   ` Alexey Kardashevskiy
2018-07-13  5:26   ` Alexey Kardashevskiy

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=20180704061349.20742-1-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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.