diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-07 16:22:07 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-07 16:22:07 +0200 |
commit | 999ef58ff726dd233bb35431cc6e7ca81e46d47e (patch) | |
tree | dbd5f954d933919d52e7edc8d461eb10548840da /debian | |
parent | bd84df2cb67b9b4ed62e47cecde5dad9cbd7da4f (diff) |
add patch series
Diffstat (limited to 'debian')
-rw-r--r-- | debian/patches/series | 1 | ||||
-rw-r--r-- | debian/patches/try-fence0001-kern-use-proper-memory-fences-when-handling-the-mapp.patch | 100 |
2 files changed, 101 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series index c8a3f31..e1f462d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -16,3 +16,4 @@ 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-kern-use-proper-memory-fences-when-handling-the-mapp.patch diff --git a/debian/patches/try-fence0001-kern-use-proper-memory-fences-when-handling-the-mapp.patch b/debian/patches/try-fence0001-kern-use-proper-memory-fences-when-handling-the-mapp.patch new file mode 100644 index 0000000..93d1e82 --- /dev/null +++ b/debian/patches/try-fence0001-kern-use-proper-memory-fences-when-handling-the-mapp.patch @@ -0,0 +1,100 @@ +From b740865e41259f24352b23808e31f600654dab77 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] kern: use proper memory fences when handling the + mapped time + +* include/mach/time_value.h (struct mapped_time_value): Adjust comment. +* kern/mach_clock.c (mtime): Likewise. Also make it volatile. +(update_mapped_time): Use full hardware barriers. +(read_mapped_time): New macro with proper fences. +(record_time_stamp, host_get_time): Use the new macro. +--- + include/mach/time_value.h | 1 + + kern/mach_clock.c | 31 ++++++++++++++++--------------- + 2 files changed, 17 insertions(+), 15 deletions(-) + +diff --git a/include/mach/time_value.h b/include/mach/time_value.h +index 61be581..ffc1845 100644 +--- a/include/mach/time_value.h ++++ b/include/mach/time_value.h +@@ -85,6 +85,7 @@ typedef struct time_value time_value_t; + * do { + * secs = mtime->seconds; + * usecs = mtime->microseconds; ++ * __sync_synchronize(); + * } while (secs != mtime->check_seconds); + */ + +diff --git a/kern/mach_clock.c b/kern/mach_clock.c +index 2bcd232..6e4f4cc 100644 +--- a/kern/mach_clock.c ++++ b/kern/mach_clock.c +@@ -86,25 +86,33 @@ int bigadj = 1000000; /* adjust 10*tickadj if adjustment + * do { + * secs = mtime->seconds; + * usecs = mtime->microseconds; ++ * __sync_synchronize(); + * } while (secs != mtime->check_seconds); +- * to read the time correctly. (On a multiprocessor this assumes +- * that processors see each other's writes in the correct order. +- * We have to insert write fence operations.) FIXME ++ * to read the time correctly. + */ + +-mapped_time_value_t *mtime = 0; ++volatile mapped_time_value_t *mtime = 0; + + #define update_mapped_time(time) \ + 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 + ++#define read_mapped_time(time) \ ++MACRO_BEGIN \ ++ do { \ ++ time->seconds = mtime->seconds; \ ++ time->microseconds = mtime->microseconds; \ ++ __sync_synchronize(); \ ++ } while (time->seconds != mtime->check_seconds); \ ++MACRO_END ++ + decl_simple_lock_data(, timer_lock) /* lock for ... */ + timer_elt_data_t timer_head; /* ordered list of timeouts */ + /* (doubles as end-of-list) */ +@@ -395,10 +403,7 @@ clock_boottime_update(struct time_value *new_time) + void + record_time_stamp (time_value_t *stamp) + { +- do { +- stamp->seconds = mtime->seconds; +- stamp->microseconds = mtime->microseconds; +- } while (stamp->seconds != mtime->check_seconds); ++ read_mapped_time(stamp); + time_value_add(stamp, &clock_boottime_offset); + } + +@@ -425,11 +430,7 @@ host_get_time(host, current_time) + if (host == HOST_NULL) + return(KERN_INVALID_HOST); + +- do { +- current_time->seconds = access_once(mtime->seconds); +- current_time->microseconds = access_once(mtime->microseconds); +- } while (current_time->seconds != access_once(mtime->check_seconds)); +- ++ read_mapped_time(current_time); + return (KERN_SUCCESS); + } + +-- +2.1.4 + |