Commit 1ee3901b authored by Sebastian Ott's avatar Sebastian Ott Committed by Sasha Levin

s390/pci: enforce fmb page boundary rule

[ Upstream commit 80c544de ]

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: d0b08853 ("s390/pci: performance statistics and debug infrastructure")
Cc: stable@vger.kernel.org # v3.8+
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent bbd5f23b
...@@ -45,7 +45,7 @@ struct zpci_fmb { ...@@ -45,7 +45,7 @@ struct zpci_fmb {
u64 rpcit_ops; u64 rpcit_ops;
u64 dma_rbytes; u64 dma_rbytes;
u64 dma_wbytes; u64 dma_wbytes;
} __packed __aligned(16); } __packed __aligned(64);
enum zpci_state { enum zpci_state {
ZPCI_FN_STATE_RESERVED, ZPCI_FN_STATE_RESERVED,
......
...@@ -871,8 +871,11 @@ static inline int barsize(u8 size) ...@@ -871,8 +871,11 @@ static inline int barsize(u8 size)
static int zpci_mem_init(void) 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), 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) if (!zdev_fmb_cache)
goto error_zdev; goto error_zdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment