Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1388416 > unrolled thread

[PATCH 3.16 098/217] s390/pci: enforce fmb page boundary rule

Started byBen Hutchings <ben@decadent.org.uk>
First post2016-04-27 02:10 +0200
Last post2016-04-27 20:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.16 098/217] s390/pci: enforce fmb page boundary rule Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:10 +0200
    Re: [PATCH 3.16 098/217] s390/pci: enforce fmb page boundary rule Sebastian Ott <sebott@linux.vnet.ibm.com> - 2016-04-27 19:30 +0200
      Re: [PATCH 3.16 098/217] s390/pci: enforce fmb page boundary rule Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 20:20 +0200

#1388416 — [PATCH 3.16 098/217] s390/pci: enforce fmb page boundary rule

FromBen Hutchings <ben@decadent.org.uk>
Date2016-04-27 02:10 +0200
Subject[PATCH 3.16 098/217] s390/pci: enforce fmb page boundary rule
Message-ID<rsldj-8vJ-67@gated-at.bofh.it>
3.16.35-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sebastian Ott <sebott@linux.vnet.ibm.com>

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 <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/s390/include/asm/pci.h | 2 +-
 arch/s390/pci/pci.c         | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

--- 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)
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -840,8 +840,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;
 

[toc] | [next] | [standalone]


#1389395

FromSebastian Ott <sebott@linux.vnet.ibm.com>
Date2016-04-27 19:30 +0200
Message-ID<rsBrI-4Yl-13@gated-at.bofh.it>
In reply to#1388416
On Wed, 27 Apr 2016, Ben Hutchings wrote:
> 3.16.35-rc1 review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Sebastian Ott <sebott@linux.vnet.ibm.com>
> 
> 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 <sebott@linux.vnet.ibm.com>
> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> [bwh: Backported to 3.16: adjust context]
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

The BUILD_BUG_ON below will be triggered. This patch has a
dependency on commit:
	6001018ae "s390/pci: extract software counters from fmb"
could you please fetch that one too?

Thanks,
Sebastian

> ---
>  arch/s390/include/asm/pci.h | 2 +-
>  arch/s390/pci/pci.c         | 5 ++++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> --- 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)
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -840,8 +840,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;
> 
> 
> 

[toc] | [prev] | [next] | [standalone]


#1389437

FromBen Hutchings <ben@decadent.org.uk>
Date2016-04-27 20:20 +0200
Message-ID<rsCe6-5LS-13@gated-at.bofh.it>
In reply to#1389395

[Multipart message — attachments visible in raw view] — view raw

On Wed, 2016-04-27 at 19:27 +0200, Sebastian Ott wrote:
> On Wed, 27 Apr 2016, Ben Hutchings wrote:
> > 
> > 3.16.35-rc1 review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Sebastian Ott <sebott@linux.vnet.ibm.com>
> > 
> > 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 <sebott@linux.vnet.ibm.com>
> > Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> > [bwh: Backported to 3.16: adjust context]
> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> The BUILD_BUG_ON below will be triggered. This patch has a
> dependency on commit:
> 	6001018ae "s390/pci: extract software counters from fmb"
> could you please fetch that one too?
[...]

Thanks, I've now done that.  I'm hoping to get cross-architecture build
testing for 3.16.y in place soon so I can catch this sort of thing
earlier.

Ben.

-- 
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web