1. 08 5月, 2007 7 次提交
    • J
      uml: more page fault path trimming · 16dd07bc
      Jeff Dike 提交于
      More trimming of the page fault path.
      
      Permissions are passed around in a single int rather than one bit per
      int.  The permission values are copied from libc so that they can be
      passed to mmap and mprotect without any further conversion.
      
      The register sets used by do_syscall_stub and copy_context_skas0 are
      initialized once, at boot time, rather than once per call.
      
      wait_stub_done checks whether it is getting the signals it expects by
      comparing the wait status to a mask containing bits for the signals of
      interest rather than comparing individually to the signal numbers.  It
      also has one check for a wait failure instead of two.  The caller is
      expected to do the initial continue of the stub.  This gets rid of an
      argument and some logic.  The fname argument is gone, as that can be
      had from a stack trace.
      
      user_signal() is collapsed into userspace() as it is basically one or
      two lines of code afterwards.
      
      The physical memory remapping stuff is gone, as it is unused.
      
      flush_tlb_page is inlined.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      16dd07bc
    • J
      uml: speed page fault path · 64f60841
      Jeff Dike 提交于
      Give the page fault code a specialized path.  There is only one page to look
      at, so there's no point in going into the general page table walking code.
      There's only going to be one host operation, so there are no opportunities for
      merging.  So, we go straight to the pte we want, figure out what needs doing,
      and do it.
      
      While I was in here, I fixed the wart where the address passed to unmap was a
      void *, but an unsigned long to map and protect.
      
      This gives me just under 10% on a kernel build.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      64f60841
    • J
      uml: rename os_{read_write}_file_k back to os_{read_write}_file · a6ea4cce
      Jeff Dike 提交于
      Rename os_{read_write}_file_k back to os_{read_write}_file, delete
      the originals and their bogus infrastructure, and fix all the callers.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a6ea4cce
    • J
      uml: dump core on panic · 63843c26
      Jeff Dike 提交于
      Dump core after a panic.  This will provide better debugging information than
      is currently available.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      63843c26
    • J
      uml: start fixing os_read_file and os_write_file · 3d564047
      Jeff Dike 提交于
      This patch starts the removal of a very old, very broken piece of code.  This
      stems from the problem of passing a userspace buffer into read() or write() on
      the host.  If that buffer had not yet been faulted in, read and write will
      return -EFAULT.
      
      To avoid this problem, the solution was to fault the buffer in before the
      system call by touching the pages that hold the buffer by doing a copy-user of
      a byte to each page.  This is obviously bogus, but it does usually work, in tt
      mode, since the kernel and process are in the same address space and userspace
      addresses can be accessed directly in the kernel.
      
      In skas mode, where the kernel and process are in separate address spaces, it
      is completely bogus because the userspace address, which is invalid in the
      kernel, is passed into the system call instead of the corresponding physical
      address, which would be valid.  Here, it appears that this code, on every host
      read() or write(), tries to fault in a random process page.  This doesn't seem
      to cause any correctness problems, but there is a performance impact.  This
      patch, and the ones following, result in a 10-15% performance gain on a kernel
      build.
      
      This code can't be immediately tossed out because when it is, you can't log
      in.  Apparently, there is some code in the console driver which depends on
      this somehow.
      
      However, we can start removing it by switching the code which does I/O using
      kernel addresses to using plain read() and write().  This patch introduces
      os_read_file_k and os_write_file_k for use with kernel buffers and converts
      all call locations which use obvious kernel buffers to use them.  These
      include I/O using buffers which are local variables which are on the stack or
      kmalloc-ed.  Later patches will handle the less obvious cases, followed by a
      mass conversion back to the original interface.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3d564047
    • J
      uml: move remaining useful contents of user_util.h · 24fa6c08
      Jeff Dike 提交于
      Rescue the useful contents of the soon-to-be-gone user-util.h.
      
      pty.c now gets ptsname from stdlib.h like it should have always done.
      
      CATCH_EINTR is now in os.h, although perhaps all usage should be under
      os-Linux at some point.
      
      get_pty is also in os.h.
      
      This patch restores the old definition of ARRAY_SIZE in user.h.  This file is
      included only in userspace files, so there will be no conflict with the
      kernel's new ARRAY_SIZE.  The copy of the kernel's ARRAY_SIZE and associated
      infrastructure is now gone.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      24fa6c08
    • J
      uml: host_info tidying · b4ffb6ad
      Jeff Dike 提交于
      Move the host_info string from util.c to um_arch.c, where it is
      actually initialized and used.  Also document its lack of locking.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b4ffb6ad
  2. 08 3月, 2007 1 次提交
  3. 12 2月, 2007 2 次提交
  4. 26 11月, 2006 1 次提交
    • P
      [PATCH] uml: make execvp safe for our usage · 5d48545e
      Paolo 'Blaisorblade' Giarrusso 提交于
      Reimplement execvp for our purposes - after we call fork() it is fundamentally
      unsafe to use the kernel allocator - current is not valid there.  So we simply
      pass to our modified execvp() a preallocated buffer.  This fixes a real bug
      and works very well in testing (I've seen indirectly warning messages from the
      forked thread - they went on the pipe connected to its stdout and where read
      as a number by UML, when calling read_output().  I verified the obtained
      number corresponded to "BUG:").
      
      The added use of __cant_sleep() is not a new bug since __cant_sleep() is
      already used in the same function - passing an atomicity parameter would be
      better but it would require huge change, stating that this function must not
      be called in atomic context and can sleep is a better idea (will make sure of
      this gradually).
      Signed-off-by: NPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Acked-by: NJeff Dike <jdike@addtoit.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5d48545e
  5. 12 10月, 2006 1 次提交
  6. 27 9月, 2006 2 次提交
    • J
      [PATCH] uml: thread creation tidying · 3c917350
      Jeff Dike 提交于
      fork on UML has always somewhat subtle.  The underlying cause has been the
      need to initialize a stack for the new process.  The only portable way to
      initialize a new stack is to set it as the alternate signal stack and take a
      signal.  The signal handler does whatever initialization is needed and jumps
      back to the original stack, where the fork processing is finished.  The basic
      context switching mechanism is a jmp_buf for each process.  You switch to a
      new process by longjmping to its jmp_buf.
      
      Now that UML has its own implementation of setjmp and longjmp, and I can poke
      around inside a jmp_buf without fear that libc will change the structure, a
      much simpler mechanism is possible.  The jmpbuf can simply be initialized by
      hand.
      
      This eliminates -
      	the need to set up and remove the alternate signal stack
      	sending and handling a signal
      	the signal blocking needed around the stack switching, since
      there is no stack switching
      	setting up the jmp_buf needed to jump back to the original
      stack after the new one is set up
      
      In addition, since jmp_buf is now defined by UML, and not by libc, it can be
      embedded in the thread struct.  This makes it unnecessary to have it exist on
      the stack, where it used to be.  It also simplifies interfaces, since the
      switch jmp_buf used to be a void * inside the thread struct, and functions
      which took it as an argument needed to define a jmp_buf variable and assign it
      from the void *.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      3c917350
    • J
      [PATCH] uml: mark some tt-mode code · 0915ee38
      Jeff Dike 提交于
      Mark a symbol and file as being tt-mode only.  This shrinks the binary
      slightly when tt mode support is compiled out and makes it easier to identity
      stuff when tt mode is removed.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0915ee38
  7. 26 9月, 2006 2 次提交
    • J
      [PATCH] uml: timer cleanups · 537ae946
      Jeff Dike 提交于
      set_interval returns an error instead of panicing if setitimer fails.  Some of
      its callers now check the return.
      
      enable_timer is largely tt-mode-specific, so it is marked as such, and the
      only skas-mode caller is made to call set-interval instead.
      
      user_time_init was a no-value-added wrapper around set_interval, so it is
      gone.
      
      Since set_interval is now called from kernel code, callers no longer pass
      ITIMER_* to it.  Instead, they pass a flag which is converted into ITIMER_REAL
      or ITIMER_VIRTUAL.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      537ae946
    • J
      [PATCH] uml: SIGIO cleanups · 19bdf040
      Jeff Dike 提交于
      - Various cleanups in the sigio code.
      
      - Removed explicit zero-initializations of a few structures.
      
      - Improved some error messages.
      
      - An API change - there was an asymmetry between reactivate_fd calling
        maybe_sigio_broken, which goes through all the machinery of figuring out if
        a file descriptor supports SIGIO and applying the workaround to it if not,
        and deactivate_fd, which just turns off the descriptor.
      
        This is changed so that only activate_fd calls maybe_sigio_broken, when
        the descriptor is first seen.  reactivate_fd now calls add_sigio_fd, which
        is symmetric with ignore_sigio_fd.
      
        This removes a recursion which makes a critical section look more critical
        than it really was, obsoleting a big comment to that effect.  This requires
        keeping track of all descriptors which are getting the SIGIO treatment, not
        just the ones being polled at any given moment, so that reactivate_fd,
        through add_sigio_fd, doesn't try to tell the SIGIO thread about descriptors
        it doesn't care about.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      19bdf040
  8. 15 7月, 2006 1 次提交
  9. 11 7月, 2006 3 次提交
  10. 01 4月, 2006 4 次提交
  11. 28 3月, 2006 4 次提交
  12. 25 2月, 2006 1 次提交
  13. 19 1月, 2006 4 次提交
  14. 09 1月, 2006 2 次提交
  15. 07 1月, 2006 2 次提交
    • J
      [PATCH] uml: umid cleanup · 7eebe8a9
      Jeff Dike 提交于
      This patch cleans up the umid code:
      
      - The only_if_set argument to get_umid is gone.
      
      - get_umid returns an empty string rather than NULL if there is no umid.
      
      - umid_is_random is gone since its users went away.
      
      - Some printfs were turned into printks because the code runs late enough
        that printk is working.
      
      - Error paths were cleaned up.
      
      - Some functions now return an error and let the caller print the error
        message rather than printing it themselves.  This eliminates the practice of
        passing a pointer to printf or printk in, depending on where in the boot
        process we are.
      
      - Major tidying of not_dead_yet - mostly error path cleanup, plus a comment
        explaining why it doesn't react to errors the way you might expect.
      
      - Calls to os_* interfaces that were moved under os are changed back to
        their native libc forms.
      
      - snprintf, strlcpy, and their bounds-checking friends are used more often,
        replacing by-hand bounds checking in some places.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      7eebe8a9
    • J
      [PATCH] uml: separate libc-dependent umid code · 2264c475
      Jeff Dike 提交于
      I reworked Gennady's umid OS abstraction patch because the code shouldn't
      be moved entirely to os.  As it turns out, I moved most of it anyway.  This
      patch is the minimal one needed to move the code and have it work.
      It turns out that the concept of the umid is OS-independent, but
      almost everything else about the implementation is OS-dependent.
      
      This is code movement without cleanup - a follow-on patch tidies
      everything up without shuffling code around.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      2264c475
  16. 07 11月, 2005 3 次提交