Re: [PATCH v2 5/9] powerpc/vmlinux.lds: Align __init_begin to 16M
On Mon, 5 Jun 2017 08:42:40 +1000 Balbir Singh wrote: > On Sun, Jun 4, 2017 at 2:22 PM, Nicholas Piggin wrote: > > On Sat, 3 Jun 2017 17:18:39 +1000 > > Balbir Singh wrote: > > > >> For CONFIG_STRICT_KERNEL_RWX align __init_begin to 16M. > >> We use 16M since its the larger of 2M on radix and 16M > >> on hash for our linear mapping. The plan is to have > >> .text, .rodata and everything upto __init_begin marked > >> as RX. Note we still have executable read only data. > >> We could further align read only data to another 16M > >> boundary, but then the linker starts using stubs and > >> that breaks our assembler code in head_64.S > > > > Is this still the case with powerpc next? > > > > Sorry, no, I was on linux-next for testing, but I think your linker > stub patches went in very recently. I'll rebase on top and test, That would be good. I'd like to make sure the linker stub workaround does work for your case. > but I am not sure if I want two 16M alignments and bloat the size > of vmlinux. But I'll double check what happens Maybe it could be an option. Thanks, Nick
[RFC 2/2] powerpc/powernv : Add support for OPAL-OCC command/response interface
In P9, OCC (On-Chip-Controller) supports shared memory based commad-response interface. Within the shared memory there is an OPAL command buffer and OCC response buffer that can be used to send inband commands to OCC. This patch adds a platform driver to support the command/response interface between OCC and the host. Signed-off-by: Shilpasri G Bhat --- arch/powerpc/include/asm/opal-api.h| 40 ++- arch/powerpc/include/asm/opal.h| 3 + arch/powerpc/platforms/powernv/Makefile| 2 +- arch/powerpc/platforms/powernv/opal-occ.c | 349 + arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + arch/powerpc/platforms/powernv/opal.c | 8 + 6 files changed, 401 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/platforms/powernv/opal-occ.c diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index cb3e624..d75fbb9 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -42,6 +42,10 @@ #define OPAL_I2C_STOP_ERR -24 #define OPAL_XIVE_PROVISIONING -31 #define OPAL_XIVE_FREE_ACTIVE -32 +#define OPAL_OCC_INVALID_STATE -33 +#define OPAL_OCC_BUSY -34 +#define OPAL_OCC_CMD_TIMEOUT -35 +#define OPAL_OCC_RSP_MISMATCH -36 /* API Tokens (in r0) */ #define OPAL_INVALID_CALL -1 @@ -190,7 +194,8 @@ #define OPAL_NPU_INIT_CONTEXT 146 #define OPAL_NPU_DESTROY_CONTEXT 147 #define OPAL_NPU_MAP_LPAR 148 -#define OPAL_LAST 148 +#define OPAL_OCC_COMMAND 149 +#define OPAL_LAST 149 /* Device tree flags */ @@ -829,6 +834,39 @@ struct opal_prd_msg_header { struct opal_prd_msg; +enum occ_cmd { + OCC_CMD_AMESTER_PASS_THRU = 0, + OCC_CMD_CLEAR_SENSOR_DATA, + OCC_CMD_SET_POWER_CAP, + OCC_CMD_SET_POWER_SHIFTING_RATIO, + OCC_CMD_LAST +}; + +struct opal_occ_cmd_rsp_msg { + u8 *cdata; + u8 *rdata; + __be16 cdata_size; + __be16 rdata_size; + u8 cmd; + u8 request_id; + u8 status; +}; + +struct opal_occ_cmd_data { + u16 size; + u8 cmd; + u8 data[]; +}; + +struct opal_occ_rsp_data { + u16 size; + u8 status; + u8 data[]; +}; + +#define MAX_OPAL_CMD_DATA_LENGTH4090 +#define MAX_OCC_RSP_DATA_LENGTH 8698 + #define OCC_RESET 0 #define OCC_LOAD1 #define OCC_THROTTLE2 diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 03ed493..e55ed79 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -346,6 +346,9 @@ static inline int opal_get_async_rc(struct opal_msg msg) void opal_wake_poller(void); +int64_t opal_occ_command(int chip_id, struct opal_occ_cmd_rsp_msg *msg, +bool retry); + #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_OPAL_H */ diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index b5d98cb..f5f0902 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile @@ -2,7 +2,7 @@ obj-y += setup.o opal-wrappers.o opal.o opal-async.o idle.o obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o obj-y += opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o -obj-y += opal-kmsg.o +obj-y += opal-kmsg.o opal-occ.o obj-$(CONFIG_SMP) += smp.o subcore.o subcore-asm.o obj-$(CONFIG_PCI) += pci.o pci-ioda.o npu-dma.o diff --git a/arch/powerpc/platforms/powernv/opal-occ.c b/arch/powerpc/platforms/powernv/opal-occ.c new file mode 100644 index 000..bae63f1 --- /dev/null +++ b/arch/powerpc/platforms/powernv/opal-occ.c @@ -0,0 +1,349 @@ +/* + * Copyright IBM Corporation 2017 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#define pr_fmt(fmt) "opal-occ: " fmt + +#include +#include +#include +#include +#include +#include +#include + +struct occ { + struct miscdevice dev; + struct opal_occ_rsp_data *rsp; + /* +* spinlock_t lock: +* Used while updating cmd_in_progress and session_in_progress +*/ + spinlock_t lock; + int id; + u8 last_token; + bool cmd_in_progress; + bool session_in_progres
[RFC 1/2] powerpc/powernv: Get a unique token for async completions
This patch adds support to get a unique token for async completion requests. This will be used for creating non-repititive request handles for consecutive requests in OPAL-OCC command/response interface. Signed-off-by: Shilpasri G Bhat --- arch/powerpc/include/asm/opal.h | 1 + arch/powerpc/platforms/powernv/opal-async.c | 46 + 2 files changed, 47 insertions(+) diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 588fb1c..03ed493 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -293,6 +293,7 @@ extern int opal_message_notifier_unregister(enum opal_msg_type msg_type, extern int __opal_async_get_token(void); extern int opal_async_get_token_interruptible(void); +extern int opal_async_get_unique_token_interruptible(int last_token); extern int __opal_async_release_token(int token); extern int opal_async_release_token(int token); extern int opal_async_wait_response(uint64_t token, struct opal_msg *msg); diff --git a/arch/powerpc/platforms/powernv/opal-async.c b/arch/powerpc/platforms/powernv/opal-async.c index 83bebee..8caeea2 100644 --- a/arch/powerpc/platforms/powernv/opal-async.c +++ b/arch/powerpc/platforms/powernv/opal-async.c @@ -73,6 +73,52 @@ int opal_async_get_token_interruptible(void) } EXPORT_SYMBOL_GPL(opal_async_get_token_interruptible); +static int __opal_async_get_new_token(int last_token) +{ + unsigned long flags; + int token; + + spin_lock_irqsave(&opal_async_comp_lock, flags); + token = find_next_bit(opal_async_complete_map, opal_max_async_tokens, + last_token + 1); + if (token >= opal_max_async_tokens) { + token = find_first_bit(opal_async_complete_map, + opal_max_async_tokens); + if (token >= opal_max_async_tokens || token == last_token) { + token = -EBUSY; + goto out; + } + } + + pr_debug("%s token = %d\n", __func__, token); + if (__test_and_set_bit(token, opal_async_token_map)) { + token = -EBUSY; + goto out; + } + + __clear_bit(token, opal_async_complete_map); + +out: + spin_unlock_irqrestore(&opal_async_comp_lock, flags); + return token; +} + +int opal_async_get_unique_token_interruptible(int last_token) +{ + int token; + + /* Wait until a token is available */ + if (down_interruptible(&opal_async_sem)) + return -ERESTARTSYS; + + token = __opal_async_get_new_token(last_token); + if (token < 0) + up(&opal_async_sem); + + return token; +} +EXPORT_SYMBOL_GPL(opal_async_get_unique_token_interruptible); + int __opal_async_release_token(int token) { unsigned long flags; -- 1.8.3.1
[RFC 0/2] Add support for OCC command/response interface
In P9, OCC(On Chip Controller) can be sent commands inband via shared memory based command response interface. This patch adds a platform driver to support the OCC command-response interface. The skiboot patch for the interface is posted here: https://lists.ozlabs.org/pipermail/skiboot/2017-June/007542.html Shilpasri G Bhat (2): powerpc/powernv: Get a unique token for async completions powerpc/powernv : Add support for OPAL-OCC command/response interface arch/powerpc/include/asm/opal-api.h| 40 ++- arch/powerpc/include/asm/opal.h| 4 + arch/powerpc/platforms/powernv/Makefile| 2 +- arch/powerpc/platforms/powernv/opal-async.c| 46 arch/powerpc/platforms/powernv/opal-occ.c | 349 + arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + arch/powerpc/platforms/powernv/opal.c | 8 + 7 files changed, 448 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/platforms/powernv/opal-occ.c -- 1.8.3.1
[PATCH] powerpc: Increase ELF_ET_DYN_BASE to 1TB for 64-bit applications
Since 7e60d1b427c51cf2525e5d736a71780978cfb828, the ELF_ET_DYN_BASE for powerpc applications has been set to 512MB. Recently there have been several reports of applications SEGV'ing and newer version of glibc also SEGV'ing (while testing) when using the following test method: LD_LIBRARY_PATH=/XXX/lib /XXX/lib/ld-2.24.so For reproducing the above, consider the following test application which uses a larger bss: 1. # cat large-bss-test-app.c #include #include #define VECSIZE (1024 * 1024 * 100) float p[VECSIZE], v1[VECSIZE], v2[VECSIZE]; void vec_mult(long int N) { long int i; for (i = 0; i < N; i++) p[i] = v1[i] * v2[i]; } int main() { char command[1024]; sprintf(command,"cat /proc/%d/maps",getpid()); system(command); vec_mult(VECSIZE/100); printf ("Done\n"); return 0; } 2. Compile it using gcc (I am using gcc-6.3.1): # gcc -g -o large-bss-test-app large-bss-test-app.c 3. Running the compiled application with ld.so directly is enough to trigger the SEGV on ppc64le/ppc64: # /lib64/ld-2.24.so ./large-bss-test-app Segmentation fault (core dumped) 4. Notice it's random depending on the layout changes, so it passes on some occassions as well: # /lib64/ld-2.24.so ./large-bss-test-app 1000-1001 r-xp fd:00 2883597 /root/large-bss-test-app 1001-1002 r--p fd:00 2883597 /root/large-bss-test-app 1002-1003 rw-p 0001 fd:00 2883597 /root/large-bss-test-app 1003-5b03 rw-p 00:00 0 5e95-5e99 r-xp fd:00 1180301 /usr/lib64/ld-2.24.so 5e99-5e9a r--p 0003 fd:00 1180301 /usr/lib64/ld-2.24.so 5e9a-5e9b rw-p 0004 fd:00 1180301 /usr/lib64/ld-2.24.so 3fffa368-3fffa386 r-xp fd:00 1180308 /usr/lib64/libc-2.24.so 3fffa386-3fffa387 r--p 001d fd:00 1180308 /usr/lib64/libc-2.24.so 3fffa387-3fffa388 rw-p 001e fd:00 1180308 /usr/lib64/libc-2.24.so 3fffa389-3fffa38b r-xp 00:00 0 [vdso] 3fffc674-3fffc677 rw-p 00:00 0 [stack] Done One way to fix this is to move ELF_ET_DYN_BASE from 0x2000 (512MB) to 0x100 (1TB), atleast for 64-bit applications. This allows hopefully enough space for most of the applications without causing them to trample upon the ld.so, leading to a SEGV. ELF_ET_DYN_BASE is still kept as 0x2000 (512MB) for 32-bit applications to preserve their compatibility. After this change, the layout for the 'large-bss-test-app' changes as shown below: # /lib64/ld-2.24.so ./large-bss-test-app 1000-1001 r-xp fd:00 2107527 /root/large-bss-test-app 1001-1002 r--p fd:00 2107527 /root/large-bss-test-app 1002-1003 rw-p 0001 fd:00 2107527 /root/large-bss-test-app 1003-5b03 rw-p 00:00 0 100283b-100283f r-xp fd:00 1835645 /usr/lib64/ld-2.24.so 100283f-1002840 r--p 0003 fd:00 1835645 /usr/lib64/ld-2.24.so 1002840-1002841 rw-p 0004 fd:00 1835645 /usr/lib64/ld-2.24.so 7fff8a47-7fff8a65 r-xp fd:00 1835652 /usr/lib64/libc-2.24.so 7fff8a65-7fff8a66 r--p 001d fd:00 1835652 /usr/lib64/libc-2.24.so 7fff8a66-7fff8a67 rw-p 001e fd:00 1835652 /usr/lib64/libc-2.24.so 7fff8a68-7fff8a6a r-xp 00:00 0 [vdso] 7fffc6d9-7fffc6dc rw-p 00:00 0 [stack] Done Cc: Anton Blanchard Cc: Daniel Cashman Cc: Kees Cook Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Signed-off-by: Bhupesh Sharma --- arch/powerpc/include/asm/elf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 09bde6e..683230c 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h @@ -28,7 +28,9 @@ the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ -#define ELF_ET_DYN_BASE0x2000 +/* Keep this as 512MB for 32-bit applications and 1TB for 64-bit ones
Re: [PATCH] powerpc/kernel: improve FP and vector registers restoration
Breno Leitao writes: > Currently tsk->thread->load_vec and load_fp are not initialized during a > task creation, which set garbage to these variables (non-zero value). > > These variables will be checked later at restore_math() to validate if the > FP and vectors are being utilized. Since these values might be non-zero, > the restore_math() will continue to save the FP and vectors even if they > were never utilized before the userspace application. load_fp and load_vec > counters will then overflow and the FP and Altivec will be finally > disabled, but before that condition is reached (counter overflow) several > context switches restored FP and vector registers without need, causing a > performance degradation. > > Signed-off-by: Breno Leitao > Signed-off-by: Gustavo Romero Thanks, I tweaked the wording a little and added: Fixes: 70fe3d980f5f ("powerpc: Restore FPU/VEC/VSX if previously used") Cc: sta...@vger.kernel.org # v4.6+ cheers
Re: [PATCH v1 7/8] powerpc/Kconfig: Enable STRICT_KERNEL_RWX
Balbir Singh writes: > On Mon, May 29, 2017 at 6:00 PM, Christophe LEROY > wrote: >> Le 25/05/2017 à 18:45, kbuild test robot a écrit : >>> All errors (new ones prefixed by >>): >>> > kernel//power/snapshot.c:40:28: fatal error: asm/set_memory.h: No such > file or directory >>> >>> #include >> >> >> Looks like it is linked to commit 50327ddfb ("kernel/power/snapshot.c: use >> set_memory.h header"). >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=50327ddfb >> >> I believe that inclusion should be conditional to >> CONFIG_ARCH_HAS_SET_MEMORY, which is not set by powerpc arch, just like in >> include/linux/filter.c >> > Agreed, it needs to be fixed in kernel/power/sanpshot.c It should be fixed in asm-generic/set_memory.h, there should be no need to guard an include of a generic header. cheers
Re: [PATCH v2] cxl: Avoid double free_irq() for psl,slice interrupts
On 03/06/17 02:56, Vaibhav Jain wrote: During an eeh call to cxl_remove can result in double free_irq of psl,slice interrupts. This can happen if perst_reloads_same_image == 1 and call to cxl_configure_adapter() fails during slot_reset callback. In such a case we see a kernel oops with following back-trace: Oops: Kernel access of bad area, sig: 11 [#1] Call Trace: free_irq+0x88/0xd0 (unreliable) cxl_unmap_irq+0x20/0x40 [cxl] cxl_native_release_psl_irq+0x78/0xd8 [cxl] pci_deconfigure_afu+0xac/0x110 [cxl] cxl_remove+0x104/0x210 [cxl] pci_device_remove+0x6c/0x110 device_release_driver_internal+0x204/0x2e0 pci_stop_bus_device+0xa0/0xd0 pci_stop_and_remove_bus_device+0x28/0x40 pci_hp_remove_devices+0xb0/0x150 pci_hp_remove_devices+0x68/0x150 eeh_handle_normal_event+0x140/0x580 eeh_handle_event+0x174/0x360 eeh_event_handler+0x1e8/0x1f0 This patch fixes the issue of double free_irq by checking that variables that hold the virqs (err_hwirq, serr_hwirq, psl_virq) are not '0' before un-mapping and resetting these variables to '0' when they are un-mapped. Cc: sta...@vger.kernel.org Signed-off-by: Vaibhav Jain v2 change looks good to me Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
Re: [PATCH] cxl: Fix error path on bad ioctl
On 03/06/17 02:15, Frederic Barrat wrote: Fix error path if we can't copy user structure on CXL_IOCTL_START_WORK ioctl. Signed-off-by: Frederic Barrat Cc: sta...@vger.kernel.org Reviewed-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnel...@au1.ibm.com IBM Australia Limited
[PATCH] net/phy: Make phy_ethtool_ksettings_get return void
Make return value void since function never return meaningfull value Signed-off-by: Yuval Shaia --- 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/ti/cpsw.c | 9 + drivers/net/phy/phy.c | 10 +- drivers/net/usb/lan78xx.c | 2 +- include/linux/phy.h| 4 ++-- net/dsa/slave.c| 9 + 12 files changed, 35 insertions(+), 28 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 b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c index b642990..4df282e 100644 --- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c +++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c @@ -113,7 +113,9 @@ uec_get_ksettings(struct net_device *netdev, struct ethtool_link_ksettings *cmd) if (!phydev) return -ENODEV; - return phy_ethtool_ksettings_get(phydev, cmd); + phy_ethtool_ksettings_get(phydev, cmd); + + return 0; } static int diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 25642de..5794d98 100644 ---
Re: [PATCH v2 5/9] powerpc/vmlinux.lds: Align __init_begin to 16M
On Sun, Jun 4, 2017 at 2:22 PM, Nicholas Piggin wrote: > On Sat, 3 Jun 2017 17:18:39 +1000 > Balbir Singh wrote: > >> For CONFIG_STRICT_KERNEL_RWX align __init_begin to 16M. >> We use 16M since its the larger of 2M on radix and 16M >> on hash for our linear mapping. The plan is to have >> .text, .rodata and everything upto __init_begin marked >> as RX. Note we still have executable read only data. >> We could further align read only data to another 16M >> boundary, but then the linker starts using stubs and >> that breaks our assembler code in head_64.S > > Is this still the case with powerpc next? > Sorry, no, I was on linux-next for testing, but I think your linker stub patches went in very recently. I'll rebase on top and test, but I am not sure if I want two 16M alignments and bloat the size of vmlinux. But I'll double check what happens Balbir Singh.
[PATCH] powerpc/pseries: fix spelling mistake: "Attemping" -> "Attempting"
From: Colin Ian King Trivial fix to spelling mistake in pr_debug message Signed-off-by: Colin Ian King --- arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 7bc0e91f8715..6afd1efd3633 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -554,7 +554,7 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, u32 drc_index) { int rc; - pr_debug("Attemping to remove CPU %s, drc index: %x\n", + pr_debug("Attempting to remove CPU %s, drc index: %x\n", dn->name, drc_index); rc = dlpar_offline_cpu(dn); -- 2.11.0
Re: [PATCH] net/phy: Make phy_ethtool_ksettings_get return void
Hi Yuval, [auto build test ERROR on net-next/master] [also build test ERROR on v4.12-rc3 next-20170602] [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/20170605-012813 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 error/warnings (new ones prefixed by >>): drivers/net//ethernet/renesas/sh_eth.c: In function 'sh_eth_get_link_ksettings': >> drivers/net//ethernet/renesas/sh_eth.c:1924:6: error: void value not ignored >> as it ought to be ret = phy_ethtool_ksettings_get(ndev->phydev, cmd); ^ -- drivers/net//ethernet/renesas/ravb_main.c: In function 'ravb_get_link_ksettings': >> drivers/net//ethernet/renesas/ravb_main.c:1084:9: error: void value not >> ignored as it ought to be error = phy_ethtool_ksettings_get(ndev->phydev, cmd); ^ -- 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] } ^ -- drivers/net//ethernet/stmicro/stmmac/stmmac_ethtool.c: In function 'stmmac_ethtool_get_link_ksettings': >> drivers/net//ethernet/stmicro/stmmac/stmmac_ethtool.c:367:5: error: void >> value not ignored as it ought to be rc = phy_ethtool_ksettings_get(phy, cmd); ^ vim +1924 drivers/net//ethernet/renesas/sh_eth.c 9fd0375ad drivers/net/ethernet/renesas/sh_eth.c Philippe Reynes 2016-08-10 1908 phy_start(ndev->phydev); 86a74ff21 drivers/net/sh_eth.c Nobuhiro Iwamatsu 2008-06-09 1909 86a74ff21 drivers/net/sh_eth.c Nobuhiro Iwamatsu 2008-06-09 1910 return 0; 86a74ff21 drivers/net/sh_eth.c Nobuhiro Iwamatsu 2008-06-09 1911 } 86a74ff21 drivers/net/sh_eth.c Nobuhiro Iwamatsu 2008-06-09 1912 f08aff444 drivers/net/ethernet/renesas/sh_eth.c Philippe Reynes 2016-08-10 1913 static int sh_eth_get_link_ksettings(struct net_device *ndev, f08aff444 drivers/net/ethernet/renesas/sh_eth.c Philippe Reynes 2016-08-10 1914 struct ethtool_link_ksettings *cmd) dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1915 { dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1916 struct sh_eth_private *mdp = netdev_priv(ndev); dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1917 unsigned long flags; dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1918 int ret; dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1919 9fd0375ad drivers/net/ethernet/renesas/sh_eth.c Philippe Reynes 2016-08-10 1920 if (!ndev->phydev) 4f9dce230 drivers/net/ethernet/renesas/sh_eth.c Ben Hutchings 2015-01-16 1921 return -ENODEV; 4f9dce230 drivers/net/ethernet/renesas/sh_eth.c Ben Hutchings 2015-01-16 1922 dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1923 spin_lock_irqsave(&mdp->lock, flags); f08aff444 drivers/net/ethernet/renesas/sh_eth.c Philippe Reynes 2016-08-10 @1924 ret = phy_ethtool_ksettings_get(ndev->phydev, cmd); dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1925 spin_unlock_irqrestore(&mdp->lock, flags); dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1926 dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1927 return ret; dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1928 } dc19e4e5e drivers/net/sh_eth.c Nobuhiro Iwamatsu 2011-02-15 1929 f08aff444 drivers/net/ethernet/renesas/sh_eth.c Philippe Reynes 2016-08-10 1930 static int
Re: [PATCH] powerpc/kernel: improve FP and vector registers restoration
On Sun, Jun 04, 2017 at 11:38:14AM +1000, Anton Blanchard wrote: > On Sat, 3 Jun 2017 19:42:14 -0300 > Breno Leitao wrote: > > > Hi Anton, > > > > On Sat, Jun 03, 2017 at 08:04:11AM +1000, Anton Blanchard wrote: > > > Hi Breno, > > > > > > > Currently tsk->thread->load_vec and load_fp are not initialized > > > > during a task creation, which set garbage to these variables > > > > (non-zero value). > > > > > > Nice catch! It seems like we should zero load_tm too though? > > > > Yes, it seems we need to zero load_tm also, since it does not seem to > > be zeroed anywhere else. > > > > But I did some tests, and load_tm is always zero after start_thread() > > is being called. > > > > In fact, start_thread() is being called and pt_regs->load_tm is > > already zero since the function start. > > > > I also wrote a SystemTap script[1] to investigate it better, and I've > > never seen a single load_tm != 0 in a my machine. I tested on both > > POWER8 bare metal and KVM guests. (load_vec and load_fp happened to > > have garbage all the time) > > > > Any idea if this is just occasional event, or, if there is someone > > zeroing it in an obscure code? > > Quite likely no one uses TM :) Try: In fact, I had tested with TM[1] and haven't seen any issue, but I was not calling a nested application (through execve() syscall). Somehow if I call "$ ./tm_application ; /bin/true", I do not see a non-zero load_tm in the new task->thread. On the other side, I see the corruption with your test case, mainly if I sleep after 'tbegin.' and before execlp(), giving a chance to have load_tm incremented, and this value is being inherited in the new task->thread. This is obviously wrong, I will send a patch to have it fixed. Thanks for the guidance! [1] https://github.com/leitao/htm_torture
[PATCH] selftests/powerpc: context_switch use private futexes with threads
This reduces overhead of mutex locking and increases context switch rate significantly (which helps to measure and profile the context switch path). Signed-off-by: Nicholas Piggin --- .../selftests/powerpc/benchmarks/context_switch.c | 53 ++ 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c index 778f5fbfd784..f4241339edd2 100644 --- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c +++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c @@ -258,9 +258,14 @@ static unsigned long xchg(unsigned long *p, unsigned long val) return __atomic_exchange_n(p, val, __ATOMIC_SEQ_CST); } +static int processes; + static int mutex_lock(unsigned long *m) { int c; + int flags = FUTEX_WAIT; + if (!processes) + flags |= FUTEX_PRIVATE_FLAG; c = cmpxchg(m, 0, 1); if (!c) @@ -270,7 +275,7 @@ static int mutex_lock(unsigned long *m) c = xchg(m, 2); while (c) { - sys_futex(m, FUTEX_WAIT, 2, NULL, NULL, 0); + sys_futex(m, flags, 2, NULL, NULL, 0); c = xchg(m, 2); } @@ -279,12 +284,16 @@ static int mutex_lock(unsigned long *m) static int mutex_unlock(unsigned long *m) { + int flags = FUTEX_WAKE; + if (!processes) + flags |= FUTEX_PRIVATE_FLAG; + if (*m == 2) *m = 0; else if (xchg(m, 0) == 1) return 0; - sys_futex(m, FUTEX_WAKE, 1, NULL, NULL, 0); + sys_futex(m, flags, 1, NULL, NULL, 0); return 0; } @@ -293,26 +302,32 @@ static unsigned long *m1, *m2; static void futex_setup(int cpu1, int cpu2) { - int shmid; - void *shmaddr; + if (!processes) { + static unsigned long _m1, _m2; + m1 = &_m1; + m2 = &_m2; + } else { + int shmid; + void *shmaddr; - shmid = shmget(IPC_PRIVATE, getpagesize(), SHM_R | SHM_W); - if (shmid < 0) { - perror("shmget"); - exit(1); - } + shmid = shmget(IPC_PRIVATE, getpagesize(), SHM_R | SHM_W); + if (shmid < 0) { + perror("shmget"); + exit(1); + } - shmaddr = shmat(shmid, NULL, 0); - if (shmaddr == (char *)-1) { - perror("shmat"); - shmctl(shmid, IPC_RMID, NULL); - exit(1); - } + shmaddr = shmat(shmid, NULL, 0); + if (shmaddr == (char *)-1) { + perror("shmat"); + shmctl(shmid, IPC_RMID, NULL); + exit(1); + } - shmctl(shmid, IPC_RMID, NULL); + shmctl(shmid, IPC_RMID, NULL); - m1 = shmaddr; - m2 = shmaddr + sizeof(*m1); + m1 = shmaddr; + m2 = shmaddr + sizeof(*m1); + } *m1 = 0; *m2 = 0; @@ -352,8 +367,6 @@ static struct actions futex_actions = { .thread2 = futex_thread2, }; -static int processes; - static struct option options[] = { { "test", required_argument, 0, 't' }, { "process", no_argument, &processes, 1 }, -- 2.11.0