1. 06 2月, 2008 9 次提交
    • J
      uml: move sig_handler_common_skas · 75ada8ff
      Jeff Dike 提交于
      This patch moves sig_handler_common_skas from
      arch/um/os-Linux/skas/trap.c to its only caller in
      arch/um/os-Linux/signal.c.  trap.c is now empty, so it can be removed.
      
      This is code movement only - the significant cleanup needed here is
      done in the next patch.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      75ada8ff
    • J
      uml: tidy helper code · 1aa351a3
      Jeff Dike 提交于
      Style fixes to arch/um/os/helper.c and tidying up the breakpoint fix a
      bit.
      
      helper.c gets all the usual style fixes -
      	 updated copyright
      	 all printks get severities
      
      Also -
      	 errval changes to err in helper_child
      	 fixed an obsolete comment
      	 run_helper was killing a child process which is guaranteed to
      be dead or dying anyway
      
      Removed the nohang and pname arguments from helper_wait and fixed the
      declaration and callers.  nohang was used only in the slirp driver and
      I don't think it was needed.  I think pname was a bit of overkill in
      putting out an error message when something goes wrong.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1aa351a3
    • J
      uml: eliminate setjmp_wrapper · 8efa3c9d
      Jeff Dike 提交于
      setjmp_wrapper existed to provide setjmp to kernel code when UML used libc's
      setjmp and longjmp.  Now that UML has its own implementation, this isn't
      needed and kernel code can invoke setjmp directly.
      
      do_buffer_op is massively cleaned up since it is no longer a callback from
      setjmp_wrapper and given a va_list from which it must extract its arguments.
      
      The actual setjmp is moved from buffer_op to do_op_one_page because the copy
      operation is inside an atomic section (kmap_atomic to kunmap_atomic) and it
      shouldn't be longjmp-ed out of.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8efa3c9d
    • J
      uml: style fixes in file.c · 1adfd609
      Jeff Dike 提交于
      arch/um/os-Linux/file.c needed some style work -
      	updated the copyright
      	cleaned up the includes
      	CodingStyle fixes
      	added some missing CATCH_EINTRs
      	os_set_owner was unused, so it is gone
      	all printks now have severities
      	fcntl(F_GETFL) was being called without checking the return
      	removed an obsolete comment
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1adfd609
    • J
      uml: miscellaneous code cleanups · bf8fde78
      Jeff Dike 提交于
      Code tidying -
      	the pid field of struct irq_fd isn't used, so it is removed
           	os_set_fd_async needed to read flags before changing them, it
      doesn't need a pid passed in because it can call getpid itself, and a
      block of unused code needed deleting
      	os_get_exec_close was unused, so it is removed
      	ptrace_child called _exit for historical reasons which are no
      longer valid, so just calls exit instead
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bf8fde78
    • J
      uml: kill processes instead of panicing kernel · 3e6f2ac4
      Jeff Dike 提交于
      UML was panicing in the case of failures of libc calls which shouldn't happen.
       This is an overreaction since a failure from libc doesn't normally mean that
      kernel data structures are in an unknown state.  Instead, the current process
      should just be killed if there is no way to recover.
      
      The case that prompted this was a failure of PTRACE_SETREGS restoring the same
      state that was read by PTRACE_GETREGS.  It appears that when a process tries
      to load a bogus value into a segment register, it segfaults (as expected) and
      the value is actually loaded and is seen by PTRACE_GETREGS (not expected).
      
      This case is fixed by forcing a fatal SIGSEGV on the process so that it
      immediately dies.  fatal_sigsegv was added for this purpose.  It was declared
      as noreturn, so in order to pursuade gcc that it actually does not return, I
      added a call to os_dump_core (and declared it noreturn) so that I get a core
      file if somehow the process survives.
      
      All other calls in arch/um/os-Linux/skas/process.c got the same treatment,
      with failures causing the process to die instead of a kernel panic, with some
      exceptions.
      
      userspace_tramp exits with status 1 if anything goes wrong there.  That will
      cause start_userspace to return an error.  copy_context_skas0 and
      map_stub_pages also now return errors instead of panicing.  Callers of thes
      functions were changed to check for errors and do something appropriate.
      Usually that's to return an error to their callers.
      check_skas3_ptrace_faultinfo just exits since that's too early to do anything
      else.
      
      save_registers, restore_registers, and init_registers now return status
      instead of panicing on failure, with their callers doing something
      appropriate.
      
      There were also duplicate declarations of save_registers and restore_registers
      in os.h - these are gone.
      
      I noticed and fixed up some whitespace damage.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e6f2ac4
    • K
      uml: convert functions to void · 6b7e9674
      Karol Swietlicki 提交于
      This patch changes a few functions into returning void.  The return values
      were not used anyway, so I think it should not be a problem.  Also removed a
      little leftover bit from TT mode.
      Signed-off-by: NKarol Swietlicki <magotari@gmail.com>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6b7e9674
    • J
      uml: tidy kern_util.h · edea1385
      Jeff Dike 提交于
      Tidy kern_util.h.  It turns out that most of the function declarations
      aren't used, so they can go away.  os.h no longer includes
      kern_util.h, so files which got it through os.h now need to include it
      directly.  A number of other files never needed it, so these includes
      are deleted.
      
      The structure which was used to pass signal handlers from the kernel
      side to the userspace side is gone.  Instead, the handlers are
      declared here, and used directly from libc code.  This allows
      arch/um/os-Linux/trap.c to be deleted, with its remnants being moved
      to arch/um/os-Linux/skas/trap.c.
      
      arch/um/os-Linux/tty.c had its inclusions changed, and it needed some
      style attention, so it got tidied.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      edea1385
    • W
      uml: code tidying under arch/um/os-Linux · c9a3072d
      WANG Cong 提交于
      This patch contains varied fixes and improvements for some files under
      arch/um/os-Linux/, such as a typo fix in a perror message, a missing
      argument fix for a printf, some constifying for pointers and so on.
      
      [ jdike - made sigprocmask failure return -errno instead of -1 ]
      Signed-off-by: NWANG Cong <xiyou.wangcong@gmail.com>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c9a3072d
  2. 18 12月, 2007 1 次提交
    • S
      uml: stop gdb from deleting breakpoints when running UML · 4dbed85a
      Stanislaw Gruszka 提交于
      Sometimes when UML is debugged gdb miss breakpoints.
      
      When process traced by gdb do fork, debugger remove breakpoints from
      child address space. There is possibility to trace more than one fork,
      but this not work with UML, I guess (only guess) there is a deadlock -
      gdb waits for UML and UML waits for gdb.
      
      When clone() is called with SIGCHLD and CLONE_VM flags, gdb see this
      as PTRACE_EVENT_FORK not as PTRACE_EVENT_CLONE and remove breakpoints
      from child and at the same time from traced process, because either
      have the same address space.
      
      Maybe it is possible to do fix in gdb, but I'm not sure if there is
      easy way to find out if traced and child processes share memory. So I
      do fix for UML, it simply do not call clone() with both SIGCHLD and
      CLONE_VM flags together.  Additionally __WALL flag is used for
      waitpid() to assure not miss clone and normal process events.
      
      [ jdike - checkpatch fixes ]
      Signed-off-by: NStanislaw Gruszka <stf_xl@wp.pl>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4dbed85a
  3. 17 10月, 2007 15 次提交
    • J
      uml: use *SEC_PER_*SEC constants · 1a805219
      Jeff Dike 提交于
      There are various uses of powers of 1000, plus the odd BILLION constant in the
      time code.  However, there are perfectly good definitions of *SEC_PER_*SEC in
      linux/time.h which can be used instaed.
      
      These are replaced directly in kernel code.  Userspace code imports those
      constants as UM_*SEC_PER_*SEC and uses these.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1a805219
    • J
      uml: time build fix · 5f734614
      Jeff Dike 提交于
      Put back an implementation of timeval_to_ns in arch/um/os-Linux/time.c.
      tglx pointed out in his review of tickless support that there was a
      perfectly good implementation of it in linux/time.h.  The problem is that
      this is userspace code which can't pull in kernel headers and there doesn't
      seem to be a libc version.
      
      So, I'm copying the version from linux/time.h rather than resurrecting my
      version.  This causes some declaration changes as it now returns a signed
      value rather than an unsigned value.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5f734614
    • J
      uml: eliminate interrupts in the idle loop · b160fb63
      Jeff Dike 提交于
      Now, the idle loop now longer needs SIGALRM firing - it can just sleep for the
      requisite amount of time and fake a timer interrupt when it finishes.
      
      Any use of ITIMER_REAL now goes away.  disable_timer only turns off
      ITIMER_VIRTUAL.  switch_timers is no longer needed, so it, and all calls, goes
      away.
      
      disable_timer now returns the amount of time remaining on the timer.
      default_idle uses this to tell idle_sleep how long to sleep.  idle_sleep will
      call alarm_handler if nanosleep returns 0, which is the case if it didn't
      return early due to an interrupt.  Otherwise, it just returns.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b160fb63
    • J
      uml: tickless support · d2753a6d
      Jeff Dike 提交于
      Enable tickless support.
      
      CONFIG_TICK_ONESHOT and CONFIG_NO_HZ are enabled.
      
      itimer_clockevent gets CLOCK_EVT_FEAT_ONESHOT and an implementation of
      .set_next_event.
      
      CONFIG_UML_REAL_TIME_CLOCK goes away because it only makes sense when there is
      a clock ticking away all the time.  timer_handler now just calls do_IRQ once
      without trying to figure out how many ticks to emulate.
      
      The idle loop now needs to turn ticking on and off.
      
      Userspace ticks keep happening as usual.  However, the userspace loop keep
      track of when the next wakeup should happen and suppresses process ticks until
      that happens.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d2753a6d
    • J
      uml: separate timer initialization · 78a26e25
      Jeff Dike 提交于
      Move timer signal initialization from init_irq_signals to a new function,
      timer_init.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      78a26e25
    • J
      uml: simplify interval setting · a2f018bf
      Jeff Dike 提交于
      set_interval took a timer type as an argument, but it always specified a
      virtual timer.  So, it is not needed, and it is gone, and set_interval is
      simplified appropriately.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a2f018bf
    • J
      uml: fix timer switching · 181bde80
      Jeff Dike 提交于
      Fix up the switching between virtual and real timers.  The idle loop sleeps,
      so the timer at that point must be real time.  At all other times, the timer
      must be virtual.  Even when userspace is running, and the kernel is asleep,
      the virtual timer is correct because the process timer will be running and the
      process timer will be firing.
      
      The timer switch used to be in the context switch and timer handler code.
      This is moved to the idle loop and the signal handler, making it much more
      clear why it is happening.
      
      switch_timers now returns the old timer type so that it may be restored.  The
      signal handler uses this in order to restore the previous timer type when it
      returns.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      181bde80
    • J
      uml: userspace files should call libc directly · 512b6fb1
      Jeff Dike 提交于
      A number of files that were changed in the recent removal of tt mode
      are userspace files which call the os_* wrappers instead of calling
      libc directly.  A few other files were affected by this, through
      
      This patch makes these call glibc directly.
      
      There are also style fixes in the affected areas.
      
      os_print_error has no remaining callers, so it is deleted.
      
      There is a interface change to os_set_exec_close, eliminating a
      parameter which was always the same.  The callers are fixed as well.
      
      os_process_pc got its error path cleaned up.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      512b6fb1
    • J
      uml: remove os_* usage from userspace files · 8ca842c4
      Jeff Dike 提交于
      This patch fixes some userspace files which were calling libc through the os_*
      wrappers.
      
      It turns out that there was only one user of os_new_tty_pgrp, so it can be
      deleted.
      
      There are also some style and whitespace fixes in here.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8ca842c4
    • J
      uml: get rid of do_longjmp · fab95c55
      Jeff Dike 提交于
      do_longjmp used to be needed when UML didn't have its own implementation of
      setjmp and longjmp.  They came from libc, and couldn't be called directly from
      kernel code, as the libc jmp_buf couldn't be imported there.  do_longjmp was a
      userspace function which served to provide longjmp access to kernel code.
      
      This is gone, and a number of void * pointers can now be jmp_buf *.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fab95c55
    • J
      uml: style fixes pass 3 · ba180fd4
      Jeff Dike 提交于
      Formatting changes in the files which have been changed in the course
      of folding foo_skas functions into their callers.  These include:
      	copyright updates
      	header file trimming
      	style fixes
      	adding severity to printks
      
      These changes should be entirely non-functional.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ba180fd4
    • J
      uml: remove code made redundant by CHOOSE_MODE removal · 77bf4400
      Jeff Dike 提交于
      This patch makes a number of simplifications enabled by the removal of
      CHOOSE_MODE.  There were lots of functions that looked like
      
      	int foo(args){
      		foo_skas(args);
      	}
      
      The bodies of foo_skas are now folded into foo, and their declarations (and
      sometimes entire header files) are deleted.
      
      In addition, the union uml_pt_regs, which was a union between the tt and skas
      register formats, is now a struct, with the tt-mode arm of the union being
      removed.
      
      It turns out that usr2_handler was unused, so it is gone.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      77bf4400
    • J
      uml: throw out CONFIG_MODE_TT · 42fda663
      Jeff Dike 提交于
      This patchset throws out tt mode, which has been non-functional for a while.
      
      This is done in phases, interspersed with code cleanups on the affected files.
      
      The removal is done as follows:
      	remove all code, config options, and files which depend on
      CONFIG_MODE_TT
      	get rid of the CHOOSE_MODE macro, which decided whether to
      call tt-mode or skas-mode code, and replace invocations with their
      skas portions
      	replace all now-trivial procedures with their skas equivalents
      
      There are now a bunch of now-redundant pieces of data structures, including
      mode-specific pieces of the thread structure, pt_regs, and mm_context.  These
      are all replaced with their skas-specific contents.
      
      As part of the ongoing style compliance project, I made a style pass over all
      files that were changed.  There are three such patches, one for each phase,
      covering the files affected by that phase but no later ones.
      
      I noticed that we weren't freeing the LDT state associated with a process when
      it exited, so that's fixed in one of the later patches.
      
      The last patch is a tidying patch which I've had for a while, but which caused
      inexplicable crashes under tt mode.  Since that is no longer a problem, this
      can now go in.
      
      This patch:
      
      Start getting rid of tt mode support.
      
      This patch throws out CONFIG_MODE_TT and all config options, code, and files
      which depend on it.
      
      CONFIG_MODE_SKAS is gone and everything that depends on it is included
      unconditionally.
      
      The few changed lines are in re-written Kconfig help, lines which needed
      something skas-related removed from them, and a few more which weren't
      strictly deletions.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      42fda663
    • J
      uml: stop saving process FP state · 42daba31
      Jeff Dike 提交于
      Throw out a lot of code dealing with saving and restoring floating-point
      state.  In skas mode, where processes run in a restoring floating-point state
      on kernel entry and exit is pointless.
      
      This eliminates most of arch/um/os-Linux/sys-{i386,x86_64}/registers.c.  Most
      of what remained is now arch-indpendent, and can be moved up to
      arch/um/os-Linux/registers.c.  Both arches need the jmp_buf accessor
      get_thread_reg, and i386 needs {save,restore}_fp_regs because it cheats during
      sigreturn by getting the fp state using ptrace rather than copying it out of
      the process sigcontext.
      
      After this, it turns out that arch/um/include/skas/mode-skas.h is almost
      completely unneeded.  The declarations in it are variables which either don't
      exist or which don't have global scope.  The one exception is
      kill_off_processes_skas.  If that's removed, this header can be deleted.
      
      This uncovered a bug in user.h, which wasn't correctly making sure that a
      size_t definition was available to both userspace and kernelspace files.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      42daba31
    • J
      uml: tidy recently-moved code · 8e2d10e1
      Jeff Dike 提交于
      Now that the generic console operations are in a userspace file, we
      can do the following:
      	directly call into libc instead of through the os_* wrappers
      	eliminate os_window_size since it has only one user
      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>
      8e2d10e1
  4. 17 7月, 2007 1 次提交
  5. 11 5月, 2007 1 次提交
  6. 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
  7. 08 3月, 2007 1 次提交
  8. 12 2月, 2007 2 次提交
  9. 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
  10. 12 10月, 2006 1 次提交
  11. 27 9月, 2006 1 次提交
    • 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