[prev in list] [next in list] [prev in thread] [next in thread]
List: lhcs-devel
Subject: [lhcs-devel] Re: fix for physical cpu add
From: Rusty Russell <rusty () rustcorp ! com ! au>
Date: 2004-03-18 4:31:55
Message-ID: 1079584314.19029.200.camel () bach
[Download RAW message or body]
On Thu, 2004-03-18 at 10:10, Ashok Raj wrote:
> Hi Rusty
>
> We are experimenting with physical cpu add, and as a first step we did this
>
> - boot with maxcpus=2 on a 4 cpu system.
> - for the time being, phys_cpu_present_map in IA64 is set (i.e cpu_possible)
> will be true, and hence the control files for sysfs will also be created
> during topology_init()
> - now we try to bringup the cpu via echo 1> online
>
> I hit the BUG check in arch/ia64/kernel/setup.c function cpu_init() line
> 626, when the check for idle task is done.
>
> If (current->mm)
> BUG()
>
> The issue is when we do echo, its not called from a kernel thread, hence
> current->mm is not null. I did the following and that seems to get over the
> problem, and now we are able to do cpu_up on a new cpu that was not started
> during the boot time. I have only tested this on IA64, but seems like it
> would be a generic problem.
Hi Ashok,
This is one reasons why the PPC64 code generates all the threads at
boot. But your problem is a little worse: the idle thread would inherit
other things from the echo command. I recommend you use schedule_work()
to create a thread from keventd, which will be clean.
struct create_idle
{
struct task_struct *idle;
struct completion done;
}
static int do_idle(void *_ci)
{
struct create_idle *ci = _ci;
ci->idle = current;
complete(&ci->done);
for (;;)
idle();
}
static void create_idle(void *_ci)
{
int ret;
ret = kernel_thread(do_idle, _ci, CLONE_KERNEL|CLONE_IDLETASK);
if (ret < 0) {
struct create_idle *ci = _ci;
ci->idle = ERR_PTR(ret);
complete(&ci->done);
}
}
struct create_idle ci;
init_completion(&ci.done);
DECLARE_WORK(work, create_idle, &ci);
schedule_work(work);
wait_for_completion(&ci.done);
Code is, of course, untested...
Hope that helps,
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
lhcs-devel mailing list
lhcs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lhcs-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic