RE: [RFC PATCH v9 7/8] ptp: arm64: Enable ptp_kvm for arm64

From
Jianyong Wu <hidden>
Date
2020-01-13 10:38:07
Also in
kvm, kvmarm, lkml, netdev
Reply to
Marc Zyngier, 2020-01-10
Hi Marc,
-----Original Message-----
From: Marc Zyngier <maz@kernel.org>
Sent: Friday, January 10, 2020 6:35 PM
To: Jianyong Wu <redacted>
Cc: <redacted>; yangbo.lu@nxp.com; <redacted>;
tglx@linutronix.de; pbonzini@redhat.com; sean.j.christopherson@intel.com;
richardcochran@gmail.com; Mark Rutland [off-list ref];
will@kernel.org; Suzuki Poulose [off-list ref]; Steven Price
[off-list ref]; linux-kernel@vger.kernel.org; linux-arm-
kernel@lists.infradead.org; kvmarm@lists.cs.columbia.edu;
kvm@vger.kernel.org; Steve Capper [off-list ref]; Kaly Xin
[off-list ref]; Justin He [off-list ref]; nd [off-list ref]
Subject: Re: [RFC PATCH v9 7/8] ptp: arm64: Enable ptp_kvm for arm64

Hi Jianyong,

On 2020-01-10 10:15, Jianyong Wu wrote:
quoted
Hi Marc,
[...]
quoted
quoted
quoted
quoted
quoted
+	ktime_overall = hvc_res.a0 << 32 | hvc_res.a1;
+	*ts = ktime_to_timespec64(ktime_overall);
+	*cycle = hvc_res.a2 << 32 | hvc_res.a3;
So why isn't that just a read of the virtual counter, given that
what you do in the hypervisor seems to be "cntpct - cntvoff"?

What am I missing here?
We need get clock time and counter cycle at the same time, so we
can't just read virtual counter at guest and must get it from host.
See my comment in my reply to patch #6: *Must* seems like a very
strong word, and you don't explain *why* that's better than just
computing the total hypercall cost. Hint: given the frequency of the
counter (in the few MHz
range) vs the frequency of a CPU (in the multiple GHz range, and with
an IPC close enough to 1), I doubt that you'll see the counter making
much progress across a hypercall.
Sorry, I will avoid to use those strong words.

It's really the case that the hypercall won't across cycle in general.
But sometimes, kernel preempt
may happen in the middle of the hypercall which we can't assume how
long before schedule back. so it's better capture them together at the
same time.
Fair enough. Please document the rational, as I guess others will ask the
same questions.
Ok
Then the problem to solve is that of the reference counter, as you so far
assume the virtual counter. I guess you need to be able to let the guest
select the reference counter when calling the PTP service.
I could not come up with an idea about the point where the guest give this info of counter value.
Where we give that interface to ptp service, as it's not a user space application.
[...]
quoted
By the way, does nested virtualization diff between arm64 and arm32?
There is no nested virt for 32bit (it is explicitly forbidden by the architecture).
 
Ok, thanks

Thanks
Jianyong 
         M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (30 messages) 30 messages, 3 authors, last reply 2020-01-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help