summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-07 14:43:07 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-07 14:43:07 +0200
commit54ecbb05e4c9bdc9740c96752064760da4a849ce (patch)
treea63c58ea7162208016adff5df83c69000e40ee97 /debian
parent2aa90e286c4b0e8a9191fd66c7b4eb15928c2b66 (diff)
add patch series
Diffstat (limited to 'debian')
-rw-r--r--debian/patches/series2
-rw-r--r--debian/patches/try-fence0001-try-fence.patch27
-rw-r--r--debian/patches/try-fence0002-kern-fix-loop-reading-the-time-value.patch49
3 files changed, 78 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
index c8a3f31..69d990f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -16,3 +16,5 @@ fix-locking0005-ipc-fix-locking-issues.patch
vm-cache-policy0001-VM-cache-policy-change.patch
vm-cache-policy0002-vm-keep-track-of-clean-pages.patch
vm-cache-policy0003-vm-evict-clean-pages-first.patch
+try-fence0001-try-fence.patch
+try-fence0002-kern-fix-loop-reading-the-time-value.patch
diff --git a/debian/patches/try-fence0001-try-fence.patch b/debian/patches/try-fence0001-try-fence.patch
new file mode 100644
index 0000000..017bba8
--- /dev/null
+++ b/debian/patches/try-fence0001-try-fence.patch
@@ -0,0 +1,27 @@
+From 83dad8de034370f216ca8123345d806ffb48c1fb Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Mon, 7 Sep 2015 13:04:39 +0200
+Subject: [PATCH gnumach 1/2] try fence
+
+---
+ kern/mach_clock.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/kern/mach_clock.c b/kern/mach_clock.c
+index 655adf4..aab7010 100644
+--- a/kern/mach_clock.c
++++ b/kern/mach_clock.c
+@@ -99,8 +99,10 @@ MACRO_BEGIN \
+ if (mtime != 0) { \
+ mtime->check_seconds = (time)->seconds; \
+ asm volatile("":::"memory"); \
++ __sync_synchronize(); \
+ mtime->microseconds = (time)->microseconds; \
+ asm volatile("":::"memory"); \
++ __sync_synchronize(); \
+ mtime->seconds = (time)->seconds; \
+ } \
+ MACRO_END
+--
+2.1.4
+
diff --git a/debian/patches/try-fence0002-kern-fix-loop-reading-the-time-value.patch b/debian/patches/try-fence0002-kern-fix-loop-reading-the-time-value.patch
new file mode 100644
index 0000000..4305819
--- /dev/null
+++ b/debian/patches/try-fence0002-kern-fix-loop-reading-the-time-value.patch
@@ -0,0 +1,49 @@
+From 5b02c9e8a6f5e41ed4da7f79ddee60a0d0941201 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Mon, 7 Sep 2015 14:37:40 +0200
+Subject: [PATCH gnumach 2/2] kern: fix loop reading the time value
+
+Previously, recent versions of gcc would hoist the loads out of the
+loop reading the time value.
+
+* kern/macros.h (access_once): New macro.
+* kern/mach_clock.c (host_get_time): Use the new macro to prevent the
+loads from being hoisted out of the loop.
+---
+ kern/mach_clock.c | 6 +++---
+ kern/macros.h | 2 ++
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/kern/mach_clock.c b/kern/mach_clock.c
+index aab7010..0757f6c 100644
+--- a/kern/mach_clock.c
++++ b/kern/mach_clock.c
+@@ -428,9 +428,9 @@ host_get_time(host, current_time)
+ return(KERN_INVALID_HOST);
+
+ do {
+- current_time->seconds = mtime->seconds;
+- current_time->microseconds = mtime->microseconds;
+- } while (current_time->seconds != mtime->check_seconds);
++ current_time->seconds = access_once(mtime->seconds);
++ current_time->microseconds = access_once(mtime->microseconds);
++ } while (current_time->seconds != access_once(mtime->check_seconds));
+
+ return (KERN_SUCCESS);
+ }
+diff --git a/kern/macros.h b/kern/macros.h
+index 7cc579d..c2e8545 100644
+--- a/kern/macros.h
++++ b/kern/macros.h
+@@ -52,6 +52,8 @@
+ #define structof(ptr, type, member) \
+ ((type *)((char *)(ptr) - offsetof(type, member)))
+
++#define access_once(x) (*(volatile typeof(x) *)&(x))
++
+ #define alignof(x) __alignof__(x)
+
+ #ifndef likely
+--
+2.1.4
+