Fix signal handling when io-thread is disabled
PATCH v2 1/1 Fix signal handling when io-thread is disabled
Changes since v1:
- take pthread_sigmask() out of the ifdef as it is now common to both parts.
This fix effectively blocks, in the main thread, the signals handled by signalfd or the compatibility signal thread.
This way, such signals are received synchronously in the main thread through sigfd_handler() instead of triggering the signal handler directly, asynchronously.
--- cpus.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpus.c +1 -1
@@ -399,7 +399,6 @@ static int qemu_signal_init(void)sigaddset (&set,SIGALRM );sigaddset (&set,SIG_IPI );sigaddset (&set,SIGBUS ); -pthread_sigmask (SIG_BLOCK , &set,NULL );#else sigemptyset (&set);sigaddset (&set,SIGBUS );
@@ -412,6 +411,7 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); }#endif +pthread_sigmask (SIG_BLOCK , &set,NULL ); sigfd =qemu_signalfd (&set);if (sigfd ==-1 ) {
Signature · 1 line
1.7.5
Quoted 29 lines · Alexandre Raymond
Changes since v1:
- takepthread_sigmask()out of the ifdef as it is now common to both parts.This fix effectively blocks, in the main thread, the signals handled by signalfd or the compatibility signal thread.
This way, such signals are received synchronously in the main thread through
sigfd_handler()instead of triggering the signal handler directly, asynchronously.Signed-off-by Alexandre Raymond <[email protected]>--- cpus.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)cpus.c +0
-1@@ -399,7 +399,6 @@ static int qemu_signal_init(void)sigaddset (&set,SIGALRM );sigaddset (&set,SIG_IPI );sigaddset (&set,SIGBUS ); -pthread_sigmask (SIG_BLOCK , &set,NULL );#else sigemptyset (&set);sigaddset (&set,SIGBUS );
cpus.c static int qemu_signal_init(void) · line 417
Quoted 7 lines
cpus.c +1
-0@@ -412,6 +411,7 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); }#endif +pthread_sigmask (SIG_BLOCK , &set,NULL ); sigfd =qemu_signalfd (&set);if (sigfd ==-1 ) {
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
ping?
Quoted 47 lines · Jan Kiszka
Quoted 29 lines · Alexandre Raymond
Changes since v1:
- takepthread_sigmask()out of the ifdef as it is now common to both parts.This fix effectively blocks, in the main thread, the signals handled by signalfd or the compatibility signal thread.
This way, such signals are received synchronously in the main thread through
sigfd_handler()instead of triggering the signal handler directly, asynchronously.Signed-off-by Alexandre Raymond <[email protected]>---
cpus.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)cpus.c +0
-1@@ -399,7 +399,6 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); sigaddset(&set, SIG_IPI); sigaddset(&set, SIGBUS); - pthread_sigmask(SIG_BLOCK, &set, NULL); #else sigemptyset(&set); sigaddset(&set, SIGBUS);cpus.c static int qemu_signal_init(void) · line 417
Quoted 7 lines
cpus.c +1
-0@@ -412,6 +411,7 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); } #endif + pthread_sigmask(SIG_BLOCK, &set, NULL); sigfd = qemu_signalfd(&set); if (sigfd == -1) {Acked-by Jan Kiszka <[email protected]>Thanks,
Jan--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
Blue Swirl
AppliedThanks, applied.
Quoted 52 lines · Alexandre Raymond
ping?
Quoted 47 lines · Jan Kiszka
Quoted 29 lines · Alexandre Raymond
Changes since v1:
- takepthread_sigmask()out of the ifdef as it is now common to both parts.This fix effectively blocks, in the main thread, the signals handled by signalfd or the compatibility signal thread.
This way, such signals are received synchronously in the main thread through
sigfd_handler()instead of triggering the signal handler directly, asynchronously.Signed-off-by Alexandre Raymond <[email protected]>---
cpus.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)cpus.c +0
-1@@ -399,7 +399,6 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); sigaddset(&set, SIG_IPI); sigaddset(&set, SIGBUS); - pthread_sigmask(SIG_BLOCK, &set, NULL); #else sigemptyset(&set); sigaddset(&set, SIGBUS);cpus.c static int qemu_signal_init(void) · line 417
Quoted 7 lines
cpus.c +1
-0@@ -412,6 +411,7 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); } #endif + pthread_sigmask(SIG_BLOCK, &set, NULL); sigfd = qemu_signalfd(&set); if (sigfd == -1) {Acked-by Jan Kiszka <[email protected]>Thanks,
Jan--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux