Linux:To speed up the startup process by setting some modules to start in parallel.

The SPACEMIT_PARALLEL_BOOTING option can be enabled for use, but it is disabled by default.

This feature is designed to optimize the boot speed for the SPACEMIT platform.
Although it can improve boot time, it may potentially cause deadlocks during startup.
It is recommended to set the loglevel to 1 when using this feature.

Change-Id: I3bd76816253277182b44c5e999e9b9db3b3f4beb
This commit is contained in:
goumin 2024-11-13 10:15:42 +08:00 committed by zhangmeng
parent 95a1c2f54f
commit 71c8fbc69b
13 changed files with 87 additions and 3 deletions

View file

@ -610,6 +610,9 @@ static struct platform_driver adma_driver = {
.driver = {
.name = "k1x-adma",
.of_match_table = adma_id_table,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_FORCE_SYNCHRONOUS,
#endif
},
.probe = adma_probe,
.remove = adma_remove,
@ -688,6 +691,9 @@ static void rpmsg_adma_client_remove(struct rpmsg_device *rpdev)
static struct rpmsg_driver rpmsg_adma_client = {
.drv.name = KBUILD_MODNAME,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.drv.probe_type = PROBE_FORCE_SYNCHRONOUS,
#endif
.id_table = rpmsg_driver_adma_id_table,
.probe = rpmsg_adma_client_probe,
.callback = rpmsg_adma_client_cb,

View file

@ -1095,11 +1095,12 @@ struct platform_driver spacemit_hdmi_driver = {
.name = "spacemit-hdmi-drv",
.of_match_table = spacemit_hdmi_dt_ids,
.pm = &hdmi_pm_ops,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
};
// module_platform_driver(spacemit_hdmi_driver);
static int spacemit_hdmi_driver_init(void)
{
return platform_driver_register(&spacemit_hdmi_driver);

View file

@ -2078,6 +2078,9 @@ static struct platform_driver spacemit_i2c_driver = {
.name = "i2c-spacemit-k1x",
/* .pm = &spacemit_i2c_pm_ops, */
.of_match_table = spacemit_i2c_dt_match,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
};
@ -2118,6 +2121,9 @@ static struct platform_driver r_spacemit_i2c_driver = {
.name = "ri2c-spacemit-k1x",
/* .pm = &spacemit_i2c_pm_ops, */
.of_match_table = r_spacemit_i2c_dt_match,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
};

View file

@ -1264,6 +1264,9 @@ struct platform_driver k1x_ccic_driver = {
.driver = {
.name = K1X_CCIC_DRV_NAME,
.of_match_table = of_match_ptr(k1x_ccic_dt_match),
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
.probe = k1x_ccic_probe,
.remove = k1x_ccic_remove,

View file

@ -1896,6 +1896,9 @@ static struct platform_driver spacemit_sdhci_driver = {
.name = "sdhci-spacemit",
.of_match_table = of_match_ptr(sdhci_spacemit_of_match),
.pm = SDHCI_SPACEMIT_PMOPS,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
.probe = spacemit_sdhci_probe,
.remove_new = spacemit_sdhci_remove,

View file

@ -2875,6 +2875,9 @@ static struct platform_driver emac_driver = {
.name = DRIVER_NAME,
.of_match_table = of_match_ptr(emac_of_match),
.pm = &k1x_emac_pm_qos,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
};

View file

@ -1861,11 +1861,21 @@ static const struct dev_pm_ops k1x_pcie_pm_ops = {
};
static struct platform_driver k1x_pcie_driver = {
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe = k1x_pcie_probe,
#endif
.driver = {
.name = "k1x-dwc-pcie",
.of_match_table = of_k1x_pcie_match,
.suppress_bind_attrs = true,
.pm = &k1x_pcie_pm_ops,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
};
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
module_platform_driver(k1x_pcie_driver);
#else
builtin_platform_driver_probe(k1x_pcie_driver, k1x_pcie_probe);
#endif

View file

@ -679,6 +679,9 @@ static struct platform_driver spacemit_rproc_driver = {
.pm = &spacemit_rproc_pm_ops,
#endif
.of_match_table = spacemit_rproc_of_match,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_FORCE_SYNCHRONOUS,
#endif
},
};

View file

@ -2369,6 +2369,9 @@ static struct platform_driver serial_pxa_driver = {
#endif
.suppress_bind_attrs = true,
.of_match_table = serial_pxa_dt_ids,
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
#endif
},
};

View file

@ -1469,6 +1469,13 @@ menuconfig EXPERT
environments which can tolerate a "non-standard" kernel.
Only use this if you really know what you are doing.
config SPACEMIT_PARALLEL_BOOTING
bool "Enable SPACEMIT parallel booting of kernel modules" if EXPERT
default n
help
Enable parallel booting of kernel modules under SPACEMIT to improve boot speed.
Enabling this option may cause boot deadlocks in certain conditions.
config UID16
bool "Enable 16-bit UID system calls" if EXPERT
depends on HAVE_UID16 && MULTIUSER

View file

@ -22,7 +22,11 @@
const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
EXPORT_SYMBOL(raid6_empty_zero_page);
#endif
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/async.h>
#endif
struct raid6_calls raid6_call;
EXPORT_SYMBOL_GPL(raid6_call);
@ -289,7 +293,22 @@ static void raid6_exit(void)
do { } while (0);
}
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
static void raid6_select_algo_wrapper(void *data, long long unsigned int arg)
{
raid6_select_algo();
}
static int __init raid6_select_algo_async_init(void)
{
async_schedule(raid6_select_algo_wrapper, NULL);
return 0;
}
subsys_initcall(raid6_select_algo_async_init);
#else
subsys_initcall(raid6_select_algo);
#endif
module_exit(raid6_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("RAID6 Q-syndrome calculations");

View file

@ -121,6 +121,9 @@
#include <net/compat.h>
#include <trace/events/sock.h>
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
#include <linux/async.h>
#endif
/* The inetsw table contains everything that inet_create needs to
* build a new socket.
@ -2080,7 +2083,21 @@ out_unregister_tcp_proto:
goto out;
}
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
static void __init inet_init_async(void *data, async_cookie_t cookie)
{
inet_init();
}
static int __init inet_async_init(void)
{
async_schedule(inet_init_async, NULL);
return 0;
}
subsys_initcall(inet_async_init);
#else
fs_initcall(inet_init);
#endif
/* ------------------------------------------------------------------------ */

View file

@ -1382,6 +1382,9 @@ static struct platform_driver spacemit_snd_dma_pdrv = {
.driver = {
.name = "spacemit-snd-dma",
.of_match_table = of_match_ptr(spacemit_snd_dma_ids),
#ifdef CONFIG_SPACEMIT_PARALLEL_BOOTING
.probe_type = PROBE_FORCE_SYNCHRONOUS,
#endif
},
.probe = spacemit_snd_dma_pdev_probe,
.remove = spacemit_snd_dma_pdev_remove,