Re: [PATCH v6 02/25] iommu/ioasid: Add ioasid references

2020-05-04 Thread Jacob Pan
On Mon, 4 May 2020 16:25:48 +0200 Jean-Philippe Brucker wrote: > On Thu, Apr 30, 2020 at 11:39:31AM -0700, Jacob Pan wrote: > > > +/** > > > + * ioasid_get - obtain a reference to the IOASID > > > + */ > > > +void ioasid_get(ioasid_t ioasid) > > why void? what if the ioasid is not valid. >

Re: [PATCH v6 02/25] iommu/ioasid: Add ioasid references

2020-05-04 Thread Jacob Pan
On Mon, 4 May 2020 16:39:32 +0200 Jean-Philippe Brucker wrote: > On Thu, Apr 30, 2020 at 01:48:42PM -0700, Jacob Pan wrote: > > On Thu, 30 Apr 2020 11:39:31 -0700 > > Jacob Pan wrote: > > > > > > -void ioasid_free(ioasid_t ioasid) > > > > +bool ioasid_free(ioasid_t ioasid) > > > > { > >

Re: [PATCH v6 02/25] iommu/ioasid: Add ioasid references

2020-05-04 Thread Jean-Philippe Brucker
On Thu, Apr 30, 2020 at 01:48:42PM -0700, Jacob Pan wrote: > On Thu, 30 Apr 2020 11:39:31 -0700 > Jacob Pan wrote: > > > > -void ioasid_free(ioasid_t ioasid) > > > +bool ioasid_free(ioasid_t ioasid) > > > { > Sorry I missed this in the last reply. > > I think free needs to be unconditional

Re: [PATCH v6 02/25] iommu/ioasid: Add ioasid references

2020-05-04 Thread Jean-Philippe Brucker
On Thu, Apr 30, 2020 at 11:39:31AM -0700, Jacob Pan wrote: > > +/** > > + * ioasid_get - obtain a reference to the IOASID > > + */ > > +void ioasid_get(ioasid_t ioasid) > why void? what if the ioasid is not valid. My intended use was for the caller to get an additional reference when they're

Re: [PATCH v6 02/25] iommu/ioasid: Add ioasid references

2020-04-30 Thread Jacob Pan
On Thu, 30 Apr 2020 11:39:31 -0700 Jacob Pan wrote: > > -void ioasid_free(ioasid_t ioasid) > > +bool ioasid_free(ioasid_t ioasid) > > { Sorry I missed this in the last reply. I think free needs to be unconditional since there is not a good way to fail it. Also can we have more symmetric APIs,

Re: [PATCH v6 02/25] iommu/ioasid: Add ioasid references

2020-04-30 Thread Jacob Pan
On Thu, 30 Apr 2020 16:34:01 +0200 Jean-Philippe Brucker wrote: > Let IOASID users take references to existing ioasids with > ioasid_get(). ioasid_free() drops a reference and only frees the > ioasid when its reference number is zero. It returns whether the > ioasid was freed. > Looks good to