[PATCH v6] ptp: Add support for the AMZNC10C 'vmclock' device

2024-09-20 Thread David Woodhouse
From: David Woodhouse The vmclock device addresses the problem of live migration with precision clocks. The tolerances of a hardware counter (e.g. TSC) are typically around ±50PPM. A guest will use NTP/PTP/PPS to discipline that counter against an external source of 'real' time, and

Re: [PATCH v5] ptp: Add support for the AMZNC10C 'vmclock' device

2024-09-18 Thread David Woodhouse
On Tue, 2024-09-03 at 15:56 +0200, Paolo Abeni wrote: > I'm sorry for the late feedback. No problem. I've addressed it all apart from the uint64_t part. I'll concede the pre-C99 nonsense where it matches existing code, but we've always also allowed code in the kernel to use the proper C language t

[PATCH v5] ptp: Add support for the AMZNC10C 'vmclock' device

2024-08-23 Thread David Woodhouse
From: David Woodhouse The vmclock device addresses the problem of live migration with precision clocks. The tolerances of a hardware counter (e.g. TSC) are typically around ±50PPM. A guest will use NTP/PTP/PPS to discipline that counter against an external source of 'real' time, and

Re: [PATCH v4] ptp: Add vDSO-style vmclock support

2024-08-22 Thread David Woodhouse
On Thu, 2024-08-22 at 12:49 +0100, Simon Horman wrote: > Hi David, > > Sorry to be always the one with the nit-pick. > Sparse complains about the line above, I believe because the > type of st->clk->size is __le32. > > .../ptp_vmclock.c:562:13: warning: restricted __le32 degrades to integer Oops

[PATCH v4] ptp: Add vDSO-style vmclock support

2024-08-21 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [PATCH v3] ptp: Add vDSO-style vmclock support

2024-07-29 Thread David Woodhouse
On Mon, 2024-07-29 at 11:33 -0400, Michael S. Tsirkin wrote: > you said you will use __le here? I hadn't intended to bother until we add the virtio discovery and negotiation paths; it would basically be cosmetic for now. Although I *will* do so with the QEMU side before posting the latest version

[PATCH v3] ptp: Add vDSO-style vmclock support

2024-07-29 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-28 Thread David Woodhouse
On 28 July 2024 16:23:49 BST, "Michael S. Tsirkin" wrote: >On Sun, Jul 28, 2024 at 02:07:01PM +0100, David Woodhouse wrote: >> On 28 July 2024 11:37:04 BST, "Michael S. Tsirkin" wrote: >> >Glad you asked :) >> >> Heh, I'm not sure I&#

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-28 Thread David Woodhouse
On 28 July 2024 11:37:04 BST, "Michael S. Tsirkin" wrote: >Glad you asked :) Heh, I'm not sure I'm so glad. Did I mention I hate ACPI? Perhaps it's still not too late for me just to define a DT binding and use PRP0001 for it :) >Long story short, QEMUVGID is indeed out of spec, but it works >bo

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On 26 July 2024 17:49:58 BST, Jonathan Cameron wrote: >On Thu, 25 Jul 2024 14:50:50 +0100 >David Woodhouse wrote: > >> On Thu, 2024-07-25 at 08:33 -0400, Michael S. Tsirkin wrote: >> > On Thu, Jul 25, 2024 at 01:31:19PM +0100, David Woodhouse wrote: >> > &g

