linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cpu_init is called during resume
@ 2006-08-31 13:55 Pavel Machek
  2006-08-31 16:11 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2006-08-31 13:55 UTC (permalink / raw)
  To: Andrew Morton, kernel list


cpu_init() is called during resume, at time when GFP_KERNEL is not
available. This silences warning, and adds few small cleanups.

Signed-off-by: Pavel Machek <pavel@suse.cz>

---
commit 0c23b1939d38a6bbdf1fd22078bd4fd3ec932c68
tree 66e19bcca9940e3cab2df78aaef010e51260cb9f
parent de9ee8a9c1e2cf18adee5d1569daa19deedc7c87
author <pavel@amd.ucw.cz> Thu, 31 Aug 2006 15:55:00 +0200
committer <pavel@amd.ucw.cz> Thu, 31 Aug 2006 15:55:00 +0200

 arch/i386/kernel/cpu/common.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 70c87de..d0565d3 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -591,10 +591,10 @@ void __init early_cpu_init(void)
 void __cpuinit cpu_init(void)
 {
 	int cpu = smp_processor_id();
-	struct tss_struct * t = &per_cpu(init_tss, cpu);
+	struct tss_struct *t = &per_cpu(init_tss, cpu);
 	struct thread_struct *thread = &current->thread;
 	struct desc_struct *gdt;
-	__u32 stk16_off = (__u32)&per_cpu(cpu_16bit_stack, cpu);
+	u32 stk16_off = (u32)&per_cpu(cpu_16bit_stack, cpu);
 	struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, cpu);
 
 	if (cpu_test_and_set(cpu, cpu_initialized)) {
@@ -629,7 +629,7 @@ void __cpuinit cpu_init(void)
 		/* alloc_bootmem_pages panics on failure, so no check */
 		memset(gdt, 0, PAGE_SIZE);
 	} else {
-		gdt = (struct desc_struct *)get_zeroed_page(GFP_KERNEL);
+		gdt = (struct desc_struct *)get_zeroed_page(GFP_ATOMIC);
 		if (unlikely(!gdt)) {
 			printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu);
 			for (;;)

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: cpu_init is called during resume
  2006-08-31 13:55 cpu_init is called during resume Pavel Machek
@ 2006-08-31 16:11 ` Jeremy Fitzhardinge
  2006-08-31 22:31   ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2006-08-31 16:11 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Andrew Morton, kernel list

Pavel Machek wrote:
> cpu_init() is called during resume, at time when GFP_KERNEL is not
> available. This silences warning, and adds few small cleanups.
>   

I presume this is resume from disk.  If you're doing resume from RAM, 
all the CPU-related stuff should already be allocated, unless you're 
bringing up a new CPU which wasn't previously there, right?

What's the call path for this on resume?  In my i386-pda patches, I've 
rearranged this so that the secondary CPU's GDT (and PDA) are 
pre-allocated on the boot CPU.  Does this help this case, or would they 
still need to be atomic allocations?

And wouldn't making these allocations atomic make real CPU hotplug (ie, 
on an active, running system) more likely to fail?  This code doesn't 
deal with allocation failure very elegantly.

    J

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

* Re: cpu_init is called during resume
  2006-08-31 16:11 ` Jeremy Fitzhardinge
@ 2006-08-31 22:31   ` Pavel Machek
  2006-08-31 23:52     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2006-08-31 22:31 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Andrew Morton, kernel list

Hi!

> >cpu_init() is called during resume, at time when GFP_KERNEL is not
> >available. This silences warning, and adds few small cleanups.
> >  
> 
> I presume this is resume from disk.  If you're doing resume from RAM, 
> all the CPU-related stuff should already be allocated, unless you're 
> bringing up a new CPU which wasn't previously there, right?

We are doing virtual cpu hotplug/unplug... actually suspend to RAM
*and* disk. Just try it :-).

> And wouldn't making these allocations atomic make real CPU hotplug (ie, 
> on an active, running system) more likely to fail?  This code doesn't 
> deal with allocation failure very elegantly.

Hmm... well hopefully free_pages_min will cover this case.
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: cpu_init is called during resume
  2006-08-31 22:31   ` Pavel Machek
@ 2006-08-31 23:52     ` Jeremy Fitzhardinge
  2006-09-02 11:21       ` Pavel Machek
  0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2006-08-31 23:52 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Andrew Morton, kernel list

Pavel Machek wrote:
> We are doing virtual cpu hotplug/unplug... actually suspend to RAM
> *and* disk. Just try it :-).
>   

Yes, I know, but if you're replugging a CPU it should already have a GDT 
allocated, so the kmalloc() won't be called in the resume case.  So if 
there's a problem, it can only be on the resume-from-disk path, on the 
assumption that that secondary CPU hasn't already been brought up.

    J

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

* Re: cpu_init is called during resume
  2006-08-31 23:52     ` Jeremy Fitzhardinge
@ 2006-09-02 11:21       ` Pavel Machek
  2006-09-03  0:00         ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2006-09-02 11:21 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: Andrew Morton, kernel list

On Thu 2006-08-31 16:52:42, Jeremy Fitzhardinge wrote:
> Pavel Machek wrote:
> >We are doing virtual cpu hotplug/unplug... actually suspend to RAM
> >*and* disk. Just try it :-).
> >  
> 
> Yes, I know, but if you're replugging a CPU it should already have a GDT 
> allocated, so the kmalloc() won't be called in the resume case.  So if 
> there's a problem, it can only be on the resume-from-disk path, on the 
> assumption that that secondary CPU hasn't already been brought up.

I think gdt is destroyed on cpu unplug, no? I guess I'll have to redo
my testing...

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

-- 
VGER BF report: H 0.410571

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

* Re: cpu_init is called during resume
  2006-09-02 11:21       ` Pavel Machek
@ 2006-09-03  0:00         ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2006-09-03  0:00 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Andrew Morton, kernel list

Pavel Machek wrote:
> I think gdt is destroyed on cpu unplug, no? I guess I'll have to redo
> my testing...
>   

No, I don't think it is.  arch/i386/cpu/common.c:cpu_uninit() doesn't 
free anything.

    J

-- 
VGER BF report: H 0

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

end of thread, other threads:[~2006-09-03  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-31 13:55 cpu_init is called during resume Pavel Machek
2006-08-31 16:11 ` Jeremy Fitzhardinge
2006-08-31 22:31   ` Pavel Machek
2006-08-31 23:52     ` Jeremy Fitzhardinge
2006-09-02 11:21       ` Pavel Machek
2006-09-03  0:00         ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).