patch "TTY: hvc: convert to use DRIVER_ATTR_RW" added to driver-core-next

2017-06-12 Thread gregkh

This is a note to let you know that I've just added the patch titled

TTY: hvc: convert to use DRIVER_ATTR_RW

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-next branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release
during the merge window.

If you have any questions about this process, please let me know.


>From 4e70a6fe6dc5d78939d9e155db3bd6cef28ec310 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman 
Date: Fri, 9 Jun 2017 11:03:07 +0200
Subject: TTY: hvc: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the hvc driver's
attribute can be trivially changed to use DRIVER_ATTR_RW().

Cc: Jiri Slaby 
Cc: 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/tty/hvc/hvcs.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 99bb875178d7..096ea5f511bd 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -484,13 +484,13 @@ static struct attribute_group hvcs_attr_group = {
.attrs = hvcs_attrs,
 };
 
-static ssize_t hvcs_rescan_show(struct device_driver *ddp, char *buf)
+static ssize_t rescan_show(struct device_driver *ddp, char *buf)
 {
/* A 1 means it is updating, a 0 means it is done updating */
return snprintf(buf, PAGE_SIZE, "%d\n", hvcs_rescan_status);
 }
 
-static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf,
+static ssize_t rescan_store(struct device_driver *ddp, const char * buf,
size_t count)
 {
if ((simple_strtol(buf, NULL, 0) != 1)
@@ -505,8 +505,7 @@ static ssize_t hvcs_rescan_store(struct device_driver *ddp, 
const char * buf,
return count;
 }
 
-static DRIVER_ATTR(rescan,
-   S_IRUGO | S_IWUSR, hvcs_rescan_show, hvcs_rescan_store);
+static DRIVER_ATTR_RW(rescan);
 
 static void hvcs_kick(void)
 {
-- 
2.13.1




Re: [RFC PATCH 1/7 v1]powerpc: Free up four PTE bits to accommodate memory keys

2017-06-12 Thread Aneesh Kumar K.V
Ram Pai  writes:

> Rearrange  PTE   bits to  free  up  bits 3, 4, 5  and  6  for
> memory keys. Bit 3, 4, 5, 6 and 57  shall  be used for memory
> keys.
>
> The patch does the following change to the 64K PTE format
>
> H_PAGE_BUSY moves from bit 3 to bit 7
> H_PAGE_F_SECOND which occupied bit 4 moves to the second part
>   of the pte.
> H_PAGE_F_GIX which  occupied bit 5, 6 and 7 also moves to the
>   second part of the pte.
>
> The second part of the PTE will hold
>a (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for  64K page backed pte,
>and sixteen (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for 4k  backed
>   pte.
>
> the four  bits((H_PAGE_F_SECOND|H_PAGE_F_GIX) that represent a slot
> is initialized to 0xF indicating a invalid slot. if a hashpage does
> get  allocated  to  the  0xF  slot, it is released and not used. In
> other words, even  though  0xF  is  a valid slot we discard it  and
> consider it as invalid slot(HPTE_SOFT_INVALID). This  gives  us  an
> opportunity to  not  depend on a bit in the primary PTE in order to
> determine the validity of a slot.
>
> When  we  release  a  0xF slot we also release a legitimate primary
> slot  and  unmap  that  entry. This  is  to  ensure  that we do get
> a legimate non-0xF slot the next time we retry for a slot.
>
> Though treating 0xF slot as invalid reduces the number of available
> slots and make have a effect on the performance, the probabilty
> of hitting a 0xF is extermely low.
>
> Compared  to the current scheme, the above described scheme reduces
> the number of false hash table updates  significantly  and  has the
> added  advantage  of  releasing  four  valuable  PTE bits for other
> purpose.
>
> This idea was jointly developed by Paul Mackerras, Aneesh, Michael
> Ellermen and myself.
>
> 4K PTE format remain unchanged currently.
>

Can you also split this patch into two. One which changes
__hash_page_4k() ie, linux pte format w.r.t 4k hash pte. Second patch
with changes w.r.t __hash_page_64k() ie, pte format w.r.t 64k hash pte.

-aneesh



Re: [PATCH 01/14] powerpc/64s: idle move soft interrupt mask logic into C code

2017-06-12 Thread Gautham R Shenoy
On Tue, Jun 13, 2017 at 12:46:02AM +1000, Nicholas Piggin wrote:
> Hi Gautham,
> 
> Thanks for the reviews.
> 
> On Mon, 12 Jun 2017 14:07:27 +0530
> Gautham R Shenoy  wrote:
> 
> > Hi Nick,
> > 
> > (Added Paul Mackerass to the Cc)
> > On Mon, Jun 12, 2017 at 09:58:22AM +1000, Nicholas Piggin wrote:
> > > This simplifies the asm and fixes irq-off tracing over sleep
> > > instructions.
> > > 
> > > Also move powersave_nap check for POWER8 into C code, and move
> > > PSSCR register value calculation for POWER9 into C.
> > >  
> > 
> > Thanks for doing this. Only one minor comment.
> > 
> > > Signed-off-by: Nicholas Piggin 
> > > ---
> > > index 98a6d07ecb5c..35cf5bb7daed 100644
> > > --- a/arch/powerpc/kernel/idle_book3s.S
> > > +++ b/arch/powerpc/kernel/idle_book3s.S  
> > 
> > [..snip..]
> > 
> > > @@ -109,13 +109,9 @@ core_idle_lock_held:
> > >  /*
> > >   * Pass requested state in r3:
> > >   *   r3 - PNV_THREAD_NAP/SLEEP/WINKLE in POWER8
> > > - *  - Requested STOP state in POWER9
> > > + *  - Requested PSSCR value in POWER9
> > >   *
> > > - * To check IRQ_HAPPENED in r4
> > > - *   0 - don't check
> > > - *   1 - check
> > > - *
> > > - * Address to 'rfid' to in r5
> > > + * Address of idle handler to 'rfid' to in r4
> > >   */
> > >  pnv_powersave_common:
> > >   /* Use r3 to pass state nap/sleep/winkle */
> > > @@ -131,30 +127,7 @@ pnv_powersave_common:
> > >   std r0,_LINK(r1)
> > >   std r0,_NIP(r1)
> > > 
> > > - /* Hard disable interrupts */
> > > - mfmsr   r9
> > > - rldicl  r9,r9,48,1
> > > - rotldi  r9,r9,16
> > > - mtmsrd  r9,1/* hard-disable interrupts */
> > > -
> > > - /* Check if something happened while soft-disabled */
> > > - lbz r0,PACAIRQHAPPENED(r13)
> > > - andi.   r0,r0,~PACA_IRQ_HARD_DIS@l
> > > - beq 1f
> > > - cmpwi   cr0,r4,0  
> > 
> > There were callers to power7_nap() in the dynamic-core-split/unsplit
> > which wanted nap to be forced irrespective of whether an irq was
> > pending or not. With this new patch, there won't be a way to enforce
> > that on POWER8.
> 
> Actually there are two APIs to sleep now, the low level one which
> does not check lazy irq or nap disable is power7_idle_insn(). The
> one which sets up the lazy irq state is power7_idle_type(). The
> dynamic core split calls the former, so AFAIKS it should be
> equivalent.

Ah, I see. Yes, my bad. I didn't check which one we are calling in the
dynamic split case.

Reviewed-by: Gautham R. Shenoy 

> 
> Not the best names perhaps. Open to better suggestions.
> 
> Thanks,
> Nick
> 

--
Thanks and Regards
gautham.



Re: [PATCH V2] cxl: Fixes for Coherent Accelerator Interface Architecture 2.0

2017-06-12 Thread Andrew Donnellan

On 12/06/17 22:45, Christophe Lombard wrote:

A previous set of patches "cxl: Add support for Coherent Accelerator
Interface Architecture 2.0" has introduced a new support for the CAPI
cards. These patches have been tested on Simulation environment and
quite a bit of them have been tested on real hardware.

This patch brings new fixes after a series of tests carried out on
new equipment.


This commit message could be more descriptive.

Also missing a Signed-off-by.



Changelog[v2]
 - Rebase to latest upstream.
 - Update cxl_is_page_fault() to handle the checkout response status.
 - Add comments.
---
 drivers/misc/cxl/context.c |  6 +++---
 drivers/misc/cxl/cxl.h | 17 -
 drivers/misc/cxl/fault.c   | 19 ---
 drivers/misc/cxl/main.c| 16 
 drivers/misc/cxl/native.c  | 26 ++
 drivers/misc/cxl/pci.c | 11 ---
 6 files changed, 49 insertions(+), 46 deletions(-)

diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index 4472ce1..8c32040 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -45,7 +45,7 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu 
*afu, bool master)
mutex_init(>mapping_lock);
ctx->mapping = NULL;

-   if (cxl_is_psl8(afu)) {
+   if (cxl_is_power8()) {
spin_lock_init(>sste_lock);

/*
@@ -189,7 +189,7 @@ int cxl_context_iomap(struct cxl_context *ctx, struct 
vm_area_struct *vma)
if (start + len > ctx->afu->adapter->ps_size)
return -EINVAL;

-   if (cxl_is_psl9(ctx->afu)) {
+   if (cxl_is_power9()) {
/*
 * Make sure there is a valid problem state
 * area space for this AFU.
@@ -324,7 +324,7 @@ static void reclaim_ctx(struct rcu_head *rcu)
 {
struct cxl_context *ctx = container_of(rcu, struct cxl_context, rcu);

-   if (cxl_is_psl8(ctx->afu))
+   if (cxl_is_power8())
free_page((u64)ctx->sstp);
if (ctx->ff_page)
__free_page(ctx->ff_page);
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index c8568ea..d516353 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -844,24 +844,15 @@ static inline bool cxl_is_power8(void)

 static inline bool cxl_is_power9(void)
 {
-   /* intermediate solution */
-   if (!cxl_is_power8() &&
-  (cpu_has_feature(CPU_FTRS_POWER9) ||
-   cpu_has_feature(CPU_FTR_POWER9_DD1)))
+   if (pvr_version_is(PVR_POWER9))
return true;
return false;
 }

-static inline bool cxl_is_psl8(struct cxl_afu *afu)
+static inline bool cxl_is_power9_dd1(void)
 {
-   if (afu->adapter->caia_major == 1)
-   return true;
-   return false;
-}
-
-static inline bool cxl_is_psl9(struct cxl_afu *afu)
-{
-   if (afu->adapter->caia_major == 2)
+   if ((pvr_version_is(PVR_POWER9)) &&
+   cpu_has_feature(CPU_FTR_POWER9_DD1))
return true;
return false;
 }
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 538..a6e6a18 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -187,7 +187,7 @@ static struct mm_struct *get_mem_context(struct cxl_context 
*ctx)

 static bool cxl_is_segment_miss(struct cxl_context *ctx, u64 dsisr)
 {
-   if ((cxl_is_psl8(ctx->afu)) && (dsisr & CXL_PSL_DSISR_An_DS))
+   if ((cxl_is_power8() && (dsisr & CXL_PSL_DSISR_An_DS)))
return true;

return false;
@@ -195,15 +195,20 @@ static bool cxl_is_segment_miss(struct cxl_context *ctx, 
u64 dsisr)

 static bool cxl_is_page_fault(struct cxl_context *ctx, u64 dsisr)
 {
-   if ((cxl_is_psl8(ctx->afu)) && (dsisr & CXL_PSL_DSISR_An_DM))
+   u64 crs; /* Translation Checkout Response Status */
+
+   if ((cxl_is_power8()) && (dsisr & CXL_PSL_DSISR_An_DM))
return true;

-   if ((cxl_is_psl9(ctx->afu)) &&
-  ((dsisr & CXL_PSL9_DSISR_An_CO_MASK) &
-   (CXL_PSL9_DSISR_An_PF_SLR | CXL_PSL9_DSISR_An_PF_RGC |
-CXL_PSL9_DSISR_An_PF_RGP | CXL_PSL9_DSISR_An_PF_HRH |
-CXL_PSL9_DSISR_An_PF_STEG)))
+   if (cxl_is_power9()) {
+   crs = (dsisr & CXL_PSL9_DSISR_An_CO_MASK);
+   if ((crs == CXL_PSL9_DSISR_An_PF_SLR) ||
+   (crs == CXL_PSL9_DSISR_An_PF_RGC) ||
+   (crs == CXL_PSL9_DSISR_An_PF_RGP) ||
+   (crs == CXL_PSL9_DSISR_An_PF_HRH) ||
+   (crs == CXL_PSL9_DSISR_An_PF_STEG))
return true;
+   }

return false;
 }
diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c
index 1703655..d2d50e3 100644
--- a/drivers/misc/cxl/main.c
+++ b/drivers/misc/cxl/main.c
@@ -329,8 +329,14 @@ static int __init init_cxl(void)

cxl_debugfs_init();

-   if ((rc = 

Re: [RFC PATCH 1/7 v1]powerpc: Free up four PTE bits to accommodate memory keys

2017-06-12 Thread Aneesh Kumar K.V
Ram Pai  writes:

> On Mon, Jun 12, 2017 at 12:27:44PM +0530, Aneesh Kumar K.V wrote:
>> Ram Pai  writes:
>> 
>> > Rearrange  PTE   bits to  free  up  bits 3, 4, 5  and  6  for
>> > memory keys. Bit 3, 4, 5, 6 and 57  shall  be used for memory
>> > keys.
>> >
>> > The patch does the following change to the 64K PTE format
>> >
>> > H_PAGE_BUSY moves from bit 3 to bit 7
>> > H_PAGE_F_SECOND which occupied bit 4 moves to the second part
>> >of the pte.
>> > H_PAGE_F_GIX which  occupied bit 5, 6 and 7 also moves to the
>> >second part of the pte.
>> >
>> > The second part of the PTE will hold
>> >a (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for  64K page backed pte,
>> >and sixteen (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for 4k  backed
>> >pte.
>> >
>> > the four  bits((H_PAGE_F_SECOND|H_PAGE_F_GIX) that represent a slot
>> > is initialized to 0xF indicating a invalid slot. if a hashpage does
>> > get  allocated  to  the  0xF  slot, it is released and not used. In
>> > other words, even  though  0xF  is  a valid slot we discard it  and
>> > consider it as invalid slot(HPTE_SOFT_INVALID). This  gives  us  an
>> > opportunity to  not  depend on a bit in the primary PTE in order to
>> > determine the validity of a slot.
>> 
>> Do we need to do this for 64K hptes ? H_PAGE_HASHPTE indicates whether a
>> slot is valid or not. For 4K hptes, we do need this right ? ie, only
>> when H_PAGE_COMBO is set we need to consider 0xf as an invalid slot
>
> for 64k hptes; you are right, we do not use 0xF to
> track the validity of a slot. We just depend on H_PAGE_HASHPTE flag.
>
> for 4k hptes, we need to depend on both H_PAGE_HASHPTE as well as the
> value of the slot.  H_PAGE_HASHPTE tells if there exists any valid
> 4k HPTEs, and the 4-bit values in the second-part-of-the-pte tells
> us if they are valid values.
>
> However in either case we do not need H_PAGE_COMBO. That flag is not
> used for ptes.  But we continue to use that flag for pmd to track
> hugepages, which is why I have not entirely divorced H_PAGE_COMBO from
> the 64K pagesize case.


Really ? May be i am missing that in the patch. H_PAGE_COMBO indicate
whether a 64K linux page is mapped via 4k hash page table enries. I
don't see you changing that in __hash_page_4k()

we still continue to do.

new_pte = old_pte | H_PAGE_BUSY | _PAGE_ACCESSED | H_PAGE_COMBO;

/*
 * Check if the pte was already inserted into the hash table
 * as a 64k HW page, and invalidate the 64k HPTE if so.
 */
if (!(old_pte & H_PAGE_COMBO)) {
flush_hash_page(vpn, rpte, MMU_PAGE_64K, ssize, flags);



>
>> 
>> 
>> >
>> > When  we  release  a  0xF slot we also release a legitimate primary
>> > slot  and  unmap  that  entry. This  is  to  ensure  that we do get
>> > a legimate non-0xF slot the next time we retry for a slot.
>> 
>> Can you explain this more ? what is a primary slot here ?
>
> I may not be using the right terminology here. But when I say slot, i
> mean the four bits that tell the position of the hpte in the hash
> buckets. Bit 0, indicates if it the primary or secondary hash bucket.
> and bit 1,2,3 indicates the entry in the hash bucket.
>
> So when i say primary slot, I mean a entry in the primary hash bucket.
>
> The idea is, when hpte_insert returns a hpte which is cached in the 7slot
> of the secondary bucket i.e 0xF, we discard it, and also release a
> random entry from the primary bucket, so that on retry we can get that
> entry.
>
>
>> 
>> >
>> > Though treating 0xF slot as invalid reduces the number of available
>> > slots and make have a effect on the performance, the probabilty
>> > of hitting a 0xF is extermely low.
>> >
>> > Compared  to the current scheme, the above described scheme reduces
>> > the number of false hash table updates  significantly  and  has the
>> > added  advantage  of  releasing  four  valuable  PTE bits for other
>> > purpose.
>> >
>> > This idea was jointly developed by Paul Mackerras, Aneesh, Michael
>> > Ellermen and myself.
>> >
>> > 4K PTE format remain unchanged currently.
>> >
>> > Signed-off-by: Ram Pai 
>> > ---
>> >  arch/powerpc/include/asm/book3s/64/hash-4k.h  | 12 +
>> >  arch/powerpc/include/asm/book3s/64/hash-64k.h | 38 ++
>> >  arch/powerpc/include/asm/book3s/64/hash.h |  8 ++-
>> >  arch/powerpc/include/asm/book3s/64/mmu-hash.h |  5 ++
>> >  arch/powerpc/mm/dump_linuxpagetables.c|  3 +-
>> >  arch/powerpc/mm/hash64_4k.c   | 12 ++---
>> >  arch/powerpc/mm/hash64_64k.c  | 73 
>> > +--
>> >  arch/powerpc/mm/hash_utils_64.c   | 38 +-
>> >  arch/powerpc/mm/hugetlbpage-hash64.c  | 16 +++---
>> >  9 files changed, 107 insertions(+), 98 deletions(-)
>> >
>> > diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h 
>> > b/arch/powerpc/include/asm/book3s/64/hash-4k.h
>> > index 

Re: [PATCH] PCI: dwc: Constify dw_pcie_host_ops structures

2017-06-12 Thread Bjorn Helgaas
On Mon, Jun 05, 2017 at 04:53:46PM +0800, Jisheng Zhang wrote:
> The dw_pcie_host_ops structures are never modified. Constify these
> structures such that these can be write-protected.
> 
> Signed-off-by: Jisheng Zhang 

Applied with Jingoo's ack to pci/host-designware for v4.13, thanks!

> ---
>  drivers/pci/dwc/pci-dra7xx.c   | 2 +-
>  drivers/pci/dwc/pci-exynos.c   | 2 +-
>  drivers/pci/dwc/pci-imx6.c | 2 +-
>  drivers/pci/dwc/pci-keystone.c | 2 +-
>  drivers/pci/dwc/pci-layerscape.c   | 6 +++---
>  drivers/pci/dwc/pcie-armada8k.c| 2 +-
>  drivers/pci/dwc/pcie-artpec6.c | 2 +-
>  drivers/pci/dwc/pcie-designware-plat.c | 2 +-
>  drivers/pci/dwc/pcie-designware.h  | 2 +-
>  drivers/pci/dwc/pcie-qcom.c| 2 +-
>  drivers/pci/dwc/pcie-spear13xx.c   | 2 +-
>  11 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c
> index 8decf46cf525..e4166032b3c6 100644
> --- a/drivers/pci/dwc/pci-dra7xx.c
> +++ b/drivers/pci/dwc/pci-dra7xx.c
> @@ -208,7 +208,7 @@ static void dra7xx_pcie_host_init(struct pcie_port *pp)
>   dra7xx_pcie_enable_interrupts(dra7xx);
>  }
>  
> -static struct dw_pcie_host_ops dra7xx_pcie_host_ops = {
> +static const struct dw_pcie_host_ops dra7xx_pcie_host_ops = {
>   .host_init = dra7xx_pcie_host_init,
>  };
>  
> diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c
> index 546082ad5a3f..c78c06552590 100644
> --- a/drivers/pci/dwc/pci-exynos.c
> +++ b/drivers/pci/dwc/pci-exynos.c
> @@ -590,7 +590,7 @@ static void exynos_pcie_host_init(struct pcie_port *pp)
>   exynos_pcie_enable_interrupts(ep);
>  }
>  
> -static struct dw_pcie_host_ops exynos_pcie_host_ops = {
> +static const struct dw_pcie_host_ops exynos_pcie_host_ops = {
>   .rd_own_conf = exynos_pcie_rd_own_conf,
>   .wr_own_conf = exynos_pcie_wr_own_conf,
>   .host_init = exynos_pcie_host_init,
> diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c
> index a98cba55c7f0..fb4816088a7a 100644
> --- a/drivers/pci/dwc/pci-imx6.c
> +++ b/drivers/pci/dwc/pci-imx6.c
> @@ -602,7 +602,7 @@ static int imx6_pcie_link_up(struct dw_pcie *pci)
>   PCIE_PHY_DEBUG_R1_XMLH_LINK_UP;
>  }
>  
> -static struct dw_pcie_host_ops imx6_pcie_host_ops = {
> +static const struct dw_pcie_host_ops imx6_pcie_host_ops = {
>   .host_init = imx6_pcie_host_init,
>  };
>  
> diff --git a/drivers/pci/dwc/pci-keystone.c b/drivers/pci/dwc/pci-keystone.c
> index fcc9723bad6e..4783cec1f78d 100644
> --- a/drivers/pci/dwc/pci-keystone.c
> +++ b/drivers/pci/dwc/pci-keystone.c
> @@ -291,7 +291,7 @@ static void __init ks_pcie_host_init(struct pcie_port *pp)
>   "Asynchronous external abort");
>  }
>  
> -static struct dw_pcie_host_ops keystone_pcie_host_ops = {
> +static const struct dw_pcie_host_ops keystone_pcie_host_ops = {
>   .rd_other_conf = ks_dw_pcie_rd_other_conf,
>   .wr_other_conf = ks_dw_pcie_wr_other_conf,
>   .host_init = ks_pcie_host_init,
> diff --git a/drivers/pci/dwc/pci-layerscape.c 
> b/drivers/pci/dwc/pci-layerscape.c
> index 27d638c4e134..fd861289ad8b 100644
> --- a/drivers/pci/dwc/pci-layerscape.c
> +++ b/drivers/pci/dwc/pci-layerscape.c
> @@ -39,7 +39,7 @@ struct ls_pcie_drvdata {
>   u32 lut_offset;
>   u32 ltssm_shift;
>   u32 lut_dbg;
> - struct dw_pcie_host_ops *ops;
> + const struct dw_pcie_host_ops *ops;
>   const struct dw_pcie_ops *dw_pcie_ops;
>  };
>  
> @@ -185,12 +185,12 @@ static int ls_pcie_msi_host_init(struct pcie_port *pp,
>   return 0;
>  }
>  
> -static struct dw_pcie_host_ops ls1021_pcie_host_ops = {
> +static const struct dw_pcie_host_ops ls1021_pcie_host_ops = {
>   .host_init = ls1021_pcie_host_init,
>   .msi_host_init = ls_pcie_msi_host_init,
>  };
>  
> -static struct dw_pcie_host_ops ls_pcie_host_ops = {
> +static const struct dw_pcie_host_ops ls_pcie_host_ops = {
>   .host_init = ls_pcie_host_init,
>   .msi_host_init = ls_pcie_msi_host_init,
>  };
> diff --git a/drivers/pci/dwc/pcie-armada8k.c b/drivers/pci/dwc/pcie-armada8k.c
> index 495b023042b3..ea8f34af6a85 100644
> --- a/drivers/pci/dwc/pcie-armada8k.c
> +++ b/drivers/pci/dwc/pcie-armada8k.c
> @@ -160,7 +160,7 @@ static irqreturn_t armada8k_pcie_irq_handler(int irq, 
> void *arg)
>   return IRQ_HANDLED;
>  }
>  
> -static struct dw_pcie_host_ops armada8k_pcie_host_ops = {
> +static const struct dw_pcie_host_ops armada8k_pcie_host_ops = {
>   .host_init = armada8k_pcie_host_init,
>  };
>  
> diff --git a/drivers/pci/dwc/pcie-artpec6.c b/drivers/pci/dwc/pcie-artpec6.c
> index 82a04acc42fd..01c6f7823672 100644
> --- a/drivers/pci/dwc/pcie-artpec6.c
> +++ b/drivers/pci/dwc/pcie-artpec6.c
> @@ -184,7 +184,7 @@ static void artpec6_pcie_host_init(struct pcie_port *pp)
>   artpec6_pcie_enable_interrupts(artpec6_pcie);
>  }
>  
> -static struct 

Re: [PATCH v9 07/10] powerpc/perf: PMU functions for Core IMC and hotplugging

2017-06-12 Thread Thomas Gleixner
On Wed, 7 Jun 2017, Anju T Sudhakar wrote:
> On Tuesday 06 June 2017 03:39 PM, Thomas Gleixner wrote:
> > On Mon, 5 Jun 2017, Anju T Sudhakar wrote:
> > > +static void cleanup_all_core_imc_memory(struct imc_pmu *pmu_ptr)
> > > +{
> > > + struct imc_mem_info *ptr = pmu_ptr->mem_info;
> > > +
> > > + if (!ptr)
> > > + return;
> > That's pointless.
> 
> No, it is not.  We may end up here from imc_mem_init() when the memory
> allocation for pmu_ptr->mem_info fails. So in that case we can just
> return from here, and kfree wont be called with a NULL pointer.

What's the problem with that. kfree() CAN be called with a NULL pointer. It
has a check already.

Thanks,

tglx


Re: [RFC PATCH 1/7 v1]powerpc: Free up four PTE bits to accommodate memory keys

2017-06-12 Thread Ram Pai
On Mon, Jun 12, 2017 at 12:27:44PM +0530, Aneesh Kumar K.V wrote:
> Ram Pai  writes:
> 
> > Rearrange  PTE   bits to  free  up  bits 3, 4, 5  and  6  for
> > memory keys. Bit 3, 4, 5, 6 and 57  shall  be used for memory
> > keys.
> >
> > The patch does the following change to the 64K PTE format
> >
> > H_PAGE_BUSY moves from bit 3 to bit 7
> > H_PAGE_F_SECOND which occupied bit 4 moves to the second part
> > of the pte.
> > H_PAGE_F_GIX which  occupied bit 5, 6 and 7 also moves to the
> > second part of the pte.
> >
> > The second part of the PTE will hold
> >a (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for  64K page backed pte,
> >and sixteen (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for 4k  backed
> > pte.
> >
> > the four  bits((H_PAGE_F_SECOND|H_PAGE_F_GIX) that represent a slot
> > is initialized to 0xF indicating a invalid slot. if a hashpage does
> > get  allocated  to  the  0xF  slot, it is released and not used. In
> > other words, even  though  0xF  is  a valid slot we discard it  and
> > consider it as invalid slot(HPTE_SOFT_INVALID). This  gives  us  an
> > opportunity to  not  depend on a bit in the primary PTE in order to
> > determine the validity of a slot.
> 
> Do we need to do this for 64K hptes ? H_PAGE_HASHPTE indicates whether a
> slot is valid or not. For 4K hptes, we do need this right ? ie, only
> when H_PAGE_COMBO is set we need to consider 0xf as an invalid slot

for 64k hptes; you are right, we do not use 0xF to
track the validity of a slot. We just depend on H_PAGE_HASHPTE flag.

for 4k hptes, we need to depend on both H_PAGE_HASHPTE as well as the
value of the slot.  H_PAGE_HASHPTE tells if there exists any valid
4k HPTEs, and the 4-bit values in the second-part-of-the-pte tells
us if they are valid values.

However in either case we do not need H_PAGE_COMBO. That flag is not
used for ptes.  But we continue to use that flag for pmd to track
hugepages, which is why I have not entirely divorced H_PAGE_COMBO from
the 64K pagesize case.

> 
> 
> >
> > When  we  release  a  0xF slot we also release a legitimate primary
> > slot  and  unmap  that  entry. This  is  to  ensure  that we do get
> > a legimate non-0xF slot the next time we retry for a slot.
> 
> Can you explain this more ? what is a primary slot here ?

I may not be using the right terminology here. But when I say slot, i
mean the four bits that tell the position of the hpte in the hash
buckets. Bit 0, indicates if it the primary or secondary hash bucket.
and bit 1,2,3 indicates the entry in the hash bucket.

So when i say primary slot, I mean a entry in the primary hash bucket.

The idea is, when hpte_insert returns a hpte which is cached in the 7slot
of the secondary bucket i.e 0xF, we discard it, and also release a
random entry from the primary bucket, so that on retry we can get that
entry.


> 
> >
> > Though treating 0xF slot as invalid reduces the number of available
> > slots and make have a effect on the performance, the probabilty
> > of hitting a 0xF is extermely low.
> >
> > Compared  to the current scheme, the above described scheme reduces
> > the number of false hash table updates  significantly  and  has the
> > added  advantage  of  releasing  four  valuable  PTE bits for other
> > purpose.
> >
> > This idea was jointly developed by Paul Mackerras, Aneesh, Michael
> > Ellermen and myself.
> >
> > 4K PTE format remain unchanged currently.
> >
> > Signed-off-by: Ram Pai 
> > ---
> >  arch/powerpc/include/asm/book3s/64/hash-4k.h  | 12 +
> >  arch/powerpc/include/asm/book3s/64/hash-64k.h | 38 ++
> >  arch/powerpc/include/asm/book3s/64/hash.h |  8 ++-
> >  arch/powerpc/include/asm/book3s/64/mmu-hash.h |  5 ++
> >  arch/powerpc/mm/dump_linuxpagetables.c|  3 +-
> >  arch/powerpc/mm/hash64_4k.c   | 12 ++---
> >  arch/powerpc/mm/hash64_64k.c  | 73 
> > +--
> >  arch/powerpc/mm/hash_utils_64.c   | 38 +-
> >  arch/powerpc/mm/hugetlbpage-hash64.c  | 16 +++---
> >  9 files changed, 107 insertions(+), 98 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h 
> > b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> > index b4b5e6b..223d318 100644
> > --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
> > +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> > @@ -16,6 +16,18 @@
> >  #define H_PUD_TABLE_SIZE   (sizeof(pud_t) << H_PUD_INDEX_SIZE)
> >  #define H_PGD_TABLE_SIZE   (sizeof(pgd_t) << H_PGD_INDEX_SIZE)
> >
> > +
> > +/*
> > + * Only supported by 4k linux page size
> 
> that comment is confusing, you can drop that, it is part of hash-4k.h
> which means these defines are local to 4k linux page size config.
> 
> > + */

right. ok.

> > +#define H_PAGE_F_SECOND_RPAGE_RSV2 /* HPTE is in 2ndary HPTEG 
> > */
> > +#define H_PAGE_F_GIX   (_RPAGE_RSV3 | _RPAGE_RSV4 | _RPAGE_RPN44)
> > +#define H_PAGE_F_GIX_SHIFT 56
> > +

Re: [PATCH v2 2/3] EDAC: altera: simplify calculation of total memory

2017-06-12 Thread Thor Thayer

On 06/06/2017 06:54 PM, Chris Packham wrote:

Use of_address_to_resource() and resource_size() instead of manually
parsing the "reg" property from the "memory" node(s).

Signed-off-by: Chris Packham 
---
Changes in v2:
- New

  drivers/edac/altera_edac.c | 24 
  1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 7717b094fabb..f8b623352627 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -214,24 +214,16 @@ static void altr_sdr_mc_create_debugfs_nodes(struct 
mem_ctl_info *mci)
  static unsigned long get_total_mem(void)
  {
struct device_node *np = NULL;
-   const unsigned int *reg, *reg_end;
-   int len, sw, aw;
-   unsigned long start, size, total_mem = 0;
+   struct resource res;
+   int ret;
+   unsigned long total_mem = 0;
  
  	for_each_node_by_type(np, "memory") {

-   aw = of_n_addr_cells(np);
-   sw = of_n_size_cells(np);
-   reg = (const unsigned int *)of_get_property(np, "reg", );
-   reg_end = reg + (len / sizeof(u32));
-
-   total_mem = 0;
-   do {
-   start = of_read_number(reg, aw);
-   reg += aw;
-   size = of_read_number(reg, sw);
-   reg += sw;
-   total_mem += size;
-   } while (reg < reg_end);
+   ret = of_address_to_resource(np, 0, );
+   if (ret)
+   continue;
+
+   total_mem += resource_size();
}
edac_dbg(0, "total_mem 0x%lx\n", total_mem);
return total_mem;


Nice change! Tested on Cyclone5 DevKit & Arria10 DevKit.

Tested-by: Thor Thayer 


Re: [PATCH v2] net: phy: Make phy_ethtool_ksettings_get return void

2017-06-12 Thread kbuild test robot
Hi Yuval,

[auto build test ERROR on net-next/master]
[also build test ERROR on next-20170609]
[cannot apply to v4.12-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Yuval-Shaia/net-phy-Make-phy_ethtool_ksettings_get-return-void/20170613-005407
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c: In function 
'xgene_get_link_ksettings':
>> drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:134:10: error: void 
>> value not ignored as it ought to be
  return phy_ethtool_ksettings_get(phydev, cmd);
 ^~
   drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:140:11: error: void 
value not ignored as it ought to be
   return phy_ethtool_ksettings_get(phydev, cmd);
  ^~
--
   drivers/net/ethernet/apm/xgene-v2/ethtool.c: In function 
'xge_get_link_ksettings':
>> drivers/net/ethernet/apm/xgene-v2/ethtool.c:160:9: error: void value not 
>> ignored as it ought to be
 return phy_ethtool_ksettings_get(phydev, cmd);
^~
   drivers/net/ethernet/apm/xgene-v2/ethtool.c:161:1: warning: control reaches 
end of non-void function [-Wreturn-type]
}
^

vim +134 drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c

e6ad7673 Iyappan Subramanian 2014-08-07  118strcpy(info->version, 
XGENE_DRV_VERSION);
e6ad7673 Iyappan Subramanian 2014-08-07  119snprintf(info->fw_version, 
ETHTOOL_FWVERS_LEN, "N/A");
e6ad7673 Iyappan Subramanian 2014-08-07  120sprintf(info->bus_info, "%s", 
pdev->name);
e6ad7673 Iyappan Subramanian 2014-08-07  121  }
e6ad7673 Iyappan Subramanian 2014-08-07  122  
36a19b29 Philippe Reynes 2016-09-11  123  static int 
xgene_get_link_ksettings(struct net_device *ndev,
36a19b29 Philippe Reynes 2016-09-11  124
struct ethtool_link_ksettings *cmd)
e6ad7673 Iyappan Subramanian 2014-08-07  125  {
e6ad7673 Iyappan Subramanian 2014-08-07  126struct xgene_enet_pdata *pdata 
= netdev_priv(ndev);
971d3a44 Philippe Reynes 2016-09-11  127struct phy_device *phydev = 
ndev->phydev;
36a19b29 Philippe Reynes 2016-09-11  128u32 supported;
e6ad7673 Iyappan Subramanian 2014-08-07  129  
326dde3e Iyappan Subramanian 2017-05-18  130if 
(phy_interface_mode_is_rgmii(pdata->phy_mode)) {
e6ad7673 Iyappan Subramanian 2014-08-07  131if (phydev == NULL)
e6ad7673 Iyappan Subramanian 2014-08-07  132return -ENODEV;
e6ad7673 Iyappan Subramanian 2014-08-07  133  
36a19b29 Philippe Reynes 2016-09-11 @134return 
phy_ethtool_ksettings_get(phydev, cmd);
5e6a024b Iyappan Subramanian 2014-10-13  135} else if (pdata->phy_mode == 
PHY_INTERFACE_MODE_SGMII) {
52d1fd99 Iyappan Subramanian 2016-07-25  136if (pdata->mdio_driver) 
{
52d1fd99 Iyappan Subramanian 2016-07-25  137if (!phydev)
52d1fd99 Iyappan Subramanian 2016-07-25  138return 
-ENODEV;
52d1fd99 Iyappan Subramanian 2016-07-25  139  
36a19b29 Philippe Reynes 2016-09-11  140return 
phy_ethtool_ksettings_get(phydev, cmd);
52d1fd99 Iyappan Subramanian 2016-07-25  141}
52d1fd99 Iyappan Subramanian 2016-07-25  142  

:: The code at line 134 was first introduced by commit
:: 36a19b299536746f5c01d7716dac962f831e4d38 net: ethernet: apm: xgene: use 
new api ethtool_{get|set}_link_ksettings

:: TO: Philippe Reynes 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 11/14] powerpc/64s: cpuidle read mostly for common globals

2017-06-12 Thread Vaidyanathan Srinivasan
* Gautham R Shenoy  [2017-06-12 21:00:27]:

> On Mon, Jun 12, 2017 at 09:58:32AM +1000, Nicholas Piggin wrote:
> > Ensure these don't get put into bouncing cachelines.
> > 
> > Signed-off-by: Nicholas Piggin 
> 
> Reviewed-by: Gautham R. Shenoy 
 
Reviewed-by: Vaidyanathan Srinivasan 
 
> > ---
> >  drivers/cpuidle/cpuidle-powernv.c | 10 +-
> >  drivers/cpuidle/cpuidle-pseries.c |  8 
> >  2 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/cpuidle/cpuidle-powernv.c 
> > b/drivers/cpuidle/cpuidle-powernv.c
> > index 50b3c2e0306f..9d03326ac05e 100644
> > --- a/drivers/cpuidle/cpuidle-powernv.c
> > +++ b/drivers/cpuidle/cpuidle-powernv.c
> > @@ -32,18 +32,18 @@ static struct cpuidle_driver powernv_idle_driver = {
> > .owner= THIS_MODULE,
> >  };
> > 
> > -static int max_idle_state;
> > -static struct cpuidle_state *cpuidle_state_table;
> > +static int max_idle_state __read_mostly;
> > +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> > 
> >  struct stop_psscr_table {
> > u64 val;
> > u64 mask;
> >  };
> > 
> > -static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX];
> > +static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX] 
> > __read_mostly;
> > 
> > -static u64 snooze_timeout;
> > -static bool snooze_timeout_en;
> > +static u64 snooze_timeout __read_mostly;
> > +static bool snooze_timeout_en __read_mostly;
> > 
> >  static int snooze_loop(struct cpuidle_device *dev,
> > struct cpuidle_driver *drv,
> > diff --git a/drivers/cpuidle/cpuidle-pseries.c 
> > b/drivers/cpuidle/cpuidle-pseries.c
> > index 7b12bb2ea70f..a404f352d284 100644
> > --- a/drivers/cpuidle/cpuidle-pseries.c
> > +++ b/drivers/cpuidle/cpuidle-pseries.c
> > @@ -25,10 +25,10 @@ struct cpuidle_driver pseries_idle_driver = {
> > .owner= THIS_MODULE,
> >  };
> > 
> > -static int max_idle_state;
> > -static struct cpuidle_state *cpuidle_state_table;
> > -static u64 snooze_timeout;
> > -static bool snooze_timeout_en;
> > +static int max_idle_state __read_mostly;
> > +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> > +static u64 snooze_timeout __read_mostly;
> > +static bool snooze_timeout_en __read_mostly;
> > 

Simple annotation of  __read_mostly could save us a few cache line
bounces.  Good idea.

--Vaidy



Re: [PATCH 12/14] powerpc/64s: cpuidle no memory barrier after break from idle

2017-06-12 Thread Vaidyanathan Srinivasan
* Nicholas Piggin  [2017-06-12 09:58:33]:

> A memory barrier is not required after the task wakes up,
> only if we clear the polling flag before waking. The case
> where we have work to do is the important one, so optimise
> for it.
> 
> Signed-off-by: Nicholas Piggin 

Reviewed-by: Vaidyanathan Srinivasan 


> ---
>  drivers/cpuidle/cpuidle-powernv.c | 11 +--
>  drivers/cpuidle/cpuidle-pseries.c | 11 +--
>  2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c 
> b/drivers/cpuidle/cpuidle-powernv.c
> index 9d03326ac05e..37b0698b7193 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -59,14 +59,21 @@ static int snooze_loop(struct cpuidle_device *dev,
>   ppc64_runlatch_off();
>   HMT_very_low();
>   while (!need_resched()) {
> - if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time)
> + if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) {
> + /*
> +  * Task has not woken up but we are exiting the polling
> +  * loop anyway. Require a barrier after polling is
> +  * cleared to order subsequent test of need_resched().
> +  */
> + clear_thread_flag(TIF_POLLING_NRFLAG);
> + smp_mb();
>   break;
> + }
>   }
> 
>   HMT_medium();
>   ppc64_runlatch_on();
>   clear_thread_flag(TIF_POLLING_NRFLAG);
> - smp_mb();

If we reach here without executing if(snooze_timeout) with the
barrier+break, that means we have seen the need_resched flag and hence
we can avoid the barrier.  Clearing of the polling flag can be seen
(take affect) later as we will exit the idle loop and re-enter anyway
at this point.  The caller also will check for need_resched and exit
the idle loop.

Actually do_idle() has a __current_set_polling() and
__current_clr_polling() in the default idle loop.  Do we really need
to set/clear the TIF_POLLING_NRFLAG again in cpuidle driver?

--Vaidy



Re: [PATCH 13/14] powerpc/64: runlatch CTRL[RUN] set optimisation

2017-06-12 Thread Vaidyanathan Srinivasan
* Nicholas Piggin  [2017-06-12 09:58:34]:

> The CTRL register is read-only except bit 63 which is the run latch
> control. This means it can be updated with a mtspr rather than
> mfspr/mtspr.
> 
> Signed-off-by: Nicholas Piggin 

Reviewed-by: Vaidyanathan Srinivasan 

> ---
>  arch/powerpc/kernel/process.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index baae104b16c7..a44ea034c226 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1960,12 +1960,8 @@ void show_stack(struct task_struct *tsk, unsigned long 
> *stack)
>  void notrace __ppc64_runlatch_on(void)
>  {
>   struct thread_info *ti = current_thread_info();
> - unsigned long ctrl;
> -
> - ctrl = mfspr(SPRN_CTRLF);
> - ctrl |= CTRL_RUNLATCH;
> - mtspr(SPRN_CTRLT, ctrl);
> 
> + mtspr(SPRN_CTRLT, CTRL_RUNLATCH);
>   ti->local_flags |= _TLF_RUNLATCH;
>  }
> 
> @@ -1973,13 +1969,9 @@ void notrace __ppc64_runlatch_on(void)
>  void notrace __ppc64_runlatch_off(void)
>  {
>   struct thread_info *ti = current_thread_info();
> - unsigned long ctrl;
> 
>   ti->local_flags &= ~_TLF_RUNLATCH;
> -
> - ctrl = mfspr(SPRN_CTRLF);
> - ctrl &= ~CTRL_RUNLATCH;
> - mtspr(SPRN_CTRLT, ctrl);
> + mtspr(SPRN_CTRLT, 0);

Good idea.  Writing to CTRL register can change only the RUN field.
Was this any different in older generations?  Anton and Ben kept the
mfspr/mtspr part in earlier updates to this routine.

--Vaidy



Re: [PATCH 14/14] powerpc/64s: idle runlatch switch is done with MSR[EE]=0

2017-06-12 Thread Vaidyanathan Srinivasan
* Nicholas Piggin  [2017-06-12 09:58:35]:

> 2*mfmsr and 2*mtmsr can be avoided in the idle sleep/wake code
> because we know the MSR[EE] is clear.

Good optimization for powernv.
 
> Signed-off-by: Nicholas Piggin 

Acked-by: Vaidyanathan Srinivasan 

> ---
>  arch/powerpc/platforms/powernv/idle.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/idle.c 
> b/arch/powerpc/platforms/powernv/idle.c
> index ee416e016387..84c55a5ef7ea 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -291,9 +291,9 @@ static unsigned long __power7_idle_type(unsigned long 
> type)
>   if (!prep_irq_for_idle_irqsoff())
>   return 0;
> 
> - ppc64_runlatch_off();
> + __ppc64_runlatch_off();
>   srr1 = power7_idle_insn(type);
> - ppc64_runlatch_on();
> + __ppc64_runlatch_on();
> 
>   fini_irq_for_idle_irqsoff();
> 
> @@ -328,9 +328,9 @@ static unsigned long __power9_idle_type(unsigned long 
> stop_psscr_val,
>   psscr = mfspr(SPRN_PSSCR);
>   psscr = (psscr & ~stop_psscr_mask) | stop_psscr_val;
> 
> - ppc64_runlatch_off();
> + __ppc64_runlatch_off();
>   srr1 = power9_idle_stop(psscr);
> - ppc64_runlatch_on();
> + __ppc64_runlatch_on();
> 
>   fini_irq_for_idle_irqsoff();
> 
> @@ -365,7 +365,7 @@ unsigned long pnv_cpu_offline(unsigned int cpu)
>   unsigned long srr1;
>   u32 idle_states = pnv_get_supported_cpuidle_states();
> 
> - ppc64_runlatch_off();
> + __ppc64_runlatch_off();
> 
>   if (cpu_has_feature(CPU_FTR_ARCH_300) && deepest_stop_found) {
>   unsigned long psscr;
> @@ -392,7 +392,7 @@ unsigned long pnv_cpu_offline(unsigned int cpu)
>   HMT_medium();
>   }
> 
> - ppc64_runlatch_on();
> + __ppc64_runlatch_on();
> 
>   return srr1;
>  }
> -- 
> 2.11.0
> 



Re: [PATCH 11/14] powerpc/64s: cpuidle read mostly for common globals

2017-06-12 Thread Gautham R Shenoy
On Mon, Jun 12, 2017 at 09:58:32AM +1000, Nicholas Piggin wrote:
> Ensure these don't get put into bouncing cachelines.
> 
> Signed-off-by: Nicholas Piggin 

Reviewed-by: Gautham R. Shenoy 

> ---
>  drivers/cpuidle/cpuidle-powernv.c | 10 +-
>  drivers/cpuidle/cpuidle-pseries.c |  8 
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c 
> b/drivers/cpuidle/cpuidle-powernv.c
> index 50b3c2e0306f..9d03326ac05e 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -32,18 +32,18 @@ static struct cpuidle_driver powernv_idle_driver = {
>   .owner= THIS_MODULE,
>  };
> 
> -static int max_idle_state;
> -static struct cpuidle_state *cpuidle_state_table;
> +static int max_idle_state __read_mostly;
> +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> 
>  struct stop_psscr_table {
>   u64 val;
>   u64 mask;
>  };
> 
> -static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX];
> +static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX] 
> __read_mostly;
> 
> -static u64 snooze_timeout;
> -static bool snooze_timeout_en;
> +static u64 snooze_timeout __read_mostly;
> +static bool snooze_timeout_en __read_mostly;
> 
>  static int snooze_loop(struct cpuidle_device *dev,
>   struct cpuidle_driver *drv,
> diff --git a/drivers/cpuidle/cpuidle-pseries.c 
> b/drivers/cpuidle/cpuidle-pseries.c
> index 7b12bb2ea70f..a404f352d284 100644
> --- a/drivers/cpuidle/cpuidle-pseries.c
> +++ b/drivers/cpuidle/cpuidle-pseries.c
> @@ -25,10 +25,10 @@ struct cpuidle_driver pseries_idle_driver = {
>   .owner= THIS_MODULE,
>  };
> 
> -static int max_idle_state;
> -static struct cpuidle_state *cpuidle_state_table;
> -static u64 snooze_timeout;
> -static bool snooze_timeout_en;
> +static int max_idle_state __read_mostly;
> +static struct cpuidle_state *cpuidle_state_table __read_mostly;
> +static u64 snooze_timeout __read_mostly;
> +static bool snooze_timeout_en __read_mostly;
> 
>  static inline void idle_loop_prolog(unsigned long *in_purr)
>  {
> -- 
> 2.11.0
> 



Re: [PATCH 10/14] powerpc/64s: cpuidle set polling before enabling irqs

2017-06-12 Thread Nicholas Piggin
On Mon, 12 Jun 2017 20:40:25 +0530
Gautham R Shenoy  wrote:

> On Mon, Jun 12, 2017 at 09:58:31AM +1000, Nicholas Piggin wrote:
> > local_irq_enable can cause interrupts to be taken which could
> > take significant amount of processing time. The idle process
> > should set its polling flag before this, so another process that
> > wakes it during this time will not have to send an IPI.
> > 
> > Expand the TIF_POLLING_NRFLAG coverage to as large as possible.
> > 
> > Signed-off-by: Nicholas Piggin   
> 
> Looks good. Were you able to see this make a difference in any of the
> tests ?

No I didn't measure a difference or have a test case where this was
noticable. I think on a workload with some IO interrupts as well as
cross-CPU wakeups, then statistically we should see some improvement
in IPI rates with this patch.

Thanks,
Nick


Re: [PATCH 10/14] powerpc/64s: cpuidle set polling before enabling irqs

2017-06-12 Thread Gautham R Shenoy
On Mon, Jun 12, 2017 at 09:58:31AM +1000, Nicholas Piggin wrote:
> local_irq_enable can cause interrupts to be taken which could
> take significant amount of processing time. The idle process
> should set its polling flag before this, so another process that
> wakes it during this time will not have to send an IPI.
> 
> Expand the TIF_POLLING_NRFLAG coverage to as large as possible.
> 
> Signed-off-by: Nicholas Piggin 

Looks good. Were you able to see this make a difference in any of the
tests ?

Reviewed-by: Gautham R. Shenoy 

> ---
>  drivers/cpuidle/cpuidle-powernv.c | 4 +++-
>  drivers/cpuidle/cpuidle-pseries.c | 3 ++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle-powernv.c 
> b/drivers/cpuidle/cpuidle-powernv.c
> index 79152676f62b..50b3c2e0306f 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -51,9 +51,10 @@ static int snooze_loop(struct cpuidle_device *dev,
>  {
>   u64 snooze_exit_time;
> 
> - local_irq_enable();
>   set_thread_flag(TIF_POLLING_NRFLAG);
> 
> + local_irq_enable();
> +
>   snooze_exit_time = get_tb() + snooze_timeout;
>   ppc64_runlatch_off();
>   HMT_very_low();
> @@ -66,6 +67,7 @@ static int snooze_loop(struct cpuidle_device *dev,
>   ppc64_runlatch_on();
>   clear_thread_flag(TIF_POLLING_NRFLAG);
>   smp_mb();
> +
>   return index;
>  }
> 
> diff --git a/drivers/cpuidle/cpuidle-pseries.c 
> b/drivers/cpuidle/cpuidle-pseries.c
> index 166ccd711ec9..7b12bb2ea70f 100644
> --- a/drivers/cpuidle/cpuidle-pseries.c
> +++ b/drivers/cpuidle/cpuidle-pseries.c
> @@ -62,9 +62,10 @@ static int snooze_loop(struct cpuidle_device *dev,
>   unsigned long in_purr;
>   u64 snooze_exit_time;
> 
> + set_thread_flag(TIF_POLLING_NRFLAG);
> +
>   idle_loop_prolog(_purr);
>   local_irq_enable();
> - set_thread_flag(TIF_POLLING_NRFLAG);
>   snooze_exit_time = get_tb() + snooze_timeout;
> 
>   while (!need_resched()) {
> -- 
> 2.11.0
> 



Re: [PATCH 09/14] powerpc/64s: idle hmi wakeup is unlikely

2017-06-12 Thread Gautham R Shenoy
On Mon, Jun 12, 2017 at 09:58:30AM +1000, Nicholas Piggin wrote:
> In a busy system, idle wakeups can be expected from IPIs and device
> interrupts.
> 
> Signed-off-by: Nicholas Piggin 

Reviewed-by: Gautham R. Shenoy 
> ---
>  arch/powerpc/kernel/idle_book3s.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/idle_book3s.S 
> b/arch/powerpc/kernel/idle_book3s.S
> index 6305d4d7a268..32b76fb28352 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -306,7 +306,7 @@ FTR_SECTION_ELSE_NESTED(66);  
> \
>   rlwinm  r0,r12,45-31,0xe;  /* P7 wake reason field is 3 bits */ \
>  ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66); \
>   cmpwi   r0,0xa; /* Hypervisor maintenance ? */  \
> - bne 20f;\
> + bne+20f;\
>   /* Invoke opal call to handle hmi */\
>   ld  r2,PACATOC(r13);\
>   ld  r1,PACAR1(r13); \
> -- 
> 2.11.0
> 



Re: [PATCH v2] net: phy: Make phy_ethtool_ksettings_get return void

2017-06-12 Thread David Miller
From: David Miller 
Date: Mon, 12 Jun 2017 10:25:25 -0400 (EDT)

> From: Yuval Shaia 
> Date: Mon, 12 Jun 2017 17:15:08 +0300
> 
>> Make return value void since function never return meaningfull value
>> 
>> Signed-off-by: Yuval Shaia 
>> Acked-by: Sergei Shtylyov 
>> ---
>> v0 ->v1:
>>  * These files were missing in v0
>>  * drivers/net/ethernet/renesas/ravb_main.c
>>  * drivers/net/ethernet/renesas/sh_eth.c
>>  * drivers/net/ethernet/ti/netcp_ethss.c
>>  * Add Acked-by: Sergei Shtylyov
>> v1 -> v2:
>>  * Adjust to net-next tree
> 
> Applied, thank you.

Reverted, please test your build properly:

drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c: In function 
‘xgene_get_link_ksettings’:
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:134:10: error: void value 
not ignored as it ought to be
   return phy_ethtool_ksettings_get(phydev, cmd);
  ^
drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.c:140:11: error: void value 
not ignored as it ought to be
return phy_ethtool_ksettings_get(phydev, cmd);
   ^
scripts/Makefile.build:302: recipe for target 
'drivers/net/ethernet/apm/xgene/xgene_enet_ethtool.o' failed


Re: [PATCH 04/14] powerpc/64s: idle process interrupts from system reset wakeup

2017-06-12 Thread Nicholas Piggin
On Mon, 12 Jun 2017 15:11:06 +0530
Gautham R Shenoy  wrote:

> Hi Nick,
> 
> On Mon, Jun 12, 2017 at 09:58:25AM +1000, Nicholas Piggin wrote:
> > When the CPU wakes from low power state, it begins at the system reset
> > interrupt with the exception that caused the wakeup encoded in SRR1.
> > 
> > Today, powernv idle wakeup ignores the wakeup reason (except a special
> > case for HMI), and the regular interrupt corresponding to the
> > exception will fire after the idle wakeup exits.
> > 
> > Change this to replay the interrupt from the idle wakeup before
> > interrupts are hard-enabled.
> > 
> > Test on POWER8 of context_switch selftests benchmark with polling idle
> > disabled (e.g., always nap, giving cross-CPU IPIs) gives the following
> > results:
> > 
> > original wakeup direct
> > Different threads, same core:   315k/s   264k/s
> > Different cores:235k/s   242k/s
> > 
> > There is a slowdown for doorbell IPI (same core) case because system
> > reset wakeup does not clear the message and the doorbell interrupt
> > fires again needlessly.  
> 
> Should we clear the doorbell message if we are recording the fact that
> the Doorbell irq has happened in paca ?

As you saw, I clear it in the next patch.

It would be quite tidy to msgclear when moving srr1 wakeup into pending
mask. But on the other hand, I thought that deferring the clear as late
as possible and moving it closer to where IRQs will be hard enabled
again may help to avoid taking other IPIs.

> 
> > 
> > Signed-off-by: Nicholas Piggin 
> > ---
> >  arch/powerpc/include/asm/hw_irq.h |  2 ++
> >  arch/powerpc/kernel/irq.c | 25 +
> >  arch/powerpc/platforms/powernv/idle.c | 10 --
> >  3 files changed, 35 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/hw_irq.h 
> > b/arch/powerpc/include/asm/hw_irq.h
> > index f06112cf8734..8366bdc69988 100644  
> 
> [..snip..]
> 
> > --- a/arch/powerpc/kernel/irq.c
> > +++ b/arch/powerpc/kernel/irq.c
> > @@ -348,6 +348,7 @@ bool prep_irq_for_idle(void)
> > return true;
> >  }
> > 
> > +#ifdef CONFIG_PPC_BOOK3S
> >  /*
> >   * This is for idle sequences that return with IRQs off, but the
> >   * idle state itself wakes on interrupt. Tell the irq tracer that
> > @@ -379,6 +380,30 @@ bool prep_irq_for_idle_irqsoff(void)
> >  }
> > 
> >  /*
> > + * Take the SRR1 wakeup reason, index into this table to find the
> > + * appropriate irq_happened bit.
> > + */
> > +static const u8 srr1_to_irq[0x10] = {
> > +   0, 0, 0,
> > +   PACA_IRQ_DBELL,
> > +   0,
> > +   PACA_IRQ_DBELL,
> > +   PACA_IRQ_DEC,
> > +   0,
> > +   PACA_IRQ_EE,
> > +   PACA_IRQ_EE,
> > +   PACA_IRQ_HMI,
> > +   0, 0, 0, 0, 0 };
> > +
> > +void irq_set_pending_from_srr1(unsigned long srr1)
> > +{
> > +   unsigned int idx = (srr1 >> 18) & SRR1_WAKEMASK_P8;  
> 
> Shouldn't this be
>   unsigned int idx = (srr1 & SRR1_WAKEMASK_P8) >> 18;
>   
>   ?

Yes, good catch. That will teach me not to verify after making a change.
Will fix.

Thanks,
Nick


Re: [PATCH 03/14] powerpc/64s: idle provide a default idle for POWER9

2017-06-12 Thread Nicholas Piggin
On Mon, 12 Jun 2017 14:23:16 +0530
Gautham R Shenoy  wrote:

> Hi Nick,
> 
> On Mon, Jun 12, 2017 at 09:58:24AM +1000, Nicholas Piggin wrote:
> > Before the cpuidle driver is enabled, provide a default idle
> > function similarly to POWER7/8.
> > 
> > This should not have much effect, because the cpuidle driver
> > for powernv is mandatory, but if that changes we should have
> > a fallback.
> > 
> > Signed-off-by: Nicholas Piggin 
> > ---
> >  arch/powerpc/platforms/powernv/idle.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/powerpc/platforms/powernv/idle.c 
> > b/arch/powerpc/platforms/powernv/idle.c
> > index f188d84d9c59..e327e1585ddc 100644
> > --- a/arch/powerpc/platforms/powernv/idle.c
> > +++ b/arch/powerpc/platforms/powernv/idle.c
> > @@ -677,6 +677,8 @@ static int __init pnv_init_idle_states(void)
> > 
> > if (supported_cpuidle_states & OPAL_PM_NAP_ENABLED)
> > ppc_md.power_save = power7_idle;
> > +   else if (supported_cpuidle_states & OPAL_PM_STOP_INST_FAST)
> > +   ppc_md.power_save = power9_idle;  
> 
> We are already initializing this in pnv_power9_idle_init() depending
> on whether the device tree has exposed at least one INST_FAST idle
> state. Else this should be NULL, because the firmware doesn't want us
> to use a platform idle state!

Ah I missed that, thanks. Will drop this one.

Thanks,
Nick


Re: [PATCH 01/14] powerpc/64s: idle move soft interrupt mask logic into C code

2017-06-12 Thread Nicholas Piggin
Hi Gautham,

Thanks for the reviews.

On Mon, 12 Jun 2017 14:07:27 +0530
Gautham R Shenoy  wrote:

> Hi Nick,
> 
> (Added Paul Mackerass to the Cc)
> On Mon, Jun 12, 2017 at 09:58:22AM +1000, Nicholas Piggin wrote:
> > This simplifies the asm and fixes irq-off tracing over sleep
> > instructions.
> > 
> > Also move powersave_nap check for POWER8 into C code, and move
> > PSSCR register value calculation for POWER9 into C.
> >  
> 
> Thanks for doing this. Only one minor comment.
> 
> > Signed-off-by: Nicholas Piggin 
> > ---
> > index 98a6d07ecb5c..35cf5bb7daed 100644
> > --- a/arch/powerpc/kernel/idle_book3s.S
> > +++ b/arch/powerpc/kernel/idle_book3s.S  
> 
> [..snip..]
> 
> > @@ -109,13 +109,9 @@ core_idle_lock_held:
> >  /*
> >   * Pass requested state in r3:
> >   * r3 - PNV_THREAD_NAP/SLEEP/WINKLE in POWER8
> > - *- Requested STOP state in POWER9
> > + *- Requested PSSCR value in POWER9
> >   *
> > - * To check IRQ_HAPPENED in r4
> > - * 0 - don't check
> > - * 1 - check
> > - *
> > - * Address to 'rfid' to in r5
> > + * Address of idle handler to 'rfid' to in r4
> >   */
> >  pnv_powersave_common:
> > /* Use r3 to pass state nap/sleep/winkle */
> > @@ -131,30 +127,7 @@ pnv_powersave_common:
> > std r0,_LINK(r1)
> > std r0,_NIP(r1)
> > 
> > -   /* Hard disable interrupts */
> > -   mfmsr   r9
> > -   rldicl  r9,r9,48,1
> > -   rotldi  r9,r9,16
> > -   mtmsrd  r9,1/* hard-disable interrupts */
> > -
> > -   /* Check if something happened while soft-disabled */
> > -   lbz r0,PACAIRQHAPPENED(r13)
> > -   andi.   r0,r0,~PACA_IRQ_HARD_DIS@l
> > -   beq 1f
> > -   cmpwi   cr0,r4,0  
> 
> There were callers to power7_nap() in the dynamic-core-split/unsplit
> which wanted nap to be forced irrespective of whether an irq was
> pending or not. With this new patch, there won't be a way to enforce
> that on POWER8.

Actually there are two APIs to sleep now, the low level one which
does not check lazy irq or nap disable is power7_idle_insn(). The
one which sets up the lazy irq state is power7_idle_type(). The
dynamic core split calls the former, so AFAIKS it should be equivalent.

Not the best names perhaps. Open to better suggestions.

Thanks,
Nick


[next-20170609] WARNING: CPU: 3 PID: 71167 at lib/idr.c:157 idr_replace

2017-06-12 Thread Abdul Haleem
Hi,

WARN_ON_ONCE is being called from idr_replace() function in file
lib/idr.c at line 157

struct radix_tree_node *node;
void __rcu **slot = NULL;
void *entry;

if (WARN_ON_ONCE(id < 0))
return ERR_PTR(-EINVAL);
if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
return ERR_PTR(-EINVAL);

entry = __radix_tree_lookup(>idr_rt, id, , );


Test: Trinity (https://github.com/kernelslacker/trinity)
Machine : Power 8 PowerVM LPAR
Kernel : 4.12.0-rc4-next-20170606
gcc : version 5.2.1
config : attached

trace logs:
[ cut here ]
WARNING: CPU: 3 PID: 71167 at lib/idr.c:157 idr_replace+0x100/0x110
Modules linked in: xts(E) ip_set(E) ipmi_powernv(E) ipmi_devintf(E)
shpchp(E) ibmpowernv(E) ofpart(E) uio_pdrv_genirq(E) sg(E) ses(E)
at24(E) tg3(E) bnx2x(E) ahci(E) loop(E) xt_CHECKSUM(E) ipt_MASQUERADE(E)
nf_nat_masquerade_ipv4(E) tun(E) kvm_hv(E) kvm_pr(E) kvm(E)
ip6t_rpfilter(E) ipt_REJECT(E) nf_reject_ipv4(E) ip6t_REJECT(E)
nf_reject_ipv6(E) xt_conntrack(E) nfnetlink(E) ebtable_nat(E)
ebtable_broute(E) bridge(E) stp(E) llc(E) ip6table_nat(E)
nf_conntrack_ipv6(E) nf_defrag_ipv6(E) nf_nat_ipv6(E) ip6table_mangle(E)
ip6table_security(E) ip6table_raw(E) iptable_nat(E) nf_conntrack_ipv4(E)
nf_defrag_ipv4(E) nf_nat_ipv4(E) nf_nat(E) nf_conntrack(E)
iptable_mangle(E) iptable_security(E) iptable_raw(E) ebtable_filter(E)
ebtables(E) ip6table_filter(E) ip6_tables(E) iptable_filter(E)
i2c_dev(E)
[29316.280682]  ghash_generic(E) gf128mul(E) vmx_crypto(E) enclosure(E)
scsi_transport_sas(E) nvmem_core(E) opal_prd(E) ipmi_msghandler(E)
powernv_rng(E) powernv_flash(E) uio(E) rtc_opal(E) mtd(E) i2c_opal(E)
nfsd(E) auth_rpcgss(E) nfs_acl(E) lockd(E) grace(E) sunrpc(E)
ip_tables(E) ext4(E) jbd2(E) fscrypto(E) mbcache(E) sd_mod(E) mdio(E)
libcrc32c(E) ptp(E) ast(E) i2c_algo_bit(E) drm_kms_helper(E)
syscopyarea(E) sysfillrect(E) sysimgblt(E) fb_sys_fops(E) ttm(E) drm(E)
aacraid(E) libahci(E) libata(E) i2c_core(E) pps_core(E) dm_mirror(E)
dm_region_hash(E) dm_log(E) dm_mod(E) [last unloaded: xts]
CPU: 3 PID: 71167 Comm: trinity-c43 Tainted: GE
4.12.0-rc4-next-20170609-autotest #1
task: c03bd0799500 task.stack: c011e81f
NIP: c04d20a0 LR: dfc16a98 CTR: c04d1fa0
REGS: c011e81f38d0 TRAP: 0700   Tainted: GE
(4.12.0-rc4-next-20170609-autotest)
MSR: 90029033 
  CR: 28002428  XER: 2000  
CFAR: c04d1fd4 SOFTE: 1 
GPR00: dfc16a98 c011e81f3b50 c106d800 c0334c89de38 
GPR04:  d7d7d7d7 d7d7d7d7  
GPR08: c011e81f4000  8003 dfc47760 
GPR12: c04d1fa0 cfac1f80  10030d70 
GPR16: 10030f38  dfc17150 0008 
GPR20: dfc4f4e0 7fff7996 0009  
GPR24:  c011e81f3c50 0008 dfc61958 
GPR28: c0334c89de50 c0334c89de38 d7d7d7d7 d7d7d7d7 
NIP [c04d20a0] idr_replace+0x100/0x110
LR [dfc16a98] drm_gem_handle_delete+0x58/0x120 [drm]
Call Trace:
[c011e81f3b50] [c011e81f3bf0] 0xc011e81f3bf0 (unreliable)
[c011e81f3ba0] [dfc16a98] drm_gem_handle_delete+0x58/0x120 [drm]
[c011e81f3bf0] [dfc17e80] drm_ioctl+0x270/0x4e0 [drm]
[c011e81f3d40] [c0344108] do_vfs_ioctl+0xc8/0x8c0
[c011e81f3de0] [c03449c4] SyS_ioctl+0xc4/0xe0
[c011e81f3e30] [c000af84] system_call+0x38/0xe0
Instruction dump:
38210050 7f83e378 e8010010 eb81ffe0 eba1ffe8 ebc1fff0 ebe1fff8 7c0803a6
4e800020 0fe0 3860ffea 4b94 <0fe0> 3860ffea 4b88 6042
---[ end trace 5158244f52496ab9 ]---
_exception: 47 callbacks suppressed


-- 
Regard's

Abdul Haleem
IBM Linux Technology Centre


#
# Automatically generated file; DO NOT EDIT.
# Linux/powerpc 4.11.0-rc7 Kernel Configuration
#
CONFIG_PPC64=y

#
# Processor support
#
CONFIG_PPC_BOOK3S_64=y
# CONFIG_PPC_BOOK3E_64 is not set
# CONFIG_POWER7_CPU is not set
CONFIG_POWER8_CPU=y
CONFIG_PPC_BOOK3S=y
CONFIG_PPC_FPU=y
CONFIG_ALTIVEC=y
CONFIG_VSX=y
# CONFIG_PPC_ICSWX is not set
CONFIG_PPC_STD_MMU=y
CONFIG_PPC_STD_MMU_64=y
CONFIG_PPC_RADIX_MMU=y
CONFIG_PPC_MM_SLICES=y
CONFIG_PPC_HAVE_PMU_SUPPORT=y
CONFIG_PPC_PERF_CTRS=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2048
CONFIG_PPC_DOORBELL=y
# CONFIG_CPU_BIG_ENDIAN is not set
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_PPC64_BOOT_WRAPPER=y
CONFIG_64BIT=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_MMU=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NR_IRQS=512
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_ARCH_HAS_ILOG2_U64=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
CONFIG_PPC=y
# CONFIG_GENERIC_CSUM is 

Re: [PATCH 06/14] powerpc/64s: interrupt replay balance the return branch predictor

2017-06-12 Thread Gautham R Shenoy
On Mon, Jun 12, 2017 at 09:58:27AM +1000, Nicholas Piggin wrote:
> The __replay_interrupt code is branched to with bl, but the caller is
> returned to directly with rfid from the interrupt.
> 
> Instead return to a return stub that returns to the caller with blr,
> which should do better with the return predictor.
> 
> Signed-off-by: Nicholas Piggin 

Reviewed-by: Gautham R. Shenoy 
> ---
>  arch/powerpc/kernel/exceptions-64s.S | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/exceptions-64s.S 
> b/arch/powerpc/kernel/exceptions-64s.S
> index a04ee0d7f88e..d55201625ea3 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1586,7 +1586,7 @@ _GLOBAL(__replay_interrupt)
>* we don't give a damn about, so we don't bother storing them.
>*/
>   mfmsr   r12
> - mflrr11
> + LOAD_REG_ADDR(r11, __replay_interrupt_return)
>   mfcrr9
>   ori r12,r12,MSR_EE
>   cmpwi   r3,0x900
> @@ -1604,4 +1604,5 @@ FTR_SECTION_ELSE
>   cmpwi   r3,0xa00
>   beq doorbell_super_common_msgclr
>  ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
> +__replay_interrupt_return:
>   blr
> -- 
> 2.11.0
> 



Re: [PATCH 05/14] powerpc/64s: msgclr when handling doorbell exceptions

2017-06-12 Thread Gautham R Shenoy
On Mon, Jun 12, 2017 at 09:58:26AM +1000, Nicholas Piggin wrote:
> msgsnd doorbell exceptions are cleared when the doorbell interrupt is
> taken. However if a doorbell exception causes a system reset interrupt
> wake from power saving state, the message is not cleared. Processing
> the doorbell from the system reset interrupt requires msgclr to avoid
> taking the exception again.
>

So you are clearing the doorbell message in this patch.

> Testing this plus the previous wakup direct patch gives:
> 
> original wakeup direct msgclr
> Different threads, same core:   315k/s   264k/s345k/s
> Different cores:235k/s   242k/s242k/s
> 
> Net speedup is +10% for same core, and +3% for different core.

This is good speedup.

Reviewed-by: Gautham R. Shenoy 


> 
> Signed-off-by: Nicholas Piggin 
> ---
>  arch/powerpc/include/asm/dbell.h  | 13 +
>  arch/powerpc/include/asm/ppc-opcode.h |  3 +++
>  arch/powerpc/kernel/asm-offsets.c |  1 +
>  arch/powerpc/kernel/exceptions-64s.S  | 23 +--
>  4 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/dbell.h 
> b/arch/powerpc/include/asm/dbell.h
> index f70cbfe0ec04..9f2ae0d25e15 100644
> --- a/arch/powerpc/include/asm/dbell.h
> +++ b/arch/powerpc/include/asm/dbell.h
> @@ -56,6 +56,19 @@ static inline void ppc_msgsync(void)
>   : : "i" (CPU_FTR_HVMODE|CPU_FTR_ARCH_300));
>  }
> 
> +static inline void _ppc_msgclr(u32 msg)
> +{
> + __asm__ __volatile__ (ASM_FTR_IFSET(PPC_MSGCLR(%1), PPC_MSGCLRP(%1), %0)
> + : : "i" (CPU_FTR_HVMODE), "r" (msg));
> +}
> +
> +static inline void ppc_msgclr(enum ppc_dbell type)
> +{
> + u32 msg = PPC_DBELL_TYPE(type);
> +
> + _ppc_msgclr(msg);
> +}
> +
>  #else /* CONFIG_PPC_BOOK3S */
> 
>  #define PPC_DBELL_MSGTYPEPPC_DBELL
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h 
> b/arch/powerpc/include/asm/ppc-opcode.h
> index 3a8d278e7421..3b29c54e51fa 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -221,6 +221,7 @@
>  #define PPC_INST_MSGCLR  0x7c0001dc
>  #define PPC_INST_MSGSYNC 0x7c0006ec
>  #define PPC_INST_MSGSNDP 0x7c00011c
> +#define PPC_INST_MSGCLRP 0x7c00015c
>  #define PPC_INST_MTTMR   0x7c0003dc
>  #define PPC_INST_NOP 0x6000
>  #define PPC_INST_PASTE   0x7c00070c
> @@ -409,6 +410,8 @@
>   ___PPC_RB(b))
>  #define PPC_MSGSNDP(b)   stringify_in_c(.long PPC_INST_MSGSNDP | 
> \
>   ___PPC_RB(b))
> +#define PPC_MSGCLRP(b)   stringify_in_c(.long PPC_INST_MSGCLRP | 
> \
> + ___PPC_RB(b))
>  #define PPC_POPCNTB(a, s)stringify_in_c(.long PPC_INST_POPCNTB | \
>   __PPC_RA(a) | __PPC_RS(s))
>  #define PPC_POPCNTD(a, s)stringify_in_c(.long PPC_INST_POPCNTD | \
> diff --git a/arch/powerpc/kernel/asm-offsets.c 
> b/arch/powerpc/kernel/asm-offsets.c
> index e15c178ba079..9624851ca276 100644
> --- a/arch/powerpc/kernel/asm-offsets.c
> +++ b/arch/powerpc/kernel/asm-offsets.c
> @@ -746,6 +746,7 @@ int main(void)
>  #endif
> 
>   DEFINE(PPC_DBELL_SERVER, PPC_DBELL_SERVER);
> + DEFINE(PPC_DBELL_MSGTYPE, PPC_DBELL_MSGTYPE);
> 
>  #ifdef CONFIG_PPC_8xx
>   DEFINE(VIRT_IMMR_BASE, (u64)__fix_to_virt(FIX_IMMR_BASE));
> diff --git a/arch/powerpc/kernel/exceptions-64s.S 
> b/arch/powerpc/kernel/exceptions-64s.S
> index ae418b85c17c..a04ee0d7f88e 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1552,6 +1552,25 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
>   b   1b
> 
>  /*
> + * When doorbell is triggered from system reset wakeup, the message is
> + * not cleared, so it would fire again when EE is enabled.
> + *
> + * When coming from local_irq_enable, there may be the same problem if
> + * we were hard disabled.
> + *
> + * Execute msgclr to clear pending exceptions before handling it.
> + */
> +h_doorbell_common_msgclr:
> + LOAD_REG_IMMEDIATE(r3, PPC_DBELL_MSGTYPE << (63-36))
> + PPC_MSGCLR(3)
> + b   h_doorbell_common
> +
> +doorbell_super_common_msgclr:
> + LOAD_REG_IMMEDIATE(r3, PPC_DBELL_MSGTYPE << (63-36))
> + PPC_MSGCLRP(3)
> + b   doorbell_super_common
> +
> +/*
>   * Called from arch_local_irq_enable when an interrupt needs
>   * to be resent. r3 contains 0x500, 0x900, 0xa00 or 0xe80 to indicate
>   * which kind of interrupt. MSR:EE is already off. We generate a
> @@ -1576,13 +1595,13 @@ _GLOBAL(__replay_interrupt)
>   beq hardware_interrupt_common
>  BEGIN_FTR_SECTION
>   cmpwi   r3,0xe80
> - beq   

Re: [PATCH v2] net: phy: Make phy_ethtool_ksettings_get return void

2017-06-12 Thread David Miller
From: Yuval Shaia 
Date: Mon, 12 Jun 2017 17:15:08 +0300

> Make return value void since function never return meaningfull value
> 
> Signed-off-by: Yuval Shaia 
> Acked-by: Sergei Shtylyov 
> ---
> v0 ->v1:
>   * These files were missing in v0
>   * drivers/net/ethernet/renesas/ravb_main.c
>   * drivers/net/ethernet/renesas/sh_eth.c
>   * drivers/net/ethernet/ti/netcp_ethss.c
>   * Add Acked-by: Sergei Shtylyov
> v1 -> v2:
>   * Adjust to net-next tree

Applied, thank you.


patch "powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type" added to driver-core-testing

2017-06-12 Thread gregkh

This is a note to let you know that I've just added the patch titled

powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the driver-core-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 205a1ee15d924df412cb8bdefafafc5b53b21153 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman 
Date: Tue, 6 Jun 2017 14:17:27 +0200
Subject: powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Vineet Gupta 
Cc: Bart Van Assche 
Cc: Robin Murphy 
Cc: Joerg Roedel 
Cc: Johan Hovold 
Cc: Alexey Kardashevskiy 
Cc: Krzysztof Kozlowski 
Cc: 
Acked-by: Michael Ellerman 
Signed-off-by: Greg Kroah-Hartman 
---
 arch/powerpc/platforms/pseries/vio.c | 56 +---
 1 file changed, 33 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vio.c 
b/arch/powerpc/platforms/pseries/vio.c
index b4f679e3ca3a..117beb9e8786 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -948,21 +948,21 @@ static void vio_cmo_bus_init(void)
 /* sysfs device functions and data structures for CMO */
 
 #define viodev_cmo_rd_attr(name)\
-static ssize_t viodev_cmo_##name##_show(struct device *dev, \
+static ssize_t cmo_##name##_show(struct device *dev,\
 struct device_attribute *attr,  \
  char *buf) \
 {   \
return sprintf(buf, "%lu\n", to_vio_dev(dev)->cmo.name);\
 }
 
-static ssize_t viodev_cmo_allocs_failed_show(struct device *dev,
+static ssize_t cmo_allocs_failed_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
struct vio_dev *viodev = to_vio_dev(dev);
return sprintf(buf, "%d\n", atomic_read(>cmo.allocs_failed));
 }
 
-static ssize_t viodev_cmo_allocs_failed_reset(struct device *dev,
+static ssize_t cmo_allocs_failed_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
 {
struct vio_dev *viodev = to_vio_dev(dev);
@@ -970,7 +970,7 @@ static ssize_t viodev_cmo_allocs_failed_reset(struct device 
*dev,
return count;
 }
 
-static ssize_t viodev_cmo_desired_set(struct device *dev,
+static ssize_t cmo_desired_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
 {
struct vio_dev *viodev = to_vio_dev(dev);
@@ -993,27 +993,37 @@ static ssize_t name_show(struct device *, struct 
device_attribute *, char *);
 static ssize_t devspec_show(struct device *, struct device_attribute *, char 
*);
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 char *buf);
-static struct device_attribute vio_cmo_dev_attrs[] = {
-   __ATTR_RO(name),
-   __ATTR_RO(devspec),
-   __ATTR_RO(modalias),
-   __ATTR(cmo_desired,   S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
-  viodev_cmo_desired_show, viodev_cmo_desired_set),
-   __ATTR(cmo_entitled,  S_IRUGO, viodev_cmo_entitled_show,  NULL),
-   __ATTR(cmo_allocated, S_IRUGO, viodev_cmo_allocated_show, NULL),
-   __ATTR(cmo_allocs_failed, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
-  viodev_cmo_allocs_failed_show, viodev_cmo_allocs_failed_reset),
-   __ATTR_NULL
+
+static struct device_attribute dev_attr_name;
+static struct device_attribute dev_attr_devspec;
+static struct device_attribute dev_attr_modalias;
+
+static DEVICE_ATTR_RO(cmo_entitled);
+static DEVICE_ATTR_RO(cmo_allocated);
+static DEVICE_ATTR_RW(cmo_desired);
+static DEVICE_ATTR_RW(cmo_allocs_failed);
+
+static struct attribute *vio_cmo_dev_attrs[] = {
+   _attr_name.attr,
+   _attr_devspec.attr,
+   _attr_modalias.attr,
+   _attr_cmo_entitled.attr,
+   _attr_cmo_allocated.attr,
+   _attr_cmo_desired.attr,
+   _attr_cmo_allocs_failed.attr,
+   NULL,
 };

patch "powerpc: vio: use dev_groups and not dev_attrs for bus_type" added to driver-core-testing

2017-06-12 Thread gregkh

This is a note to let you know that I've just added the patch titled

powerpc: vio: use dev_groups and not dev_attrs for bus_type

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the driver-core-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 451e3f1a740d2b453c7358a07421d427315483e6 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman 
Date: Tue, 6 Jun 2017 14:26:12 +0200
Subject: powerpc: vio: use dev_groups and not dev_attrs for bus_type

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: Vineet Gupta 
Cc: Bart Van Assche 
Cc: Robin Murphy 
Cc: Joerg Roedel 
Cc: Johan Hovold 
Cc: Alexey Kardashevskiy 
Cc: Krzysztof Kozlowski 
Cc: 
Acked-by: Michael Ellerman 
Signed-off-by: Greg Kroah-Hartman 
---
 arch/powerpc/platforms/pseries/vio.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vio.c 
b/arch/powerpc/platforms/pseries/vio.c
index 28b09fd797ec..b4f679e3ca3a 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -1537,6 +1537,7 @@ static ssize_t name_show(struct device *dev,
 {
return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t devspec_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -1545,6 +1546,7 @@ static ssize_t devspec_show(struct device *dev,
 
return sprintf(buf, "%s\n", of_node_full_name(of_node));
 }
+static DEVICE_ATTR_RO(devspec);
 
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 char *buf)
@@ -1566,13 +1568,15 @@ static ssize_t modalias_show(struct device *dev, struct 
device_attribute *attr,
 
return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute vio_dev_attrs[] = {
-   __ATTR_RO(name),
-   __ATTR_RO(devspec),
-   __ATTR_RO(modalias),
-   __ATTR_NULL
+static struct attribute *vio_dev_attrs[] = {
+   _attr_name.attr,
+   _attr_devspec.attr,
+   _attr_modalias.attr,
+   NULL,
 };
+ATTRIBUTE_GROUPS(vio_dev);
 
 void vio_unregister_device(struct vio_dev *viodev)
 {
@@ -1608,7 +1612,7 @@ static int vio_hotplug(struct device *dev, struct 
kobj_uevent_env *env)
 
 struct bus_type vio_bus_type = {
.name = "vio",
-   .dev_attrs = vio_dev_attrs,
+   .dev_groups = vio_dev_groups,
.uevent = vio_hotplug,
.match = vio_bus_match,
.probe = vio_bus_probe,
-- 
2.13.1




[PATCH v2] net: phy: Make phy_ethtool_ksettings_get return void

2017-06-12 Thread Yuval Shaia
Make return value void since function never return meaningfull value

Signed-off-by: Yuval Shaia 
Acked-by: Sergei Shtylyov 
---
v0 ->v1:
* These files were missing in v0
* drivers/net/ethernet/renesas/ravb_main.c
* drivers/net/ethernet/renesas/sh_eth.c
* drivers/net/ethernet/ti/netcp_ethss.c
* Add Acked-by: Sergei Shtylyov
v1 -> v2:
* Adjust to net-next tree
---
 drivers/net/ethernet/broadcom/b44.c|  3 ++-
 drivers/net/ethernet/broadcom/bcm63xx_enet.c   |  3 ++-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |  4 +++-
 drivers/net/ethernet/broadcom/tg3.c|  4 +++-
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c |  6 ++
 drivers/net/ethernet/freescale/ucc_geth_ethtool.c  |  4 +++-
 drivers/net/ethernet/marvell/mv643xx_eth.c |  5 ++---
 drivers/net/ethernet/renesas/ravb_main.c   | 14 +++---
 drivers/net/ethernet/renesas/sh_eth.c  |  5 ++---
 drivers/net/ethernet/ti/cpsw.c |  9 +
 drivers/net/ethernet/ti/netcp_ethss.c  |  8 +++-
 drivers/net/phy/phy.c  | 10 +-
 drivers/net/usb/lan78xx.c  |  2 +-
 include/linux/phy.h|  4 ++--
 net/dsa/slave.c|  9 +
 15 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/b44.c 
b/drivers/net/ethernet/broadcom/b44.c
index 5b95bb4..9873d2d 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -1836,7 +1836,8 @@ static int b44_get_link_ksettings(struct net_device *dev,
 
if (bp->flags & B44_FLAG_EXTERNAL_PHY) {
BUG_ON(!dev->phydev);
-   return phy_ethtool_ksettings_get(dev->phydev, cmd);
+   phy_ethtool_ksettings_get(dev->phydev, cmd);
+   return 0;
}
 
supported = (SUPPORTED_Autoneg);
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c 
b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 50d88d3..34ebb40 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1453,7 +1453,8 @@ static int bcm_enet_get_link_ksettings(struct net_device 
*dev,
if (priv->has_phy) {
if (!dev->phydev)
return -ENODEV;
-   return phy_ethtool_ksettings_get(dev->phydev, cmd);
+   phy_ethtool_ksettings_get(dev->phydev, cmd);
+   return 0;
} else {
cmd->base.autoneg = 0;
cmd->base.speed = (priv->force_speed_100) ?
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c 
b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index a205a9f..daca1c9 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -477,7 +477,9 @@ static int bcmgenet_get_link_ksettings(struct net_device 
*dev,
if (!priv->phydev)
return -ENODEV;
 
-   return phy_ethtool_ksettings_get(priv->phydev, cmd);
+   phy_ethtool_ksettings_get(priv->phydev, cmd);
+
+   return 0;
 }
 
 static int bcmgenet_set_link_ksettings(struct net_device *dev,
diff --git a/drivers/net/ethernet/broadcom/tg3.c 
b/drivers/net/ethernet/broadcom/tg3.c
index 537d571..d600c41 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12097,7 +12097,9 @@ static int tg3_get_link_ksettings(struct net_device 
*dev,
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
phydev = mdiobus_get_phy(tp->mdio_bus, tp->phy_addr);
-   return phy_ethtool_ksettings_get(phydev, cmd);
+   phy_ethtool_ksettings_get(phydev, cmd);
+
+   return 0;
}
 
supported = (SUPPORTED_Autoneg);
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
index 15571e2..aad825088 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -75,16 +75,14 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = {
 static int dpaa_get_link_ksettings(struct net_device *net_dev,
   struct ethtool_link_ksettings *cmd)
 {
-   int err;
-
if (!net_dev->phydev) {
netdev_dbg(net_dev, "phy device not initialized\n");
return 0;
}
 
-   err = phy_ethtool_ksettings_get(net_dev->phydev, cmd);
+   phy_ethtool_ksettings_get(net_dev->phydev, cmd);
 
-   return err;
+   return 0;
 }
 
 static int dpaa_set_link_ksettings(struct net_device *net_dev,
diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c 

patch "TTY: hvc: convert to use DRIVER_ATTR_RW" added to driver-core-testing

2017-06-12 Thread gregkh

This is a note to let you know that I've just added the patch titled

TTY: hvc: convert to use DRIVER_ATTR_RW

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-testing branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will be merged to the driver-core-next branch sometime soon,
after it passes testing, and the merge window is open.

If you have any questions about this process, please let me know.


>From 4e70a6fe6dc5d78939d9e155db3bd6cef28ec310 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman 
Date: Fri, 9 Jun 2017 11:03:07 +0200
Subject: TTY: hvc: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the hvc driver's
attribute can be trivially changed to use DRIVER_ATTR_RW().

Cc: Jiri Slaby 
Cc: 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/tty/hvc/hvcs.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 99bb875178d7..096ea5f511bd 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -484,13 +484,13 @@ static struct attribute_group hvcs_attr_group = {
.attrs = hvcs_attrs,
 };
 
-static ssize_t hvcs_rescan_show(struct device_driver *ddp, char *buf)
+static ssize_t rescan_show(struct device_driver *ddp, char *buf)
 {
/* A 1 means it is updating, a 0 means it is done updating */
return snprintf(buf, PAGE_SIZE, "%d\n", hvcs_rescan_status);
 }
 
-static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf,
+static ssize_t rescan_store(struct device_driver *ddp, const char * buf,
size_t count)
 {
if ((simple_strtol(buf, NULL, 0) != 1)
@@ -505,8 +505,7 @@ static ssize_t hvcs_rescan_store(struct device_driver *ddp, 
const char * buf,
return count;
 }
 
-static DRIVER_ATTR(rescan,
-   S_IRUGO | S_IWUSR, hvcs_rescan_show, hvcs_rescan_store);
+static DRIVER_ATTR_RW(rescan);
 
 static void hvcs_kick(void)
 {
-- 
2.13.1




Re: [PATCH v1] net/phy: Make phy_ethtool_ksettings_get return void

2017-06-12 Thread David Miller
From: Yuval Shaia 
Date: Mon, 12 Jun 2017 10:42:33 +0300

> Make return value void since function never return meaningfull value
> 
> Signed-off-by: Yuval Shaia 
> Acked-by: Sergei Shtylyov 
> ---
> Re-sending since last time forgot to add netdev-list
> v0 ->v1:
>   * These files were missing in v0
>   * drivers/net/ethernet/renesas/ravb_main.c
>   * drivers/net/ethernet/renesas/sh_eth.c
>   * drivers/net/ethernet/ti/netcp_ethss.c
>   * Add Acked-by: Sergei Shtylyov

This doesn't apply cleanly to net-next at all.

Please respin against an uptodate net-next tree, thank you.


Re: [PATCH] macintosh: move mac_hid driver to input/mouse.

2017-06-12 Thread Michal Suchánek
On Mon, 12 Jun 2017 13:40:07 +0200
Michal Suchánek  wrote:

> On Sat, 10 Jun 2017 12:00:22 +1000
> Peter Hutterer  wrote:
> 
> > On Fri, Jun 09, 2017 at 01:39:53PM +0200, Michal Suchánek wrote:  
> > > On Thu, 8 Jun 2017 16:18:28 -0700
> > > Dmitry Torokhov  wrote:
> > > 
> > > > On Thu, Jun 8, 2017 at 4:07 PM, Peter Hutterer
> > > >  wrote:
> > > > > On Thu, Jun 08, 2017 at 03:18:42PM +0200, Michal Suchánek
> > > > > wrote:  
> > > > >> This is what evtest reports about my keyboard:
> > > > >>
> > > > >> Select the device event number [0-12]: 2
> > > > >> Input driver version is 1.0.1
> > > > >> Input device ID: bus 0x3 vendor 0x413c product 0x2107 version
> > > > >> 0x111 Input device name: "DELL Dell USB Entry Keyboard"
> > > > >> Supported events:
> > > > >>   Event type 0 (EV_SYN)
> > > > >>   Event type 1 (EV_KEY)
> > > > >> Event code 1 (KEY_ESC)
> > > > >> Event code 2 (KEY_1)
> > > > >> Event code 3 (KEY_2)
> > > > >> Event code 4 (KEY_3)
> > > > >> ...
> > > > >> Event code 193 (KEY_F23)
> > > > >> Event code 194 (KEY_F24)
> > > > >> Event code 240 (KEY_UNKNOWN)
> > > > >> Event code 272 (BTN_LEFT)
> > > > >> Event code 273 (BTN_RIGHT)
> > > > >> Event code 274 (BTN_MIDDLE)
> > > > >>   Event type 4 (EV_MSC)
> > > > >> Event code 4 (MSC_SCAN)
> > > > >>   Event type 17 (EV_LED)
> > > > >> Event code 0 (LED_NUML) state 1
> > > > >> Event code 1 (LED_CAPSL) state 0
> > > > >> Event code 2 (LED_SCROLLL) state 0
> > > > >> Event code 3 (LED_COMPOSE) state 0
> > > > >> Event code 4 (LED_KANA) state 0
> > > > >> Key repeat handling:
> > > > >>   Repeat type 20 (EV_REP)
> > > > >> Repeat code 0 (REP_DELAY)
> > > > >>   Value250
> > > > >> Repeat code 1 (REP_PERIOD)
> > > > >>   Value 33
> > > > >> Properties:  
> > > > >
> > > > > looks like it's not tagged as ID_INPUT_MOUSE by the default
> > > > > udev rules because for that we need x/y axes (either relative
> > > > > for real mice or absolute ones for the VMWare USB mouse). This
> > > > > keyboard only has buttons though. So it gets ID_INPUT_KEYBOARD
> > > > > for the keys, but no ID_INPUT_MOUSE.
> > > > >
> > > > > Google isn't overly forthcoming on "DELL Dell USB Entry
> > > > > Keyboard" but the few pictures I can find all point to a
> > > > > keyboard that doesn't have any physical mouse buttons at all.
> > > > > Does yours have buttons? Can you post a picture of it
> > > > > somewhere? 
> > > > 
> > > > Michal is using udev/hwdb to replace some of the keys on his
> > > > keyboard to generate BTN_RIGHT/BTN_MIDDLE trying to achive the
> > > > same end result as with mac_hid. It is not the default keyboard
> > > > behavior. Having another custom udev rule to mark the device as
> > > > ID_INPUT_MOUSE is a fair requirement in this case I think.
> > > > 
> > > 
> > > Which is done in different place, and uses device matching with
> > > completely different patterns. So for this to work reasonably
> > > either
> > > 
> > >  - all devices should have all capabilities by default
> > >  - the capabilities should be detected based on the events
> > > actually available on the device
> > > 
> > > And if my keyboard actually claimed to have relative axis because
> > > of some great firmware engineering on the manufacturer's part and
> > > I found how to remove them in hwdb it would not take effect
> > > either.
> > 
> > https://github.com/systemd/systemd/blob/master/rules/50-udev-default.rules.in
> > calls input-id which sets the ID_INPUT_* tags. If you modify the
> > capabilities after that happens, you need to call input-id again to
> > get updated udev properties.  
> 
> rules/50-udev-default.rules.in:SUBSYSTEM=="usb",
> ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id",
> IMPORT{builtin}="hwdb --subsystem=usb"
> rules/50-udev-default.rules.in:SUBSYSTEM=="input", ENV{ID_INPUT}=="",
> IMPORT{builtin}="input_id"
> rules/50-udev-default.rules.in:ENV{MODALIAS}!="",
> IMPORT{builtin}="hwdb --subsystem=$env{SUBSYSTEM}"
> rules/60-evdev.rules:IMPORT{builtin}="hwdb --subsystem=input
> --lookup-prefix=evdev:", \
> rules/60-evdev.rules:ENV{ID_INPUT_KEY}=="?*", DRIVERS=="atkbd", \
> rules/60-evdev.rules:  IMPORT{builtin}="hwdb
> 'evdev:atkbd:$attr{[dmi/id]modalias}'", \
> rules/60-evdev.rules:KERNELS=="input*", IMPORT{builtin}="hwdb
> 'evdev:name:$attr{name}:phys:$attr{phys}:ev:$attr{capabilities/ev}:$attr{[dmi/id]modalias}'",
> \ rules/60-evdev.rules:KERNELS=="input*", IMPORT{builtin}="hwdb
> 'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
> rules/60-persistent-input.rules:ENV{ID_INPUT_KEYBOARD}=="?*",
> ENV{.INPUT_CLASS}="kbd"
> rules/60-persistent-input.rules:ENV{ID_INPUT_MOUSE}=="?*",
> ENV{.INPUT_CLASS}="mouse"
> rules/60-persistent-input.rules:ENV{ID_INPUT_TOUCHPAD}=="?*",
> ENV{.INPUT_CLASS}="mouse"
> 

[PATCH V2] cxl: Fixes for Coherent Accelerator Interface Architecture 2.0

2017-06-12 Thread Christophe Lombard
A previous set of patches "cxl: Add support for Coherent Accelerator
Interface Architecture 2.0" has introduced a new support for the CAPI
cards. These patches have been tested on Simulation environment and
quite a bit of them have been tested on real hardware.

This patch brings new fixes after a series of tests carried out on
new equipment.

Changelog[v2]
 - Rebase to latest upstream.
 - Update cxl_is_page_fault() to handle the checkout response status.
 - Add comments.
---
 drivers/misc/cxl/context.c |  6 +++---
 drivers/misc/cxl/cxl.h | 17 -
 drivers/misc/cxl/fault.c   | 19 ---
 drivers/misc/cxl/main.c| 16 
 drivers/misc/cxl/native.c  | 26 ++
 drivers/misc/cxl/pci.c | 11 ---
 6 files changed, 49 insertions(+), 46 deletions(-)

diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index 4472ce1..8c32040 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -45,7 +45,7 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu 
*afu, bool master)
mutex_init(>mapping_lock);
ctx->mapping = NULL;
 
-   if (cxl_is_psl8(afu)) {
+   if (cxl_is_power8()) {
spin_lock_init(>sste_lock);
 
/*
@@ -189,7 +189,7 @@ int cxl_context_iomap(struct cxl_context *ctx, struct 
vm_area_struct *vma)
if (start + len > ctx->afu->adapter->ps_size)
return -EINVAL;
 
-   if (cxl_is_psl9(ctx->afu)) {
+   if (cxl_is_power9()) {
/*
 * Make sure there is a valid problem state
 * area space for this AFU.
@@ -324,7 +324,7 @@ static void reclaim_ctx(struct rcu_head *rcu)
 {
struct cxl_context *ctx = container_of(rcu, struct cxl_context, rcu);
 
-   if (cxl_is_psl8(ctx->afu))
+   if (cxl_is_power8())
free_page((u64)ctx->sstp);
if (ctx->ff_page)
__free_page(ctx->ff_page);
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index c8568ea..d516353 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -844,24 +844,15 @@ static inline bool cxl_is_power8(void)
 
 static inline bool cxl_is_power9(void)
 {
-   /* intermediate solution */
-   if (!cxl_is_power8() &&
-  (cpu_has_feature(CPU_FTRS_POWER9) ||
-   cpu_has_feature(CPU_FTR_POWER9_DD1)))
+   if (pvr_version_is(PVR_POWER9))
return true;
return false;
 }
 
-static inline bool cxl_is_psl8(struct cxl_afu *afu)
+static inline bool cxl_is_power9_dd1(void)
 {
-   if (afu->adapter->caia_major == 1)
-   return true;
-   return false;
-}
-
-static inline bool cxl_is_psl9(struct cxl_afu *afu)
-{
-   if (afu->adapter->caia_major == 2)
+   if ((pvr_version_is(PVR_POWER9)) &&
+   cpu_has_feature(CPU_FTR_POWER9_DD1))
return true;
return false;
 }
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 538..a6e6a18 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -187,7 +187,7 @@ static struct mm_struct *get_mem_context(struct cxl_context 
*ctx)
 
 static bool cxl_is_segment_miss(struct cxl_context *ctx, u64 dsisr)
 {
-   if ((cxl_is_psl8(ctx->afu)) && (dsisr & CXL_PSL_DSISR_An_DS))
+   if ((cxl_is_power8() && (dsisr & CXL_PSL_DSISR_An_DS)))
return true;
 
return false;
@@ -195,15 +195,20 @@ static bool cxl_is_segment_miss(struct cxl_context *ctx, 
u64 dsisr)
 
 static bool cxl_is_page_fault(struct cxl_context *ctx, u64 dsisr)
 {
-   if ((cxl_is_psl8(ctx->afu)) && (dsisr & CXL_PSL_DSISR_An_DM))
+   u64 crs; /* Translation Checkout Response Status */
+
+   if ((cxl_is_power8()) && (dsisr & CXL_PSL_DSISR_An_DM))
return true;
 
-   if ((cxl_is_psl9(ctx->afu)) &&
-  ((dsisr & CXL_PSL9_DSISR_An_CO_MASK) &
-   (CXL_PSL9_DSISR_An_PF_SLR | CXL_PSL9_DSISR_An_PF_RGC |
-CXL_PSL9_DSISR_An_PF_RGP | CXL_PSL9_DSISR_An_PF_HRH |
-CXL_PSL9_DSISR_An_PF_STEG)))
+   if (cxl_is_power9()) {
+   crs = (dsisr & CXL_PSL9_DSISR_An_CO_MASK);
+   if ((crs == CXL_PSL9_DSISR_An_PF_SLR) ||
+   (crs == CXL_PSL9_DSISR_An_PF_RGC) ||
+   (crs == CXL_PSL9_DSISR_An_PF_RGP) ||
+   (crs == CXL_PSL9_DSISR_An_PF_HRH) ||
+   (crs == CXL_PSL9_DSISR_An_PF_STEG))
return true;
+   }
 
return false;
 }
diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c
index 1703655..d2d50e3 100644
--- a/drivers/misc/cxl/main.c
+++ b/drivers/misc/cxl/main.c
@@ -329,8 +329,14 @@ static int __init init_cxl(void)
 
cxl_debugfs_init();
 
-   if ((rc = register_cxl_calls(_calls)))
-   goto err;
+   /*
+* we don't register the callbacks on P9. slb 

Re: [PATCH v2] perf: libdw support for powerpc [ping]

2017-06-12 Thread Ravi Bangoria
Hi Paolo,

Thanks for the patch and really sorry for being late. I was quite busy
with few other things.

On Friday 09 June 2017 06:00 PM, Paolo Bonzini wrote:
>
> On 01/06/2017 12:24, Paolo Bonzini wrote:
>> Porting PPC to libdw only needs an architecture-specific hook to move
>> the register state from perf to libdw.
>>
>> The ARM and x86 architectures already use libdw, and it is useful to
>> have as much common code for the unwinder as possible.  Mark Wielaard
>> has contributed a frame-based unwinder to libdw, so that unwinding works
>> even for binaries that do not have CFI information.  In addition,
>> libunwind is always preferred to libdw by the build machinery so this
>> cannot introduce regressions on machines that have both libunwind and
>> libdw installed.
>>
>> Cc: a...@kernel.org
>> Cc: Naveen N. Rao 
>> Cc: Ravi Bangoria 
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Signed-off-by: Paolo Bonzini 
>> ---
>>  v1->v2: fix for 4.11->4.12 changes
> Ravi, Naveen, any reviews?

So, I tested this patch along with Mark's patch[1] on elfutils an looks
like it's not working. Steps on what I did:

After applying Mark's patch on upstream elfutils:

  $ aclocal
  $ autoheader
  $ autoconf
  $ automake --add-missing
  $ ./configure
  $ make
  $ make install DESTDIR=/home/ravi/elfutils-git

After applying your patch on upstream perf:

  $ make
  $ ./perf record --call-graph=dwarf ls
  $ LD_LIBRARY_PATH=/home/ravi/elfutils-git/usr/local/lib:\
/home/ravi/elfutils-git/usr/local/lib/elfutils/:$LD_LIBRARY_PATH \
./perf script

ls 44159  1800.878468: 191408 cycles:u:

ls 44159  1800.878673: 419356 cycles:u:
   8a97c hpte_need_flush 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   835f4 flush_hash_page 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   8acec hpte_need_flush 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  3468f4 ptep_clear_flush 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  328b10 wp_page_copy 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  32ebe4 do_wp_page 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  33434c __handle_mm_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  335040 handle_mm_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   7bf94 do_page_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   1a4f8 handle_page_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)

ls 44159  1800.878961: 430876 cycles:u:

ls 44159  1800.879195: 423785 cycles:u:

ls 44159  1800.879360: 427359 cycles:u:

Here I don't see userspace callchain getting unwound. Please let me know
if I'm doing anything wrong. Same perf.data with libunwind:

ls 44159  1800.878468: 191408 cycles:u:
   20380 _dl_sysdep_start (/usr/lib64/ld-2.17.so)
1c7f _dl_start_final (/usr/lib64/ld-2.17.so)
5ce7 _dl_start (/usr/lib64/ld-2.17.so)
1937 _start (/usr/lib64/ld-2.17.so)

ls 44159  1800.878673: 419356 cycles:u:
   8a97c hpte_need_flush 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   835f4 flush_hash_page 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   8acec hpte_need_flush 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  3468f4 ptep_clear_flush 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  328b10 wp_page_copy 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  32ebe4 do_wp_page 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  33434c __handle_mm_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
  335040 handle_mm_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   7bf94 do_page_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
   1a4f8 handle_page_fault 
(/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
7cd4 _dl_map_object_from_fd (/usr/lib64/ld-2.17.so)
b24b _dl_map_object (/usr/lib64/ld-2.17.so)
   12b3b openaux (/usr/lib64/ld-2.17.so)
   159bf _dl_catch_error (/usr/lib64/ld-2.17.so)
   13323 _dl_map_object_deps (/usr/lib64/ld-2.17.so)
3feb dl_main (/usr/lib64/ld-2.17.so)
   2045b _dl_sysdep_start (/usr/lib64/ld-2.17.so)
1c7f _dl_start_final (/usr/lib64/ld-2.17.so)
  

Re: [PATCH] macintosh: move mac_hid driver to input/mouse.

2017-06-12 Thread Michal Suchánek
On Sat, 10 Jun 2017 12:00:22 +1000
Peter Hutterer  wrote:

> On Fri, Jun 09, 2017 at 01:39:53PM +0200, Michal Suchánek wrote:
> > On Thu, 8 Jun 2017 16:18:28 -0700
> > Dmitry Torokhov  wrote:
> >   
> > > On Thu, Jun 8, 2017 at 4:07 PM, Peter Hutterer
> > >  wrote:  
> > > > On Thu, Jun 08, 2017 at 03:18:42PM +0200, Michal Suchánek
> > > > wrote:
> > > >> This is what evtest reports about my keyboard:
> > > >>
> > > >> Select the device event number [0-12]: 2
> > > >> Input driver version is 1.0.1
> > > >> Input device ID: bus 0x3 vendor 0x413c product 0x2107 version
> > > >> 0x111 Input device name: "DELL Dell USB Entry Keyboard"
> > > >> Supported events:
> > > >>   Event type 0 (EV_SYN)
> > > >>   Event type 1 (EV_KEY)
> > > >> Event code 1 (KEY_ESC)
> > > >> Event code 2 (KEY_1)
> > > >> Event code 3 (KEY_2)
> > > >> Event code 4 (KEY_3)
> > > >> ...
> > > >> Event code 193 (KEY_F23)
> > > >> Event code 194 (KEY_F24)
> > > >> Event code 240 (KEY_UNKNOWN)
> > > >> Event code 272 (BTN_LEFT)
> > > >> Event code 273 (BTN_RIGHT)
> > > >> Event code 274 (BTN_MIDDLE)
> > > >>   Event type 4 (EV_MSC)
> > > >> Event code 4 (MSC_SCAN)
> > > >>   Event type 17 (EV_LED)
> > > >> Event code 0 (LED_NUML) state 1
> > > >> Event code 1 (LED_CAPSL) state 0
> > > >> Event code 2 (LED_SCROLLL) state 0
> > > >> Event code 3 (LED_COMPOSE) state 0
> > > >> Event code 4 (LED_KANA) state 0
> > > >> Key repeat handling:
> > > >>   Repeat type 20 (EV_REP)
> > > >> Repeat code 0 (REP_DELAY)
> > > >>   Value250
> > > >> Repeat code 1 (REP_PERIOD)
> > > >>   Value 33
> > > >> Properties:
> > > >
> > > > looks like it's not tagged as ID_INPUT_MOUSE by the default udev
> > > > rules because for that we need x/y axes (either relative for
> > > > real mice or absolute ones for the VMWare USB mouse). This
> > > > keyboard only has buttons though. So it gets ID_INPUT_KEYBOARD
> > > > for the keys, but no ID_INPUT_MOUSE.
> > > >
> > > > Google isn't overly forthcoming on "DELL Dell USB Entry
> > > > Keyboard" but the few pictures I can find all point to a
> > > > keyboard that doesn't have any physical mouse buttons at all.
> > > > Does yours have buttons? Can you post a picture of it somewhere?
> > > >
> > > 
> > > Michal is using udev/hwdb to replace some of the keys on his
> > > keyboard to generate BTN_RIGHT/BTN_MIDDLE trying to achive the
> > > same end result as with mac_hid. It is not the default keyboard
> > > behavior. Having another custom udev rule to mark the device as
> > > ID_INPUT_MOUSE is a fair requirement in this case I think.
> > >   
> > 
> > Which is done in different place, and uses device matching with
> > completely different patterns. So for this to work reasonably either
> > 
> >  - all devices should have all capabilities by default
> >  - the capabilities should be detected based on the events actually
> >available on the device
> > 
> > And if my keyboard actually claimed to have relative axis because of
> > some great firmware engineering on the manufacturer's part and I
> > found how to remove them in hwdb it would not take effect either.  
> 
> https://github.com/systemd/systemd/blob/master/rules/50-udev-default.rules.in
> calls input-id which sets the ID_INPUT_* tags. If you modify the
> capabilities after that happens, you need to call input-id again to
> get updated udev properties.

rules/50-udev-default.rules.in:SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", 
IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
rules/50-udev-default.rules.in:SUBSYSTEM=="input", ENV{ID_INPUT}=="", 
IMPORT{builtin}="input_id"
rules/50-udev-default.rules.in:ENV{MODALIAS}!="", IMPORT{builtin}="hwdb 
--subsystem=$env{SUBSYSTEM}"
rules/60-evdev.rules:IMPORT{builtin}="hwdb --subsystem=input 
--lookup-prefix=evdev:", \
rules/60-evdev.rules:ENV{ID_INPUT_KEY}=="?*", DRIVERS=="atkbd", \
rules/60-evdev.rules:  IMPORT{builtin}="hwdb 
'evdev:atkbd:$attr{[dmi/id]modalias}'", \
rules/60-evdev.rules:KERNELS=="input*", IMPORT{builtin}="hwdb 
'evdev:name:$attr{name}:phys:$attr{phys}:ev:$attr{capabilities/ev}:$attr{[dmi/id]modalias}'",
 \
rules/60-evdev.rules:KERNELS=="input*", IMPORT{builtin}="hwdb 
'evdev:name:$attr{name}:$attr{[dmi/id]modalias}'", \
rules/60-persistent-input.rules:ENV{ID_INPUT_KEYBOARD}=="?*", 
ENV{.INPUT_CLASS}="kbd"
rules/60-persistent-input.rules:ENV{ID_INPUT_MOUSE}=="?*", 
ENV{.INPUT_CLASS}="mouse"
rules/60-persistent-input.rules:ENV{ID_INPUT_TOUCHPAD}=="?*", 
ENV{.INPUT_CLASS}="mouse"
rules/60-persistent-input.rules:ENV{ID_INPUT_TABLET}=="?*", 
ENV{.INPUT_CLASS}="mouse"
rules/60-persistent-input.rules:ENV{ID_INPUT_JOYSTICK}=="?*", 
ENV{.INPUT_CLASS}="joystick"
rules/60-sensor.rules:  IMPORT{builtin}="hwdb 
'sensor:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \
rules/60-sensor.rules:SUBSYSTEM=="input", 

Re: [PATCH 00/35] defconfig: Cleanup from old entries

2017-06-12 Thread Arnd Bergmann
On Sat, Jun 10, 2017 at 6:43 PM, Krzysztof Kozlowski  wrote:
> On Fri, Jun 09, 2017 at 09:59:48PM +0200, Arnd Bergmann wrote:
>> On Thu, Jun 8, 2017 at 6:08 PM, Krzysztof Kozlowski  wrote:
>> > Hi,
>> >
>> > While cleaning Samsung ARM defconfigs with savedefconfig, I encountered
>> > similar obsolete entries in other files.
>> >
>> > Except the ARM, no dependencies.
>> > For ARM, the rest of patches depend on the first change (otherwise
>> > it might not apply cleanly).
>>
>> Great work!
>>
>> I looked at all the ARM patches, and everything looks good to me (the
>> changlog linewrapping may be suboptimal for readability in some cases,
>> if I had to say anything negative ;-) ).
>>
>> Please add my Acked-by to the ARM patches and send a pull request.
>
> Thanks, I'll send you ARM part in pull request.

Ok

> As for the rest, I think respective arch/platform maintainers should
> take it.

I suspect most will apply the patches, but some architectures maintainers
are not very active. If you are motivated, you could resend the ones
that missed out to Andrew Morton, or you just leave the architectures
to bitrot more. ;-)

 Arnd


Re: [PATCH 27/44] sparc: remove leon_dma_ops

2017-06-12 Thread Andreas Larsson

On 2017-06-08 15:25, Christoph Hellwig wrote:

We can just use pci32_dma_ops.

Btw, given that leon is 32-bit and appears to be PCI based, do even need
the special case for it in get_arch_dma_ops at all?


Hi!

Yes, it is needed. LEON systems are AMBA bus based. The common case here 
is DMA over AMBA buses. Some LEON systems have PCI bridges, but in 
general CONFIG_PCI is not a given.


--
Andreas Larsson
Software Engineer
Cobham Gaisler


Re: [PATCH 04/14] powerpc/64s: idle process interrupts from system reset wakeup

2017-06-12 Thread Gautham R Shenoy
Hi Nick,

On Mon, Jun 12, 2017 at 09:58:25AM +1000, Nicholas Piggin wrote:
> When the CPU wakes from low power state, it begins at the system reset
> interrupt with the exception that caused the wakeup encoded in SRR1.
> 
> Today, powernv idle wakeup ignores the wakeup reason (except a special
> case for HMI), and the regular interrupt corresponding to the
> exception will fire after the idle wakeup exits.
> 
> Change this to replay the interrupt from the idle wakeup before
> interrupts are hard-enabled.
> 
> Test on POWER8 of context_switch selftests benchmark with polling idle
> disabled (e.g., always nap, giving cross-CPU IPIs) gives the following
> results:
> 
> original wakeup direct
> Different threads, same core:   315k/s   264k/s
> Different cores:235k/s   242k/s
> 
> There is a slowdown for doorbell IPI (same core) case because system
> reset wakeup does not clear the message and the doorbell interrupt
> fires again needlessly.

Should we clear the doorbell message if we are recording the fact that
the Doorbell irq has happened in paca ?

> 
> Signed-off-by: Nicholas Piggin 
> ---
>  arch/powerpc/include/asm/hw_irq.h |  2 ++
>  arch/powerpc/kernel/irq.c | 25 +
>  arch/powerpc/platforms/powernv/idle.c | 10 --
>  3 files changed, 35 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/hw_irq.h 
> b/arch/powerpc/include/asm/hw_irq.h
> index f06112cf8734..8366bdc69988 100644

[..snip..]

> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -348,6 +348,7 @@ bool prep_irq_for_idle(void)
>   return true;
>  }
> 
> +#ifdef CONFIG_PPC_BOOK3S
>  /*
>   * This is for idle sequences that return with IRQs off, but the
>   * idle state itself wakes on interrupt. Tell the irq tracer that
> @@ -379,6 +380,30 @@ bool prep_irq_for_idle_irqsoff(void)
>  }
> 
>  /*
> + * Take the SRR1 wakeup reason, index into this table to find the
> + * appropriate irq_happened bit.
> + */
> +static const u8 srr1_to_irq[0x10] = {
> + 0, 0, 0,
> + PACA_IRQ_DBELL,
> + 0,
> + PACA_IRQ_DBELL,
> + PACA_IRQ_DEC,
> + 0,
> + PACA_IRQ_EE,
> + PACA_IRQ_EE,
> + PACA_IRQ_HMI,
> + 0, 0, 0, 0, 0 };
> +
> +void irq_set_pending_from_srr1(unsigned long srr1)
> +{
> + unsigned int idx = (srr1 >> 18) & SRR1_WAKEMASK_P8;

Shouldn't this be
unsigned int idx = (srr1 & SRR1_WAKEMASK_P8) >> 18;

?
> +
> + local_paca->irq_happened |= srr1_to_irq[idx];
> +}
> +#endif /* CONFIG_PPC_BOOK3S */
> +


Looks good otherwise.

--
Thanks and Regards
gautham.



Re: [PATCH 03/14] powerpc/64s: idle provide a default idle for POWER9

2017-06-12 Thread Gautham R Shenoy
Hi Nick,

On Mon, Jun 12, 2017 at 09:58:24AM +1000, Nicholas Piggin wrote:
> Before the cpuidle driver is enabled, provide a default idle
> function similarly to POWER7/8.
> 
> This should not have much effect, because the cpuidle driver
> for powernv is mandatory, but if that changes we should have
> a fallback.
> 
> Signed-off-by: Nicholas Piggin 
> ---
>  arch/powerpc/platforms/powernv/idle.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powernv/idle.c 
> b/arch/powerpc/platforms/powernv/idle.c
> index f188d84d9c59..e327e1585ddc 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -677,6 +677,8 @@ static int __init pnv_init_idle_states(void)
> 
>   if (supported_cpuidle_states & OPAL_PM_NAP_ENABLED)
>   ppc_md.power_save = power7_idle;
> + else if (supported_cpuidle_states & OPAL_PM_STOP_INST_FAST)
> + ppc_md.power_save = power9_idle;

We are already initializing this in pnv_power9_idle_init() depending
on whether the device tree has exposed at least one INST_FAST idle
state. Else this should be NULL, because the firmware doesn't want us
to use a platform idle state!


> 
>  out:
>   return 0;
> -- 
> 2.11.0
> 



Re: [PATCH 01/14] powerpc/64s: idle move soft interrupt mask logic into C code

2017-06-12 Thread Gautham R Shenoy
Hi Nick,

(Added Paul Mackerass to the Cc)
On Mon, Jun 12, 2017 at 09:58:22AM +1000, Nicholas Piggin wrote:
> This simplifies the asm and fixes irq-off tracing over sleep
> instructions.
> 
> Also move powersave_nap check for POWER8 into C code, and move
> PSSCR register value calculation for POWER9 into C.
>

Thanks for doing this. Only one minor comment.

> Signed-off-by: Nicholas Piggin 
> ---
> index 98a6d07ecb5c..35cf5bb7daed 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S

[..snip..]

> @@ -109,13 +109,9 @@ core_idle_lock_held:
>  /*
>   * Pass requested state in r3:
>   *   r3 - PNV_THREAD_NAP/SLEEP/WINKLE in POWER8
> - *  - Requested STOP state in POWER9
> + *  - Requested PSSCR value in POWER9
>   *
> - * To check IRQ_HAPPENED in r4
> - *   0 - don't check
> - *   1 - check
> - *
> - * Address to 'rfid' to in r5
> + * Address of idle handler to 'rfid' to in r4
>   */
>  pnv_powersave_common:
>   /* Use r3 to pass state nap/sleep/winkle */
> @@ -131,30 +127,7 @@ pnv_powersave_common:
>   std r0,_LINK(r1)
>   std r0,_NIP(r1)
> 
> - /* Hard disable interrupts */
> - mfmsr   r9
> - rldicl  r9,r9,48,1
> - rotldi  r9,r9,16
> - mtmsrd  r9,1/* hard-disable interrupts */
> -
> - /* Check if something happened while soft-disabled */
> - lbz r0,PACAIRQHAPPENED(r13)
> - andi.   r0,r0,~PACA_IRQ_HARD_DIS@l
> - beq 1f
> - cmpwi   cr0,r4,0

There were callers to power7_nap() in the dynamic-core-split/unsplit
which wanted nap to be forced irrespective of whether an irq was
pending or not. With this new patch, there won't be a way to enforce
that on POWER8.

> - beq 1f
> - addir1,r1,INT_FRAME_SIZE
> - ld  r0,16(r1)
> - li  r3,0/* Return 0 (no nap) */
> - mtlrr0
> - blr
> -

[..snip..]

> diff --git a/arch/powerpc/platforms/powernv/subcore.c 
> b/arch/powerpc/platforms/powernv/subcore.c
> index 0babef11136f..d975d78188a9 100644
> --- a/arch/powerpc/platforms/powernv/subcore.c
> +++ b/arch/powerpc/platforms/powernv/subcore.c
> @@ -18,6 +18,7 @@
>  #include 
> 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -182,7 +183,7 @@ static void unsplit_core(void)
>   cpu = smp_processor_id();
>   if (cpu_thread_in_core(cpu) != 0) {
>   while (mfspr(SPRN_HID0) & mask)
> - power7_nap(0);
> + power7_idle_insn(PNV_THREAD_NAP);

This is the place where we are unsplitting the core after exiting the
guest and returning to the host. This required us to execute the nap
instruction. With the new patch, will just loop inside this loop
without executing nap. Paul, will this be an issue ?

> 
>   per_cpu(split_state, cpu).step = SYNC_STEP_UNSPLIT;
>   return;
> diff --git a/drivers/cpuidle/cpuidle-powernv.c 
> b/drivers/cpuidle/cpuidle-powernv.c
> index 45eaf06462ae..79152676f62b 100644
> --- a/drivers/cpuidle/cpuidle-powernv.c
> +++ b/drivers/cpuidle/cpuidle-powernv.c
> @@ -73,9 +73,8 @@ static int nap_loop(struct cpuidle_device *dev,
>   struct cpuidle_driver *drv,
>   int index)
>  {
> - ppc64_runlatch_off();
> - power7_idle();
> - ppc64_runlatch_on();
> + power7_idle_type(PNV_THREAD_NAP);
> +
>   return index;
>  }
> 
> @@ -98,7 +97,8 @@ static int fastsleep_loop(struct cpuidle_device *dev,
>   new_lpcr &= ~LPCR_PECE1;
> 
>   mtspr(SPRN_LPCR, new_lpcr);
> - power7_sleep();
> +
> + power7_idle_type(PNV_THREAD_SLEEP);
> 
>   mtspr(SPRN_LPCR, old_lpcr);
> 
> @@ -110,10 +110,8 @@ static int stop_loop(struct cpuidle_device *dev,
>struct cpuidle_driver *drv,
>int index)
>  {
> - ppc64_runlatch_off();
> - power9_idle_stop(stop_psscr_table[index].val,
> + power9_idle_type(stop_psscr_table[index].val,
>stop_psscr_table[index].mask);
> - ppc64_runlatch_on();
>   return index;
>  }
> 
> -- 
> 2.11.0
> 

--
Thanks and Regards
gautham.



Re: [next-20170609][bisected 4d72ba0] WARNING: CPU: 8 PID: 11043 at lib/vsprintf.c:1945 set_precision

2017-06-12 Thread Joe Perches
On Mon, 2017-06-12 at 13:23 +0530, Abdul Haleem wrote:
> Hi Rasmus,
> 
> With commit (4d72ba0-lib/vsprintf.c: warn about too large precisions..)
> 
> WARN_ONCE is being triggered while running trinity 
> $ git clone https://github.com/kernelslacker/trinity.git
> $ cd trinity;./configure;make 
> $ ./trinity --dangerous
> 
> Machine : Power 8 PowerVM LPAR
> gcc : version 5.2.1
> config : attached
> 
> 
> In file lib/vsprintf.c at line 1945:
> set_precision(struct printf_spec *spec, int prec)
> {
> spec->precision = prec;
> if (WARN_ONCE(spec->precision != prec, "precision %d too large",
> prec)) {
> spec->precision = clamp(prec, 0, PRECISION_MAX);
> }
> }

Presumably there should be a PATH_MAX maximum check added
to the strlen(name) in get_fs_type.

fs/filesystems.c:271

struct file_system_type *get_fs_type(const char *name)
{
struct file_system_type *fs;
const char *dot = strchr(name, '.');
int len = dot ? dot - name : strlen(name);

fs = __get_fs_type(name, len);
if (!fs && (request_module("fs-%.*s", len, name) == 0))
fs = __get_fs_type(name, len);




Re: [PATCH] cxl: Fixes for Coherent Accelerator Interface Architecture 2.0

2017-06-12 Thread christophe lombard

Le 09/06/2017 à 18:12, Frederic Barrat a écrit :

Salut Christophe,

It looks pretty good, but checkpatch complains about 1 or 2 items 
worth fixing.


2 small remarks below.


Le 09/06/2017 à 12:09, Christophe Lombard a écrit :

A previous set of patches "cxl: Add support for Coherent Accelerator
Interface Architecture 2.0" has introduced a new support for the CAPI
cards. These patches have been tested on Simulation environment and
quite a bit of them have been tested on real hardware.

This patch brings new fixes after a series of tests carried out on
new equipment.
---
  drivers/misc/cxl/context.c |  6 +++---
  drivers/misc/cxl/cxl.h | 17 -
  drivers/misc/cxl/fault.c   | 19 ---
  drivers/misc/cxl/main.c| 12 
  drivers/misc/cxl/native.c  | 26 ++
  drivers/misc/cxl/pci.c | 11 ---
  6 files changed, 45 insertions(+), 46 deletions(-)

diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index 4472ce1..8c32040 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/misc/cxl/context.c
@@ -45,7 +45,7 @@ int cxl_context_init(struct cxl_context *ctx, 
struct cxl_afu *afu, bool master)

  mutex_init(>mapping_lock);
  ctx->mapping = NULL;

-if (cxl_is_psl8(afu)) {
+if (cxl_is_power8()) {
  spin_lock_init(>sste_lock);

  /*
@@ -189,7 +189,7 @@ int cxl_context_iomap(struct cxl_context *ctx, 
struct vm_area_struct *vma)

  if (start + len > ctx->afu->adapter->ps_size)
  return -EINVAL;

-if (cxl_is_psl9(ctx->afu)) {
+if (cxl_is_power9()) {
  /*
   * Make sure there is a valid problem state
   * area space for this AFU.
@@ -324,7 +324,7 @@ static void reclaim_ctx(struct rcu_head *rcu)
  {
  struct cxl_context *ctx = container_of(rcu, struct cxl_context, 
rcu);


-if (cxl_is_psl8(ctx->afu))
+if (cxl_is_power8())
  free_page((u64)ctx->sstp);
  if (ctx->ff_page)
  __free_page(ctx->ff_page);
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index c8568ea..d516353 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -844,24 +844,15 @@ static inline bool cxl_is_power8(void)

  static inline bool cxl_is_power9(void)
  {
-/* intermediate solution */
-if (!cxl_is_power8() &&
-   (cpu_has_feature(CPU_FTRS_POWER9) ||
-cpu_has_feature(CPU_FTR_POWER9_DD1)))
+if (pvr_version_is(PVR_POWER9))
  return true;
  return false;
  }

-static inline bool cxl_is_psl8(struct cxl_afu *afu)
+static inline bool cxl_is_power9_dd1(void)
  {
-if (afu->adapter->caia_major == 1)
-return true;
-return false;
-}
-
-static inline bool cxl_is_psl9(struct cxl_afu *afu)
-{
-if (afu->adapter->caia_major == 2)
+if ((pvr_version_is(PVR_POWER9)) &&
+cpu_has_feature(CPU_FTR_POWER9_DD1))
  return true;
  return false;
  }
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index 538..866ff191 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -187,7 +187,7 @@ static struct mm_struct *get_mem_context(struct 
cxl_context *ctx)


  static bool cxl_is_segment_miss(struct cxl_context *ctx, u64 dsisr)
  {
-if ((cxl_is_psl8(ctx->afu)) && (dsisr & CXL_PSL_DSISR_An_DS))
+if ((cxl_is_power8() && (dsisr & CXL_PSL_DSISR_An_DS)))
  return true;

  return false;
@@ -195,15 +195,20 @@ static bool cxl_is_segment_miss(struct 
cxl_context *ctx, u64 dsisr)


  static bool cxl_is_page_fault(struct cxl_context *ctx, u64 dsisr)
  {
-if ((cxl_is_psl8(ctx->afu)) && (dsisr & CXL_PSL_DSISR_An_DM))
+u64 crs;
+
+if ((cxl_is_power8()) && (dsisr & CXL_PSL_DSISR_An_DM))
  return true;

-if ((cxl_is_psl9(ctx->afu)) &&
-   ((dsisr & CXL_PSL9_DSISR_An_CO_MASK) &
-(CXL_PSL9_DSISR_An_PF_SLR | CXL_PSL9_DSISR_An_PF_RGC |
- CXL_PSL9_DSISR_An_PF_RGP | CXL_PSL9_DSISR_An_PF_HRH |
- CXL_PSL9_DSISR_An_PF_STEG)))
+if (cxl_is_power9()) {
+crs = (dsisr & CXL_PSL9_DSISR_An_CO_MASK);
+if ((crs & CXL_PSL9_DSISR_An_PF_SLR) ||
+(crs & CXL_PSL9_DSISR_An_PF_RGC) ||
+(crs & CXL_PSL9_DSISR_An_PF_RGP) ||
+(crs & CXL_PSL9_DSISR_An_PF_HRH) ||
+(crs & CXL_PSL9_DSISR_An_PF_STEG))
  return true;
+}

  return false;
  }
diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c
index 1703655..40c2b05 100644
--- a/drivers/misc/cxl/main.c
+++ b/drivers/misc/cxl/main.c
@@ -329,8 +329,10 @@ static int __init init_cxl(void)

  cxl_debugfs_init();

-if ((rc = register_cxl_calls(_calls)))
-goto err;
+if (cxl_is_power8()) {
+if ((rc = register_cxl_calls(_calls)))
+goto err;
+}




I would add a comment to explain why we don't register the callbacks 
on p9 (i.e. slb callack is only for the PSL8 MMU and the others are 
dead code for CX4, which I'd like to 

[PATCH v1] net/phy: Make phy_ethtool_ksettings_get return void

2017-06-12 Thread Yuval Shaia
Make return value void since function never return meaningfull value

Signed-off-by: Yuval Shaia 
Acked-by: Sergei Shtylyov 
---
Re-sending since last time forgot to add netdev-list
v0 ->v1:
* These files were missing in v0
* drivers/net/ethernet/renesas/ravb_main.c
* drivers/net/ethernet/renesas/sh_eth.c
* drivers/net/ethernet/ti/netcp_ethss.c
* Add Acked-by: Sergei Shtylyov
---
 drivers/net/ethernet/broadcom/b44.c|  3 ++-
 drivers/net/ethernet/broadcom/bcm63xx_enet.c   |  3 ++-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c |  4 +++-
 drivers/net/ethernet/broadcom/tg3.c|  4 +++-
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c |  6 ++
 drivers/net/ethernet/freescale/ucc_geth_ethtool.c  |  4 +++-
 drivers/net/ethernet/marvell/mv643xx_eth.c |  5 ++---
 drivers/net/ethernet/renesas/ravb_main.c   | 14 +++---
 drivers/net/ethernet/renesas/sh_eth.c  |  5 ++---
 drivers/net/ethernet/ti/cpsw.c |  9 +
 drivers/net/ethernet/ti/netcp_ethss.c  |  8 +++-
 drivers/net/phy/phy.c  | 10 +-
 drivers/net/usb/lan78xx.c  |  2 +-
 include/linux/phy.h|  4 ++--
 net/dsa/slave.c|  9 +
 15 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/b44.c 
b/drivers/net/ethernet/broadcom/b44.c
index 5b95bb4..9873d2d 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -1836,7 +1836,8 @@ static int b44_get_link_ksettings(struct net_device *dev,
 
if (bp->flags & B44_FLAG_EXTERNAL_PHY) {
BUG_ON(!dev->phydev);
-   return phy_ethtool_ksettings_get(dev->phydev, cmd);
+   phy_ethtool_ksettings_get(dev->phydev, cmd);
+   return 0;
}
 
supported = (SUPPORTED_Autoneg);
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c 
b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 50d88d3..34ebb40 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1453,7 +1453,8 @@ static int bcm_enet_get_link_ksettings(struct net_device 
*dev,
if (priv->has_phy) {
if (!dev->phydev)
return -ENODEV;
-   return phy_ethtool_ksettings_get(dev->phydev, cmd);
+   phy_ethtool_ksettings_get(dev->phydev, cmd);
+   return 0;
} else {
cmd->base.autoneg = 0;
cmd->base.speed = (priv->force_speed_100) ?
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c 
b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index a205a9f..daca1c9 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -477,7 +477,9 @@ static int bcmgenet_get_link_ksettings(struct net_device 
*dev,
if (!priv->phydev)
return -ENODEV;
 
-   return phy_ethtool_ksettings_get(priv->phydev, cmd);
+   phy_ethtool_ksettings_get(priv->phydev, cmd);
+
+   return 0;
 }
 
 static int bcmgenet_set_link_ksettings(struct net_device *dev,
diff --git a/drivers/net/ethernet/broadcom/tg3.c 
b/drivers/net/ethernet/broadcom/tg3.c
index 537d571..d600c41 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12097,7 +12097,9 @@ static int tg3_get_link_ksettings(struct net_device 
*dev,
if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
return -EAGAIN;
phydev = mdiobus_get_phy(tp->mdio_bus, tp->phy_addr);
-   return phy_ethtool_ksettings_get(phydev, cmd);
+   phy_ethtool_ksettings_get(phydev, cmd);
+
+   return 0;
}
 
supported = (SUPPORTED_Autoneg);
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
index 15571e2..aad825088 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -75,16 +75,14 @@ static char dpaa_stats_global[][ETH_GSTRING_LEN] = {
 static int dpaa_get_link_ksettings(struct net_device *net_dev,
   struct ethtool_link_ksettings *cmd)
 {
-   int err;
-
if (!net_dev->phydev) {
netdev_dbg(net_dev, "phy device not initialized\n");
return 0;
}
 
-   err = phy_ethtool_ksettings_get(net_dev->phydev, cmd);
+   phy_ethtool_ksettings_get(net_dev->phydev, cmd);
 
-   return err;
+   return 0;
 }
 
 static int dpaa_set_link_ksettings(struct net_device *net_dev,
diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c 

Re: [BUG][next-20170606][bisected 411fe24e6b] WARNING: CPU: 10 PID: 0 at kernel/time/tick-sched.c:791

2017-06-12 Thread Abdul Haleem
On Fri, 2017-06-09 at 15:09 +0200, Frederic Weisbecker wrote:
> On Wed, Jun 07, 2017 at 12:56:53PM +0530, Abdul Haleem wrote:
> > Hi,
> > 
> > Test: Trinity (https://github.com/kernelslacker/trinity)
> > Machine : Power 8 PowerVM LPAR
> > Kernel : 4.12.0-rc4-next-20170606
> > gcc : version 5.2.1
> > config : attached
> > 
> > With commit (411fe24e6b : nohz: Fix collision between tick and other
> > hrtimers), a WARNING is seen while running trinity syscall fuzzer
> > 
> > In file kernel/time/tick-sched.c at line 791, a WARN_ON_ONCE is being
> > triggered from tick_nohz_stop_sched_tick function.
> > 
> > /* Skip reprogram of event if its not changed */
> > if (ts->tick_stopped && (expires == ts->next_tick)) {
> > /* Sanity check: make sure clockevent is actually programmed */
> > if (likely(dev->next_event <= ts->next_tick))
> > goto out;
> > 
> > WARN_ON_ONCE(1);
> > printk_once("basemono: %llu ts->next_tick: %llu dev->next_event: 
> > %llu timer->active: %d timer->expires: %llu\n",
> > basemono, ts->next_tick, dev->next_event,
> > hrtimer_active(>sched_timer), 
> > hrtimer_get_expires(>sched_timer));
> > }
> > 
> > Trace logs:
> > [22934.302780] [ cut here ]
> > [22934.302787] WARNING: CPU: 10 PID: 0 at kernel/time/tick-sched.c:791
> > __tick_nohz_idle_enter+0x2e8/0x570
> 
> Hi Abdul,
> 
> Thanks for reporting. I've cooked a fix, any chance you could test it?

Hi Frederic,

Thanks for the fix. With given patch on 4.12.0-rc4-next-20170609, test
completed with no WARNINGS.

Reported-and-tested-by : Abdul Haleem 

> --
> From f80041b5209aaf9d02ac25a29a248d0f214ba19f Mon Sep 17 00:00:00 2001
> From: Frederic Weisbecker 
> Date: Thu, 8 Jun 2017 16:32:58 +0200
> Subject: [PATCH] nohz: Fix spurious warning when hrtimer and clocksource get
>  out of sync
> 
> The sanity check ensuring that the tick expiry cache (ts->next_tick)
> is actually in sync with the hardware clock (dev->next_event) makes the
> wrong assumption that the clock can't be programmed later than the
> hrtimer deadline.
> 
> In fact the clock hardware can be programmed later on some conditions
> such as:
> 
> * The hrtimer deadline is already in the past.
> * The hrtimer deadline is earlier than the minimum delay supported
>   by the hardware.
> 
> Such conditions can be met when we program the tick, for example if the
> last jiffies update hasn't been seen by the current CPU yet, we may
> program the hrtimer to a deadline that is earlier than ktime_get()
> because last_jiffies_update is our timestamp base to compute the next
> tick.
> 
> As a result, we can randomly observe such warning:
> 
>   WARNING: CPU: 5 PID: 0 at kernel/time/tick-sched.c:794 
> tick_nohz_stop_sched_tick kernel/time/tick-sched.c:791 [inline]
>   Call Trace:
>tick_nohz_irq_exit
>tick_irq_exit
>irq_exit
>exiting_irq
>smp_call_function_interrupt
>smp_call_function_single_interrupt
>call_function_single_interrupt
> 
> Therefore, let's rather make sure that the tick expiry cache is sync'ed
> with the tick hrtimer deadline, against which it is not supposed to
> drift away. The clock hardware instead has its own will and can't be
> used as a reliable comparison point.
> 
> Reported-by: Sasha Levin 
> Cc: Thomas Gleixner 
> Cc: Ingo Molnar 
> Cc: Peter Zijlstra 
> Cc: Rik van Riel 
> Cc: James Hartsock 
> Cc: Tim Wright 
> Signed-off-by: Frederic Weisbecker 
> ---
>  kernel/time/tick-sched.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 9d31f1e..83c788e 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -768,7 +768,8 @@ static ktime_t tick_nohz_stop_sched_tick(struct 
> tick_sched *ts,
>   /* Skip reprogram of event if its not changed */
>   if (ts->tick_stopped && (expires == ts->next_tick)) {
>   /* Sanity check: make sure clockevent is actually programmed */
> - if (likely(dev->next_event <= ts->next_tick))
> + if (tick == KTIME_MAX ||
> + ts->next_tick == hrtimer_get_expires(>sched_timer))
>   goto out;
> 
>   WARN_ON_ONCE(1);
> @@ -806,8 +807,10 @@ static ktime_t tick_nohz_stop_sched_tick(struct 
> tick_sched *ts,
>   goto out;
>   }
> 
> + hrtimer_set_expires(>sched_timer, tick);
> +
>   if (ts->nohz_mode == NOHZ_MODE_HIGHRES)
> - hrtimer_start(>sched_timer, tick, HRTIMER_MODE_ABS_PINNED);
> + hrtimer_start_expires(>sched_timer, 
> HRTIMER_MODE_ABS_PINNED);
>   else
>   tick_program_event(tick, 1);
>  out:


Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type

2017-06-12 Thread Greg Kroah-Hartman
On Fri, Jun 09, 2017 at 09:23:10PM +1000, Michael Ellerman wrote:
> Greg Kroah-Hartman  writes:
> 
> > On Fri, Jun 09, 2017 at 08:53:22AM +1000, Michael Ellerman wrote:
> >> Greg Kroah-Hartman  writes:
> >> 
> >> > On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
> >> >> Greg Kroah-Hartman  writes:
> >> >> 
> >> >> > The dev_attrs field has long been "depreciated" and is finally being
> >> >> > removed, so move the driver to use the "correct" dev_groups field
> >> >> > instead for struct bus_type.
> >> >> >
> >> >> > Cc: Benjamin Herrenschmidt 
> >> >> > Cc: Paul Mackerras 
> >> >> > Cc: Michael Ellerman 
> >> >> > Cc: Vineet Gupta 
> >> >> > Cc: Bart Van Assche 
> >> >> > Cc: Robin Murphy 
> >> >> > Cc: Joerg Roedel 
> >> >> > Cc: Johan Hovold 
> >> >> > Cc: Alexey Kardashevskiy 
> >> >> > Cc: Krzysztof Kozlowski 
> >> >> > Cc: 
> >> >> > Signed-off-by: Greg Kroah-Hartman 
> >> >> > ---
> >> >> >  arch/powerpc/platforms/pseries/vio.c | 37 
> >> >> > +---
> >> >> >  1 file changed, 22 insertions(+), 15 deletions(-)
> >> >> 
> >> >> This one needed a bit more work to get building, the incremental diff is
> >> >> below. We need a forward declaration of name, devspec and modalias,
> >> >> which is a bit weird, but that's how the code is currently structured.
> >> >> And there's dev and bus attributes with the same name, so that needed an
> >> >> added "bus".
> >> >> 
> >> >> I booted v2 of patch 10 and this one and everything looks identical to
> >> >> upstream.
> >> >
> >> > Ah, many thanks, this was on my todo list to fix up today.
> >> >
> >> > But you renamed the sysfs files when you added "bus" to the function
> >> > names, are you sure you want to do that?  I don't mind, but if you
> >> > happen to have userspace tools that look at those files, they just broke
> >> > :(
> >> 
> >> Ugh crap, no that won't work.
> >> 
> >> I didn't see it when I tested because my machine doesn't have the CMO
> >> feature enabled.
> >> 
> >> I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
> >> avoid the name clash.
> >
> > Or split it into multiple files, I've solved this that way in the past.
> > You shouldn't have to "open code" BUS_ATTR_RO().
> 
> It just requires one use of __ATTR(), which seems simpler than splitting
> the file in two.
> 
> Here's a new incremental diff against your patch.
> 
> I confirmed none of the cmo names changed, result after is:
> 
> ./devices/vio/cmo_desired
> ./devices/vio/cmo_allocated
> ./devices/vio/cmo_entitled
> ./devices/vio/cmo_allocs_failed
> ./devices/vio/7100/cmo_desired
> ./devices/vio/7100/cmo_allocated
> ./devices/vio/7100/cmo_entitled
> ./devices/vio/7100/cmo_allocs_failed
> ./devices/vio/3000/cmo_desired
> ./devices/vio/3000/cmo_allocated
> ./devices/vio/3000/cmo_entitled
> ./devices/vio/3000/cmo_allocs_failed
> ./devices/vio/2000/cmo_desired
> ./devices/vio/2000/cmo_allocated
> ./devices/vio/2000/cmo_entitled
> ./devices/vio/2000/cmo_allocs_failed
> ./bus/vio/cmo_high
> ./bus/vio/cmo_spare
> ./bus/vio/cmo_reserve_size
> ./bus/vio/cmo_desired
> ./bus/vio/cmo_entitled
> ./bus/vio/cmo_excess_free
> ./bus/vio/cmo_excess_size
> ./bus/vio/cmo_min
> ./bus/vio/cmo_curr

Thanks for this, it seems to have passed all of the 0-day testing.  I'll
go apply it to my "real" tree now, thanks again for the help.

greg k-h


Re: [RFC PATCH 1/7 v1]powerpc: Free up four PTE bits to accommodate memory keys

2017-06-12 Thread Aneesh Kumar K.V
Ram Pai  writes:

> Rearrange  PTE   bits to  free  up  bits 3, 4, 5  and  6  for
> memory keys. Bit 3, 4, 5, 6 and 57  shall  be used for memory
> keys.
>
> The patch does the following change to the 64K PTE format
>
> H_PAGE_BUSY moves from bit 3 to bit 7
> H_PAGE_F_SECOND which occupied bit 4 moves to the second part
>   of the pte.
> H_PAGE_F_GIX which  occupied bit 5, 6 and 7 also moves to the
>   second part of the pte.
>
> The second part of the PTE will hold
>a (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for  64K page backed pte,
>and sixteen (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for 4k  backed
>   pte.
>
> the four  bits((H_PAGE_F_SECOND|H_PAGE_F_GIX) that represent a slot
> is initialized to 0xF indicating a invalid slot. if a hashpage does
> get  allocated  to  the  0xF  slot, it is released and not used. In
> other words, even  though  0xF  is  a valid slot we discard it  and
> consider it as invalid slot(HPTE_SOFT_INVALID). This  gives  us  an
> opportunity to  not  depend on a bit in the primary PTE in order to
> determine the validity of a slot.

Do we need to do this for 64K hptes ? H_PAGE_HASHPTE indicates whether a
slot is valid or not. For 4K hptes, we do need this right ? ie, only
when H_PAGE_COMBO is set we need to consider 0xf as an invalid slot


>
> When  we  release  a  0xF slot we also release a legitimate primary
> slot  and  unmap  that  entry. This  is  to  ensure  that we do get
> a legimate non-0xF slot the next time we retry for a slot.

Can you explain this more ? what is a primary slot here ?

>
> Though treating 0xF slot as invalid reduces the number of available
> slots and make have a effect on the performance, the probabilty
> of hitting a 0xF is extermely low.
>
> Compared  to the current scheme, the above described scheme reduces
> the number of false hash table updates  significantly  and  has the
> added  advantage  of  releasing  four  valuable  PTE bits for other
> purpose.
>
> This idea was jointly developed by Paul Mackerras, Aneesh, Michael
> Ellermen and myself.
>
> 4K PTE format remain unchanged currently.
>
> Signed-off-by: Ram Pai 
> ---
>  arch/powerpc/include/asm/book3s/64/hash-4k.h  | 12 +
>  arch/powerpc/include/asm/book3s/64/hash-64k.h | 38 ++
>  arch/powerpc/include/asm/book3s/64/hash.h |  8 ++-
>  arch/powerpc/include/asm/book3s/64/mmu-hash.h |  5 ++
>  arch/powerpc/mm/dump_linuxpagetables.c|  3 +-
>  arch/powerpc/mm/hash64_4k.c   | 12 ++---
>  arch/powerpc/mm/hash64_64k.c  | 73 
> +--
>  arch/powerpc/mm/hash_utils_64.c   | 38 +-
>  arch/powerpc/mm/hugetlbpage-hash64.c  | 16 +++---
>  9 files changed, 107 insertions(+), 98 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h 
> b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> index b4b5e6b..223d318 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> @@ -16,6 +16,18 @@
>  #define H_PUD_TABLE_SIZE (sizeof(pud_t) << H_PUD_INDEX_SIZE)
>  #define H_PGD_TABLE_SIZE (sizeof(pgd_t) << H_PGD_INDEX_SIZE)
>
> +
> +/*
> + * Only supported by 4k linux page size

that comment is confusing, you can drop that, it is part of hash-4k.h
which means these defines are local to 4k linux page size config.

> + */
> +#define H_PAGE_F_SECOND_RPAGE_RSV2 /* HPTE is in 2ndary HPTEG */
> +#define H_PAGE_F_GIX   (_RPAGE_RSV3 | _RPAGE_RSV4 | _RPAGE_RPN44)
> +#define H_PAGE_F_GIX_SHIFT 56
> +
> +#define H_PAGE_BUSY  _RPAGE_RSV1 /* software: PTE & hash are busy */
> +#define H_PAGE_HASHPTE   _RPAGE_RPN43/* PTE has associated HPTE */
> +
> +
>  /* PTE flags to conserve for HPTE identification */
>  #define _PAGE_HPTEFLAGS (H_PAGE_BUSY | H_PAGE_HASHPTE | \
>H_PAGE_F_SECOND | H_PAGE_F_GIX)
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h 
> b/arch/powerpc/include/asm/book3s/64/hash-64k.h
> index 9732837..87ee22d 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
> @@ -10,23 +10,21 @@
>   * 64k aligned address free up few of the lower bits of RPN for us
>   * We steal that here. For more deatils look at pte_pfn/pfn_pte()
>   */
> -#define H_PAGE_COMBO _RPAGE_RPN0 /* this is a combo 4k page */
> -#define H_PAGE_4K_PFN_RPAGE_RPN1 /* PFN is for a single 4k page */
> +#define H_PAGE_COMBO   _RPAGE_RPN0 /* this is a combo 4k page */
> +#define H_PAGE_4K_PFN  _RPAGE_RPN1 /* PFN is for a single 4k page */
> +
> +#define H_PAGE_BUSY  _RPAGE_RPN44 /* software: PTE & hash are busy */
> +#define H_PAGE_HASHPTE   _RPAGE_RPN43/* PTE has associated HPTE */
> +
>  /*
>   * We need to differentiate between explicit huge page and THP huge
>   * page, since THP huge page also need to track real subpage details
>   */
>  #define H_PAGE_THP_HUGE  

Re: [PATCH v10 09/10] powerpc/perf: Thread IMC PMU functions

2017-06-12 Thread Madhavan Srinivasan



On Sunday 11 June 2017 01:43 AM, kbuild test robot wrote:

Hi Anju,

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.12-rc4 next-20170609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Madhavan-Srinivasan/IMC-Instrumentation-Support/20170609-183528
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
 wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
 chmod +x ~/bin/make.cross
 # save the attached .config to linux build tree
 make.cross ARCH=powerpc

Note: the 
linux-review/Madhavan-Srinivasan/IMC-Instrumentation-Support/20170609-183528 
HEAD 32ada0705ff79986e8ceca5e83dba14c0b620751 builds fine.
   It only hurts bisectibility.

All errors (new ones prefixed by >>):

In file included from include/linux/compiler.h:62:0,
 from include/uapi/linux/stddef.h:1,
 from include/linux/stddef.h:4,
 from include/uapi/linux/posix_types.h:4,
 from include/uapi/linux/types.h:13,
 from include/linux/types.h:5,
 from include/uapi/linux/perf_event.h:17,
 from include/linux/perf_event.h:17,
 from arch/powerpc/perf/imc-pmu.c:13:
arch/powerpc/perf/imc-pmu.c: In function 'cleanup_all_thread_imc_memory':

arch/powerpc/perf/imc-pmu.c:863:31: error: 'cpu' undeclared (first use in this 
function)

Have fixed this issue in the next patch. Damn my bad.
Will wait for comments and if needed can respin just with this.

Maddy


   if (per_cpu(thread_imc_mem, cpu))
   ^
include/linux/compiler-gcc.h:53:26: note: in definition of macro 
'RELOC_HIDE'
  (typeof(ptr)) (__ptr + (off)); \
  ^~~
include/linux/percpu-defs.h:223:2: note: in expansion of macro 
'SHIFT_PERCPU_PTR'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~~~
include/linux/percpu-defs.h:223:26: note: in expansion of macro 
'per_cpu_offset'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~
include/linux/percpu-defs.h:256:29: note: in expansion of macro 
'per_cpu_ptr'
 #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
 ^~~
arch/powerpc/perf/imc-pmu.c:863:7: note: in expansion of macro 'per_cpu'
   if (per_cpu(thread_imc_mem, cpu))
   ^~~
arch/powerpc/perf/imc-pmu.c:863:31: note: each undeclared identifier is 
reported only once for each function it appears in
   if (per_cpu(thread_imc_mem, cpu))
   ^
include/linux/compiler-gcc.h:53:26: note: in definition of macro 
'RELOC_HIDE'
  (typeof(ptr)) (__ptr + (off)); \
  ^~~
include/linux/percpu-defs.h:223:2: note: in expansion of macro 
'SHIFT_PERCPU_PTR'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~~~
include/linux/percpu-defs.h:223:26: note: in expansion of macro 
'per_cpu_offset'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~
include/linux/percpu-defs.h:256:29: note: in expansion of macro 
'per_cpu_ptr'
 #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
 ^~~
arch/powerpc/perf/imc-pmu.c:863:7: note: in expansion of macro 'per_cpu'
   if (per_cpu(thread_imc_mem, cpu))
   ^~~

vim +/cpu +863 arch/powerpc/perf/imc-pmu.c

857 
858 static void cleanup_all_thread_imc_memory(void)
859 {
860 int i;
861 
862 for_each_online_cpu(i) {
  > 863  if (per_cpu(thread_imc_mem, cpu))
864 free_pages(per_cpu(thread_imc_mem, cpu), 0);
865 }
866 }

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation