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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 21 Dec 2011 16:32:35 -0500 (EST)
From:	Vince Weaver <vince@...ter.net>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
cc:	Vince Weaver <vweaver1@...s.utk.edu>, mingo@...e.hu,
	William Cohen <wcohen@...hat.com>,
	Stephane Eranian <eranian@...gle.com>,
	Arun Sharma <asharma@...com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 0/6] perf: x86 RDPMC and RDTSC support

On Wed, 21 Dec 2011, Vince Weaver wrote:
> 
> currently when I tried doing a start ioctl then an immediate read, the 
> counter values returned were a very high value.  So unless I did two 
> rdpmcs and subtracted, the results made no sense.

I've added two rdpmc() tests to my perf_event_test suite.  A few comments.

* One, is it possible to detect at runtime that rdpmc() is supported?  
  Maybe a field in the mmap'd buffer that can be read?

  Otherwise if you try to do a rdpmc() on an unpatched kernel you get a 
  general protection error and a segfault.  This makes it tricky to have 
  nice code that tries rdpmc() and falls back to read() if it is 
  unavailable.

* Second, if I try a start / run 100M instructions / read
  and measure retired instructions I get:
      281474977711543 instructions
  This is 0x10000000f45b7 which is 1<<48 + 100M.  I guess an artifact
  of how the counters are set up?  Is it possible to have this start
  at 0?  

  Otherwise you need to always do two reads and a subtract  to get good 
  values.

Thanks,

Vince


(below are the results from the rdpmc_validation test)


This test checks if userspace rdpmc() style reads work.

total start/work/read/stop latency: 646001 cycles
	Event 0 -- count: 281474977711543 running: 320324
	Event 1 -- count: 281474977712320 running: 320939
total start/read/work/read/stop latency: 653451 cycles
	Event 0 -- count: 1000828 running: 321985
	Event 1 -- count: 1000108 running: 321195

   Expected: 1000000
   High: 1000828   Low:  1000828   Average:  1000828
   ( note, a small value above 1000000 may be expected due
     to overhead and interrupt noise, among other reasons)
   Average Error = 0.08%
Testing if userspace rdpmc reads give expected results...    PASSED

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