All of lore.kernel.org
 help / color / mirror / Atom feed
* sparse fixes
@ 2018-12-13  8:51 Christoph Hellwig
  2018-12-13  8:51 ` [PATCH 1/3] nvmet-tcp: fix endianess annotations Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Christoph Hellwig @ 2018-12-13  8:51 UTC (permalink / raw)


Mostly endianess annoations in the new TCP code, but
nvme_poll_irqdisable didn't make sparse happy, so a small fix there
as well.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] nvmet-tcp: fix endianess annotations
  2018-12-13  8:51 sparse fixes Christoph Hellwig
@ 2018-12-13  8:51 ` Christoph Hellwig
  2018-12-13 16:42   ` Sagi Grimberg
  2018-12-13  8:51 ` [PATCH 2/3] " Christoph Hellwig
  2018-12-13  8:51 ` [PATCH 3/3] nvme-pci: refactor nvme_poll_irqdisable to make sparse happy Christoph Hellwig
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2018-12-13  8:51 UTC (permalink / raw)


Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/target/tcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index d31bec260160..44b37b202e39 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -758,7 +758,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
 
 	if (icreq->maxr2t != 0) {
 		pr_err("queue %d: unsupported maxr2t %d\n", queue->idx,
-			le16_to_cpu(icreq->maxr2t) + 1);
+			le32_to_cpu(icreq->maxr2t) + 1);
 		return -EPROTO;
 	}
 
@@ -776,7 +776,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
 	icresp->hdr.pdo = 0;
 	icresp->hdr.plen = cpu_to_le32(icresp->hdr.hlen);
 	icresp->pfv = cpu_to_le16(NVME_TCP_PFV_1_0);
-	icresp->maxdata = 0xffff; /* FIXME: support r2t */
+	icresp->maxdata = cpu_to_le32(0xffff); /* FIXME: support r2t */
 	icresp->cpda = 0;
 	if (queue->hdr_digest)
 		icresp->digest |= NVME_TCP_HDR_DIGEST_ENABLE;
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] nvmet-tcp: fix endianess annotations
  2018-12-13  8:51 sparse fixes Christoph Hellwig
  2018-12-13  8:51 ` [PATCH 1/3] nvmet-tcp: fix endianess annotations Christoph Hellwig
@ 2018-12-13  8:51 ` Christoph Hellwig
  2018-12-13 16:42   ` Sagi Grimberg
  2018-12-13  8:51 ` [PATCH 3/3] nvme-pci: refactor nvme_poll_irqdisable to make sparse happy Christoph Hellwig
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2018-12-13  8:51 UTC (permalink / raw)


Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/tcp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 15543358e245..5b64051671ca 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -35,7 +35,7 @@ struct nvme_tcp_request {
 	u32			pdu_sent;
 	u16			ttag;
 	struct list_head	entry;
-	u32			ddgst;
+	__le32			ddgst;
 
 	struct bio		*curr_bio;
 	struct iov_iter		iter;
@@ -272,7 +272,8 @@ nvme_tcp_fetch_request(struct nvme_tcp_queue *queue)
 	return req;
 }
 
-static inline void nvme_tcp_ddgst_final(struct ahash_request *hash, u32 *dgst)
+static inline void nvme_tcp_ddgst_final(struct ahash_request *hash,
+		__le32 *dgst)
 {
 	ahash_request_set_crypt(hash, NULL, (u8 *)dgst, 0);
 	crypto_ahash_final(hash);
@@ -817,7 +818,7 @@ static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
 	union nvme_result res = {};
 
 	nvme_end_request(blk_mq_rq_from_pdu(req),
-		NVME_SC_DATA_XFER_ERROR, res);
+		cpu_to_le16(NVME_SC_DATA_XFER_ERROR), res);
 }
 
 static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
@@ -1950,7 +1951,7 @@ nvme_tcp_timeout(struct request *rq, bool reserved)
 		union nvme_result res = {};
 
 		nvme_req(rq)->flags |= NVME_REQ_CANCELLED;
-		nvme_end_request(rq, NVME_SC_ABORT_REQ, res);
+		nvme_end_request(rq, cpu_to_le16(NVME_SC_ABORT_REQ), res);
 		return BLK_EH_DONE;
 	}
 
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] nvme-pci: refactor nvme_poll_irqdisable to make sparse happy
  2018-12-13  8:51 sparse fixes Christoph Hellwig
  2018-12-13  8:51 ` [PATCH 1/3] nvmet-tcp: fix endianess annotations Christoph Hellwig
  2018-12-13  8:51 ` [PATCH 2/3] " Christoph Hellwig
@ 2018-12-13  8:51 ` Christoph Hellwig
  2018-12-13 16:43   ` Sagi Grimberg
  2 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2018-12-13  8:51 UTC (permalink / raw)


By duplicating the nvme_process_cq in both branches we keep the
sparse lock context checking happy, so do it.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/pci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fb9d8270f32c..c0f66d2f6e80 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1093,15 +1093,15 @@ static int nvme_poll_irqdisable(struct nvme_queue *nvmeq, unsigned int tag)
 	 * using the CQ lock.  For normal interrupt driven threads we have
 	 * to disable the interrupt to avoid racing with it.
 	 */
-	if (nvmeq->cq_vector == -1)
+	if (nvmeq->cq_vector == -1) {
 		spin_lock(&nvmeq->cq_poll_lock);
-	else
-		disable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
-	found = nvme_process_cq(nvmeq, &start, &end, tag);
-	if (nvmeq->cq_vector == -1)
+		found = nvme_process_cq(nvmeq, &start, &end, tag);
 		spin_unlock(&nvmeq->cq_poll_lock);
-	else
+	} else {
+		disable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
+		found = nvme_process_cq(nvmeq, &start, &end, tag);
 		enable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
+	}
 
 	nvme_complete_cqes(nvmeq, start, end);
 	return found;
-- 
2.19.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/3] nvmet-tcp: fix endianess annotations
  2018-12-13  8:51 ` [PATCH 1/3] nvmet-tcp: fix endianess annotations Christoph Hellwig
