From patchwork Fri Feb 8 10:55:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 1038566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Chx8dIL+"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="NsxINz1p"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43wsXk4Jngz9sLw for ; Fri, 8 Feb 2019 21:55:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=3E/CTMI48eEVWx06GugPsWAQSwEEK1Ecl9CSZ6bIMmw=; b=Chx 8dIL+dj5GsKLNxeFESOc0l2eG+zW2I86oVfBzExsbJ/PghvSk8Tk2dBA53EtJKg8Zh1YyNgCAt/3I 1fKi8SCE3/x59RT18Vr6LE/PYh1MmSdT4E56zgIxomaoMqidBAEzAxNuySwHzUduxpKDiyJ0hXXdW w1f5nbN12ZQFDqrU9+dQbDdCd3M8lv2pAUOuVrArMc+ShTjz6X02nYj+dN3hWEHj0w71Zs7DimtV6 IH/Q52td5tRda0hd5kZDFHqfzTdGX9hMcZZS7NYFLIdvdlWM0KOZ90iizEkZ6JjXsaD0Wj8va5Gam XkLqPyBYWWQCqR+R1UGKKBhPcH/sIpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gs3oi-0001GI-Mz; Fri, 08 Feb 2019 10:55:32 +0000 Received: from smtprelay4.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gs3of-00015i-8y for linux-snps-arc@lists.infradead.org; Fri, 08 Feb 2019 10:55:30 +0000 Received: from mailhost.synopsys.com (dc8-mailhost2.synopsys.com [10.13.135.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id D544424E2154; Fri, 8 Feb 2019 02:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1549623327; bh=/ImxSKSZVi6jhe3QHM/0C4FbQEYs2kGVpoNld2Ojpi4=; h=From:To:Cc:Subject:Date:From; b=NsxINz1pSDVNa76CLEpo58yxM2l0AIVGG2rQq0EyBxZK+BylAhWxccrJM7gT1CuGj qUm1AxKIjMpnR1hffqj8a+1evNmhR+HfmLi4Q/BCF3AUeLtgfSlv2zcHbsYzB9daXg 8p9PZ6BgmVBP4nHzYjRea4/l5EKYNTFboToN2uz8tILReOq0xn1F8+URPbi3UnT8ON asB9BddKRJo4Qz0eMPoxo56wpQl0dB1B9C41bnSQLtWCdgNzxq4U4o0qF4pDkqcbEw VfP2vZW/16QJ3h5CNhr+TFkcZs3wekqTAWCZHZLqDkajA3sox/mb9J0/cQ3tvsntUu rP+lLJEfPFcrA== Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 6E662A005A; Fri, 8 Feb 2019 10:55:25 +0000 (UTC) From: Alexey Brodkin To: linux-snps-arc@lists.infradead.org Subject: [PATCH] ARC: Explicitly set ARCH_SLAB_MINALIGN = 8 Date: Fri, 8 Feb 2019 13:55:19 +0300 Message-Id: <20190208105519.26750-1-abrodkin@synopsys.com> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190208_025529_325308_1AD34D1A X-CRM114-Status: GOOD ( 11.77 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , Alexey Brodkin , linux-kernel@vger.kernel.org, stable@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org By default ARCH_SLAB_MINALIGN is defined in "include/linux/slab.h" as "__alignof__(unsigned long long)" which looks fine but not for ARC. ARC tools ABI sets align of "long long" the same as for "long" = 4 instead of 8 one may think of. Thus slab allocator may easily allocate a buffer which is 32-bit aligned. And most of the time it's OK until we start dealing with 64-bit atomics with special LLOCKD/SCONDD instructions which (as opposed to their 32-bit counterparts LLOCK/SCOND) operate with full 64-bit words but those words must be 64-bit aligned. Fixes Ext4 folder removal: --------------------->8------------------- [ 4.015732] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 4.167881] [ 4.167881] Misaligned Access [ 4.172356] Path: /bin/busybox.nosuid [ 4.176004] CPU: 2 PID: 171 Comm: rm Not tainted 4.19.14-yocto-standard #1 [ 4.182851] [ 4.182851] [ECR ]: 0x000d0000 => Check Programmer's Manual [ 4.190061] [EFA ]: 0xbeaec3fc [ 4.190061] [BLINK ]: ext4_delete_entry+0x210/0x234 [ 4.190061] [ERET ]: ext4_delete_entry+0x13e/0x234 [ 4.202985] [STAT32]: 0x80080002 : IE K [ 4.207236] BTA: 0x9009329c SP: 0xbe5b1ec4 FP: 0x00000000 [ 4.212790] LPS: 0x9074b118 LPE: 0x9074b120 LPC: 0x00000000 [ 4.218348] r00: 0x00000040 r01: 0x00000021 r02: 0x00000001 [ 4.218348] r03: 0x00000000 r04: 0x00000002 r05: 0x00000000 [ 4.218348] r06: 0x000000c6 r07: 0x00000000 r08: 0x9050f140 [ 4.218348] r09: 0x000000c6 r10: 0x0000000a r11: 0x00000000 [ 4.218348] r12: 0x90247a9c r13: 0x9004e574 r14: 0x0008e150 [ 4.218348] r15: 0x000989b8 r16: 0x0008cbec r17: 0x0009806c [ 4.218348] r18: 0x0009806c r19: 0x0008e150 r20: 0x0008f0f8 [ 4.218348] r21: 0x000000ab r22: 0x0008f0f8 r23: 0x00000000 [ 4.218348] r24: 0x00000000 r25: 0x00000000 [ 4.218348] [ 4.218348] [ 4.270510] [ 4.270510] Stack Trace: [ 4.274510] ext4_delete_entry+0x13e/0x234 [ 4.278695] ext4_rmdir+0xe0/0x238 [ 4.282187] vfs_rmdir+0x50/0xf0 [ 4.285492] do_rmdir+0x9e/0x154 [ 4.288802] EV_Trap+0x110/0x114 --------------------->8------------------- Signed-off-by: Alexey Brodkin Cc: # 4.8+ --- arch/arc/include/asm/cache.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index f393b663413e..74f8fcaaef5c 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h @@ -52,6 +52,16 @@ #define cache_line_size() SMP_CACHE_BYTES #define ARCH_DMA_MINALIGN SMP_CACHE_BYTES +/* + * Make sure slab-allocated buffers are 64-bit aligned. + * This is required for llockd/scondd to deal with 64-bit aligned dwords. + * By default ARCH_SLAB_MINALIGN is __alignof__(long long) which in + * case of ARC is 4 instead of 8! + */ +#ifdef CONFIG_ARC_HAS_LL64 +#define ARCH_SLAB_MINALIGN 8 +#endif + extern void arc_cache_init(void); extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); extern void read_decode_cache_bcr(void);