[Top] [All Lists]

MIPS: [raw_]smp_processor_id uses current_thread_info

Subject: MIPS: [raw_]smp_processor_id uses current_thread_info
From: Randy MacLeod <>
Date: Wed, 23 Sep 2009 14:27:26 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=VWSkP4KCQxMT/NjDYaAjz9uPHgC7XesJCJjIV0jGt5A=; b=tp1cG7ZhEE8zMOnC7OavkXfGlNa/YqGQgajLlM2JM62kOYkfoLcpLJsHZAo8ak+dqi mqK8aYSnuaEPevqP+6PWibu+jpg1HHxbK+XRX1f57CVIVwWpiutAksZHtIzN0+XJgHkC xIdYr519LlL5cjn1crDRXR5zZQUQqbFCGX6a8=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OJ5Jc7/SFKAd6uzvTV64BizVEpYeAIzTiW8TNMo1eOVdijZluHBmYA3wc2s+sWk6G5 LamUoKhMm++RWgBehffqSpcMmS8wLdgF9jCmQI60yPexNWkU4Kx8lygL4mEaWxn67x5y ZU4/3BQvcgC6KZDqudcVsQQwNo9gIXqvazsP8=
Original-recipient: rfc822;

I'd like advice on changing the implementation of smp_processor_id on
Cavium specifically and/or MIPS generally.

Currently we have: arch/mips/include/asm/smp.h
#define raw_smp_processor_id() (current_thread_info()->cpu)

A co-worker has an issue where the current thread pointer is corrupted
on a Cavium MIPS system running 2.6.14 (but the same code exists in 2.6.31).
During the resulting panic() the kernel calls smp_processor_id()
which dereferences the corrupt task pointer again - ouch. I've notice that
other arches have raw_smp_processor_id() defined to
 - a platform specific register read, or
 - a percpu variable or
 - have a hard_smp_processor_id() defined
This last one is presumably for times when you don't trust the kernel
data structures to be

I can create a patch that calls cvmx_get_core_num(); for cavium.
Is there a more generic way to get the cpu number on MIPS?


<Prev in Thread] Current Thread [Next in Thread>