@ 2018-12-13 16:42   ` Sagi Grimberg
  2018-12-13 20:10     ` Christoph Hellwig
  2018-12-16 16:24     ` Christoph Hellwig
  0 siblings, 2 replies; 10+ messages in thread
From: Sagi Grimberg @ 2018-12-13 16:42 UTC (permalink / raw)



> @@ -776,7 +776,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
>   	icresp->hdr.pdo = 0;
>   	icresp->hdr.plen = cpu_to_le32(icresp->hdr.hlen);
>   	icresp->pfv = cpu_to_le16(NVME_TCP_PFV_1_0);
> -	icresp->maxdata = 0xffff; /* FIXME: support r2t */
> +	icresp->maxdata = cpu_to_le32(0xffff); /* FIXME: support r2t */
>   	icresp->cpda = 0;
>   	if (queue->hdr_digest)
>   		icresp->digest |= NVME_TCP_HDR_DIGEST_ENABLE;

This needs an actual fix, we need to send 0xffffffff as we don't have
this any limitation..

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/3] nvmet-tcp: fix endianess annotations
  2018-12-13  8:51 ` [PATCH 2/3] " Christoph Hellwig
@ 2018-12-13 16:42   ` Sagi Grimberg
  0 siblings, 0 replies; 10+ messages in thread
From: Sagi Grimberg @ 2018-12-13 16:42 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/3] nvme-pci: refactor nvme_poll_irqdisable to make sparse happy
  2018-12-13  8:51 ` [PATCH 3/3] nvme-pci: refactor nvme_poll_irqdisable to make sparse happy Christoph Hellwig
@ 2018-12-13 16:43   ` Sagi Grimberg
  0 siblings, 0 replies; 10+ messages in thread
From: Sagi Grimberg @ 2018-12-13 16:43 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] nvmet-tcp: fix endianess annotations
  2018-12-13 16:42   ` Sagi Grimberg
@ 2018-12-13 20:10     ` Christoph Hellwig
  2018-12-16 16:24     ` Christoph Hellwig
  1 sibling, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2018-12-13 20:10 UTC (permalink / raw)


On Thu, Dec 13, 2018@08:42:15AM -0800, Sagi Grimberg wrote:
>
>> @@ -776,7 +776,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
>>   	icresp->hdr.pdo = 0;
>>   	icresp->hdr.plen = cpu_to_le32(icresp->hdr.hlen);
>>   	icresp->pfv = cpu_to_le16(NVME_TCP_PFV_1_0);
>> -	icresp->maxdata = 0xffff; /* FIXME: support r2t */
>> +	icresp->maxdata = cpu_to_le32(0xffff); /* FIXME: support r2t */
>>   	icresp->cpda = 0;
>>   	if (queue->hdr_digest)
>>   		icresp->digest |= NVME_TCP_HDR_DIGEST_ENABLE;
>
> This needs an actual fix, we need to send 0xffffffff as we don't have
> this any limitation..

Please either send a fix on top of this, or if you want separately
and I'll rebase.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] nvmet-tcp: fix endianess annotations
  2018-12-13 16:42   ` Sagi Grimberg
  2018-12-13 20:10     ` Christoph Hellwig
@ 2018-12-16 16:24     ` Christoph Hellwig
  2018-12-18  7:24       ` Sagi Grimberg
  1 sibling, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2018-12-16 16:24 UTC (permalink / raw)


On Thu, Dec 13, 2018@08:42:15AM -0800, Sagi Grimberg wrote:
>
>> @@ -776,7 +776,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
>>   	icresp->hdr.pdo = 0;
>>   	icresp->hdr.plen = cpu_to_le32(icresp->hdr.hlen);
>>   	icresp->pfv = cpu_to_le16(NVME_TCP_PFV_1_0);
>> -	icresp->maxdata = 0xffff; /* FIXME: support r2t */
>> +	icresp->maxdata = cpu_to_le32(0xffff); /* FIXME: support r2t */
>>   	icresp->cpda = 0;
>>   	if (queue->hdr_digest)
>>   		icresp->digest |= NVME_TCP_HDR_DIGEST_ENABLE;
>
> This needs an actual fix, we need to send 0xffffffff as we don't have
> this any limitation..

Can I get an ACK for this for now?  I can also send the proper fix
on top then..

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] nvmet-tcp: fix endianess annotations
  2018-12-16 16:24     ` Christoph Hellwig
@ 2018-12-18  7:24       ` Sagi Grimberg
  0 siblings, 0 replies; 10+ messages in thread
From: Sagi Grimberg @ 2018-12-18  7:24 UTC (permalink / raw)



> Can I get an ACK for this for now?  I can also send the proper fix
> on top then..


Acked-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-12-18  7:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13  8:51 sparse fixes Christoph Hellwig
2018-12-13  8:51 ` [PATCH 1/3] nvmet-tcp: fix endianess annotations Christoph Hellwig
2018-12-13 16:42   ` Sagi Grimberg
2018-12-13 20:10     ` Christoph Hellwig
2018-12-16 16:24     ` Christoph Hellwig
2018-12-18  7:24       ` Sagi Grimberg
2018-12-13  8:51 ` [PATCH 2/3] " Christoph Hellwig
2018-12-13 16:42   ` Sagi Grimberg
2018-12-13  8:51 ` [PATCH 3/3] nvme-pci: refactor nvme_poll_irqdisable to make sparse happy Christoph Hellwig
2018-12-13 16:43   ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.