lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 23 Jan 2023 10:27:25 -0800
From:   kan.liang@...ux.intel.com
To:     peterz@...radead.org, mingo@...hat.com, tglx@...utronix.de,
        jstultz@...gle.com, sboyd@...nel.org, linux-kernel@...r.kernel.org
Cc:     eranian@...gle.com, namhyung@...nel.org, ak@...ux.intel.com,
        Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH 0/3] Convert TSC to monotonic clock for PEBS

From: Kan Liang <kan.liang@...ux.intel.com>

A Processor Event Based Sampling (PEBS) record includes a field that
provide the time stamp counter value when the counter was overflowed
and the PEBS record was generated. The accurate time stamp can be used
to reconcile user samples. However, the current PEBS codes only can
convert the time stamp to sched_clock, which is not available from user
space. A solution to convert a given TSC to user visible monotonic
clock is required.

The perf_event subsystem only converts the TSC in a NMI handler. The
converter function must be fast and NMI safe.

Considered the below two existing functions, but none of them fulfill
the above requirements.
- The ktime_get_mono_fast_ns() is NMI safe, but it can only return the
  current clock monotonic rather than a given time's monotonic.
- The get_device_system_crosststamp() can calculate the system time from
  a given device time. But it's not fast and NMI safe.

Introduce a new generic interface, get_mono_fast_from_given_time, to
convert a given timestamp to clock monotonic.

Kan Liang (3):
  timekeeping: NMI safe converter from a given time to monotonic
  x86/tsc: Add set_tsc_system_counterval
  perf/x86/intel/ds: Support monotonic clock for PEBS

 arch/x86/events/intel/core.c |  2 +-
 arch/x86/events/intel/ds.c   | 30 +++++++++++++---
 arch/x86/include/asm/tsc.h   |  1 +
 arch/x86/kernel/tsc.c        |  6 ++++
 include/linux/timekeeping.h  |  9 +++++
 kernel/time/timekeeping.c    | 68 ++++++++++++++++++++++++++++++++++--
 6 files changed, 108 insertions(+), 8 deletions(-)

-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