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

[RFC PATCH 09/10] arm: traps: try to preempt before leaving IRQ handler


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 23 Feb 2021 02:34:58 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=77HrcIok9Ev7108K/qUYq6X0RM0POs+crZXjM8Ysf2c=; b=JXX58xLnl8fV4rPTTgIAgoZIAfRLCD6wBHiETxq5Ox6dRdwRpFg2xSEGSTKE01Ot9kjtMlCxBqiI0sy8r54/RCLEIO5rr+iYfbU0gRJwVdU+rKAQ8OZwrknDOXRmR8WKv3VyOntez6MQiGdGzZC+mTKYnyFQngeEl5nJHLf3lNc3zMXa+cyjDeR1EgalQvKLfk9cqsIQak4ZV2sIRLgvjn9rPna1J9dXyza2n3b0v3ElMoJkv74O+7+0nbsl/qxioORoR3UknCVUsftCjwv4sjYvZvPJdKb/tXSECe/9thod3op/Xhkh1uxZP0AkCVvLVasqHu4AN3qiNmbq2BEG2w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Box0ZW6cJts97vL+MA7FHGhTExkrOv+H0xYvOoLWoSAex+3v4NDWEvoaOGDmzmYtNlOmg/NUnpdBiDqKPBYeOUWcpQ/I0c0VlqMmtg3jg2MPTaIYi/26drW6h3/7UEcP+Vyvapdji3kNNbUty4rrcVgsm36UZ8gKvy4Lx2ZFLyj/gr7+4TAANZ5szhH6DKG1e3ciDXUN6zmh8paJrWBFSjM26CChOarY2WeE4ehbr21Uh0RJMjf8dIbjDGq6kOtc3+Iv288cRGxAyGsVprLYDGqk4sTTJ8O70yKAnXrNdXiHjEJIZbJCK0c1o0QRW/Zgo9LcZDA97nUn6rCtHcpH5w==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=epam.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 23 Feb 2021 02:35:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXCYx6aQhBTjfpeUOOmxfCufx61A==
  • Thread-topic: [RFC PATCH 09/10] arm: traps: try to preempt before leaving IRQ handler

Now we can try to preempt code that is running in hypervisor code. To
do so we need to try to invoke scheduler by calling try_preempt(),
while not in nested IRQ handler.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
 xen/arch/arm/traps.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 6fa135050b..98a4fb4904 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2260,7 +2260,14 @@ void do_trap_guest_serror(struct cpu_user_regs *regs)
 
 void do_trap_irq(struct cpu_user_regs *regs)
 {
+    static DEFINE_PER_CPU(unsigned int, irq_entry_cnt);
+
+    this_cpu(irq_entry_cnt)++;
     gic_interrupt(regs, 0);
+    this_cpu(irq_entry_cnt)--;
+
+    if (this_cpu(irq_entry_cnt) == 0)
+        try_preempt(true);
 }
 
 void do_trap_fiq(struct cpu_user_regs *regs)
-- 
2.29.2



 


Rackspace

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