From patchwork Tue Jul 16 11:07:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 2828063 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CFED49F967 for ; Tue, 16 Jul 2013 11:08:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86B6020158 for ; Tue, 16 Jul 2013 11:08:12 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3283620148 for ; Tue, 16 Jul 2013 11:08:11 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uz36v-00071D-9f; Tue, 16 Jul 2013 11:08:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uz36t-00007o-3U; Tue, 16 Jul 2013 11:07:59 +0000 Received: from caramon.arm.linux.org.uk ([78.32.30.218]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uz36q-00007F-VL for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2013 11:07:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=UzJ3JNq2VvJfgF5cr662hT+/aiZMQ5cWU8SRME00z7M=; b=YjG8mN/Cgsy+iydV09fuqkVlMoA7MKcJhe2bKkHqSyGgqZ6Cew+w1QRvVVVKdKcp8v6Kxd0ZhNDieDU3p379BBtmR2AZodfSo84tLi5f65XPXhzbAAhi8huJYN7em9ehnMvIlD+TuypI/bjoaKAX29B/a1ry9E6d9UAn954Yu3o=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:40632) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Uz36J-0008WJ-Gr; Tue, 16 Jul 2013 12:07:23 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1Uz36I-0006MP-9d; Tue, 16 Jul 2013 12:07:22 +0100 Date: Tue, 16 Jul 2013 12:07:21 +0100 From: Russell King - ARM Linux To: Alexander Kartashov Subject: Re: [PATCH] arm: align shared memory unconditionally to the SHMLBA boundary Message-ID: <20130716110721.GD24642@n2100.arm.linux.org.uk> References: <1361254269-3444-1-git-send-email-alekskartashov@parallels.com> <20130715173238.GJ1730@moon> <20130715180846.GV24642@n2100.arm.linux.org.uk> <20130715185739.GK1730@moon> <51E4DC0B.8040908@parallels.com> <20130716095349.GB16370@moon> <51E51EF1.3010104@parallels.com> <20130716103649.GC24642@n2100.arm.linux.org.uk> <51E524D1.2090504@parallels.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <51E524D1.2090504@parallels.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130716_070757_349750_B46D3BFA X-CRM114-Status: GOOD ( 16.43 ) X-Spam-Score: -4.7 (----) Cc: Cyrill Gorcunov , Andrey Vagin , linux-arm-kernel@lists.infradead.org, Pavel Emelyanov X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jul 16, 2013 at 02:47:45PM +0400, Alexander Kartashov wrote: > On 07/16/2013 02:36 PM, Russell King - ARM Linux wrote: >> shmget() doesn't allocate space in the process for the SHM region. It >> merely creates the shm memory and returns an identifier for it which can >> later be used by shmat() to map it. > Thank you for the correction, I meant shmat() in that comment indeed. > I'm sorry for the inconvenience. Right, so it appears that there's a difference between shmat() with an address and with a NULL address, because the enforcement is done by two completely different bits of code in unrelated parts of the kernel. I notice Sparc32 seems to have a fix for this along the lines of the (untested) patch below, so let's do the same on ARM. Please test this and let me know if this solves your problem. Thanks. arch/arm/include/asm/shmparam.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/shmparam.h b/arch/arm/include/asm/shmparam.h index a5223b3..843db59 100644 --- a/arch/arm/include/asm/shmparam.h +++ b/arch/arm/include/asm/shmparam.h @@ -1,16 +1,16 @@ #ifndef _ASMARM_SHMPARAM_H #define _ASMARM_SHMPARAM_H +#include + /* * This should be the size of the virtually indexed cache/ways, * or page size, whichever is greater since the cache aliases * every size/ways bytes. */ -#define SHMLBA (4 * PAGE_SIZE) /* attach addr a multiple of this */ +#define SHMLBA (cache_is_vipt_aliasing() ? (4 * PAGE_SIZE) : PAGE_SIZE) -/* - * Enforce SHMLBA in shmat - */ +/* Enforce SHMLBA in shmat */ #define __ARCH_FORCE_SHMLBA #endif /* _ASMARM_SHMPARAM_H */