get_update_locks_for_queue(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 a vfio_ap_queue object 🫢 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:

  1. q->matrix_dev->guests_lock β€” you need this one to use the KVM pointer to update a KVM guest's APCB πŸ”₯
  2. q->matrix_mdev->kvm->lock β€” this one's required to update a guest's APCB ✨
  3. matrix_dev->mdevs_lock β€” needed to access data stored in matrix_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