all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
@ 2019-02-22 15:08 Ken Brown
  2019-02-22 16:12 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Brown @ 2019-02-22 15:08 UTC (permalink / raw)
  To: 34618

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

Starting with cygwin-3.0.0, Cygwin has the timerfd functions.  But using
them causes Emacs to be very slow to respond to user input.  If I press
a key, there is a 1-2 second delay before Emacs responds.  I'm in the
process of trying to debug this
(http://www.cygwin.org/ml/cygwin/2019-02/msg00364.html).  In the
meantime, the attached patch disables the use of these functions.

OK for the emacs-26 branch (after filling in the bug number)?

Ken

[-- Attachment #2: 0001-Disable-the-timerfd-interface-on-Cygwin.patch --]
[-- Type: text/plain, Size: 772 bytes --]

From c0025015ac30ae3c61388eb98f39f495926fe5d1 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Fri, 22 Feb 2019 09:53:52 -0500
Subject: [PATCH] Disable the timerfd interface on Cygwin

* configure.ac (emacs_cv_have_timerfd): Set to "no" on Cygwin.
---
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index d5e802a961..0783b6455a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4145,6 +4145,10 @@ AC_DEFUN
 AC_SUBST(TERMCAP_OBJ)
 
 # GNU/Linux-specific timer functions.
+# Bug #?????.
+if test "$opsys" = "cygwin"; then
+  emacs_cv_have_timerfd=no
+fi
 AC_CACHE_CHECK([for timerfd interface], [emacs_cv_have_timerfd],
   [AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[#include <sys/timerfd.h>
-- 
2.17.0


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

* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
  2019-02-22 15:08 bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin Ken Brown
@ 2019-02-22 16:12 ` Eli Zaretskii
  2019-02-22 16:15   ` Ken Brown
  2019-03-09 19:27   ` Ken Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2019-02-22 16:12 UTC (permalink / raw)
  To: Ken Brown; +Cc: 34618

> From: Ken Brown <kbrown@cornell.edu>
> Date: Fri, 22 Feb 2019 15:08:33 +0000
> 
> Starting with cygwin-3.0.0, Cygwin has the timerfd functions.  But using
> them causes Emacs to be very slow to respond to user input.  If I press
> a key, there is a 1-2 second delay before Emacs responds.  I'm in the
> process of trying to debug this
> (http://www.cygwin.org/ml/cygwin/2019-02/msg00364.html).  In the
> meantime, the attached patch disables the use of these functions.
> 
> OK for the emacs-26 branch (after filling in the bug number)?

Yes, thanks.





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

* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
  2019-02-22 16:12 ` Eli Zaretskii
@ 2019-02-22 16:15   ` Ken Brown
  2019-03-09 19:27   ` Ken Brown
  1 sibling, 0 replies; 7+ messages in thread
From: Ken Brown @ 2019-02-22 16:15 UTC (permalink / raw)
  Cc: 34618-done@debbugs.gnu.org

Closing.

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

* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
  2019-02-22 16:12 ` Eli Zaretskii
  2019-02-22 16:15   ` Ken Brown
@ 2019-03-09 19:27   ` Ken Brown
  2019-03-09 19:42     ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Ken Brown @ 2019-03-09 19:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 34618@debbugs.gnu.org

On 2/22/2019 11:12 AM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown@cornell.edu>
>> Date: Fri, 22 Feb 2019 15:08:33 +0000
>>
>> Starting with cygwin-3.0.0, Cygwin has the timerfd functions.  But using
>> them causes Emacs to be very slow to respond to user input.  If I press
>> a key, there is a 1-2 second delay before Emacs responds.  I'm in the
>> process of trying to debug this
>> (http://www.cygwin.org/ml/cygwin/2019-02/msg00364.html).  In the
>> meantime, the attached patch disables the use of these functions.
>>
>> OK for the emacs-26 branch (after filling in the bug number)?
> 
> Yes, thanks.

The Cygwin problems with the timerfd functions have been fixed as of 
cygwin-3.0.2, so I've re-enabled the use of these functions on the master 
branch.  To play it safe, we should probably leave them disabled on the emacs-26 
branch.

Ken

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

* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
  2019-03-09 19:27   ` Ken Brown
@ 2019-03-09 19:42     ` Eli Zaretskii
  2019-03-09 22:20       ` Ken Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2019-03-09 19:42 UTC (permalink / raw)
  To: Ken Brown; +Cc: 34618

> From: Ken Brown <kbrown@cornell.edu>
> CC: "34618@debbugs.gnu.org" <34618@debbugs.gnu.org>
> Date: Sat, 9 Mar 2019 19:27:34 +0000
> 
> The Cygwin problems with the timerfd functions have been fixed as of 
> cygwin-3.0.2, so I've re-enabled the use of these functions on the master 
> branch.  To play it safe, we should probably leave them disabled on the emacs-26 
> branch.

Isn't there a way to get at the version of Cygwin at run time?  I
think the best solution is to allow timerfd functions only for
versions whose support is not buggy, and that's not a compile-time
decision, right?





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

* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
  2019-03-09 19:42     ` Eli Zaretskii
@ 2019-03-09 22:20       ` Ken Brown
  2019-03-10  3:32         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Brown @ 2019-03-09 22:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 34618@debbugs.gnu.org

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

On 3/9/2019 2:42 PM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown@cornell.edu>
>> CC: "34618@debbugs.gnu.org" <34618@debbugs.gnu.org>
>> Date: Sat, 9 Mar 2019 19:27:34 +0000
>>
>> The Cygwin problems with the timerfd functions have been fixed as of
>> cygwin-3.0.2, so I've re-enabled the use of these functions on the master
>> branch.  To play it safe, we should probably leave them disabled on the emacs-26
>> branch.
> 
> Isn't there a way to get at the version of Cygwin at run time?  I
> think the best solution is to allow timerfd functions only for
> versions whose support is not buggy, and that's not a compile-time
> decision, right?

Good idea.  How's the attached?

Ken

[-- Attachment #2: 0001-Use-a-runtime-test-for-timerfd-on-Cygwin-Bug-34618.patch --]
[-- Type: text/plain, Size: 1622 bytes --]

From fd6932c4c87a20ad3e019755c60e3fc1c322ef37 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Sat, 9 Mar 2019 17:06:54 -0500
Subject: [PATCH] Use a runtime test for timerfd on Cygwin (Bug#34618)

* src/atimer.c [HAVE_TIMERFD] (have_buggy_timerfd): New
function.
(init_atimer) Use it.
---
 src/atimer.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/atimer.c b/src/atimer.c
index d36c4f1f5a..8387b8aa0e 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -28,7 +28,10 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 
 #ifdef HAVE_TIMERFD
 #include <errno.h>
-# include <sys/timerfd.h>
+#include <sys/timerfd.h>
+# ifdef CYGWIN
+# include <sys/utsname.h>
+# endif
 #endif
 
 #ifdef MSDOS
@@ -557,13 +560,28 @@ Return t if all self-tests are passed, nil otherwise.  */)
 
 #endif /* ENABLE_CHECKING */
 
+/* Cygwin has the timerfd interface starting with release 3.0.0, but
+   it is buggy until release 3.0.2. */
+#ifdef HAVE_TIMERFD
+static bool
+have_buggy_timerfd (void)
+{
+# ifdef CYGWIN
+  struct utsname name;
+  return uname (&name) < 0 || strverscmp (name.release, "3.0.2") < 0;
+# else
+  return false;
+# endif
+}
+#endif
+
 void
 init_atimer (void)
 {
 #ifdef HAVE_ITIMERSPEC
 # ifdef HAVE_TIMERFD
   /* Until this feature is considered stable, you can ask to not use it.  */
-  timerfd = (egetenv ("EMACS_IGNORE_TIMERFD") ? -1 :
+  timerfd = (egetenv ("EMACS_IGNORE_TIMERFD") || have_buggy_timerfd () ? -1 :
 	     timerfd_create (CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC));
 # endif
   if (timerfd < 0)
-- 
2.17.0


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

* bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin
  2019-03-09 22:20       ` Ken Brown
@ 2019-03-10  3:32         ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2019-03-10  3:32 UTC (permalink / raw)
  To: Ken Brown; +Cc: 34618

> From: Ken Brown <kbrown@cornell.edu>
> CC: "34618@debbugs.gnu.org" <34618@debbugs.gnu.org>
> Date: Sat, 9 Mar 2019 22:20:44 +0000
> 
> > Isn't there a way to get at the version of Cygwin at run time?  I
> > think the best solution is to allow timerfd functions only for
> > versions whose support is not buggy, and that's not a compile-time
> > decision, right?
> 
> Good idea.  How's the attached?

LGTM, thanks.





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

end of thread, other threads:[~2019-03-10  3:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22 15:08 bug#34618: 26.1.92; timerfd interface causes slowdown on Cygwin Ken Brown
2019-02-22 16:12 ` Eli Zaretskii
2019-02-22 16:15   ` Ken Brown
2019-03-09 19:27   ` Ken Brown
2019-03-09 19:42     ` Eli Zaretskii
2019-03-09 22:20       ` Ken Brown
2019-03-10  3:32         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.