Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"Yang, Lixiao" <lixiao.yang@intel.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Nicolin Chen <nicolinc@nvidia.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [PATCH 4/4] iommufd: Simplify the lifecycle of a hwpt
Date: Tue, 14 Feb 2023 12:32:46 -0400	[thread overview]
Message-ID: <Y+u3ru5HgyNGZdPQ@nvidia.com> (raw)
In-Reply-To: <BN9PR11MB5276D5B247C1F93A5FEB46838CA29@BN9PR11MB5276.namprd11.prod.outlook.com>

On Tue, Feb 14, 2023 at 06:14:07AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@nvidia.com>
> > Sent: Tuesday, February 14, 2023 2:03 AM
> > 
> > The HWPT is connected to the ioas when it is finished being created and
> > should remain connected until it is destroyed.
> > 
> > Instead of trying to disconnect the HWPT manually during
> > iommufd_device_detach() simply use the object reference counting
> > mechanism
> > and free it when the refcount reaches 0.
> > 
> > This means the ioas->hwpt_list can have an item with a 0 refcount during
> > races, a prior patch made sure this is safe.
> > 
> > Add a new API iommufd_hw_pagetable_finalize() to formalize this contract.
> 
> Can you add a few words how you expect this to be called in manually
> created hwpt case? the new API requires it to be called after
> iopt_table_add_domain() which is part of iommufd_device_do_attach()
> now. Do you intend to move iopt_table_add_domain() into hwpt
> creation path so this finalize API is also called there or leave it as today
> which means again need to track first device in the group to finalize?

It is all still pretty messy, let me try again.

Jason

  parent reply	other threads:[~2023-02-14 16:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 18:02 [PATCH 0/4] Fix hwpt lifetime and detach bugs Jason Gunthorpe
2023-02-13 18:02 ` [PATCH 1/4] iommufd: Do not add the same hwpt to the ioas->hwpt_list twice Jason Gunthorpe
2023-02-14  5:51   ` Tian, Kevin
2023-02-14 15:14     ` Jason Gunthorpe
2023-02-15  1:39       ` Tian, Kevin
2023-02-13 18:02 ` [PATCH 2/4] iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() Jason Gunthorpe
2023-02-14  5:52   ` Tian, Kevin
2023-02-13 18:02 ` [PATCH 3/4] iommufd: Add iommufd_lock_obj() around the auto-domains hwpts Jason Gunthorpe
2023-02-14  5:55   ` Tian, Kevin
2023-02-13 18:02 ` [PATCH 4/4] iommufd: Simplify the lifecycle of a hwpt Jason Gunthorpe
2023-02-14  6:14   ` Tian, Kevin
2023-02-14 10:41     ` Nicolin Chen
2023-02-14 16:32     ` Jason Gunthorpe [this message]
2023-02-16  1:36 ` [PATCH 0/4] Fix hwpt lifetime and detach bugs Jason Gunthorpe
2023-02-22  2:14   ` Tian, Kevin
2023-02-22 12:43     ` Jason Gunthorpe

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=Y+u3ru5HgyNGZdPQ@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=kevin.tian@intel.com \
    --cc=lixiao.yang@intel.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=nicolinc@nvidia.com \
    --cc=yi.l.liu@intel.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