linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] nvme-pci: refresh visible attrs after being checked
@ 2025-06-13 19:21 André Almeida
  2025-06-13 19:24 ` André Almeida
  2025-06-30  6:45 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: André Almeida @ 2025-06-13 19:21 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni, linux-nvme
  Cc: linux-kernel, kernel-dev, Eugen Hristev, André Almeida

From: Eugen Hristev <eugen.hristev@collabora.com>

The sysfs attributes are registered early, but the driver does not
know whether they are needed or not at that moment.
For the cmb attributes, commit
e917a849c3fc ("nvme-pci: refresh visible attrs for cmb attributes")
solved this problem by calling `nvme_update_attrs` after mapping the cmb.
However the issue persists for the hmb attributes.
To solve the problem, moved the call to `nvme_update_attrs` after
`nvme_setup_host_mem` is called, the one that sets up the hmb, in probe
and in reset_work functions.

Fixes: e917a849c3fc ("nvme-pci: refresh visible attrs for cmb attributes")
Fixes: 86adbf0cdb9e ("nvme: simplify transport specific device attribute handling")
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
This commit was reviewed a long time ago but was never merged. This is
just a resend rebased on top of v6.16-rc1.

v1: https://lore.kernel.org/lkml/01020191b7b7adc0-bca16d06-b051-4ce2-bfee-c8038a62462f-000000@eu-west-1.amazonses.com/
---
 drivers/nvme/host/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8ff12e415cb5..320aaa41ec39 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2101,8 +2101,6 @@ static void nvme_map_cmb(struct nvme_dev *dev)
 	if ((dev->cmbsz & (NVME_CMBSZ_WDS | NVME_CMBSZ_RDS)) ==
 			(NVME_CMBSZ_WDS | NVME_CMBSZ_RDS))
 		pci_p2pmem_publish(pdev, true);
-
-	nvme_update_attrs(dev);
 }
 
 static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
@@ -3010,6 +3008,8 @@ static void nvme_reset_work(struct work_struct *work)
 	if (result < 0)
 		goto out;
 
+	nvme_update_attrs(dev);
+
 	result = nvme_setup_io_queues(dev);
 	if (result)
 		goto out;
@@ -3343,6 +3343,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (result < 0)
 		goto out_disable;
 
+	nvme_update_attrs(dev);
+
 	result = nvme_setup_io_queues(dev);
 	if (result)
 		goto out_disable;
-- 
2.49.0



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

* Re: [PATCH RESEND] nvme-pci: refresh visible attrs after being checked
  2025-06-13 19:21 [PATCH RESEND] nvme-pci: refresh visible attrs after being checked André Almeida
@ 2025-06-13 19:24 ` André Almeida
  2025-06-30  6:45 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: André Almeida @ 2025-06-13 19:24 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni, linux-nvme
  Cc: linux-kernel, kernel-dev, Eugen Hristev

+CC current Eugen mail address

Em 13/06/2025 16:21, André Almeida escreveu:
> From: Eugen Hristev <eugen.hristev@collabora.com>
> 
> The sysfs attributes are registered early, but the driver does not
> know whether they are needed or not at that moment.
> For the cmb attributes, commit
> e917a849c3fc ("nvme-pci: refresh visible attrs for cmb attributes")
> solved this problem by calling `nvme_update_attrs` after mapping the cmb.
> However the issue persists for the hmb attributes.
> To solve the problem, moved the call to `nvme_update_attrs` after
> `nvme_setup_host_mem` is called, the one that sets up the hmb, in probe
> and in reset_work functions.
> 
> Fixes: e917a849c3fc ("nvme-pci: refresh visible attrs for cmb attributes")
> Fixes: 86adbf0cdb9e ("nvme: simplify transport specific device attribute handling")
> Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> This commit was reviewed a long time ago but was never merged. This is
> just a resend rebased on top of v6.16-rc1.
> 
> v1: https://lore.kernel.org/lkml/01020191b7b7adc0-bca16d06-b051-4ce2-bfee-c8038a62462f-000000@eu-west-1.amazonses.com/
> ---
>   drivers/nvme/host/pci.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 8ff12e415cb5..320aaa41ec39 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2101,8 +2101,6 @@ static void nvme_map_cmb(struct nvme_dev *dev)
>   	if ((dev->cmbsz & (NVME_CMBSZ_WDS | NVME_CMBSZ_RDS)) ==
>   			(NVME_CMBSZ_WDS | NVME_CMBSZ_RDS))
>   		pci_p2pmem_publish(pdev, true);
> -
> -	nvme_update_attrs(dev);
>   }
>   
>   static int nvme_set_host_mem(struct nvme_dev *dev, u32 bits)
> @@ -3010,6 +3008,8 @@ static void nvme_reset_work(struct work_struct *work)
>   	if (result < 0)
>   		goto out;
>   
> +	nvme_update_attrs(dev);
> +
>   	result = nvme_setup_io_queues(dev);
>   	if (result)
>   		goto out;
> @@ -3343,6 +3343,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   	if (result < 0)
>   		goto out_disable;
>   
> +	nvme_update_attrs(dev);
> +
>   	result = nvme_setup_io_queues(dev);
>   	if (result)
>   		goto out_disable;



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

* Re: [PATCH RESEND] nvme-pci: refresh visible attrs after being checked
  2025-06-13 19:21 [PATCH RESEND] nvme-pci: refresh visible attrs after being checked André Almeida
  2025-06-13 19:24 ` André Almeida
@ 2025-06-30  6:45 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-06-30  6:45 UTC (permalink / raw)
  To: André Almeida
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	Chaitanya Kulkarni, linux-nvme, linux-kernel, kernel-dev,
	Eugen Hristev

Thanks,

applied to nvme-6.16.



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

end of thread, other threads:[~2025-06-30  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13 19:21 [PATCH RESEND] nvme-pci: refresh visible attrs after being checked André Almeida
2025-06-13 19:24 ` André Almeida
2025-06-30  6:45 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).