1. 23 6月, 2019 1 次提交
    • V
      x86/vdso: Switch to generic vDSO implementation · 7ac87074
      Vincenzo Frascino 提交于
      The x86 vDSO library requires some adaptations to take advantage of the
      newly introduced generic vDSO library.
      
      Introduce the following changes:
       - Modification of vdso.c to be compliant with the common vdso datapage
       - Use of lib/vdso for gettimeofday
      
      [ tglx: Massaged changelog and cleaned up the function signature formatting ]
      Signed-off-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kselftest@vger.kernel.org
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Mark Salyzyn <salyzyn@android.com>
      Cc: Peter Collingbourne <pcc@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Dmitry Safonov <0x7f454c46@gmail.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Huw Davies <huw@codeweavers.com>
      Cc: Shijith Thotton <sthotton@marvell.com>
      Cc: Andre Przywara <andre.przywara@arm.com>
      Link: https://lkml.kernel.org/r/20190621095252.32307-23-vincenzo.frascino@arm.com
      7ac87074
  2. 22 6月, 2019 1 次提交
    • A
      x86/vdso: Prevent segfaults due to hoisted vclock reads · ff17bbe0
      Andy Lutomirski 提交于
      GCC 5.5.0 sometimes cleverly hoists reads of the pvclock and/or hvclock
      pages before the vclock mode checks.  This creates a path through
      vclock_gettime() in which no vclock is enabled at all (due to disabled
      TSC on old CPUs, for example) but the pvclock or hvclock page
      nevertheless read.  This will segfault on bare metal.
      
      This fixes commit 459e3a21 ("gcc-9: properly declare the
      {pv,hv}clock_page storage") in the sense that, before that commit, GCC
      didn't seem to generate the offending code.  There was nothing wrong
      with that commit per se, and -stable maintainers should backport this to
      all supported kernels regardless of whether the offending commit was
      present, since the same crash could just as easily be triggered by the
      phase of the moon.
      
      On GCC 9.1.1, this doesn't seem to affect the generated code at all, so
      I'm not too concerned about performance regressions from this fix.
      
      Cc: stable@vger.kernel.org
      Cc: x86@kernel.org
      Cc: Borislav Petkov <bp@alien8.de>
      Reported-by: NDuncan Roe <duncan_roe@optusnet.com.au>
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ff17bbe0
  3. 31 5月, 2019 1 次提交
  4. 02 5月, 2019 1 次提交
    • L
      gcc-9: properly declare the {pv,hv}clock_page storage · 459e3a21
      Linus Torvalds 提交于
      The pvlock_page and hvclock_page variables are (as the name implies)
      addresses to pages, created by the linker script.
      
      But we declared them as just "extern u8" variables, which _works_, but
      now that gcc does some more bounds checking, it causes warnings like
      
          warning: array subscript 1 is outside array bounds of ‘u8[1]’
      
      when we then access more than one byte from those variables.
      
      Fix this by simply making the declaration of the variables match
      reality, which makes the compiler happy too.
      Signed-off-by: NLinus Torvalds <torvalds@-linux-foundation.org>
      459e3a21
  5. 06 10月, 2018 1 次提交
  6. 05 10月, 2018 9 次提交
    • A
      x86/vdso: Remove "memory" clobbers in the vDSO syscall fallbacks · 89fe0a1f
      Andy Lutomirski 提交于
      When a vDSO clock function falls back to the syscall, no special
      barriers or ordering is needed, and the syscall fallbacks don't
      clobber any memory that is not explicitly listed in the asm
      constraints.  Remove the "memory" clobber.
      
      This causes minor changes to the generated code, but otherwise has
      no obvious performance impact.  I think it's nice to have, though,
      since it may help the optimizer in the future.
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/3a7438f5fb2422ed881683d2ccffd7f987b2dc44.1538689401.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      89fe0a1f
    • T
      x86/vdso: Move cycle_last handling into the caller · 3e89bf35
      Thomas Gleixner 提交于
      Dereferencing gtod->cycle_last all over the place and foing the cycles <
      last comparison in the vclock read functions generates horrible code. Doing
      it at the call site is much better and gains a few cycles both for TSC and
      pvclock.
      
      Caveat: This adds the comparison to the hyperv vclock as well, but I have
      no way to test that.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.741440803@linutronix.de
      3e89bf35
    • T
      x86/vdso: Simplify the invalid vclock case · 4f72adc5
      Thomas Gleixner 提交于
      The code flow for the vclocks is convoluted as it requires the vclocks
      which can be invalidated separately from the vsyscall_gtod_data sequence to
      store the fact in a separate variable. That's inefficient.
      
      Restructure the code so the vclock readout returns cycles and the
      conversion to nanoseconds is handled at the call site.
      
      If the clock gets invalidated or vclock is already VCLOCK_NONE, return
      U64_MAX as the cycle value, which is invalid for all clocks and leave the
      sequence loop immediately in that case by calling the fallback function
      directly.
      
      This allows to remove the gettimeofday fallback as it now uses the
      clock_gettime() fallback and does the nanoseconds to microseconds
      conversion in the same way as it does when the vclock is functional. It
      does not make a difference whether the division by 1000 happens in the
      kernel fallback or in userspace.
      
      Generates way better code and gains a few cycles back.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.657928937@linutronix.de
      4f72adc5
    • T
      x86/vdso: Replace the clockid switch case · f3e83938
      Thomas Gleixner 提交于
      Now that the time getter functions use the clockid as index into the
      storage array for the base time access, the switch case can be replaced.
      
      - Check for clockid >= MAX_CLOCKS and for negative clockid (CPU/FD) first
        and call the fallback function right away.
      
      - After establishing that clockid is < MAX_CLOCKS, convert the clockid to a
        bitmask
      
      - Check for the supported high resolution and coarse functions by anding
        the bitmask of supported clocks and check whether a bit is set.
      
      This completely avoids jump tables, reduces the number of conditionals and
      makes the VDSO extensible for other clock ids.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.574315796@linutronix.de
      f3e83938
    • T
      x86/vdso: Collapse coarse functions · 6deec5bd
      Thomas Gleixner 提交于
      do_realtime_coarse() and do_monotonic_coarse() are now the same except for
      the storage array index. Hand the index in as an argument and collapse the
      functions.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.490733779@linutronix.de
      6deec5bd
    • T
      x86/vdso: Collapse high resolution functions · e9a62f76
      Thomas Gleixner 提交于
      do_realtime() and do_monotonic() are now the same except for the storage
      array index. Hand the index in as an argument and collapse the functions.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.407955860@linutronix.de
      e9a62f76
    • T
      x86/vdso: Introduce and use vgtod_ts · 49116f20
      Thomas Gleixner 提交于
      It's desired to support more clocks in the VDSO, e.g. CLOCK_TAI. This
      results either in indirect calls due to the larger switch case, which then
      requires retpolines or when the compiler is forced to avoid jump tables it
      results in even more conditionals.
      
      To avoid both variants which are bad for performance the high resolution
      functions and the coarse grained functions will be collapsed into one for
      each. That requires to store the clock specific base time in an array.
      
      Introcude struct vgtod_ts for storage and convert the data store, the
      update function and the individual clock functions over to use it.
      
      The new storage does not longer use gtod_long_t for seconds depending on 32
      or 64 bit compile because this needs to be the full 64bit value even for
      32bit when a Y2038 function is added. No point in keeping the distinction
      alive in the internal representation.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.324679401@linutronix.de
      49116f20
    • T
      x86/vdso: Use unsigned int consistently for vsyscall_gtod_data:: Seq · 77e9c678
      Thomas Gleixner 提交于
      The sequence count in vgtod_data is unsigned int, but the call sites use
      unsigned long, which is a pointless exercise. Fix the call sites and
      replace 'unsigned' with unsinged 'int' while at it.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.236250416@linutronix.de
      77e9c678
    • T
      x86/vdso: Enforce 64bit clocksource · a51e996d
      Thomas Gleixner 提交于
      All VDSO clock sources are TSC based and use CLOCKSOURCE_MASK(64). There is
      no point in masking with all FF. Get rid of it and enforce the mask in the
      sanity checker.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Matt Rickard <matt@softrans.com.au>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: devel@linuxdriverproject.org
      Cc: virtualization@lists.linux-foundation.org
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Juergen Gross <jgross@suse.com>
      Link: https://lkml.kernel.org/r/20180917130707.151963007@linutronix.de
      a51e996d
  7. 04 10月, 2018 1 次提交
  8. 02 10月, 2018 1 次提交
    • A
      x86/vdso: Fix asm constraints on vDSO syscall fallbacks · 715bd9d1
      Andy Lutomirski 提交于
      The syscall fallbacks in the vDSO have incorrect asm constraints.
      They are not marked as writing to their outputs -- instead, they are
      marked as clobbering "memory", which is useless.  In particular, gcc
      is smart enough to know that the timespec parameter hasn't escaped,
      so a memory clobber doesn't clobber it.  And passing a pointer as an
      asm *input* does not tell gcc that the pointed-to value is changed.
      
      Add in the fact that the asm instructions weren't volatile, and gcc
      was free to omit them entirely unless their sole output (the return
      value) is used.  Which it is (phew!), but that stops happening with
      some upcoming patches.
      
      As a trivial example, the following code:
      
      void test_fallback(struct timespec *ts)
      {
      	vdso_fallback_gettime(CLOCK_MONOTONIC, ts);
      }
      
      compiles to:
      
      00000000000000c0 <test_fallback>:
        c0:   c3                      retq
      
      To add insult to injury, the RCX and R11 clobbers on 64-bit
      builds were missing.
      
      The "memory" clobber is also unnecessary -- no ordering with respect to
      other memory operations is needed, but that's going to be fixed in a
      separate not-for-stable patch.
      
      Fixes: 2aae950b ("x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu")
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/2c0231690551989d2fafa60ed0e7b5cc8b403908.1538422295.git.luto@kernel.org
      715bd9d1
  9. 07 12月, 2017 1 次提交
    • A
      x86/vdso: Change time() prototype to match __vdso_time() · 88edb57d
      Arnd Bergmann 提交于
      gcc-8 warns that time() is an alias for __vdso_time() but the two
      have different prototypes:
      
        arch/x86/entry/vdso/vclock_gettime.c:327:5: error: 'time' alias between functions of incompatible types 'int(time_t *)' {aka 'int(long int *)'} and 'time_t(time_t *)' {aka 'long int(long int *)'} [-Werror=attribute-alias]
         int time(time_t *t)
             ^~~~
        arch/x86/entry/vdso/vclock_gettime.c:318:16: note: aliased declaration here
      
      I could not figure out whether this is intentional, but I see that
      changing it to return time_t avoids the warning.
      
      Returning 'int' from time() is also a bit questionable, as it causes an
      overflow in y2038 even on 64-bit architectures that use a 64-bit time_t
      type. On 32-bit architecture with 64-bit time_t, time() should always
      be implement by the C library by calling a (to be added) clock_gettime()
      variant that takes a sufficiently wide argument.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Link: http://lkml.kernel.org/r/20171204150203.852959-1-arnd@arndb.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      88edb57d
  10. 25 10月, 2017 1 次提交
    • M
      locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns... · 6aa7de05
      Mark Rutland 提交于
      locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
      
      Please do not apply this to mainline directly, instead please re-run the
      coccinelle script shown below and apply its output.
      
      For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
      preference to ACCESS_ONCE(), and new code is expected to use one of the
      former. So far, there's been no reason to change most existing uses of
      ACCESS_ONCE(), as these aren't harmful, and changing them results in
      churn.
      
      However, for some features, the read/write distinction is critical to
      correct operation. To distinguish these cases, separate read/write
      accessors must be used. This patch migrates (most) remaining
      ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
      coccinelle script:
      
      ----
      // Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
      // WRITE_ONCE()
      
      // $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch
      
      virtual patch
      
      @ depends on patch @
      expression E1, E2;
      @@
      
      - ACCESS_ONCE(E1) = E2
      + WRITE_ONCE(E1, E2)
      
      @ depends on patch @
      expression E;
      @@
      
      - ACCESS_ONCE(E)
      + READ_ONCE(E)
      ----
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: davem@davemloft.net
      Cc: linux-arch@vger.kernel.org
      Cc: mpe@ellerman.id.au
      Cc: shuah@kernel.org
      Cc: snitzer@redhat.com
      Cc: thor.thayer@linux.intel.com
      Cc: tj@kernel.org
      Cc: viro@zeniv.linux.org.uk
      Cc: will.deacon@arm.com
      Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      6aa7de05
  11. 11 3月, 2017 1 次提交
  12. 25 12月, 2016 1 次提交
  13. 20 9月, 2016 1 次提交
    • P
      KVM: x86: introduce get_kvmclock_ns · 108b249c
      Paolo Bonzini 提交于
      Introduce a function that reads the exact nanoseconds value that is
      provided to the guest in kvmclock.  This crystallizes the notion of
      kvmclock as a thin veneer over a stable TSC, that the guest will
      (hopefully) convert with NTP.  In other words, kvmclock is *not* a
      paravirtualized host-to-guest NTP.
      
      Drop the get_kernel_ns() function, that was used both to get the base
      value of the master clock and to get the current value of kvmclock.
      The former use is replaced by ktime_get_boot_ns(), the latter is
      the purpose of get_kernel_ns().
      
      This also allows KVM to provide a Hyper-V time reference counter that
      is synchronized with the time that is computed from the TSC page.
      Reviewed-by: NRoman Kagan <rkagan@virtuozzo.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      108b249c
  14. 04 8月, 2016 2 次提交
  15. 13 4月, 2016 1 次提交
    • A
      x86/vdso: Remove direct HPET access through the vDSO · 1ed95e52
      Andy Lutomirski 提交于
      Allowing user code to map the HPET is problematic.  HPET
      implementations are notoriously buggy, and there are probably many
      machines on which even MMIO reads from bogus HPET addresses are
      problematic.
      
      We have a report that the Dell Precision M2800 with:
      
        ACPI: HPET 0x00000000C8FE6238 000038 (v01 DELL   CBX3  01072009 AMI. 00000005)
      
      is either so slow when accessing the HPET or actually hangs in some
      regard, causing soft lockups to be reported if users do unexpected
      things to the HPET.
      
      The vclock HPET code has also always been a questionable speedup.
      Accessing an HPET is exceedingly slow (on the order of several
      microseconds), so the added overhead in requiring a syscall to read
      the HPET is a small fraction of the total code of accessing it.
      
      To avoid future problems, let's just delete the code entirely.
      
      In the long run, this could actually be a speedup.  Waiman Long as a
      patch to optimize the case where multiple CPUs contend for the HPET,
      but that won't help unless all the accesses are mediated by the
      kernel.
      Reported-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NBorislav Petkov <bp@alien8.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Waiman Long <Waiman.Long@hpe.com>
      Cc: Waiman Long <waiman.long@hpe.com>
      Link: http://lkml.kernel.org/r/d2f90bba98db9905041cff294646d290d378f67a.1460074438.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      1ed95e52
  16. 24 2月, 2016 1 次提交
  17. 13 1月, 2016 1 次提交
  18. 11 12月, 2015 4 次提交
  19. 06 7月, 2015 3 次提交
  20. 04 6月, 2015 1 次提交
    • I
      x86/asm/entry, x86/vdso: Move the vDSO code to arch/x86/entry/vdso/ · d603c8e1
      Ingo Molnar 提交于
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      d603c8e1
  21. 27 4月, 2015 1 次提交
  22. 08 4月, 2015 1 次提交
    • R
      x86: vdso: fix pvclock races with task migration · 80f7fdb1
      Radim Krčmář 提交于
      If we were migrated right after __getcpu, but before reading the
      migration_count, we wouldn't notice that we read TSC of a different
      VCPU, nor that KVM's bug made pvti invalid, as only migration_count
      on source VCPU is increased.
      
      Change vdso instead of updating migration_count on destination.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      Fixes: 0a4e6be9 ("x86: kvm: Revert "remove sched notifier for cross-cpu migrations"")
      Message-Id: <1428000263-11892-1-git-send-email-rkrcmar@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      80f7fdb1
  23. 24 3月, 2015 1 次提交
  24. 25 6月, 2014 1 次提交
  25. 06 5月, 2014 2 次提交
    • A
      x86, vdso: Move the vvar and hpet mappings next to the 64-bit vDSO · f40c3300
      Andy Lutomirski 提交于
      This makes the 64-bit and x32 vdsos use the same mechanism as the
      32-bit vdso.  Most of the churn is deleting all the old fixmap code.
      Signed-off-by: NAndy Lutomirski <luto@amacapital.net>
      Link: http://lkml.kernel.org/r/8af87023f57f6bb96ec8d17fce3f88018195b49b.1399317206.git.luto@amacapital.netSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      f40c3300
    • A
      x86, vdso: Reimplement vdso.so preparation in build-time C · 6f121e54
      Andy Lutomirski 提交于
      Currently, vdso.so files are prepared and analyzed by a combination
      of objcopy, nm, some linker script tricks, and some simple ELF
      parsers in the kernel.  Replace all of that with plain C code that
      runs at build time.
      
      All five vdso images now generate .c files that are compiled and
      linked in to the kernel image.
      
      This should cause only one userspace-visible change: the loaded vDSO
      images are stripped more heavily than they used to be.  Everything
      outside the loadable segment is dropped.  In particular, this causes
      the section table and section name strings to be missing.  This
      should be fine: real dynamic loaders don't load or inspect these
      tables anyway.  The result is roughly equivalent to eu-strip's
      --strip-sections option.
      
      The purpose of this change is to enable the vvar and hpet mappings
      to be moved to the page following the vDSO load segment.  Currently,
      it is possible for the section table to extend into the page after
      the load segment, so, if we map it, it risks overlapping the vvar or
      hpet page.  This happens whenever the load segment is just under a
      multiple of PAGE_SIZE.
      
      The only real subtlety here is that the old code had a C file with
      inline assembler that did 'call VDSO32_vsyscall' and a linker script
      that defined 'VDSO32_vsyscall = __kernel_vsyscall'.  This most
      likely worked by accident: the linker script entry defines a symbol
      associated with an address as opposed to an alias for the real
      dynamic symbol __kernel_vsyscall.  That caused ld to relocate the
      reference at link time instead of leaving an interposable dynamic
      relocation.  Since the VDSO32_vsyscall hack is no longer needed, I
      now use 'call __kernel_vsyscall', and I added -Bsymbolic to make it
      work.  vdso2c will generate an error and abort the build if the
      resulting image contains any dynamic relocations, so we won't
      silently generate bad vdso images.
      
      (Dynamic relocations are a problem because nothing will even attempt
      to relocate the vdso.)
      Signed-off-by: NAndy Lutomirski <luto@amacapital.net>
      Link: http://lkml.kernel.org/r/2c4fcf45524162a34d87fdda1eb046b2a5cecee7.1399317206.git.luto@amacapital.netSigned-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      6f121e54