diff options
6 files changed, 258 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series index e532dda..babf625 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -13,3 +13,8 @@ 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 +upstreamme0001-kern-slab-fix-locking.patch +upstreamme0002-kern-bootstrap-fix-locking.patch +upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch +upstreamme0004-kern-printf-do-not-serialize-printf-and-co.patch +upstreamme0005-linux-net-fix-build-with-O0.patch diff --git a/debian/patches/upstreamme0001-kern-slab-fix-locking.patch b/debian/patches/upstreamme0001-kern-slab-fix-locking.patch new file mode 100644 index 0000000..986ad7a --- /dev/null +++ b/debian/patches/upstreamme0001-kern-slab-fix-locking.patch @@ -0,0 +1,26 @@ +From 63e97b694c2f9eefe33d5ac84c18df0dc102759a Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 18 Jul 2015 13:33:33 +0200 +Subject: [PATCH gnumach 1/5] kern/slab: fix locking + +* kern/slab.c (host_slab_info): Fix locking. +--- + kern/slab.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kern/slab.c b/kern/slab.c +index 60378b5..1114cfa 100644 +--- a/kern/slab.c ++++ b/kern/slab.c +@@ -1503,7 +1503,7 @@ kern_return_t host_slab_info(host_t host, cache_info_array_t *infop, + i = 0; + + list_for_each_entry(&kmem_cache_list, cache, node) { +- simple_lock(&cache_lock); ++ simple_lock(&cache->lock); + info[i].flags = ((cache->flags & KMEM_CF_NO_CPU_POOL) + ? CACHE_FLAGS_NO_CPU_POOL : 0) + | ((cache->flags & KMEM_CF_SLAB_EXTERNAL) +-- +2.1.4 + diff --git a/debian/patches/upstreamme0002-kern-bootstrap-fix-locking.patch b/debian/patches/upstreamme0002-kern-bootstrap-fix-locking.patch new file mode 100644 index 0000000..c019e36 --- /dev/null +++ b/debian/patches/upstreamme0002-kern-bootstrap-fix-locking.patch @@ -0,0 +1,34 @@ +From 661a0a5c59714b95633a866f717d8072c67f7ac7 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 18 Jul 2015 18:40:47 +0200 +Subject: [PATCH gnumach 2/5] kern/bootstrap: fix locking + +* kern/bootstrap.c (boot_script_exec_cmd): Add missing unlock. +(user_bootstrap): Likewise. +--- + kern/bootstrap.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/kern/bootstrap.c b/kern/bootstrap.c +index e70e1f6..50388ad 100644 +--- a/kern/bootstrap.c ++++ b/kern/bootstrap.c +@@ -735,6 +735,7 @@ boot_script_exec_cmd (void *hook, task_t task, char *path, int argc, + thread_sleep ((event_t) &info, simple_lock_addr(info.lock), FALSE); + simple_lock (&info.lock); + } ++ simple_unlock (&info.lock); + printf ("\n"); + } + +@@ -769,6 +770,7 @@ static void user_bootstrap(void) + simple_lock (&info->lock); + assert (!info->done); + info->done = 1; ++ simple_unlock (&info->lock); + thread_wakeup ((event_t) info); + + /* +-- +2.1.4 + diff --git a/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch b/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch new file mode 100644 index 0000000..6389074 --- /dev/null +++ b/debian/patches/upstreamme0003-kern-lock-use-compiler-built-in-functions-to-get-ret.patch @@ -0,0 +1,55 @@ +From 1451a958347f5e683c63466cd7dfb893c1651f19 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 18 Jul 2015 18:46:24 +0200 +Subject: [PATCH gnumach 3/5] kern/lock: use compiler built-in functions to get + return address + +* kern/lock.c (struct simple_locks_info): Fix type of `ra'. +(simple_lock, simple_lock_try): Use compiler built-in functions to get +return address. +--- + kern/lock.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/kern/lock.c b/kern/lock.c +index fb5e344..3c74fec 100644 +--- a/kern/lock.c ++++ b/kern/lock.c +@@ -133,7 +133,7 @@ unsigned int simple_locks_taken = 0; + + struct simple_locks_info { + simple_lock_t l; +- unsigned int ra; ++ void *ra; + } simple_locks_info[NSLINFO]; + + void check_simple_locks(void) +@@ -161,10 +161,8 @@ void simple_lock( + + info = &simple_locks_info[simple_locks_taken++]; + info->l = l; +- /* XXX we want our return address, if possible */ +-#if defined(__i386__) +- info->ra = *((unsigned long *)&l - 1); +-#endif /* i386 */ ++ info->ra = ++ __builtin_extract_return_addr (__builtin_return_address (0)); + } + + boolean_t simple_lock_try( +@@ -179,10 +177,8 @@ boolean_t simple_lock_try( + + info = &simple_locks_info[simple_locks_taken++]; + info->l = l; +- /* XXX we want our return address, if possible */ +-#if defined(__i386__) +- info->ra = *((unsigned long *)&l - 1); +-#endif /* i386 */ ++ info->ra = ++ __builtin_extract_return_addr (__builtin_return_address (0)); + + return TRUE; + } +-- +2.1.4 + diff --git a/debian/patches/upstreamme0004-kern-printf-do-not-serialize-printf-and-co.patch b/debian/patches/upstreamme0004-kern-printf-do-not-serialize-printf-and-co.patch new file mode 100644 index 0000000..367d772 --- /dev/null +++ b/debian/patches/upstreamme0004-kern-printf-do-not-serialize-printf-and-co.patch @@ -0,0 +1,112 @@ +From c9e087748246622d824b5ab83ad8cc79b31014d1 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 18 Jul 2015 16:17:50 +0200 +Subject: [PATCH gnumach 4/5] kern/printf: do not serialize printf and co + +A lot of code assumes that printf is re-entrant, e.g. the pagination +code in the debugger, or any use of assert inside the console driver. + +* kern/printf.c: Drop the lock serializing calls to `_doprnt'. +(printf_init): Remove function. +* kern/printf.h (printf_init): Remove declaration. +* kern/startup.c (setup_main): Remove call to `printf_init'. +--- + kern/printf.c | 33 --------------------------------- + kern/printf.h | 2 -- + kern/startup.c | 2 -- + 3 files changed, 37 deletions(-) + +diff --git a/kern/printf.c b/kern/printf.c +index 13f2dc0..50f2362 100644 +--- a/kern/printf.c ++++ b/kern/printf.c +@@ -151,21 +151,6 @@ void printnum( + + boolean_t _doprnt_truncates = FALSE; + +-/* printf could be called at _any_ point during system initialization, +- including before printf_init() gets called from the "normal" place +- in kern/startup.c. */ +-boolean_t _doprnt_lock_initialized = FALSE; +-decl_simple_lock_data(,_doprnt_lock) +- +-void printf_init(void) +-{ +- if (!_doprnt_lock_initialized) +- { +- _doprnt_lock_initialized = TRUE; +- simple_lock_init(&_doprnt_lock); +- } +-} +- + void _doprnt( + const char *fmt, + va_list argp, +@@ -187,22 +172,6 @@ void _doprnt( + int base; + char c; + +- printf_init(); +- +-#if 0 +- /* Make sure that we get *some* printout, no matter what */ +- simple_lock(&_doprnt_lock); +-#else +- { +- int i = 0; +- while (i < 1*1024*1024) { +- if (simple_lock_try(&_doprnt_lock)) +- break; +- i++; +- } +- } +-#endif +- + while ((c = *fmt) != '\0') { + if (c != '%') { + (*putc)(c, putc_arg); +@@ -522,8 +491,6 @@ void _doprnt( + } + fmt++; + } +- +- simple_unlock(&_doprnt_lock); + } + + /* +diff --git a/kern/printf.h b/kern/printf.h +index 76047f0..b72640a 100644 +--- a/kern/printf.h ++++ b/kern/printf.h +@@ -27,8 +27,6 @@ + #include <sys/types.h> + #include <stdarg.h> + +-extern void printf_init (void); +- + extern void _doprnt (const char *fmt, + va_list argp, + void (*putc)(char, vm_offset_t), +diff --git a/kern/startup.c b/kern/startup.c +index f9f0c34..30cff5c 100644 +--- a/kern/startup.c ++++ b/kern/startup.c +@@ -39,7 +39,6 @@ + #include <kern/machine.h> + #include <kern/mach_factor.h> + #include <kern/mach_clock.h> +-#include <kern/printf.h> + #include <kern/processor.h> + #include <kern/rdxtree.h> + #include <kern/sched_prim.h> +@@ -109,7 +108,6 @@ void setup_main(void) + #endif /* MACH_KDB */ + + panic_init(); +- printf_init(); + + sched_init(); + vm_mem_bootstrap(); +-- +2.1.4 + diff --git a/debian/patches/upstreamme0005-linux-net-fix-build-with-O0.patch b/debian/patches/upstreamme0005-linux-net-fix-build-with-O0.patch new file mode 100644 index 0000000..169eff5 --- /dev/null +++ b/debian/patches/upstreamme0005-linux-net-fix-build-with-O0.patch @@ -0,0 +1,26 @@ +From 92e98a7f4d4fa75b286a067e1d1caef514fccb0d Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 18 Jul 2015 18:52:22 +0200 +Subject: [PATCH gnumach 5/5] linux/net: fix build with -O0 + +* linux/src/drivers/net/pci-scan.c: Avoid #erroring out. +--- + linux/src/drivers/net/pci-scan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux/src/drivers/net/pci-scan.c b/linux/src/drivers/net/pci-scan.c +index 60525b7..ffb7b12 100644 +--- a/linux/src/drivers/net/pci-scan.c ++++ b/linux/src/drivers/net/pci-scan.c +@@ -31,7 +31,7 @@ static int min_pci_latency = 32; + #if ! defined(__KERNEL__) + #define __KERNEL__ 1 + #endif +-#if !defined(__OPTIMIZE__) ++#if !defined(__OPTIMIZE__) && /* Mach glue, we think this is ok now: */ 0 + #warning You must compile this file with the correct options! + #warning See the last lines of the source file. + #error You must compile this driver with the proper options, including "-O". +-- +2.1.4 + |