All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Julien Grall <julien.grall@citrix.com>, xen-devel@lists.xenproject.org
Cc: stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v2 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank
Date: Tue, 6 Oct 2015 14:59:20 +0100	[thread overview]
Message-ID: <1444139960.5302.185.camel@citrix.com> (raw)
In-Reply-To: <1444049512-15323-8-git-send-email-julien.grall@citrix.com>

On Mon, 2015-10-05 at 13:51 +0100, Julien Grall wrote:
> Xen is currently directly storing the value of GICD_ITARGETSR register
> (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 vIRQ more complex.
> 
> While the target vCPU of an vIRQ is retrieved every time an vIRQ 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 introduces 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.
> 
> With the new way to store the target vCPU, the structure vgic_irq_rank
> is shrinked down from 320 bytes to 92 bytes. This is saving about 228

"shrunk"

> bytes of memory allocated separately per vCPU.
> 
> 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'd prefer if instead of "this is fine..." this said something like "We
think this is likely to be OK because...(stuff)...".

It is not the case that the spec actually says what is implemented here is
acceptable and I think that needs to be clear here along with why we
currently think it is something we can get away with, for future reference.

> +    /*
> +     * From the spec (see 8.9.13 in IHI 0069A), any write with an
> +     * invalid vCPU will lead to ignore the interrupt.

"will lead to the interrupt being ignored"

  reply	other threads:[~2015-10-06 13:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 12:51 [PATCH v2 0/9] xen/arm: vgic: Support 32-bit access for 64-bit register Julien Grall
2015-10-05 12:51 ` [PATCH v2 1/9] xen/arm: io: remove mmio_check_t typedef Julien Grall
2015-10-05 12:51 ` [PATCH v2 2/9] xen/arm: io: Extend write/read handler to pass the register in parameter Julien Grall
2015-10-05 12:58   ` Julien Grall
2015-10-06 13:44     ` Ian Campbell
2015-10-05 12:51 ` [PATCH v2 3/9] xen/arm: io: Support sign-extension for every read access Julien Grall
2015-10-06 13:47   ` Ian Campbell
2015-10-06 13:55     ` Julien Grall
2015-10-05 12:51 ` [PATCH v2 4/9] xen/arm: vgic: ctlr stores a 32-bit hardware register so use uint32_t Julien Grall
2015-10-05 12:51 ` [PATCH v2 5/9] xen/arm: vgic: Optimize the way to store GICD_IPRIORITYR in the rank Julien Grall
2015-10-06 13:49   ` Ian Campbell
2015-10-05 12:51 ` [PATCH v2 6/9] xen/arm: vgic: Introduce a new field to store the rank index and use it Julien Grall
2015-10-06 13:51   ` Ian Campbell
2015-10-06 13:56     ` Julien Grall
2015-10-05 12:51 ` [PATCH v2 7/9] xen/arm: vgic: Optimize the way to store the target vCPU in the rank Julien Grall
2015-10-06 13:59   ` Ian Campbell [this message]
2015-10-06 14:18     ` Julien Grall
2015-10-05 12:51 ` [PATCH v2 8/9] xen/arm: vgic: Introduce helpers to extract/update/clear/set vGIC register Julien Grall
2015-10-06 14:01   ` Ian Campbell
2015-10-05 12:51 ` [PATCH v2 9/9] xen/arm: vgic-v3: Support 32-bit access for 64-bit registers 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=1444139960.5302.185.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.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.