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

Re: [PATCH v8 02/13] xen/arm: gic-v2: Implement GIC suspend/resume functions


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 11 May 2026 06:40:37 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=gmail.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=46TNZ7N5CLRKXK/jnAyrxUQ6YHSrZE5xfoFM9EUcVCk=; b=yvkPanJ7U8nKVYfaK3UDo560uqbsZ3D2/9GKiQCzafHxOsWIS2UE7zosROqUyLLmUGw2eNSn3PKHz7zWjYVsagIrNKa8sx9UkLIMcy9VNL5ca2hQhL/UYmIktVn+ikBTgBQ6P6smF8Z2bFZ1Rk8BCZXHXMzsJjARubJHAcAXD2BmqMWTXTUykwEIFfZ3Kr2sOSpB6BU2FgNACLKZhCIfxo7Mx7EpxKu2ReYwCXUMqjXZZiCMnXVS0BcgMhfKjO3FHjhh9sLaZtU11jzVYookpXiU5qYsx4RRlDEEJA7aRTy06afMIu/WcQ4QorRHftxmFK52PTC6UqrGeoV9QELMRw==
  • 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=46TNZ7N5CLRKXK/jnAyrxUQ6YHSrZE5xfoFM9EUcVCk=; b=QTtzC9adly+anNVY08ckIot0mgU/lyx258cCj5s9WJP5hLU/9bxXsjOEB+8093JTwncdlWQY+x5HWUZvTZU5eVMCZp1HFTqKgTWbB9RxFqZiiWdAzpFdijyFl/GFjtMC5EWn9hfdwvj4/FJFXx4tEOpMKXSgNMKSnOOTWd95KVAbf5Q5E0CS4BUF/rpVVQ8kaPsWZjo7aVDAVPMLGZf3yYyn8cwEjXGxvoP7hcVHfk6ulkv9MwinHlEw4nf7UvqAZ4OUtjM6i20IBv5AKiyheQH1Bkp2zbkha5nG0ksBEUSaF4AxAoH0eQlqatWUtwxKUNhAIiiV/1LZGXHgaCeMJQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=UxffaIdkxn80s02BuJHF3zKIDjs9L7CN8J2R0vwgT/aGZZ7CRO5kZa0LpWeV+9ggrWac/sQ2QKty8kHOUk+aMjYVpjw74yGdY+f48INlaOejjbTF7JDTAvbDWQLmkY7Rcbpz0a902eNA/64FSZSmv7dDRRMx5fpdDWfa2l1oTrJ5sRl/e1UhF+4Y1AACUfWCVnx6VojYlV+BexnSDg8VRJ7Vmhpszb6x804mxrDlr8JFn9obRIfB6gnG8o2Ya4CayXaGYZCdmGlGVKh+Tg9Ltz5nsWPLYRnIPMi7k8KA7iFnhduTj7pOsPqHBVz6j0kVjQ8LzIL5gyu+oeB33SuAEw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yY8IBotlf5pIgwTc+ZeTJxtIeZunLYsdPl4GHjVPtX0zQBCcGN8mduIFT3aMuhK/h89TlyyAjBxz8U8d91cNKsG2l1nSEoNFO5Kt+sqHE0E3MB0uTvvbEN6xXU8eciHU9aRS6kxH20FXi3Vz7lzSZyt0ii+1/WMQIpJrLvvg78plzPII4T+NoPFhOOWn/JzUPiU1k9SX2nS4Hztp7fshnKbUwZZ8ZszGK/Z7kumHkeaOjl3gcH8HUyTlUARwPFfvlamloV4fRwL5d9oDUg0aeds2LrVvT3Hlgkn5A2ELDkyzvcpPp5kww0RPVoYQlLl+l5b/q9ymtTxl2wlTdusfzA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 11 May 2026 06:42:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHc0ZIp4iA20ItBV0OKtUp08vt6QrYCSMAAgAHGpwCAAtKuAIABnMgA
  • Thread-topic: [PATCH v8 02/13] xen/arm: gic-v2: Implement GIC suspend/resume functions

