Commit Graph

570 Commits

Author SHA1 Message Date
38c3b2358a Exclude areas not assigned to Mckernel from direct map of all phys. memory
It's enabled by adding -s to mcreboot.sh.

Cherry-pick of the following commit:

commit b5c13ce51a5a4926c2cf11c817cd0d369ac4402d
Author: Katsuya Horigome <katsuya.horigome.rj@ps.hitachi-solutions.com>
Date:   Mon Nov 20 09:40:41 2017 +0900

    Include measures to prevent memory destruction on Linux side (This is rebase commit for merging to development+hfi)
2018-09-04 19:51:10 +09:00
65df9c8084 ihk_mc_get_processor_id(): return -1 for non-McKernel CPUs
Cherry-pick of c45641e97add9fde467844d9272f2626cf4317de
2018-09-04 19:51:09 +09:00
7836aa0136 Map LWK TEXT to the end of Linux modules section (0xFFFFFFFFFE800000) 2018-09-04 19:51:09 +09:00
1cf7fad15a virt_to_phys(): fix debug messages
Cherry-pick of 46eb3b73dac75b28ead62476f017ad0f29ec4b0a
2018-09-04 19:51:09 +09:00
0076e1f5e0 mem: make McKernel kernel heap virtual addresses Linux compatible
Cherry-pick of e5334c646d2dc6fb11d419918d8139a0de583fde
2018-09-04 19:51:09 +09:00
cae6b9f154 move McKernel out of Linux kernel virtual 2018-09-04 19:51:09 +09:00
9a20cfaefb mem: Check if phys-mem is within the range of McKernel memory
Fujitsu: POSTK_DEBUG_TEMP_FIX_52
Refs: #1164
Change-Id: Idb9a6eac1d2e1df4c663c3171925c774421177fd
2018-08-30 02:18:37 +00:00
f57b0c5d4f wait: Delay wake-up parent within switch context
Fujitsu: POSTK_DEBUG_TEMP_FIX_41
Refs: #1006
Change-Id: Ia98e896505ad0f6549766604ade84550eee8bd2d
2018-08-30 02:13:51 +00:00
0fdeb254b3 switch context: Move to arch-dependent (arch_switch_context())
Fujitsu: POSTK_DEBUG_ARCH_DEP_22
Change-Id: I6faf8d9daa1e639350c2cd83db9bb27b9d37ba01
2018-08-30 02:13:34 +00:00
61a942acdc arm64 vdso/gettimeofday: add new includes for cpu_set_t and pte_t
Change-Id: I4035b179a173a6b29c34c73670d68a38d4dc5dc4
2018-08-22 06:17:56 +00:00
c4b4b7222e arm64: ihk_mc_perfctr_start/stop: fix prototype that was changed in x86
The functions now take a bitmask in argument since commit d7416c6f79
("perf_event: Specify counter by bit_mask on start/stop")...
Thanksfully the change also induced a type modification so it was easy
to notice.

(On the other hand I'm building with --disable-perf so why the hell is
that file compiled?!)

Change-Id: Ie16367cc94e81068b70e1b80142a6394de896c4f
2018-08-22 06:14:15 +00:00
21af0351d1 arm64 syscall.c needs uio.h for struct iovec
Change-Id: I9d070d0e148636be1d9ecec8ec4dfb72f93c4ed6
2018-08-22 06:08:27 +00:00
b1aa94d417 arm64 arch-perfctr.h: remove duplicate enums
Some enums were redefined in lib/include/mc_perf_event.h in commit
1284060 ("support PERF_TYPE_{HARDWARE|HWCACHE} in perf_event_open")

