From: "Luck, Tony" <tony.luck@intel.com>
To: David Laight <David.Laight@aculab.com>
Cc: "Sun, Yi" <yi.sun@intel.com>,
"Hansen, Dave" <dave.hansen@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"Mehta, Sohil" <sohil.mehta@intel.com>,
"Su, Heng" <heng.su@intel.com>
Subject: Re: [PATCH 1/2] x86/fpu: Measure the Latency of XSAVE and XRSTOR
Date: Sun, 24 Jul 2022 23:00:19 +0000 [thread overview]
Message-ID: <75084D4E-80AC-4FE7-8CDD-2BFD30D23695@intel.com> (raw)
In-Reply-To: <921078bc2a994d3ab6aba26d4654cb47@AcuMS.aculab.com>
RDTSC has returned values invariant of current frequency since Nehalem (modulo a few hiccoughs). So any CPU with XSAVE/XRESTOR should be safe to measure using TSC.
Sent from my iPhone
> On Jul 24, 2022, at 14:16, David Laight <David.Laight@aculab.com> wrote:
>
> From: Yi Sun
>> Sent: 23 July 2022 09:38
>>
>> Calculate the latency of instructions xsave and xrstor with new trace
>> points x86_fpu_latency_xsave and x86_fpu_latency_xrstor.
>>
>> The delta TSC can be calculated within a single trace event. Another
>> option considered was to have 2 separated trace events marking the
>> start and finish of the xsave/xrstor instructions. The delta TSC was
>> calculated from the 2 trace points in user space, but there was
>> significant overhead added by the trace function itself.
>>
>> In internal testing, the single trace point option which is
>> implemented here proved to be more accurate.
> ...
>
> I've done some experiments that measure short instruction latencies.
> Basically I found:
> 1) You need a suitable serialising instruction before and after
> the code being tested - otherwise it can overlap whatever
> you are using for timing.
> 2) The only reliable counter is the performance monitor clock
> counter - everything else depends on the current cpu frequency.
> On intel cpu the cpu frequency can change all the time.
> Allowing for that, and then ignoring complete outliers, I could
> get clock-count accurate values for iterations of the IP csum loop.
>
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>
next prev parent reply other threads:[~2022-07-24 23:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 8:37 [PATCH 0/2] x86: Add xsave/xrstor Latency Trace Events and Consuming Script Yi Sun
2022-07-23 8:37 ` [PATCH 1/2] x86/fpu: Measure the Latency of XSAVE and XRSTOR Yi Sun
2022-07-24 20:54 ` David Laight
2022-07-24 23:00 ` Luck, Tony [this message]
2022-07-25 7:35 ` David Laight
2022-07-25 17:44 ` Dave Hansen
2022-07-26 7:41 ` David Laight
2022-07-26 9:03 ` 'Yi Sun'
2022-07-28 18:46 ` Sohil Mehta
2022-07-23 8:38 ` [PATCH 2/2] scripts/x86: Add script to consume trace log of xsave latency Yi Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75084D4E-80AC-4FE7-8CDD-2BFD30D23695@intel.com \
--to=tony.luck@intel.com \
--cc=David.Laight@aculab.com \
--cc=dave.hansen@intel.com \
--cc=heng.su@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sohil.mehta@intel.com \
--cc=x86@kernel.org \
--cc=yi.sun@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®