Hi Mykola,

> 
>> 
>>> 
>>> For GICC_APRn/GICC_NSAPRn, those registers describe active priority state 
>>> for
>>> interrupts already acknowledged by the CPU interface. The final suspend 
>>> path is
>>> not expected to run with an active physical interrupt context. If those
>>> registers were non-zero there, restoring only APR/NSAPR would not make the
>>> corresponding interrupt handling context valid after resume, and could 
>>> instead
>>> leave the CPU interface with stale active priority state.
>> 
>> Ok I understand now, but if we are expecting here GICD_ISACTIVERn zeroed, 
>> why are
>> we saving/restoring it? Shouldn’t we instead have a runtime check that it’s 
>> zero and in case
>> it’s not bail out? And in the resume path we would only zero it.
>> 
>> Am I missing something?
> 
> Good questions.
> 
> Yes, the distinction I should have made clearer is between CPU-interface
> active-priority state and distributor active state.
> 
> For GICC_APRn/GICC_NSAPRn, I expect the state to be quiesced at this point.
> Those registers track active priorities in the CPU interface. Xen reaches
> gic_suspend() with local interrupts disabled, and for the guest-routed
> interrupt case that can leave a distributor active bit behind, Xen has
> already performed the physical EOI, so the CPU-interface priority has been
> dropped.
> There is no CPU-interface active-priority context that we can meaningfully
> replay after resume.
> 
> That is different from GICD_ISACTIVERn. In EOImode==1, EOIR only drops the
> priority. The interrupt remains active in the distributor until the separate
> deactivation step. For a guest-routed interrupt Xen's GICv2 guest end path 
> does
> only the physical EOI; deactivation is completed later by the virtual GIC/GICV
> path when the guest completes the interrupt.
> 
> This is why APR/NSAPR and ISACTIVERn are treated differently. For example:
> 
>  1. A physical IRQ routed to a guest is acknowledged by Xen.
>  2. The GIC marks the interrupt active in the distributor.
>  3. Xen EOIs it, which drops the physical priority.
>  4. Xen queues/injects the interrupt to the vGIC.
>  5. The guest has not yet run, or the virtual interrupt is not yet deliverable
>     because of guest PMR/priority/local IRQ masking/vGIC state.
>  6. Therefore the guest-side deactivate has not happened yet, and the physical
>     distributor active bit remains set.
> 
> There is also a late suspend window in the current Xen path: domains are
> suspended and the scheduler is disabled before local IRQs are disabled.
> A guest-routed IRQ can therefore be taken by Xen after the guest is already
> suspended, but before gic_suspend(). Xen can EOI/priority-drop it and queue
> it for the guest, while the guest cannot run and deactivate it before the
> GIC state is saved.
> 
> This is the same class of issue handled by Linux for GIC EOImode==1. Linux
> saves/restores the active state because forwarded interrupts can remain active
> while passed to a VM [1].
> 
> So I don't think GICD_ISACTIVERn should be treated as "must be zero" unless we
> also add an explicit suspend-abort/quiesce policy for in-flight guest
> interrupts. That would be a different design: detect non-zero active/in-flight
> state, unwind suspend, thaw domains, let the guest drain/deactivate the
> interrupts, and retry later. This series does not implement that policy. Given
> the current flow, preserving GICD_ISACTIVERn avoids losing architectural
> interrupt-controller state across suspend/resume.
> 
> I am not opposed to such a policy as a follow-up if we want stricter suspend
> quiescence rules, but I think it should be designed explicitly rather than
> inferred from the GIC save/restore code.
> 
> Best regards,
> Mykola
> 
> [1] 
> https://patchwork.kernel.org/project/linux-arm-kernel/patch/1447701208-18150-5-git-send-email-marc.zyngier@xxxxxxx/

Right, yes I agree! I have another question though, since GICC_APRn state 
should be
quiesced in the suspend path (allimplemented active-priority bits should read 
as zero),
should we have a runtime check just after disabling the CPU interface?

Cheers,
Luca


 


Rackspace

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