xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org, Peng Fan <peng.fan@nxp.com>,
	Stefano Stabellini <stefano.stabellini@xilinx.com>,
	Wei Xu <xuwei5@hisilicon.com>
Subject: Re: [Xen-devel] [PATCH v2] xen/arm: implement GICD_I[S/C]ACTIVER reads
Date: Tue, 31 Mar 2020 01:05:42 +0100	[thread overview]
Message-ID: <e04bce54-d638-56e4-d4c9-e888c879ab85@xen.org> (raw)
In-Reply-To: <20200327023451.20271-1-sstabellini@kernel.org>

Hi,

On 27/03/2020 02:34, Stefano Stabellini wrote:
> It doesn't take into account the latest state of interrupts on
> other vCPUs.

So I think your implementation is going to introduce a deadlock in the 
guest. Let's imagine a guest with 2 vCPUs (A and B) with the following 
setup:
     * The HW SPI 32 is routed to and serviced by vCPU B.
     * vCPU A will routinely wait for any pending SPI 32 to be finished 
before performing a specific task.

In the current form of the vGIC, vCPU B will not exit to Xen when SPI 32 
has been deactivated. Instead, the vCPU will continue to run until an 
unrelated trap happen (I/O emulation, IRQs...). Depending on your setup 
(think NULL scheduler) this may happen in a really long time (or never).

Until the vCPU B exit to Xen, SPI 32 may be considered as active. 
Therefore vCPU A will keep waiting and be block until vCPU B is finally 
trapping in Xen.

My example above is basically a cut down version of 
__synchronize_hardirq() in Linux. In practice, you may be lucky most of 
the times because there will be trap happening time to time. However, it 
also means the task you need to perform on vCPU A will be delayed.

So I would not really bet on the trap here. You have two options:
      1) Force the vCPU to trap when deactivating an interrupt
      2) For the vCPUs to exiting when reading I{S,C}ACTIVER

1) will incur cost on every interrupts which is not great. So I think 
your best option is 2) here.

Cheers,

-- 
Julien Grall


      parent reply	other threads:[~2020-03-31  0:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27  2:34 [Xen-devel] [PATCH v2] xen/arm: implement GICD_I[S/C]ACTIVER reads Stefano Stabellini
2020-03-28 11:52 ` Julien Grall
2020-03-30 16:35   ` Stefano Stabellini
2020-03-30 21:19     ` Julien Grall
2020-04-01  0:57       ` Stefano Stabellini
2020-04-01  8:30         ` Julien Grall
2020-04-01  9:54           ` Bertrand Marquis
2020-04-01 17:02             ` George Dunlap
2020-04-01 17:56               ` Julien Grall
2020-04-01 17:23             ` Julien Grall
2020-04-02  8:17               ` Bertrand Marquis
2020-04-02 17:19           ` Stefano Stabellini
2020-04-02 18:52             ` Julien Grall
2020-04-03  8:47               ` Marc Zyngier
2020-04-03 10:43                 ` George Dunlap
2020-04-03 10:59                   ` Marc Zyngier
2020-04-03 11:15                     ` George Dunlap
2020-04-03 11:16                   ` Julien Grall
2020-04-03 16:18                 ` Stefano Stabellini
2020-04-03 16:23                   ` Julien Grall
2020-04-03 17:46                     ` Julien Grall
2020-04-03 19:41               ` Stefano Stabellini
2020-04-03 20:27                 ` Julien Grall
2020-04-06 17:58                   ` George Dunlap
2020-04-06 18:47                     ` Julien Grall
2020-04-07 16:16                       ` George Dunlap
2020-04-07 16:25                         ` Bertrand Marquis
2020-04-07 16:52                           ` Julien Grall
2020-04-07 16:50                         ` Julien Grall
2020-04-07 16:56                           ` Julien Grall
2020-04-07 18:16                           ` George Dunlap
2020-04-07 19:58                             ` Julien Grall
2020-04-09  1:26                               ` Stefano Stabellini
2020-04-09 12:56                                 ` Julien Grall
2020-04-09 13:00                                   ` Julien Grall
2020-04-17 15:16                                     ` Bertrand Marquis
2020-04-17 16:07                                       ` Julien Grall
2020-04-17 16:31                                         ` Stefano Stabellini
2020-04-17 16:47                                           ` Julien Grall
2020-04-08 15:54                 ` Julien Grall
2020-03-31  0:05 ` Julien Grall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e04bce54-d638-56e4-d4c9-e888c879ab85@xen.org \
    --to=julien@xen.org \
    --cc=peng.fan@nxp.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xuwei5@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).