diff mbox

[v9,12/22] core/pci: Allow for serialized jobs

Message ID 1447295609-20446-13-git-send-email-gwshan@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Gavin Shan Nov. 12, 2015, 2:33 a.m. UTC
Currently, the PHB reset and PCI enumeration are done concurrently
on multiple CPU cores. The output messages are interleaved and not
readable enough. This adds a option to do the jobs in serialized
fashion for debugging purpose only.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 core/pci.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Daniel Axtens Nov. 30, 2015, 11:14 p.m. UTC | #1
Gavin Shan <gwshan@linux.vnet.ibm.com> writes:

> Currently, the PHB reset and PCI enumeration are done concurrently
> on multiple CPU cores. The output messages are interleaved and not
> readable enough. This adds a option to do the jobs in serialized
> fashion for debugging purpose only.

This looks good.

Out of idle curiousity, is there any reason we might want to serialise
everything? Would it be lots of work to make an option to serialise all
the concurrent jobs done through __cpu_queue_job()?

Gavin, I'm not suggesting that you have to actually write the code to do
this! :) At this point I'm just interested to know if it's easy to do or
if it would be difficult, and if Stewart thinks it might be worthwhile.

Regards,
Daniel

>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
>  core/pci.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/core/pci.c b/core/pci.c
> index 54509c6..22a4675 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -22,6 +22,8 @@
>  #include <device.h>
>  #include <fsp.h>
>  
> +//#define PCI_SERIALIZED_JOBS
> +
>  #define MAX_PHB_ID	256
>  static struct phb *phbs[MAX_PHB_ID];
>  
> @@ -1471,6 +1473,7 @@ void pci_reset(void)
>  	}
>  }
>  
> +#ifndef PCI_SERIALIZED_JOBS
>  static void pci_do_jobs(void (*fn)(void *))
>  {
>  	struct cpu_job **jobs;
> @@ -1502,16 +1505,33 @@ static void pci_do_jobs(void (*fn)(void *))
>  	}
>  	free(jobs);
>  }
> +#endif /* !PCI_SERIALIZED_JOBS */
>  
>  void pci_init_slots(void)
>  {
>  	unsigned int i;
>  
> +#ifdef PCI_SERIALIZED_JOBS
> +	prlog(PR_NOTICE, "PCI: Resetting PHBs...\n");
> +	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
> +		if (!phbs[i])
> +			continue;
> +		pci_reset_phb(phbs[i]);
> +	}
> +
> +	prlog(PR_NOTICE, "PCI: Probing slots...\n");
> +	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
> +		if (!phbs[i])
> +			continue;
> +		pci_scan_phb(phbs[i]);
> +	}
> +#else
>  	prlog(PR_NOTICE, "PCI: Resetting PHBs...\n");
>  	pci_do_jobs(pci_reset_phb);
>  
>  	prlog(PR_NOTICE, "PCI: Probing slots...\n");
>  	pci_do_jobs(pci_scan_phb);
> +#endif
>  
>  	if (platform.pci_probe_complete)
>  		platform.pci_probe_complete();
> -- 
> 2.1.0
>
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
diff mbox

Patch

diff --git a/core/pci.c b/core/pci.c
index 54509c6..22a4675 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -22,6 +22,8 @@ 
 #include <device.h>
 #include <fsp.h>
 
+//#define PCI_SERIALIZED_JOBS
+
 #define MAX_PHB_ID	256
 static struct phb *phbs[MAX_PHB_ID];
 
@@ -1471,6 +1473,7 @@  void pci_reset(void)
 	}
 }
 
+#ifndef PCI_SERIALIZED_JOBS
 static void pci_do_jobs(void (*fn)(void *))
 {
 	struct cpu_job **jobs;
@@ -1502,16 +1505,33 @@  static void pci_do_jobs(void (*fn)(void *))
 	}
 	free(jobs);
 }
+#endif /* !PCI_SERIALIZED_JOBS */
 
 void pci_init_slots(void)
 {
 	unsigned int i;
 
+#ifdef PCI_SERIALIZED_JOBS
+	prlog(PR_NOTICE, "PCI: Resetting PHBs...\n");
+	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
+		if (!phbs[i])
+			continue;
+		pci_reset_phb(phbs[i]);
+	}
+
+	prlog(PR_NOTICE, "PCI: Probing slots...\n");
+	for (i = 0; i < ARRAY_SIZE(phbs); i++) {
+		if (!phbs[i])
+			continue;
+		pci_scan_phb(phbs[i]);
+	}
+#else
 	prlog(PR_NOTICE, "PCI: Resetting PHBs...\n");
 	pci_do_jobs(pci_reset_phb);
 
 	prlog(PR_NOTICE, "PCI: Probing slots...\n");
 	pci_do_jobs(pci_scan_phb);
+#endif
 
 	if (platform.pci_probe_complete)
 		platform.pci_probe_complete();