Re: [PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Kees Cook
On Fri, Feb 3, 2017 at 2:28 PM, Russell King - ARM Linux wrote: > On Fri, Feb 03, 2017 at 01:08:40PM -0800, Kees Cook wrote: >> On Fri, Feb 3, 2017 at 12:29 PM, Russell King - ARM Linux >> wrote: >> > On Fri, Feb 03, 2017 at 11:45:56AM -0800, Kees Cook wrote: >> >> On Fri, Feb 3, 2017 at 9:52 AM,

Re: [PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Russell King - ARM Linux
On Fri, Feb 03, 2017 at 01:08:40PM -0800, Kees Cook wrote: > On Fri, Feb 3, 2017 at 12:29 PM, Russell King - ARM Linux > wrote: > > On Fri, Feb 03, 2017 at 11:45:56AM -0800, Kees Cook wrote: > >> On Fri, Feb 3, 2017 at 9:52 AM, Laura Abbott wrote: > >> > diff --git a/arch/Kconfig b/arch/Kconfig >

Re: [PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Kees Cook
On Fri, Feb 3, 2017 at 12:29 PM, Russell King - ARM Linux wrote: > On Fri, Feb 03, 2017 at 11:45:56AM -0800, Kees Cook wrote: >> On Fri, Feb 3, 2017 at 9:52 AM, Laura Abbott wrote: >> > diff --git a/arch/Kconfig b/arch/Kconfig >> > index 99839c2..22ee01e 100644 >> > --- a/arch/Kconfig >> > +++ b/

Re: [PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Russell King - ARM Linux
On Fri, Feb 03, 2017 at 11:45:56AM -0800, Kees Cook wrote: > On Fri, Feb 3, 2017 at 9:52 AM, Laura Abbott wrote: > > diff --git a/arch/Kconfig b/arch/Kconfig > > index 99839c2..22ee01e 100644 > > --- a/arch/Kconfig > > +++ b/arch/Kconfig > > @@ -781,4 +781,32 @@ config VMAP_STACK > > the

Re: [PATCHv2 2/2] arch: Rename CONFIG_DEBUG_RODATA and CONFIG_DEBUG_MODULE_RONX

2017-02-03 Thread Kees Cook
On Fri, Feb 3, 2017 at 9:52 AM, Laura Abbott wrote: > > Both of these options are poorly named. The features they provide are > necessary for system security and should not be considered debug only. > Change the name to something that accurately describes what these > options do. It may help to e

Re: [PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Kees Cook
On Fri, Feb 3, 2017 at 9:52 AM, Laura Abbott wrote: > There are multiple architectures that support CONFIG_DEBUG_RODATA and > CONFIG_SET_MODULE_RONX. These options also now have the ability to be > turned off at runtime. Move these to an architecture independent > location and make these options d

Re: [PATCH-tip v5 17/21] TP-futex: Group readers together in wait queue

2017-02-03 Thread valdis . kletnieks
On Fri, 03 Feb 2017 13:42:46 -0500, Waiman Long said: > This patch set does guarantee some minimum performance level, but it > can't guarantee fairness for all the lock waiters. OK, sounds like it's a situation that's statistically unlikely, but it has protections against starvation so the system

Re: [PATCH-tip v5 17/21] TP-futex: Group readers together in wait queue

2017-02-03 Thread Waiman Long
On 02/03/2017 01:23 PM, valdis.kletni...@vt.edu wrote: > On Fri, 03 Feb 2017 13:03:50 -0500, Waiman Long said: > >> On a 2-socket 36-core E5-2699 v3 system (HT off) running on a 4.10 >> WW futex TP futex Glibc >> -

Re: [PATCHv2 2/2] arch: Rename CONFIG_DEBUG_RODATA and CONFIG_DEBUG_MODULE_RONX

2017-02-03 Thread Mark Rutland
On Fri, Feb 03, 2017 at 09:52:22AM -0800, Laura Abbott wrote: > > Both of these options are poorly named. The features they provide are > necessary for system security and should not be considered debug only. > Change the name to something that accurately describes what these > options do. > > Si

Re: [PATCH-tip v5 17/21] TP-futex: Group readers together in wait queue

2017-02-03 Thread valdis . kletnieks
On Fri, 03 Feb 2017 13:03:50 -0500, Waiman Long said: > On a 2-socket 36-core E5-2699 v3 system (HT off) running on a 4.10 > WW futex TP futex Glibc > - > Total locking ops35,707,234

Re: [PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Mark Rutland
On Fri, Feb 03, 2017 at 09:52:21AM -0800, Laura Abbott wrote: > There are multiple architectures that support CONFIG_DEBUG_RODATA and > CONFIG_SET_MODULE_RONX. These options also now have the ability to be > turned off at runtime. Move these to an architecture independent > location and make these

[PATCH-tip v5 01/21] perf bench: New microbenchmark for userspace mutex performance

2017-02-03 Thread Waiman Long
This microbenchmark simulates how the use of different futex types can affect the actual performanace of userspace mutex locks. The usage is: perf bench futex mutex Three sets of simple mutex lock and unlock functions are implemented using the wait-wake and PI futexes respectively. This

[PATCH-tip v5 00/21] futex: Introducing throughput-optimized (TP) futexes

2017-02-03 Thread Waiman Long
v4->v5: - Fix 0-day kernel build test compilation warnings. - Extract out non-TP futexes futex-mutex and futex-rwlock microbenchmarks as separate patches, as suggested by Arnaldo. - Rebased to the latest tip tree & use running_clock() instead of sched_clock(). v3->v4: - Properly

[PATCH-tip v5 04/21] futex: Rename futex_pi_state to futex_state

2017-02-03 Thread Waiman Long
The futex_pi_state structure will be overloaded in later patches to store state information about non-PI futexes. So the structure name itself is no longer a good description of its purpose. So its name is changed to futex_state, a more generic name. Some of the functions that process the futex st

[PATCH-tip v5 05/21] futex: Add helpers to get & cmpxchg futex value without lock

2017-02-03 Thread Waiman Long
Two new helper functions cmpxchg_futex_value() and get_futex_value() are added to access and change the futex value without the hash bucket lock. As a result, page fault is enabled and the page will be faulted in if not present yet. Signed-off-by: Waiman Long --- kernel/futex.c | 15 +++

[PATCH-tip v5 02/21] perf bench: New microbenchmark for userspace rwlock performance

2017-02-03 Thread Waiman Long
This microbenchmark simulates how the use of different futex types can affect the actual performanace of userspace rwlock locks. The usage is: perf bench futex rwlock Two sets of simple rwlock lock and unlock functions are implemented using the wait-wake futexes and glibc rwlock respecti

[PATCH-tip v5 03/21] futex: Consolidate duplicated timer setup code

2017-02-03 Thread Waiman Long
A new futex_setup_timer() helper function is added to consolidate all the hrtimer_sleeper setup code. Signed-off-by: Waiman Long --- kernel/futex.c | 67 -- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/kernel/futex.c b/ke

[PATCH-tip v5 11/21] TP-futex: Implement lock handoff to prevent lock starvation

2017-02-03 Thread Waiman Long
The current TP futexes has no guarantee that the top waiter (serialization mutex owner) can get the lock within a finite time. As a result, lock starvation can happen. A lock handoff mechanism is added to the TP futexes to prevent lock starvation from happening. The idea is that the top waiter can

[PATCH-tip v5 06/21] futex: Consolidate pure pi_state_list add & delete codes to helpers

2017-02-03 Thread Waiman Long
Two new helper functions (task_pi_list_add & task_pi_list_del) are created to consolidate all the pure pi_state_list addition and insertion codes. The set_owner argument in task_pi_list_add() will be needed in a later patch. Signed-off-by: Waiman Long --- kernel/futex.c | 64

[PATCH-tip v5 14/21] TP-futex, doc: Add TP futexes documentation

2017-02-03 Thread Waiman Long
This patch adds a new document file on how to use the TP futexes. Signed-off-by: Waiman Long --- Documentation/00-INDEX | 2 + Documentation/tp-futex.txt | 161 + 2 files changed, 163 insertions(+) create mode 100644 Documentation/tp-futex.txt

[PATCH-tip v5 08/21] futex: Allow direct attachment of futex_state objects to hash bucket

2017-02-03 Thread Waiman Long
Currently, the futex state objects can only be located indirectly as hash bucket => futex_q => futex state Actually it can be beneficial in some cases to locate the futex state object directly from the hash bucket without the futex_q middleman. Therefore, a new list head to link the futex

[PATCH-tip v5 12/21] TP-futex: Return status code on FUTEX_LOCK calls

2017-02-03 Thread Waiman Long
To better understand how the TP futexes are performing, it is useful to return the internal status on the TP futexes. The FUTEX_LOCK futex(2) syscall will now return a positive status code if no error happens. The status code consists of the following 3 fields: 1) Bits 00-07: code on how the lock

[PATCH-tip v5 07/21] futex: Add a new futex type field into futex_state

2017-02-03 Thread Waiman Long
As the futex_state structure will be overloaded in later patches to be used by non-PI futexes, it is necessary to add a type field to distinguish among different types of futexes. Signed-off-by: Waiman Long --- kernel/futex.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-)

[PATCH-tip v5 13/21] TP-futex: Add timeout support

2017-02-03 Thread Waiman Long
Unlike other futexes, TP futexes do not accept the specification of a timeout value. To align with the other futexes, timeout support is now added. However, the timeout isn't as precise as the other futex types due to the fact that timer expiration can't be detected when the thread is waiting in t

[PATCH-tip v5 17/21] TP-futex: Group readers together in wait queue

2017-02-03 Thread Waiman Long
All the TP futex lock waiters are serialized in the kernel using a kernel mutex which acts like a wait queue. The order at which the waiters popped out from the wait queue will affect performance when exclusive (writer) and shared (reader) lock waiters are mixed in the queue. The worst case scenari

[PATCH-tip v5 15/21] TP-futex: Support userspace reader/writer locks

2017-02-03 Thread Waiman Long
The TP futexes was designed to support userspace mutually exclusive locks. They are now extended to support userspace reader/writer locks as well. Two new futex command codes are added: 1) FUTEX_LOCK_SHARED - to acquire a shared lock (reader-lock) 2) FUTEX_UNLOCK_SHARED - to release a shred lock

[PATCH-tip v5 16/21] TP-futex: Enable kernel reader lock stealing

2017-02-03 Thread Waiman Long
The TP-futexes prefer writers as the code path is much simpler for them. This may not be good for overall system performance especially if there is a fair amount of reader activities. This patch enables kernel reader to steal the lock when the futex is currently reader-owned and the lock handoff m

[PATCH-tip v5 21/21] futex: Dump internal futex state via debugfs

2017-02-03 Thread Waiman Long
For debugging purpose, it is sometimes useful to dump the internal states in the futex hash bucket table. This patch adds a file "futex_hash_table" in debugfs root filesystem to dump the internal futex states. Signed-off-by: Waiman Long --- kernel/futex.c | 82 +++

[PATCH-tip v5 18/21] TP-futex, doc: Update TP futexes document on shared locking

2017-02-03 Thread Waiman Long
The tp-futex.txt was updated to add description about shared locking support. Signed-off-by: Waiman Long --- Documentation/tp-futex.txt | 163 +++-- 1 file changed, 143 insertions(+), 20 deletions(-) diff --git a/Documentation/tp-futex.txt b/Documentation

[PATCH-tip v5 10/21] TP-futex: Enable robust handling

2017-02-03 Thread Waiman Long
The TP futexes don't have code to handle the death of futex owners. There are 2 different cases that need to be considered. As top waiter gets a reference to the task structure of the futex owner, the task structure will never go away even if the owner dies. When the futex owner died while the top

[PATCH-tip v5 19/21] perf bench: Extend mutex/rwlock futex suite to test TP futexes

2017-02-03 Thread Waiman Long
This patch extends the futex-mutex and futex-rwlock microbenchmarks to test userspace mutexes and rwlocks built on top of the TP futexes. We can then compare the relative performance of those userspace locks based on different type of futexes. Signed-off-by: Waiman Long --- tools/perf/bench/fute

[PATCH-tip v5 09/21] futex: Introduce throughput-optimized (TP) futexes

2017-02-03 Thread Waiman Long
A new futex implementation called throughput-optimized (TP) futexes is introduced. The goal of this new futex type is to maximize locking throughput at the expense of fairness and deterministic latency. Its throughput is higher than that of the wait-wake futexes especially on systems with a large n

[PATCH-tip v5 20/21] sched, TP-futex: Make wake_up_q() return wakeup count

2017-02-03 Thread Waiman Long
Unlike wake_up_process(), wake_up_q() doesn't tell us how many tasks have been woken up. This information can sometimes be useful for tracking purpose. So wake_up_q() is now modified to return that information. Signed-off-by: Waiman Long --- include/linux/sched/wake_q.h | 2 +- kernel/futex.c

[PATCHv2 0/2] Hardening configs refactor/rename

2017-02-03 Thread Laura Abbott
Hi, This is a follow up to my proposal to rename/refactor CONFIG_DEBUG_RODATA and CONFIG_DEBUG_SET_MODULE_RONX. Among other objections, there shouldn't be 'debug' in the name since these provide necessary kernel protection. v2 takes a slightly different approach to this per feedback. Patch #1 mov

[PATCHv2 2/2] arch: Rename CONFIG_DEBUG_RODATA and CONFIG_DEBUG_MODULE_RONX

2017-02-03 Thread Laura Abbott
Both of these options are poorly named. The features they provide are necessary for system security and should not be considered debug only. Change the name to something that accurately describes what these options do. Signed-off-by: Laura Abbott --- v2: This patch is now doing the renaming of C

[PATCHv2 1/2] arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common

2017-02-03 Thread Laura Abbott
There are multiple architectures that support CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX. These options also now have the ability to be turned off at runtime. Move these to an architecture independent location and make these options def_bool y for almost all of those arches. Signed-off-by: Lau

[PATCH] Add 'nodoc' option

2017-02-03 Thread Matthew Wilcox
I've written this patch, and it seems to work, but I don't really know what I'm doing and I fear I may have broken something. I don't know what: required_argument = 1 optional_arguments = 4 mean, so I don't know whether I should have adjusted them when adding this new option. >From 268

Re: [PATCH RESEND] Documentation/sphinx: prevent generation of .pyc files in the source tree

2017-02-03 Thread Jani Nikula
On Wed, 01 Feb 2017, Jonathan Corbet wrote: > On Tue, 31 Jan 2017 20:18:05 +0200 > Jani Nikula wrote: > >> Considering the small amount of python code to compile (assuming sphinx >> itself has .pyc around), the impact on build is neglible. > > Hey...don't you know that performance-impacting patch

Re: [PATCH 1/1] MicroSemi Switchtec management interface driver

2017-02-03 Thread Emil Velikov
On 2 February 2017 at 16:37, Logan Gunthorpe wrote: > > > On 01/02/17 05:10 AM, Emil Velikov wrote: >> You can keep it roughly as-is if you're ~reasonably certain one won't >> change it in the future. > > I've made the change anyway. I think it's better now. > >> Some teams frown upon adding new I

Re: [PATCH v8 07/12] dt-bindings: i2c: i2c-mux-simple: document i2c-mux-simple bindings

2017-02-03 Thread Peter Rosin
On 2017-02-02 17:08, Rob Herring wrote: > On Tue, Jan 31, 2017 at 1:36 AM, Peter Rosin wrote: >> If you see this new driver as something that is superseding the existing >> i2c-mux-gpio driver, I'm sad to inform you that the code is not simply >> not there. i2c-mux-gpio has acpi support and users