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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Tue, 8 Jul 2025 10:40:38 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com 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=dNqYgtXWp14219vyBDb7vk+riCM5keptKtC84Kx68zw=; b=bfK0GQB7T/z+UdvaIjaUC1Ebe/zOwey0q9jvhXwqm5gMKMzxevCjP42iXSDM27SQ80H0huXSDLTHKhLoz6zSGXojW1uRc1l9j3S4vhITs8he4rSxp3xjcNpj+664t87YpCWdfqS8asejNXbOpglcOe1O+HgR4xIJnPcEZOZSWFR8iFKSGwDvnduJBosEy0SbU5qe4M6ccHc3w6GSFzoIds1XVv5PFWuRqgNEsWUyA94n90ACaw07m8170+azHhQmYOpaxQRR9Sil6Vh6vf04vBBjiasqKNsW4SaU2s0FCcgeNRMKYJQyMrBcGbxXYvoGTA8krmX0nJd8b+/ndJHYJw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QEczkEEzjH3y2Ftw+443VNHlL2mE9k9AombOVUCGq/NvwA+aB6sBStH/K2VM5XhCX1FbCOpIiwRnrqmsESWhyh6f6EwCHQJkxxC/P6cNChKFatPTDKVQdWqroMIVeJ6f7Ngmppl0ehOyzahjXjPAHbBBuHhBe9jPYsDcZwzSEwt8L/zpERwaZF0cn7EWyXhKInl438747S79V+hO5DoqXpqaQ2/EJiAElcJK/rL70HONL5B6pprCdRH4w02rmlHxZzE5l00mKa3VJVEUt+wkzQeewuY/x9871V7trkMP4Cb5Nxl3jlRjqCE12MBJmSizbU8zimiqiRSYXQZjJ0lncg==
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <roger.pau@xxxxxxxxxx>, <Xenia.Ragiadakou@xxxxxxx>, <alejandro.garciavallejo@xxxxxxx>, <Jason.Andryuk@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 08 Jul 2025 17:40:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, 8 Jul 2025, Jan Beulich wrote:
> On 08.07.2025 02:07, 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. Remove the unnecessary
> > IPI on all physical CPUs to sync the TSC when the TSC is known to be
> > reliable.
> 
> If it had been truly unnecessary for all the time, I'm sure someone would
> have suggested to get rid of the overhead.

I am not so sure someone else would have suggested it given that Xen on
x86 has been mostly used on the datacenter where real-time is not a
requirement. 


> IOW I think there is more to be
> said as to this being correct / safe, including in any corner cases.
> 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> > ---
> >  xen/arch/x86/time.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
> > index 59129f419d..bfd022174a 100644
> > --- a/xen/arch/x86/time.c
> > +++ b/xen/arch/x86/time.c
> > @@ -2303,6 +2303,10 @@ static void cf_check time_calibration(void *unused)
> >          local_irq_enable();
> >      }
> >  
> > +    if ( boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
> > +         boot_cpu_has(X86_FEATURE_TSC_RELIABLE) )
> > +        return;
> 
> This would render the (first of the two) invocation(s) of the function from
> verify_tsc_reliability() (largely) dead; it would then be only r.master_stime
> which gets updated (see also Alejandro's reply), which surely wouldn't have
> required that call in the first place.

I'll follow Alejandro's suggestions



 


Rackspace

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