Re: [PATCH] powerpc/perf: Fix cycles/instructions as PM_CYC/PM_INST_CMPL in power10

2021-07-12 Thread Athira Rajeev
> On 08-Jul-2021, at 6:26 PM, Nicholas Piggin wrote: > > Excerpts from Athira Rajeev's message of July 7, 2021 4:39 pm: >> From: Athira Rajeev >> >> Power10 performance monitoring unit (PMU) driver uses performance >> monitor counter 5 (PMC5) and performance monitor counter 6 (PMC6) >> for

Re: [PATCH v2 1/1] powerpc/pseries: Interface to represent PAPR firmware attributes

2021-07-12 Thread Pratik Sampat
On 08/07/21 4:05 pm, Gautham R Shenoy wrote: Hello Pratik, On Tue, Jul 06, 2021 at 01:54:00PM +0530, Pratik R. Sampat wrote: Adds a generic interface to represent the energy and frequency related PAPR attributes on the system using the new H_CALL "H_GET_ENERGY_SCALE_INFO". H_GET_EM_PARMS

[PATCH v3 0/1] Interface to represent PAPR firmware attributes

2021-07-12 Thread Pratik R. Sampat
RFC: https://lkml.org/lkml/2021/6/4/791 PATCH v1: https://lkml.org/lkml/2021/6/16/805 PATCH v2: https://lkml.org/lkml/2021/7/6/138 Changelog v2 --> v3 Based on a comment from Guatham: 1. Added a versioning check after the H_CALL is made to bail out when the version from the firmware is

Re: [PATCH] ASoC: fsl_xcvr: Omit superfluous error message in fsl_xcvr_probe()

2021-07-12 Thread Mark Brown
On Thu, 24 Jun 2021 18:45:05 +0800, Tang Bin wrote: > In the function fsl_xcvr__probe(), when get irq failed, > the function platform_get_irq() logs an error message, so remove > redundant message here. Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

[PATCH v3 1/1] powerpc/pseries: Interface to represent PAPR firmware attributes

2021-07-12 Thread Pratik R. Sampat
Adds a generic interface to represent the energy and frequency related PAPR attributes on the system using the new H_CALL "H_GET_ENERGY_SCALE_INFO". H_GET_EM_PARMS H_CALL was previously responsible for exporting this information in the lparcfg, however the H_GET_EM_PARMS H_CALL will be deprecated

[PATCH] powerpc/papr_scm: Implement initial support for injecting smart errors

2021-07-12 Thread Vaibhav Jain
Presently PAPR doesn't support injecting smart errors on an NVDIMM. This makes testing the NVDIMM health reporting functionality difficult as simulating NVDIMM health related events need a hacked up qemu version. To solve this problem this patch proposes simulating certain set of NVDIMM health

Re: [PATCH] memblock: make for_each_mem_range() traverse MEMBLOCK_HOTPLUG regions

2021-07-12 Thread Greg Kurz
On Mon, 12 Jul 2021 10:11:32 +0300 Mike Rapoport wrote: > From: Mike Rapoport > > Commit b10d6bca8720 ("arch, drivers: replace for_each_membock() with > for_each_mem_range()") didn't take into account that when there is > movable_node parameter in the kernel command line, for_each_mem_range()

Re: [PATCH V3 1/1] powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC

2021-07-12 Thread Athira Rajeev
> On 12-Jul-2021, at 8:07 AM, Nicholas Piggin wrote: > > Excerpts from Athira Rajeev's message of July 11, 2021 1:58 am: >> Running perf fuzzer showed below in dmesg logs: >> "Can't find PMC that caused IRQ" >> >> This means a PMU exception happened, but none of the PMC's (Performance >>

Re: [PATCH] powerpc/perf: Fix cycles/instructions as PM_CYC/PM_INST_CMPL in power10

2021-07-12 Thread Athira Rajeev
> On 08-Jul-2021, at 9:13 PM, Paul A. Clarke wrote: > > On Thu, Jul 08, 2021 at 10:56:57PM +1000, Nicholas Piggin wrote: >> Excerpts from Athira Rajeev's message of July 7, 2021 4:39 pm: >>> From: Athira Rajeev >>> >>> Power10 performance monitoring unit (PMU) driver uses performance >>>

Re: [RFC PATCH 10/43] powerpc/64s: Always set PMU control registers to frozen/disabled when not in use

2021-07-12 Thread Athira Rajeev
On 12-Jul-2021, at 8:11 AM, Nicholas Piggin wrote:Excerpts from Athira Rajeev's message of July 10, 2021 12:50 pm:On 22-Jun-2021, at 4:27 PM, Nicholas Piggin wrote:KVM PMU management code looks for particular frozen/disabled bits inthe PMU registers so it knows whether it must clear them when

[PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory()

2021-07-12 Thread David Hildenbrand
The parameter is unused, let's remove it. Acked-by: Catalin Marinas Acked-by: Michael Ellerman (powerpc) Acked-by: Heiko Carstens (s390) Cc: Catalin Marinas Cc: Will Deacon Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Heiko Carstens Cc: Vasily Gorbik Cc:

Re: [PATCH v15 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-07-12 Thread Will Deacon
On Tue, Jul 06, 2021 at 12:59:57PM -0400, Konrad Rzeszutek Wilk wrote: > On Tue, Jul 06, 2021 at 05:57:21PM +0100, Will Deacon wrote: > > On Tue, Jul 06, 2021 at 10:46:07AM -0400, Konrad Rzeszutek Wilk wrote: > > > On Tue, Jul 06, 2021 at 04:05:13PM +0200, Christoph Hellwig wrote: > > > > On Tue,

[PATCH v1 3/4] mm/memory_hotplug: remove nid parameter from remove_memory() and friends

2021-07-12 Thread David Hildenbrand
There is only a single user remaining. We can simply lookup the nid only used for node offlining purposes when walking our memory blocks. We don't expect to remove multi-nid ranges; and if we'd ever do, we most probably don't care about removing multi-nid ranges that actually result in empty

Re: [PATCH v2 1/2] sched/topology: Skip updating masks for non-online nodes

2021-07-12 Thread Srikar Dronamraju
Hi Valentin, > On 01/07/21 09:45, Srikar Dronamraju wrote: > > @@ -1891,12 +1894,30 @@ void sched_init_numa(void) > > void sched_domains_numa_masks_set(unsigned int cpu) > > { > > Hmph, so we're playing games with masks of offline nodes - is that really > necessary? Your modification of

Re: [PATCH] powerpc/64s/hash: Fix SLB preload cache vs kthread_use_mm

2021-07-12 Thread Nicholas Piggin
Excerpts from Nicholas Piggin's message of July 8, 2021 7:05 pm: > It's possible for kernel threads to pick up SLB preload entries if > they are accessing userspace with kthread_use_mm. If the kthread > later is context switched while using a different mm, when it is > switched back it could

Re: [RFC PATCH 11/43] KVM: PPC: Book3S HV P9: Implement PMU save/restore in C

2021-07-12 Thread Athira Rajeev
> On 12-Jul-2021, at 8:19 AM, Nicholas Piggin wrote: > > Excerpts from Athira Rajeev's message of July 10, 2021 12:47 pm: >> >> >>> On 22-Jun-2021, at 4:27 PM, Nicholas Piggin wrote: >>> >>> Implement the P9 path PMU save/restore code in C, and remove the >>> POWER9/10 code from the P7/8

Re: [PATCH v3 1/1] powerpc/pseries: Interface to represent PAPR firmware attributes

2021-07-12 Thread Fabiano Rosas
"Pratik R. Sampat" writes: Hi, have you seen Documentation/core-api/kobject.rst, particularly the part that says: "When you see a sysfs directory full of other directories, generally each of those directories corresponds to a kobject in the same kset." Taking a look at

[PATCH] replace if with min

2021-07-12 Thread Salah Triki
Replace if with min in order to make code more clean. Signed-off-by: Salah Triki --- drivers/crypto/nx/nx-842.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/nx/nx-842.c b/drivers/crypto/nx/nx-842.c index 2ab90ec10e61..0d1d5a463899 100644 ---

[RFC PATCH] KVM: PPC: BookE: Load FP and Altivec state before soft enabling IRQs

2021-07-12 Thread Fabiano Rosas
The kvmppc_fix_ee_before_entry function sets the IRQ soft mask to IRQS_ENABLED. This function is called right before loading the guest FP and Altivec states at kvmppc_handle_exit. This triggers a WARN_ON(preemptible()) at enable_kernel_fp/altivec when running with CONFIG_PREEMPT_COUNT=y: WARNING:

[PATCH 1/2] PCI: Use pcie_reset_state_t type in function arguments

2021-07-12 Thread Krzysztof Wilczyński
The pcie_reset_state_t type has been introduced in the commit f7bdd12d234d ("pci: New PCI-E reset API") along with the enum pcie_reset_state, but it has never been used for anything else other than to define the members of the enumeration set in the enum pcie_reset_state. Thus, replace the direct

[PATCH 2/2] powerpc/eeh: Use pcie_reset_state_t type in function arguments

2021-07-12 Thread Krzysztof Wilczyński
The pcie_reset_state_t type has been introduced in the commit f7bdd12d234d ("pci: New PCI-E reset API") along with the enum pcie_reset_state, but it has never been used for anything else other than to define the members of the enumeration set in the enum pcie_reset_state. Thus, replace the direct

Re: [PATCH v3] lockdown,selinux: fix wrong subject in some SELinux lockdown checks

2021-07-12 Thread Paul Moore
On Sat, Jun 19, 2021 at 1:00 PM Thomas Gleixner wrote: > On Wed, Jun 16 2021 at 10:51, Ondrej Mosnacek wrote: > > diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c > > index bda73cb7a044..c43a13241ae8 100644 > > --- a/arch/x86/mm/testmmiotrace.c > > +++

Re: [PATCH v4 10/11] powerpc/pseries/iommu: Make use of DDW for indirect mapping

2021-07-12 Thread Leonardo Brás
On Tue, 2021-05-11 at 17:57 +1000, Alexey Kardashevskiy wrote: > > > On 01/05/2021 02:31, Leonardo Bras wrote: > > [...] > >   pmem_present = dn != NULL; > > @@ -1218,8 +1224,12 @@ static bool enable_ddw(struct pci_dev *dev, > > struct device_node *pdn) > >   > >

Re: [PATCH v4 07/11] powerpc/pseries/iommu: Reorganize iommu_table_setparms*() with new helper

2021-07-12 Thread Leonardo Brás
Hello Alexey, On Fri, 2021-06-18 at 19:26 -0300, Leonardo Brás wrote: > > > > > +    unsigned long liobn, > > > unsigned long win_addr, > > > +    unsigned long > > > window_size, > > > unsigned long page_shift, > > > + 

[RFC 0/2] Paravirtualize idle CPU wakeup optimization

2021-07-12 Thread Parth Shah
This patch-set is a revision over HCALL based implementation which can be found at: https://lore.kernel.org/linuxppc-dev/20210401115922.1524705-1-pa...@linux.ibm.com/ But since the overhead of HCALL is huge, this patch-set uses lppaca region to update idle-hint, where hypervisor keeps changing the

[PATCH v5 6/8] powerpc: Rework and improve STRICT_KERNEL_RWX patching

2021-07-12 Thread Christopher M. Riedl
Rework code-patching with STRICT_KERNEL_RWX to prepare for the next patch which uses a temporary mm for patching under the Book3s64 Radix MMU. Make improvements by adding a WARN_ON when the patchsite doesn't match after patching and return the error from __patch_instruction() properly.

[PATCH v5 5/8] powerpc/64s: Introduce temporary mm for Radix MMU

2021-07-12 Thread Christopher M. Riedl
x86 supports the notion of a temporary mm which restricts access to temporary PTEs to a single CPU. A temporary mm is useful for situations where a CPU needs to perform sensitive operations (such as patching a STRICT_KERNEL_RWX kernel) requiring temporary mappings without exposing said mappings to

[PATCH v5 8/8] lkdtm/powerpc: Fix code patching hijack test

2021-07-12 Thread Christopher M. Riedl
Code patching on powerpc with a STRICT_KERNEL_RWX uses a userspace address in a temporary mm on Radix now. Use __put_user() to avoid write failures due to KUAP when attempting a "hijack" on the patching address. __put_user() also works with the non-userspace, vmalloc-based patching address on

[PATCH v5 1/8] powerpc: Add LKDTM accessor for patching addr

2021-07-12 Thread Christopher M. Riedl
When live patching with STRICT_KERNEL_RWX a mapping is installed at a "patching address" with temporary write permissions. Provide a LKDTM-only accessor function for this address in preparation for a LKDTM test which attempts to "hijack" this mapping by writing to it from another CPU.

[PATCH v5 7/8] powerpc/64s: Initialize and use a temporary mm for patching on Radix

2021-07-12 Thread Christopher M. Riedl
When code patching a STRICT_KERNEL_RWX kernel the page containing the address to be patched is temporarily mapped as writeable. Currently, a per-cpu vmalloc patch area is used for this purpose. While the patch area is per-cpu, the temporary page mapping is inserted into the kernel page tables for

[PATCH v5 0/8] Use per-CPU temporary mappings for patching on Radix MMU

2021-07-12 Thread Christopher M. Riedl
When compiled with CONFIG_STRICT_KERNEL_RWX, the kernel must create temporary mappings when patching itself. These mappings temporarily override the strict RWX text protections to permit a write. Currently, powerpc allocates a per-CPU VM area for patching. Patching occurs as follows: 1.

[PATCH v5 2/8] lkdtm/powerpc: Add test to hijack a patch mapping

2021-07-12 Thread Christopher M. Riedl
When live patching with STRICT_KERNEL_RWX the CPU doing the patching must temporarily remap the page(s) containing the patch site with +W permissions. While this temporary mapping is in use, another CPU could write to the same mapping and maliciously alter kernel text. Implement a LKDTM test to

[PATCH v5 4/8] lkdtm/x86_64: Add test to hijack a patch mapping

2021-07-12 Thread Christopher M. Riedl
A previous commit implemented an LKDTM test on powerpc to exploit the temporary mapping established when patching code with STRICT_KERNEL_RWX enabled. Extend the test to work on x86_64 as well. Signed-off-by: Christopher M. Riedl --- drivers/misc/lkdtm/perms.c | 26 ++ 1

[PATCH v5 3/8] x86_64: Add LKDTM accessor for patching addr

2021-07-12 Thread Christopher M. Riedl
When live patching with STRICT_KERNEL_RWX a mapping is installed at a "patching address" with temporary write permissions. Provide a LKDTM-only accessor function for this address in preparation for a LKDTM test which attempts to "hijack" this mapping by writing to it from another CPU.

[RFC 1/2] powerpc/book3s_hv: Add new idle-hint attribute in VPA region

2021-07-12 Thread Parth Shah
In lppaca region, add a new attribute idle_hint which can allow guest scheduler for better cpu selection. Hypervisor can update idle_hint attribute based on the prediction that if vCPU needs to be scheduled then can it be scheduled instantly or not. Signed-off-by: Parth Shah ---

[RFC 2/2] kernel/idle: Update and use idle-hint in VPA region

2021-07-12 Thread Parth Shah
In guest, Set idle_hint to 1 when the prev_cpu of a vCPU goes into idle state, similarly set idle_hint to 0 when exiting an idle state. Since the idle_hint is in VPA region, the available_idle_cpu() in guest can read this region every time to find if a vCPU can be scheduled instantly by the