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

Re: [PATCH 0/2] Xen real-time x86


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Thu, 10 Jul 2025 14:39:36 -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=bLUp/NiC6tbn6ZfxPF2GrFXvfsTMN2Bul4B986RlZ/E=; b=PoxEDv2B+0hXVfViKzmeQcUoKXMV6BFIF5koRtGVqQvs+sE8Y/Ht/oNjQL1w8VedNjFjgw0hoOq3X1JLwEYd6Qhau/m5n9gkCVCYvd1BLP7BfGU9CjvGEAHYivczSTXhC3glj7Vu1Pyu3DTRKmIMnSSHlW4Aoc4kO7x8rOs7KiImQV1rzk4XcBuI232OvtRkcrvb6WiKHVGxgynaIJWr7j5cFXaU/6PRILM26saMBAthlSe0Y73M231crakPONhATcF36S1YMSh84Juun5etSJram74dMToV0EeVcSfxziWVIUI2xEnl0VoliWWsnAQwJKF6RAzDqr+KNFPa1mcSJQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N+mCwkpJQX/EU6zvHA9HwRDagDN4e4lnGfhmQpPg87dKD0gqqaHON5CY1+E87yAwrAD9jSCxZIXcnVg2XmSa3My30KfSkL2k3tTh3F1ws54ijLiwt3w9niUuLaZz9+2Gw2KikRFit+uBPVV+qSVgB/+LpVsQf/rNOtUkLIhvhtWwW66X0rQ7nPLep2mclTvyS3h8zFxZFK4J3uHyDyFXHIQmKu8lz2PuzteWcoy233wh4tjyNJQ/0CPXcHZNxfpw+/QQ3COSvJEbfh4Gh7DTmRRjNZd33+ZxRE14rVr6fR7/MZ7mKNG+Hhw02CPve/BzRNY8lvIUHi1Lxeq9O3M0bg==
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <stefano.stabellini@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, <Xenia.Ragiadakou@xxxxxxx>, <alejandro.garciavallejo@xxxxxxx>, <Jason.Andryuk@xxxxxxx>
  • Delivery-date: Thu, 10 Jul 2025 21:40:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, 10 Jul 2025, Jan Beulich wrote:
> On 10.07.2025 09:02, Roger Pau Monné wrote:
> > On Wed, Jul 09, 2025 at 05:44:33PM -0700, Stefano Stabellini wrote:
> >> 2) means that the RTOS must be undisturbed when executing the critical
> >> section, which is typically right after receiving the interrupt and only
> >> last for less than 1ms. In practice, it means the RTOS should absolutely
> >> not be descheduled and there should be no (unnecessary) traps into Xen
> >> while the RTOS is executing the critical section. It is expected that
> >> the RTOS will run the critical section with interrupts disabled.
> > 
> > What about other external interrupts?  While the guest runs the
> > critical interrupt handling section with interrupts disabled, an
> > external interrupt from a device targeting the pCPU could cause a
> > vmexit.
>
> For interrupts to be handled by the guest, we may need to finally gain AVIC
> support (albeit I'm not sure how close that is to VMX-es posted interrupts).
> For interrupts handled in Xen the only way would be to allow the guest to
> announce such critical sections to Xen. Which, besides being a security
> concern, may of course itself represent unacceptable overhead.

In the past, I wrote a patch for an ARM user basically to do what you
suggested: "announce such critical sections to Xen". It is easy for Xen
to know when the critical section start: upon receiving the critical
interrupt. I added an hypercall so that the RTOS could tell Xen when it
ends. This is the kind of dirty patch that is very effective but
difficult to generalize. As an example, you can pause all other VMs
during the critical section to make sure the RTOS has full bandwidth on
the bus. The critical section is much shorter than a scheduler slot
anyway. I did not try to upstream the patch.


> >  I'm not aware of a nice way to solve this however, as for
> > PVH/HVM Xen doesn't know when the guest has finished interrupt
> > processing (iret).  Maybe this is not an issue in practice if you
> > isolate interrupts to different vCPUs (you might have to do this
> > already to ensure deterministic latency).

Yeah, that should be solvable by moving around other interrupts to other
pCPUs.

 


Rackspace

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