public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH 0/2] Remove some i386 system call optimizations
Date: Wed, 12 Jan 2022 13:59:55 -0800	[thread overview]
Message-ID: <CAMe9rOpxExB2TOE4_r5XtvvacQ=RqnpmTntkEYHTvP9Uh_WWsQ@mail.gmail.com> (raw)
In-Reply-To: <87sftslnmz.fsf@oldenburg.str.redhat.com>

On Wed, Jan 12, 2022 at 12:12 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Wed, Jan 12, 2022 at 11:37 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu:
> >>
> >> > On Tue, Jan 11, 2022 at 2:52 PM Florian Weimer <fweimer@redhat.com> wrote:
> >> >>
> >> >> * H. J. Lu:
> >> >>
> >> >> >> > There are
> >> >> >> >
> >> >> >> > /* Since GCC 5 and above can properly spill %ebx with PIC when needed,
> >> >> >> >    we can inline syscalls with 6 arguments if GCC 5 or above is used
> >> >> >> >    to compile glibc.  Disable GCC 5 optimization when compiling for
> >> >> >> >    profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
> >> >> >> >    can't be used to put the 6th argument in %ebp for syscall.  */
> >> >> >> > #if !defined PROF && CAN_USE_REGISTER_ASM_EBP
> >> >> >> > # define OPTIMIZE_FOR_GCC_5
> >> >> >> > #endif
> >> >> >> >
> >> >> >> > If we want to support profiling or -fno-omit-frame-pointer,
> >> >> >> > we need to keep these codes.
> >> >> >>
> >> >> >> This is strictly for %ebp, I think, as indicated by the comment.  %ebx
> >> >> >> does not need to be special-cased for profiling.
> >> >> >>
> >> >> >> I assume that building glibc (with profiling) is proof enough that this
> >> >> >> works?
> >> >> >
> >> >> > You need to test glibc build with -fno-omit-frame-pointer.
> >> >>
> >> >> I tried it, it works (with both patches applied).
> >> >> -fno-omit-frame-pointer is about %ebp, not %ebx.
> >> >>
> >> >> Thanks,
> >> >> Florian
> >> >>
> >> >
> >> > Do they have to be in glibc 2.35?  If not, I prefer to do it after
> >> > 2.35 is branched.
> >>
> >> We can't build glibc 2.35 with GCC 12 in Fedora without these changes.
> >>
> >> The %ebp avoidance I can activate with a configure argument, but the
> >> macros for optimized %ebx usage are incompatible with .altmacro, as used
> >> by the current Systemtap probes.
> >
> > Please open a glibc bug with a reproducer and CC me.
>
> Done: <https://sourceware.org/bugzilla/show_bug.cgi?id=28771>
>

OPTIMIZE_FOR_GCC_5 enables 2 things: one is let GCC handle
-fPIC and the other is use

register int reg asm ("ebp")

which is unreliable.   You want to let GCC handle -fPIC and
remove CAN_USE_REGISTER_ASM_EBP.  If this is correct,
please combine 2 patches into one and reference BZ #28771
in the commit log.

Thanks.

-- 
H.J.

  reply	other threads:[~2022-01-12 22:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 10:05 Florian Weimer
2022-01-11 10:06 ` [PATCH 1/2] i386: Always treat %ebx as an allocatable register Florian Weimer
2022-01-11 10:06 ` [PATCH 2/2] i386: Always use __libc_do_syscall for 6-argument syscalls (bug 27997) Florian Weimer
2022-01-11 14:00 ` [PATCH 0/2] Remove some i386 system call optimizations H.J. Lu
2022-01-11 20:30   ` H.J. Lu
2022-01-11 20:37     ` Florian Weimer
2022-01-11 22:20       ` H.J. Lu
2022-01-11 22:52         ` Florian Weimer
2022-01-12 18:49           ` H.J. Lu
2022-01-12 19:37             ` Florian Weimer
2022-01-12 19:56               ` H.J. Lu
2022-01-12 20:12                 ` Florian Weimer
2022-01-12 21:59                   ` H.J. Lu [this message]
2022-01-12 22:33                     ` Florian Weimer

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='CAMe9rOpxExB2TOE4_r5XtvvacQ=RqnpmTntkEYHTvP9Uh_WWsQ@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=jakub@redhat.com \
    --cc=libc-alpha@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).