Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3341342yba; Mon, 6 May 2019 22:50:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxn65Z+PR+EhAX90+B35TpkyYRAk4BTD5HcfYLvVm5x+GNT6cmGCJtT9uUXQOl4DK/WbaUz X-Received: by 2002:a17:902:9a9:: with SMTP id 38mr22605107pln.10.1557208249556; Mon, 06 May 2019 22:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557208249; cv=none; d=google.com; s=arc-20160816; b=gMFw+ECltcBfT1uwhi6fbloO5dgq8jk6jF1KC2MKhWVeuba+iduZj7yMYALGiuxaPx jQTTXvexl/DL6T8Go57tXUbqTNdQxGbyWPgTgLGZREMDcOM4Az4tuxWKJJxkkzMPdYmV 3XpyZDfxGdx6HzjJqmZ/6i72ZYnTQjRFzZnDK524Qq6vww5VXWSgIyTI+qnTKYimv0kG tNYUhLaflqij0FPbwosDAQdL3cyNzQP4S1CRwx18AXlvncLG2dcJQX3b1SPPv/XjTa+A pax7gL8t4goZmB/uYMwj9AoU/cnNZbRs08H18w38UpTyabYkxCdMdAHsNKvrx0L2KFi1 5Wpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5rX9939PK8jbs0y5Z2IspAvirzwZ2oXP+4KMISa//AE=; b=qPJINgp4v0hBWYb561OngsG5XWBYSN+REjP6ANY5S593DBibRj3tmnbQEiU93qRuyl c6wXZPKy6KBH3i8Ed//GtNk1TS09ayMaKLKhO1EpkSQfte4ufdU9AAMGo2HZ51vq8/e/ D87e0k7bhs6EHVYZyyEEGijWhAzZy6+MnRCh14aJkR2+Bs+Wvz9zlEJG/SnmXt2QSzAI wW5cQwFKTZ9A+2Vtj/SXExCbzadXy9ZQBAFjZhG1059W9+R5ZqCL9IeS4+oaiVhWzICR eJMAkqKWZWn68tYVCBHCYWFRK/lNmQoRFXFzay6hm7BSK13QzygrCKPvAKh+XE3KSdOu XHHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LjiMBnFq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si17719294plo.41.2019.05.06.22.50.34; Mon, 06 May 2019 22:50:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LjiMBnFq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729165AbfEGFkn (ORCPT + 99 others); Tue, 7 May 2019 01:40:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:60104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729142AbfEGFkj (ORCPT ); Tue, 7 May 2019 01:40:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ECDB5205ED; Tue, 7 May 2019 05:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557207639; bh=4Ruw6mUD4zBOCDiBbLvKaU1Nm+tiQj2boN6q3TPTB18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LjiMBnFqwrkyL5H3KcTcobAxMWzYoiTWdC0MeV86TAsOH3OxzcGmiW7nOetBtdKF0 7yNG25HAH6n8BjmT4OR/QapehK4qyRRIOCuvjVckGfa/LOHQJiZwpncVtBtMTPY6jB Mb/w8ek7oX0hNNFLv5NoW7MSMr8nTdbHMO++sPOs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexey Brodkin , Alexey Brodkin , Greg Kroah-Hartman , Geert Uytterhoeven , David Laight , Peter Zijlstra , Thomas Gleixner , Vineet Gupta , Will Deacon , Greg KH , Sasha Levin Subject: [PATCH AUTOSEL 4.14 72/95] devres: Align data[] to ARCH_KMALLOC_MINALIGN Date: Tue, 7 May 2019 01:38:01 -0400 Message-Id: <20190507053826.31622-72-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507053826.31622-1-sashal@kernel.org> References: <20190507053826.31622-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexey Brodkin [ Upstream commit a66d972465d15b1d89281258805eb8b47d66bd36 ] Initially we bumped into problem with 32-bit aligned atomic64_t on ARC, see [1]. And then during quite lengthly discussion Peter Z. mentioned ARCH_KMALLOC_MINALIGN which IMHO makes perfect sense. If allocation is done by plain kmalloc() obtained buffer will be ARCH_KMALLOC_MINALIGN aligned and then why buffer obtained via devm_kmalloc() should have any other alignment? This way we at least get the same behavior for both types of allocation. [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004009.html [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004036.html Signed-off-by: Alexey Brodkin Cc: Greg Kroah-Hartman Cc: Geert Uytterhoeven Cc: David Laight Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vineet Gupta Cc: Will Deacon Cc: Greg KH Cc: # 4.8+ Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/devres.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/base/devres.c b/drivers/base/devres.c index 71d577025285..e43a04a495a3 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -25,8 +25,14 @@ struct devres_node { struct devres { struct devres_node node; - /* -- 3 pointers */ - unsigned long long data[]; /* guarantee ull alignment */ + /* + * Some archs want to perform DMA into kmalloc caches + * and need a guaranteed alignment larger than + * the alignment of a 64-bit integer. + * Thus we use ARCH_KMALLOC_MINALIGN here and get exactly the same + * buffer alignment as if it was allocated by plain kmalloc(). + */ + u8 __aligned(ARCH_KMALLOC_MINALIGN) data[]; }; struct devres_group { -- 2.20.1