Re: [PATCH 2/7] PCI/TSM: Add pci_tsm_guest_req() for managing TDIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexey Kardashevskiy wrote:
> 
> 
> On 2/9/25 09:49, Alexey Kardashevskiy wrote:
> > 
> > 
> > On 30/8/25 12:37, dan.j.williams@xxxxxxxxx wrote:
> >> Alexey Kardashevskiy wrote:
> >> [..]
> >>>>> We have pdev in pci_tdi, pci_tsm and pci_tsm_pf0 (via .base), using
> >>>>> these in pci_tsm_ops will document better which call is allowed on
> >>>>> what entity - DSM or TDI. Or may be ditch those back "pdev"
> >>>>> references?
> >>>>
> >>>> Not immediately understanding what change you want here. Do you want
> >>>> iommufd to track the pci_tdi?
> >>>
> >>> I'd like to either:
> >>>
> >>> - get rid of pdev back refs in pci_tsm/pci_tdi since we pass pci_dev
> >>> everywhere as if a pdev from pci_tsm/pci_tdi is used in, say, 1-2
> >>> places, then it is just cleaner to pass pdev to those places
> >>> explicitly
> >>
> >> Maybe if we see that that are unused then they are easy to delete later.
> > 
> > It is way easier to do now than later when it grows. I'll dig a bit.
> 
> So far it appears so that the only use for these backrefs is
> pci_tsm_ops's hooks which take pci_tsm/pci_tdi instead of pci_dev. So
> the backrefs are only needed because unbind()/remove() do not take
> pci_dev.
> 
> My problem with these backrefs is that for a new reader of the code
> it won't be immediately obvious whether we need
> pci_dev_get/pci_dev_put for those, are pci_tsm/pci_tdi ever detached
> from pci_dev, etc. Dunno, I won't be nak-ing of this though. Thanks,

Why would the new reader audit that the core is taking references on the
back pointers it provides?

The to_pci_tsm_pf0() object casting path has safety checks based on type
which can be inferred by walking the backref.




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux