lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADLLry7bYPYfqwQwWLtsXaAMG_deJ=TVVowAb5wtk_=AhTT64Q@mail.gmail.com>
Date:   Sat, 12 Jun 2021 22:32:54 +0900
From:   Austin Kim <austindh.kim@...il.com>
To:     Marc Zyngier <maz@...nel.org>
Cc:     james.morse@....com, alexandru.elisei@....com,
        suzuki.poulose@....com, catalin.marinas@....com, will@...nel.org,
        linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        김동현 <austin.kim@....com>
Subject: Re: [PATCH] KVM: arm64: vgic: declear local variable 'flags' before
 for loop starts

2021년 6월 12일 (토) 오후 8:10, Marc Zyngier <maz@...nel.org>님이 작성:
>
> On Sat, 12 Jun 2021 12:00:14 +0100,
> Austin Kim <austindh.kim@...il.com> wrote:
> >
> > From: Austin Kim <austin.kim@....com>
> >
> > Normally local variable 'flags' is defined out of for loop,
> > when 'flags' is used as the second parameter in a call to
> > spinlock_irq[save/restore] function.
> >
> > So it had better declear local variable 'flags' ahead of for loop.
>
> Why better? Reducing the scope of a variable is in general good
> practice. Do you see any material advantage in moving this variable
> out of the loop? Does the compiler generate better code?

First all of, thanks for feedback.

I checked how the compiler generate assembly code(before/after) using
objdump utility.
And then found out that compiler generates the same assembly code.

<compiler version: gcc-linaro-7.5.0-2019.12-x86_64_aarch64>

ffff80001005f5c8 <vgic_mmio_read_pending>:
ffff80001005f5c8:   d503233f    paciasp
...
ffff80001005f63c:   97ffe9af    bl  ffff800010059cf8 <vgic_get_irq>
ffff80001005f640:   aa0003f3    mov x19, x0
ffff80001005f644:   943886c3    bl  ffff800010e81150 <_raw_spin_lock_irqsave>

Let me keep in mind how compiler generate assembly code with new patch,
which leads to material advantage.

BR,
Austin Kim

>
> Thanks,
>
>         M.
>
> --
> Without deviation from the norm, progress is not possible.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