All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: vijay.kilari@gmail.com, Prasun.Kapoor@caviumnetworks.com,
	Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>,
	xen-devel@lists.xen.org, marc.zyngier@arm.com,
	stefano.stabellini@citrix.com
Subject: Re: [PATCH v4 13/16] xen/arm: Add support for GIC v3
Date: Tue, 03 Jun 2014 10:05:15 +0100	[thread overview]
Message-ID: <538D8FCB.9090204@linaro.org> (raw)
In-Reply-To: <1401785663.8841.38.camel@kazak.uk.xensource.com>



On 03/06/14 09:54, Ian Campbell wrote:
> On Mon, 2014-06-02 at 18:33 +0100, Stefano Stabellini wrote:
>>> +static inline void gicv3_restore_lr(int nr_lrs, const struct vcpu *v)
>>> +{
>>> +    /* Fall through for all the cases */
>>> +    switch ( nr_lrs )
>>> +    {
>>> +    case 16:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[15], ICH_LR15_EL2);
>>> +    case 15:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[14], ICH_LR14_EL2);
>>> +    case 14:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[13], ICH_LR13_EL2);
>>> +    case 13:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[12], ICH_LR12_EL2);
>>> +    case 12:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[11], ICH_LR11_EL2);
>>> +    case 11:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[10], ICH_LR10_EL2);
>>> +    case 10:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[9], ICH_LR9_EL2);
>>> +    case 9:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[8], ICH_LR8_EL2);
>>> +    case 8:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[7], ICH_LR7_EL2);
>>> +    case 7:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[6], ICH_LR6_EL2);
>>> +    case 6:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[5], ICH_LR5_EL2);
>>> +    case 5:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[4], ICH_LR4_EL2);
>>> +    case 4:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[3], ICH_LR3_EL2);
>>> +    case 3:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[2], ICH_LR2_EL2);
>>> +    case 2:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[1], ICH_LR1_EL2);
>>> +    case 1:
>>> +        WRITE_SYSREG(v->arch.gic.v3.lr[0], ICH_LR0_EL2);
>>> +         break;
>>> +    default:
>>> +         BUG();
>>> +    }
>>> +}
>>
>> Given that the number of LR registers has grown up quite a bit from
>> GICv2, we should optimize this code and only save and restore the
>> registers that are actually in used by checking on lr_mask.
>
> I'm not convinced that will be faster, the code above involves a
> straight line with no branches, but potentially some unnecessary stores.
> Looping or lr_mask involves a loop, a test_bit and most critically a
> switch over the lr number (to select the correct sysreg, which is a
> static register, not an opcode argument), but has no redundant stores. I
> suspect the straight line version will actually be quicker.

The solution suggested by Stefano doesn't work as it is. We only 
save/restore the LR register marked as used in the lr_mask (which is 
per-VCPU). We may end up with LR from the previous running VCPU because 
Xen will restore only the necessary LRs.

To fix the solution would be to clear the LRs when we save all LRs. But 
I'm not convince it will be faster than the current solution.

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-06-03  9:05 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 10:26 [PATCH v4 00/16] xen/arm: Add GICv3 support vijay.kilari
2014-05-26 10:26 ` [PATCH v4 01/16] xen/arm: move io.h as mmio.h to include folder vijay.kilari
2014-05-26 11:28   ` Julien Grall
2014-05-28 13:55   ` Stefano Stabellini
2014-05-26 10:26 ` [PATCH v4 02/16] xen/arm: make mmio handlers domain specific vijay.kilari
2014-05-26 12:33   ` Julien Grall
2014-05-28 14:05     ` Stefano Stabellini
2014-05-28 14:11       ` Julien Grall
2014-05-26 10:26 ` [PATCH v4 03/16] xen/arm: make sgi handling generic vijay.kilari
2014-05-26 12:41   ` Julien Grall
2014-05-26 12:45     ` Julien Grall
2014-05-28 14:10   ` Stefano Stabellini
2014-06-09  9:58     ` Vijay Kilari
2014-05-26 10:26 ` [PATCH v4 04/16] xen/arm: remove unused parameter in do_sgi call vijay.kilari
2014-05-26 12:48   ` Julien Grall
2014-05-26 10:26 ` [PATCH v4 05/16] xen/arm: use ioremap to map gic-v2 registers vijay.kilari
2014-05-26 13:10   ` Julien Grall
2014-05-30 12:54     ` Vijay Kilari
2014-05-28 14:26   ` Stefano Stabellini
2014-06-09 10:29     ` Vijay Kilari
2014-05-26 10:26 ` [PATCH v4 06/16] xen/arm: segregate and split GIC low level functionality vijay.kilari
2014-05-26 14:09   ` Julien Grall
2014-05-27 19:13   ` Julien Grall
2014-05-28 14:43   ` Stefano Stabellini
2014-05-26 10:26 ` [PATCH v4 07/16] arm/xen: move GIC context data structure to gic driver vijay.kilari
2014-05-26 14:32   ` Julien Grall
2014-05-28 14:49     ` Stefano Stabellini
2014-05-26 10:26 ` [PATCH v4 08/16] xen/arm: use device api to detect GIC version vijay.kilari
2014-05-26 14:39   ` Julien Grall
2014-05-28 14:52     ` Stefano Stabellini
2014-05-26 10:26 ` [PATCH v4 09/16] xen/arm: move vgic rank data to gic header file vijay.kilari
2014-05-27 11:32   ` Julien Grall
2014-05-28 14:54   ` Stefano Stabellini
2014-05-26 10:26 ` [PATCH v4 10/16] xen/arm: move vgic defines to vgic " vijay.kilari
2014-05-27 11:49   ` Julien Grall
2014-06-10  8:30     ` Vijay Kilari
2014-05-26 10:26 ` [PATCH v4 11/16] xen/arm: calculate vgic irq rank based on register size vijay.kilari
2014-05-27 11:56   ` Julien Grall
2014-05-30  8:59     ` Vijay Kilari
2014-05-30  9:58       ` Julien Grall
2014-05-30 10:24         ` Vijay Kilari
2014-05-30 10:36           ` Julien Grall
2014-05-30 10:51             ` Vijay Kilari
2014-05-30 10:54               ` Julien Grall
2014-05-26 10:26 ` [PATCH v4 12/16] xen/arm: split vgic driver into generic and vgic-v2 driver vijay.kilari
2014-05-27 16:50   ` Julien Grall
2014-05-26 10:26 ` [PATCH v4 13/16] xen/arm: Add support for GIC v3 vijay.kilari
2014-05-27 19:47   ` Julien Grall
2014-06-02 17:33   ` Stefano Stabellini
2014-06-03  8:54     ` Ian Campbell
2014-06-03  9:05       ` Julien Grall [this message]
2014-06-03  9:07         ` Ian Campbell
2014-06-03 10:43           ` Stefano Stabellini
2014-06-03 10:46       ` Stefano Stabellini
2014-05-26 10:26 ` [PATCH v4 14/16] xen/arm: Add virtual GICv3 support vijay.kilari
2014-06-02 15:50   ` Stefano Stabellini
2014-06-11 11:36     ` Vijay Kilari
2014-06-11 12:44       ` Stefano Stabellini
2014-06-02 16:10   ` Julien Grall
2014-06-02 16:15     ` Ian Campbell
2014-06-02 16:18       ` Julien Grall
2014-06-02 16:38         ` Ian Campbell
2014-06-02 16:46           ` Julien Grall
2014-05-26 10:26 ` [PATCH v4 15/16] xen/arm: Update Dom0 GIC dt node with GICv3 information vijay.kilari
2014-05-26 10:26 ` [PATCH v4 16/16] xen/arm: add SGI handling for GICv3 vijay.kilari
2014-06-02 16:05   ` Stefano Stabellini
2014-06-02 16:13     ` Ian Campbell
2014-06-11 12:34       ` Vijay Kilari
2014-06-02 16:17   ` Julien Grall
2014-06-11 12:35     ` Vijay Kilari
2014-06-11 12:38       ` Julien Grall
2014-06-12  6:53         ` Vijay Kilari
2014-06-12 21:56           ` Julien Grall
2014-06-13  8:34             ` Ian Campbell
2014-06-15 18:44               ` Julien Grall
2014-06-20  8:48                 ` Vijay Kilari
2014-05-28 10:26 ` [PATCH v4 00/16] xen/arm: Add GICv3 support Ian Campbell
2014-05-28 12:34   ` Ian Campbell

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=538D8FCB.9090204@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=marc.zyngier@arm.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=vijay.kilari@gmail.com \
    --cc=vijaya.kumar@caviumnetworks.com \
    --cc=xen-devel@lists.xen.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.