linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* setitimer() doesn't work properly starting with 4.8-rc1
@ 2016-08-17 19:01 Andrei Vagin
  2016-08-17 19:22 ` Andrei Vagin
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Vagin @ 2016-08-17 19:01 UTC (permalink / raw)
  To: Thomas Gleixner, LKML

[-- Attachment #1: Type: text/plain, Size: 3027 bytes --]

Hello,

I found that setitimer() doesn't work properly on out test AMD fitlet.
It works correctly in the 4.7 kernel and doesn't work in 4.8-rc1.

A small test is attached to this message.

[root@usr-LAN-dhcp-38 ~]# uname -a
Linux usr-LAN-dhcp-38.99.sw.ru 4.8.0-0.rc2.git1.1.fc25.x86_64 #1 SMP
Tue Aug 16 22:08:16 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@usr-LAN-dhcp-38 ~]# strace ./test-timers
...
rt_sigaction(SIGVTALRM, {0x400606, [VTALRM], SA_RESTORER|SA_RESTART,
0x7f51e0d67770}, {SIG_DFL, [], 0}, 8) = 0
setitimer(ITIMER_VIRTUAL, {it_interval={0, 100000}, it_value={0,
100}}, NULL) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

We can see that a test didn't get any signals. When timers works, this
output looks like this:
rt_sigaction(SIGALRM, {0x400606, [ALRM], SA_RESTORER|SA_RESTART,
0x7f9e21b1b770}, {SIG_DFL, [], 0}, 8) = 0
setitimer(ITIMER_REAL, {it_interval={0, 100000}, it_value={0, 100}}, NULL) = 0
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 6295208
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 0
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1471459909
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---


Only ITIMER_PROF and ITIMER_VIRTUAL doesn't work properly. ITIMER_REAL
works as expected.

[root@usr-LAN-dhcp-38 ~]# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 22
model : 48
model name : AMD A10 Micro-6700T APU+AMD Radeon R6 Graphics
stepping : 1
microcode : 0x7030105
cpu MHz : 1000.000
cache size : 2048 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt
pdpe1gb rdtscp lm constant_tsc rep_good acc_power nopl nonstop_tsc
extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 cx16
sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm
cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch
osvw ibs skinit wdt topoext perfctr_nb bpext ptsc perfctr_l2 cpb
hw_pstate vmmcall bmi1 xsaveopt arat npt lbrv svm_lock nrip_save
tsc_scale flushbyasid decodeassists pausefilter pfthreshold
overflow_recov
bugs : fxsave_leak sysret_ss_attrs null_seg
bogomips : 2395.40
TLB size : 1024 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb acc_power [13]

This problem was caught by criu tests:
https://github.com/xemul/criu/issues/200

Thanks,
Andrei

[-- Attachment #2: test-timers.c --]
[-- Type: text/x-csrc, Size: 811 bytes --]

#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>

static struct {
	const int timer_type;
	const int signal;
	volatile sig_atomic_t count;
} timer_tests[] = {	/* from slowest to fastest */
	{ ITIMER_VIRTUAL,	SIGVTALRM	},
	{ ITIMER_PROF,		SIGPROF		},
	{ ITIMER_REAL,		SIGALRM		},
};

static int count;
static void timer_tick(int sig)
{
	count++;
}

int main()
{
	struct itimerval tv = {
		.it_interval = {
			.tv_sec = 0,
			.tv_usec = 100000
		},
		.it_value = {
			.tv_sec = 0,
			.tv_usec = 100
		},
	};
	int i = 0;
	time_t start;

	if (signal(timer_tests[i].signal, timer_tick) == SIG_ERR)
		exit(1);

	if (setitimer(timer_tests[i].timer_type, &tv, NULL) < 0)
		exit(1);

	start = time(NULL);
	for (;;)
		if (time(NULL) - start > 10)
			break;

	return 0;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: setitimer() doesn't work properly starting with 4.8-rc1
  2016-08-17 19:01 setitimer() doesn't work properly starting with 4.8-rc1 Andrei Vagin
@ 2016-08-17 19:22 ` Andrei Vagin
  2016-08-24  8:48   ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Vagin @ 2016-08-17 19:22 UTC (permalink / raw)
  To: Thomas Gleixner, LKML

