From patchwork Tue May 29 05:28:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: bill4carson@gmail.com X-Patchwork-Id: 161658 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CD49AB6FAC for ; Tue, 29 May 2012 15:29:04 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SZEwI-0001BZ-Vg; Tue, 29 May 2012 05:25:51 +0000 Received: from mail-vb0-f49.google.com ([209.85.212.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SZEwF-0001AN-2g for linux-arm-kernel@lists.infradead.org; Tue, 29 May 2012 05:25:47 +0000 Received: by vbbfo1 with SMTP id fo1so2668720vbb.36 for ; Mon, 28 May 2012 22:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=vAKCWKQu95gVNupm8EaCNnwh9akjEC7ukRIjmmDepvk=; b=aaYsHAyPAM+yQxKt2D9eRW1vLO8/V/KNwdAF0zcv/iEy70rnu0zedzUYTx/QHGbcuu IeiaxvA15eylDnCvZnDQxuCcefpAkMYKefnwb9NNoBnKgr+o5FVbcm/oprV8Abean5R5 aYgRMdbZIpmVzyP7poaSxTB9PTYAHQRfylrHK4C/2HMIGoS8pCU/LjoKApd20hYR3Vj0 1QxWN9kPjcMcXmoVASjXuO3g0pIfXS3U9+3j1/CEaBKHhRyOOOYWJ3Xl3JToBDZ5jkqj SD0eCVSc4U6EO4twBJpX7JBQ4+SYuVNRdc8tZ9kFckHLQj2XdNdnNbP7LsC7rb6DwnVo OeWw== Received: by 10.220.226.68 with SMTP id iv4mr11327448vcb.21.1338269145364; Mon, 28 May 2012 22:25:45 -0700 (PDT) Received: from [128.224.163.200] ([61.148.56.138]) by mx.google.com with ESMTPS id ek5sm22618324vdb.5.2012.05.28.22.25.41 (version=SSLv3 cipher=OTHER); Mon, 28 May 2012 22:25:44 -0700 (PDT) Message-ID: <4FC45E6B.2070202@gmail.com> Date: Tue, 29 May 2012 13:28:11 +0800 From: bill4carson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Will Deacon Subject: Re: Query about: ARM11 MPCore: preemption/task migration cache coherency References: <4FAA34A9.5020708@gmail.com> <20120511085150.GA17453@mudshark.cambridge.arm.com> In-Reply-To: <20120511085150.GA17453@mudshark.cambridge.arm.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (bill4carson[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: "gdavis@mvista.com" , Catalin Marinas , arm-mail-list X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org On 2012年05月11日 16:51, Will Deacon wrote: > Bill, > > On Wed, May 09, 2012 at 10:11:05AM +0100, bill4carson wrote: >> I'm using ARM11 MPCore on linux-2.6.34, unfortunately I have random >> panic/segment fault with task migration. I noticed a patch set >> [ARM11 MPCore: preemption/task migration cache coherency fixups] to fix >> such issues in here: >> >> http://lists.infradead.org/pipermail/linux-arm-kernel/2011-October/069851.html >> >> It seems there is no follow ups, is there official patch to fix such >> issues? > > Let's be honest: you haven't given us a lot to go on here. Perhaps you could > answer the following? > > (1) Do you experience the same issues with a more recent kernel? > (2) If you apply the patches linked to above, does it fix your problem? > (3) If you can reproduce on current mainline, do you have a testcase? > (4) Does disabling CONFIG_PREEMPT make the problem disappear? > > That should provide us with some information about the problem. > Based on the limitation of CP15 of ARM11 MPCore: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0228a/index.html The ARM11 MPCore SCU does not handle coherency consequences of CP15 cache operations like clean and invalidate. If these operations are performed on one CPU, they do not affect the state of a cache line on a different CPU. This can result in unexpected behavior if, say, a line is cleaned/invalidated but a subsequent access hits a stale copy in another CPU’s L1 through snooping the ‘coherency domain’. Kernel option CONFIG_DMA_CACHE_RWFO was introduced to fix it. details see arch/arm/mm/cache-v6.S: ... #ifdef CONFIG_DMA_CACHE_RWFO ldr r2, [r0] @ read for ownership str r2, [r0] @ write for ownership #endif ... I think: 1) The similar protection was not added on data cache handlers like v6_coherent_kern_range and v6_flush_kern_cache_all. Here I modified v6_coherent_kern_range as: But I have no idea on how to accomplish the v6_flush_kern_cache_all, maybe IPI is needed? Any opinions? And, with this little patch above, a strange issue on my side did *disappeared*. The issue is when enable task migration, some strange error may occurred like Segmentation fault and: *** glibc detected *** cat: munmap_chunk(): invalid pointer: 0xbeaa0f13 *** [10870.314465] Unhandled fault: alignment exception (0x821) at 0xebfffee6 [10870.315347] Unhandled fault: alignment exception (0x821) at 0xebfffee6 [10870.354917] Unhandled fault: alignment exception (0x821) at 0xebfffee6 cat: invalid number 'cat' cat: invalid number 'cat' cat: invalid number 'cat' cat: invalid number 'cat' cat: ����: No such file or directory cat: �˾�˾: No such file or directory cat: can't open ' *D_fo|�����': No such file or directory cat: applet not found cat: (null): Invalid argument cat: (null): Bad address cat: (null): Bad address cat: o��o��: No such file or directory cat: applet not found cat: ������: No such file or directory cat: unknown user /busybox cat: ?��?��: No such file or directory cat: applet not found cat: ���$���: Bad address cat: ������: Bad address cat: ����: Bad address [13758.255564] Alignment trap: not handling instruction e1a00001 at [<00033e38>] [13758.256459] Alignment trap: not handling instruction e1a00001 at [<00033e38>] [13758.256522] Unhandled fault: alignment exception (0x811) at 0x0019f1aa [13758.319272] Alignment trap: not handling instruction e1a00001 at [<00033e38>] [13758.340860] Unhandled fault: alignment exception (0x811) at 0x0019f1aa [13758.361612] Unhandled fault: alignment exception (0x811) at 0x0019f1aa --- a/arch/arm/mm/cache-v6.S +++ b/arch/arm/mm/cache-v6.S @@ -170,6 +170,10 @@ ENDPROC(v6_coherent_kern_range) ENTRY(v6_flush_kern_dcache_area) add r1, r0, r1 1: +#ifdef CONFIG_SMP + ldr r2, [r0] @ read for ownership + str r2, [r0] @ write for ownership +#endif /* CONFIG_SMP */ #ifdef HARVARD_CACHE mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line #else