All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xenproject.org
Cc: Vijaya.Kumar@caviumnetworks.com, stefano.stabellini@citrix.com,
	manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com
Subject: Re: [PATCH v1 6/8] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Date: Wed, 30 Sep 2015 19:11:21 +0100	[thread overview]
Message-ID: <560C25C9.8040207@citrix.com> (raw)
In-Reply-To: <1443536619.16718.104.camel@citrix.com>

On 29/09/15 15:23, Ian Campbell wrote:
> On Tue, 2015-09-29 at 14:36 +0100, Julien Grall wrote:
>> On 29/09/15 14:07, Ian Campbell wrote:
>>> On Fri, 2015-09-25 at 15:51 +0100, Julien Grall wrote:
>>>> Xen is currently directly storing the value of register
>>>> GICD_ITARGETSR
>>>> (for GICv2) and GICD_IROUTER (for GICv3) in the rank. This makes the
>>>> emulation of the registers access very simple but makes the code to
>>>> get
>>>> the target vCPU for a given IRQ more complex.
>>>>
>>>> While the target vCPU of an IRQ is retrieved everytime an IRQ is
>>>> injected to the guest, the access to the register occurs less often.
>>>>
>>>> So the data structure should be optimized for the most common case
>>>> rather than the inverse.
>>>>
>>>> This patch introduce the usage of an array to store the target vCPU
>>>> for
>>>> every interrupt in the rank. This will make the code to get the
>>>> target
>>>> very quick. The emulation code will now have to generate the
>>>> GICD_ITARGETSR
>>>> and GICD_IROUTER register for read access and split it to store in a
>>>> convenient way.
>>>>
>>>> Note that with these changes, any read to those registers will list
>>>> only
>>>> the target vCPU used by Xen. This is fine because the GIC spec
>>>> doesn't
>>>> require to return exactly the value written and it can be seen as if
>>>> we
>>>> decide to implement the register read-only.
>>>
>>> I think this is probably OK, but skirting round what the spec actually
>>> says
>>> a fair bit.
>>
>> Well, nothing in the spec clearly explain the behavior of a read access
>> on the register. An implementation could decide to make some bits RO or
>> even not store everything.
>>
>> FWIW, KVM is using the same trick.
> 
> At least we'll both get screwed by a picky OS then ;-)

I think our implementation could fold into 4.3.12 IHI 0048B:

"It is IMPLEMENTATION DEFINED which, if any, SPIs are statically
configured in hardware. The CPU targets field for such an SPI is
read-only, and returns a value that indicates the CPU targets for the
interrupt."

We are implementing a weird read-only but at least an OS should not
trust the written value.

Regards,

-- 
Julien Grall

  reply	other threads:[~2015-09-30 18:12 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 14:51 [PATCH v1 0/8] xen/arm: vgic: Support 32-bit access for 64-bit register Julien Grall
2015-09-25 14:51 ` [PATCH v1 1/8] xen/arm: io: remove mmio_check_t typedef Julien Grall
2015-09-25 16:33   ` Ian Campbell
2015-09-25 14:51 ` [PATCH v1 2/8] xen/arm: io: Extend write/read handler to pass the register in parameter Julien Grall
2015-09-25 16:36   ` Ian Campbell
2015-09-28 16:35     ` Julien Grall
2015-09-29 10:51       ` Ian Campbell
2015-09-29 11:00         ` Julien Grall
2015-09-29 11:09           ` Ian Campbell
2015-09-25 14:51 ` [PATCH v1 3/8] xen/arm: Support sign-extension for every read access Julien Grall
2015-09-25 16:44   ` Ian Campbell
2015-09-28 16:42     ` Julien Grall
2015-09-29 11:01       ` Ian Campbell
2015-09-29 11:07         ` Julien Grall
2015-09-28 18:22     ` Julien Grall
2015-09-29 11:03       ` Ian Campbell
2015-09-29 11:13         ` Julien Grall
2015-09-29 13:13           ` Ian Campbell
2015-09-29 13:16             ` Julien Grall
2015-09-25 14:51 ` [PATCH v1 4/8] xen/arm: vgic: ctlr stores a 32-bit hardware register so use uint32_t Julien Grall
2015-09-25 16:45   ` Ian Campbell
2015-09-25 14:51 ` [PATCH v1 5/8] xen/arm: vgic: Optimize the way to store GICD_IPRIORITYR in the rank Julien Grall
2015-09-28 10:50   ` Ian Campbell
2015-09-28 17:10     ` Julien Grall
2015-09-29 10:56       ` Ian Campbell
2015-09-28 10:52   ` Ian Campbell
2015-09-28 16:43     ` Julien Grall
2015-09-25 14:51 ` [PATCH v1 6/8] xen/arm: vgic: Optimize the way to store the target vCPU " Julien Grall
2015-09-29 13:07   ` Ian Campbell
2015-09-29 13:36     ` Julien Grall
2015-09-29 14:23       ` Ian Campbell
2015-09-30 18:11         ` Julien Grall [this message]
2015-10-01  8:30           ` Ian Campbell
2015-09-25 14:51 ` [PATCH v1 7/8] xen/arm: vgic: Introduce helpers to read/write/clear/set vGIC register Julien Grall
2015-09-29 13:23   ` Ian Campbell
2015-09-29 13:48     ` Julien Grall
2015-09-29 14:24       ` Ian Campbell
2015-10-02  9:36         ` Julien Grall
2015-09-25 14:51 ` [PATCH v1 8/8] xen/arm: vgic-v3: Support 32-bit access for 64-bit registers Julien Grall
2015-09-29 13:27   ` Ian Campbell
  -- strict thread matches above, loose matches on Subject: below --
2015-09-25 14:50 [PATCH v1 0/8] xen/arm: vgic: Support 32-bit access for 64-bit register Julien Grall
2015-09-25 14:51 ` [PATCH v1 6/8] xen/arm: vgic: Optimize the way to store the target vCPU in the rank Julien Grall
2015-09-25 14:51   ` Julien Grall
2015-09-25 14:51   ` Julien Grall

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=560C25C9.8040207@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=ian.campbell@citrix.com \
    --cc=manish.jaggi@caviumnetworks.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=vijay.kilari@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.