From: "M. Koehrer" <mathias_koehrer@arcor.de>
To: linux-kernel@vger.kernel.org
Subject: Issue with clock_nanosleep(), TIMER_ABSTIME and CONFIG_CC_OPTIMIZE_FOR_SIZE not set
Date: Thu, 9 Apr 2009 10:22:05 +0200 (CEST) [thread overview]
Message-ID: <21685897.1239265325322.JavaMail.ngmail@webmail14.arcor-online.net> (raw)
Hi all!
I am using kernel 2.6.29.1 from kernel.org on a Debian 5.0 (Lenny) system (Intel Core2Quad).
GCC is 4.3.2
I have not set CONFIG_CC_OPT_SIZE.
When I use clock_nanosleep with TIMER_ABSTIME with gdb and stop the execution by CTRL-C,
I cannot continue the execution of my program when it interrupted the clock_nanosleep call.
When I set the kernel config parameter CONFIG_CC_OPT_SIZE everything is fine.
There seems to be an optimization issue that is related to the clock_nanosleep system call.
Some more remarks:
When I use relative times (mode set to 0) everything works fine in both cases.
CONFIG_TICK_ONESHOT=y
CONFIG_HIGH_RES_TIMERS=y
Here is my tiny test program that demonstrates the behaviour:
Let it run in gdb, interrupt it (CTRL-C) and try to continue "c".
***************** BEGIN ************************
#define _GNU_SOURCE
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <linux/unistd.h>
const clockid_t CLOCK_TO_USE=CLOCK_MONOTONIC;
static int clock_nanosleep2(clockid_t clock_id, int flags, const struct timespec *req,
struct timespec *rem)
{
return syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
}
int main(void)
{
int i;
struct timespec ts;
clock_gettime(CLOCK_TO_USE, &ts);
for (i=0; i<=1000; i++)
{
ts.tv_sec++;
clock_nanosleep2(CLOCK_TO_USE, TIMER_ABSTIME, &ts, NULL);
// clock_nanosleep(CLOCK_TO_USE, TIMER_ABSTIME, &ts, NULL);
printf("%i\n",i);
}
return 0;
}
/* Build with
gcc test_clock_nanosleep.c -g -Wall -lrt
*/
**************** END *******************
Thanks for all feedback on that issue
Regards
Mathias
--
Mathias Koehrer
mathias_koehrer@arcor.de
Zerreißen Sie die Netze der Phisher, Hacker und Betrüger!
Ihre Internet-Sicherheits-Seiten auf Arcor.de bieten alle Infos und Hilfsmittel, die Sie zum sicheren Surfen brauchen! Play it safe!
http://www.arcor.de/footer-sicherheit/
reply other threads:[~2009-04-09 8:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21685897.1239265325322.JavaMail.ngmail@webmail14.arcor-online.net \
--to=mathias_koehrer@arcor.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome