Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
From: Jason Gunthorpe
Date: Fri Dec 04 2026 - 12:21:14 EST
On Fri, Dec 04, 2026 at 01:27:41PM +0530, Aneesh Kumar K.V wrote:
> Could we also avoid taking ctlv->registration_lock in ctlv_device_add()
> and ctlv_publish()? TSM drivers may call attestation_register() while
> holding their own locks. For CCA, registration holds pci_tsm_rwsem, so
> taking registration_lock here introduces this dependency:
>
> pci_tsm_rwsem -> ctlv->registration_lock
>
> CTLV operations hold registration_lock while invoking callbacks, and
> those callbacks may need to acquire pci_tsm_rwsem, creating the reverse
> dependency.
>
> I think we should preserve this lock ordering:
>
> ctlv->registration_lock -> pci_tsm_rwsem
>
> and avoid taking registration_lock during ctlv_publish() and
> ctlv_device_add().
That doesn't seem like tsm is using its locks right. Lets not create
another rtnl_lock :\
Jason