[ANNOUNCE] 4.1.3-rt3 v4.1.3-rt3-patches
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Sat, 25 Jul 2015 10:09:45 +0000 (12:09 +0200)
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>
Sat, 25 Jul 2015 10:09:45 +0000 (12:09 +0200)
Dear RT folks!

I'm pleased to announce the v4.1.3-rt3 patch set.
Changes since v4.1.3-rt2:

- fix compile of locktorture. Patch by Wolfgang M. Reimer.

- fix compile pid_namespace without lockdep on ARM. Patch by Grygorii
  Strashko

- The annoying "cpufreq_stat_notifier_trans: No policy found" is finally
  gone.

- xor / raid_pq
  The max latency will increase into the ms range if the raid6_pq is
  loaded. This should not matter under normal circumstances because that
  module should only be loaded at boot time if required (and not while a
  -RT task is active in production). It might also get loaded at
  run-time manually.
  Dropping the preempt_disable() might cause different results for the
  individual implementations. People who don't care (load it at
  run-time) don't need to load it at all. People who care (load it boot
  time) would prefer to stick with the best implementation.
  Therefore I think it is enough to document this (don't load it at run
  time if you don't need it) and I cross it off my list. Patches are
  welcome if someone needs / has an improvement.

Known issues:

- bcache is disabled.

- CPU hotplug works in general. Steven's test script however
  deadlocks usually on the second invocation.

You can get this release via the git tree at:

    git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt
    git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt-rebase
    git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt-queue

The RT patch against 4.1.3 can be found here:

    https://www.kernel.org/pub/linux/kernel/projects/rt/4.1/patch-4.1.3-rt3.patch.xz

The split quilt queue is available at:

    https://www.kernel.org/pub/linux/kernel/projects/rt/4.1/patches-4.1.3-rt3.tar.xz

Sebastian

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
patches/arch-arm64-Add-lazy-preempt-support.patch
patches/cgroups-use-simple-wait-in-css_release.patch
patches/cpufreq-Remove-cpufreq_rwsem.patch [new file with mode: 0644]
patches/localversion.patch
patches/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch [new file with mode: 0644]
patches/pid.h-include-atomic.h.patch [new file with mode: 0644]
patches/series

index 5952089d3dde01c56faa052054177b3fcb817bc2..de7aa8b52aad81b970baafe9eba8578a08e1cbb2 100644 (file)
@@ -93,7 +93,7 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
        ret     x24
  #endif
  
-@@ -621,6 +627,7 @@ ENDPROC(cpu_switch_to)
+@@ -622,6 +628,7 @@ ENDPROC(cpu_switch_to)
        str     x0, [sp, #S_X0]                 // returned x0
  work_pending:
        tbnz    x1, #TIF_NEED_RESCHED, work_resched
index b4e6bdc8b97fdbac113c04a5b3e510d96d101a8b..3baff121f282fd11af3eefc3a6d023bdc12d1740 100644 (file)
@@ -52,7 +52,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  /* bits in struct cgroup_subsys_state flags field */
 --- a/kernel/cgroup.c
 +++ b/kernel/cgroup.c
-@@ -4423,10 +4423,10 @@ static void css_free_rcu_fn(struct rcu_h
+@@ -4421,10 +4421,10 @@ static void css_free_rcu_fn(struct rcu_h
        queue_work(cgroup_destroy_wq, &css->destroy_work);
  }
  
@@ -65,7 +65,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
        struct cgroup_subsys *ss = css->ss;
        struct cgroup *cgrp = css->cgroup;
  
-@@ -4465,8 +4465,8 @@ static void css_release(struct percpu_re
+@@ -4463,8 +4463,8 @@ static void css_release(struct percpu_re
        struct cgroup_subsys_state *css =
                container_of(ref, struct cgroup_subsys_state, refcnt);
  
@@ -76,7 +76,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  }
  
  static void init_and_link_css(struct cgroup_subsys_state *css,
-@@ -5070,6 +5070,7 @@ static int __init cgroup_wq_init(void)
+@@ -5068,6 +5068,7 @@ static int __init cgroup_wq_init(void)
         */
        cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1);
        BUG_ON(!cgroup_destroy_wq);
diff --git a/patches/cpufreq-Remove-cpufreq_rwsem.patch b/patches/cpufreq-Remove-cpufreq_rwsem.patch
new file mode 100644 (file)
index 0000000..434d350
--- /dev/null
@@ -0,0 +1,195 @@
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Tue, 21 Jul 2015 15:28:49 +0200
+Subject: cpufreq: Remove cpufreq_rwsem
+
+cpufreq_rwsem was introduced in commit 6eed9404ab3c4 ("cpufreq: Use
+rwsem for protecting critical sections) in order to replace
+try_module_get() on the cpu-freq driver. That try_module_get() worked
+well until the refcount was so heavily used that module removal became
+more or less impossible.
+
+Though when looking at the various (undocumented) protection
+mechanisms in that code, the randomly sprinkeled around cpufreq_rwsem
+locking sites are superfluous.
+
+The policy, which is acquired in cpufreq_cpu_get() and released in
+cpufreq_cpu_put() is sufficiently protected already.
+
+  cpufreq_cpu_get(cpu)
+    /* Protects against concurrent driver removal */
+    read_lock_irqsave(&cpufreq_driver_lock, flags);
+    policy = per_cpu(cpufreq_cpu_data, cpu);
+    kobject_get(&policy->kobj);
+    read_unlock_irqrestore(&cpufreq_driver_lock, flags);
+
+The reference on the policy serializes versus module unload already:
+
+  cpufreq_unregister_driver()
+    subsys_interface_unregister()
+      __cpufreq_remove_dev_finish()
+        per_cpu(cpufreq_cpu_data) = NULL;
+       cpufreq_policy_put_kobj()
+
+If there is a reference held on the policy, i.e. obtained prior to the
+unregister call, then cpufreq_policy_put_kobj() will wait until that
+reference is dropped. So once subsys_interface_unregister() returns
+there is no policy pointer in flight and no new reference can be
+obtained. So that rwsem protection is useless.
+
+The other usage of cpufreq_rwsem in show()/store() of the sysfs
+interface is redundant as well because sysfs already does the proper
+kobject_get()/put() pairs.
+
+That leaves CPU hotplug versus module removal. The current
+down_write() around the write_lock() in cpufreq_unregister_driver() is
+silly at best as it protects actually nothing.
+
+The trivial solution to this is to prevent hotplug across
+cpufreq_unregister_driver completely.
+
+[upstream: rafael/linux-pm 454d3a2500a4eb33be85dde3bfba9e5f6b5efadc]
+[fixes: "cpufreq_stat_notifier_trans: No policy found" since v4.0-rt]
+Cc: stable-rt@vger.kernel.org
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ drivers/cpufreq/cpufreq.c |   35 +++--------------------------------
+ 1 file changed, 3 insertions(+), 32 deletions(-)
+
+--- a/drivers/cpufreq/cpufreq.c
++++ b/drivers/cpufreq/cpufreq.c
+@@ -64,12 +64,6 @@ static inline bool has_target(void)
+       return cpufreq_driver->target_index || cpufreq_driver->target;
+ }
+-/*
+- * rwsem to guarantee that cpufreq driver module doesn't unload during critical
+- * sections
+- */
+-static DECLARE_RWSEM(cpufreq_rwsem);
+-
+ /* internal prototypes */
+ static int __cpufreq_governor(struct cpufreq_policy *policy,
+               unsigned int event);
+@@ -215,9 +209,6 @@ struct cpufreq_policy *cpufreq_cpu_get(u
+       if (cpu >= nr_cpu_ids)
+               return NULL;
+-      if (!down_read_trylock(&cpufreq_rwsem))
+-              return NULL;
+-
+       /* get the cpufreq driver */
+       read_lock_irqsave(&cpufreq_driver_lock, flags);
+@@ -230,9 +221,6 @@ struct cpufreq_policy *cpufreq_cpu_get(u
+       read_unlock_irqrestore(&cpufreq_driver_lock, flags);
+-      if (!policy)
+-              up_read(&cpufreq_rwsem);
+-
+       return policy;
+ }
+ EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
+@@ -240,7 +228,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
+ void cpufreq_cpu_put(struct cpufreq_policy *policy)
+ {
+       kobject_put(&policy->kobj);
+-      up_read(&cpufreq_rwsem);
+ }
+ EXPORT_SYMBOL_GPL(cpufreq_cpu_put);
+@@ -765,9 +752,6 @@ static ssize_t show(struct kobject *kobj
+       struct freq_attr *fattr = to_attr(attr);
+       ssize_t ret;
+-      if (!down_read_trylock(&cpufreq_rwsem))
+-              return -EINVAL;
+-
+       down_read(&policy->rwsem);
+       if (fattr->show)
+@@ -776,7 +760,6 @@ static ssize_t show(struct kobject *kobj
+               ret = -EIO;
+       up_read(&policy->rwsem);
+-      up_read(&cpufreq_rwsem);
+       return ret;
+ }
+@@ -793,9 +776,6 @@ static ssize_t store(struct kobject *kob
+       if (!cpu_online(policy->cpu))
+               goto unlock;
+-      if (!down_read_trylock(&cpufreq_rwsem))
+-              goto unlock;
+-
+       down_write(&policy->rwsem);
+       if (fattr->store)
+@@ -804,8 +784,6 @@ static ssize_t store(struct kobject *kob
+               ret = -EIO;
+       up_write(&policy->rwsem);
+-
+-      up_read(&cpufreq_rwsem);
+ unlock:
+       put_online_cpus();
+@@ -1117,16 +1095,12 @@ static int __cpufreq_add_dev(struct devi
+       if (unlikely(policy))
+               return 0;
+-      if (!down_read_trylock(&cpufreq_rwsem))
+-              return 0;
+-
+       /* Check if this cpu was hot-unplugged earlier and has siblings */
+       read_lock_irqsave(&cpufreq_driver_lock, flags);
+       for_each_policy(policy) {
+               if (cpumask_test_cpu(cpu, policy->related_cpus)) {
+                       read_unlock_irqrestore(&cpufreq_driver_lock, flags);
+                       ret = cpufreq_add_policy_cpu(policy, cpu, dev);
+-                      up_read(&cpufreq_rwsem);
+                       return ret;
+               }
+       }
+@@ -1269,8 +1243,6 @@ static int __cpufreq_add_dev(struct devi
+       kobject_uevent(&policy->kobj, KOBJ_ADD);
+-      up_read(&cpufreq_rwsem);
+-
+       /* Callback for handling stuff after policy is ready */
+       if (cpufreq_driver->ready)
+               cpufreq_driver->ready(policy);
+@@ -1304,8 +1276,6 @@ static int __cpufreq_add_dev(struct devi
+       cpufreq_policy_free(policy);
+ nomem_out:
+-      up_read(&cpufreq_rwsem);
+-
+       return ret;
+ }
+@@ -2499,19 +2469,20 @@ int cpufreq_unregister_driver(struct cpu
+       pr_debug("unregistering driver %s\n", driver->name);
++      /* Protect against concurrent cpu hotplug */
++      get_online_cpus();
+       subsys_interface_unregister(&cpufreq_interface);
+       if (cpufreq_boost_supported())
+               cpufreq_sysfs_remove_file(&boost.attr);
+       unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
+-      down_write(&cpufreq_rwsem);
+       write_lock_irqsave(&cpufreq_driver_lock, flags);
+       cpufreq_driver = NULL;
+       write_unlock_irqrestore(&cpufreq_driver_lock, flags);
+-      up_write(&cpufreq_rwsem);
++      put_online_cpus();
+       return 0;
+ }
index d3322791bb4ff219fc4bcbf7930f4a788b351778..1149c8b97772ad8c25feaee03f3a8bb61194e154 100644 (file)
@@ -12,4 +12,4 @@ Link: http://lkml.kernel.org/n/tip-8vdw4bfcsds27cvox6rpb334@git.kernel.org
 --- /dev/null
 +++ b/localversion-rt
 @@ -0,0 +1 @@
-+-rt2
++-rt3
diff --git a/patches/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch b/patches/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch
new file mode 100644 (file)
index 0000000..6684931
--- /dev/null
@@ -0,0 +1,26 @@
+From: "Wolfgang M. Reimer" <linuxball@gmail.com>
+Date: Tue, 21 Jul 2015 16:20:07 +0200
+Subject: locking: locktorture: Do NOT include rwlock.h directly
+
+Including rwlock.h directly will cause kernel builds to fail
+if CONFIG_PREEMPT_RT_FULL is defined. The correct header file
+(rwlock_rt.h OR rwlock.h) will be included by spinlock.h which
+is included by locktorture.c anyway.
+
+Cc: stable-rt@vger.kernel.org
+Signed-off-by: Wolfgang M. Reimer <linuxball@gmail.com>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/locking/locktorture.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/kernel/locking/locktorture.c
++++ b/kernel/locking/locktorture.c
+@@ -24,7 +24,6 @@
+ #include <linux/module.h>
+ #include <linux/kthread.h>
+ #include <linux/spinlock.h>
+-#include <linux/rwlock.h>
+ #include <linux/mutex.h>
+ #include <linux/rwsem.h>
+ #include <linux/smp.h>
diff --git a/patches/pid.h-include-atomic.h.patch b/patches/pid.h-include-atomic.h.patch
new file mode 100644 (file)
index 0000000..8277468
--- /dev/null
@@ -0,0 +1,36 @@
+From: Grygorii Strashko <Grygorii.Strashko@linaro.org>
+Date: Tue, 21 Jul 2015 19:43:56 +0300
+Subject: wait.h: include atomic.h
+
+This patch fixes build error:
+  CC      kernel/pid_namespace.o
+In file included from kernel/pid_namespace.c:11:0:
+include/linux/pid.h: In function 'get_pid':
+include/linux/pid.h:78:3: error: implicit declaration of function 'atomic_inc' [-Werror=implicit-function-declaration]
+   atomic_inc(&pid->count);
+   ^
+which happens when
+ CONFIG_PROVE_LOCKING=n
+ CONFIG_DEBUG_SPINLOCK=n
+ CONFIG_DEBUG_MUTEXES=n
+ CONFIG_DEBUG_LOCK_ALLOC=n
+ CONFIG_PID_NS=y
+
+Vanilla gets this via spinlock.h.
+
+Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ include/linux/pid.h |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/include/linux/pid.h
++++ b/include/linux/pid.h
+@@ -2,6 +2,7 @@
+ #define _LINUX_PID_H
+ #include <linux/rcupdate.h>
++#include <linux/atomic.h>
+ enum pid_type
+ {
index 96745dc20015b3e390dbb5c49d8d5b3486eac93a..616e9bfc5e62b533ace665e9c060d65350f68640 100644 (file)
@@ -33,6 +33,7 @@ mm-slub-move-slab-initialization-into-irq-enabled-region.patch
 ############################################################
 # Stuff broken upstream, patches submitted
 ############################################################
+cpufreq-Remove-cpufreq_rwsem.patch
 
 ############################################################
 # Stuff which needs addressing upstream, but requires more
@@ -329,6 +330,8 @@ futex-requeue-pi-fix.patch
 0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch
 
 # RTMUTEX
+pid.h-include-atomic.h.patch
+locking-locktorture-Do-NOT-include-rwlock.h-directly.patch
 rtmutex-lock-killable.patch
 spinlock-types-separate-raw.patch
 rtmutex-avoid-include-hell.patch