Re: [PATCH 1/2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value

2020-03-11 Thread Balamuruhan S
On Wed, 2020-03-11 at 08:01 +0100, Christophe Leroy wrote: > > Le 11/03/2020 à 07:14, Balamuruhan S a écrit : > > ld instruction should have 14 bit immediate field (DS) concatenated > > with > > 0b00 on the right, encode it accordingly. > > > > Fixes: 4ceae137bdab ("powerpc: emulate_step() tests

Re: [PATCH -next 017/491] CELL BROADBAND ENGINE ARCHITECTURE: Use fallthrough;

2020-03-11 Thread Arnd Bergmann
On Wed, Mar 11, 2020 at 6:07 AM Joe Perches wrote: > > Convert the various uses of fallthrough comments to fallthrough; > > Done via script > Link: > https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe.com/ > > Signed-off-by: Joe Perches Acked-by: Arnd

[PATCH 2/2] powerpc test_emulate_step: add macro for 14 bit immediate field

2020-03-11 Thread Balamuruhan S
introduce macro `IMM_DS()` to encode DS form instructions with 14 bit immediate field. Signed-off-by: Balamuruhan S --- arch/powerpc/lib/test_emulate_step.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/lib/test_emulate_step.c

[PATCH 1/2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value

2020-03-11 Thread Balamuruhan S
ld instruction should have 14 bit immediate field (DS) concatenated with 0b00 on the right, encode it accordingly. Fixes: 4ceae137bdab ("powerpc: emulate_step() tests for load/store instructions") Reviewed-by: Sandipan Das Signed-off-by: Balamuruhan S --- arch/powerpc/lib/test_emulate_step.c

Re: [PATCH v6 6/7] powerpc/mm: implement set_memory_attr()

2020-03-11 Thread Daniel Axtens
Russell Currey writes: > From: Christophe Leroy > > In addition to the set_memory_xx() functions which allows to change > the memory attributes of not (yet) used memory regions, implement a > set_memory_attr() function to: > - set the final memory protection after init on currently used >

Re: [PATCH v6 1/7] powerpc/mm: Implement set_memory() routines

2020-03-11 Thread Daniel Axtens
Russell Currey writes: > The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, > and are generally useful primitives to have. This implementation is > designed to be completely generic across powerpc's many MMUs. > > It's possible that this could be optimised to be faster

Re: [PATCH] pseries/iommu: Tweak ddw behavior in presence of pmem

2020-03-11 Thread Alexey Kardashevskiy
On 11/03/2020 17:09, Aneesh Kumar K.V wrote: > Vaibhav Jain writes: > >> Recently we discovered an issue on pseries guests that prevents pci >> devices from accessing pmem memory via DMA. Performing such an >> operation will cause PHB to freeze the corresponding partition >> endpoint and in

Re: [PATCH] pseries/iommu: Tweak ddw behavior in presence of pmem

2020-03-11 Thread Aneesh Kumar K.V
Vaibhav Jain writes: > Recently we discovered an issue on pseries guests that prevents pci > devices from accessing pmem memory via DMA. Performing such an > operation will cause PHB to freeze the corresponding partition > endpoint and in some scenarios will shutdown the disk that hosts the >

Re: [PATCH 1/2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value

2020-03-11 Thread Christophe Leroy
Le 11/03/2020 à 07:14, Balamuruhan S a écrit : ld instruction should have 14 bit immediate field (DS) concatenated with 0b00 on the right, encode it accordingly. Fixes: 4ceae137bdab ("powerpc: emulate_step() tests for load/store instructions") Reviewed-by: Sandipan Das Signed-off-by:

[PATCH] hwmon: (ibmpowernv) Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Takashi Iwai
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai --- drivers/hwmon/ibmpowernv.c | 8 1 file changed, 4 insertions(+), 4

Re: [PATCH v3 23/27] powerpc/powernv/pmem: Add debug IOCTLs

2020-03-11 Thread Alastair D'Silva
On Thu, 2020-03-05 at 14:11 +1100, Andrew Donnellan wrote: > On 21/2/20 2:27 pm, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > These IOCTLs provide low level access to the card to aid in > > debugging > > controller/FPGA firmware. > > > > Signed-off-by: Alastair D'Silva > > --- >

Re: [RFC PATCH v1] pseries/drmem: don't cache node id in drmem_lmb struct

2020-03-11 Thread Michal Suchánek
On Wed, Mar 11, 2020 at 06:08:15PM -0500, Scott Cheloha wrote: > At memory hot-remove time we can retrieve an LMB's nid from its > corresponding memory_block. There is no need to store the nid > in multiple locations. > > Signed-off-by: Scott Cheloha > --- > The linear search in powerpc's

Re: [PATCH] powerpc/pseries: fix of_read_drc_info_cell() to point at next record

2020-03-11 Thread Michael Ellerman
Tyrel Datwyler writes: > On 3/10/20 10:25 AM, Nathan Lynch wrote: >> Tyrel Datwyler writes: >>> The expectation is that when calling of_read_drc_info_cell() >>> repeatedly to parse multiple drc-info records that the in/out curval >>> parameter points at the start of the next record on return.

Re: [PATCH v4 1/5] mm/memremap_pages: Introduce memremap_compat_align()

2020-03-11 Thread Michael Ellerman
Dan Williams writes: > The "sub-section memory hotplug" facility allows memremap_pages() users > like libnvdimm to compensate for hardware platforms like x86 that have a > section size larger than their hardware memory mapping granularity. The > compensation that sub-section support affords is

Re: [PATCH v3 23/27] powerpc/powernv/pmem: Add debug IOCTLs

2020-03-11 Thread Alastair D'Silva
On Wed, 2020-03-04 at 16:21 +0100, Frederic Barrat wrote: > > Le 21/02/2020 à 04:27, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > These IOCTLs provide low level access to the card to aid in > > debugging > > controller/FPGA firmware. > > > > Signed-off-by: Alastair D'Silva >

Re: [PATCH v3 19/27] powerpc/powernv/pmem: Add an IOCTL to report controller statistics

2020-03-11 Thread Alastair D'Silva
On Thu, 2020-03-05 at 11:46 +1100, Andrew Donnellan wrote: > On 21/2/20 2:27 pm, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > The controller can report a number of statistics that are useful > > in evaluating the performance and reliability of the card. > > > > This patch exposes

Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus

2020-03-11 Thread Srikar Dronamraju
* Michal Hocko [2020-03-11 12:57:35]: > On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote: > > A Powerpc system with multiple possible nodes and with CONFIG_NUMA > > enabled always used to have a node 0, even if node 0 does not any cpus > > or memory attached to it. As per PAPR, node affinity of

[PATCH v1 4/5] mm/memory_hotplug: convert memhp_auto_online to store an online_type

2020-03-11 Thread David Hildenbrand
... and rename it to memhp_default_online_type. This is a preparation for more detailed default online behavior. Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Cc: Benjamin Herrenschmidt Cc: Paul Mackerras

[PATCH] ocxl: control via sysfs whether the FPGA is reloaded on a link reset

2020-03-11 Thread Philippe Bergheaud
Some opencapi FPGA images allow to control if the FPGA should be reloaded on the next adapter reset. If it is supported, the image specifies it through a Vendor Specific DVSEC in the config space of function 0. This patch adds an interface to sysfs to control that behavior, if possible.

Re: [PATCH v1 3/5] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 01:30:24PM +0100, David Hildenbrand wrote: >Let's use a simple array which we can reuse soon. While at it, move the >string->mmop conversion out of the device hotplug lock. > >Cc: Greg Kroah-Hartman >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: "Rafael

[PATCH v3 5/6] Documentation: Document sysfs interfaces purr, spurr, idle_purr, idle_spurr

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" Add documentation for the following sysfs interfaces: /sys/devices/system/cpu/cpuX/purr /sys/devices/system/cpu/cpuX/spurr /sys/devices/system/cpu/cpuX/idle_purr /sys/devices/system/cpu/cpuX/idle_spurr Signed-off-by: Gautham R. Shenoy ---

[PATCH v2] powerpc test_emulate_step: fix DS operand in ld encoding to appropriate value

2020-03-11 Thread Balamuruhan S
ld instruction should have 14 bit immediate field (DS) concatenated with 0b00 on the right, encode it accordingly. Introduce macro `IMM_DS()` to encode DS form instructions with 14 bit immediate field. Fixes: 4ceae137bdab ("powerpc: emulate_step() tests for load/store instructions") Reviewed-by:

[PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus

2020-03-11 Thread Srikar Dronamraju
A Powerpc system with multiple possible nodes and with CONFIG_NUMA enabled always used to have a node 0, even if node 0 does not any cpus or memory attached to it. As per PAPR, node affinity of a cpu is only available once its present / online. For all cpus that are possible but not present,

Re: [PATCH] hwmon: (ibmpowernv) Use scnprintf() for avoiding potential buffer overflow

2020-03-11 Thread Guenter Roeck
On Wed, Mar 11, 2020 at 08:39:44AM +0100, Takashi Iwai wrote: > Since snprintf() returns the would-be-output size instead of the > actual output size, the succeeding calls may go beyond the given > buffer limit. Fix it by replacing with scnprintf(). > > Signed-off-by: Takashi Iwai Applied to

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
On 11.03.20 15:26, Wei Yang wrote: > On Wed, Mar 11, 2020 at 01:30:26PM +0100, David Hildenbrand wrote: >> For now, distributions implement advanced udev rules to essentially >> - Don't online any hotplugged memory (s390x) >> - Online all memory to ZONE_NORMAL (e.g., most virt environments like >>

[PATCH v1 0/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
Distributions nowadays use udev rules ([1] [2]) to specify if and how to online hotplugged memory. The rules seem to get more complex with many special cases. Due to the various special cases, CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE cannot be used. All memory hotplug is handled via udev rules.

Re: [PATCH v1 1/5] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 01:30:22PM +0100, David Hildenbrand wrote: >The name is misleading. Let's just name it like the online_type name we >expose to user space ("online"). > >Add some documentation to the types. > >Cc: Greg Kroah-Hartman >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Oscar

Re: [PATCH v1 3/5] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 02:20:02PM +, Wei Yang wrote: >On Wed, Mar 11, 2020 at 01:30:24PM +0100, David Hildenbrand wrote: >>Let's use a simple array which we can reuse soon. While at it, move the >>string->mmop conversion out of the device hotplug lock. >> >>Cc: Greg Kroah-Hartman >>Cc:

[PATCH v1 2/5] drivers/base/memory: map MMOP_OFFLINE to 0

2020-03-11 Thread David Hildenbrand
I have no idea why we have to start at -1. Just treat 0 as the special case. Clarify a comment (which was wrong, when we come via device_online() the first time, the online_type would have been 0 / MEM_ONLINE). The default is now always MMOP_OFFLINE. This is a preparation to use the online_type

[PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
For now, distributions implement advanced udev rules to essentially - Don't online any hotplugged memory (s390x) - Online all memory to ZONE_NORMAL (e.g., most virt environments like hyperv) - Online all memory to ZONE_MOVABLE in case the zone imbalance is taken care of (e.g., bare metal,

Re: [PATCH v1 4/5] mm/memory_hotplug: convert memhp_auto_online to store an online_type

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 01:30:25PM +0100, David Hildenbrand wrote: >... and rename it to memhp_default_online_type. This is a preparation >for more detailed default online behavior. > >Cc: Greg Kroah-Hartman >Cc: Andrew Morton >Cc: Michal Hocko >Cc: Oscar Salvador >Cc: "Rafael J. Wysocki"

Re: [PATCH v1 2/5] drivers/base/memory: map MMOP_OFFLINE to 0

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 01:30:23PM +0100, David Hildenbrand wrote: >I have no idea why we have to start at -1. Just treat 0 as the special >case. Clarify a comment (which was wrong, when we come via >device_online() the first time, the online_type would have been 0 / >MEM_ONLINE). The default is

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread Wei Yang
On Wed, Mar 11, 2020 at 01:30:26PM +0100, David Hildenbrand wrote: >For now, distributions implement advanced udev rules to essentially >- Don't online any hotplugged memory (s390x) >- Online all memory to ZONE_NORMAL (e.g., most virt environments like > hyperv) >- Online all memory to

[PATCH V16] mm/debug: Add tests validating architecture page table helpers

2020-03-11 Thread Anshuman Khandual
This adds tests which will validate architecture page table helpers and other accessors in their compliance with expected generic MM semantics. This will help various architectures in validating changes to existing page table helpers or addition of new ones. This test covers basic page table

[PATCH v1 3/5] drivers/base/memory: store mapping between MMOP_* and string in an array

2020-03-11 Thread David Hildenbrand
Let's use a simple array which we can reuse soon. While at it, move the string->mmop conversion out of the device hotplug lock. Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand

[PATCH v3 2/6] powerpc/idle: Add accessor function to always read latest idle PURR

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" Currently when CPU goes idle, we take a snapshot of PURR via pseries_idle_prolog() which is used at the CPU idle exit to compute the idle PURR cycles via the function pseries_idle_epilog(). Thus, the value of idle PURR cycle thus read before pseries_idle_prolog() and

[PATCH v3 6/6] pseries/sysfs: Minimise IPI noise while reading [idle_][s]purr

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" Currently purr, spurr, idle_purr, idle_spurr are exposed for every CPU via the sysfs interface /sys/devices/system/cpu/cpuX/[idle_][s]purr. Each sysfs read currently generates an IPI to obtain the desired value from the target CPU X. Since these aforementioned sysfs

[PATCH v3 0/6] Track and expose idle PURR and SPURR ticks

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" Hi, This is the third version of the patches to track and expose idle PURR and SPURR ticks. These patches are required by tools such as lparstat to compute system utilization for capacity planning purposes. The previous versions can be found here: v2:

[PATCH 0/3] Offline memoryless cpuless node 0

2020-03-11 Thread Srikar Dronamraju
Linux kernel configured with CONFIG_NUMA on a system with multiple possible nodes, marks node 0 as online at boot. However in practice, there are systems which have node 0 as memoryless and cpuless. This can cause 1. numa_balancing to be enabled on systems with only one online node. 2. Existence

[PATCH 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline

2020-03-11 Thread Srikar Dronamraju
Currently Linux kernel with CONFIG_NUMA on a system with multiple possible nodes, marks node 0 as online at boot. However in practice, there are systems which have node 0 as memoryless and cpuless. This can cause numa_balancing to be enabled on systems with only one node with memory and CPUs.

[PATCH v3 3/6] powerpc/pseries: Account for SPURR ticks on idle CPUs

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" On Pseries LPARs, to calculate utilization, we need to know the [S]PURR ticks when the CPUs were busy or idle. Via pseries_idle_prolog(), pseries_idle_epilog(), we track the idle PURR ticks in the VPA variable "wait_state_cycles". This patch extends the support to

[PATCH 2/3] powerpc/numa: Prefer node id queried from vphn

2020-03-11 Thread Srikar Dronamraju
Node id queried from the static device tree may not be correct. For example: it may always show 0 on a shared processor. Hence prefer the node id queried from vphn and fallback on the device tree based node id if vphn query fails. Cc: linuxppc-dev@lists.ozlabs.org Cc: linux...@kvack.org Cc:

Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus

2020-03-11 Thread Michal Hocko
On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote: > A Powerpc system with multiple possible nodes and with CONFIG_NUMA > enabled always used to have a node 0, even if node 0 does not any cpus > or memory attached to it. As per PAPR, node affinity of a cpu is only > available once its present /

[PATCH v3 4/6] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" On Pseries LPARs, to calculate utilization, we need to know the [S]PURR ticks when the CPUs were busy or idle. The total PURR and SPURR ticks are already exposed via the per-cpu sysfs files "purr" and "spurr". This patch adds support for exposing the idle PURR and

[PATCH v1 1/5] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE

2020-03-11 Thread David Hildenbrand
The name is misleading. Let's just name it like the online_type name we expose to user space ("online"). Add some documentation to the types. Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by:

[PATCH v3 1/6] powerpc: Move idle_loop_prolog()/epilog() functions to header file

2020-03-11 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" Currently prior to entering an idle state on a Linux Guest, the pseries cpuidle driver implement an idle_loop_prolog() and idle_loop_epilog() functions which ensure that idle_purr is correctly computed, and the hypervisor is informed that the CPU cycles have been

Re: [PATCH v3] ima: add a new CONFIG for loading arch-specific policies

2020-03-11 Thread Mimi Zohar
On Sun, 2020-03-08 at 20:57 -0400, Nayna Jain wrote: > From: Nayna Jain > > Every time a new architecture defines the IMA architecture specific > functions - arch_ima_get_secureboot() and arch_ima_get_policy(), the IMA > include file needs to be updated. To avoid this "noise", this patch >

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread David Hildenbrand
On 11.03.20 17:55, Vitaly Kuznetsov wrote: > David Hildenbrand writes: > >> For now, distributions implement advanced udev rules to essentially >> - Don't online any hotplugged memory (s390x) >> - Online all memory to ZONE_NORMAL (e.g., most virt environments like >> hyperv) >> - Online all

Re: [RFC 00/11] perf: Enhancing perf to export processor hazard information

2020-03-11 Thread Ravi Bangoria
Hi Kim, On 3/6/20 3:36 AM, Kim Phillips wrote: On 3/3/20 3:55 AM, Kim Phillips wrote: On 3/2/20 2:21 PM, Stephane Eranian wrote: On Mon, Mar 2, 2020 at 2:13 AM Peter Zijlstra wrote: On Mon, Mar 02, 2020 at 10:53:44AM +0530, Ravi Bangoria wrote: Modern processors export such hazard data in

Re: [PATCH v1 5/5] mm/memory_hotplug: allow to specify a default online_type

2020-03-11 Thread Vitaly Kuznetsov
David Hildenbrand writes: > For now, distributions implement advanced udev rules to essentially > - Don't online any hotplugged memory (s390x) > - Online all memory to ZONE_NORMAL (e.g., most virt environments like > hyperv) > - Online all memory to ZONE_MOVABLE in case the zone imbalance is

Re: [PATCH v3] ima: add a new CONFIG for loading arch-specific policies

2020-03-11 Thread Philipp Rudo
On Sun, 8 Mar 2020 20:57:51 -0400 Nayna Jain wrote: > From: Nayna Jain > > Every time a new architecture defines the IMA architecture specific > functions - arch_ima_get_secureboot() and arch_ima_get_policy(), the IMA > include file needs to be updated. To avoid this "noise", this patch >

Re: [PATCH v3 19/27] powerpc/powernv/pmem: Add an IOCTL to report controller statistics

2020-03-11 Thread Alastair D'Silva
On Wed, 2020-03-04 at 10:25 +0100, Frederic Barrat wrote: > > Le 21/02/2020 à 04:27, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > The controller can report a number of statistics that are useful > > in evaluating the performance and reliability of the card. > > > > This patch

[RFC PATCH v1] pseries/drmem: don't cache node id in drmem_lmb struct

2020-03-11 Thread Scott Cheloha
At memory hot-remove time we can retrieve an LMB's nid from its corresponding memory_block. There is no need to store the nid in multiple locations. Signed-off-by: Scott Cheloha --- The linear search in powerpc's memory_add_physaddr_to_nid() has become a bottleneck at boot on systems with many