From patchwork Mon Nov 19 06:16:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhong X-Patchwork-Id: 199930 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 65CAC2C0333 for ; Mon, 19 Nov 2012 17:17:26 +1100 (EST) Received: from e28smtp05.in.ibm.com (e28smtp05.in.ibm.com [122.248.162.5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e28smtp05.in.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EB28F2C0085 for ; Mon, 19 Nov 2012 17:16:59 +1100 (EST) Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Nov 2012 11:46:56 +0530 Received: from d28relay02.in.ibm.com (9.184.220.59) by e28smtp05.in.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Nov 2012 11:46:53 +0530 Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qAJ6Grea26935470 for ; Mon, 19 Nov 2012 11:46:53 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qAJBinn7007718 for ; Mon, 19 Nov 2012 22:44:50 +1100 Received: from [9.123.247.185] ([9.123.247.185]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id qAJBibmE006952 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Mon, 19 Nov 2012 22:44:44 +1100 Message-ID: <1353305799.3694.9.camel@ThinkPad-T5421.cn.ibm.com> Subject: [RFC PATCH powerpc ] Protect smp_processor_id() in arch_spin_unlock_wait() From: Li Zhong To: PowerPC email list Date: Mon, 19 Nov 2012 14:16:39 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 x-cbid: 12111906-8256-0000-0000-00000513EE9D Cc: "Paul E. McKenney" , Paul Mackerras X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This patch tries to disable preemption for using smp_processor_id() in arch_spin_unlock_wait(), to avoid following report: [ 17.279377] BUG: using smp_processor_id() in preemptible [00000000] code: autorun/1024 [ 17.279407] caller is .arch_spin_unlock_wait+0x34/0x80 [ 17.279415] Call Trace: [ 17.279423] [c00000000911fb30] [c000000000015230] .show_stack+0x70/0x1c0 (unreliable) [ 17.279441] [c00000000911fbe0] [c0000000003e13b0] .debug_smp_processor_id+0x110/0x130 [ 17.279455] [c00000000911fc80] [c00000000004c2b4] .arch_spin_unlock_wait+0x34/0x80 [ 17.279470] [c00000000911fd00] [c0000000000b0e50] .task_work_run+0x80/0x160 [ 17.279482] [c00000000911fdb0] [c000000000018744] .do_notify_resume+0x94/0xa0 [ 17.279495] [c00000000911fe30] [c000000000009d1c] .ret_from_except_lite+0x48/0x4c Reported-by: Paul E. McKenney Signed-off-by: Li Zhong --- arch/powerpc/lib/locks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c index bb7cfec..7a7c31b 100644 --- a/arch/powerpc/lib/locks.c +++ b/arch/powerpc/lib/locks.c @@ -72,8 +72,10 @@ void arch_spin_unlock_wait(arch_spinlock_t *lock) { while (lock->slock) { HMT_low(); + preempt_disable(); if (SHARED_PROCESSOR) __spin_yield(lock); + preempt_enable(); } HMT_medium(); }