Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Keith Busch <kbusch@meta.com>
Cc: "martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"joshi.k@samsung.com" <joshi.k@samsung.com>,
	Keith Busch <kbusch@kernel.org>, David Wei <dw@davidwei.uk>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH] nvme: module parameter to disable pi checks
Date: Wed, 23 Oct 2024 20:01:43 +0000	[thread overview]
Message-ID: <cb19f610-b6b3-4dde-9d1a-88446dc0615f@nvidia.com> (raw)
In-Reply-To: <20241023155048.634988-1-kbusch@meta.com>

On 10/23/24 08:50, Keith Busch wrote:
>   
> +static bool disable_pi = false;
> +module_param(disable_pi, bool, 0444);
> +MODULE_PARM_DESC(disable_pi, "disable protection-information if used");
> +
>   /*
>    * nvme_wq - hosts nvme related works that are not reset or delete
>    * nvme_reset_wq - hosts nvme reset works
> @@ -1763,6 +1767,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
>   		struct queue_limits *lim, struct nvme_ns_info *info)
>   {
>   	struct blk_integrity *bi = &lim->integrity;
> +	int pi_type = head->pi_type;
>   
>   	memset(bi, 0, sizeof(*bi));
>   
> @@ -1777,7 +1782,10 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
>   	    !(head->features & NVME_NS_METADATA_SUPPORTED))
>   		return nvme_ns_has_pi(head);
>   
> -	switch (head->pi_type) {
> +	if (disable_pi)
> +		pi_type = 0;
> +
> +	switch (pi_type) {
>   	case NVME_NS_DPS_PI_TYPE3:
>   		switch (head->guard_type) {
>   		case NVME_NVM_NS_16B_GUARD:

may be we can get rid of the local var pi_type ? totally untested [1].

Irrespective of that :-

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck

[1]

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2f3b3911bce4..d587f541937e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1758,7 +1758,6 @@ static bool nvme_init_integrity(struct 
nvme_ns_head *head,
                 struct queue_limits *lim, struct nvme_ns_info *info)
  {
         struct blk_integrity *bi = &lim->integrity;
-       int pi_type = head->pi_type;

         memset(bi, 0, sizeof(*bi));

@@ -1774,9 +1773,9 @@ static bool nvme_init_integrity(struct 
nvme_ns_head *head,
                 return nvme_ns_has_pi(head);

         if (disable_pi)
-               pi_type = 0;
+               goto out;

-       switch (pi_type) {
+       switch (head->pi_type) {
         case NVME_NS_DPS_PI_TYPE3:
                 switch (head->guard_type) {
                 case NVME_NVM_NS_16B_GUARD:
@@ -1816,6 +1815,7 @@ static bool nvme_init_integrity(struct 
nvme_ns_head *head,
                 break;
         }

+out:
         bi->tuple_size = head->ms;
         bi->pi_offset = info->pi_offset;
         return true;



  reply	other threads:[~2024-10-23 20:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20241023162331epcas5p17398e6453b275a480ace5ae5a0176001@epcas5p1.samsung.com>
2024-10-23 15:50 ` [PATCH] nvme: module parameter to disable pi checks Keith Busch
2024-10-23 20:01   ` Chaitanya Kulkarni [this message]
2024-10-23 20:21     ` Keith Busch
2024-10-23 21:21       ` David Wei
2024-10-24  1:33         ` Tokunori Ikegami
2024-10-24  5:02   ` Christoph Hellwig
2024-10-24 15:23     ` Keith Busch
2024-10-24  6:10   ` Kanchan Joshi
2024-10-24 15:19     ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb19f610-b6b3-4dde-9d1a-88446dc0615f@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=dw@davidwei.uk \
    --cc=hch@lst.de \
    --cc=joshi.k@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox