minix/kernel/arch/i386
Ben Gras 565f13088f make vfs & filesystems use failable copying
Change the kernel to add features to vircopy and safecopies so that
transparent copy fixing won't happen to avoid deadlocks, and such copies
fail with EFAULT.

Transparently making copying work from filesystems (as normally done by
the kernel & VM when copying fails because of missing/readonly memory)
is problematic as it can happen that, for file-mapped ranges, that that
same filesystem that is blocked on the copy request is needed to satisfy
the memory range, leading to deadlock. Dito for VFS itself, if done with
a blocking call.

This change makes the copying done from a filesystem fail in such cases
with EFAULT by VFS adding the CPF_TRY flag to the grants. If a FS call
fails with EFAULT, VFS will then request the range to be made available
to VM after the FS is unblocked, allowing it to be used to satisfy the
range if need be in another VFS thread.

Similarly, for datacopies that VFS itself does, it uses the failable
vircopy variant and callers use a wrapper that talk to VM if necessary
to get the copy to work.

	. kernel: add CPF_TRY flag to safecopies
	. kernel: only request writable ranges to VM for the
	  target buffer when copying fails
	. do copying in VFS TRY-first
	. some fixes in VM to build SANITYCHECK mode
	. add regression test for the cases where
	  - a FS system call needs memory mapped in a process that the
	    FS itself must map.
	  - such a range covers more than one file-mapped region.
	. add 'try' mode to vircopy, physcopy
	. add flags field to copy kernel call messages
	. if CP_FLAG_TRY is set, do not transparently try
	  to fix memory ranges
	. for use by VFS when accessing user buffers to avoid
	  deadlock
	. remove some obsolete backwards compatability assignments
        . VFS: let thread scheduling work for VM requests too
          Allows VFS to make calls to VM while suspending and resuming
          the currently running thread. Does currently not work for the
          main thread.
        . VM: add fix memory range call for use by VFS

Change-Id: I295794269cea51a3163519a9cfe5901301d90b32
2014-07-28 17:05:14 +02:00
..
include VMWare poweroff magic cli;hlt sequence 2013-08-11 23:55:43 +02:00
acpi.c Add acpi poweroff 2013-05-29 16:12:33 +00:00
acpi.h Add acpi poweroff 2013-05-29 16:12:33 +00:00
apic.c Replaced common u64.h functions with operators. 2014-03-02 12:28:32 +01:00
apic.h kernel: spelling fixes 2013-10-09 20:24:17 -04:00
apic_asm.h retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
apic_asm.S SYSENTER/SYSCALL support 2012-09-24 15:53:43 +02:00
arch_clock.c Some more 64bit function eradication. 2013-08-07 12:35:53 +00:00
arch_do_vmctl.c Rename sys_vmctl_get_cr3_i386 2012-08-12 23:30:54 +02:00
arch_reset.c big <utmp.h>-inspired netbsd switch 2014-03-01 09:05:02 +01:00
arch_smp.c smp: build fixes for CONFIG_SMP=y 2013-10-12 11:51:55 -04:00
arch_system.c <machine/signal.h> 2014-03-03 20:47:07 +01:00
arch_watchdog.c Replaced common u64.h functions with operators. 2014-03-02 12:28:32 +01:00
breakpoints.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
debugreg.h Fix types in debug register functions 2010-04-28 08:35:05 +00:00
debugreg.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
direct_tty_utils.c <a.out.h>, MINIX style: remove as obsolete 2013-08-06 11:43:35 +02:00
do_iopenable.c Kernel: use okendpt() to resolve stored endpoints 2012-08-15 08:50:30 +00:00
do_readbios.c No more intel/minix segments. 2012-07-15 22:30:15 +02:00
do_sdevio.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
exception.c kernel: trap-dependent state restore, trace fixes 2013-01-08 15:47:37 +00:00
glo.h SMP - CPU local run queues 2010-09-15 14:10:18 +00:00
head.S x86 multiboot.h 2014-03-03 20:47:05 +01:00
i8259.c Kernel: clean up include statements a bit 2012-08-14 16:29:05 +00:00
io_inb.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
io_inl.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
io_intr.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
io_inw.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
io_outb.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
io_outl.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
io_outw.S Macros for symbols used in both ASM and C 2010-08-17 16:44:07 +00:00
kernel.lds Gold linker support for entire source tree 2013-06-11 22:51:02 +02:00
klib.S bigger message 2014-03-02 12:28:31 +01:00
Makefile.inc Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
memory.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
mpx.S Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
oxpcie.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
oxpcie.h retire _PROTOTYPE 2012-03-25 16:17:10 +02:00
pg_utils.c x86 multiboot.h 2014-03-03 20:47:05 +01:00
pre_init.c x86 multiboot.h 2014-03-03 20:47:05 +01:00
procoffsets.cf <machine/signal.h> 2014-03-03 20:47:07 +01:00
protect.c x86 multiboot.h 2014-03-03 20:47:05 +01:00
sconst.h <machine/signal.h> 2014-03-03 20:47:07 +01:00
serial.h Add cttybaud boot monitor variable to control speed of serial console (combine with ctty 0) 2011-03-16 12:25:10 +00:00
trampoline.S segmentless smp fixes 2012-07-15 22:47:20 +02:00
usermapped_data_arch.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
usermapped_glo_ipc.S kernel: trap-dependent state restore, trace fixes 2013-01-08 15:47:37 +00:00