Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline
@ 2024-06-05  7:54 Hongchen Zhang
  2024-06-12  4:51 ` Huacai Chen
  2024-06-12 18:08 ` Markus Elfring
  0 siblings, 2 replies; 4+ messages in thread
From: Hongchen Zhang @ 2024-06-05  7:54 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-kernel, loongarch, Hongchen Zhang, stable,
	Huacai Chen

When the best selected CPU is offline, work_on_cpu() will stuck forever.
This can be happen if a node is online while all its CPUs are offline
(we can use "maxcpus=1" without "nr_cpus=1" to reproduce it), Therefore,
in this case, we should call local_pci_probe() instead of work_on_cpu().

Cc: <stable@vger.kernel.org>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
---
v1 -> v2 Added the method to reproduce this issue
---
 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index af2996d0d17f..32a99828e6a3 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -386,7 +386,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
 		free_cpumask_var(wq_domain_mask);
 	}
 
-	if (cpu < nr_cpu_ids)
+	if ((cpu < nr_cpu_ids) && cpu_online(cpu))
 		error = work_on_cpu(cpu, local_pci_probe, &ddi);
 	else
 		error = local_pci_probe(&ddi);
-- 
2.33.0


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

* Re: [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline
  2024-06-05  7:54 [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline Hongchen Zhang
@ 2024-06-12  4:51 ` Huacai Chen
  2024-06-12 18:08 ` Markus Elfring
  1 sibling, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2024-06-12  4:51 UTC (permalink / raw)
  To: Hongchen Zhang
  Cc: Bjorn Helgaas, linux-pci, linux-kernel, loongarch, stable,
	Huacai Chen

Hi, Hongchen,

It seems you forgot to update the title which I have pointed out. :)

And Bjorn,

Could you please take some time to review this patch? Thank you.

Huacai

On Wed, Jun 5, 2024 at 3:54 PM Hongchen Zhang <zhanghongchen@loongson.cn> wrote:
>
> When the best selected CPU is offline, work_on_cpu() will stuck forever.
> This can be happen if a node is online while all its CPUs are offline
> (we can use "maxcpus=1" without "nr_cpus=1" to reproduce it), Therefore,
> in this case, we should call local_pci_probe() instead of work_on_cpu().
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
> ---
> v1 -> v2 Added the method to reproduce this issue
> ---
>  drivers/pci/pci-driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index af2996d0d17f..32a99828e6a3 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -386,7 +386,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
>                 free_cpumask_var(wq_domain_mask);
>         }
>
> -       if (cpu < nr_cpu_ids)
> +       if ((cpu < nr_cpu_ids) && cpu_online(cpu))
>                 error = work_on_cpu(cpu, local_pci_probe, &ddi);
>         else
>                 error = local_pci_probe(&ddi);
> --
> 2.33.0
>
>

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

* Re: [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline
  2024-06-05  7:54 [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline Hongchen Zhang
  2024-06-12  4:51 ` Huacai Chen
@ 2024-06-12 18:08 ` Markus Elfring
  2024-06-13  2:20   ` Hongchen Zhang
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2024-06-12 18:08 UTC (permalink / raw)
  To: Hongchen Zhang, Huacai Chen, linux-pci, loongarch, Bjorn Helgaas
  Cc: stable, LKML> This can be happen if a node is online while all its CPUs are offline
> (we can use "maxcpus=1" without "nr_cpus=1" to reproduce it), Therefore,
> in this case, we should call local_pci_probe() instead of work_on_cpu().

* Please take text layout concerns a bit better into account also according to
  the usage of paragraphs.
  https://elixir.bootlin.com/linux/v6.10-rc3/source/Documentation/process/maintainer-tip.rst#L128

* Please improve the change description with an imperative wording.
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc3#n94

* Would you like to add the tag “Fixes” accordingly?

* How do you think about to specify the name of the affected function
  in the summary phrase?


Regards,
Markus

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

* Re: [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline
  2024-06-12 18:08 ` Markus Elfring
@ 2024-06-13  2:20   ` Hongchen Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Hongchen Zhang @ 2024-06-13  2:20 UTC (permalink / raw)
  To: Markus Elfring, Huacai Chen, linux-pci, loongarch, Bjorn Helgaas
  Cc: stable, LKML

Hi Markus,
   Thanks for your review.

On 2024/6/13 上午2:08, Markus Elfring wrote:
> …
>> This can be happen if a node is online while all its CPUs are offline
>> (we can use "maxcpus=1" without "nr_cpus=1" to reproduce it), Therefore,
>> in this case, we should call local_pci_probe() instead of work_on_cpu().
> 
> * Please take text layout concerns a bit better into account also according to
>    the usage of paragraphs.
>    https://elixir.bootlin.com/linux/v6.10-rc3/source/Documentation/process/maintainer-tip.rst#L128OK, Let rewrite the commit message.
> * Please improve the change description with an imperative wording.
>    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc3#n94
OK, Let me use imperative word.
> * Would you like to add the tag “Fixes” accordingly?
OK, Let me add Fixes.
> * How do you think about to specify the name of the affected function
>    in the summary phrase?
OK, Let me add the affected function in summary phrase.

> 
> Regards,
> Markus
> 


-- 
Best Regards
Hongchen Zhang


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

end of thread, other threads:[~2024-06-13  2:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05  7:54 [PATCH v2] PCI: use local_pci_probe when best selected cpu is offline Hongchen Zhang
2024-06-12  4:51 ` Huacai Chen
2024-06-12 18:08 ` Markus Elfring
2024-06-13  2:20   ` Hongchen Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox