[PATCH v6 01/10] capabilities: introduce CAP_PERFMON to kernel and user space

2020-02-05 Thread Alexey Budankov
Introduce CAP_PERFMON capability designed to secure system performance monitoring and observability operations so that CAP_PERFMON would assist CAP_SYS_ADMIN capability in its governing role for performance monitoring and observability subsystems. CAP_PERFMON hardens system security and

[PATCH v6 03/10] perf/core: open access to probes for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to monitoring via kprobes and uprobes and eBPF tracing for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. perf

[PATCH v6 09/10] drivers/perf: open access for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to monitoring for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. CAP_PERFMON implements the principal of least

[PATCH v6 10/10] drivers/oprofile: open access for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to monitoring for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. CAP_PERFMON implements the principal of least

[PATCH v6 04/10] perf tool: extend Perf tool with CAP_PERFMON capability support

2020-02-05 Thread Alexey Budankov
Extend error messages to mention CAP_PERFMON capability as an option to substitute CAP_SYS_ADMIN capability for secure system performance monitoring and observability operations. Make perf_event_paranoid_check() and __cmd_ftrace() to be aware of CAP_PERFMON capability. CAP_PERFMON implements

Re: Latest Git kernel: avahi-daemon[2410]: ioctl(): Inappropriate ioctl for device

2020-02-05 Thread Christian Zigotzky
Kernel 5.5 PowerPC is also affected. — Christian Christian Zigotzky wrote: Hi All, The issue with the avahi-daemon still exist in the latest Git kernel. It's a PowerPC issue. I compiled the latest Git kernel on a PC today and there aren't any issues with the avahi daemon. Another Power Mac

[PATCH v6 06/10] trace/bpf_trace: open access for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to bpf_trace monitoring for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. CAP_PERFMON implements the principal of

Re: [yyu168-linux_cet:cet 55/58] powerpc64le-linux-ld: warning: discarding dynamic section .rela___ksymtab+jiffies_to_timeval

2020-02-05 Thread H.J. Lu
On Tue, Feb 4, 2020 at 3:37 PM kbuild test robot wrote: > > tree: https://github.com/yyu168/linux_cet.git cet > head: bba707cc4715c1036b6561ab38b16747f9c49cfa > commit: 71bb971dd76eeacd351690f28864ad5c5bec3691 [55/58] Discard > .note.gnu.property sections in generic NOTES > config:

[PATCH v6 05/10] drm/i915/perf: open access for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to i915_perf monitoring for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. CAP_PERFMON implements the principal of

[PATCH v6 07/10] powerpc/perf: open access for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to monitoring for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. CAP_PERFMON implements the principal of least

[PATCH v6 08/10] parisc/perf: open access for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to monitoring for CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more secure. CAP_PERFMON implements the principal of least

[PATCH v6 02/10] perf/core: open access to the core for CAP_PERFMON privileged process

2020-02-05 Thread Alexey Budankov
Open access to monitoring of kernel code, cpus, tracepoints and namespaces data for a CAP_PERFMON privileged process. Providing the access under CAP_PERFMON capability singly, without the rest of CAP_SYS_ADMIN credentials, excludes chances to misuse the credentials and makes operation more

[PATCH] ASoC: fsl_sai: Fix exiting path on probing failure

2020-02-05 Thread Oleksandr Suvorov
If the imx-sdma driver is built as a module, the fsl-sai device doesn't disable on probing failure, which causes the warning in the next probing: == fsl-sai 308a.sai: Unbalanced pm_runtime_enable! fsl-sai 308a.sai: Unbalanced

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Thu, Feb 06, 2020 at 07:30:51AM +0800, Baoquan He wrote: >On 02/06/20 at 07:26am, Wei Yang wrote: >> On Thu, Feb 06, 2020 at 07:08:26AM +0800, Baoquan He wrote: >> >On 02/06/20 at 06:56am, Wei Yang wrote: >> >> On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: >> >> >Hi Wei Yang, >>

[PATCH v6 04/11] powerpc/mce_power: Use functions to track lockless pgtbl walks

2020-02-05 Thread Leonardo Bras
Applies the new functions used for tracking lockless pgtable walks on addr_to_pfn(). local_irq_{save,restore} is already inside {begin,end}_lockless_pgtbl_walk, so there is no need to repeat it here. Signed-off-by: Leonardo Bras --- arch/powerpc/kernel/mce_power.c | 6 +++--- 1 file changed, 3

Re: [PATCH v6 02/11] mm/gup: Use functions to track lockless pgtbl walks on gup_pgd_range

2020-02-05 Thread Leonardo Bras
On Thu, 2020-02-06 at 00:08 -0300, Leonardo Bras wrote: > gup_pgd_range(addr, end, gup_flags, pages, ); > - local_irq_enable(); > + end_lockless_pgtbl_walk(IRQS_ENABLED); > ret = nr; > } > Just noticed IRQS_ENABLED is not

Re: [PATCH 1/1] vfio-pci/nvlink2: Allow fallback to ibm,mmio-atsd[0]

2020-02-05 Thread Alexey Kardashevskiy
On 06/02/2020 14:17, Sam Bobroff wrote: > Older versions of skiboot only provide a single value in the device > tree property "ibm,mmio-atsd", even when multiple Address Translation > Shoot Down (ATSD) registers are present. This prevents NVLink2 devices > (other than the first) from being

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
On 02/06/20 at 07:26am, Wei Yang wrote: > On Thu, Feb 06, 2020 at 07:08:26AM +0800, Baoquan He wrote: > >On 02/06/20 at 06:56am, Wei Yang wrote: > >> On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: > >> >Hi Wei Yang, > >> > > >> >On 02/05/20 at 05:59pm, Wei Yang wrote: > >> >> >diff

[PATCH v3 6/6] powerpc/fsl_booke/kaslr: rename kaslr-booke32.rst to kaslr-booke.rst and add 64bit part

2020-02-05 Thread Jason Yan
Now we support both 32 and 64 bit KASLR for fsl booke. Add document for 64 bit part and rename kaslr-booke32.rst to kaslr-booke.rst. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael Ellerman Cc: Christophe Leroy Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc:

[PATCH 1/1] vfio-pci/nvlink2: Allow fallback to ibm,mmio-atsd[0]

2020-02-05 Thread Sam Bobroff
Older versions of skiboot only provide a single value in the device tree property "ibm,mmio-atsd", even when multiple Address Translation Shoot Down (ATSD) registers are present. This prevents NVLink2 devices (other than the first) from being used with vfio-pci because vfio-pci expects to be able

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

2020-02-05 Thread kbuild test robot
Hi Anshuman, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on s390/features linus/master arc/for-next v5.5] [cannot apply to mmotm/master tip/x86/core arm64/for-next/core next-20200205] [if your patch is applied to the wrong git

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Thu, Feb 06, 2020 at 07:08:26AM +0800, Baoquan He wrote: >On 02/06/20 at 06:56am, Wei Yang wrote: >> On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: >> >Hi Wei Yang, >> > >> >On 02/05/20 at 05:59pm, Wei Yang wrote: >> >> >diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> >>

[PATCH v6 02/11] mm/gup: Use functions to track lockless pgtbl walks on gup_pgd_range

2020-02-05 Thread Leonardo Bras
As described, gup_pgd_range is a lockless pagetable walk. So, in order to track against THP split/collapse, it disables/enables irq around it. To make use of the new tracking functions, it replaces irq disable/enable by {begin,end}_lockless_pgtbl_walk(). As local_irq_{save,restore} is present

[PATCH v6 03/11] powerpc/mm: Adds arch-specificic functions to track lockless pgtable walks

2020-02-05 Thread Leonardo Bras
On powerpc, we need to do some lockless pagetable walks from functions that already have disabled interrupts, specially from real mode with MSR[EE=0]. In these contexts, disabling/enabling interrupts can be very troubling. So, this arch-specific implementation features functions with an extra

[PATCH v6 01/11] asm-generic/pgtable: Adds generic functions to track lockless pgtable walks

2020-02-05 Thread Leonardo Bras
It's necessary to track lockless pagetable walks, in order to avoid doing THP splitting/collapsing during them. The default solution is to disable irq before lockless pagetable walks and enable it after it's finished. On code, this means you can find local_irq_disable() and local_irq_enable()

Re: [PATCH 2/6] powerpc/eeh: Remove eeh_add_device_tree_late()

2020-02-05 Thread Sam Bobroff
On Mon, Feb 03, 2020 at 07:35:17PM +1100, Oliver O'Halloran wrote: > On pseries and PowerNV pcibios_bus_add_device() calls eeh_add_device_late() > so there's no need to do a separate tree traversal to bind the eeh_dev and > pci_dev together setting up the PHB at boot. As a result we can remove >

Re: Latest Git kernel: avahi-daemon[2410]: ioctl(): Inappropriate ioctl for device

2020-02-05 Thread Michael Ellerman
Christian Zigotzky writes: > Kernel 5.5 PowerPC is also affected. I don't know what you mean by that. What sha are you talking about? I have a system with avahi running and everything's fine. # grep use- /etc/avahi/avahi-daemon.conf use-ipv4=yes use-ipv6=yes # systemctl status -l

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
On 02/06/20 at 06:56am, Wei Yang wrote: > On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: > >Hi Wei Yang, > > > >On 02/05/20 at 05:59pm, Wei Yang wrote: > >> >diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > >> >index f294918f7211..8dafa1ba8d9f 100644 > >> >---

[PATCH v3 2/6] powerpc/fsl_booke/64: introduce reloc_kernel_entry() helper

2020-02-05 Thread Jason Yan
Like the 32bit code, we introduce reloc_kernel_entry() helper to prepare for the KASLR 64bit version. And move the C declaration of this function out of CONFIG_PPC32 and use long instead of int for the parameter 'addr'. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael

[PATCH v6 10/11] powerpc/mm: Adds counting method to track lockless pagetable walks

2020-02-05 Thread Leonardo Bras
Implements an additional feature to track lockless pagetable walks, using a per-cpu counter: lockless_pgtbl_walk_counter. Before a lockless pagetable walk, preemption is disabled and the current cpu's counter is increased. When the lockless pagetable walk finishes, the current cpu counter is

[PATCH v6 11/11] powerpc/mm/book3s64/pgtable: Uses counting method to skip serializing

2020-02-05 Thread Leonardo Bras
For each cpu in cpumask, checks if it's running a lockless pagetable walk. Then, run serialize_against_pte_lookup() only on these cpus. serialize_agains_pte_lookup() can take a long while when there are a lot of cpus in cpumask. This method is intended to reduce this waiting, while not impacting

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Wed, Feb 05, 2020 at 10:48:11PM +0800, Baoquan He wrote: >Hi Wei Yang, > >On 02/05/20 at 05:59pm, Wei Yang wrote: >> >diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> >index f294918f7211..8dafa1ba8d9f 100644 >> >--- a/mm/memory_hotplug.c >> >+++ b/mm/memory_hotplug.c >> >@@ -393,6

[PATCH v3 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized

2020-02-05 Thread Jason Yan
The original kernel still exists in the memory, clear it now. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael Ellerman Cc: Christophe Leroy Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Nicholas Piggin Cc: Kees Cook --- arch/powerpc/mm/nohash/kaslr_booke.c | 4

[PATCH v6 07/11] powerpc/kvm/e500: Use functions to track lockless pgtbl walks

2020-02-05 Thread Leonardo Bras
Applies the new functions used for tracking lockless pgtable walks on kvmppc_e500_shadow_map(). Fixes the place where local_irq_restore() is called: previously, if ptep was NULL, local_irq_restore() would never be called. local_irq_{save,restore} is already inside

Re: [yyu168-linux_cet:cet 55/58] powerpc64le-linux-ld: warning: discarding dynamic section .rela___ksymtab+jiffies_to_timeval

2020-02-05 Thread Michael Ellerman
"H.J. Lu" writes: > On Tue, Feb 4, 2020 at 3:37 PM kbuild test robot wrote: >> >> tree: https://github.com/yyu168/linux_cet.git cet >> head: bba707cc4715c1036b6561ab38b16747f9c49cfa >> commit: 71bb971dd76eeacd351690f28864ad5c5bec3691 [55/58] Discard >> .note.gnu.property sections in generic

[PATCH v3 0/6] implement KASLR for powerpc/fsl_booke/64

2020-02-05 Thread Jason Yan
This is a try to implement KASLR for Freescale BookE64 which is based on my earlier implementation for Freescale BookE32: https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=131718 The implementation for Freescale BookE64 is similar as BookE32. One difference is that Freescale BookE64

[PATCH v3 4/6] powerpc/fsl_booke/64: do not clear the BSS for the second pass

2020-02-05 Thread Jason Yan
The BSS section has already cleared out in the first pass. No need to clear it again. This can save some time when booting with KASLR enabled. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael Ellerman Cc: Christophe Leroy Cc: Benjamin Herrenschmidt Cc: Paul Mackerras

[PATCH v6 09/11] powerpc/kvm/book3s_64: Use functions to track lockless pgtbl walks

2020-02-05 Thread Leonardo Bras
Applies the new tracking functions to all book3s_64 related functions that do lockless pagetable walks. Adds comments explaining that some lockless pagetable walks don't need protection due to guest pgd not being a target of THP collapse/split, or due to being called from Realmode + MSR_EE = 0.

[PATCH v6 08/11] powerpc/kvm/book3s_hv: Use functions to track lockless pgtbl walks

2020-02-05 Thread Leonardo Bras
Applies the new functions for tracking all book3s_hv related functions that do lockless pagetable walks. Adds comments explaining that some lockless pagetable walks don't need protection due to guest pgd not being a target of THP collapse/split, or due to being called from Realmode + MSR_EE = 0

[PATCH v6 00/11] Introduces new functions for tracking lockless pagetable walks

2020-02-05 Thread Leonardo Bras
Patches 1-2: Introduces new arch-generic functions to use before and after lockless pagetable walks, instead of local_irq_*, and applies them to generic code. It makes lockless pagetable walks more explicit and improves documentation about it. Patches 3-9: Introduces a powerpc-specific version of

[PATCH v6 06/11] powerpc/mm/book3s64/hash: Use functions to track lockless pgtbl walks

2020-02-05 Thread Leonardo Bras
Applies the new tracking functions to all hash-related functions that do lockless pagetable walks. hash_page_mm: Adds comment that explain that there is no need to local_int_disable/save given that it is only called from DataAccess interrupt, so interrupts are already disabled.

[PATCH v6 05/11] powerpc/perf: Use functions to track lockless pgtbl walks

2020-02-05 Thread Leonardo Bras
Applies the new functions used for tracking lockless pgtable walks on read_user_stack_slow. local_irq_{save,restore} is already inside {begin,end}_lockless_pgtbl_walk, so there is no need to repeat it here. Variable that saves the irq mask was renamed from flags to irq_mask so it doesn't lose

[PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64

2020-02-05 Thread Jason Yan
The implementation for Freescale BookE64 is similar as BookE32. One difference is that Freescale BookE64 set up a TLB mapping of 1G during booting. Another difference is that ppc64 needs the kernel to be 64K-aligned. So we can randomize the kernel in this 1G mapping and make it 64K-aligned. This

[PATCH v3 1/6] powerpc/fsl_booke/kaslr: refactor kaslr_legal_offset() and kaslr_early_init()

2020-02-05 Thread Jason Yan
Some code refactor in kaslr_legal_offset() and kaslr_early_init(). No functional change. This is a preparation for KASLR fsl_booke64. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael Ellerman Cc: Christophe Leroy Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc:

Re: [PATCH 1/6] powerpc/eeh: Add sysfs files in late probe

2020-02-05 Thread Sam Bobroff
On Mon, Feb 03, 2020 at 07:35:16PM +1100, Oliver O'Halloran wrote: > Move creating the EEH specific sysfs files into eeh_add_device_late() > rather than being open-coded all over the place. Calling the function is > generally done immediately after calling eeh_add_device_late() anyway. The > two

Re: [PATCH v6 03/11] powerpc/mm: Adds arch-specificic functions to track lockless pgtable walks

2020-02-05 Thread Christophe Leroy
Le 06/02/2020 à 04:08, Leonardo Bras a écrit : On powerpc, we need to do some lockless pagetable walks from functions that already have disabled interrupts, specially from real mode with MSR[EE=0]. In these contexts, disabling/enabling interrupts can be very troubling. When interrupts are

Re: [PATCH 3/6] powerpc/eeh: Do early EEH init only when required

2020-02-05 Thread Sam Bobroff
On Mon, Feb 03, 2020 at 07:35:18PM +1100, Oliver O'Halloran wrote: > The pci hotplug helper (pci_hp_add_devices()) calls > eeh_add_device_tree_early() to scan the device-tree for new PCI devices and > do the early EEH probe before the device is scanned. This early probe is a > no-op in a lot of

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

2020-02-05 Thread Dan Williams
On Tue, Feb 4, 2020 at 7:05 PM Michael Ellerman wrote: > > 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

Re: [PATCH v6 06/11] powerpc/mm/book3s64/hash: Use functions to track lockless pgtbl walks

2020-02-05 Thread Christophe Leroy
Le 06/02/2020 à 04:08, Leonardo Bras a écrit : Applies the new tracking functions to all hash-related functions that do lockless pagetable walks. hash_page_mm: Adds comment that explain that there is no need to local_int_disable/save given that it is only called from DataAccess interrupt, so

[PATCH 1/2] cpufreq/powernv: Fix use-after-free

2020-02-05 Thread Oliver O'Halloran
The cpufreq driver has a use-after-free that we can hit if: a) There's an OCC message pending when the notifier is registered, and b) The cpufreq driver fails to register with the core. When a) occurs the notifier schedules a workqueue item to handle the message. The backing work_struct is

Re: [PATCH 4/6] powerpc/eeh: Remove PHB check in probe

2020-02-05 Thread Sam Bobroff
On Mon, Feb 03, 2020 at 07:35:19PM +1100, Oliver O'Halloran wrote: > This check for a missing PHB has existing in various forms since the > initial PPC64 port was upstreamed in 2002. The idea seems to be that we > need to guard against creating pci-specific data structures for the non-pci >

Re: [PATCH v6 01/11] asm-generic/pgtable: Adds generic functions to track lockless pgtable walks

2020-02-05 Thread Christophe Leroy
Le 06/02/2020 à 04:08, Leonardo Bras a écrit : It's necessary to track lockless pagetable walks, in order to avoid doing THP splitting/collapsing during them. The default solution is to disable irq before lockless pagetable walks and enable it after it's finished. On code, this means you

Re: [PATCH v6 10/11] powerpc/mm: Adds counting method to track lockless pagetable walks

2020-02-05 Thread Christophe Leroy
Le 06/02/2020 à 04:08, Leonardo Bras a écrit : Implements an additional feature to track lockless pagetable walks, using a per-cpu counter: lockless_pgtbl_walk_counter. Before a lockless pagetable walk, preemption is disabled and the current cpu's counter is increased. When the lockless

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

2020-02-05 Thread Aneesh Kumar K.V
On 2/6/20 11:21 AM, Dan Williams wrote: Link: http://lore.kernel.org/r/capcyv4gbgnp95apyabcsocea50tqj9b5h__83vgngjq3oug...@mail.gmail.com Reported-by: Aneesh Kumar K.V Reported-by: Jeff Moyer Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Dan

Re: [PATCH v6 04/11] powerpc/mce_power: Use functions to track lockless pgtbl walks

2020-02-05 Thread Christophe Leroy
Le 06/02/2020 à 04:08, Leonardo Bras a écrit : Applies the new functions used for tracking lockless pgtable walks on addr_to_pfn(). local_irq_{save,restore} is already inside {begin,end}_lockless_pgtbl_walk, so there is no need to repeat it here. Signed-off-by: Leonardo Bras ---

Re: [PATCH v6 07/11] powerpc/kvm/e500: Use functions to track lockless pgtbl walks

2020-02-05 Thread Christophe Leroy
Le 06/02/2020 à 04:08, Leonardo Bras a écrit : Applies the new functions used for tracking lockless pgtable walks on kvmppc_e500_shadow_map(). Fixes the place where local_irq_restore() is called: previously, if ptep was NULL, local_irq_restore() would never be called.

[PATCH 2/2] cpufreq/powernv: Fix unsafe notifiers

2020-02-05 Thread Oliver O'Halloran
The PowerNV cpufreq driver registers two notifiers: one to catch throttle messages from the OCC and one to bump the CPU frequency back to normal before a reboot. Both require the cpufreq driver to be registered in order to function since the notifier callbacks use various cpufreq_*() functions.

Re: [PATCH v2] powerpc: drmem: avoid NULL pointer dereference when drmem is unavailable

2020-02-05 Thread Nathan Lynch
Michal Suchanek writes: > From: Libor Pechacek > > In guests without hotplugagble memory drmem structure is only zero > initialized. Trying to manipulate DLPAR parameters results in a crash. > [...] > > Fixes: 6c6ea53725b3 ("powerpc/mm: Separate ibm, dynamic-memory data from DT > format") >

[PATCH v6 00/10] Introduce CAP_PERFMON to secure system performance monitoring and observability

2020-02-05 Thread Alexey Budankov
Currently access to perf_events, i915_perf and other performance monitoring and observability subsystems of the kernel is open only for a privileged process [1] with CAP_SYS_ADMIN capability enabled in the process effective set [2]. This patch set introduces CAP_PERFMON capability designed to

Re: [PATCH v6 07/10] mm/memory_hotplug: We always have a zone in find_(smallest|biggest)_section_pfn

2020-02-05 Thread David Hildenbrand
On 05.02.20 09:57, Wei Yang wrote: > On Sun, Oct 06, 2019 at 10:56:43AM +0200, David Hildenbrand wrote: >> With shrink_pgdat_span() out of the way, we now always have a valid >> zone. >> >> Cc: Andrew Morton >> Cc: Oscar Salvador >> Cc: David Hildenbrand >> Cc: Michal Hocko >> Cc: Pavel

Re: [PATCH v6 07/10] mm/memory_hotplug: We always have a zone in find_(smallest|biggest)_section_pfn

2020-02-05 Thread Wei Yang
On Wed, Feb 05, 2020 at 09:59:41AM +0100, David Hildenbrand wrote: >On 05.02.20 09:57, Wei Yang wrote: >> On Sun, Oct 06, 2019 at 10:56:43AM +0200, David Hildenbrand wrote: >>> With shrink_pgdat_span() out of the way, we now always have a valid >>> zone. >>> >>> Cc: Andrew Morton >>> Cc: Oscar

Re: [PATCH v6 07/10] mm/memory_hotplug: We always have a zone in find_(smallest|biggest)_section_pfn

2020-02-05 Thread Wei Yang
On Sun, Oct 06, 2019 at 10:56:43AM +0200, David Hildenbrand wrote: >With shrink_pgdat_span() out of the way, we now always have a valid >zone. > >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: David Hildenbrand >Cc: Michal Hocko >Cc: Pavel Tatashin >Cc: Dan Williams >Cc: Wei Yang

Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-05 Thread Naveen N. Rao
Christophe Leroy wrote: Le 27/11/2019 à 13:01, Gautham R. Shenoy a écrit : 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

Re: [PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2020-02-05 Thread Wei Yang
On Sun, Oct 06, 2019 at 10:56:46AM +0200, David Hildenbrand wrote: >Let's drop the basically unused section stuff and simplify. > >Also, let's use a shorter variant to calculate the number of pages to >the next section boundary. > >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: Michal Hocko >Cc:

Re: [PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2020-02-05 Thread Segher Boessenkool
On Tue, Feb 04, 2020 at 02:38:51PM +0100, David Hildenbrand wrote: > On 04.02.20 14:13, Segher Boessenkool wrote: > > On Tue, Feb 04, 2020 at 01:41:06PM +0100, David Hildenbrand wrote: > >> It's a pattern commonly used in compilers and emulators to calculate the > >> number of bytes to the next

Re: Latest Git kernel: avahi-daemon[2410]: ioctl(): Inappropriate ioctl for device

2020-02-05 Thread Christian Zigotzky
On 03 February 2020 at 6:53 pm, Jakub Kicinski wrote: On Sun, 2 Feb 2020 16:02:18 +0100, Christian Zigotzky wrote: On 02 February 2020 at 09:19 am, Christophe Leroy wrote: Hello, Le 02/02/2020 à 01:08, Christian Zigotzky a écrit : Hello, We regularly compile and test Linux kernels every day

Re: [PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2020-02-05 Thread David Hildenbrand
On 05.02.20 14:18, David Hildenbrand wrote: >> I'm sorry to have to correct you again for some corner cases: >> >> ALIGN_UP(1, 4096) - 4096 = 0 >> >> Again, not as easy as it seems ... >> > > Eh, wait, I'm messing up things. Will double check :) > Yes, makes sense, will send a patch and cc you.

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
On 02/04/20 at 03:42pm, David Hildenbrand wrote: > On 04.02.20 15:25, Baoquan He wrote: > > On 10/06/19 at 10:56am, David Hildenbrand wrote: > >> If we have holes, the holes will automatically get detected and removed > >> once we remove the next bigger/smaller section. The extra checks can > >>

Re: [PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2020-02-05 Thread David Hildenbrand
On 05.02.20 13:51, Segher Boessenkool wrote: > On Tue, Feb 04, 2020 at 02:38:51PM +0100, David Hildenbrand wrote: >> On 04.02.20 14:13, Segher Boessenkool wrote: >>> On Tue, Feb 04, 2020 at 01:41:06PM +0100, David Hildenbrand wrote: It's a pattern commonly used in compilers and emulators to

Re: [PATCH v6 10/10] mm/memory_hotplug: Cleanup __remove_pages()

2020-02-05 Thread David Hildenbrand
> I'm sorry to have to correct you again for some corner cases: > > ALIGN_UP(1, 4096) - 4096 = 0 > > Again, not as easy as it seems ... > Eh, wait, I'm messing up things. Will double check :) -- Thanks, David / dhildenb

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread David Hildenbrand
On 05.02.20 13:43, Baoquan He wrote: > On 02/04/20 at 03:42pm, David Hildenbrand wrote: >> On 04.02.20 15:25, Baoquan He wrote: >>> On 10/06/19 at 10:56am, David Hildenbrand wrote: If we have holes, the holes will automatically get detected and removed once we remove the next

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Sun, Oct 06, 2019 at 10:56:44AM +0200, David Hildenbrand wrote: >If we have holes, the holes will automatically get detected and removed >once we remove the next bigger/smaller section. The extra checks can >go. > >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: Michal Hocko >Cc: David

Re: [PATCH v6 09/10] mm/memory_hotplug: Drop local variables in shrink_zone_span()

2020-02-05 Thread Wei Yang
On Sun, Oct 06, 2019 at 10:56:45AM +0200, David Hildenbrand wrote: >Get rid of the unnecessary local variables. > >Cc: Andrew Morton >Cc: Oscar Salvador >Cc: David Hildenbrand >Cc: Michal Hocko >Cc: Pavel Tatashin >Cc: Dan Williams >Cc: Wei Yang >Signed-off-by: David Hildenbrand Looks

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

2020-02-05 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] powerpc/legacy_serial: Use early_ioremap()

2020-02-05 Thread Christophe Leroy
[0.00] ioremap() called early from find_legacy_serial_ports+0x3cc/0x474. Use early_ioremap() instead find_legacy_serial_ports() is called early from setup_arch(), before paging_init(). vmalloc is not available yet, ioremap shouldn't be used that early. Use early_ioremap() and switch to

Re: [RFC] per-CPU usage in perf core-book3s

2020-02-05 Thread Sebastian Andrzej Siewior
On 2020-02-05 07:10:59 [+0530], maddy wrote: > Yes, currently we dont have anything that prevents the timer > callback to interrupt pmu::event_init. Nice catch. Thanks for > pointing this out. You are welcome. > Looking at the code, per-cpu variable access are made to > check for constraints and

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread David Hildenbrand
Anyhow, that patch is already upstream and I don't consider this high priority. Thanks :) >>> >>> Yeah, noticed you told Wei the status in another patch thread, I am fine >>> with it, just leave it to you to decide. Thanks. >> >> I am fairly busy right now. Can you send a patch

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
On 02/05/20 at 03:16pm, David Hildenbrand wrote: > Anyhow, that patch is already upstream and I don't consider this high > priority. Thanks :) > >>> > >>> Yeah, noticed you told Wei the status in another patch thread, I am fine > >>> with it, just leave it to you to decide. Thanks. > >>

Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup

2020-02-05 Thread Fontenot, Nathan
On 2/3/2020 2:13 PM, Scott Cheloha wrote: > On Thu, Jan 30, 2020 at 10:09:32AM -0600, Fontenot, Nathan wrote: >> On 1/29/2020 12:10 PM, Scott Cheloha wrote: >>> On Tue, Jan 28, 2020 at 05:56:55PM -0600, Nathan Lynch wrote: Scott Cheloha writes: > LMB lookup is currently an O(n) linear

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
On 02/05/20 at 02:20pm, David Hildenbrand wrote: > On 05.02.20 13:43, Baoquan He wrote: > > On 02/04/20 at 03:42pm, David Hildenbrand wrote: > >> On 04.02.20 15:25, Baoquan He wrote: > >>> On 10/06/19 at 10:56am, David Hildenbrand wrote: > If we have holes, the holes will automatically get

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread David Hildenbrand
On 05.02.20 14:34, Baoquan He wrote: > On 02/05/20 at 02:20pm, David Hildenbrand wrote: >> On 05.02.20 13:43, Baoquan He wrote: >>> On 02/04/20 at 03:42pm, David Hildenbrand wrote: On 04.02.20 15:25, Baoquan He wrote: > On 10/06/19 at 10:56am, David Hildenbrand wrote: >> If we have

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
Hi Wei Yang, On 02/05/20 at 05:59pm, Wei Yang wrote: > >diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > >index f294918f7211..8dafa1ba8d9f 100644 > >--- a/mm/memory_hotplug.c > >+++ b/mm/memory_hotplug.c > >@@ -393,6 +393,9 @@ static void shrink_zone_span(struct zone *zone, unsigned >

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread David Hildenbrand
On 05.02.20 15:54, David Laight wrote: > From: Wei Yang >> Sent: 05 February 2020 09:59 > ... >> If it is me, I would like to take out these two similar logic out. >> >> For example: >> >> if () { >> } else if () { >> } else { >> goto out; >> } > > I'm pretty sure

Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread Baoquan He
On 02/05/20 at 02:38pm, David Hildenbrand wrote: > On 05.02.20 14:34, Baoquan He wrote: > > On 02/05/20 at 02:20pm, David Hildenbrand wrote: > >> On 05.02.20 13:43, Baoquan He wrote: > >>> On 02/04/20 at 03:42pm, David Hildenbrand wrote: > On 04.02.20 15:25, Baoquan He wrote: > > On

Re: [PATCH v2 1/3] powerpc/tm: Clear the current thread's MSR[TS] after treclaim

2020-02-05 Thread Sasha Levin
Hi, [This is an automated email] This commit has been processed because it contains a "Fixes:" tag, fixing commit: 2b0a576d15e0 ("powerpc: Add new transactional memory state to the signal context"). The bot has tested the following trees: v5.5.1, v5.4.17, v4.19.101, v4.14.169, v4.9.212,

RE: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span()

2020-02-05 Thread David Laight
From: Wei Yang > Sent: 05 February 2020 09:59 ... > If it is me, I would like to take out these two similar logic out. > > For example: > > if () { > } else if () { > } else { > goto out; > } I'm pretty sure the kernel layout rules disallow 'else if'. It is

Re: [PATCH v2 00/14] Convert cpu_up/down to device_online/offline

2020-02-05 Thread Qais Yousef
Hi Thomas On 11/25/19 11:27, Qais Yousef wrote: > Changes in v2: > * Add 2 new patches that create smp_shutdown_nonboot_cpus() to be used > in machine_shutdown() in ia64, arm and arm64 > * Use proper kernel-doc for the newly introduced functions > * Renamed a function >