get_update_locks_for_queue(9)
π get_update_locks_for_queue β the kernel API manual, bestie edition
okay so you found your way to get_update_locks_for_queue(9), the page from the Kernel API Manual, and honestly? this one's a little niche but it slaps once you get it π
β¨ NAME β¨
get_update_locks_for_queue β bestie, this one grabs all the locks you need to update the APCB of the KVM guest that the matrix mdev is attached to, where that matrix mdev is linked to a vfio_ap_queue object. like, it's the lock-fetching errand-runner of the s390 crypto vfio world π¦
β¨ SYNOPSIS β¨
void get_update_locks_for_queue (struct vfio_ap_queue *q );
no return value, it just does the thing and your locks are got. periodt π
β¨ ARGUMENTS β¨
qβ a pointer to avfio_ap_queueobject π«Ά that's it, that's the whole argument list, and honestly we love a one-parameter icon.
β¨ DESCRIPTION β¨
so here's the tea β β there is a proper locking order and you will respect it. the order goes like this:
q->matrix_dev->guests_lockβ you need this one to use the KVM pointer to update a KVM guest's APCB π₯q->matrix_mdev->kvm->lockβ this one's required to update a guest's APCB β¨matrix_dev->mdevs_lockβ needed to access data stored inmatrix_mdevπ
that's the whole sequence. in order. no skipping, no shuffling, iykyk π
πΈ NOTE πΈ
if the queue is not linked to an ap_matrix_mdev object, the KVM lock will not be taken, no cap π«Ά so don't go looking for it, it's just not invited to the party.
π SEE ALSO π
the source of truth lives in the kernel file ./drivers/s390/crypto/vfio_ap_ops.c and here's the whole friend group, all of them getting a shoutout:
get_update_locks_for_kvm(9), release_update_locks_for_kvm(9), get_update_locks_for_mdev(9), release_update_locks_for_mdev(9), get_update_locks_by_apqn(9), vfio_ap_mdev_get_queue(9), vfio_ap_wait_for_irqclear(9), vfio_ap_free_aqic_resources(9), vfio_ap_irq_disable(9), vfio_ap_validate_nib(9), ensure_nib_shared(9), vfio_ap_irq_enable(9), vfio_ap_le_guid_to_be_uuid(9), handle_pqap(9), vfio_ap_mdev_verify_no_sharing(9), vfio_ap_mdev_validate_masks(9), assign_adapter_store(9), vfio_ap_mdev_unlink_adapter(9), unassign_adapter_store(9), assign_domain_store(9), unassign_domain_store(9), assign_control_domain_store(9), unassign_control_domain_store(9), vfio_ap_mdev_set_kvm(9), vfio_ap_mdev_unset_kvm(9), vfio_ap_mdev_resource_in_use(9), vfio_ap_mdev_hot_unplug_cfg(9), vfio_ap_mdev_cfg_remove(9), vfio_ap_mdev_on_cfg_remove(9), vfio_ap_filter_apid_by_qtype(9), vfio_ap_mdev_cfg_add(9), vfio_ap_mdev_on_cfg_add(9), vfio_ap_on_cfg_changed(9)
and that's the page, bestie π sourced from ./drivers/s390/crypto, dated October 2026, and filed under get_update_locks_for_queue(9) β go forth and lock in the correct order, you absolute main character πβ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms