Re: [RFC PATCH v3] ptp: Add vDSO-style vmclock support
Simon Horman <[email protected]> Mon, 8 Jul 2024 10:17:08 +0100
| Newsgroups | dev.linux.lists.virtio-dev,dev.linux.lists.virtualization,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-rtc,org.kernel.vger.netdev,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jul 06, 2024 at 04:14:39PM +0100, David Woodhouse wrote: > From: David Woodhouse <[email protected]> > > 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, it does so only when such is > actually helpful. > > The memory region of the device is also exposed to userspace so it can be > read or memory mapped by application which need reliable notification of > clock disruptions. > > The shared memory structure is intended to be adopted into the nascent > virtio-rtc specification (since one might consider a virtio-rtc > specification that doesn't fix the live migration problem to be not fit > for purpose). It can also be presented via a simple ACPI device. > > Signed-off-by: David Woodhouse <[email protected]> ... > diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c ... > + /* If there is valid clock information, register a PTP clock */ > + if (st->cs_id) { > + st->ptp_clock_info = ptp_vmclock_info; > + strncpy(st->ptp_clock_info.name, st->name, sizeof(st->ptp_clock_info.name)); 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. ...