public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Guo Heyi <heyi.guo@linaro.org>,
	 "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Yi Li <phoenix.liyi@huawei.com>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH v2 1/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload
Date: Wed, 14 Mar 2018 14:50:41 +0000	[thread overview]
Message-ID: <CAKv+Gu_y5wZqeja9Jaaj6dLN2X1x96CwigY6QTr466=41GKZYw@mail.gmail.com> (raw)
In-Reply-To: <86a7vbaynt.wl-marc.zyngier@arm.com>

On 14 March 2018 at 07:45, Marc Zyngier <marc.zyngier@arm.com> wrote:
> On Wed, 14 Mar 2018 00:25:09 +0000,
> Guo Heyi wrote:
>>
>> On Tue, Mar 13, 2018 at 09:33:33AM +0000, Marc Zyngier wrote:
>> > On 13/03/18 00:31, Heyi Guo wrote:
>> > > If timer interrupt is level sensitive, reloading timer compare
>> > > register has a side effect of clearing GIC pending status, so a "ISB"
>> > > is needed to make sure this instruction is executed before enabling
>> > > CPU IRQ, or else we may get spurious timer interrupts.
>> > >
>> > > Contributed-under: TianoCore Contribution Agreement 1.1
>> > > Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
>> > > Signed-off-by: Yi Li <phoenix.liyi@huawei.com>
>> > > Cc: Leif Lindholm <leif.lindholm@linaro.org>
>> > > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> > > Cc: Marc Zyngier <marc.zyngier@arm.com>
>> > > ---
>> > >
>> > > Notes:
>> > >     v2:
>> > >     - Use ISB instead of DSB [Marc]
>> > >     - Update commit message accordingly.
>> > >
>> > >  ArmPkg/Drivers/TimerDxe/TimerDxe.c | 1 +
>> > >  1 file changed, 1 insertion(+)
>> > >
>> > > diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
>> > > index 33d7c922221f..32abee8726a0 100644
>> > > --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
>> > > +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
>> > > @@ -337,6 +337,7 @@ TimerInterruptHandler (
>> > >
>> > >      // Set next compare value
>> > >      ArmGenericTimerSetCompareVal (CompareValue);
>> > > +    ArmInstructionSynchronizationBarrier ();
>> > >      ArmGenericTimerEnableTimer ();
>> > >    }
>> >
>> > Sorry for being pedantic here, but it would make more sense if ISB was
>> > placed after the enabling of the timer. Otherwise, you only force the
>> > update of the comparator. But on the other hand, the timer was never
>> > disabled the first place, in which case you'd wonder why you're trying
>> > to enable it again.
>> Yes, I also had such question and hesitated at this place :)
>> >
>> > So either you leave the ISB here and remove the enable call, or move the
>> > ISB after the enable.
>>
>> If we are going to remove the enable call, is it better to be changed in a
>> separate patch? It seems not related with adding ISB, though it is only a
>> one-line change.
>
> I guess a separate patch doesn't hurt, but that's for Ard and Leif to
> decide.
>

Yes, please.


  reply	other threads:[~2018-03-14 14:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13  0:31 [PATCH v2 0/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload Heyi Guo
2018-03-13  0:31 ` [PATCH v2 1/1] " Heyi Guo
2018-03-13  9:33   ` Marc Zyngier
2018-03-14  0:25     ` Guo Heyi
2018-03-14  7:45       ` Marc Zyngier
2018-03-14 14:50         ` Ard Biesheuvel [this message]
2018-03-15  7:11           ` Guo Heyi
2018-03-15  7:30             ` Ard Biesheuvel
2018-03-15  9:40               ` Marc Zyngier
2018-03-15  9:52                 ` Ard Biesheuvel
2018-03-15 10:02                   ` Marc Zyngier

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-list 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='CAKv+Gu_y5wZqeja9Jaaj6dLN2X1x96CwigY6QTr466=41GKZYw@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /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