Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757070AbcDDXqQ (ORCPT ); Mon, 4 Apr 2016 19:46:16 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35121 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932733AbcDDX2V (ORCPT ); Mon, 4 Apr 2016 19:28:21 -0400 From: Kamal Mostafa To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Sebastian Ott , Martin Schwidefsky , Kamal Mostafa Subject: [PATCH 3.13.y-ckt 46/97] s390/pci: enforce fmb page boundary rule Date: Mon, 4 Apr 2016 16:26:10 -0700 Message-Id: <1459812421-933-47-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1459812421-933-1-git-send-email-kamal@canonical.com> References: <1459812421-933-1-git-send-email-kamal@canonical.com> X-Extended-Stable: 3.13 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1802 Lines: 53 3.13.11-ckt38 -stable review patch. If anyone has any objections, please let me know. ---8<------------------------------------------------------------ From: Sebastian Ott commit 80c544ded25ac14d7cc3e555abb8ed2c2da99b84 upstream. The function measurement block must not cross a page boundary. Ensure that by raising the alignment requirement to the smallest power of 2 larger than the size of the fmb. Fixes: d0b088531 ("s390/pci: performance statistics and debug infrastructure") Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky Signed-off-by: Kamal Mostafa --- arch/s390/include/asm/pci.h | 2 +- arch/s390/pci/pci.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index c129ab2..33932ce 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h @@ -48,7 +48,7 @@ struct zpci_fmb { atomic64_t allocated_pages; atomic64_t mapped_pages; atomic64_t unmapped_pages; -} __packed __aligned(16); +} __packed __aligned(64); #define ZPCI_MSI_VEC_BITS 11 #define ZPCI_MSI_VEC_MAX (1 << ZPCI_MSI_VEC_BITS) diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index bf7c73d..710056d 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -895,8 +895,11 @@ static inline int barsize(u8 size) static int zpci_mem_init(void) { + BUILD_BUG_ON(!is_power_of_2(__alignof__(struct zpci_fmb)) || + __alignof__(struct zpci_fmb) < sizeof(struct zpci_fmb)); + zdev_fmb_cache = kmem_cache_create("PCI_FMB_cache", sizeof(struct zpci_fmb), - 16, 0, NULL); + __alignof__(struct zpci_fmb), 0, NULL); if (!zdev_fmb_cache) goto error_zdev; -- 2.7.4