lkml.org 
[lkml]   [2005]   [Nov]   [30]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Fastboot] Re: [PATCH 1/4] stack overflow safe kdump (i386) - safe_smp_processor_id
FromFernando Luis Vazquez Cao <>
DateWed, 30 Nov 2005 16:32:46 +0900
On Mon, 2005-11-28 at 21:16 -0700, Eric W. Biederman wrote: 
> Andi Kleen <ak@suse.de> writes:
> 
> > Fernando Luis Vazquez Cao <fernando@intellilink.co.jp> writes:
> >> 
> >> To circumvent this problem I suggest implementing
> >> "safe_smp_processor_id()" (it already exists on x86_64) for i386 and
> >> IA64 and use it as a replacement to smp_processor_id in the reboot path
> >> to the dump capture kernel. This is a possible implementation for i386.
> >
> > It's not fully safe, because a SMP kernel might run on a 32bit
> > system without APIC. Then hard_smp_processor_id() would fault. 
> > (this cannot happen on x86-64)
> >
> > You probably need to check one of the globals set by apic.c
> > when its disabled.
> 
> Right.  An SMP kernel on a uniprocessor, without apics.
> 
> To my knowledge all SMP systems that linux supports have
> apics.

Thank you for the comments. I have modified safe_smp_processor_id so
that it now checks whether APICs are enabled before using
hard_smp_processor_id. Would this check suffice?

int safe_smp_processor_id(void) {
        int apicid, cpuid;
        if (!boot_cpu_has(X86_FEATURE_APIC))
                return 0;
        apicid = hard_smp_processor_id();
        if (apicid == BAD_APICID)
                return 0;
        cpuid = convert_apicid_to_cpu(apicid);

        return cpuid >= 0 ? cpuid : 0;
}
I will be resending the stack overflow patches reflecting this change.
They should apply cleanly against kernel 2.6.15-rc3. I will send the nmi
handler-related patches separately once I have tested the code properly.

Regards,

Fernando

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-30 07:40    [from the cache]
©2003-2008