[PATCH v2] nvmet: protect sqhd update by a lock

Christoph Hellwig hch at infradead.org
Mon Oct 16 23:43:06 PDT 2017


>  	if (status)
>  		nvmet_set_status(req, status);
>  
> +	spin_lock_irqsave(&req->sq->sqhd_lock, flags);
>  	if (req->sq->size)
>  		req->sq->sqhd = (req->sq->sqhd + 1) % req->sq->size;
>  	req->rsp->sq_head = cpu_to_le16(req->sq->sqhd);
> +	spin_unlock_irqrestore(&req->sq->sqhd_lock, flags);

What performance impact does this have?   I'm really reluctant to put
an irq disabling spinlock into a hot path for a feature that
theoretically is in the spec but ignored by every host.

I'd much rather play games with cmpxchg or similar here.



More information about the Linux-nvme mailing list