On Wed, Aug 17, 2016 at 12:01 PM, Andrei Vagin <avagin@gmail.com> wrote:
> Hello,
>
> I found that setitimer() doesn't work properly on out test AMD fitlet.
> It works correctly in the 4.7 kernel and doesn't work in 4.8-rc1.
>
> A small test is attached to this message.
>
> [root@usr-LAN-dhcp-38 ~]# uname -a
> Linux usr-LAN-dhcp-38.99.sw.ru 4.8.0-0.rc2.git1.1.fc25.x86_64 #1 SMP
> Tue Aug 16 22:08:16 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
> [root@usr-LAN-dhcp-38 ~]# strace ./test-timers
> ...
> rt_sigaction(SIGVTALRM, {0x400606, [VTALRM], SA_RESTORER|SA_RESTART,
> 0x7f51e0d67770}, {SIG_DFL, [], 0}, 8) = 0
> setitimer(ITIMER_VIRTUAL, {it_interval={0, 100000}, it_value={0,
> 100}}, NULL) = 0
> exit_group(0)                           = ?
> +++ exited with 0 +++

One more interesting thing is how cpu time is accounted. The test is
running in a busy loop for 10 seconds, but the user time is zero and
everything is accounted to the system time.

[root@usr-LAN-dhcp-38 ~]# time ./test-timers

real 0m10.959s
user 0m0.000s
sys 0m10.682s


>
> We can see that a test didn't get any signals. When timers works, this
> output looks like this:
> rt_sigaction(SIGALRM, {0x400606, [ALRM], SA_RESTORER|SA_RESTART,
> 0x7f9e21b1b770}, {SIG_DFL, [], 0}, 8) = 0
> setitimer(ITIMER_REAL, {it_interval={0, 100000}, it_value={0, 100}}, NULL) = 0
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> rt_sigreturn({mask=[]})                 = 6295208
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> rt_sigreturn({mask=[]})                 = 0
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> rt_sigreturn({mask=[]})                 = 1
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> rt_sigreturn({mask=[]})                 = 1
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> rt_sigreturn({mask=[]})                 = 1471459909
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> rt_sigreturn({mask=[]})                 = 1
> --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
>
>
> Only ITIMER_PROF and ITIMER_VIRTUAL doesn't work properly. ITIMER_REAL
> works as expected.
>
> [root@usr-LAN-dhcp-38 ~]# cat /proc/cpuinfo
> processor : 0
> vendor_id : AuthenticAMD
> cpu family : 22
> model : 48
> model name : AMD A10 Micro-6700T APU+AMD Radeon R6 Graphics
> stepping : 1
> microcode : 0x7030105
> cpu MHz : 1000.000
> cache size : 2048 KB
> physical id : 0
> siblings : 4
> core id : 0
> cpu cores : 4
> apicid : 0
> initial apicid : 0
> fpu : yes
> fpu_exception : yes
> cpuid level : 13
> wp : yes
> flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
> pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt
> pdpe1gb rdtscp lm constant_tsc rep_good acc_power nopl nonstop_tsc
> extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 cx16
> sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm
> cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch
> osvw ibs skinit wdt topoext perfctr_nb bpext ptsc perfctr_l2 cpb
> hw_pstate vmmcall bmi1 xsaveopt arat npt lbrv svm_lock nrip_save
> tsc_scale flushbyasid decodeassists pausefilter pfthreshold
> overflow_recov
> bugs : fxsave_leak sysret_ss_attrs null_seg
> bogomips : 2395.40
> TLB size : 1024 4K pages
> clflush size : 64
> cache_alignment : 64
> address sizes : 40 bits physical, 48 bits virtual
> power management: ts ttp tm 100mhzsteps hwpstate cpb acc_power [13]
>
> This problem was caught by criu tests:
> https://github.com/xemul/criu/issues/200
>
> Thanks,
> Andrei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: setitimer() doesn't work properly starting with 4.8-rc1
  2016-08-17 19:22 ` Andrei Vagin
@ 2016-08-24  8:48   ` Thomas Gleixner
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2016-08-24  8:48 UTC (permalink / raw)
  To: Andrei Vagin; +Cc: LKML, Peter Zijlstra, Wanpeng Li, Ingo Molnar

On Wed, 17 Aug 2016, Andrei Vagin wrote:

Cc'ing scheduler folks.

