1. 28 3月, 2015 4 次提交
    • N
      ARM: 8332/1: add CONFIG_VDSO Kconfig and Makefile bits · e5b61deb
      Nathan Lynch 提交于
      Allow users to enable the vdso in Kconfig; include the vdso in the
      build if CONFIG_VDSO is enabled.  Add 'vdso_install' target.
      Signed-off-by: NNathan Lynch <nathan_lynch@mentor.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      e5b61deb
    • N
      ARM: 8331/1: VDSO initialization, mapping, and synchronization · ecf99a43
      Nathan Lynch 提交于
      Initialize the VDSO page list at boot, install the VDSO mapping at
      exec time, and update the data page during timer ticks.  This code is
      not built if CONFIG_VDSO is not enabled.
      
      Account for the VDSO length when randomizing the offset from the
      stack.  The [vdso] and [vvar] pages are placed immediately following
      the sigpage with separate _install_special_mapping calls.
      
      We want to "penalize" systems lacking the arch timer as little
      as possible.  Previous versions of this code installed the VDSO
      unconditionally and unmodified, making it a measurably slower way for
      glibc to invoke the real syscalls on such systems.  E.g. calling
      gettimeofday via glibc goes from ~560ns to ~630ns on i.MX6Q.
      
      If we can indicate to glibc that the time-related APIs in the VDSO are
      not accelerated, glibc can continue to invoke the syscalls directly
      instead of dispatching through the VDSO only to fall back to the slow
      path.
      
      Thus, if the architected timer is unusable for whatever reason, patch
      the VDSO at boot time so that symbol lookups for gettimeofday and
      clock_gettime return NULL.  (This is similar to what powerpc does and
      borrows code from there.)  This allows glibc to perform the syscall
      directly instead of passing control to the VDSO, which minimizes the
      penalty.  In my measurements the time taken for a gettimeofday call
      via glibc goes from ~560ns to ~580ns (again on i.MX6Q), and this is
      solely due to adding a test and branch to glibc's gettimeofday syscall
      wrapper.
      
      An alternative to patching the VDSO at boot would be to not install
      the VDSO at all when the arch timer isn't usable.  Another alternative
      is to include a separate "dummy" vdso.so without gettimeofday and
      clock_gettime, which would be selected at boot time.  Either of these
      would get cumbersome if the VDSO were to gain support for an API such
      as getcpu which is unrelated to arch timer support.
      Signed-off-by: NNathan Lynch <nathan_lynch@mentor.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ecf99a43
    • N
      ARM: 8330/1: add VDSO user-space code · 8512287a
      Nathan Lynch 提交于
      Place VDSO-related user-space code in arch/arm/kernel/vdso/.
      
      It is almost completely written in C with some assembly helpers to
      load the data page address, sample the counter, and fall back to
      system calls when necessary.
      
      The VDSO can service gettimeofday and clock_gettime when
      CONFIG_ARM_ARCH_TIMER is enabled and the architected timer is present
      (and correctly configured).  It reads the CP15-based virtual counter
      to compute high-resolution timestamps.
      
      Of particular note is that a post-processing step ("vdsomunge") is
      necessary to produce a shared object which is architecturally allowed
      to be used by both soft- and hard-float EABI programs.
      
      The 2012 edition of the ARM ABI defines Tag_ABI_VFP_args = 3 "Code is
      compatible with both the base and VFP variants; the user did not
      permit non-variadic functions to pass FP parameters/results."
      Unfortunately current toolchains do not support this tag, which is
      ideally what we would use.
      
      The best available option is to ensure that both EF_ARM_ABI_FLOAT_SOFT
      and EF_ARM_ABI_FLOAT_HARD are unset in the ELF header's e_flags,
      indicating that the shared object is "old" and should be accepted for
      backward compatibility's sake.  While binutils < 2.24 appear to
      produce a vdso.so with both flags clear, 2.24 always sets
      EF_ARM_ABI_FLOAT_SOFT, with no way to inhibit this behavior.  So we
      have to fix things up with a custom post-processing step.
      
      In fact, the VDSO code in glibc does much less validation (including
      checking these flags) than the code for handling conventional
      file-backed shared libraries, so this is a bit moot unless glibc's
      VDSO code becomes more strict.
      Signed-off-by: NNathan Lynch <nathan_lynch@mentor.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      8512287a
    • N
      ARM: 8329/1: miscellaneous vdso infrastructure, preparation · 1713ce7c
      Nathan Lynch 提交于
      Define the layout of the data structure shared between kernel and
      userspace.
      
      Track the vdso address in the mm_context; needed for communicating
      AT_SYSINFO_EHDR to the ELF loader.
      
      Add declarations for arm_install_vdso; implementation is in a
      following patch.
      
      Define AT_SYSINFO_EHDR, and, if CONFIG_VDSO=y, report the vdso shared
      object address via the ELF auxiliary vector.
      
      Note - this adds the AT_SYSINFO_EHDR in a new user-visible header
      asm/auxvec.h; this is consistent with other architectures.
      Signed-off-by: NNathan Lynch <nathan_lynch@mentor.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      1713ce7c
  2. 23 2月, 2015 1 次提交
    • D
      VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) · e36cb0b8
      David Howells 提交于
      Convert the following where appropriate:
      
       (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
      
       (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
      
       (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
           complicated than it appears as some calls should be converted to
           d_can_lookup() instead.  The difference is whether the directory in
           question is a real dir with a ->lookup op or whether it's a fake dir with
           a ->d_automount op.
      
      In some circumstances, we can subsume checks for dentry->d_inode not being
      NULL into this, provided we the code isn't in a filesystem that expects
      d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
      use d_inode() rather than d_backing_inode() to get the inode pointer).
      
      Note that the dentry type field may be set to something other than
      DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
      manages the fall-through from a negative dentry to a lower layer.  In such a
      case, the dentry type of the negative union dentry is set to the same as the
      type of the lower dentry.
      
      However, if you know d_inode is not NULL at the call site, then you can use
      the d_is_xxx() functions even in a filesystem.
      
      There is one further complication: a 0,0 chardev dentry may be labelled
      DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
      intended for special directory entry types that don't have attached inodes.
      
      The following perl+coccinelle script was used:
      
      use strict;
      
      my @callers;
      open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
          die "Can't grep for S_ISDIR and co. callers";
      @callers = <$fd>;
      close($fd);
      unless (@callers) {
          print "No matches\n";
          exit(0);
      }
      
      my @cocci = (
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISLNK(E->d_inode->i_mode)',
          '+ d_is_symlink(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISDIR(E->d_inode->i_mode)',
          '+ d_is_dir(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISREG(E->d_inode->i_mode)',
          '+ d_is_reg(E)' );
      
      my $coccifile = "tmp.sp.cocci";
      open($fd, ">$coccifile") || die $coccifile;
      print($fd "$_\n") || die $coccifile foreach (@cocci);
      close($fd);
      
      foreach my $file (@callers) {
          chomp $file;
          print "Processing ", $file, "\n";
          system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
      	die "spatch failed";
      }
      
      [AV: overlayfs parts skipped]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e36cb0b8
  3. 21 2月, 2015 2 次提交
  4. 20 2月, 2015 29 次提交
  5. 19 2月, 2015 4 次提交