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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 23 May 2022 14:50:28 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Changbin Du <changbin.du@...il.com>
Cc:     Masahiro Yamada <masahiroy@...nel.org>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        kernel-janitors <kernel-janitors@...r.kernel.org>,
        Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: Re: [RFC PATCH] kbuild: Add an option to enable -O1 and speed-up
 compilation time

On Mon, May 23, 2022 at 2:34 PM Changbin Du <changbin.du@...il.com> wrote:
> On Sun, May 22, 2022 at 12:38:17AM +0900, Masahiro Yamada wrote:
> > (+CC: Arnd, Changbin Du)
> >
> >
> > If -O1 support does not require additional effort,
> > I have no objection to this patch.
> >
> > (but I do not have enough insight about
> > the compiler's inlining heuristic)
> >
> >
> >
> > BTW, when we attempted to add the -Og support,
> > we fixed various parts, and Linus rejected it.
> >
> > https://lore.kernel.org/linux-kbuild/CAK7LNARQggM3aKEPRKJqa4tunFAfmfErMZuS-rrnRv6UB1VpPQ@mail.gmail.com/
> >
> >
> >
> >
> >
> >
> >
> I am afraid that '-O1' has the same situation with '-Og'. As described in GCC
> mannual:
>
> Like -O0, -Og completely disables a number of optimization passes so that
> individual options controlling them have no effect. Otherwise -Og enables all
> -O1 optimization flags except for those that may interfere with debugging:
>  -fbranch-count-reg  -fdelayed-branch
>  -fdse  -fif-conversion  -fif-conversion2
>  -finline-functions-called-once
>  -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
>  -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra

Correct, I'm fairly sure this never worked. It may be possible to narrow down
the individual optimization flags to have something that works inbetween
-O1 and -O2, but that requires a lot of testing work, and it is questionable
whether there are any practical upsides.

Note that we already disable some optimizations for certain configurations,
e.g. CONFIG_READABLE_ASM, CONFIG_FRAME_POINTER or
CONFIG_DEBUG_SECTION_MISMATCH. The gcc manual suggests
listing all optimization flags with

$ gcc -c -Q -O1 --help=optimizers > O1-opts
$ gcc -c -Q -O2 --help=optimizers > O2-opts
$ diff -u O1-opts O2-opts

If the goal is to speed up compilation, there may be value in trying
which of the various options make the most difference here and
still produce a working kernel when disabled. I know we need the
inlining to happen or things go badly wrong, but I don't know if e.g.
-fno-expensive-optimizations would work.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