linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/4] timerfd c/r support, v4
@ 2014-06-23 18:54 Cyrill Gorcunov
  2014-06-23 18:54 ` [patch 1/4] timerfd: Implement show_fdinfo method Cyrill Gorcunov
                   ` (5 more replies)
  0 siblings, 6 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-23 18:54 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov

Hi guys, here is an updated version of c/r support for timerfd files. The main change
is in how @ticks are restored in patch 3 -- I switched to ioctl code, which is wrapped
with CONFIG because I still think that while there is only one ioctl designated
solely for c/r needs no need to build it all the time until explicitly requested.
Please take a look once time permit. Comments are highly appreciated.
Also note the last patch is for man-page git repo, not for kernel.

Thanks!

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

* [patch 1/4] timerfd: Implement show_fdinfo method
  2014-06-23 18:54 [patch 0/4] timerfd c/r support, v4 Cyrill Gorcunov
@ 2014-06-23 18:54 ` Cyrill Gorcunov
       [not found]   ` <20140623190345.354980826-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
  2014-06-23 18:54 ` [patch 2/4] docs: procfs -- Document timerfd output Cyrill Gorcunov
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-23 18:54 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov, Cyrill Gorcunov

[-- Attachment #1: timerfd-show-fdinfo-4 --]
[-- Type: text/plain, Size: 3046 bytes --]

For checkpoint/restore of timerfd files we need to know how exactly
the timer were armed, to be able to recreate it on restore stage.
Thus implement show_fdinfo method which provides enough information
for that.

One of significant changes I think is the addition of @settime_flags
member. Currently there are two flags TFD_TIMER_ABSTIME and
TFD_TIMER_CANCEL_ON_SET, and the second can be found from
@might_cancel variable but in case if the flags will be extended
in future we most probably will have to somehow remember them
explicitly anyway so I guss doing that right now won't hurt.

To not bloat the timerfd_ctx structure I've converted @expired
to short integer and defined @settime_flags as short too.

v2 (by avagin@, vdavydov@ and tglx@):

 - Add it_value/it_interval fields
 - Save flags being used in timerfd_setup in context

v3 (by tglx@):
 - don't forget to use CONFIG_PROC_FS

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Andrey Vagin <avagin@openvz.org>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 fs/timerfd.c |   34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

Index: linux-2.6.git/fs/timerfd.c
===================================================================
--- linux-2.6.git.orig/fs/timerfd.c
+++ linux-2.6.git/fs/timerfd.c
@@ -35,8 +35,9 @@ struct timerfd_ctx {
 	ktime_t moffs;
 	wait_queue_head_t wqh;
 	u64 ticks;
-	int expired;
 	int clockid;
+	short unsigned expired;
+	short unsigned settime_flags;	/* to show in fdinfo */
 	struct rcu_head rcu;
 	struct list_head clist;
 	bool might_cancel;
@@ -196,6 +197,8 @@ static int timerfd_setup(struct timerfd_
 		if (timerfd_canceled(ctx))
 			return -ECANCELED;
 	}
+
+	ctx->settime_flags = flags & TFD_SETTIME_FLAGS;
 	return 0;
 }
 
@@ -284,11 +287,40 @@ static ssize_t timerfd_read(struct file
 	return res;
 }
 
+#ifdef CONFIG_PROC_FS
+static int timerfd_show(struct seq_file *m, struct file *file)
+{
+	struct timerfd_ctx *ctx = file->private_data;
+	struct itimerspec t;
+
+	spin_lock_irq(&ctx->wqh.lock);
+	t.it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
+	t.it_interval = ktime_to_timespec(ctx->tintv);
+	spin_unlock_irq(&ctx->wqh.lock);
+
+	return seq_printf(m,
+			  "clockid: %d\n"
+			  "ticks: %llu\n"
+			  "settime flags: 0%o\n"
+			  "it_value: (%llu, %llu)\n"
+			  "it_interval: (%llu, %llu)\n",
+			  ctx->clockid, (unsigned long long)ctx->ticks,
+			  ctx->settime_flags,
+			  (unsigned long long)t.it_value.tv_sec,
+			  (unsigned long long)t.it_value.tv_nsec,
+			  (unsigned long long)t.it_interval.tv_sec,
+			  (unsigned long long)t.it_interval.tv_nsec);
+}
+#endif
+
 static const struct file_operations timerfd_fops = {
 	.release	= timerfd_release,
 	.poll		= timerfd_poll,
 	.read		= timerfd_read,
 	.llseek		= noop_llseek,
+#ifdef CONFIG_PROC_FS
+	.show_fdinfo	= timerfd_show,
+#endif
 };
 
 static int timerfd_fget(int fd, struct fd *p)

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

* [patch 2/4] docs: procfs -- Document timerfd output
  2014-06-23 18:54 [patch 0/4] timerfd c/r support, v4 Cyrill Gorcunov
  2014-06-23 18:54 ` [patch 1/4] timerfd: Implement show_fdinfo method Cyrill Gorcunov
