On Tue, May 20, 2025 at 01:06:28PM +0200, Karol Kolacinski wrote:
> Sideband queue is a HW queue and has much faster completion time than
> other queues.
>
> With <5 us for read on average it is possible to use spin_lock to be
> able to read/write sideband queue messages in the interrupt top half.
>
> Add send queue lock/unlock operations and assign them based on the queue
> type. Use ice_sq_spin_lock/unlock for sideband queue and
> ice_sq_mutex_lock/unlock for other queues.
>
> Reviewed-by: Milena Olech <[email protected]>
> Signed-off-by: Karol Kolacinski <[email protected]>
...
> +/**
> + * ice_sq_spin_lock - Call spin_lock_irqsave for union ice_sq_lock
> + * @lock: lock handle
> + */
> +static void ice_sq_spin_lock(union ice_sq_lock *lock)
> + __acquires(&lock->sq_spinlock)
> +{
> + spin_lock_irqsave(&lock->sq_spinlock, lock->sq_flags);
> +}
> +
> +/**
> + * ice_sq_spin_unlock - Call spin_unlock_irqrestore for union ice_sq_lock
> + * @lock: lock handle
> + */
> +static void ice_sq_spin_unlock(union ice_sq_lock *lock)
> + __releases(&lock->sq_spinlock)
> +{
> + spin_unlock_irqrestore(&lock->sq_spinlock, lock->sq_flags);
> +}
> +
> +/**
> + * ice_sq_mutex_lock - Call mutex_lock for union ice_sq_lock
> + * @lock: lock handle
> + */
> +static void ice_sq_mutex_lock(union ice_sq_lock *lock)
> + __acquires(&lock->sq_mutex)
> +{
> + mutex_lock(&lock->sq_mutex);
> +}
> +
> +/**
> + * ice_sq_mutex_unlock - Call mutex_unlock for union ice_sq_lock
> + * @lock: lock handle
> + */
> +static void ice_sq_mutex_unlock(union ice_sq_lock *lock)
> + __releases(&lock->sq_mutex)
> +{
> + mutex_unlock(&lock->sq_mutex);
> +}
Sparse seems unhappy about the annotations on the mutex functions above,
but curiously happy with those for the corresponding spinlock functions.
I am unsure why.
.../ice_controlq.c:803:13: warning: context imbalance in 'ice_sq_mutex_lock'
- wrong count at exit
.../ice_controlq.c:813:13: warning: context imbalance in
'ice_sq_mutex_unlock' - wrong count at exit
> +
> +static struct ice_sq_ops ice_spin_ops = {
> + .lock = ice_sq_spin_lock,
> + .unlock = ice_sq_spin_unlock,
> +};
> +
> +static struct ice_sq_ops ice_mutex_ops = {
> + .lock = ice_sq_mutex_lock,
> + .unlock = ice_sq_mutex_unlock,
> +};
> +
...