From patchwork Fri Jul 6 17:15:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 940638 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="ncnzyGdk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="VYlkuyzN"; 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 41MhFG5yczz9s4r for ; Sat, 7 Jul 2018 03:15:30 +1000 (AEST) 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=YSDfXSWjnKNcqjz3z4iosCCDo0j6N5YMEZf9Q4wtUYw=; b=ncn zyGdk3D994nUbTvozL8TOtKU3GaFiXVfzRp9HQZOsXDaRJQ84Z89ZPzfE3VVFXz4DM9HZ/c+KPLQM uDbtEA6ntbUCF/SUtw8KbsTeAleAnnrfn3uhegwy00kKWQrFwIHJ5jyh14pCHm2BPITKJ3Wm0ZCwi jK9q3CSv8pNI7SGxM8YtwvlphgdWUw4DGU7D/uWbKslKT+s1BfSHsWYT6aP081Cs160W0alPHWic7 jJxF7N4ZDdyLdxAzzpdnfs+2ujbP3wT4rZm/DoqyupI3Ct5etf4V7Mn5gglqnaHKKgaq1TC48aFwS bUdsY1NP02sQOSoHLBNsrhYwx2bbviA==; 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 1fbUKO-0004yV-S7; Fri, 06 Jul 2018 17:15:28 +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 1fbUKM-0004x6-Pk for linux-snps-arc@lists.infradead.org; Fri, 06 Jul 2018 17:15:28 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 8F14324E03F1; Fri, 6 Jul 2018 10:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1530897314; bh=HfOI10sPGCBNQSQJ+v2HPxHsCVuwvp9NlMMRqkAGvoU=; h=From:To:Cc:Subject:Date:From; b=VYlkuyzNLwyvC26NLyd/S/wwQzKJwNMLjB8S5SyiqkXrQhA0zBsQMAsCpMAza0DDV Wl7UdSI+AYpORV6hPggr9n1wporKWnHxaqiKnXylAvBzd9sJ5Xaob1yqh0y9hLkjJW qh9rHVHxM3/Xhd/qu+mdXLB4f1X9BlR4g06n+mGsS1VTixt5lwDHLLG2CcRsumThbo ztMWOIkiv90Fi/QrtZ3iWT9ZoLr/Q8cnQ4w8s3gxQRS7ucHCHjgsT/QfTFp3HBXgXC Ne9E3jDztqyR4UUu4wUaDff1o8BICrLbpmO1JgrMDRhQWsV5oslizC0O26hcabtfGA FAfd47wlsXCEg== Received: from abrodkin-7480l.internal.synopsys.com (unknown [10.121.8.87]) by mailhost.synopsys.com (Postfix) with ESMTP id 28994320E; Fri, 6 Jul 2018 10:15:12 -0700 (PDT) From: Alexey Brodkin To: linux-kernel@vger.kernel.org Subject: [PATCH] devres: Really align data field to unsigned long long Date: Fri, 6 Jul 2018 20:15:04 +0300 Message-Id: <20180706171504.10265-1-abrodkin@synopsys.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180706_101526_846139_BC7445E4 X-CRM114-Status: GOOD ( 11.88 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 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_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 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: linux-arch@vger.kernel.org, linux-snps-arc@lists.infradead.org, Alexey Brodkin , 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 It looks like on most of architectures "data" member of devres struture gets aligned to 8-byte "unsigned long long" boundary as one may expect: if we don't explicitly pack a structure then natural alignment (which matches each member data type) is used. But at least on 32-bit ARC architecture ABI requires "long long" types to be aligned by normal 32-bit word. This makes "data" field aligned to 12 bytes. This is still OK as long as we use 32-bit data only. But once we want to use native atomic64_t type (i.e. when we use special instructions LLOCKD/SCONDD for accessing 64-bit data) we easily hit misaligned access exception. That's because even on CPUs capable of non-aligned data access LL/SC instructions require strict alignment. Signed-off-by: Alexey Brodkin Cc: stable@vger.kernel.org --- drivers/base/devres.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/devres.c b/drivers/base/devres.c index f98a097e73f2..35ddc8b66bc9 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -25,7 +25,7 @@ struct devres_node { struct devres { struct devres_node node; /* -- 3 pointers */ - unsigned long long data[]; /* guarantee ull alignment */ + unsigned long long data[] __aligned(sizeof(unsigned long long)); }; struct devres_group {