Change-Id: I1a98699955ca7fd6135b2a7dde72ed4df77b1974
2018-08-22 06:04:08 +00:00
a6a9bac5b7 Protect more code by #ifdef PERF_ENABLE
Change-Id: I20a67c56c4d7817fdb87cc6a2aa47d68fe3eae8d
2018-08-22 06:03:12 +00:00
240a23a21b arch-lock: tentative implementation of irqflags_can_interrupt for arm64
Change-Id: I814e02e757039cab8c142c0b774ad470154454c1
2018-08-22 06:02:06 +00:00
b93e14f695 arm64 signal.h: add valid_signal() function
This function was added for x86 by commit 140f813d77 ("fix:
differences in behavior of sigaction between Linux and Mckernel")

The x86 and arm files are actually pretty close and could use
factoring...

Change-Id: Ia8820fd2f824d898610b384a3e137c96aadbc911
2018-08-22 05:54:31 +00:00
3e3f3c5590 mcoverlayfs: vfs_readdir -> iterate_dir compat for el7.5
Also enable mcoverlay for new kernel version / actually build it

Change-Id: I80bc043c65cf99c3b41a54a5666ea7652e6c2bbd
2018-08-09 04:30:24 +00:00
d7416c6f79 perf_event: Specify counter by bit_mask on start/stop
Fujitsu: POSTK_DEBUG_TEMP_FIX_30
Refs: #1002
Change-Id: Iea51e9aef78927a5033e3a226d5efc6298da056a
2018-08-02 11:22:28 +09:00
cb1522ca92 perf_event: Handle fixed-pmc in arch-dep part
Fujitsu: POSTK_DEBUG_TEMP_FIX_31
Refs: #1003
Change-Id: I66c7d18b9137894cf5764464482e2ebd5ecb9d52
2018-08-02 02:14:04 +00:00
c716e87c53 execve: Clear sigaltstack and fp_regs
Fujitsu: POSTK_DEBUG_TEMP_FIX_19
Refs: #976
Change-Id: I16895eab13eecbb47b7e6da961fae82ee5e570ee
2018-08-01 15:11:05 +09:00
bc0759e2dc arm64 arch-lock: add missing include for cpu_set
Probably only needed for recent system, see ihk's 3271b5e6 ("fix
compilation with recent glibc (cpu_set define change)")

The root of the problem really is that we rely on system headers for
mckernel that ought to be independent...

Change-Id: Ieb9a017e5a7697ad767087370ced7b615efc917e
2018-07-27 02:33:03 +00:00
1aa429d4f5 init_normal_area: fix warnings
- unused variable pt_phys
 - undeclared function set_pt_large_page (move definition lower)

Change-Id: I4625b70efe8e914160b17064078c42b86a461d3e
2018-07-27 02:32:23 +00:00
3185334c1c debug messages: implement dynamic debug
Heavily inspired off linux kernel's dynamic debug:
 * add a /sys/kernel/debug/dynamic_debug/control file
 (accessible from linux side in /sys/class/mcos/mcos0/sys/kernel/debug/dynamic_debug/control)
 * read from file to list debug statements (currently limited to 4k in size)
 * write to file with '[file foo ][func bar ][line [x][-[y]]] [+-]p' to change values

Side effects:
 * reindented all linker scripts, there is a new __verbose section
 * added string function strpbrk

Change-Id: I36d7707274dcc3ecaf200075a31a2f0f76021059
2018-07-26 14:16:31 +09:00
bc887aab44 x86 futex: fix out of bounds shift
8 << 28 needs unsigned to fit, other shifts were done to truncate
the input, use a mask instead

Change-Id: I81ba41595f4629f1df554e34392116440ff3b641
2018-07-26 05:10:36 +00:00
97273adcc5 x86_64 move_pages_smp_handler: rework initialisation
- add missing break statement
- remove duplicate memset for mpsr->status

Change-Id: I1fd1a8b2bb7bbabb32db9e7d3fc84102d9b0ff82
2018-07-26 04:59:23 +00:00
ad2cb6375a kprintf: only call eventfd() if it is safe to interrupt
Missing ARM64 implementation, cannot test right now

Change-Id: Ia05e8b7952b19bcd8fdac1f920d9bfe341be8b97
2018-07-26 04:57:30 +00:00
6df4bd8f8c Fix a few more warnings
Some are important, e.g. the seemingly harmless braces around if with dprintf,
since that dprintf is defined as empty, will screw things up and grab the next
line

Change-Id: Ie5e1cf813178ad708ff42ae5e477fbc96034471c
2018-07-26 04:52:17 +00:00
eb675818c7 x86 mmap: fix out of bounds shift
0x3F << MAP_HUGE_SHIFT is too big to fit in signed int,
make it unsigned

Change-Id: I0e476b80ff51a8e141c90da6f985ba18a3438752
2018-07-26 03:50:44 +00:00
3ce7763715 x86 mem init: do not map identity mapping
init_normal_area was mapping identity lookups (phys = virt) from 0,
leading to many undetected null pointer dereferences in init_pt (but
not in new process page tables leading to odd behaviour)

This also makes the code use the set_pt_large_page() function, cleaning
it up a bit

Change-Id: I22889031de26a7e48501b0eb4d453ca62e671835
2018-07-26 03:50:44 +00:00
79e5026f01 x86 mem init: fix clearing of init_pt
memset(init_pt...) had the wrong size.

Change-Id: Idb5d0d53b3c70ee4a16a101dd265d0854cfd3b72
2018-07-26 03:50:31 +00:00
9a79920ef9 Static analysis fixes
Change-Id: I7bc42545a1c497f704d7bfa6ea1b7e3893acc697
2018-07-26 03:36:50 +00:00
699cb4f88c arm64/arch-lock: typedef mcs_lock_t
Was done in x86_64 for fileobj in commit 249bda4aef ("fileobj: use
MCS locks for per-file page hash")

Change-Id: I61957de336b6657687803e6288afed9360a42032
2018-07-26 03:28:40 +00:00
67ebcca74d Fix to VMAP virtual address leak
Fujitsu: POSTK_DEBUG_TEMP_FIX_51
Refs: #1024
Change-Id: I1692ee4f004cb4d1f725baf47a8ed31fce1bf42a
2018-07-26 02:17:55 +00:00
11756d96ef mmap, mremap: Check arguments in the same order as in Linux
Refs: #1137
Change-Id: I4fd2ac83b013a2741a3facce4dd7e0c37b14fd25
2018-07-03 08:41:30 +00:00
f185be06eb mcoverlay-create.sh, mcoverlay-destroy.sh: Return -EINVAL on failure
Change-Id: I0561df33e8068327bf2d921c8facac7b18ac8866
2018-07-03 05:19:55 +00:00
249bda4aef fileobj: use MCS locks for per-file page hash 2018-05-14 17:46:52 +09:00
90a34f54c9 mcreboot.sh,mcstop+release.sh: Disable irqbalance_mck forcefully 2018-04-26 15:06:53 +09:00
d5190990f5 mcreboot.sh,mcstop+release.sh: rm -rf /tmp/mcreboot when it's done 2018-03-27 23:25:44 +09:00
82822b1f16 mcreboot.sh: Fix error cases
(1) Restart irqbalance when error occurs after it's stopped
(2) Restore /proc/irq/*/smp_affinity when error occurs after
    they're modified
2018-03-27 22:20:25 +09:00
7f02889f76 mcreboot.sh,mcstop+release.sh: Save /proc/irq/*/smp_affinity to /tmp/mcreboot 2018-03-27 22:01:55 +09:00
ce3af4734a fix: dual hold_thread() in do_kill() 2018-03-19 11:12:50 +09:00
fe42481d6f Add allow_oversubscribe kernel argument
It's not allowed in the default setting.
Execute mcreboot.sh with -O option to allow it.

refs #1072
2018-03-10 13:08:38 +09:00
65667709a8 Fix thread status race-condition caused by hold_thread() in do_kill() and terminate()
Conflicts:
	arch/x86_64/kernel/syscall.c
	kernel/syscall.c
2018-03-09 17:53:17 +09:00
3b277b2354 uti: Fix dead-lock of calling terminate() from terminate()
Conflicts:
	arch/x86_64/kernel/syscall.c
	kernel/syscall.c
2018-03-09 17:38:55 +09:00
06b1b4f8ab Fix deadlock on thread->times_update in getrusage()
Set thread->in_kernel properly on exiting interrupt handler when entering
it from kernel mode.

Conflicts:
	arch/x86_64/kernel/cpu.c
	kernel/mem.c
2018-03-09 17:26:31 +09:00
a224bf648a fix: Bug for getrusage return incorrect ru_maxrss
refs #1032
2018-03-07 13:09:24 +09:00
140f813d77 fix: differences in behavior of sigaction between Linux and Mckernel 2018-03-01 09:44:44 +09:00
523a066245 sigaction: support for SA_RESETHAND on x86_64
refs #1031
2018-02-22 11:55:32 +09:00
228f8f8533 Wait for LWK to run at shutdown.
refs #898
refs #928
2018-02-06 10:40:12 +09:00
559fc9746c signal: check_signal must be called after check_need_resched. 2018-01-28 13:38:51 +09:00