* [PATCH] fix timerfd support
@ 2016-05-03 8:45 Feng Li
2016-05-09 23:35 ` FUJITA Tomonori
0 siblings, 1 reply; 3+ messages in thread
From: Feng Li @ 2016-05-03 8:45 UTC (permalink / raw)
To: stgt, lifeng1519
From: vonnyfly <lifeng1519@gmail.com>
There are some exceptions when checking features in Makefile.
In my debian, timerfd.h path is not '/usr/include/sys/timerfd.h'.
$ find /usr/include -name "timerfd.h" | head -n1
/usr/include/x86_64-linux-gnu/sys/timerfd.h
In my raspberrypi, the path is also not here.
So, it will not enable timerfd, even though it supports actually.
When I enable it after fix. I have seen error logs.
"Failed to write to pipe".
From the code, we could know in add_work, it calls work_timer_schedule_evt.
work_timer_schedule_evt will call write(timer_fd[1], ...), then it will print error log,
because timer_fd[1] == -1.
When enable timerfd support, makefile check incorrectly.
work_timer_schedule_evt should check support of timerfd.
Signed-off-by: vonnyfly <lifeng1519@gmail.com>
---
usr/Makefile | 2 +-
usr/work.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/Makefile b/usr/Makefile
index 1fae7e7..d4e3eaf 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -5,7 +5,7 @@ ifneq ($(shell test -e /usr/include/linux/signalfd.h && echo 1),)
CFLAGS += -DUSE_SIGNALFD
endif
-ifneq ($(shell test -e /usr/include/sys/timerfd.h && echo 1),)
+ifneq ($(shell test -n $(shell find /usr/include -name "timerfd.h" | head -n1) && echo 1),)
CFLAGS += -DUSE_TIMERFD
endif
diff --git a/usr/work.c b/usr/work.c
index 6b9ec12..d760c22 100644
--- a/usr/work.c
+++ b/usr/work.c
@@ -59,7 +59,7 @@ static void work_timer_schedule_evt(void)
unsigned int n = 0;
int err;
- if (timer_pending)
+ if (timer_pending || timer_fd[1] < 0)
return;
timer_pending = 1;
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fix timerfd support
2016-05-03 8:45 [PATCH] fix timerfd support Feng Li
@ 2016-05-09 23:35 ` FUJITA Tomonori
2016-05-11 7:37 ` Alex Feng
0 siblings, 1 reply; 3+ messages in thread
From: FUJITA Tomonori @ 2016-05-09 23:35 UTC (permalink / raw)
To: li.feng; +Cc: stgt, lifeng1519
On Tue, 3 May 2016 16:45:38 +0800
Feng Li <li.feng@oracle.com> wrote:
> From: vonnyfly <lifeng1519@gmail.com>
>
> There are some exceptions when checking features in Makefile.
> In my debian, timerfd.h path is not '/usr/include/sys/timerfd.h'.
>
> $ find /usr/include -name "timerfd.h" | head -n1
> /usr/include/x86_64-linux-gnu/sys/timerfd.h
>
> In my raspberrypi, the path is also not here.
>
> So, it will not enable timerfd, even though it supports actually.
> When I enable it after fix. I have seen error logs.
> "Failed to write to pipe".
>
> From the code, we could know in add_work, it calls work_timer_schedule_evt.
> work_timer_schedule_evt will call write(timer_fd[1], ...), then it will print error log,
> because timer_fd[1] == -1.
Looks like with timerfd enabled, work_timer_schedule_evt() isn't
called. add_work() is always called with the non-zero second
argument. How you hit the above bug?
> When enable timerfd support, makefile check incorrectly.
> work_timer_schedule_evt should check support of timerfd.
>
> Signed-off-by: vonnyfly <lifeng1519@gmail.com>
> ---
> usr/Makefile | 2 +-
> usr/work.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix timerfd support
2016-05-09 23:35 ` FUJITA Tomonori
@ 2016-05-11 7:37 ` Alex Feng
0 siblings, 0 replies; 3+ messages in thread
From: Alex Feng @ 2016-05-11 7:37 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: stgt, lifeng1519
Hi Tomonori ,
Thanks for your response.
Please see my response inline.
On 2016/5/10 7:35, FUJITA Tomonori wrote:
> On Tue, 3 May 2016 16:45:38 +0800
> Feng Li <li.feng@oracle.com> wrote:
>
>> From: vonnyfly <lifeng1519@gmail.com>
>>
>> There are some exceptions when checking features in Makefile.
>> In my debian, timerfd.h path is not '/usr/include/sys/timerfd.h'.
>>
>> $ find /usr/include -name "timerfd.h" | head -n1
>> /usr/include/x86_64-linux-gnu/sys/timerfd.h
>>
>> In my raspberrypi, the path is also not here.
>>
>> So, it will not enable timerfd, even though it supports actually.
>> When I enable it after fix. I have seen error logs.
>> "Failed to write to pipe".
>>
>> From the code, we could know in add_work, it calls work_timer_schedule_evt.
>> work_timer_schedule_evt will call write(timer_fd[1], ...), then it will print error log,
>> because timer_fd[1] == -1.
> Looks like with timerfd enabled, work_timer_schedule_evt() isn't
> called. add_work() is always called with the non-zero second
> argument. How you hit the above bug?
The easiest way to see this log is to replace 'add_work(&nop_work, 1);'
to 'add_work(&nop_work, 0);'.
Like this:
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -438,7 +438,7 @@ static int iscsi_tcp_init(void)
nop_work.func = iscsi_tcp_nop_work_handler;
nop_work.data = &nop_work;
- add_work(&nop_work, 1);
+ add_work(&nop_work, 0);
tgtd: work_timer_schedule_evt(69) Failed to write to pipe, Bad file
descriptor
>
>> When enable timerfd support, makefile check incorrectly.
>> work_timer_schedule_evt should check support of timerfd.
>>
>> Signed-off-by: vonnyfly <lifeng1519@gmail.com>
>> ---
>> usr/Makefile | 2 +-
>> usr/work.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
> Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-11 7:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 8:45 [PATCH] fix timerfd support Feng Li
2016-05-09 23:35 ` FUJITA Tomonori
2016-05-11 7:37 ` Alex Feng
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).