[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 3/3] x86/time: avoid reading the platform timer in rendezvous functions
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Thu, 29 Apr 2021 14:53:06 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=peozl4LdcWYvy7JNYsFHyULLZmOhsGfUGU0UMSPMSkw=; b=ARnPb9GwAxGwPdhwZYqADjV7BeaJ9u8seompaADqlIXhEyOm6gi7Pf7UjJBph7ruBYujHup15DkTXQGBMXp/nRg3pkg29HwJrXxr8LpNeFhs91Q4YqLNgAT7b+stynUn+Ye06mmELkgIA1eeUGSch8WmX1c1qYhKxudQv7Dg4JUJwJWYntPvY04ssBSDxoO86adXZAb9mZxCwQ4XEINj0A0IodQoecWX5H7iLHQBGyg0GaQef7M1Say1PUsu4LG4v6mPAwG1XTGFT/MbTFKyozczuIJnPxTK2F4V/69U+3WlzMDfim6rO4N13q7HUM5Q1iHF7nPrezC1YDOgT3vm5A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mePG3VqNxalrbiMylxfRCOopY8Het/9YG4043ihjl57emb0JveYIxETg2b2FvOlXWZSztFu3Kr6lERpB3XLctI37awZqyEi6hKB7uGIeVjW0YroqmNEZoWTzuNnVHIS5yl2eUvc7NFoy9vT7GB/KaEQhJ+HQRZpaCaWalPMk4gv/AVPCmQEI2Ndq/QQsGBjl5dBzGw2WZNZwiS1S6bmkozOpa5Y+esDh/PjpPDCdqkfhhZwvLsllei5/B/s/DxYAPNx1P41htE99aYm2fSZ0yjiSx22X0Aec7Uc/dPr6blrtY7YaNx/J60srMeFtysA/+hNHIQ3yfsil+ci5i5gYLA==
- Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Thu, 29 Apr 2021 12:53:19 +0000
- Ironport-hdrordr: A9a23:JsJaHK+pF3pERobM/eZuk+EKdb1zdoIgy1knxilNYDRIb82VkN 2vlvwH1RnyzA0cQm0khMroAsS9aFnXnKQU3aA6O7C+UA76/Fa5NY0K1/qH/xTMOQ3bstRc26 BpbrRkBLTLZ2RSoM7m7GCDfOoI78KA9MmT69v261dIYUVUZ7p77wF/Yzzrd3FeYAVdH5I2GN 69y6N81lmdUE8aZMi6GXUJNtKrz7H2vanrfAIcAFof4BSO5AnC1JfBDxOa0h0COgk/o4sKzG 6tqW3Ez5Tmid6X4Fv212jf75NZ8eGRt+drNYi3peU+bhnpggasTox9V7OFpyBdmpDS1H8a1O Pijj1lE8Nv627AXmzdm2qT5yDQlAwAxlWn6ViEjWDtqcb0LQhKdfZptMZiXTbyr28D1esMt5 5j7iaimLd8SS7kpmDb4ePFUhl7/3DE2kYKoKoooFF0FbcFZKQ5l/14wGplVK0uMQjd844dHO xnHKjnlYxrWGLfVXzfs2V1qebcJ0gbL1ODSkgGjMSfzyJbqnB/11cZ38wShB47heoAd6U=
- Ironport-sdr: hQobtcBtJaxchpyBd1xNS7eLAQQqQiXvOB93XG14OCCHLw4bgKJzWjJFjpy+CahhoDlVhXGCkL TCiWmqnw35Dq8pfmzaYoLodPZyI8aRdwnhOWQmxJbe0rNQZv+Gqil55vFes1yNOhK5MPi+LyAK OhZjt//0wdzGkSyC5La/iA4C1sz7BMwKVicTav7oIM3bBkfgKD9Qix+wSJ1Q7eNjqZOZ7a8qAl ROFKQ7s5YctnYOdK5rIKaMFWdU7N9IuHxuQM6lE/oSwd54XUtnM0IGDg5RmLi04Dyz699DcUUM VwU=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, Apr 01, 2021 at 11:55:10AM +0200, Jan Beulich wrote:
> Reading the platform timer isn't cheap, so we'd better avoid it when the
> resulting value is of no interest to anyone.
>
> The consumer of master_stime, obtained by
> time_calibration_{std,tsc}_rendezvous() and propagated through
> this_cpu(cpu_calibration), is local_time_calibration(). With
> CONSTANT_TSC the latter function uses an early exit path, which doesn't
> explicitly use the field. While this_cpu(cpu_calibration) (including the
> master_stime field) gets propagated to this_cpu(cpu_time).stamp on that
> path, both structures' fields get consumed only by the !CONSTANT_TSC
> logic of the function.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Albeit as said on my other email I would prefer performance related
changes like this one to be accompanied with some proof that they
actually make a difference, or else we risk making the code more
complicated for no concrete benefit.
> ---
> v4: New.
> ---
> I realize there's some risk associated with potential new uses of the
> field down the road. What would people think about compiling time.c a
> 2nd time into a dummy object file, with a conditional enabled to force
> assuming CONSTANT_TSC, and with that conditional used to suppress
> presence of the field as well as all audited used of it (i.e. in
> particular that large part of local_time_calibration())? Unexpected new
> users of the field would then cause build time errors.
>
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -52,6 +52,7 @@ unsigned long pit0_ticks;
> struct cpu_time_stamp {
> u64 local_tsc;
> s_time_t local_stime;
> + /* Next field unconditionally valid only when !CONSTANT_TSC. */
Could you also mention this is only true for the cpu_time_stamp that's
used in cpu_calibration?
For ap_bringup_ref master_stime is valid regardless of CONSTANT_TSC.
Thanks, Roger.
|