@ 2014-06-23 18:54 ` Cyrill Gorcunov
  2014-06-23 18:54 ` [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks Cyrill Gorcunov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-23 18:54 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov, Cyrill Gorcunov

[-- Attachment #1: timerfd-doc-fdinfo --]
[-- Type: text/plain, Size: 1576 bytes --]

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Andrey Vagin <avagin@openvz.org>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 Documentation/filesystems/proc.txt |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Index: linux-2.6.git/Documentation/filesystems/proc.txt
===================================================================
--- linux-2.6.git.orig/Documentation/filesystems/proc.txt
+++ linux-2.6.git/Documentation/filesystems/proc.txt
@@ -1743,6 +1743,25 @@ pair provide additional information part
 	While the first three lines are mandatory and always printed, the rest is
 	optional and may be omitted if no marks created yet.
 
+	Timerfd files
+	~~~~~~~~~~~~~
+
+	pos:	0
+	flags:	02
+	mnt_id:	9
+	clockid: 0
+	ticks: 0
+	settime flags: 01
+	it_value: (0, 49406829)
+	it_interval: (1, 0)
+
+	where 'clockid' is the clock type and 'ticks' is the number of the timer expirations
+	that have occurred [see timerfd_create(2) for details]. 'settime flags' are
+	flags in octal form been used to setup the timer [see timerfd_settime(2) for
+	details]. 'it_value' is remaining time until the timer exiration.
+	'it_interval' is the interval for the timer. Note the timer might be set up
+	with TIMER_ABSTIME option which will be shown in 'settime flags', but 'it_value'
+	still exhibits timer's remaining time.
 
 ------------------------------------------------------------------------------
 Configuring procfs

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

* [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
  2014-06-23 18:54 [patch 0/4] timerfd c/r support, v4 Cyrill Gorcunov
  2014-06-23 18:54 ` [patch 1/4] timerfd: Implement show_fdinfo method Cyrill Gorcunov
  2014-06-23 18:54 ` [patch 2/4] docs: procfs -- Document timerfd output Cyrill Gorcunov
@ 2014-06-23 18:54 ` Cyrill Gorcunov
       [not found]   ` <20140623190345.499956567-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
  2014-06-23 18:54 ` [patch 4/4] timerfd.2: Add ioctl method description Cyrill Gorcunov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-23 18:54 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov, Cyrill Gorcunov

[-- Attachment #1: timerfd-ticks-ioctl-3 --]
[-- Type: text/plain, Size: 3043 bytes --]

The read() of timerfd files allows to fetch the number of timer ticks
while there is no way to set it back from userspace.

To restore the timer's state as it was at checkpoint moment we need
a path to bring @ticks back. Initially I thought about writing ticks
back via write() interface but it seems such API is somehow obscure.

Instead implement timerfd_ioctl() method with TFD_IOC_SET_TICKS
command which allows to adjust @ticks into non-zero value waking
up the waiters. The reason to forbid from 

I wrapped code with CONFIG_CHECKPOINT_RESTORE which can be
dropped off if there users except c/r camp appear.

CC: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
CC: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
CC: Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
CC: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Signed-off-by: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
---
 fs/timerfd.c            |   37 +++++++++++++++++++++++++++++++++++++
 include/linux/timerfd.h |    5 +++++
 2 files changed, 42 insertions(+)

Index: linux-2.6.git/fs/timerfd.c
===================================================================
--- linux-2.6.git.orig/fs/timerfd.c
+++ linux-2.6.git/fs/timerfd.c
@@ -313,11 +313,48 @@ static int timerfd_show(struct seq_file
 }
 #endif
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	struct timerfd_ctx *ctx = file->private_data;
+	int ret = 0;
+
+	switch (cmd) {
+	case TFD_IOC_SET_TICKS: {
+		u64 ticks;
+
+		if (get_user(ticks, (u64 __user *)arg))
+			return -EFAULT;
+		if (!ticks)
+			return -EINVAL;
+
+		spin_lock_irq(&ctx->wqh.lock);
+		if (!timerfd_canceled(ctx)) {
+			ctx->ticks = ticks;
+			if (ticks)
+				wake_up_locked(&ctx->wqh);
+		} else
+			ret = -ECANCELED;
+		spin_unlock_irq(&ctx->wqh.lock);
+		break;
+	}
+	default:
+		ret = -ENOTTY;
+		break;
+	}
+
+	return ret;
+}
+#endif
+
 static const struct file_operations timerfd_fops = {
 	.release	= timerfd_release,
 	.poll		= timerfd_poll,
 	.read		= timerfd_read,
 	.llseek		= noop_llseek,
+#ifdef CONFIG_CHECKPOINT_RESTORE
+	.unlocked_ioctl	= timerfd_ioctl,
+#endif
 #ifdef CONFIG_PROC_FS
 	.show_fdinfo	= timerfd_show,
 #endif
Index: linux-2.6.git/include/linux/timerfd.h
===================================================================
--- linux-2.6.git.orig/include/linux/timerfd.h
+++ linux-2.6.git/include/linux/timerfd.h
@@ -11,6 +11,9 @@
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
 
+/* For _IO helpers */
+#include <linux/ioctl.h>
+
 /*
  * CAREFUL: Check include/asm-generic/fcntl.h when defining
  * new flags, since they might collide with O_* ones. We want
@@ -29,4 +32,6 @@
 /* Flags for timerfd_settime.  */
 #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
 
+#define TFD_IOC_SET_TICKS	_IOW('T', 0, u64)
+
 #endif /* _LINUX_TIMERFD_H */

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

* [patch 4/4] timerfd.2: Add ioctl method description
  2014-06-23 18:54 [patch 0/4] timerfd c/r support, v4 Cyrill Gorcunov
                   ` (2 preceding siblings ...)
  2014-06-23 18:54 ` [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks Cyrill Gorcunov
@ 2014-06-23 18:54 ` Cyrill Gorcunov
       [not found] ` <20140623185431.396309193-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
  2014-06-30 19:43 ` Cyrill Gorcunov
  5 siblings, 0 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-23 18:54 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov, Cyrill Gorcunov

[-- Attachment #1: timerfd-man --]
[-- Type: text/plain, Size: 1806 bytes --]

ioctl(2)
	The following commands are supported: TFD_IOC_SET_TICKS to adjust
	the number of the timer expirations that have occurred.
	It take a pointer to nonzero 8-byte integer (uint64_t*) containing
	new number of expirations. Once the number is set any waiter on
	the timer is woken up. The only purpose of this command is to restore
	the expirations in a sake of checkpoint/restore procedure.
	It requires the kernel to be built with CONFIG_CHECKPOINT_RESTORE
	support.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Michael Kerrisk <mtk.manpages@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Andrey Vagin <avagin@openvz.org>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Vladimir Davydov <vdavydov@parallels.com>
CC: linux-api@vger.kernel.org
---
 man2/timerfd_create.2 |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: man-pages/man2/timerfd_create.2
===================================================================
--- man-pages.orig/man2/timerfd_create.2
+++ man-pages/man2/timerfd_create.2
@@ -260,6 +260,20 @@ multiplexing APIs:
 and
 .BR epoll (7).
 .TP
+.BR ioctl "(2)"
+The following commands are supported:
+.B TFD_IOC_SET_TICKS
+to adjust the number of the timer expirations that have occurred.
+It take a pointer to nonzero 8-byte integer
+.RI ( uint64_t *)
+containing the new number of expirations.
+Once the number is set any waiter on the timer is woken up.
+The only purpose of this command is to restore the expirations
+in a sake of checkpoint/restore procedure.
+It requires the kernel to be built with
+.BR CONFIG_CHECKPOINT_RESTORE
+support.
+.TP
 .BR close (2)
 When the file descriptor is no longer required it should be closed.
 When all file descriptors associated with the same timer object

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

* Re: [patch 0/4] timerfd c/r support, v4
       [not found] ` <20140623185431.396309193-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2014-06-23 19:44   ` Andrew Vagin
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew Vagin @ 2014-06-23 19:44 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk,
	Thomas Gleixner, Andrew Morton, Andrey Vagin, Pavel Emelyanov,
	Vladimir Davydov

On Mon, Jun 23, 2014 at 10:54:31PM +0400, Cyrill Gorcunov wrote:
> Hi guys, here is an updated version of c/r support for timerfd files. The main change
> is in how @ticks are restored in patch 3 -- I switched to ioctl code, which is wrapped
> with CONFIG because I still think that while there is only one ioctl designated
> solely for c/r needs no need to build it all the time until explicitly requested.
> Please take a look once time permit. Comments are highly appreciated.
> Also note the last patch is for man-page git repo, not for kernel.
> 
> Thanks!

Acked-by: Andrew Vagin <avagin-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>

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

* [patch 1/4] timerfd: Implement show_fdinfo method
       [not found]   ` <20140623190345.354980826-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2014-06-24 22:02     ` Cyrill Gorcunov
  0 siblings, 0 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-24 22:02 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov

For checkpoint/restore of timerfd files we need to know how exactly
the timer were armed, to be able to recreate it on restore stage.
Thus implement show_fdinfo method which provides enough information
for that.

One of significant changes I think is the addition of @settime_flags
member. Currently there are two flags TFD_TIMER_ABSTIME and
TFD_TIMER_CANCEL_ON_SET, and the second can be found from
@might_cancel variable but in case if the flags will be extended
in future we most probably will have to somehow remember them
explicitly anyway so I guss doing that right now won't hurt.

To not bloat the timerfd_ctx structure I've converted @expired
to short integer and defined @settime_flags as short too.

v2 (by avagin@, vdavydov@ and tglx@):

 - Add it_value/it_interval fields
 - Save flags being used in timerfd_setup in context

v3 (by tglx@):
 - don't forget to use CONFIG_PROC_FS

v4 (by akpm@):
 -Use define timerfd_show NULL for non c/r config

CC: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
CC: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
CC: Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
CC: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Signed-off-by: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
---

A nit fixed in timerfd_show for non c/r config

 fs/timerfd.c |   34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

Index: linux-2.6.git/fs/timerfd.c
===================================================================
--- linux-2.6.git.orig/fs/timerfd.c
+++ linux-2.6.git/fs/timerfd.c
@@ -35,8 +35,9 @@ struct timerfd_ctx {
 	ktime_t moffs;
 	wait_queue_head_t wqh;
 	u64 ticks;
-	int expired;
 	int clockid;
+	short unsigned expired;
+	short unsigned settime_flags;	/* to show in fdinfo */
 	struct rcu_head rcu;
 	struct list_head clist;
 	bool might_cancel;
@@ -196,6 +197,8 @@ static int timerfd_setup(struct timerfd_
 		if (timerfd_canceled(ctx))
 			return -ECANCELED;
 	}
+
+	ctx->settime_flags = flags & TFD_SETTIME_FLAGS;
 	return 0;
 }
 
@@ -284,11 +287,40 @@ static ssize_t timerfd_read(struct file
 	return res;
 }
 
+#ifdef CONFIG_PROC_FS
+static int timerfd_show(struct seq_file *m, struct file *file)
+{
+	struct timerfd_ctx *ctx = file->private_data;
+	struct itimerspec t;
+
+	spin_lock_irq(&ctx->wqh.lock);
+	t.it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
+	t.it_interval = ktime_to_timespec(ctx->tintv);
+	spin_unlock_irq(&ctx->wqh.lock);
+
+	return seq_printf(m,
+			  "clockid: %d\n"
+			  "ticks: %llu\n"
+			  "settime flags: 0%o\n"
+			  "it_value: (%llu, %llu)\n"
+			  "it_interval: (%llu, %llu)\n",
+			  ctx->clockid, (unsigned long long)ctx->ticks,
+			  ctx->settime_flags,
+			  (unsigned long long)t.it_value.tv_sec,
+			  (unsigned long long)t.it_value.tv_nsec,
+			  (unsigned long long)t.it_interval.tv_sec,
+			  (unsigned long long)t.it_interval.tv_nsec);
+}
+#else
+#define timerfd_show NULL
+#endif
+
 static const struct file_operations timerfd_fops = {
 	.release	= timerfd_release,
 	.poll		= timerfd_poll,
 	.read		= timerfd_read,
 	.llseek		= noop_llseek,
+	.show_fdinfo	= timerfd_show,
 };
 
 static int timerfd_fget(int fd, struct fd *p)

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

* [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
       [not found]   ` <20140623190345.499956567-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2014-06-24 22:03     ` Cyrill Gorcunov
  2014-07-02 16:49       ` Christopher Covington
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-24 22:03 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael Kerrisk, Thomas Gleixner, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov

The read() of timerfd files allows to fetch the number of timer ticks
while there is no way to set it back from userspace.

To restore the timer's state as it was at checkpoint moment we need
a path to bring @ticks back. Initially I thought about writing ticks
back via write() interface but it seems such API is somehow obscure.

Instead implement timerfd_ioctl() method with TFD_IOC_SET_TICKS
command which allows to adjust @ticks into non-zero value waking
up the waiters.

I wrapped code with CONFIG_CHECKPOINT_RESTORE which can be
dropped off if there users except c/r camp appear.

v2 (by akpm@):
 -Use define timerfd_ioctl NULL for non c/r config

CC: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
CC: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
CC: Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
CC: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Signed-off-by: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
---

A nit fixed for for non c/r config in timerfd_ioctl declaration

 fs/timerfd.c            |   37 +++++++++++++++++++++++++++++++++++++
 include/linux/timerfd.h |    5 +++++
 2 files changed, 42 insertions(+)

Index: linux-2.6.git/fs/timerfd.c
===================================================================
--- linux-2.6.git.orig/fs/timerfd.c
+++ linux-2.6.git/fs/timerfd.c
@@ -315,12 +315,49 @@ static int timerfd_show(struct seq_file
 #define timerfd_show NULL
 #endif
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	struct timerfd_ctx *ctx = file->private_data;
+	int ret = 0;
+
+	switch (cmd) {
+	case TFD_IOC_SET_TICKS: {
+		u64 ticks;
+
+		if (get_user(ticks, (u64 __user *)arg))
+			return -EFAULT;
+		if (!ticks)
+			return -EINVAL;
+
+		spin_lock_irq(&ctx->wqh.lock);
+		if (!timerfd_canceled(ctx)) {
+			ctx->ticks = ticks;
+			if (ticks)
+				wake_up_locked(&ctx->wqh);
+		} else
+			ret = -ECANCELED;
+		spin_unlock_irq(&ctx->wqh.lock);
+		break;
+	}
+	default:
+		ret = -ENOTTY;
+		break;
+	}
+
+	return ret;
+}
+#else
+#define timerfd_ioctl NULL
+#endif
+
 static const struct file_operations timerfd_fops = {
 	.release	= timerfd_release,
 	.poll		= timerfd_poll,
 	.read		= timerfd_read,
 	.llseek		= noop_llseek,
 	.show_fdinfo	= timerfd_show,
+	.unlocked_ioctl	= timerfd_ioctl,
 };
 
 static int timerfd_fget(int fd, struct fd *p)
Index: linux-2.6.git/include/linux/timerfd.h
===================================================================
--- linux-2.6.git.orig/include/linux/timerfd.h
+++ linux-2.6.git/include/linux/timerfd.h
@@ -11,6 +11,9 @@
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
 
+/* For _IO helpers */
+#include <linux/ioctl.h>
+
 /*
  * CAREFUL: Check include/asm-generic/fcntl.h when defining
  * new flags, since they might collide with O_* ones. We want
@@ -29,4 +32,6 @@
 /* Flags for timerfd_settime.  */
 #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
 
+#define TFD_IOC_SET_TICKS	_IOW('T', 0, u64)
+
 #endif /* _LINUX_TIMERFD_H */

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-06-23 18:54 [patch 0/4] timerfd c/r support, v4 Cyrill Gorcunov
                   ` (4 preceding siblings ...)
       [not found] ` <20140623185431.396309193-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2014-06-30 19:43 ` Cyrill Gorcunov
  2014-07-15 13:54   ` Cyrill Gorcunov
  5 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-06-30 19:43 UTC (permalink / raw)
  To: Thomas Gleixner, Michael Kerrisk
  Cc: linux-kernel, linux-api, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov

On Mon, Jun 23, 2014 at 10:54:31PM +0400, Cyrill Gorcunov wrote:
>
> Hi guys, here is an updated version of c/r support for timerfd files. The main change
> is in how @ticks are restored in patch 3 -- I switched to ioctl code, which is wrapped
> with CONFIG because I still think that while there is only one ioctl designated
> solely for c/r needs no need to build it all the time until explicitly requested.
> Please take a look once time permit. Comments are highly appreciated.
> Also note the last patch is for man-page git repo, not for kernel.

Gentlemen, could you please point me if there something preventing the
series from being picked up? Or there some way to improve the series?

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

* Re: [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
  2014-06-24 22:03     ` Cyrill Gorcunov
@ 2014-07-02 16:49       ` Christopher Covington
       [not found]         ` <53B4382F.9030908-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
  0 siblings, 1 reply; 25+ messages in thread
From: Christopher Covington @ 2014-07-02 16:49 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: linux-kernel, linux-api, Michael Kerrisk, Thomas Gleixner,
	Andrew Morton, Andrey Vagin, Pavel Emelyanov, Vladimir Davydov,
	Linux ARM kernel mailing list

Hi Cyrill,

On 06/24/2014 06:03 PM, Cyrill Gorcunov wrote:
> The read() of timerfd files allows to fetch the number of timer ticks
> while there is no way to set it back from userspace.
> 
> To restore the timer's state as it was at checkpoint moment we need
> a path to bring @ticks back. Initially I thought about writing ticks
> back via write() interface but it seems such API is somehow obscure.
> 
> Instead implement timerfd_ioctl() method with TFD_IOC_SET_TICKS
> command which allows to adjust @ticks into non-zero value waking
> up the waiters.
> 
> I wrapped code with CONFIG_CHECKPOINT_RESTORE which can be
> dropped off if there users except c/r camp appear.
> 
> v2 (by akpm@):
>  -Use define timerfd_ioctl NULL for non c/r config
> 
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: Andrey Vagin <avagin@openvz.org>
> CC: Pavel Emelyanov <xemul@parallels.com>
> CC: Vladimir Davydov <vdavydov@parallels.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
> 
> A nit fixed for for non c/r config in timerfd_ioctl declaration
> 
>  fs/timerfd.c            |   37 +++++++++++++++++++++++++++++++++++++
>  include/linux/timerfd.h |    5 +++++
>  2 files changed, 42 insertions(+)
> 
> Index: linux-2.6.git/fs/timerfd.c
> ===================================================================
> --- linux-2.6.git.orig/fs/timerfd.c
> +++ linux-2.6.git/fs/timerfd.c
> @@ -315,12 +315,49 @@ static int timerfd_show(struct seq_file
>  #define timerfd_show NULL
>  #endif
>  
> +#ifdef CONFIG_CHECKPOINT_RESTORE
> +static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> +{
> +	struct timerfd_ctx *ctx = file->private_data;
> +	int ret = 0;
> +
> +	switch (cmd) {
> +	case TFD_IOC_SET_TICKS: {
> +		u64 ticks;
> +
> +		if (get_user(ticks, (u64 __user *)arg))

64-bit get_user is currently unsupported on ARM, although it appears work is
ongoing [1].

1. https://lkml.org/lkml/2014/6/17/260

Regards,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

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

* Re: [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
       [not found]         ` <53B4382F.9030908-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2014-07-02 17:04           ` Cyrill Gorcunov
  2014-07-02 19:01             ` Arnd Bergmann
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-02 17:04 UTC (permalink / raw)
  To: Christopher Covington
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk,
	Thomas Gleixner, Andrew Morton, Andrey Vagin, Pavel Emelyanov,
	Vladimir Davydov, Linux ARM kernel mailing list

On Wed, Jul 02, 2014 at 12:49:51PM -0400, Christopher Covington wrote:
> >  
> > +#ifdef CONFIG_CHECKPOINT_RESTORE
> > +static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> > +{
> > +	struct timerfd_ctx *ctx = file->private_data;
> > +	int ret = 0;
> > +
> > +	switch (cmd) {
> > +	case TFD_IOC_SET_TICKS: {
> > +		u64 ticks;
> > +
> > +		if (get_user(ticks, (u64 __user *)arg))
> 
> 64-bit get_user is currently unsupported on ARM, although it appears work is
> ongoing [1].
> 
> 1. https://lkml.org/lkml/2014/6/17/260

Thanks for info, Christopher! What arm camp is using then, copy-from-user?

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

* Re: [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
  2014-07-02 17:04           ` Cyrill Gorcunov
@ 2014-07-02 19:01             ` Arnd Bergmann
  2014-07-02 19:07               ` Cyrill Gorcunov
  2014-07-02 19:36               ` Cyrill Gorcunov
  0 siblings, 2 replies; 25+ messages in thread
From: Arnd Bergmann @ 2014-07-02 19:01 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: Christopher Covington, linux-kernel, linux-api, Michael Kerrisk,
	Thomas Gleixner, Andrew Morton, Andrey Vagin, Pavel Emelyanov,
	Vladimir Davydov, Linux ARM kernel mailing list

On Wednesday 02 July 2014 21:04:16 Cyrill Gorcunov wrote:
> On Wed, Jul 02, 2014 at 12:49:51PM -0400, Christopher Covington wrote:
> > >  
> > > +#ifdef CONFIG_CHECKPOINT_RESTORE
> > > +static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> > > +{
> > > +   struct timerfd_ctx *ctx = file->private_data;
> > > +   int ret = 0;
> > > +
> > > +   switch (cmd) {
> > > +   case TFD_IOC_SET_TICKS: {
> > > +           u64 ticks;
> > > +
> > > +           if (get_user(ticks, (u64 __user *)arg))
> > 
> > 64-bit get_user is currently unsupported on ARM, although it appears work is
> > ongoing [1].
> > 
> > 1. https://lkml.org/lkml/2014/6/17/260
> 
> Thanks for info, Christopher! What arm camp is using then, copy-from-user?
> 

copy_from_user should work on all architectures. I believe a 64-bit get_user
is currently unsupported on most 32-bit architectures, x86-32 being a notable
exception.

	Arnd

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

* Re: [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
  2014-07-02 19:01             ` Arnd Bergmann
@ 2014-07-02 19:07               ` Cyrill Gorcunov
  2014-07-02 19:36               ` Cyrill Gorcunov
  1 sibling, 0 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-02 19:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Christopher Covington, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk,
	Thomas Gleixner, Andrew Morton, Andrey Vagin, Pavel Emelyanov,
	Vladimir Davydov, Linux ARM kernel mailing list

On Wed, Jul 02, 2014 at 09:01:02PM +0200, Arnd Bergmann wrote:
> > > 
> > > 64-bit get_user is currently unsupported on ARM, although it appears work is
> > > ongoing [1].
> > > 
> > > 1. https://lkml.org/lkml/2014/6/17/260
> > 
> > Thanks for info, Christopher! What arm camp is using then, copy-from-user?
> > 
> 
> copy_from_user should work on all architectures. I believe a 64-bit get_user
> is currently unsupported on most 32-bit architectures, x86-32 being a notable
> exception.

Thanks, I'll update.

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

* Re: [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks
  2014-07-02 19:01             ` Arnd Bergmann
  2014-07-02 19:07               ` Cyrill Gorcunov
@ 2014-07-02 19:36               ` Cyrill Gorcunov
  1 sibling, 0 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-02 19:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Christopher Covington, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk,
	Thomas Gleixner, Andrew Morton, Andrey Vagin, Pavel Emelyanov,
	Vladimir Davydov, Linux ARM kernel mailing list

Updated variant, thanks a lot for feedback!

---
From: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks, v3

The read() of timerfd files allows to fetch the number of timer ticks
while there is no way to set it back from userspace.

To restore the timer's state as it was at checkpoint moment we need
a path to bring @ticks back. Initially I thought about writing ticks
back via write() interface but it seems such API is somehow obscure.

Instead implement timerfd_ioctl() method with TFD_IOC_SET_TICKS
command which allows to adjust @ticks into non-zero value waking
up the waiters.

I wrapped code with CONFIG_CHECKPOINT_RESTORE which can be
dropped off if there users except c/r camp appear.

v2 (by akpm@):
 - Use define timerfd_ioctl NULL for non c/r config

v3:
 - Use copy_from_user for @ticks fetching since
   not all arch support get_user for 8 byte argument

CC: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
CC: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
CC: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
CC: Christopher Covington <cov-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
CC: Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
CC: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Signed-off-by: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
---
 fs/timerfd.c            |   37 +++++++++++++++++++++++++++++++++++++
 include/linux/timerfd.h |    5 +++++
 2 files changed, 42 insertions(+)

Index: linux-2.6.git/fs/timerfd.c
===================================================================
--- linux-2.6.git.orig/fs/timerfd.c
+++ linux-2.6.git/fs/timerfd.c
@@ -315,12 +315,49 @@ static int timerfd_show(struct seq_file
 #define timerfd_show NULL
 #endif
 
+#ifdef CONFIG_CHECKPOINT_RESTORE
+static long timerfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	struct timerfd_ctx *ctx = file->private_data;
+	int ret = 0;
+
+	switch (cmd) {
+	case TFD_IOC_SET_TICKS: {
+		u64 ticks;
+
+		if (copy_from_user(&ticks, (u64 __user *)arg, sizeof(ticks)))
+			return -EFAULT;
+		if (!ticks)
+			return -EINVAL;
+
+		spin_lock_irq(&ctx->wqh.lock);
+		if (!timerfd_canceled(ctx)) {
+			ctx->ticks = ticks;
+			if (ticks)
+				wake_up_locked(&ctx->wqh);
+		} else
+			ret = -ECANCELED;
+		spin_unlock_irq(&ctx->wqh.lock);
+		break;
+	}
+	default:
+		ret = -ENOTTY;
+		break;
+	}
+
+	return ret;
+}
+#else
+#define timerfd_ioctl NULL
+#endif
+
 static const struct file_operations timerfd_fops = {
 	.release	= timerfd_release,
 	.poll		= timerfd_poll,
 	.read		= timerfd_read,
 	.llseek		= noop_llseek,
 	.show_fdinfo	= timerfd_show,
+	.unlocked_ioctl	= timerfd_ioctl,
 };
 
 static int timerfd_fget(int fd, struct fd *p)
Index: linux-2.6.git/include/linux/timerfd.h
===================================================================
--- linux-2.6.git.orig/include/linux/timerfd.h
+++ linux-2.6.git/include/linux/timerfd.h
@@ -11,6 +11,9 @@
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
 
+/* For _IO helpers */
+#include <linux/ioctl.h>
+
 /*
  * CAREFUL: Check include/asm-generic/fcntl.h when defining
  * new flags, since they might collide with O_* ones. We want
@@ -29,4 +32,6 @@
 /* Flags for timerfd_settime.  */
 #define TFD_SETTIME_FLAGS (TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)
 
+#define TFD_IOC_SET_TICKS	_IOW('T', 0, u64)
+
 #endif /* _LINUX_TIMERFD_H */

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-06-30 19:43 ` Cyrill Gorcunov
@ 2014-07-15 13:54   ` Cyrill Gorcunov
  2014-07-15 16:11     ` Thomas Gleixner
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-15 13:54 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Thomas Gleixner, Michael Kerrisk, Andrew Morton, Andrey Vagin,
	Pavel Emelyanov, Vladimir Davydov

On Mon, Jun 30, 2014 at 11:43:54PM +0400, Cyrill Gorcunov wrote:
> On Mon, Jun 23, 2014 at 10:54:31PM +0400, Cyrill Gorcunov wrote:
> >
> > Hi guys, here is an updated version of c/r support for timerfd files. The main change
> > is in how @ticks are restored in patch 3 -- I switched to ioctl code, which is wrapped
> > with CONFIG because I still think that while there is only one ioctl designated
> > solely for c/r needs no need to build it all the time until explicitly requested.
> > Please take a look once time permit. Comments are highly appreciated.
> > Also note the last patch is for man-page git repo, not for kernel.
> 
> Gentlemen, could you please point me if there something preventing the
> series from being picked up? Or there some way to improve the series?

Dear sirs, ping?

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 13:54   ` Cyrill Gorcunov
@ 2014-07-15 16:11     ` Thomas Gleixner
  2014-07-15 16:25       ` Cyrill Gorcunov
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Gleixner @ 2014-07-15 16:11 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Tue, 15 Jul 2014, Cyrill Gorcunov wrote:

> On Mon, Jun 30, 2014 at 11:43:54PM +0400, Cyrill Gorcunov wrote:
> > On Mon, Jun 23, 2014 at 10:54:31PM +0400, Cyrill Gorcunov wrote:
> > >
> > > Hi guys, here is an updated version of c/r support for timerfd files. The main change
> > > is in how @ticks are restored in patch 3 -- I switched to ioctl code, which is wrapped
> > > with CONFIG because I still think that while there is only one ioctl designated
> > > solely for c/r needs no need to build it all the time until explicitly requested.
> > > Please take a look once time permit. Comments are highly appreciated.
> > > Also note the last patch is for man-page git repo, not for kernel.
> > 
> > Gentlemen, could you please point me if there something preventing the
> > series from being picked up? Or there some way to improve the series?
> 
> Dear sirs, ping?

Hmm, I was waiting for a V5, but it seems you just updated that single
patch according to the review. I'll pick it up

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 16:11     ` Thomas Gleixner
@ 2014-07-15 16:25       ` Cyrill Gorcunov
  2014-07-15 21:08         ` Thomas Gleixner
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-15 16:25 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Tue, Jul 15, 2014 at 06:11:58PM +0200, Thomas Gleixner wrote:
> > 
> > Dear sirs, ping?
> 
> Hmm, I was waiting for a V5, but it seems you just updated that single
> patch according to the review. I'll pick it up

Thanks a lot, Thomas!

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 16:25       ` Cyrill Gorcunov
@ 2014-07-15 21:08         ` Thomas Gleixner
  2014-07-15 21:14           ` Cyrill Gorcunov
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Gleixner @ 2014-07-15 21:08 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Tue, 15 Jul 2014, Cyrill Gorcunov wrote:

> On Tue, Jul 15, 2014 at 06:11:58PM +0200, Thomas Gleixner wrote:
> > > 
> > > Dear sirs, ping?
> > 
> > Hmm, I was waiting for a V5, but it seems you just updated that single
> > patch according to the review. I'll pick it up
> 
> Thanks a lot, Thomas!

Sigh. That updated 3/4 patch does not even apply.... 

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 21:08         ` Thomas Gleixner
@ 2014-07-15 21:14           ` Cyrill Gorcunov
  2014-07-15 21:16             ` Thomas Gleixner
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-15 21:14 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Tue, Jul 15, 2014 at 11:08:39PM +0200, Thomas Gleixner wrote:
> On Tue, 15 Jul 2014, Cyrill Gorcunov wrote:
> 
> > On Tue, Jul 15, 2014 at 06:11:58PM +0200, Thomas Gleixner wrote:
> > > > 
> > > > Dear sirs, ping?
> > > 
> > > Hmm, I was waiting for a V5, but it seems you just updated that single
> > > patch according to the review. I'll pick it up
> > 
> > Thanks a lot, Thomas!
> 
> Sigh. That updated 3/4 patch does not even apply.... 

Maybe it's because of new -rc? Letme check...

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 21:14           ` Cyrill Gorcunov
@ 2014-07-15 21:16             ` Thomas Gleixner
  2014-07-15 21:18               ` Cyrill Gorcunov
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Gleixner @ 2014-07-15 21:16 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Wed, 16 Jul 2014, Cyrill Gorcunov wrote:

> On Tue, Jul 15, 2014 at 11:08:39PM +0200, Thomas Gleixner wrote:
> > On Tue, 15 Jul 2014, Cyrill Gorcunov wrote:
> > 
> > > On Tue, Jul 15, 2014 at 06:11:58PM +0200, Thomas Gleixner wrote:
> > > > > 
> > > > > Dear sirs, ping?
> > > > 
> > > > Hmm, I was waiting for a V5, but it seems you just updated that single
> > > > patch according to the review. I'll pick it up
> > > 
> > > Thanks a lot, Thomas!
> > 
> > Sigh. That updated 3/4 patch does not even apply.... 
> 
> Maybe it's because of new -rc? Letme check...

No, it's because its against an older version of your patches which
lack the #ifdef PROC_FS around the show function ....


 

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 21:16             ` Thomas Gleixner
@ 2014-07-15 21:18               ` Cyrill Gorcunov
  2014-07-15 21:20                 ` Thomas Gleixner
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-15 21:18 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Tue, Jul 15, 2014 at 11:16:23PM +0200, Thomas Gleixner wrote:
> > 
> > Maybe it's because of new -rc? Letme check...
> 
> No, it's because its against an older version of your patches which
> lack the #ifdef PROC_FS around the show function ....

Crap. Sorry. Thomas, I'm fetching -rc5 now, I suppose better will
be if I rebase the whole series and resend. Sounds good?

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

* Re: [patch 0/4] timerfd c/r support, v4
  2014-07-15 21:18               ` Cyrill Gorcunov
@ 2014-07-15 21:20                 ` Thomas Gleixner
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Gleixner @ 2014-07-15 21:20 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Michael Kerrisk, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov



On Wed, 16 Jul 2014, Cyrill Gorcunov wrote:

> On Tue, Jul 15, 2014 at 11:16:23PM +0200, Thomas Gleixner wrote:
> > > 
> > > Maybe it's because of new -rc? Letme check...
> > 
> > No, it's because its against an older version of your patches which
> > lack the #ifdef PROC_FS around the show function ....
> 
> Crap. Sorry. Thomas, I'm fetching -rc5 now, I suppose better will
> be if I rebase the whole series and resend. Sounds good?

No rebase necessary. 1&2 apply fine. It's home made wreckage :)
 

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

* Re: [patch 4/4] timerfd.2: Add ioctl method description
       [not found]       ` <552C1F64.30202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-04-13 20:10         ` Cyrill Gorcunov
  0 siblings, 0 replies; 25+ messages in thread
From: Cyrill Gorcunov @ 2015-04-13 20:10 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages)
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Thomas Gleixner, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

On Mon, Apr 13, 2015 at 09:56:20PM +0200, Michael Kerrisk (man-pages) wrote:
> Hello Cyrill,
> 
> On 07/15/2014 11:54 PM, Cyrill Gorcunov wrote:
> > ioctl(2)
> > 	The following commands are supported: TFD_IOC_SET_TICKS to adjust
> > 	the number of the timer expirations that have occurred.
> > 	It take a pointer to nonzero 8-byte integer (uint64_t*) containing
> > 	new number of expirations. Once the number is set any waiter on
> > 	the timer is woken up. The only purpose of this command is to restore
> > 	the expirations in a sake of checkpoint/restore procedure.
> > 	It requires the kernel to be built with CONFIG_CHECKPOINT_RESTORE
> > 	support.
> 
> Late... but, patch applied. Thank you.

Sure thing! Ping me if anything else should be added.

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

* Re: [patch 4/4] timerfd.2: Add ioctl method description
       [not found]   ` <20140715215703.353177995-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2015-04-13 19:56     ` Michael Kerrisk (man-pages)
       [not found]       ` <552C1F64.30202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-04-13 19:56 UTC (permalink / raw)
  To: Cyrill Gorcunov, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, Thomas Gleixner,
	Andrew Morton, Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

Hello Cyrill,

On 07/15/2014 11:54 PM, Cyrill Gorcunov wrote:
> ioctl(2)
> 	The following commands are supported: TFD_IOC_SET_TICKS to adjust
> 	the number of the timer expirations that have occurred.
> 	It take a pointer to nonzero 8-byte integer (uint64_t*) containing
> 	new number of expirations. Once the number is set any waiter on
> 	the timer is woken up. The only purpose of this command is to restore
> 	the expirations in a sake of checkpoint/restore procedure.
> 	It requires the kernel to be built with CONFIG_CHECKPOINT_RESTORE
> 	support.

Late... but, patch applied. Thank you.

Cheers,

Michael


> Signed-off-by: Cyrill Gorcunov <gorcunov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
> CC: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> CC: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> CC: Andrey Vagin <avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
> CC: Pavel Emelyanov <xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> CC: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> CC: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
>  man2/timerfd_create.2 |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> Index: man-pages/man2/timerfd_create.2
> ===================================================================
> --- man-pages.orig/man2/timerfd_create.2
> +++ man-pages/man2/timerfd_create.2
> @@ -260,6 +260,20 @@ multiplexing APIs:
>  and
>  .BR epoll (7).
>  .TP
> +.BR ioctl "(2)"
> +The following commands are supported:
> +.B TFD_IOC_SET_TICKS
> +to adjust the number of the timer expirations that have occurred.
> +It take a pointer to nonzero 8-byte integer
> +.RI ( uint64_t *)
> +containing the new number of expirations.
> +Once the number is set any waiter on the timer is woken up.
> +The only purpose of this command is to restore the expirations
> +in a sake of checkpoint/restore procedure.
> +It requires the kernel to be built with
> +.BR CONFIG_CHECKPOINT_RESTORE
> +support.
> +.TP
>  .BR close (2)
>  When the file descriptor is no longer required it should be closed.
>  When all file descriptors associated with the same timer object
> 
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

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

* [patch 4/4] timerfd.2: Add ioctl method description
  2014-07-15 21:54 [patch 0/4] timerfd c/r support, v5 Cyrill Gorcunov
@ 2014-07-15 21:54 ` Cyrill Gorcunov
       [not found]   ` <20140715215703.353177995-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 25+ messages in thread
From: Cyrill Gorcunov @ 2014-07-15 21:54 UTC (permalink / raw)
  To: linux-kernel, linux-api
  Cc: Michael Kerrisk, Thomas Gleixner, Cyrill Gorcunov, Andrew Morton,
	Andrey Vagin, Pavel Emelyanov, Vladimir Davydov

[-- Attachment #1: timerfd-man --]
[-- Type: text/plain, Size: 1806 bytes --]

ioctl(2)
	The following commands are supported: TFD_IOC_SET_TICKS to adjust
	the number of the timer expirations that have occurred.
	It take a pointer to nonzero 8-byte integer (uint64_t*) containing
	new number of expirations. Once the number is set any waiter on
	the timer is woken up. The only purpose of this command is to restore
	the expirations in a sake of checkpoint/restore procedure.
	It requires the kernel to be built with CONFIG_CHECKPOINT_RESTORE
	support.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Michael Kerrisk <mtk.manpages@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Andrey Vagin <avagin@openvz.org>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Vladimir Davydov <vdavydov@parallels.com>
CC: linux-api@vger.kernel.org
---
 man2/timerfd_create.2 |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: man-pages/man2/timerfd_create.2
===================================================================
--- man-pages.orig/man2/timerfd_create.2
+++ man-pages/man2/timerfd_create.2
@@ -260,6 +260,20 @@ multiplexing APIs:
 and
 .BR epoll (7).
 .TP
+.BR ioctl "(2)"
+The following commands are supported:
+.B TFD_IOC_SET_TICKS
+to adjust the number of the timer expirations that have occurred.
+It take a pointer to nonzero 8-byte integer
+.RI ( uint64_t *)
+containing the new number of expirations.
+Once the number is set any waiter on the timer is woken up.
+The only purpose of this command is to restore the expirations
+in a sake of checkpoint/restore procedure.
+It requires the kernel to be built with
+.BR CONFIG_CHECKPOINT_RESTORE
+support.
+.TP
 .BR close (2)
 When the file descriptor is no longer required it should be closed.
 When all file descriptors associated with the same timer object

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

end of thread, other threads:[~2015-04-13 20:10 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23 18:54 [patch 0/4] timerfd c/r support, v4 Cyrill Gorcunov
2014-06-23 18:54 ` [patch 1/4] timerfd: Implement show_fdinfo method Cyrill Gorcunov
     [not found]   ` <20140623190345.354980826-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2014-06-24 22:02     ` Cyrill Gorcunov
2014-06-23 18:54 ` [patch 2/4] docs: procfs -- Document timerfd output Cyrill Gorcunov
2014-06-23 18:54 ` [patch 3/4] timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks Cyrill Gorcunov
     [not found]   ` <20140623190345.499956567-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2014-06-24 22:03     ` Cyrill Gorcunov
2014-07-02 16:49       ` Christopher Covington
     [not found]         ` <53B4382F.9030908-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-07-02 17:04           ` Cyrill Gorcunov
2014-07-02 19:01             ` Arnd Bergmann
2014-07-02 19:07               ` Cyrill Gorcunov
2014-07-02 19:36               ` Cyrill Gorcunov
2014-06-23 18:54 ` [patch 4/4] timerfd.2: Add ioctl method description Cyrill Gorcunov
     [not found] ` <20140623185431.396309193-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2014-06-23 19:44   ` [patch 0/4] timerfd c/r support, v4 Andrew Vagin
2014-06-30 19:43 ` Cyrill Gorcunov
2014-07-15 13:54   ` Cyrill Gorcunov
2014-07-15 16:11     ` Thomas Gleixner
2014-07-15 16:25       ` Cyrill Gorcunov
2014-07-15 21:08         ` Thomas Gleixner
2014-07-15 21:14           ` Cyrill Gorcunov
2014-07-15 21:16             ` Thomas Gleixner
2014-07-15 21:18               ` Cyrill Gorcunov
2014-07-15 21:20                 ` Thomas Gleixner
2014-07-15 21:54 [patch 0/4] timerfd c/r support, v5 Cyrill Gorcunov
2014-07-15 21:54 ` [patch 4/4] timerfd.2: Add ioctl method description Cyrill Gorcunov
     [not found]   ` <20140715215703.353177995-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2015-04-13 19:56     ` Michael Kerrisk (man-pages)
     [not found]       ` <552C1F64.30202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-13 20:10         ` Cyrill Gorcunov

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).