Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date
Msg-id xapc4voxjx5ra47ci62essqxyyxyh57q6o4griutoq6inkxdgj@yqwgycwkdr6s
Whole thread
In response to Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?  (Lukas Fittl <lukas@fittl.com>)
Responses Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
List pgsql-hackers
Hi,

Just a quick comment, haven't actually had time to look through the email/new
patch version with any care.


On 2026-03-03 02:29:06 -0800, Lukas Fittl wrote:
> - Added support for HyperV hypervisor by reading the TSC frequency
> MSR. This allows Azure Linux VMs to work as well, and in my test gives
> a similar speed up with RDTSC like reported on AWS. Only annoyance is
> that to enable it you have to make /dev/cpu/0/msr readable ("setcap
> cap_sys_rawio=ep" on the binary that accesses it + give the user/group
> access to the device file)

I rather doubt that giving even just read access to MSRs to unprivileged
userspace processes is a good idea.

But if we read files anyway, wouldn't just using
  /sys/devices/system/cpu/cpu0/cpufreq/base_frequency
work?

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Sami Imseih
Date:
Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access
Next
From: Anthonin Bonnefoy
Date:
Subject: Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record