[PATCH v6 3/3] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
The commit a22a0ad7c4f0 was not entirely correct. Even with the patch, some hangs still occur. This patch overrides the previous commit along with the patch that makes cygwait() reentrant, to fix these hangs. Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html Addresses: https

[PATCH v6 2/3] Cygwin: cygwait: Make cygwait() reentrant

2025-01-20 Thread Takashi Yano
To allow cygwait() to be called in the signal handler, a locally created timer is used instead of _cygtls::locals.cw_timer if it is in use. Co-Authored-By: Corinna Vinschen Signed-off-by: Takashi Yano --- winsup/cygwin/cygtls.cc | 2 ++ winsup/cygwin/cygwait.cc | 22

[PATCH v6 1/3] Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent"

2025-01-20 Thread Takashi Yano
This reverts commit a22a0ad7c4f0 to apply a new patch for the same purpose. Signed-off-by: Takashi Yano --- winsup/cygwin/release/3.5.6 | 3 --- winsup/cygwin/sigproc.cc| 20 +--- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/release/3.5.6 b/w

[PATCH v6 0/3] Revert __SIGFLUSHFAST v2 patch and apply v6

2025-01-20 Thread Takashi Yano
v5 -> v6: Revise cygwait()/select() a bit Takashi Yano (3): Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent" Cygwin: cygwait: Make cygwait() reentrant Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent winsup/cygwin/cygtls.cc | 2

[PATCH v5 3/3] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
The commit a22a0ad7c4f0 was not exactly the correct thing. Even with the patch, some hangs still happen. This patch overrides the previous commit togerther with the patch making cygwait() reentrant to fix these hangs. Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html Address

[PATCH v5 1/3] Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent"

2025-01-20 Thread Takashi Yano
This reverts commit a22a0ad7c4f0 to apply a new patch for the same purpose. Signed-off-by: Takashi Yano --- winsup/cygwin/release/3.5.6 | 3 --- winsup/cygwin/sigproc.cc| 20 +--- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/release/3.5.6 b/w

[PATCH v5 2/3] Cygwin: cygwait: Make cygwait() reentrant

2025-01-20 Thread Takashi Yano
To allow cygwait() to be called in the signal handler, a locally created timer is used instead of _cygtls::locals.cw_timer if it is in use. Co-Authored-By: Corinna Vinschen Signed-off-by: Takashi Yano --- winsup/cygwin/cygtls.cc | 2 ++ winsup/cygwin/cygwait.cc | 23

[PATCH v5 0/3] Revert __SIGFLUSHFAST v2 patch and apply v5

2025-01-20 Thread Takashi Yano
Takashi Yano (3): Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent" Cygwin: cygwait: Make cygwait() reentrant Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent winsup/cygwin/cygtls.cc | 2 ++ winsup/cygwin/cygwait.cc | 2

Re: [PATCH v4 2/3] Cygwin: cygwait: Make cygwait() reentrant

2025-01-20 Thread Takashi Yano
On Mon, 20 Jan 2025 09:03:01 -0800 (PST) Jeremy Drake wrote: > On Tue, 21 Jan 2025, Takashi Yano wrote: > > > diff --git a/winsup/cygwin/cygwait.cc b/winsup/cygwin/cygwait.cc > > index 80c0e971c..8613638f6 100644 > > --- a/winsup/cygwin/cygwait.cc > > +++ b/winsup/cygwin/cygwait.cc > > @@ -58,16 +

Re: [PATCH v4 2/3] Cygwin: cygwait: Make cygwait() reentrant

2025-01-20 Thread Jeremy Drake via Cygwin-patches
On Tue, 21 Jan 2025, Takashi Yano wrote: > diff --git a/winsup/cygwin/cygwait.cc b/winsup/cygwin/cygwait.cc > index 80c0e971c..8613638f6 100644 > --- a/winsup/cygwin/cygwait.cc > +++ b/winsup/cygwin/cygwait.cc > @@ -58,16 +58,22 @@ cygwait (HANDLE object, PLARGE_INTEGER timeout, unsigned > mask)

Re: [PATCH v3 2/2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
On Mon, 20 Jan 2025 16:53:34 +0100 Corinna Vinschen wrote: > Hi Takashi, > > do you want to keep it this way, or do you rather want to change > cygwait to use a local timer? I prefer changing cygwait() to use a local timer because: 1) It makes the __SIGFLUSHFAST patch much simpler. 2) I wonder si

[PATCH v4 1/3] Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent"

2025-01-20 Thread Takashi Yano
This reverts commit a22a0ad7c4f0 to apply a new patch for the same purpose. Signed-off-by: Takashi Yano --- winsup/cygwin/release/3.5.6 | 3 --- winsup/cygwin/sigproc.cc| 20 +--- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/release/3.5.6 b/w

Re: [PATCH v3 2/2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Corinna Vinschen
Hi Takashi, do you want to keep it this way, or do you rather want to change cygwait to use a local timer? Thanks, Corinna On Jan 20 17:52, Takashi Yano wrote: > The commit a22a0ad7c4f0 was not exactly the correct thing. Even with > the patch, some hangs still happen. This patch overrides the p

[PATCH v4 2/3] Cygwin: cygwait: Make cygwait() reentrant

2025-01-20 Thread Takashi Yano
To allow cygwait() to be called in the signal handler, a locally created timer is used instead of _cygtls::locals.cw_timer if it is in use. Co-Authored-By: Corinna Vinschen Signed-off-by: Takashi Yano --- winsup/cygwin/cygtls.cc | 2 ++ winsup/cygwin/cygwait.cc | 22

[PATCH v4 3/3] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
The commit a22a0ad7c4f0 was not exactly the correct thing. Even with the patch, some hangs still happen. This patch overrides the previous commit togerther with the patch making cygwait() reentrant to fix these hangs. Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html Address

[PATCH v4 0/3] Revert __SIGFLUSHFAST v2 patch and apply v4

2025-01-20 Thread Takashi Yano
Takashi Yano (3): Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent" Cygwin: cygwait: Make cygwait() reentrant Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent winsup/cygwin/cygtls.cc | 2 ++ winsup/cygwin/cygwait.cc | 2

Re: [PATCH v2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
On Mon, 20 Jan 2025 12:38:24 +0100 Corinna Vinschen wrote: > On Jan 20 18:08, Takashi Yano wrote: > > On Mon, 20 Jan 2025 00:33:26 +0900 > > Takashi Yano wrote: > > > On Sun, 19 Jan 2025 09:40:14 +0900 > > > Takashi Yano wrote: > > > > However, I wonder if cw_timer is re-set by NtSetTimer() in the

Re: [PATCH] Cygwin: mmap: use 64K pages for bookkeeping

2025-01-20 Thread Ken Brown
On 1/20/2025 6:49 AM, Corinna Vinschen wrote: Nice idea, but this may not do what is expected if the mapping is an anonymous mapping, leaving the protection or mapping of trailing pages in a wrong state, isn't it? Can we easily make sure the type of mapping (file vs anon) is known at the time of

Re: [PATCH v2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
On Mon, 20 Jan 2025 12:43:07 +0100 Corinna Vinschen wrote: > On Jan 19 19:42, Takashi Yano wrote: > > Hi Corinna, > > > > On Sun, 19 Jan 2025 11:49:58 +0900 > > Takashi Yano wrote: > > > On Sat, 18 Jan 2025 17:06:50 -0800 (PST) > > > Jeremy Drake wrote: > > > > On Sat, 18 Jan 2025, Takashi Yano wr

[PATCH v2] Cygwin: signal: Avoid frequent TLS lock/unlock for SIGCONT processing

2025-01-20 Thread Takashi Yano
It seems that current _cygtls::handle_SIGCONT() code sometimes falls into a deadlock due to frequent TLS lock/unlock operation in the yield() loop. With this patch, the yield() in the wait loop is placed outside the TLS lock to avoid frequent TLS lock/unlock. Fixes: 9ae51bcc51a7 ("Cygwin: signal:

Re: [PATCH] Cygwin: mmap: use 64K pages for bookkeeping

2025-01-20 Thread Corinna Vinschen
On Jan 17 18:22, Ken Brown wrote: > On 1/15/2025 12:31 PM, Corinna Vinschen wrote: > > > Ouch. It looks like we can't go to 64K bookkeeping. Windows files are > > > not length-aligned to 64K allocation granularity, but to 4K pagesize. > > > Thus, if we align the length to 64K in mprotect or > > >

Re: [PATCH v2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Corinna Vinschen
On Jan 19 19:42, Takashi Yano wrote: > Hi Corinna, > > On Sun, 19 Jan 2025 11:49:58 +0900 > Takashi Yano wrote: > > On Sat, 18 Jan 2025 17:06:50 -0800 (PST) > > Jeremy Drake wrote: > > > On Sat, 18 Jan 2025, Takashi Yano wrote: > > > > > > > While debugging this problem, I encountered another han

Re: [PATCH v2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Corinna Vinschen
On Jan 20 18:08, Takashi Yano wrote: > On Mon, 20 Jan 2025 00:33:26 +0900 > Takashi Yano wrote: > > On Sun, 19 Jan 2025 09:40:14 +0900 > > Takashi Yano wrote: > > > However, I wonder if cw_timer is re-set by NtSetTimer() in the > > > cygwait(), it will be set to WSSC (60 sec) (or 10msec) in the > >

Re: [PATCH v2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
On Mon, 20 Jan 2025 00:33:26 +0900 Takashi Yano wrote: > On Sun, 19 Jan 2025 09:40:14 +0900 > Takashi Yano wrote: > > On Sat, 18 Jan 2025 20:41:37 +0900 > > Takashi Yano wrote: > > > On Fri, 17 Jan 2025 18:52:41 +0900 > > > Takashi Yano wrote: > > > > On Wed, 8 Jan 2025 18:05:53 -0800 (PST) > > > >

[PATCH v3 1/2] Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent"

2025-01-20 Thread Takashi Yano
This reverts commit a22a0ad7c4f0 to apply a new patch for the same purpose. Signed-off-by: Takashi Yano --- winsup/cygwin/release/3.5.6 | 3 --- winsup/cygwin/sigproc.cc| 20 +--- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/release/3.5.6 b/w

[PATCH v3 2/2] Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent

2025-01-20 Thread Takashi Yano
The commit a22a0ad7c4f0 was not exactly the correct thing. Even with the patch, some hangs still happen. This patch overrides the previous commit to fix these hangs. Addresses: https://cygwin.com/pipermail/cygwin/2024-December/256954.html Addresses: https://cygwin.com/pipermail/cygwin/2024-Decembe

[PATCH v3 0/2] Revert __SIGFLUSHFAST v2 patch and apply v3

2025-01-20 Thread Takashi Yano
Takashi Yano (2): Revert "Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent" Cygwin: signal: Do not handle signal when __SIGFLUSHFAST is sent winsup/cygwin/release/3.5.6 | 3 --- winsup/cygwin/sigproc.cc| 43 +++-- 2 files changed, 27 in

[PATCH v3] Cygwin: Minor updates to load average calculations

2025-01-20 Thread Mark Geisert
Commentary wording now refers to tasks (i.e., threads) rather than processes. This makes it somewhat easier to justify adding two kinds of counters together. After researching what "load average" has meant over time, we have what seems like a reasonable implementation, modulo Windows differences