Skip to contentSkip to conversation

nvme-tcp: Fix misuse of __smp_processor_id with preemption enabled

PATCH Applied Sagi Grimberg 4 participants 4 messages Mar 15, 2021 – Mar 18, 2021 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvme-tcp: Fix misuse of __smp_processor_id with preemption enabled

For our pure advisory use-case, we only rely on this call as a hint so fix the warning complaints of using the smp_processor_id variants with preemption enabled.

Fixes db5ad6b7f8cd ("nvme-tcp: try to send request in queue_rq context")
Fixes ada831772188 ("nvme-tcp: Fix warning with CONFIG_DEBUG_PREEMPT")
---
 drivers/nvme/host/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/tcp.c +1 -1
index bd931de44d6c..0ef72568a4dd 100644
@@ -287,7 +287,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
 	 * directly, otherwise queue io_work. Also, only do that if we
 	 * are on the same cpu, so we don't introduce contention.
 	 */
-	if (queue->io_cpu == __smp_processor_id() &&
+	if (queue->io_cpu == raw_smp_processor_id() &&
 	    sync && empty && mutex_trylock(&queue->send_mutex)) {
 		queue->more_requests = !last;
 		nvme_tcp_send_all(queue);
Signature · 7 lines
2.27.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Sagi Grimberg

For our pure advisory use-case, we only rely on this call as a hint so fix the warning complaints of using the smp_processor_id variants with preemption enabled.

Fixes db5ad6b7f8cd ("nvme-tcp: try to send request in queue_rq context")
Fixes ada831772188 ("nvme-tcp: Fix warning with CONFIG_DEBUG_PREEMPT")

This patch adds the call that is discussed on the earlier thread.

Looks good.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

Tested-by on v1 1/1
#2 lore raw
In reply to Sagi Grimberg

Thanks.

Quoted 16 lines · Sagi Grimberg

For our pure advisory use-case, we only rely on this call as a hint so fix the warning complaints of using the smp_processor_id variants with preemption enabled.

Fixes db5ad6b7f8cd ("nvme-tcp: try to send request in queue_rq context")
Fixes ada831772188 ("nvme-tcp: Fix warning with CONFIG_DEBUG_PREEMPT")
---
  drivers/nvme/host/tcp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/tcp.c +0 -0
index bd931de44d6c..0ef72568a4dd 100644

drivers/nvme/host/tcp.c static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, · line 293

Quoted 8 lines
drivers/nvme/host/tcp.c +1 -1
@@ -287,7 +287,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
  	 * directly, otherwise queue io_work. Also, only do that if we
  	 * are on the same cpu, so we don't introduce contention.
  	 */
-	if (queue->io_cpu == __smp_processor_id() &&
+	if (queue->io_cpu == raw_smp_processor_id() &&
  	    sync && empty && mutex_trylock(&queue->send_mutex)) {
  		queue->more_requests = !last;
  		nvme_tcp_send_all(queue);

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme