* [GIT pull] timer updates for 3.4-rc
@ 2012-04-06 23:32 Thomas Gleixner
2012-04-06 23:37 ` David Rientjes
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2012-04-06 23:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, LKML
Linus,
please pull the latest timers-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-core-for-linus
Thanks,
tglx
------------------>
Martin Schwidefsky (1):
proc: stats: Use arch_idle_time for idle and iowait times if available
Sasikantha babu (1):
itimer: Schedule silent NULL pointer fixup in setitimer() for removal
Thomas Gleixner (1):
tick: Document TICK_ONESHOT config option
Documentation/feature-removal-schedule.txt | 8 ++++++
fs/proc/stat.c | 34 +++++++++++++++++++++++-----
kernel/itimer.c | 5 +++-
kernel/time/Kconfig | 4 +++
4 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 0cad480..32fae81 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -529,3 +529,11 @@ When: 3.5
Why: The old kmap_atomic() with two arguments is deprecated, we only
keep it for backward compatibility for few cycles and then drop it.
Who: Cong Wang <amwang@redhat.com>
+
+----------------------------
+
+What: setitimer accepts user NULL pointer (value)
+When: 3.6
+Why: setitimer is not returning -EFAULT if user pointer is NULL. This
+ violates the spec.
+Who: Sasikantha Babu <sasikanth.v19@gmail.com>
diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index 6a0c62d..64c3b31 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -18,19 +18,39 @@
#ifndef arch_irq_stat
#define arch_irq_stat() 0
#endif
-#ifndef arch_idle_time
-#define arch_idle_time(cpu) 0
-#endif
+
+#ifdef arch_idle_time
+
+static cputime64_t get_idle_time(int cpu)
+{
+ cputime64_t idle;
+
+ idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
+ if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
+ idle += arch_idle_time(cpu);
+ return idle;
+}
+
+static cputime64_t get_iowait_time(int cpu)
+{
+ cputime64_t iowait;
+
+ iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
+ if (cpu_online(cpu) && nr_iowait_cpu(cpu))
+ iowait += arch_idle_time(cpu);
+ return iowait;
+}
+
+#else
static u64 get_idle_time(int cpu)
{
u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL);
- if (idle_time == -1ULL) {
+ if (idle_time == -1ULL)
/* !NO_HZ so we can rely on cpustat.idle */
idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
- idle += arch_idle_time(cpu);
- } else
+ else
idle = usecs_to_cputime64(idle_time);
return idle;
@@ -49,6 +69,8 @@ static u64 get_iowait_time(int cpu)
return iowait;
}
+#endif
+
static int show_stat(struct seq_file *p, void *v)
{
int i, j;
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 22000c3..c70369a 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -284,8 +284,11 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
if (value) {
if(copy_from_user(&set_buffer, value, sizeof(set_buffer)))
return -EFAULT;
- } else
+ } else {
memset((char *) &set_buffer, 0, sizeof(set_buffer));
+ WARN_ONCE(1, "setitimer: new_value pointer is NULL."
+ " Misfeature support will be removed\n");
+ }
error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);
if (error || !ovalue)
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index 2cf9cc7..a20dc8a 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -1,6 +1,10 @@
#
# Timer subsystem related configuration options
#
+
+# Core internal switch. Selected by NO_HZ / HIGH_RES_TIMERS. This is
+# only related to the tick functionality. Oneshot clockevent devices
+# are supported independ of this.
config TICK_ONESHOT
bool
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [GIT pull] timer updates for 3.4-rc
2012-04-06 23:32 [GIT pull] timer updates for 3.4-rc Thomas Gleixner
@ 2012-04-06 23:37 ` David Rientjes
2012-04-06 23:48 ` Thomas Gleixner
0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2012-04-06 23:37 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Linus Torvalds, Andrew Morton, LKML
On Sat, 7 Apr 2012, Thomas Gleixner wrote:
> diff --git a/kernel/itimer.c b/kernel/itimer.c
> index 22000c3..c70369a 100644
> --- a/kernel/itimer.c
> +++ b/kernel/itimer.c
> @@ -284,8 +284,11 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
> if (value) {
> if(copy_from_user(&set_buffer, value, sizeof(set_buffer)))
> return -EFAULT;
> - } else
> + } else {
> memset((char *) &set_buffer, 0, sizeof(set_buffer));
> + WARN_ONCE(1, "setitimer: new_value pointer is NULL."
> + " Misfeature support will be removed\n");
> + }
>
> error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);
> if (error || !ovalue)
When I tried doing this for the deprecated /proc/pid/oom_adj there was a
complaint that WARN_ONCE() screws up log parsing scripts that think there
is a kernel issue so I had to change it to printk_once() and include
get_task_comm(current) and current->pid. See
http://lkml.indiana.edu/hypermail/linux/kernel/1108.0/00446.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [GIT pull] timer updates for 3.4-rc
2012-04-06 23:37 ` David Rientjes
@ 2012-04-06 23:48 ` Thomas Gleixner
2012-04-06 23:58 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2012-04-06 23:48 UTC (permalink / raw)
To: David Rientjes; +Cc: Linus Torvalds, Andrew Morton, LKML
On Fri, 6 Apr 2012, David Rientjes wrote:
> On Sat, 7 Apr 2012, Thomas Gleixner wrote:
>
> > diff --git a/kernel/itimer.c b/kernel/itimer.c
> > index 22000c3..c70369a 100644
> > --- a/kernel/itimer.c
> > +++ b/kernel/itimer.c
> > @@ -284,8 +284,11 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
> > if (value) {
> > if(copy_from_user(&set_buffer, value, sizeof(set_buffer)))
> > return -EFAULT;
> > - } else
> > + } else {
> > memset((char *) &set_buffer, 0, sizeof(set_buffer));
> > + WARN_ONCE(1, "setitimer: new_value pointer is NULL."
> > + " Misfeature support will be removed\n");
> > + }
> >
> > error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);
> > if (error || !ovalue)
>
> When I tried doing this for the deprecated /proc/pid/oom_adj there was a
> complaint that WARN_ONCE() screws up log parsing scripts that think there
> is a kernel issue so I had to change it to printk_once() and include
> get_task_comm(current) and current->pid. See
> http://lkml.indiana.edu/hypermail/linux/kernel/1108.0/00446.html
Bah.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [GIT pull] timer updates for 3.4-rc
2012-04-06 23:48 ` Thomas Gleixner
@ 2012-04-06 23:58 ` Andrew Morton
2012-04-06 23:59 ` Thomas Gleixner
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2012-04-06 23:58 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: David Rientjes, Linus Torvalds, LKML
On Sat, 7 Apr 2012 01:48:51 +0200 (CEST)
Thomas Gleixner <tglx@linutronix.de> wrote:
> On Fri, 6 Apr 2012, David Rientjes wrote:
>
> > On Sat, 7 Apr 2012, Thomas Gleixner wrote:
> >
> > > diff --git a/kernel/itimer.c b/kernel/itimer.c
> > > index 22000c3..c70369a 100644
> > > --- a/kernel/itimer.c
> > > +++ b/kernel/itimer.c
> > > @@ -284,8 +284,11 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
> > > if (value) {
> > > if(copy_from_user(&set_buffer, value, sizeof(set_buffer)))
> > > return -EFAULT;
> > > - } else
> > > + } else {
> > > memset((char *) &set_buffer, 0, sizeof(set_buffer));
> > > + WARN_ONCE(1, "setitimer: new_value pointer is NULL."
> > > + " Misfeature support will be removed\n");
> > > + }
> > >
> > > error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);
> > > if (error || !ovalue)
> >
> > When I tried doing this for the deprecated /proc/pid/oom_adj there was a
> > complaint that WARN_ONCE() screws up log parsing scripts that think there
> > is a kernel issue so I had to change it to printk_once() and include
> > get_task_comm(current) and current->pid. See
> > http://lkml.indiana.edu/hypermail/linux/kernel/1108.0/00446.html
>
> Bah.
It gives you a chance to remove the unneeded cast from the memset call ;)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [GIT pull] timer updates for 3.4-rc
2012-04-06 23:58 ` Andrew Morton
@ 2012-04-06 23:59 ` Thomas Gleixner
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2012-04-06 23:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: David Rientjes, Linus Torvalds, LKML
On Fri, 6 Apr 2012, Andrew Morton wrote:
> On Sat, 7 Apr 2012 01:48:51 +0200 (CEST)
> Thomas Gleixner <tglx@linutronix.de> wrote:
>
> > On Fri, 6 Apr 2012, David Rientjes wrote:
> >
> > > On Sat, 7 Apr 2012, Thomas Gleixner wrote:
> > >
> > > > diff --git a/kernel/itimer.c b/kernel/itimer.c
> > > > index 22000c3..c70369a 100644
> > > > --- a/kernel/itimer.c
> > > > +++ b/kernel/itimer.c
> > > > @@ -284,8 +284,11 @@ SYSCALL_DEFINE3(setitimer, int, which, struct itimerval __user *, value,
> > > > if (value) {
> > > > if(copy_from_user(&set_buffer, value, sizeof(set_buffer)))
> > > > return -EFAULT;
> > > > - } else
> > > > + } else {
> > > > memset((char *) &set_buffer, 0, sizeof(set_buffer));
> > > > + WARN_ONCE(1, "setitimer: new_value pointer is NULL."
> > > > + " Misfeature support will be removed\n");
> > > > + }
> > > >
> > > > error = do_setitimer(which, &set_buffer, ovalue ? &get_buffer : NULL);
> > > > if (error || !ovalue)
> > >
> > > When I tried doing this for the deprecated /proc/pid/oom_adj there was a
> > > complaint that WARN_ONCE() screws up log parsing scripts that think there
> > > is a kernel issue so I had to change it to printk_once() and include
> > > get_task_comm(current) and current->pid. See
> > > http://lkml.indiana.edu/hypermail/linux/kernel/1108.0/00446.html
> >
> > Bah.
>
> It gives you a chance to remove the unneeded cast from the memset call ;)
Will do :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-06 23:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06 23:32 [GIT pull] timer updates for 3.4-rc Thomas Gleixner
2012-04-06 23:37 ` David Rientjes
2012-04-06 23:48 ` Thomas Gleixner
2012-04-06 23:58 ` Andrew Morton
2012-04-06 23:59 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox