John D. Ramsdell
2006-Jun-08 11:20 UTC
[Xen-devel] [RFC PATCH] Run the Mini-OS application in its own thread.
Some Xen developers have questioned why one would ever need to run a Mini-OS application before thread scheduling is enabled. I can see no reason to do it. If no one else can, I suggest each an application be a thread function that is started in kernel.c. The following patch to kernel.c sets up and runs the application in its own thread. Signed-of-by: John D. Ramsdell <ramsdell@mitre.org> diff -ur oxen-unstable/extras/mini-os/kernel.c xen-unstable/extras/mini-os/kernel.c --- oxen-unstable/extras/mini-os/kernel.c 2006-06-02 01:03:40.000000000 -0400 +++ xen-unstable/extras/mini-os/kernel.c 2006-06-07 17:39:52.000000000 -0400 @@ -82,17 +82,6 @@ } -void test_xenbus(void); - -/* Do initialisation from a thread once the scheduler''s available */ -static void init_xs(void *ign) -{ - init_xenbus(); - - test_xenbus(); -} - - u8 xen_features[XENFEAT_NR_SUBMAPS * 32]; void setup_xen_features(void) @@ -111,11 +100,13 @@ } } +void test_xenbus(void); + /* This should be overridden by the application we are linked against. */ -__attribute__((weak)) int app_main(start_info_t *si) +__attribute__((weak)) void app_main(void *si) { printk("Dummy main: start_info=%p\n", si); - return 0; + test_xenbus(); } /* @@ -183,11 +174,11 @@ /* Init scheduler. */ init_sched(); - /* Init XenBus from a separate thread */ - create_thread("init_xs", init_xs, NULL); + /* Init XenBus */ + init_xenbus(); - /* Call (possibly overridden) app_main() */ - app_main(&start_info); + /* Schedule the possibly overridden app_main() function */ + create_thread("app_main", app_main, &start_info); /* Everything initialised, start idle thread */ run_idle_thread(); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jacob Gorm Hansen
2006-Jun-08 12:03 UTC
[Xen-devel] Re: [RFC PATCH] Run the Mini-OS application in its own thread.
On 08 Jun 2006 07:20:26 -0400, John D. Ramsdell <ramsdell@mitre.org> wrote:> Some Xen developers have questioned why one would ever need to run a > Mini-OS application before thread scheduling is enabled. I can see no > reason to do it. If no one else can, I suggest each an application be > a thread function that is started in kernel.c.I can, when writing a boot-loader there is no need for multiple threads, so I would like the option of not having to start (and clean up after) any. Perhaps the last part of start_kernel() could be moved to a weak function, that people like me can override? Regards, Jacob _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John D. Ramsdell
2006-Jun-08 12:08 UTC
[Xen-devel] Re: [RFC PATCH] Run the Mini-OS application in its own thread.
"Jacob Gorm Hansen" <jacobg@diku.dk> writes:> I can, when writing a boot-loader there is no need for multiple > threads, so I would like the option of not having to start (and clean > up after) any.I see.> Perhaps the last part of start_kernel() could be moved to a weak > function, that people like me can override?I suggest we simply just leave kernel.c the way it is, and my patch be ignored. John _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel