diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-17 11:43:18 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-17 11:43:18 +0100 |
commit | eb095839b802975cada1957d5285bc2d1458e2bf (patch) | |
tree | 3b610f599d2ab7a456992eb5b746110088cdc57a /debian | |
parent | 25a2ea9dde991cf0174871c7ec79b438ba3e9626 (diff) |
add patch series
Diffstat (limited to 'debian')
-rw-r--r-- | debian/patches/0001-libports-avoid-acquiring-global-lock-in-message-disp.patch | 80 | ||||
-rw-r--r-- | debian/patches/0002-startup-faster-reboots.patch | 25 | ||||
-rw-r--r-- | debian/patches/series | 2 |
3 files changed, 107 insertions, 0 deletions
diff --git a/debian/patches/0001-libports-avoid-acquiring-global-lock-in-message-disp.patch b/debian/patches/0001-libports-avoid-acquiring-global-lock-in-message-disp.patch new file mode 100644 index 00000000..17af18da --- /dev/null +++ b/debian/patches/0001-libports-avoid-acquiring-global-lock-in-message-disp.patch @@ -0,0 +1,80 @@ +From 9e94fffba8ffbc9af4a6ceb75a78d2dab2da5682 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Mon, 15 Dec 2014 11:53:26 +0100 +Subject: [PATCH hurd 1/2] libports: avoid acquiring global lock in message + dispatch + +* libports/interrupt-operation.c (ports_S_interrupt_operation): Update +`cancel_threshold' using atomic operations. +* libports/manage-multithread.c (internal_demuxer): Avoid taking the lock. +* libports/ports.h (struct port_info): Mention that one needs atomic +operations to access `cancel_threshold'. +--- + libports/interrupt-operation.c | 14 ++++++++++---- + libports/manage-multithread.c | 8 +++++--- + libports/ports.h | 2 +- + 3 files changed, 16 insertions(+), 8 deletions(-) + +diff --git a/libports/interrupt-operation.c b/libports/interrupt-operation.c +index 943bd4f..5d4b0b7 100644 +--- a/libports/interrupt-operation.c ++++ b/libports/interrupt-operation.c +@@ -27,12 +27,18 @@ kern_return_t + ports_S_interrupt_operation (struct port_info *pi, + mach_port_seqno_t seqno) + { ++ mach_port_seqno_t old; ++ + if (!pi) + return EOPNOTSUPP; +- pthread_mutex_lock (&_ports_lock); +- if (pi->cancel_threshold < seqno) +- pi->cancel_threshold = seqno; +- pthread_mutex_unlock (&_ports_lock); ++ ++ retry: ++ old = __atomic_load_n (&pi->cancel_threshold, __ATOMIC_SEQ_CST); ++ if (old < seqno ++ && ! __atomic_compare_exchange_n (&pi->cancel_threshold, &old, seqno, ++ 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) ++ goto retry; ++ + ports_interrupt_rpcs (pi); + return 0; + } +diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c +index 2067cba..7d2e126 100644 +--- a/libports/manage-multithread.c ++++ b/libports/manage-multithread.c +@@ -173,10 +173,12 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket, + } + else + { +- pthread_mutex_lock (&_ports_lock); +- if (inp->msgh_seqno < pi->cancel_threshold) ++ mach_port_seqno_t cancel_threshold = ++ __atomic_load_n (&pi->cancel_threshold, __ATOMIC_SEQ_CST); ++ ++ if (inp->msgh_seqno < cancel_threshold) + hurd_thread_cancel (link.thread); +- pthread_mutex_unlock (&_ports_lock); ++ + status = demuxer (inp, outheadp); + ports_end_rpc (pi, &link); + } +diff --git a/libports/ports.h b/libports/ports.h +index a625b47..f02edb4 100644 +--- a/libports/ports.h ++++ b/libports/ports.h +@@ -48,7 +48,7 @@ struct port_info + struct port_class *class; + refcounts_t refcounts; + mach_port_mscount_t mscount; +- mach_msg_seqno_t cancel_threshold; ++ mach_msg_seqno_t cancel_threshold; /* needs atomic operations */ + int flags; + mach_port_t port_right; + struct rpc_info *current_rpcs; +-- +2.1.3 + diff --git a/debian/patches/0002-startup-faster-reboots.patch b/debian/patches/0002-startup-faster-reboots.patch new file mode 100644 index 00000000..1291b446 --- /dev/null +++ b/debian/patches/0002-startup-faster-reboots.patch @@ -0,0 +1,25 @@ +From 6214a1df308f46738a832b04489200127e59a927 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Wed, 17 Dec 2014 11:43:09 +0100 +Subject: [PATCH hurd 2/2] startup: faster reboots + +--- + startup/startup.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/startup/startup.c b/startup/startup.c +index 601c894..ebd0e12 100644 +--- a/startup/startup.c ++++ b/startup/startup.c +@@ -176,7 +176,7 @@ reboot_mach (int flags) + printf ("%s: %sing Mach (flags %#x)...\n", + program_invocation_short_name, BOOT (flags), flags); + fflush (stdout); +- sleep (5); ++ sleep (1); + while ((err = host_reboot (host_priv, flags))) + error (0, err, "reboot"); + for (;;); +-- +2.1.3 + diff --git a/debian/patches/series b/debian/patches/series index ef03f009..0dc4c152 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -45,3 +45,5 @@ startup-avoid-broken-puts.patch pfinet_dhcp.patch libports-payloads.patch proc-task-notify-0005-proc-fix-build.patch +0001-libports-avoid-acquiring-global-lock-in-message-disp.patch +0002-startup-faster-reboots.patch |