> On Wed, Aug 17, 2016 at 12:01 PM, Andrei Vagin <avagin@gmail.com> wrote:
> > Hello,
> >
> > I found that setitimer() doesn't work properly on out test AMD fitlet.
> > It works correctly in the 4.7 kernel and doesn't work in 4.8-rc1.
> >
> > A small test is attached to this message.
> >
> > [root@usr-LAN-dhcp-38 ~]# uname -a
> > Linux usr-LAN-dhcp-38.99.sw.ru 4.8.0-0.rc2.git1.1.fc25.x86_64 #1 SMP
> > Tue Aug 16 22:08:16 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
> > [root@usr-LAN-dhcp-38 ~]# strace ./test-timers
> > ...
> > rt_sigaction(SIGVTALRM, {0x400606, [VTALRM], SA_RESTORER|SA_RESTART,
> > 0x7f51e0d67770}, {SIG_DFL, [], 0}, 8) = 0
> > setitimer(ITIMER_VIRTUAL, {it_interval={0, 100000}, it_value={0,
> > 100}}, NULL) = 0
> > exit_group(0)                           = ?
> > +++ exited with 0 +++
> 
> One more interesting thing is how cpu time is accounted. The test is
> running in a busy loop for 10 seconds, but the user time is zero and
> everything is accounted to the system time.
> 
> [root@usr-LAN-dhcp-38 ~]# time ./test-timers
> 
> real 0m10.959s
> user 0m0.000s
> sys 0m10.682s
> 
> 
> >
> > We can see that a test didn't get any signals. When timers works, this
> > output looks like this:
> > rt_sigaction(SIGALRM, {0x400606, [ALRM], SA_RESTORER|SA_RESTART,
> > 0x7f9e21b1b770}, {SIG_DFL, [], 0}, 8) = 0
> > setitimer(ITIMER_REAL, {it_interval={0, 100000}, it_value={0, 100}}, NULL) = 0
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> > rt_sigreturn({mask=[]})                 = 6295208
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> > rt_sigreturn({mask=[]})                 = 0
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> > rt_sigreturn({mask=[]})                 = 1
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> > rt_sigreturn({mask=[]})                 = 1
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> > rt_sigreturn({mask=[]})                 = 1471459909
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> > rt_sigreturn({mask=[]})                 = 1
> > --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
> >
> >
> > Only ITIMER_PROF and ITIMER_VIRTUAL doesn't work properly. ITIMER_REAL
> > works as expected.
> >
> > [root@usr-LAN-dhcp-38 ~]# cat /proc/cpuinfo
> > processor : 0
> > vendor_id : AuthenticAMD
> > cpu family : 22
> > model : 48
> > model name : AMD A10 Micro-6700T APU+AMD Radeon R6 Graphics
> > stepping : 1
> > microcode : 0x7030105
> > cpu MHz : 1000.000
> > cache size : 2048 KB
> > physical id : 0
> > siblings : 4
> > core id : 0
> > cpu cores : 4
> > apicid : 0
> > initial apicid : 0
> > fpu : yes
> > fpu_exception : yes
> > cpuid level : 13
> > wp : yes
> > flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
> > pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt
> > pdpe1gb rdtscp lm constant_tsc rep_good acc_power nopl nonstop_tsc
> > extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 cx16
> > sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm
> > cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch
> > osvw ibs skinit wdt topoext perfctr_nb bpext ptsc perfctr_l2 cpb
> > hw_pstate vmmcall bmi1 xsaveopt arat npt lbrv svm_lock nrip_save
> > tsc_scale flushbyasid decodeassists pausefilter pfthreshold
> > overflow_recov
> > bugs : fxsave_leak sysret_ss_attrs null_seg
> > bogomips : 2395.40
> > TLB size : 1024 4K pages
> > clflush size : 64
> > cache_alignment : 64
> > address sizes : 40 bits physical, 48 bits virtual
> > power management: ts ttp tm 100mhzsteps hwpstate cpb acc_power [13]
> >
> > This problem was caught by criu tests:
> > https://github.com/xemul/criu/issues/200
> >
> > Thanks,
> > Andrei
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-24  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-17 19:01 setitimer() doesn't work properly starting with 4.8-rc1 Andrei Vagin
2016-08-17 19:22 ` Andrei Vagin
2016-08-24  8:48   ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).