From patchwork Thu Mar 18 09:30:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 48013 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EE07BB7CFD for ; Thu, 18 Mar 2010 20:30:39 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751748Ab0CRJai (ORCPT ); Thu, 18 Mar 2010 05:30:38 -0400 Received: from hera.kernel.org ([140.211.167.34]:56827 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665Ab0CRJah (ORCPT ); Thu, 18 Mar 2010 05:30:37 -0400 Received: from htj.dyndns.org (localhost [127.0.0.1]) by hera.kernel.org (8.14.3/8.14.3) with ESMTP id o2I9UYVm006756 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 18 Mar 2010 09:30:35 GMT X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.95.2 at hera.kernel.org Received: from [127.0.0.2] (htj.dyndns.org [127.0.0.2]) by htj.dyndns.org (Postfix) with ESMTPSA id 18B901005AA59; Thu, 18 Mar 2010 18:30:34 +0900 (KST) Message-ID: <4BA1F2BA.30604@kernel.org> Date: Thu, 18 Mar 2010 18:30:34 +0900 From: Tejun Heo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100228 SUSE/3.0.3-1.1.1 Thunderbird/3.0.3 MIME-Version: 1.0 To: Frederic Weisbecker CC: Sparc , David Miller , LKML Subject: Re: [BUG] percpu misaligned allocation References: <20100318044930.GC5045@nowhere> In-Reply-To: <20100318044930.GC5045@nowhere> X-Enigmail-Version: 1.0.1 X-Spam-Status: No, score=-0.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_48_96 autolearn=no version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (hera.kernel.org [127.0.0.1]); Thu, 18 Mar 2010 09:30:36 +0000 (UTC) Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Hello, On 03/18/2010 01:49 PM, Frederic Weisbecker wrote: > Hi, > > While using the lock events through perf in a sparc box, I can see > the following message repeated many times: > > Kernel unaligned access at TPC[49357c] perf_trace_lock_acquire+0xb4/0x180 > > It actually hangs the box as the messages are sent to a serial console. > > When used with perf, the trace events use a per cpu buffer allocated > in kernel/trace/trace_event_perf.c, and the allocation appears to return > a misaligned percpu pointer. It is aligned to 4 while it seems it > requires to be aligned to 8. Does this fix the problem? diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c index c1cc3ab..d3f7d1b 100644 --- a/kernel/trace/trace_event_profile.c +++ b/kernel/trace/trace_event_profile.c @@ -27,13 +27,15 @@ static int ftrace_profile_enable_event(struct ftrace_event_call *event) return 0; if (!total_profile_count) { - buf = (char *)alloc_percpu(perf_trace_t); + buf = (char *)__alloc_percpu(sizeof(perf_trace_t), + __alignof__(unsigned long)); if (!buf) goto fail_buf; rcu_assign_pointer(perf_trace_buf, buf); - buf = (char *)alloc_percpu(perf_trace_t); + buf = (char *)__alloc_percpu(sizeof(perf_trace_t), + __alignof__(unsigned long)); if (!buf) goto fail_buf_nmi;