summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemy Noel <mocramis@gmail.com>2018-04-18 21:11:16 +0200
committerRemy Noel <mocramis@gmail.com>2018-04-18 21:11:16 +0200
commit6b3df26a8822b08f87a2aab5085d4e51c5168583 (patch)
tree66a15c26244ed0cdaee173ae931b899761cb69cd
parent7f1d6dcb4317647a3fc06f7d95f751142d7c6f16 (diff)
parent3640f94ee392b19de48360d2d026a7f581447049 (diff)
Merge branch 'master' into perfmon
-rw-r--r--arch/x86/machine/acpi.h6
-rw-r--r--arch/x86/machine/asm.h6
-rw-r--r--arch/x86/machine/atcons.h6
-rw-r--r--arch/x86/machine/atkbd.h6
-rw-r--r--arch/x86/machine/atomic.h62
-rw-r--r--arch/x86/machine/biosmem.h6
-rw-r--r--arch/x86/machine/boot.h6
-rw-r--r--arch/x86/machine/cga.h6
-rw-r--r--arch/x86/machine/cpu.h18
-rw-r--r--arch/x86/machine/elf.h6
-rw-r--r--arch/x86/machine/io.h6
-rw-r--r--arch/x86/machine/lapic.h6
-rw-r--r--arch/x86/machine/multiboot.h6
-rw-r--r--arch/x86/machine/page.h6
-rw-r--r--arch/x86/machine/pic.h6
-rw-r--r--arch/x86/machine/pit.h6
-rw-r--r--arch/x86/machine/pmap.h6
-rw-r--r--arch/x86/machine/pmem.h6
-rw-r--r--arch/x86/machine/ssp.h6
-rw-r--r--arch/x86/machine/strace.h6
-rw-r--r--arch/x86/machine/string.h6
-rw-r--r--arch/x86/machine/tcb.h6
-rw-r--r--arch/x86/machine/trap.h6
-rw-r--r--arch/x86/machine/types.h6
-rw-r--r--arch/x86/machine/uart.h6
-rw-r--r--doc/style.9.txt11
-rw-r--r--kern/Kconfig14
-rw-r--r--kern/atomic.h31
-rw-r--r--kern/hlist.h30
-rw-r--r--kern/list.h24
-rw-r--r--kern/log2.h6
-rw-r--r--kern/rbtree.h94
-rw-r--r--kern/rcu.c6
-rw-r--r--kern/shell.h10
-rw-r--r--kern/slist.h36
-rwxr-xr-xtools/qemu.sh3
36 files changed, 242 insertions, 241 deletions
diff --git a/arch/x86/machine/acpi.h b/arch/x86/machine/acpi.h
index 1f65fd6..cf46660 100644
--- a/arch/x86/machine/acpi.h
+++ b/arch/x86/machine/acpi.h
@@ -19,8 +19,8 @@
* specification v1.0.
*/
-#ifndef _X86_ACPI_H
-#define _X86_ACPI_H
+#ifndef X86_ACPI_H
+#define X86_ACPI_H
#include <kern/init.h>
@@ -32,4 +32,4 @@
*/
INIT_OP_DECLARE(acpi_setup);
-#endif /* _X86_ACPI_H */
+#endif /* X86_ACPI_H */
diff --git a/arch/x86/machine/asm.h b/arch/x86/machine/asm.h
index 204d6fe..44a0c6e 100644
--- a/arch/x86/machine/asm.h
+++ b/arch/x86/machine/asm.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_ASM_H
-#define _X86_ASM_H
+#ifndef X86_ASM_H
+#define X86_ASM_H
#ifndef __ASSEMBLER__
#warning "asm.h included from a C file"
@@ -39,4 +39,4 @@ x:
#define ASM_END(x) \
.size x, . - x
-#endif /* _X86_ASM_H */
+#endif /* X86_ASM_H */
diff --git a/arch/x86/machine/atcons.h b/arch/x86/machine/atcons.h
index 0d4893a..1b4fb68 100644
--- a/arch/x86/machine/atcons.h
+++ b/arch/x86/machine/atcons.h
@@ -18,8 +18,8 @@
* AT console driver.
*/
-#ifndef _X86_ATCONS_H
-#define _X86_ATCONS_H
+#ifndef X86_ATCONS_H
+#define X86_ATCONS_H
#include <kern/init.h>
@@ -52,4 +52,4 @@ INIT_OP_DECLARE(atcons_bootstrap);
*/
INIT_OP_DECLARE(atcons_setup);
-#endif /* _X86_ATCONS_H */
+#endif /* X86_ATCONS_H */
diff --git a/arch/x86/machine/atkbd.h b/arch/x86/machine/atkbd.h
index 9efeefb..646b2e2 100644
--- a/arch/x86/machine/atkbd.h
+++ b/arch/x86/machine/atkbd.h
@@ -18,8 +18,8 @@
* Tiny AT keyboard driver.
*/
-#ifndef _X86_ATKBD_H
-#define _X86_ATKBD_H
+#ifndef X86_ATKBD_H
+#define X86_ATKBD_H
#include <kern/init.h>
@@ -29,4 +29,4 @@
*/
INIT_OP_DECLARE(atkbd_setup);
-#endif /* _X86_ATKBD_H */
+#endif /* X86_ATKBD_H */
diff --git a/arch/x86/machine/atomic.h b/arch/x86/machine/atomic.h
index ce41358..36f0067 100644
--- a/arch/x86/machine/atomic.h
+++ b/arch/x86/machine/atomic.h
@@ -19,8 +19,8 @@
* Architecture-specific definitions for atomic operations.
*/
-#ifndef _X86_ATOMIC_H
-#define _X86_ATOMIC_H
+#ifndef X86_ATOMIC_H
+#define X86_ATOMIC_H
#ifndef KERN_ATOMIC_H
#error "don't include <machine/atomic.h> directly, use <kern/atomic.h> instead"
@@ -46,38 +46,38 @@
* Temporarily discard qualifiers when loading 64-bits values with a
* compare-and-swap operation.
*/
-#define atomic_load_64(ptr, mo) \
-MACRO_BEGIN \
- uint64_t ret___ = 0; \
- \
- __atomic_compare_exchange_n((uint64_t *)(ptr), &ret___, 0, \
- false, mo, __ATOMIC_RELAXED); \
- ret___; \
+#define atomic_load_64(ptr, mo) \
+MACRO_BEGIN \
+ uint64_t ret_ = 0; \
+ \
+ __atomic_compare_exchange_n((uint64_t *)(ptr), &ret_, 0, \
+ false, mo, __ATOMIC_RELAXED); \
+ ret_; \
MACRO_END
-#define atomic_load(ptr, mo) \
- (typeof(*(ptr)))__builtin_choose_expr(sizeof(*(ptr)) == 8, \
- atomic_load_64(ptr, mo), \
+#define atomic_load(ptr, mo) \
+ (typeof(*(ptr)))__builtin_choose_expr(sizeof(*(ptr)) == 8, \
+ atomic_load_64(ptr, mo), \
__atomic_load_n(ptr, mo))
-#define atomic_store(ptr, val, mo) \
-MACRO_BEGIN \
- if (sizeof(*(ptr)) != 8) { \
- __atomic_store_n(ptr, val, mo); \
- } else { \
- typeof(*(ptr)) oval___, nval___; \
- bool done___; \
- \
- oval___ = *(ptr); \
- nval___ = (val); \
- \
- do { \
- done___ = __atomic_compare_exchange_n(ptr, &oval___, nval___, \
- false, mo, \
- __ATOMIC_RELAXED); \
- } while (!done___); \
- \
- } \
+#define atomic_store(ptr, val, mo) \
+MACRO_BEGIN \
+ if (sizeof(*(ptr)) != 8) { \
+ __atomic_store_n(ptr, val, mo); \
+ } else { \
+ typeof(*(ptr)) oval_, nval_; \
+ bool done_; \
+ \
+ oval_ = *(ptr); \
+ nval_ = (val); \
+ \
+ do { \
+ done_ = __atomic_compare_exchange_n(ptr, &oval_, nval_, \
+ false, mo, \
+ __ATOMIC_RELAXED); \
+ } while (!done_); \
+ \
+ } \
MACRO_END
/*
@@ -101,4 +101,4 @@ MACRO_END
#endif /* __clang__ */
-#endif /* _X86_ATOMIC_H */
+#endif /* X86_ATOMIC_H */
diff --git a/arch/x86/machine/biosmem.h b/arch/x86/machine/biosmem.h
index 2a701de..cff698d 100644
--- a/arch/x86/machine/biosmem.h
+++ b/arch/x86/machine/biosmem.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_BIOSMEM_H
-#define _X86_BIOSMEM_H
+#ifndef X86_BIOSMEM_H
+#define X86_BIOSMEM_H
#include <stdbool.h>
@@ -108,4 +108,4 @@ phys_addr_t biosmem_directmap_end(void);
*/
INIT_OP_DECLARE(biosmem_setup);
-#endif /* _X86_BIOSMEM_H */
+#endif /* X86_BIOSMEM_H */
diff --git a/arch/x86/machine/boot.h b/arch/x86/machine/boot.h
index c85c264..d30b3be 100644
--- a/arch/x86/machine/boot.h
+++ b/arch/x86/machine/boot.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_BOOT_H
-#define _X86_BOOT_H
+#ifndef X86_BOOT_H
+#define X86_BOOT_H
#include <stdnoreturn.h>
@@ -166,4 +166,4 @@ INIT_OP_DECLARE(boot_setup_shutdown);
#endif /* __ASSEMBLER__ */
-#endif /* _X86_BOOT_H */
+#endif /* X86_BOOT_H */
diff --git a/arch/x86/machine/cga.h b/arch/x86/machine/cga.h
index 2708ec4..f7ad539 100644
--- a/arch/x86/machine/cga.h
+++ b/arch/x86/machine/cga.h
@@ -18,8 +18,8 @@
* Tiny CGA driver.
*/
-#ifndef _X86_CGA_H
-#define _X86_CGA_H
+#ifndef X86_CGA_H
+#define X86_CGA_H
#include <kern/init.h>
@@ -40,4 +40,4 @@ void cga_cursor_right(void);
*/
INIT_OP_DECLARE(cga_setup);
-#endif /* _X86_CGA_H */
+#endif /* X86_CGA_H */
diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h
index 3b7db61..98c363f 100644
--- a/arch/x86/machine/cpu.h
+++ b/arch/x86/machine/cpu.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_CPU_H
-#define _X86_CPU_H
+#ifndef X86_CPU_H
+#define X86_CPU_H
#include <limits.h>
@@ -442,13 +442,13 @@ extern void *cpu_local_area;
#define cpu_local_ptr(var) \
MACRO_BEGIN \
- typeof(var) *ptr___ = &(var); \
+ typeof(var) *ptr_ = &(var); \
\
asm("add %%fs:%1, %0" \
- : "+r" (ptr___) \
+ : "+r" (ptr_) \
: "m" (cpu_local_area)); \
\
- ptr___; \
+ ptr_; \
MACRO_END
#define cpu_local_var(var) (*cpu_local_ptr(var))
@@ -461,13 +461,13 @@ MACRO_END
#define cpu_local_read(var) \
MACRO_BEGIN \
- typeof(var) val___; \
+ typeof(var) val_; \
\
asm("mov %%fs:%1, %0" \
- : "=r" (val___) \
+ : "=r" (val_) \
: "m" (var)); \
\
- val___; \
+ val_; \
MACRO_END
static inline struct cpu *
@@ -721,4 +721,4 @@ INIT_OP_DECLARE(cpu_setup_shutdown);
#endif /* __ASSEMBLER__ */
-#endif /* _X86_CPU_H */
+#endif /* X86_CPU_H */
diff --git a/arch/x86/machine/elf.h b/arch/x86/machine/elf.h
index e0ea260..04df7e0 100644
--- a/arch/x86/machine/elf.h
+++ b/arch/x86/machine/elf.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_ELF_H
-#define _X86_ELF_H
+#ifndef X86_ELF_H
+#define X86_ELF_H
#define ELF_SHT_SYMTAB 2
#define ELF_SHT_STRTAB 3
@@ -58,4 +58,4 @@ struct elf_sym {
#endif /* __LP64__ */
-#endif /* _X86_ELF_H */
+#endif /* X86_ELF_H */
diff --git a/arch/x86/machine/io.h b/arch/x86/machine/io.h
index fb566b9..8c48332 100644
--- a/arch/x86/machine/io.h
+++ b/arch/x86/machine/io.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_IO_H
-#define _X86_IO_H
+#ifndef X86_IO_H
+#define X86_IO_H
#include <stdint.h>
@@ -41,4 +41,4 @@ io_write_byte(uint16_t port, uint8_t value)
asm volatile("outb %%al, %%dx" : : "d" (port), "a" (value));
}
-#endif /* _X86_IO_H */
+#endif /* X86_IO_H */
diff --git a/arch/x86/machine/lapic.h b/arch/x86/machine/lapic.h
index ae7abfe..6355da4 100644
--- a/arch/x86/machine/lapic.h
+++ b/arch/x86/machine/lapic.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_LAPIC_H
-#define _X86_LAPIC_H
+#ifndef X86_LAPIC_H
+#define X86_LAPIC_H
#include <stdbool.h>
#include <stdint.h>
@@ -58,4 +58,4 @@ void lapic_timer_intr(struct trap_frame *frame);
void lapic_error_intr(struct trap_frame *frame);
void lapic_spurious_intr(struct trap_frame *frame);
-#endif /* _X86_LAPIC_H */
+#endif /* X86_LAPIC_H */
diff --git a/arch/x86/machine/multiboot.h b/arch/x86/machine/multiboot.h
index 80d793f..826ea2d 100644
--- a/arch/x86/machine/multiboot.h
+++ b/arch/x86/machine/multiboot.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_MULTIBOOT_H
-#define _X86_MULTIBOOT_H
+#ifndef X86_MULTIBOOT_H
+#define X86_MULTIBOOT_H
/*
* Magic number provided by the OS to the boot loader.
@@ -108,4 +108,4 @@ struct multiboot_info {
#endif /* __ASSEMBLER__ */
-#endif /* _X86_MULTIBOOT_H */
+#endif /* X86_MULTIBOOT_H */
diff --git a/arch/x86/machine/page.h b/arch/x86/machine/page.h
index 43ab237..19ef7b5 100644
--- a/arch/x86/machine/page.h
+++ b/arch/x86/machine/page.h
@@ -19,11 +19,11 @@
* other headers that may cause circular dependencies.
*/
-#ifndef _X86_PAGE_H
-#define _X86_PAGE_H
+#ifndef X86_PAGE_H
+#define X86_PAGE_H
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
-#endif /* _X86_PAGE_H */
+#endif /* X86_PAGE_H */
diff --git a/arch/x86/machine/pic.h b/arch/x86/machine/pic.h
index 89833d0..4796cff 100644
--- a/arch/x86/machine/pic.h
+++ b/arch/x86/machine/pic.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_PIC_H
-#define _X86_PIC_H
+#ifndef X86_PIC_H
+#define X86_PIC_H
/*
* Interrupts per PIC.
@@ -44,4 +44,4 @@ void pic_setup(void);
*/
void pic_setup_disabled(void);
-#endif /* _X86_PIC_H */
+#endif /* X86_PIC_H */
diff --git a/arch/x86/machine/pit.h b/arch/x86/machine/pit.h
index 7bf7a7b..a2caf0b 100644
--- a/arch/x86/machine/pit.h
+++ b/arch/x86/machine/pit.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_PIT_H
-#define _X86_PIT_H
+#ifndef X86_PIT_H
+#define X86_PIT_H
/*
* Initialize the PIT as a free running counter.
@@ -37,4 +37,4 @@ void pit_setup(void);
*/
void pit_delay(unsigned long usecs);
-#endif /* _X86_PIT_H */
+#endif /* X86_PIT_H */
diff --git a/arch/x86/machine/pmap.h b/arch/x86/machine/pmap.h
index 369679f..3a6a120 100644
--- a/arch/x86/machine/pmap.h
+++ b/arch/x86/machine/pmap.h
@@ -18,8 +18,8 @@
* TODO Comment.
*/
-#ifndef _X86_PMAP_H
-#define _X86_PMAP_H
+#ifndef X86_PMAP_H
+#define X86_PMAP_H
#include <kern/macros.h>
@@ -336,4 +336,4 @@ INIT_OP_DECLARE(pmap_setup);
#endif /* __ASSEMBLER__ */
-#endif /* _X86_PMAP_H */
+#endif /* X86_PMAP_H */
diff --git a/arch/x86/machine/pmem.h b/arch/x86/machine/pmem.h
index 33006a7..98b448d 100644
--- a/arch/x86/machine/pmem.h
+++ b/arch/x86/machine/pmem.h
@@ -21,8 +21,8 @@
* other headers that may cause circular dependencies.
*/
-#ifndef _X86_PMEM_H
-#define _X86_PMEM_H
+#ifndef X86_PMEM_H
+#define X86_PMEM_H
#include <kern/macros.h>
@@ -64,4 +64,4 @@
#define PMEM_ZONE_HIGHMEM 2
#endif /* __LP64__ */
-#endif /* _X86_PMEM_H */
+#endif /* X86_PMEM_H */
diff --git a/arch/x86/machine/ssp.h b/arch/x86/machine/ssp.h
index f278361..832e409 100644
--- a/arch/x86/machine/ssp.h
+++ b/arch/x86/machine/ssp.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_SSP_H
-#define _X86_SSP_H
+#ifndef X86_SSP_H
+#define X86_SSP_H
#ifdef __LP64__
#define SSP_GUARD_WORD 0xdeadd00ddeadd00d
@@ -29,4 +29,4 @@
*/
#define SSP_WORD_TLS_OFFSET 5
-#endif /* _X86_SSP_H */
+#endif /* X86_SSP_H */
diff --git a/arch/x86/machine/strace.h b/arch/x86/machine/strace.h
index b55f6b8..482768b 100644
--- a/arch/x86/machine/strace.h
+++ b/arch/x86/machine/strace.h
@@ -20,8 +20,8 @@
* TODO Make it possible to debug without the frame pointer.
*/
-#ifndef _X86_STRACE_H
-#define _X86_STRACE_H
+#ifndef X86_STRACE_H
+#define X86_STRACE_H
#include <kern/init.h>
#include <kern/macros.h>
@@ -61,4 +61,4 @@ void strace_set_mbi(const struct multiboot_raw_info *mbi);
*/
INIT_OP_DECLARE(strace_setup);
-#endif /* _X86_STRACE_H */
+#endif /* X86_STRACE_H */
diff --git a/arch/x86/machine/string.h b/arch/x86/machine/string.h
index 6111ba1..a64e2fc 100644
--- a/arch/x86/machine/string.h
+++ b/arch/x86/machine/string.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_STRING_H
-#define _X86_STRING_H
+#ifndef X86_STRING_H
+#define X86_STRING_H
/*
* Provide architecture-specific string functions.
@@ -31,4 +31,4 @@
#define STRING_ARCH_STRNCMP
#define STRING_ARCH_STRCHR
-#endif /* _X86_STRING_H */
+#endif /* X86_STRING_H */
diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h
index 2e9493d..fb782ab 100644
--- a/arch/x86/machine/tcb.h
+++ b/arch/x86/machine/tcb.h
@@ -18,8 +18,8 @@
* Thread control block.
*/
-#ifndef _X86_TCB_H
-#define _X86_TCB_H
+#ifndef X86_TCB_H
+#define X86_TCB_H
#include <assert.h>
#include <stdint.h>
@@ -125,4 +125,4 @@ void tcb_trace(const struct tcb *tcb);
*/
INIT_OP_DECLARE(tcb_setup);
-#endif /* _X86_TCB_H */
+#endif /* X86_TCB_H */
diff --git a/arch/x86/machine/trap.h b/arch/x86/machine/trap.h
index 699f19e..af6fd6b 100644
--- a/arch/x86/machine/trap.h
+++ b/arch/x86/machine/trap.h
@@ -21,8 +21,8 @@
* other headers that may cause circular dependencies.
*/
-#ifndef _X86_TRAP_H
-#define _X86_TRAP_H
+#ifndef X86_TRAP_H
+#define X86_TRAP_H
#include <machine/page.h>
@@ -182,4 +182,4 @@ INIT_OP_DECLARE(trap_setup);
#endif /* __ASSEMBLER__ */
-#endif /* _X86_TRAP_H */
+#endif /* X86_TRAP_H */
diff --git a/arch/x86/machine/types.h b/arch/x86/machine/types.h
index cd82515..6067454 100644
--- a/arch/x86/machine/types.h
+++ b/arch/x86/machine/types.h
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _X86_TYPES_H
-#define _X86_TYPES_H
+#ifndef X86_TYPES_H
+#define X86_TYPES_H
#ifdef CONFIG_X86_PAE
typedef unsigned long long phys_addr_t;
@@ -24,4 +24,4 @@ typedef unsigned long long phys_addr_t;
typedef unsigned long phys_addr_t;
#endif /* CONFIG_X86_PAE */
-#endif /* _X86_TYPES_H */
+#endif /* X86_TYPES_H */
diff --git a/arch/x86/machine/uart.h b/arch/x86/machine/uart.h
index 0054da8..aaba261 100644
--- a/arch/x86/machine/uart.h
+++ b/arch/x86/machine/uart.h
@@ -18,8 +18,8 @@
* Tiny 8250 UART driver.
*/
-#ifndef _X86_UART_H
-#define _X86_UART_H
+#ifndef X86_UART_H
+#define X86_UART_H
#include <kern/init.h>
@@ -36,4 +36,4 @@ INIT_OP_DECLARE(uart_bootstrap);
*/
INIT_OP_DECLARE(uart_setup);
-#endif /* _X86_UART_H */
+#endif /* X86_UART_H */
diff --git a/doc/style.9.txt b/doc/style.9.txt
index d5b8b3f..efbead0 100644
--- a/doc/style.9.txt
+++ b/doc/style.9.txt
@@ -680,13 +680,10 @@ matching the object.method() syntax.
Function-like macros with local variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Such macros may cause variable shadowing if one of their local variables has
-the same name as one of the arguments. To avoid such situations, local
-variables in function-like macros should be named with a prefix of underscores.
-The C specification describes the use of single and double underscore prefixes
-for file-scope specifiers and names reserved for the implementation. It's
-therefore recommended to use three underscores when naming the local variables
-of function-like macros.
+Variable shadowing occurs in function-like macros if one of their local
+variables has the same name as one of the arguments. To avoid such situations,
+local variables in function-like macros must be named with an underscore
+suffix. This naming scheme is reserved for function-like macro variables.
SEE
---
diff --git a/kern/Kconfig b/kern/Kconfig
index 3101b7f..5e0e5eb 100644
--- a/kern/Kconfig
+++ b/kern/Kconfig
@@ -63,6 +63,20 @@ config MUTEX_PLAIN
endchoice
+config RCU_WINDOW_CHECK_INTERVAL
+ int "Interval between RCU window checks"
+ range 1 100
+ default 10
+ ---help---
+ Time (in milliseconds) between two RCU window checks.
+
+ The RCU system keeps memory used by read-side critical sections
+ until it is safe to release it, which can only be determined when
+ checking windows. As a result, checking windows more frequently
+ may help lower latencies on synchronous RCU waits, and in turn,
+ the amount of memory pending release, at the cost of increased
+ CPU overhead.
+
config SHELL
bool "Embedded shell"
default n
diff --git a/kern/atomic.h b/kern/atomic.h
index e106dac..5d99da9 100644
--- a/kern/atomic.h
+++ b/kern/atomic.h
@@ -31,20 +31,9 @@
/*
* Supported memory orders.
- *
- * Note that the consume order is aliased to relaxed. This assumes that
- * all supported processors respect data dependencies. The rationale is
- * that the definition for the consume order is confusing enough that
- * most compilers alias it to acquire, which forces the generation of
- * memory barrier instructions even when they're not really needed.
- * Since there is currently no processor where using consume or relaxed
- * would produce different code, it is safe to establish that alias.
- * It serves as explicit documentation for code review, and will easily
- * be replaced with the true consume order once compiler support becomes
- * efficient and reliable.
*/
#define ATOMIC_RELAXED __ATOMIC_RELAXED
-#define ATOMIC_CONSUME __ATOMIC_RELAXED
+#define ATOMIC_CONSUME __ATOMIC_CONSUME
#define ATOMIC_ACQUIRE __ATOMIC_ACQUIRE
#define ATOMIC_RELEASE __ATOMIC_RELEASE
#define ATOMIC_ACQ_REL __ATOMIC_ACQ_REL
@@ -89,15 +78,15 @@
* value, some compilers seem to have trouble when all parameters don't
* have the same type.
*/
-#define atomic_cas(ptr, oval, nval, mo) \
-MACRO_BEGIN \
- typeof(*(ptr)) oval___, nval___; \
- \
- oval___ = (oval); \
- nval___ = (nval); \
- __atomic_compare_exchange_n(ptr, &oval___, nval___, false, \
- mo, ATOMIC_RELAXED); \
- oval___; \
+#define atomic_cas(ptr, oval, nval, mo) \
+MACRO_BEGIN \
+ typeof(*(ptr)) oval_, nval_; \
+ \
+ oval_ = (oval); \
+ nval_ = (nval); \
+ __atomic_compare_exchange_n(ptr, &oval_, nval_, false, \
+ mo, ATOMIC_RELAXED); \
+ oval_; \
MACRO_END
/*
diff --git a/kern/hlist.h b/kern/hlist.h
index 61fad4f..739ea83 100644
--- a/kern/hlist.h
+++ b/kern/hlist.h
@@ -200,23 +200,23 @@ hlist_remove(struct hlist_node *node)
*/
#define hlist_first_entry(list, type, member) \
MACRO_BEGIN \
- struct hlist_node *first___; \
+ struct hlist_node *first_; \
\
- first___ = (list)->first; \
- hlist_end(first___) ? NULL : hlist_entry(first___, type, member); \
+ first_ = (list)->first; \
+ hlist_end(first_) ? NULL : hlist_entry(first_, type, member); \
MACRO_END
/*
* Get the entry next to the given entry.
*/
-#define hlist_next_entry(entry, member) \
+#define hlist_next_entry(entry, member) \
MACRO_BEGIN \
- struct hlist_node *next___; \
+ struct hlist_node *next_; \
\
- next___ = (entry)->member.next; \
- hlist_end(next___) \
+ next_ = (entry)->member.next; \
+ hlist_end(next_) \
? NULL \
- : hlist_entry(next___, typeof(*entry), member); \
+ : hlist_entry(next_, typeof(*entry), member); \
MACRO_END
/*
@@ -355,10 +355,10 @@ hlist_rcu_remove(struct hlist_node *node)
*/
#define hlist_rcu_first_entry(list, type, member) \
MACRO_BEGIN \
- struct hlist_node *first___; \
+ struct hlist_node *first_; \
\
- first___ = hlist_rcu_first(list); \
- hlist_end(first___) ? NULL : hlist_entry(first___, type, member); \
+ first_ = hlist_rcu_first(list); \
+ hlist_end(first_) ? NULL : hlist_entry(first_, type, member); \
MACRO_END
/*
@@ -366,12 +366,12 @@ MACRO_END
*/
#define hlist_rcu_next_entry(entry, member) \
MACRO_BEGIN \
- struct hlist_node *next___; \
+ struct hlist_node *next_; \
\
- next___ = hlist_rcu_next(&entry->member); \
- hlist_end(next___) \
+ next_ = hlist_rcu_next(&entry->member); \
+ hlist_end(next_) \
? NULL \
- : hlist_entry(next___, typeof(*entry), member); \
+ : hlist_entry(next_, typeof(*entry), member); \
MACRO_END
/*
diff --git a/kern/list.h b/kern/list.h
index 8163176..2ba7f09 100644
--- a/kern/list.h
+++ b/kern/list.h
@@ -480,14 +480,14 @@ list_rcu_remove(struct list *node)
*/
#define list_rcu_first_entry(head, type, member) \
MACRO_BEGIN \
- struct list *list___; \
- struct list *first___; \
+ struct list *list_; \
+ struct list *first_; \
\
- list___ = (head); \
- first___ = list_rcu_first(list___); \
- list_end(list___, first___) \
+ list_ = (head); \
+ first_ = list_rcu_first(list_); \
+ list_end(list_, first_) \
? NULL \
- : list_entry(first___, type, member); \
+ : list_entry(first_, type, member); \
MACRO_END
/*
@@ -499,14 +499,14 @@ MACRO_END
*/
#define list_rcu_next_entry(head, entry, member) \
MACRO_BEGIN \
- struct list *list___; \
- struct list *next___; \
+ struct list *list_; \
+ struct list *next_; \
\
- list___ = (head); \
- next___ = list_rcu_next(&entry->member); \
- list_end(list___, next___) \
+ list_ = (head); \
+ next_ = list_rcu_next(&entry->member); \
+ list_end(list_, next_) \
? NULL \
- : list_entry(next___, typeof(*entry), member); \
+ : list_entry(next_, typeof(*entry), member); \
MACRO_END
/*
diff --git a/kern/log2.h b/kern/log2.h
index 1799b82..c59753f 100644
--- a/kern/log2.h
+++ b/kern/log2.h
@@ -18,8 +18,8 @@
* Integer base 2 logarithm operations.
*/
-#ifndef _KERN_LOG2_H
-#define _KERN_LOG2_H
+#ifndef KERN_LOG2_H
+#define KERN_LOG2_H
#include <assert.h>
#include <limits.h>
@@ -51,4 +51,4 @@ log2_order(unsigned long size)
return log2(size - 1) + 1;
}
-#endif /* _KERN_LOG2_H */
+#endif /* KERN_LOG2_H */
diff --git a/kern/rbtree.h b/kern/rbtree.h
index 7ec83fe..1eafebb 100644
--- a/kern/rbtree.h
+++ b/kern/rbtree.h
@@ -120,22 +120,22 @@ rbtree_empty(const struct rbtree *tree)
*/
#define rbtree_lookup(tree, key, cmp_fn) \
MACRO_BEGIN \
- struct rbtree_node *cur___; \
- int diff___; \
+ struct rbtree_node *cur_; \
+ int diff_; \
\
- cur___ = (tree)->root; \
+ cur_ = (tree)->root; \
\
- while (cur___ != NULL) { \
- diff___ = cmp_fn(key, cur___); \
+ while (cur_ != NULL) { \
+ diff_ = cmp_fn(key, cur_); \
\
- if (diff___ == 0) { \
+ if (diff_ == 0) { \
break; \
} \
\
- cur___ = cur___->children[rbtree_d2i(diff___)]; \
+ cur_ = cur_->children[rbtree_d2i(diff_)]; \
} \
\
- cur___; \
+ cur_; \
MACRO_END
/*
@@ -150,30 +150,30 @@ MACRO_END
*/
#define rbtree_lookup_nearest(tree, key, cmp_fn, dir) \
MACRO_BEGIN \
- struct rbtree_node *cur___, *prev___; \
- int diff___, index___; \
+ struct rbtree_node *cur_, *prev_; \
+ int diff_, index_; \
\
- prev___ = NULL; \
- index___ = -1; \
- cur___ = (tree)->root; \
+ prev_ = NULL; \
+ index_ = -1; \
+ cur_ = (tree)->root; \
\
- while (cur___ != NULL) { \
- diff___ = cmp_fn(key, cur___); \
+ while (cur_ != NULL) { \
+ diff_ = cmp_fn(key, cur_); \
\
- if (diff___ == 0) { \
+ if (diff_ == 0) { \
break; \
} \
\
- prev___ = cur___; \
- index___ = rbtree_d2i(diff___); \
- cur___ = cur___->children[index___]; \
+ prev_ = cur_; \
+ index_ = rbtree_d2i(diff_); \
+ cur_ = cur_->children[index_]; \
} \
\
- if (cur___ == NULL) { \
- cur___ = rbtree_nearest(prev___, index___, dir); \
+ if (cur_ == NULL) { \
+ cur_ = rbtree_nearest(prev_, index_, dir); \
} \
\
- cur___; \
+ cur_; \
MACRO_END
/*
@@ -194,22 +194,22 @@ MACRO_END
*/
#define rbtree_insert(tree, node, cmp_fn) \
MACRO_BEGIN \
- struct rbtree_node *cur___, *prev___; \
- int diff___, index___; \
+ struct rbtree_node *cur_, *prev_; \
+ int diff_, index_; \
\
- prev___ = NULL; \
- index___ = -1; \
- cur___ = (tree)->root; \
+ prev_ = NULL; \
+ index_ = -1; \
+ cur_ = (tree)->root; \
\
- while (cur___ != NULL) { \
- diff___ = cmp_fn(node, cur___); \
- assert(diff___ != 0); \
- prev___ = cur___; \
- index___ = rbtree_d2i(diff___); \
- cur___ = cur___->children[index___]; \
+ while (cur_ != NULL) { \
+ diff_ = cmp_fn(node, cur_); \
+ assert(diff_ != 0); \
+ prev_ = cur_; \
+ index_ = rbtree_d2i(diff_); \
+ cur_ = cur_->children[index_]; \
} \
\
- rbtree_insert_rebalance(tree, prev___, index___, node); \
+ rbtree_insert_rebalance(tree, prev_, index_, node); \
MACRO_END
/*
@@ -225,27 +225,27 @@ MACRO_END
*/
#define rbtree_lookup_slot(tree, key, cmp_fn, slot) \
MACRO_BEGIN \
- struct rbtree_node *cur___, *prev___; \
- int diff___, index___; \
+ struct rbtree_node *cur_, *prev_; \
+ int diff_, index_; \
\
- prev___ = NULL; \
- index___ = 0; \
- cur___ = (tree)->root; \
+ prev_ = NULL; \
+ index_ = 0; \
+ cur_ = (tree)->root; \
\
- while (cur___ != NULL) { \
- diff___ = cmp_fn(key, cur___); \
+ while (cur_ != NULL) { \
+ diff_ = cmp_fn(key, cur_); \
\
- if (diff___ == 0) { \
+ if (diff_ == 0) { \
break; \
} \
\
- prev___ = cur___; \
- index___ = rbtree_d2i(diff___); \
- cur___ = cur___->children[index___]; \
+ prev_ = cur_; \
+ index_ = rbtree_d2i(diff_); \
+ cur_ = cur_->children[index_]; \
} \
\
- (slot) = rbtree_slot(prev___, index___); \
- cur___; \
+ (slot) = rbtree_slot(prev_, index_); \
+ cur_; \
MACRO_END
/*
diff --git a/kern/rcu.c b/kern/rcu.c
index 1903dcf..834a99b 100644
--- a/kern/rcu.c
+++ b/kern/rcu.c
@@ -105,12 +105,12 @@
#define RCU_WINDOW_ID_INIT_VALUE ((unsigned int)-500)
/*
- * Interval between window checking.
+ * Interval (in milliseconds) between window checking.
*
* When windows are checked, a flip occurs if the previous window isn't
* active any more.
*/
-#define RCU_WINDOW_CHECK_INTERVAL_MS 10
+#define RCU_WINDOW_CHECK_INTERVAL CONFIG_RCU_WINDOW_CHECK_INTERVAL
/*
* Grace period states.
@@ -376,7 +376,7 @@ rcu_data_schedule_timer(struct rcu_data *data, uint64_t now)
{
uint64_t ticks;
- ticks = clock_ticks_from_ms(RCU_WINDOW_CHECK_INTERVAL_MS);
+ ticks = clock_ticks_from_ms(RCU_WINDOW_CHECK_INTERVAL);
timer_schedule(&data->timer, now + ticks);
}
diff --git a/kern/shell.h b/kern/shell.h
index db055e7..0526019 100644
--- a/kern/shell.h
+++ b/kern/shell.h
@@ -32,12 +32,12 @@
#define SHELL_REGISTER_CMDS(cmds) \
MACRO_BEGIN \
- size_t i___; \
- int error___; \
+ size_t i_; \
+ int error_; \
\
- for (i___ = 0; i___ < ARRAY_SIZE(cmds); i___++) { \
- error___ = shell_cmd_register(&(cmds)[i___]); \
- error_check(error___, __func__); \
+ for (i_ = 0; i_ < ARRAY_SIZE(cmds); i_++) { \
+ error_ = shell_cmd_register(&(cmds)[i_]); \
+ error_check(error_, __func__); \
} \
MACRO_END
diff --git a/kern/slist.h b/kern/slist.h
index 424cdb2..8fd0a21 100644
--- a/kern/slist.h
+++ b/kern/slist.h
@@ -226,10 +226,10 @@ slist_remove(struct slist *list, struct slist_node *prev)
*/
#define slist_first_entry(list, type, member) \
MACRO_BEGIN \
- struct slist_node *first___; \
+ struct slist_node *first_; \
\
- first___ = (list)->first; \
- slist_end(first___) ? NULL : slist_entry(first___, type, member); \
+ first_ = (list)->first; \
+ slist_end(first_) ? NULL : slist_entry(first_, type, member); \
MACRO_END
/*
@@ -237,23 +237,23 @@ MACRO_END
*/
#define slist_last_entry(list, type, member) \
MACRO_BEGIN \
- struct slist_node *last___; \
+ struct slist_node *last_; \
\
- last___ = (list)->last; \
- slist_end(last___) ? NULL : slist_entry(last___, type, member); \
+ last_ = (list)->last; \
+ slist_end(last_) ? NULL : slist_entry(last_, type, member); \
MACRO_END
/*
* Get the entry next to the given entry.
*/
-#define slist_next_entry(entry, member) \
+#define slist_next_entry(entry, member) \
MACRO_BEGIN \
- struct slist_node *next___; \
+ struct slist_node *next_; \
\
- next___ = (entry)->member.next; \
- slist_end(next___) \
+ next_ = (entry)->member.next; \
+ slist_end(next_) \
? NULL \
- : slist_entry(next___, typeof(*entry), member); \
+ : slist_entry(next_, typeof(*entry), member); \
MACRO_END
/*
@@ -409,10 +409,10 @@ slist_rcu_remove(struct slist *list, struct slist_node *prev)
*/
#define slist_rcu_first_entry(list, type, member) \
MACRO_BEGIN \
- struct slist_node *first___; \
+ struct slist_node *first_; \
\
- first___ = slist_rcu_first(list); \
- slist_end(first___) ? NULL : slist_entry(first___, type, member); \
+ first_ = slist_rcu_first(list); \
+ slist_end(first_) ? NULL : slist_entry(first_, type, member); \
MACRO_END
/*
@@ -420,12 +420,12 @@ MACRO_END
*/
#define slist_rcu_next_entry(entry, member) \
MACRO_BEGIN \
- struct slist_node *next___; \
+ struct slist_node *next_; \
\
- next___ = slist_rcu_next(&entry->member); \
- slist_end(next___) \
+ next_ = slist_rcu_next(&entry->member); \
+ slist_end(next_) \
? NULL \
- : slist_entry(next___, typeof(*entry), member); \
+ : slist_entry(next_, typeof(*entry), member); \
MACRO_END
/*
diff --git a/tools/qemu.sh b/tools/qemu.sh
index 3aef63e..91029b1 100755
--- a/tools/qemu.sh
+++ b/tools/qemu.sh
@@ -25,13 +25,14 @@ TMPDIR=$(mktemp -d)
objcopy -O elf32-i386 $X15 $TMPDIR/x15
+cd $TMPDIR
$QEMU_EXE $KVM \
-ctrl-grab \
-gdb tcp::1234 \
-m $RAM \
-smp $NR_CPUS \
-monitor stdio \
- -kernel $TMPDIR/x15 \
+ -kernel x15 \
-append "console=atcons"
rm -rf $TMPDIR