public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: yaozhenguo <yaozhenguo1@gmail.com>,
	yaozhenguo@jd.com, dwmw2@infradead.org, baolu.lu@linux.intel.com,
	joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, Wenchao Yao <yaowenchao@jd.com>,
	ZiHan Zhou <zhouzihan30@jd.com>
Subject: Re: [PATCH V1] vfio: add attach_group_by_node to control behavior of attaching group to domain
Date: Mon, 20 Nov 2023 09:50:27 -0400	[thread overview]
Message-ID: <20231120135027.GB6083@nvidia.com> (raw)
In-Reply-To: <20231117152746.3aa55d68.alex.williamson@redhat.com>

On Fri, Nov 17, 2023 at 03:27:46PM -0700, Alex Williamson wrote:
> > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> > index eacd6ec..6a5641e 100644
> > --- a/drivers/vfio/vfio_iommu_type1.c
> > +++ b/drivers/vfio/vfio_iommu_type1.c
> > @@ -59,6 +59,11 @@
> >  module_param_named(dma_entry_limit, dma_entry_limit, uint, 0644);
> >  MODULE_PARM_DESC(dma_entry_limit,
> >  		 "Maximum number of user DMA mappings per container (65535).");
> > +static uint attach_group_by_node;
> > +module_param_named(attach_group_by_node,
> > +		attach_group_by_node, uint, 0644);
> > +MODULE_PARM_DESC(attach_group_by_node,
> > +		 "Attach group to domain when it's in same node");

Definately no to any kind of module option..

> I question whether we need this solution at all though.  AIUI the
> initial domain is allocated in proximity to the initial group.  The
> problem comes when the user asks to add an additional group into the
> same container.  Another valid solution would be that the user
> recognizes that these groups are not within the same locality and
> creates a separate container for this group. 

qemu using iommufd should de-duplicate the IOAS though, so we would be
back to this discussion.

Regardless, I agree this should be handled by userspace. The kernel
driver should associate the NUMA locality of the iommu_domain to the
first iommu instance that it was allocated against.

The explicit HWPTs in iommufd already will allow userspace to choose
the appropriate locality. We many need to expose a bit more
information in iommufd ioctls showing the instance to device
association.

Jason

  reply	other threads:[~2023-11-20 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15  2:02 [PATCH V1] vfio: add attach_group_by_node to control behavior of attaching group to domain yaozhenguo
2023-11-17 22:27 ` Alex Williamson
2023-11-20 13:50   ` Jason Gunthorpe [this message]
2023-11-22  1:02   ` Zhenguo Yao

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=20231120135027.GB6083@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yaowenchao@jd.com \
    --cc=yaozhenguo1@gmail.com \
    --cc=yaozhenguo@jd.com \
    --cc=zhouzihan30@jd.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