Merge branch 'master' of postpeta.pccluster.org:mckernel

This commit is contained in:
simin
2013-05-21 03:53:18 +09:00
14 changed files with 1144 additions and 1561 deletions

View File

@@ -44,7 +44,7 @@ void *get_x86_this_cpu_kstack(void);
void init_processors_local(int max_id); void init_processors_local(int max_id);
void assign_processor_id(void); void assign_processor_id(void);
void arch_delay(int); void arch_delay(int);
void x86_set_warm_reset(void); void x86_set_warm_reset(unsigned long ip, char *first_page_va);
void x86_init_perfctr(void); void x86_init_perfctr(void);
extern int kprintf(const char *format, ...); extern int kprintf(const char *format, ...);
@@ -393,12 +393,7 @@ static void outb(uint8_t v, uint16_t port)
static void set_warm_reset_vector(unsigned long ip) static void set_warm_reset_vector(unsigned long ip)
{ {
/* Write CMOS */ x86_set_warm_reset(ip, first_page_va);
x86_set_warm_reset();
/* Set vector */
*(unsigned short *)(first_page_va + 0x469) = (ip >> 4);
*(unsigned short *)(first_page_va + 0x467) = ip & 0xf;
} }
static void wait_icr_idle(void) static void wait_icr_idle(void)

View File