Re: [PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On 26 July 2024 15:57:34 BST, Jakub Kicinski wrote: >On Fri, 26 Jul 2024 13:28:17 +0100 David Woodhouse wrote: >> +` status = acpi_walk_resources(adev->handle, METHOD_NAME__CRS, > > ^ watch out for ticks! Oops, that last minute space->tab fix after I'd already

Re: [PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On Fri, 2024-07-26 at 09:14 -0400, Michael S. Tsirkin wrote: > For purposes of virtio, should we label all the fields here > __le? Yes. Peter and I discussed that, and it's mostly just a cosmetic change at this point. The simple ACPI thing only exists on LE platforms for *now* anyway. We also had

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On Fri, 2024-07-26 at 09:04 -0400, Michael S. Tsirkin wrote: > On Fri, Jul 26, 2024 at 02:00:25PM +0100, David Woodhouse wrote: > > On Fri, 2024-07-26 at 08:52 -0400, Michael S. Tsirkin wrote: > > > On Fri, Jul 26, 2024 at 09:35:51AM +0100, David Woodhouse wrote: > > >

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On Fri, 2024-07-26 at 08:52 -0400, Michael S. Tsirkin wrote: > On Fri, Jul 26, 2024 at 09:35:51AM +0100, David Woodhouse wrote: > > But for this use case, we only need a memory region that the hypervisor > > can update. We don't need any of that complexity of gratuitously >

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On Fri, 2024-07-26 at 08:47 -0400, Michael S. Tsirkin wrote: > On Fri, Jul 26, 2024 at 09:06:29AM +0100, David Woodhouse wrote: > > That's great. You don't even need it to be per-vCPU if you let the > > hypervisor write directly to the single physical location that'

[PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On Fri, 2024-07-26 at 02:06 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 11:20:56PM +0100, David Woodhouse wrote: > > We're rolling out the AMZNVCLK device for internal use cases, and plan > > to add it in public instances some time later. > > Let's be

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-26 Thread David Woodhouse
On Fri, 2024-07-26 at 01:55 -0400, Michael S. Tsirkin wrote: > On Fri, Jul 26, 2024 at 01:09:24AM -0400, Michael S. Tsirkin wrote: > > On Thu, Jul 25, 2024 at 10:29:18PM +0100, David Woodhouse wrote: > > > > > > Then can't we fix it by inte

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 17:47 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 10:29:18PM +0100, David Woodhouse wrote: > > Those people included me. I wanted to interrupt all the vCPUs, even the > > ones which were in userspace at the moment of migration, and have the >

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 17:04 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 10:00:24PM +0100, David Woodhouse wrote: > > On Thu, 2024-07-25 at 16:50 -0400, Michael S. Tsirkin wrote: > > > On Thu, Jul 25, 2024 at 08:35:40PM +0100, David Woodhouse wrote: > > >

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 16:50 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 08:35:40PM +0100, David Woodhouse wrote: > > On Thu, 2024-07-25 at 12:38 -0400, Michael S. Tsirkin wrote: > > > On Thu, Jul 25, 2024 at 04:18:43PM +0100, David Woodhouse wrote: > >

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 12:38 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 04:18:43PM +0100, David Woodhouse wrote: > > The use case isn't necessarily for all users of gettimeofday(), of > > course; this is for those applications which *need* precision time.

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 10:11 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 02:50:50PM +0100, David Woodhouse wrote: > > Even if the virtio-rtc specification were official today, and I was > > able to expose it via PCI, I probably wouldn't do it that way. There&#x

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 08:33 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 01:31:19PM +0100, David Woodhouse wrote: > > On Thu, 2024-07-25 at 08:29 -0400, Michael S. Tsirkin wrote: > > > On Thu, Jul 25, 2024 at 01:27:49PM +0100, David Woodhouse wrote: > > >

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 08:29 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 01:27:49PM +0100, David Woodhouse wrote: > > On Thu, 2024-07-25 at 08:17 -0400, Michael S. Tsirkin wrote: > > > On Thu, Jul 25, 2024 at 10:56:05AM +0100, David Woodhouse wrote: > > > &

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 08:17 -0400, Michael S. Tsirkin wrote: > On Thu, Jul 25, 2024 at 10:56:05AM +0100, David Woodhouse wrote: > > > Do you want to just help complete virtio-rtc then? Would be easier than > > > trying to keep two specs in sync. > > > > The ACPI

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 12:31 +0100, Daniel P. Berrangé wrote: > On Thu, Jul 25, 2024 at 10:56:05AM +0100, David Woodhouse wrote: > > Hi Michael, thanks for the review! > > > > On Thu, 2024-07-25 at 01:48 -0400, Michael S. Tsirkin wrote: > > > Do you want to just

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 13:20 +0200, Paolo Abeni wrote: > > > Just a bunch of 'nits below Thank you. Fixed in https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/vmclock I'll post a new version once I've finished resolving mst's and any other feedback. smime.p7s Description: S/

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
On Thu, 2024-07-25 at 01:54 -0400, Michael S. Tsirkin wrote: > one other thing worth mentioning is that this design can't work > with confidential computing setups. By comparison, mapping e.g. a > range in a PCI BAR would work for these setups. Why so? This is just like mapping a PCI BAR, isn't it

Re: [PATCH] ptp: Add vDSO-style vmclock support

2024-07-25 Thread David Woodhouse
Hi Michael, thanks for the review! On Thu, 2024-07-25 at 01:48 -0400, Michael S. Tsirkin wrote: > On Wed, Jul 24, 2024 at 06:16:37PM +0100, David Woodhouse wrote: > > From: David Woodhouse > > > > The vmclock "device" provides a shared memory region with prec

[PATCH] ptp: Add vDSO-style vmclock support

2024-07-24 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [RFC PATCH v4] ptp: Add vDSO-style vmclock support

2024-07-17 Thread David Woodhouse
On Tue, 2024-07-16 at 15:20 +0200, Peter Hilber wrote: > On 16.07.24 14:32, David Woodhouse wrote: > > On 16 July 2024 12:54:52 BST, Peter Hilber > > wrote: > > > On 11.07.24 09:50, David Woodhouse wrote: > > > > On Thu, 2024-07-11 at 09:25 +0200, Peter Hil

Re: [RFC PATCH v4] ptp: Add vDSO-style vmclock support

2024-07-17 Thread David Woodhouse
On Tue, 2024-07-16 at 13:54 +0200, Peter Hilber wrote: > On 08.07.24 11:27, David Woodhouse wrote: > > + > > +   /* > > +    * Time according to time_type field above. > > +    */ > > +   uint64_t time_sec;  /* Seconds since time_t

Re: [RFC PATCH v4] ptp: Add vDSO-style vmclock support

2024-07-16 Thread David Woodhouse
On 16 July 2024 12:54:52 BST, Peter Hilber wrote: >On 11.07.24 09:50, David Woodhouse wrote: >> On Thu, 2024-07-11 at 09:25 +0200, Peter Hilber wrote: >>> >>> IMHO this phrasing is better, since it directly refers to the state of the >>> structure. >> &

Re: [RFC PATCH v4] ptp: Add vDSO-style vmclock support

2024-07-11 Thread David Woodhouse
On Thu, 2024-07-11 at 09:25 +0200, Peter Hilber wrote: > > IMHO this phrasing is better, since it directly refers to the state of the > structure. Thanks. I'll update it. > AFAIU if there would be abnormal delays in store buffers, causing some > driver to still see the old clock for some time, t

Re: [RFC PATCH v4] ptp: Add vDSO-style vmclock support

2024-07-10 Thread David Woodhouse
On Wed, 2024-07-10 at 15:07 +0200, Peter Hilber wrote: > On 08.07.24 11:27, David Woodhouse wrote: > > From: David Woodhouse > > > > The vmclock "device" provides a shared memory region with precision clock > > information. By using shared memory, it is safe

[RFC PATCH v4] ptp: Add vDSO-style vmclock support

2024-07-08 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [RFC PATCH v3] ptp: Add vDSO-style vmclock support

2024-07-08 Thread David Woodhouse
On Mon, 2024-07-08 at 10:17 +0100, Simon Horman wrote: > Hi David, > > As per my comment on v2, although it is harmless in this case, > it would be nicer to use strscpy() here and avoid fortification > warnings. > Oh, pants! I have fixed that; must have sent the wrong version. V4 coming up short

[RFC PATCH v3] ptp: Add vDSO-style vmclock support

2024-07-06 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-05 Thread David Woodhouse
On Fri, 2024-07-05 at 10:12 +0200, Peter Hilber wrote: > On 03.07.24 12:40, David Woodhouse wrote: > > [...] > > > > > > > This is what I currently have for 'struct vmclock_abi' that I'd like to > > persuade you to adopt. I need to tweak it so

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-03 Thread David Woodhouse
On Wed, 2024-07-03 at 11:56 +0200, Peter Hilber wrote: > On 02.07.24 20:40, David Woodhouse wrote: > > On 2 July 2024 19:12:00 BST, Peter Hilber > > wrote: > > > On 02.07.24 18:39, David Woodhouse wrote: > > > > To clarify then, the main types are > &g

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-02 Thread David Woodhouse
On 2 July 2024 19:12:00 BST, Peter Hilber wrote: >On 02.07.24 18:39, David Woodhouse wrote: >> To clarify then, the main types are >> >> VIRTIO_RTC_CLOCK_UTC == 0 >> VIRTIO_RTC_CLOCK_TAI == 1 >> VIRTIO_RTC_CLOCK_MONOTONIC == 2 >> VIRTIO_RTC_CLOCK_SMEAR

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-02 Thread David Woodhouse
On Tue, 2024-07-02 at 17:03 +0200, Peter Hilber wrote: > > On 01.07.24 10:57, David Woodhouse wrote: > > > > If my proposed memory structure is subsumed into the virtio-rtc > > > > proposal we'd literally use the same names, but for the time being I'll

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-07-01 Thread David Woodhouse
On Fri, 2024-06-28 at 22:27 +0100, David Woodhouse wrote: > On 28 June 2024 17:38:15 BST, Peter Hilber > wrote: > > On 28.06.24 14:15, David Woodhouse wrote: > > > On Fri, 2024-06-28 at 13:33 +0200, Peter Hilber wrote: > > > > On 27.06.24 16:52, David Woodhouse w

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-28 Thread David Woodhouse
On 28 June 2024 17:38:15 BST, Peter Hilber wrote: >On 28.06.24 14:15, David Woodhouse wrote: >> On Fri, 2024-06-28 at 13:33 +0200, Peter Hilber wrote: >>> On 27.06.24 16:52, David Woodhouse wrote: >>>> I already added a flags field, so

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-28 Thread David Woodhouse
On Fri, 2024-06-28 at 13:33 +0200, Peter Hilber wrote: > On 27.06.24 16:52, David Woodhouse wrote: > > I already added a flags field, so this might look something like: > > > >     /* > > * Smearing flags. The UTC clock exposed through this structure >

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-28 Thread David Woodhouse
On Fri, 2024-06-28 at 13:33 +0200, Peter Hilber wrote: > > > > > /* > > * What time is exposed in the time_sec/time_frac_sec fields? > > */ > > uint8_t time_type; > > #define VMCLOCK_TIME_UNKNOWN0   /* Invalid / no time > > exposed */ > > #define

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-27 Thread David Woodhouse
I've updated the tree at https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/vmclock (but not yet the qemu one). I think I've taken into account all your comments apart from the one about non-64-bit counters wrapping. I reduced the seq_count to 32 bit to make room for a 32-bit fla

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-27 Thread David Woodhouse
On Thu, 2024-06-27 at 15:50 +0200, Peter Hilber wrote: > On 25.06.24 21:01, David Woodhouse wrote: > > From: David Woodhouse > > > > The vmclock "device" provides a shared memory region with precision clock > > information. By using shared memory, it is safe

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-26 Thread David Woodhouse
On Tue, 2024-06-25 at 15:22 -0700, John Stultz wrote: > On Tue, Jun 25, 2024 at 2:48 PM David Woodhouse wrote: > > On Tue, 2024-06-25 at 23:34 +0200, Thomas Gleixner wrote: > > > On Tue, Jun 25 2024 at 20:01, David Woodhouse wrote: > > > > From: David Woodhouse

Re: [RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-25 Thread David Woodhouse
On Tue, 2024-06-25 at 23:34 +0200, Thomas Gleixner wrote: > On Tue, Jun 25 2024 at 20:01, David Woodhouse wrote: > > From: David Woodhouse > > > > The vmclock "device" provides a shared memory region with precision clock > > information. By using shared mem

[RFC PATCH v2] ptp: Add vDSO-style vmclock support

2024-06-25 Thread David Woodhouse
From: David Woodhouse The vmclock "device" provides a shared memory region with precision clock information. By using shared memory, it is safe across Live Migration. Like the KVM PTP clock, this can convert TSC-based cross timestamps into KVM clock values. Unlike the KVM PTP clock,

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-06-21 Thread David Woodhouse
On Thu, 2024-06-20 at 14:37 +0200, Peter Hilber wrote: > Should implement .gettimex64 instead. Thanks. This look sane? As noted in the code comment, in the *ideal* case we just build all three pre/post/device timestamps from the very same counter read. So sts->pre_ts == sts->post_ts. In the less

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-06-21 Thread David Woodhouse
On Thu, 2024-06-20 at 17:19 +0100, David Woodhouse wrote: > > > > > > + > > > +   /* Counter frequency, and error margin. Units of (second >> 64) */ > > > +   uint64_t counter_period_frac_sec; > > > > AFAIU this might limit the pr

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-06-20 Thread David Woodhouse
ave my permission to direct replies to whichever you choose.) > On 15.06.24 10:40, David Woodhouse wrote: > > As discussed before, I don't think it makes sense to design a new high- > > precision virtual clock which only gets it right *most* of the time. We > > absolutely n

Re: [RFC PATCH v3 5/7] virtio_rtc: Add PTP clocks

2024-06-20 Thread David Woodhouse
On Thu, 2024-06-20 at 14:01 +0200, Peter Hilber wrote: > On 15.06.24 10:01, David Woodhouse wrote: > > On Mon, 2023-12-18 at 08:38 +0100, Peter Hilber wrote: > > > > > > +   ret = viortc_hw_xtstamp_params(&hw_counter, &cs_id); > > > +

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-06-15 Thread David Woodhouse
27;m doing the same thing for now. The structure itself is at the end, or see https://git.infradead.org/?p=users/dwmw2/linux.git;a=blob;f=include/uapi/linux/vmclock.h;hb=vmclock From 9e1c3b823d497efa4e0acb21b226a72e4d6e8a53 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 10 Jun 2024 15

Re: [RFC PATCH v3 5/7] virtio_rtc: Add PTP clocks

2024-06-15 Thread David Woodhouse
On Mon, 2023-12-18 at 08:38 +0100, Peter Hilber wrote: > > +   ret = viortc_hw_xtstamp_params(&hw_counter, &cs_id); > +   if (ret) > +   return ret; > + > +   ktime_get_snapshot(&history_begin); > +   if (history_begin.cs_id != cs_id) > +   return -EOPNOTSUP

Re: [RFC PATCH v3 6/7] virtio_rtc: Add Arm Generic Timer cross-timestamping

2024-06-15 Thread David Woodhouse
On Mon, 2023-12-18 at 08:38 +0100, Peter Hilber wrote: > > +int viortc_hw_xtstamp_params(u16 *hw_counter, enum clocksource_ids *cs_id) > +{ > +   *hw_counter = VIRTIO_RTC_COUNTER_ARM_VIRT; Hm, but what if it isn't? I think you need to put this in drivers/clocksource/arm_arch_timer.c where it

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-20 Thread David Woodhouse
On Tue, 2024-03-19 at 14:47 +0100, Peter Hilber wrote: > While the virtio-comment list is not available, now also CC'ing Parav, > which may be interested in this virtio-rtc spec related discussion thread. > > On 14.03.24 15:19, David Woodhouse wrote: > > On 14 March 2

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-14 Thread David Woodhouse
On 14 March 2024 11:13:37 CET, Peter Hilber wrote: >> To a certain extent, as long as the virtio-rtc device is designed to expose >> time precisely and unambiguously, it's less important if the Linux kernel >> *today* can use that. Although of course we should strive for that. Let's >> be...we

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-13 Thread David Woodhouse
On 13 March 2024 17:50:48 GMT, Peter Hilber wrote: >On 13.03.24 13:45, David Woodhouse wrote: >> Surely the whole point of this effort is to provide guests with precise >> and *unambiguous* knowledge of what the time is? > >I would say, a fundamental point of this eff

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-13 Thread David Woodhouse
On Wed, 2024-03-13 at 13:58 +0100, Alexandre Belloni wrote: > The TSC or whatever CPU counter/clock that is used to keep the system > time is not an RTC, I don't get why it has to be exposed as such to the > guests. PTP is fine and precise, RTC is not. Ah, I see. But the point of the virtio_rtc is

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-13 Thread David Woodhouse
On Wed, 2024-03-13 at 10:45 +0100, Peter Hilber wrote: > On 12.03.24 18:15, David Woodhouse wrote: > > On Mon, 2024-03-11 at 19:24 +0100, Peter Hilber wrote: > > > On 08.03.24 13:33, David Woodhouse wrote: > > > > On Fri, 2024-03-08 at 11:32 +0100, Peter Hilber wrot

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-13 Thread David Woodhouse
On Wed, 2024-03-13 at 12:18 +0100, Alexandre Belloni wrote: > > I still don't know anything about virtio but under Linux, an RTC is > always UTC (or localtime when dual booting but let's not care) and never > accounts for leap seconds. Having an RTC and RTC driver behaving > differently would be s

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-12 Thread David Woodhouse
On Mon, 2024-03-11 at 19:24 +0100, Peter Hilber wrote: > On 08.03.24 13:33, David Woodhouse wrote: > > On Fri, 2024-03-08 at 11:32 +0100, Peter Hilber wrote: > > > On 07.03.24 15:02, David Woodhouse wrote: > > > > Hm, should we allow UTC? If you tell me the time in U

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-08 Thread David Woodhouse
On Fri, 2024-03-08 at 11:32 +0100, Peter Hilber wrote: > On 07.03.24 15:02, David Woodhouse wrote: > > On Mon, 2023-12-18 at 08:38 +0100, Peter Hilber wrote: > > > RFC v3 updates > > > -- > > > > > > This series implements a driver for a v

Re: [RFC PATCH v3 0/7] Add virtio_rtc module and related changes

2024-03-07 Thread David Woodhouse
On Mon, 2023-12-18 at 08:38 +0100, Peter Hilber wrote: > RFC v3 updates > -- > > This series implements a driver for a virtio-rtc device conforming to spec > RFC v3 [1]. It now includes an RTC class driver with alarm, in addition to > the PTP clock driver already present before. > > T

Re: [PATCH 5/5] modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules

2023-10-17 Thread David Woodhouse
On Tue, 2023-08-01 at 19:35 +0200, Christoph Hellwig wrote: > It has recently come to my attention that nvidia is circumventing the > protection added in 262e6ae7081d ("modules: inherit > TAINT_PROPRIETARY_MODULE") by importing exports from their proprietary > modules into an allegedly GPL licensed

Re: [EXTERNAL] [PATCH 2/2] KVM: x86: disable interrupts while pvclock_gtod_sync_lock is taken

2021-04-01 Thread David Woodhouse
On Tue, 2021-03-30 at 12:59 -0400, Paolo Bonzini wrote: > @@ -2686,13 +2688,13 @@ static int kvm_guest_time_update(struct > kvm_vcpu *v) > * If the host uses TSC clock, then passthrough TSC as stable > * to the guest. > */ > - spin_lock(&ka->pvclock_gtod_sync_lock);

Re: [PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread David Woodhouse
On 17 March 2021 13:32:35 GMT, Joerg Roedel wrote: >On Wed, Mar 17, 2021 at 11:47:11AM +0000, David Woodhouse wrote: >> If you've already moved the Stoney Ridge check out of the way, >there's >> no real reason why you can't just set >init_state=IOM

Re: [PATCH 2/3] iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled

2021-03-17 Thread David Woodhouse
On Wed, 2021-03-17 at 10:10 +0100, Joerg Roedel wrote: > diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c > index 3280e6f5b720..61dae1800b7f 100644 > --- a/drivers/iommu/amd/init.c > +++ b/drivers/iommu/amd/init.c > @@ -2919,12 +2919,12 @@ static int __init state_next(void) >

[PATCH] iommu/amd: Don't initialise remapping irqdomain if IOMMU is disabled

2021-03-15 Thread David Woodhouse
From: David Woodhouse When the IOMMU is disabled, the driver still enumerates and initialises the hardware in order to turn it off. Because IRQ remapping setup is done early, the irqdomain is set up opportunistically. In commit b34f10c2dc59 ("iommu/amd: Stop irq_remapping_select() matching

Re: [EXTERNAL] [PATCH] KVM: x86: allow compiling out the Xen hypercall interface

2021-02-26 Thread David Woodhouse
On Fri, 2021-02-26 at 05:14 -0500, Paolo Bonzini wrote: > The Xen hypercall interface adds to the attack surface of the hypervisor > and will be used quite rarely. Allow compiling it out. > > Suggested-by: Christoph Hellwig > Cc: David Woodhouse > Signed-off-by: Paolo Bonz

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-02-16 Thread David Woodhouse
On Tue, 2021-02-16 at 15:10 +, David Woodhouse wrote: > Actually it breaks before that, in rcu_cpu_starting(). A spinlock > around that, an atomic_t to let the APs do their TSC sync one at a time > (both in the above tree now), and I have a 75% saving on CPU bringup > time for

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-02-16 Thread David Woodhouse
On Tue, 2021-02-16 at 13:53 +, David Woodhouse wrote: > I threw it into my tree at > https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/parallel > > It seems to work fairly nicely. The parallel SIPI seems to win be about > a third of the bringup time on my 28

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-02-16 Thread David Woodhouse
On Fri, 2021-02-12 at 18:30 +0100, Thomas Gleixner wrote: > On Fri, Feb 12 2021 at 01:29, Thomas Gleixner wrote: > > On Thu, Feb 11 2021 at 22:58, David Woodhouse wrote: > > I have no problem with making that jump based. It does not matter at > > all. But you can't use

Re: [EXTERNAL] [PATCH 4/5] KVM: sefltests: Don't bother mapping GVA for Xen shinfo test

2021-02-10 Thread David Woodhouse
On Wed, 2021-02-10 at 10:26 -0800, Sean Christopherson wrote: > Don't bother mapping the Xen shinfo pages into the guest, they don't need > to be accessed using the GVAs and passing a define with "GPA" in the name > to addr_gva2hpa() is confusing. > > Cc: Dav

Re: [EXTERNAL] [PATCH 2/5] KVM: selftests: Fix size of memslots created by Xen tests

2021-02-10 Thread David Woodhouse
> add test case") > Cc: David Woodhouse > Signed-off-by: Sean Christopherson Reviewed-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature

Re: [EXTERNAL] [PATCH 1/5] KVM: selftests: Ignore recently added Xen tests' build output

2021-02-10 Thread David Woodhouse
On Wed, 2021-02-10 at 10:26 -0800, Sean Christopherson wrote: > Add the new Xen test binaries to KVM selftest's .gitnore. > > Signed-off-by: Sean Christopherson > --- Reviewed-by: David Woodhouse smime.p7s Description: S/MIME cryptographic signature

Re: [PATCH] sign-file: add openssl engine support

2021-02-10 Thread David Woodhouse
On 10 February 2021 07:45:54 GMT, Yang Song wrote: >Use a customized signature service supported by openssl engine >to sign the kernel module. >Add command line parameters that support engine for sign-file >to use the customized openssl engine service to sign kernel modules. > >Signed-off-by: Y

Re: [EXTERNAL] linux-next: Signed-off-by missing for commit in the kvm tree

2021-02-05 Thread David Woodhouse
On Fri, 2021-02-05 at 14:36 +, Joao Martins wrote: > On 2/4/21 8:18 PM, Stephen Rothwell wrote: > > Hi all, > > > > Commit > > > > 79033bebf6fa ("KVM: x86/xen: Fix coexistence of Xen and Hyper-V > > hypercalls") > > > > is missing a Signed-off-by from its author. > > > > Except that Davi

Re: [PATCH v3 00/17] Introducing Linux root partition support for Microsoft Hypervisor

2021-02-02 Thread David Woodhouse
On Tue, 2020-12-15 at 16:42 +, Wei Liu wrote: > On Tue, Dec 15, 2020 at 04:25:03PM +0100, Enrico Weigelt, metux IT consult > wrote: > > On 03.12.20 00:22, Wei Liu wrote: > > > > Hi, > > > > > I don't follow. Do you mean reusing /dev/kvm but with a different set of > > > APIs underneath? I do

[PATCH 6/6] pre states for x86

2021-02-01 Thread David Woodhouse
Utterly broken because the bringup uses global initial_stack and initial_gs variables, and the TSC sync is similarly hosed (I should probably do one at a time). The bringup is going to be the most fun to fix, because the AP coming up doesn't actually have a lot that it *can* use to disambiguate it

[PATCH 4/6] x86/smpboot: Split up native_cpu_up into separate phases

2021-02-01 Thread David Woodhouse
but merely splits those phases out into separate functions so that future commits and make them happen in parallel for all APs. Signed-off-by: David Woodhouse --- arch/x86/kernel/smpboot.c | 136 +++--- 1 file changed, 82 insertions(+), 54 deletions(-) diff --git

[PATCH 2/6] cpu/hotplug: Add dynamic states before CPUHP_BRINGUP_CPU for parallel bringup

2021-02-01 Thread David Woodhouse
If the platform registers these states, bring all CPUs to each registered state in parallel, before the final bringup to CPUHP_BRINGUP_CPU. Signed-off-by: David Woodhouse --- include/linux/cpuhotplug.h | 2 ++ kernel/cpu.c | 27 +-- 2 files changed, 27

[PATCH 5/6] cpu/hotplug: Move idle_thread_get() to

2021-02-01 Thread David Woodhouse
ndard API. Signed-off-by: David Woodhouse --- include/linux/smpboot.h | 7 +++ kernel/smpboot.h| 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h index 9d1bc65d226c..3862addcaa34 100644 --- a/include/linux/smpboot.h

[PATCH 3/6] x86/smpboot: Reference count on smpboot_setup_warm_reset_vector()

2021-02-01 Thread David Woodhouse
If we want to do parallel CPU bringup, we're going to need to set this up and leave it until all CPUs are done. Might as well use the RTC spinlock to protect the refcount, as we need to take it anyway. Signed-off-by: David Woodhouse --- arch/x86/kernel/smpboot.c | 23 +++--

[PATCH 1/6] x86/apic/x2apic: Fix parallel handling of cluster_mask

2021-02-01 Thread David Woodhouse
;x86/apic/x2apic: Simplify cluster management") Signed-off-by: David Woodhouse --- arch/x86/kernel/apic/x2apic_cluster.c | 82 --- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-02-01 Thread David Woodhouse
can do that just as a "cleanup" with no functional change. So I'm relatively happy at least that far, as preparatory work... David Woodhouse (6): x86/apic/x2apic: Fix parallel handling of cluster_mask cpu/hotplug: Add dynamic states before CPUHP_BRINGUP_CPU for paralle

[PATCH] x86/apic/x2apic: Fix parallel handling of cluster_mask

2021-01-21 Thread David Woodhouse
From: David Woodhouse For each CPU being brought up, the alloc_clustermask() function allocates a new struct cluster_mask just in case it's needed. Then the target CPU actually runs, and in init_x2apic_ldr() it either uses a cluster_mask from a previous CPU in the same cluster, or consume

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-01-21 Thread David Woodhouse
On Thu, 2021-01-21 at 15:42 +, David Woodhouse wrote: > [2.289283] BUG: kernel NULL pointer dereference, address: > [2.289283] #PF: supervisor write access in kernel mode > [2.289283] #PF: error_code(0x0002) - not-present page > [2.289283]

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-01-21 Thread David Woodhouse
On Thu, 2021-01-21 at 15:55 +0100, Thomas Gleixner wrote: > > Testing on real hardware has been more interesting and less useful so > > far. We started with the CPUHP_BRINGUP_KICK_CPU state being > > *immediately* before CPUHP_BRINGUP_CPU. On my 28-thread Haswell box, > > that didn't come up at all

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-01-19 Thread David Woodhouse
On Tue, 2020-12-15 at 22:20 +0100, Thomas Gleixner wrote: > Since the rewrite of the CPU hotplug infrastructure to a state machine > it's pretty obvious that the bringup of APs can changed from the fully > serialized: > > for_each_present_cpu(cpu) { > if (!cpu_online(cpu)) >

Re: [PATCH] use x86 cpu park to speedup smp_init in kexec situation

2021-01-07 Thread David Woodhouse
On Wed, 2020-12-16 at 16:31 +0100, Thomas Gleixner wrote: > But obviously the C-state in which the APs are waiting is not really > relevant, as you demonstrated that the cost is due to INIT/SIPI even > with spinwait, which is what I suspected. > > OTOH, the advantage of INIT/SIPI is that the AP co

Re: 5.11-rc1 TTM list corruption

2021-01-06 Thread David Woodhouse
On Tue, 2021-01-05 at 16:40 +0100, Christian König wrote: > Am 05.01.21 um 13:20 schrieb Huang Rui: > > On Tue, Jan 05, 2021 at 07:43:51PM +0800, Borislav Petkov wrote: > > > On Tue, Jan 05, 2021 at 07:08:52PM +0800, Huang Rui wrote: > > > > Ah, this asic is a bit old and still use radeon driver. S

Re: [PATCH RFC 10/39] KVM: x86/xen: support upcall vector

2021-01-05 Thread David Woodhouse
On Tue, 2021-01-05 at 12:11 +, Joao Martins wrote: > On 1/1/21 2:33 PM, David Woodhouse wrote: > > What it does actually mean in the short term is that as I update your > > KVM_IRQ_ROUTING_XEN_EVTCHN support, I probably *won't* bother to add a > >

[PATCH] iommu/amd: Stop irq_remapping_select() matching when remapping is disabled

2021-01-04 Thread David Woodhouse
From: David Woodhouse The AMD IOMMU initialisation registers the IRQ remapping domain for each IOMMU before doing the final sanity check that every I/OAPIC is covered. This means that the AMD irq_remapping_select() function gets invoked even when IRQ remapping has been disabled, eventually

[PATCH] iommu/amd: Set iommu->int_enabled consistently when interrupts are set up

2021-01-04 Thread David Woodhouse
From: David Woodhouse When I made the INTCAPXT support stop gratuitously pretending to be MSI, I missed the fact that iommu_setup_msi() also sets the ->int_enabled flag. I missed this in the iommu_setup_intcapxt() code path, which means that a resume from suspend will try to allocate the

Re: [EXTERNAL] PROBLEM: commit f36a74b9345a leads to not booting system with AMD 2990WX

2021-01-04 Thread David Woodhouse
On Tue, 2021-01-05 at 00:05 +0100, Johnathan Smithinovic wrote: > commit f36a74b9345a leads to not booting system with AMD 2990WX > > > When trying to boot 5.11-rc2 as usual the messages of the bootloader stay on > my > screen and not much appears to happen (fans run a bit slower than in GRUB, >

  1   2   3   4   5   6   7   8   9   10   >