linux-mips
[Top] [All Lists]

MIPS: [raw_]smp_processor_id uses current_thread_info

To: linux-mips@linux-mips.org
Subject: MIPS: [raw_]smp_processor_id uses current_thread_info
From: Randy MacLeod <rwmacleod@gmail.com>
Date: Wed, 23 Sep 2009 14:27:26 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; 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; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OJ5Jc7/SFKAd6uzvTV64BizVEpYeAIzTiW8TNMo1eOVdijZluHBmYA3wc2s+sWk6G5 LamUoKhMm++RWgBehffqSpcMmS8wLdgF9jCmQI60yPexNWkU4Kx8lygL4mEaWxn67x5y ZU4/3BQvcgC6KZDqudcVsQQwNo9gIXqvazsP8=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Hi,

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
sane.

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?

Thanks,
-- 
../Randy/..

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