@@ -200,7 +200,7 @@ static unsigned long attr_to_l2attr(enum ihk_mc_pt_attribute attr)
static unsigned long attr_to_l1attr(enum ihk_mc_pt_attribute attr) static unsigned long attr_to_l1attr(enum ihk_mc_pt_attribute attr)
{ {
if (attr & PTATTR_UNCACHABLE) { if (attr & PTATTR_UNCACHABLE) {
return (attr & ATTR_MASK) | PFL1_PWT | PFL1_PWT; return (attr & ATTR_MASK) | PFL1_PCD | PFL1_PWT;
} else { } else {
return (attr & ATTR_MASK); return (attr & ATTR_MASK);
} }
@@ -683,7 +683,7 @@ void ihk_mc_reserve_arch_pages(unsigned long start, unsigned long end,
void ihk_mc_set_page_allocator(struct ihk_mc_pa_ops *ops) void ihk_mc_set_page_allocator(struct ihk_mc_pa_ops *ops)
{ {
last_page = NULL; last_page = (void *)-1;
pa_ops = ops; pa_ops = ops;
} }

2481
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -28,6 +28,8 @@ if test "X$WITH_TARGET" = Xyes -o "X$WITH_TARGET" = Xno; then
WITH_TARGET=attached-mic WITH_TARGET=attached-mic
fi fi
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
case $WITH_TARGET in case $WITH_TARGET in
attached-mic) attached-mic)
ARCH=`uname -m` ARCH=`uname -m`

View File

@@ -1,19 +0,0 @@
KDIR ?= /lib/modules/`uname -r `/build
obj-m += mcctrl.o
mcctrl-objs := driver.o control.o ikc.o syscall.o
IHK_BASE=$(src)/../../../ihk
EXTRA_CFLAGS = -I$(IHK_BASE)/linux/include -I$(IHK_BASE)/ikc/include -I$(IHK_BASE)/include -I$(src)/../include
KBUILD_EXTRA_SYMBOLS = $(IHK_BASE)/linux/core/Module.symvers
.PHONY: clean install
modules:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
$(RM) .*.cmd *.mod.c *.o *.ko* Module.symvers modules.order -r .tmp*
install:

View File

@@ -1,16 +0,0 @@
#CC=/usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gcc
CC=gcc
CFLAGS=-Wall -O
TARGET=mcexec
all: $(TARGET)
mcexec: mcexec.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -pthread -o $@ $^ $(EXTRA_OBJS)
clean:
$(RM) $(TARGET) *.o
.PHONY: all clean

View File

@@ -6,7 +6,7 @@ TARGET=mcexec
all: $(TARGET) all: $(TARGET)
mcexec: mcexec.c mcexec: mcexec.c
$(CC) $(CFLAGS) -pthread -o $@ $^ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -pthread -o $@ $^ $(EXTRA_OBJS)
clean: clean:
$(RM) $(TARGET) *.o $(RM) $(TARGET) *.o

View File

@@ -549,6 +549,7 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
{ {
struct syscall_wait_desc w; struct syscall_wait_desc w;
long ret; long ret;
char *fn;
w.cpu = cpu; w.cpu = cpu;
@@ -573,7 +574,17 @@ int main_loop(int fd, int cpu, pthread_mutex_t *lock)
__dprintf("open: %s\n", dma_buf); __dprintf("open: %s\n", dma_buf);
ret = open((char *)dma_buf, w.sr.args[1], w.sr.args[2]); fn = (char *)dma_buf;
if(!strcmp(fn, "/proc/meminfo")){
fn = "/admin/fs/attached/files/proc/meminfo";
}
else if(!strcmp(fn, "/proc/cpuinfo")){
fn = "/admin/fs/attached/files/proc/cpuinfo";
}
else if(!strcmp(fn, "/sys/devices/system/cpu/online")){
fn = "/admin/fs/attached/files/sys/devices/system/cpu/online";
}
ret = open(fn, w.sr.args[1], w.sr.args[2]);
SET_ERR(ret); SET_ERR(ret);
do_syscall_return(fd, cpu, ret, 0, 0, 0, 0); do_syscall_return(fd, cpu, ret, 0, 0, 0, 0);
break; break;

View File

@@ -1,40 +0,0 @@
#BUILD_TARGET = builtin-mic attached-mic
BUILD_TARGET ?= attached-mic
SRC = $(CURDIR)
IHKBASE ?= $(SRC)/../../ihk/cokernel
O ?= $(KBUILD_OUTPUT)
V ?= $(VERBOSE)
KERNEL = kernel.img
KERNELS = $(addsuffix /$(KERNEL),$(addprefix $(O)/,$(BUILD_TARGET)))
SUBCMD_OPTS = V='$(V)'
$(if $(O),,$(error Specify the compilation target directory))
#$(if $(shell ls $(IHKBASE)/Makefile),,\
# $(error IHK is not found in $(IHKBASE)))
.PHONY: all clean depend
all: $(KERNELS)
%/kernel.img: %/Makefile
@echo 'Building for' $(dir $@)
@make --no-print-directory -C $(dir $@) $(SUBCMD_OPTS)
%/Makefile: Makefile.build FORCE
@mkdir -p $(dir $@)
@echo 'SRC = $(SRC)' > $@
@echo 'IHKBASE = $(IHKBASE)' >> $@
@echo 'TARGET = $(notdir $(patsubst %/,%,$(dir $@)))' >> $@
@echo 'TARGETDIR = $$(shell echo $$(TARGET) | sed "s/-/\//")' >> $@
@cat Makefile.build >> $@
@rm -f $(dir $@)/Makefile.dep
clean: $(addsuffix .clean,$(BUILD_TARGET))
%.clean: $(O)/%/Makefile
@make --no-print-directory -C $(O)/$(basename $@) $(SUBCMD_OPTS) clean
FORCE:

View File

@@ -20,9 +20,12 @@ void kputs(char *buf)
if (len + kmsg_buf.tail > kmsg_buf.len) { if (len + kmsg_buf.tail > kmsg_buf.len) {
kmsg_buf.tail = 0; kmsg_buf.tail = 0;
if(len > kmsg_buf.len) {
len = kmsg_buf.len;
}
} }
strncpy(kmsg_buf.str + kmsg_buf.tail, buf, len); memcpy(kmsg_buf.str + kmsg_buf.tail, buf, len);
kmsg_buf.tail += len; kmsg_buf.tail += len;
ihk_mc_spinlock_unlock(&kmsg_lock, flags); ihk_mc_spinlock_unlock(&kmsg_lock, flags);

View File

@@ -49,7 +49,7 @@ static void process_msg_prepare_process(unsigned long rphys)
sz = sizeof(struct program_load_desc) sz = sizeof(struct program_load_desc)
+ sizeof(struct program_image_section) * 16; + sizeof(struct program_image_section) * 16;
npages = (sz + PAGE_SIZE - 1) >> PAGE_SHIFT; npages = ((rphys + sz - 1) >> PAGE_SHIFT) - (rphys >> PAGE_SHIFT) + 1;
phys = ihk_mc_map_memory(NULL, rphys, sz); phys = ihk_mc_map_memory(NULL, rphys, sz);
p = ihk_mc_map_virtual(phys, npages, PTATTR_WRITABLE); p = ihk_mc_map_virtual(phys, npages, PTATTR_WRITABLE);

View File

@@ -1055,7 +1055,7 @@ SYSCALL_DECLARE(sched_getaffinity)
CPU_ZERO_S(min_len, mask); CPU_ZERO_S(min_len, mask);
for (cpu_id = 0; cpu_id < min_ncpus; ++cpu_id) for (cpu_id = 0; cpu_id < min_ncpus; ++cpu_id)
CPU_SET_S(min_len, cpu_id, mask); CPU_SET_S(cpu_info->hw_ids[cpu_id], min_len, mask);
// dkprintf("sched_getaffinity returns full mask\n"); // dkprintf("sched_getaffinity returns full mask\n");

View File

@@ -46,15 +46,15 @@ void *__ihk_pagealloc_init(unsigned long start, unsigned long size,
} else { } else {
desc = (void *)allocate_pages(descsize, 0); desc = (void *)allocate_pages(descsize, 0);
} }
flag = descsize;
memset(desc, 0, descsize * PAGE_SIZE);
if (!desc) { if (!desc) {
kprintf("IHK: failed to allocate page-allocator-desc "\ kprintf("IHK: failed to allocate page-allocator-desc "\
"(%lx, %lx, %lx)\n", start, size, unit); "(%lx, %lx, %lx)\n", start, size, unit);
return NULL; return NULL;
} }
flag = descsize;
memset(desc, 0, descsize * PAGE_SIZE);
desc->start = start; desc->start = start;
desc->last = 0; desc->last = 0;
desc->count = mapaligned >> 3; desc->count = mapaligned >> 3;

104
make.sh
View File

@@ -1,104 +0,0 @@
#!/bin/sh
MOPT=
OPT=
ihkdir=`pwd`/../ihk
installdir=
kerneldir=
target=
cleanflag=
while [ "X$1" != X ]; do
case "$1" in
clean)
cleanflag=1
;;
installdir=*)
installdir="`echo $1 | sed 's/^installdir=//'`"
;;
ihkdir=*)
ihkdir="`echo $1 | sed 's/^ihkdir=//'`"
;;
kerneldir=*)
kerneldir="`echo $1 | sed 's/^kerneldir=//'`"
;;
target=*)
target="`echo $1 | sed 's/^target=//'`"
;;
*)
echo "unknown option $1" >&2
exit 1
;;
esac
shift
done
if [ "X$cleanflag" != X ]; then
(cd executer/kernel; make clean)
(cd executer/user; make clean)
rm -rf kernel/build
exit 0
fi
if [ "X$target" = X ]; then
if [ -f $ihkdir/target ]; then
target="`cat $ihkdir/target`"
fi
fi
if [ "X$target" = X ]; then
target=attached-mic
fi
if [ "X$kerneldir" = X ]; then
if [ -f $ihkdir/kerneldir ]; then
kerneldir="`cat $ihkdir/kerneldir`"
fi
fi
if [ "X$kerneldir" != X ]; then
MOPT="KDIR=$kerneldir"
fi
if [ "X$target" = "Xbuiltin-mic" ]; then
MOPT="$MOPT ARCH=k1om"
OPT="CC=x86_64-k1om-linux-gcc"
fi
if [ "X$installdir" != X ]; then
mkdir -p "$installdir"
fi
(cd executer/kernel; make $MOPT)
if [ -f executer/kernel/mcctrl.ko ]; then
if [ "X$installdir" != X ]; then
cp executer/kernel/mcctrl.ko "$installdir"
fi
else
echo "executer/kernel/mcctrl.ko could not be built" >&2
exit 1
fi
case "$target" in
attached-mic | builtin-x86 | builtin-mic)
(cd kernel; mkdir -p build; make O=`pwd`/build BUILD_TARGET=$target)
krn=kernel/build/$target/kernel.img
;;
*)
echo "unknown target $target" >&2
exit 1
;;
esac
if [ -f $krn ]; then
if [ "X$installdir" != X ]; then
cp $krn "$installdir"
fi
else
echo "$krn could not be built" >&2
exit 1
fi
(cd executer/user; make $OPT)
if [ -f executer/user/mcexec ]; then
if [ "X$installdir" != X ]; then
cp executer/user/mcexec "$installdir"
fi
else
echo "executer/user/mcexec could not be built" >&2
exit 1
fi