[Xen-devel] [PATCH 3/6] libxl: events: Deregister, don't just modify, sigchld pipe fd

2014-12-09 Thread Ian Jackson
We want to have no fd events registered when we are idle.  This
implies that we must be able to deregister our interest in the sigchld
self-pipe fd, not just modify to request no events.

Signed-off-by: Ian Jackson 
Acked-by: Ian Campbell 
Tested-by: Ian Campbell 
Release-Acked-by: Konrad Rzeszutek Wilk 
---
 tools/libxl/libxl_fork.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c
index fa15095..144208a 100644
--- a/tools/libxl/libxl_fork.c
+++ b/tools/libxl/libxl_fork.c
@@ -372,15 +372,8 @@ static void sigchld_user_remove(libxl_ctx *ctx) /* 
idempotent */
 
 void libxl__sigchld_notneeded(libxl__gc *gc) /* non-reentrant, idempotent */
 {
-int rc;
-
 sigchld_user_remove(CTX);
-
-if (libxl__ev_fd_isregistered(&CTX->sigchld_selfpipe_efd)) {
-rc = libxl__ev_fd_modify(gc, &CTX->sigchld_selfpipe_efd, 0);
-if (rc)
-libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd);
-}
+libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd);
 }
 
 int libxl__sigchld_needed(libxl__gc *gc) /* non-reentrant, idempotent */
-- 
1.7.10.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 3/6] libxl: events: Deregister, don't just modify, sigchld pipe fd

2014-11-28 Thread Ian Campbell
On Fri, 2014-11-28 at 14:42 +, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH 3/6] libxl: events: Deregister, don't just 
> modify, sigchld pipe fd"):
> > On Thu, 2014-11-27 at 18:27 +, Ian Jackson wrote:
> > > We want to have no fd events registered when we are idle.  This
> > > implies that we must be able to deregister our interest in the sigchld
> > > self-pipe fd, not just modify to request no events.
> > > 
> > > Signed-off-by: Ian Jackson 
> > 
> > Acked-by: Ian Campbell 
> > 
> > I think in principal there is now some redundant code in
> > libxl__sigchld_needed which calls modify to set POLLIN if the fd is not
> > registered. I think it's redundant because now the fd is registered iff
> > it is looking for POLLIN.
> 
> You're right.  (Although you mean `calls modify if the fd /is/
> registered'.)

Indeed.

> I wonder if it would be better to leave tidying that up until
> post-4.5, in case we are wrong.

Sure.




___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 3/6] libxl: events: Deregister, don't just modify, sigchld pipe fd

2014-11-28 Thread Ian Jackson
Ian Campbell writes ("Re: [PATCH 3/6] libxl: events: Deregister, don't just 
modify, sigchld pipe fd"):
> On Thu, 2014-11-27 at 18:27 +, Ian Jackson wrote:
> > We want to have no fd events registered when we are idle.  This
> > implies that we must be able to deregister our interest in the sigchld
> > self-pipe fd, not just modify to request no events.
> > 
> > Signed-off-by: Ian Jackson 
> 
> Acked-by: Ian Campbell 
> 
> I think in principal there is now some redundant code in
> libxl__sigchld_needed which calls modify to set POLLIN if the fd is not
> registered. I think it's redundant because now the fd is registered iff
> it is looking for POLLIN.

You're right.  (Although you mean `calls modify if the fd /is/
registered'.)

I wonder if it would be better to leave tidying that up until
post-4.5, in case we are wrong.

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 3/6] libxl: events: Deregister, don't just modify, sigchld pipe fd

2014-11-28 Thread Ian Campbell
On Thu, 2014-11-27 at 18:27 +, Ian Jackson wrote:
> We want to have no fd events registered when we are idle.  This
> implies that we must be able to deregister our interest in the sigchld
> self-pipe fd, not just modify to request no events.
> 
> Signed-off-by: Ian Jackson 

Acked-by: Ian Campbell 

I think in principal there is now some redundant code in
libxl__sigchld_needed which calls modify to set POLLIN if the fd is not
registered. I think it's redundant because now the fd is registered iff
it is looking for POLLIN.

> ---
>  tools/libxl/libxl_fork.c |9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c
> index fa15095..144208a 100644
> --- a/tools/libxl/libxl_fork.c
> +++ b/tools/libxl/libxl_fork.c
> @@ -372,15 +372,8 @@ static void sigchld_user_remove(libxl_ctx *ctx) /* 
> idempotent */
>  
>  void libxl__sigchld_notneeded(libxl__gc *gc) /* non-reentrant, idempotent */
>  {
> -int rc;
> -
>  sigchld_user_remove(CTX);
> -
> -if (libxl__ev_fd_isregistered(&CTX->sigchld_selfpipe_efd)) {
> -rc = libxl__ev_fd_modify(gc, &CTX->sigchld_selfpipe_efd, 0);
> -if (rc)
> -libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd);
> -}
> +libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd);
>  }
>  
>  int libxl__sigchld_needed(libxl__gc *gc) /* non-reentrant, idempotent */



___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH 3/6] libxl: events: Deregister, don't just modify, sigchld pipe fd

2014-11-27 Thread Ian Jackson
We want to have no fd events registered when we are idle.  This
implies that we must be able to deregister our interest in the sigchld
self-pipe fd, not just modify to request no events.

Signed-off-by: Ian Jackson 
---
 tools/libxl/libxl_fork.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c
index fa15095..144208a 100644
--- a/tools/libxl/libxl_fork.c
+++ b/tools/libxl/libxl_fork.c
@@ -372,15 +372,8 @@ static void sigchld_user_remove(libxl_ctx *ctx) /* 
idempotent */
 
 void libxl__sigchld_notneeded(libxl__gc *gc) /* non-reentrant, idempotent */
 {
-int rc;
-
 sigchld_user_remove(CTX);
-
-if (libxl__ev_fd_isregistered(&CTX->sigchld_selfpipe_efd)) {
-rc = libxl__ev_fd_modify(gc, &CTX->sigchld_selfpipe_efd, 0);
-if (rc)
-libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd);
-}
+libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd);
 }
 
 int libxl__sigchld_needed(libxl__gc *gc) /* non-reentrant, idempotent */
-- 
1.7.10.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel