All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chegu Vinod <chegu_vinod@hp.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	konrad.wilk@oracle.com
Subject: Re: [PATCH 3/2] vfio: Provide module option to disable vfio_iommu_type1 hugepage support
Date: Thu, 30 May 2013 19:33:21 -0700	[thread overview]
Message-ID: <51A80BF1.4040408@hp.com> (raw)
In-Reply-To: <20130528162637.28848.76733.stgit@bling.home>

On 5/28/2013 9:27 AM, Alex Williamson wrote:
> Add a module option to vfio_iommu_type1 to disable IOMMU hugepage
> support.  This causes iommu_map to only be called with single page
> mappings, disabling the IOMMU driver's ability to use hugepages.
> This option can be enabled by loading vfio_iommu_type1 with
> disable_hugepages=1 or dynamically through sysfs.  If enabled
> dynamically, only new mappings are restricted.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> As suggested by Konrad.  This is cleaner to add as a follow-on
>
>   drivers/vfio/vfio_iommu_type1.c |   11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 6654a7e..8a2be4e 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -48,6 +48,12 @@ module_param_named(allow_unsafe_interrupts,
>   MODULE_PARM_DESC(allow_unsafe_interrupts,
>   		 "Enable VFIO IOMMU support for on platforms without interrupt remapping support.");
>   
> +static bool disable_hugepages;
> +module_param_named(disable_hugepages,
> +		   disable_hugepages, bool, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(disable_hugepages,
> +		 "Disable VFIO IOMMU support for IOMMU hugepages.");
> +
>   struct vfio_iommu {
>   	struct iommu_domain	*domain;
>   	struct mutex		lock;
> @@ -270,6 +276,11 @@ static long vfio_pin_pages(unsigned long vaddr, long npage,
>   		return -ENOMEM;
>   	}
>   
> +	if (unlikely(disable_hugepages)) {
> +		vfio_lock_acct(1);
> +		return 1;
> +	}
> +
>   	/* Lock all the consecutive pages from pfn_base */
>   	for (i = 1, vaddr += PAGE_SIZE; i < npage; i++, vaddr += PAGE_SIZE) {
>   		unsigned long pfn = 0;
>
> .
>

Tested-by: Chegu Vinod <chegu_vinod@hp.com>

I was able to verify your changes on a 2 Sandybridge-EP socket platform 
and observed about ~7-8% improvement in the netperf's TCP_RR 
performance.  The guest size was small (16vcpu/32GB).

Hopefully these changes also have an indirect benefit of avoiding soft 
lockups on the host side when larger guests (> 256GB ) are rebooted. 
Someone who has ready access to a larger Sandybridge-EP/EX platform can 
verify this.

FYI
Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Chegu Vinod <chegu_vinod@hp.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, konrad.wilk@oracle.com,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org
Subject: Re: [PATCH 3/2] vfio: Provide module option to disable vfio_iommu_type1 hugepage support
Date: Thu, 30 May 2013 19:33:21 -0700	[thread overview]
Message-ID: <51A80BF1.4040408@hp.com> (raw)
In-Reply-To: <20130528162637.28848.76733.stgit@bling.home>

On 5/28/2013 9:27 AM, Alex Williamson wrote:
> Add a module option to vfio_iommu_type1 to disable IOMMU hugepage
> support.  This causes iommu_map to only be called with single page
> mappings, disabling the IOMMU driver's ability to use hugepages.
> This option can be enabled by loading vfio_iommu_type1 with
> disable_hugepages=1 or dynamically through sysfs.  If enabled
> dynamically, only new mappings are restricted.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> As suggested by Konrad.  This is cleaner to add as a follow-on
>
>   drivers/vfio/vfio_iommu_type1.c |   11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 6654a7e..8a2be4e 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -48,6 +48,12 @@ module_param_named(allow_unsafe_interrupts,
>   MODULE_PARM_DESC(allow_unsafe_interrupts,
>   		 "Enable VFIO IOMMU support for on platforms without interrupt remapping support.");
>   
> +static bool disable_hugepages;
> +module_param_named(disable_hugepages,
> +		   disable_hugepages, bool, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(disable_hugepages,
> +		 "Disable VFIO IOMMU support for IOMMU hugepages.");
> +
>   struct vfio_iommu {
>   	struct iommu_domain	*domain;
>   	struct mutex		lock;
> @@ -270,6 +276,11 @@ static long vfio_pin_pages(unsigned long vaddr, long npage,
>   		return -ENOMEM;
>   	}
>   
> +	if (unlikely(disable_hugepages)) {
> +		vfio_lock_acct(1);
> +		return 1;
> +	}
> +
>   	/* Lock all the consecutive pages from pfn_base */
>   	for (i = 1, vaddr += PAGE_SIZE; i < npage; i++, vaddr += PAGE_SIZE) {
>   		unsigned long pfn = 0;
>
> .
>

Tested-by: Chegu Vinod <chegu_vinod@hp.com>

I was able to verify your changes on a 2 Sandybridge-EP socket platform 
and observed about ~7-8% improvement in the netperf's TCP_RR 
performance.  The guest size was small (16vcpu/32GB).

Hopefully these changes also have an indirect benefit of avoiding soft 
lockups on the host side when larger guests (> 256GB ) are rebooted. 
Someone who has ready access to a larger Sandybridge-EP/EX platform can 
verify this.

FYI
Vinod


WARNING: multiple messages have this Message-ID (diff)
From: Chegu Vinod <chegu_vinod@hp.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	konrad.wilk@oracle.com
Subject: Re: [Qemu-devel] [PATCH 3/2] vfio: Provide module option to disable vfio_iommu_type1 hugepage support
Date: Thu, 30 May 2013 19:33:21 -0700	[thread overview]
Message-ID: <51A80BF1.4040408@hp.com> (raw)
In-Reply-To: <20130528162637.28848.76733.stgit@bling.home>

On 5/28/2013 9:27 AM, Alex Williamson wrote:
> Add a module option to vfio_iommu_type1 to disable IOMMU hugepage
> support.  This causes iommu_map to only be called with single page
> mappings, disabling the IOMMU driver's ability to use hugepages.
> This option can be enabled by loading vfio_iommu_type1 with
> disable_hugepages=1 or dynamically through sysfs.  If enabled
> dynamically, only new mappings are restricted.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> As suggested by Konrad.  This is cleaner to add as a follow-on
>
>   drivers/vfio/vfio_iommu_type1.c |   11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 6654a7e..8a2be4e 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -48,6 +48,12 @@ module_param_named(allow_unsafe_interrupts,
>   MODULE_PARM_DESC(allow_unsafe_interrupts,
>   		 "Enable VFIO IOMMU support for on platforms without interrupt remapping support.");
>   
> +static bool disable_hugepages;
> +module_param_named(disable_hugepages,
> +		   disable_hugepages, bool, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(disable_hugepages,
> +		 "Disable VFIO IOMMU support for IOMMU hugepages.");
> +
>   struct vfio_iommu {
>   	struct iommu_domain	*domain;
>   	struct mutex		lock;
> @@ -270,6 +276,11 @@ static long vfio_pin_pages(unsigned long vaddr, long npage,
>   		return -ENOMEM;
>   	}
>   
> +	if (unlikely(disable_hugepages)) {
> +		vfio_lock_acct(1);
> +		return 1;
> +	}
> +
>   	/* Lock all the consecutive pages from pfn_base */
>   	for (i = 1, vaddr += PAGE_SIZE; i < npage; i++, vaddr += PAGE_SIZE) {
>   		unsigned long pfn = 0;
>
> .
>

Tested-by: Chegu Vinod <chegu_vinod@hp.com>

I was able to verify your changes on a 2 Sandybridge-EP socket platform 
and observed about ~7-8% improvement in the netperf's TCP_RR 
performance.  The guest size was small (16vcpu/32GB).

Hopefully these changes also have an indirect benefit of avoiding soft 
lockups on the host side when larger guests (> 256GB ) are rebooted. 
Someone who has ready access to a larger Sandybridge-EP/EX platform can 
verify this.

FYI
Vinod

  parent reply	other threads:[~2013-05-31  2:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 17:24 [PATCH 0/2] vfio: type1 iommu hugepage support Alex Williamson
2013-05-24 17:24 ` [Qemu-devel] " Alex Williamson
2013-05-24 17:24 ` Alex Williamson
     [not found] ` <20130524171613.14229.84050.stgit-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-05-24 17:24   ` [PATCH 1/2] vfio: Convert type1 iommu to use rbtree Alex Williamson
2013-05-24 17:24     ` [Qemu-devel] " Alex Williamson
2013-05-24 17:24     ` Alex Williamson
2013-05-24 17:24   ` [PATCH 2/2] vfio: hugepage support for vfio_iommu_type1 Alex Williamson
2013-05-24 17:24     ` [Qemu-devel] " Alex Williamson
2013-05-24 17:24     ` Alex Williamson
     [not found]     ` <20130524172438.14229.59476.stgit-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-05-25 11:20       ` Konrad Rzeszutek Wilk
2013-05-25 11:20         ` [Qemu-devel] " Konrad Rzeszutek Wilk
2013-05-25 11:20         ` Konrad Rzeszutek Wilk
     [not found]         ` <20130525112009.GC2418-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2013-05-25 14:23           ` Alex Williamson
2013-05-25 14:23             ` [Qemu-devel] " Alex Williamson
2013-05-25 14:23             ` Alex Williamson
2013-05-27  8:41       ` Sethi Varun-B16395
2013-05-27  8:41         ` [Qemu-devel] " Sethi Varun-B16395
2013-05-27  8:41         ` Sethi Varun-B16395
     [not found]         ` <C5ECD7A89D1DC44195F34B25E172658D552685-RL0Hj/+nBVDYdknt8GnhQq4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org>
2013-05-27 13:37           ` Alex Williamson
2013-05-27 13:37             ` [Qemu-devel] " Alex Williamson
2013-05-27 13:37             ` Alex Williamson
2013-05-25 11:21   ` [PATCH 0/2] vfio: type1 iommu hugepage support Konrad Rzeszutek Wilk
2013-05-25 11:21     ` [Qemu-devel] " Konrad Rzeszutek Wilk
2013-05-25 11:21     ` Konrad Rzeszutek Wilk
     [not found]     ` <20130525112153.GD2418-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2013-05-25 14:39       ` Alex Williamson
2013-05-25 14:39         ` [Qemu-devel] " Alex Williamson
2013-05-25 14:39         ` Alex Williamson
2013-05-28 16:27   ` [PATCH 3/2] vfio: Provide module option to disable vfio_iommu_type1 " Alex Williamson
2013-05-28 16:27     ` [Qemu-devel] " Alex Williamson
2013-05-28 16:27     ` Alex Williamson
     [not found]     ` <20130528162637.28848.76733.stgit-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org>
2013-05-28 16:42       ` Konrad Rzeszutek Wilk
2013-05-28 16:42         ` [Qemu-devel] " Konrad Rzeszutek Wilk
2013-05-28 16:42         ` Konrad Rzeszutek Wilk
2013-05-31  2:33     ` Chegu Vinod [this message]
2013-05-31  2:33       ` [Qemu-devel] " Chegu Vinod
2013-05-31  2:33       ` Chegu Vinod

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=51A80BF1.4040408@hp.com \
    --to=chegu_vinod@hp.com \
    --cc=alex.williamson@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qemu-devel@nongnu.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.