[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] xen/x86: don't send IPI to sync TSC when it is reliable


  • To: Stefano Stabellini <stefano.stabellini@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Wed, 9 Jul 2025 11:44:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BLdhdSRqr4ds7QWEI04Rz6nogbT2BOCixOAhIDszOg8=; b=vKG0RMztl0cYXlv3LTcXV4MEsuMuuayAHEh1PRawp/93zaGld6Z4Jrmh54xOMvrUyfOIaXZ+hhXdMpOlYQ8i2xzYYQknVrYjMWpqq5ilK6gon7rfzk4vPK3cd/lBOT3+3LvBM6uEbYDZhygOGwQfCxvpR6dzKobI72z+z4gQpcOWdPLcjXuQKIsTVt0vwpclXRx4AHQHgISck/NE/N5kQrBnxFOiAowjIt1yQEJEPnpUSpYuPOVCPVmRyUJw1ExnTLxdJpepUpXhR4nLNxMQi2RfdXnez3AFAqa6uYrr1u6+uc7OSULQNr2R9oSqlqEElQp5Zee6+17oAnUjsypDMQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DryhbWmWnCqgBdUP2mCBX4yzIIEe0GeQGi0+bV8k4THoVq7svh7B/2jrqrFm4G7qdfsQtoteVK2PuoxU8ppSozQGpubt6DrsAwjYQB14KRsba6pkrS3SCOdEslrRK7jxsF39TdGsMw+QhnafVCZ9dscSOZzjO28fbVkNHny5TNPWOYQGr71oTXqGN3ojaXS/8rkanu4qCjDwgUhI0EaZ53uEGDfaejoB1woXJQe1u/re0Oxn+sL14IPxxaGBEXH30g27nbgazaDMJGcVXE1tLMmBi65y3A/N9QNot9XUcBjuO9O4XN1CJrtYRgqtxW8Hy6enZ+lfo4HooUILwSwt4A==
  • Cc: <jbeulich@xxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <roger.pau@xxxxxxxxxx>, <Xenia.Ragiadakou@xxxxxxx>, <Jason.Andryuk@xxxxxxx>
  • Delivery-date: Wed, 09 Jul 2025 09:44:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue Jul 8, 2025 at 8:32 PM CEST, Stefano Stabellini wrote:
> On real time configuration with the null scheduler, we shouldn't
> interrupt the guest execution unless strictly necessary: the guest could
> be a real time guest (e.g. FreeRTOS) and interrupting its execution
> could lead to a missed deadline. The principal source of interruptions
> is IPIs.
>
> When TSC is the chosen clocksource, we know it is reliable and
> synchronized across cpus and clusters. Thus, we can return early
> time_calibration because the calibration is not needed, removing the
> related Xen timer and IPIs.
>
> Also remove the master_stime write as it is unnecessary.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> ---
> Changes in v2:
> - simplify the patch simply by returning early if clocksource_is_tsc()
> - also remove setting r.master_stime as it is not needed
> ---
>  xen/arch/x86/time.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
> index 59129f419d..d72e640f72 100644
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -2297,11 +2297,7 @@ static void cf_check time_calibration(void *unused)
>      };
>  
>      if ( clocksource_is_tsc() )
> -    {
> -        local_irq_disable();
> -        r.master_stime = read_platform_stime(&r.master_tsc_stamp);
> -        local_irq_enable();
> -    }
> +        return;
>  
>      cpumask_copy(&r.cpu_calibration_map, &cpu_online_map);
>  

As far as I can tell, this shouldn't cause problems. But I'd prefer if someone
knowledgeable in the calibration code (Jan?) pitches in as to the effects of
master_stime in the absence of calibration. Otherwise:

  Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>

Cheers,
Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.