public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: Gabriel Ravier <gabravier@gmail.com>
Cc: Zack Weinberg <zack@owlfolio.org>,
	GNU libc development <libc-alpha@sourceware.org>
Subject: Re: [PATCH v1 1/2] x86: Implement sched_yield syscall for x86 only.
Date: Fri, 9 Jun 2023 23:59:18 -0500	[thread overview]
Message-ID: <CAFUsyfKmLxq+9-oRmk4E2E6Jbf91quQH0qOWu-3fw27BaTfT-g@mail.gmail.com> (raw)
In-Reply-To: <b4a57395-3879-e387-1a63-3b0f24066b9b@gmail.com>

On Fri, Jun 9, 2023 at 9:07 PM Gabriel Ravier <gabravier@gmail.com> wrote:
>
> On 6/10/23 03:11, Noah Goldstein via Libc-alpha wrote:
> > On Fri, Jun 9, 2023 at 12:59 AM Zack Weinberg via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> >> On Thu, Jun 8, 2023, at 5:25 PM, Florian Weimer wrote:
> >>> The problem is that it's not beneficial in general and might impact
> >>> small packet receive performance with an event loop (where the
> >>> previous poll ensures that the subsequent recvmsg etc. is pretty much
> >>> always non-blocking).  But in other cases, receive operations are
> >>> blocking, and would benefit from that VZEROALL.
> >>>
> >>> Only the kernel knows if the VZEROALL equivalent is beneficial during
> >>> that particular execution of the system call.  But glibc still needs
> >>> to help the kernel and communicate that discarding the vector state is
> >>> safe in this particular context.
> >> The negative effect on non-blocking syscalls would be due to the cost of
> >> the VZEROALL itself, right?
> >>
> >> I'm not having any luck thinking of a good way to communicate this
> >> context information to the kernel.  If we could put flags in the high
> >> bits of syscall numbers that would be very efficient, but it would break
> >> compatibility with old kernels, old strace binaries, and lots of other
> >> stuff.  But any other place we could put it would involve either
> >> stomping on another register (and IIRC there are no call-clobbered
> >> integer registers _left_ to stomp on) or making the kernel do an extra
> >> memory load in the syscall entry path.  Have you got any ideas?
> >>
> > There are some output only registers for syscalls on x86_64 at least.
> > rcx/r11. Those get clobbered by syscall anyways so writing to rcx
> > instruction beforehand would probably not break anything.
> The syscall instruction itself overwrites these with rip and rflags, so
> how is the kernel is supposed to determine what value they had beforehand ?

Oh, I thought that happened before the return to userspace, not before
the transition to the kernel. Nevermind.
> >> zw
>
>

      reply	other threads:[~2023-06-10  4:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  9:00 Noah Goldstein
2023-06-08  9:00 ` [PATCH v1 2/2] x86: Implement clock_nanosleep{_time64} " Noah Goldstein
2023-06-08 10:13 ` [PATCH v1 1/2] x86: Implement sched_yield " Gabriel Ravier
2023-06-08 17:43   ` Noah Goldstein
2023-06-08 11:43 ` Florian Weimer
2023-06-08 12:08   ` Adhemerval Zanella Netto
2023-06-08 17:39     ` Noah Goldstein
2023-06-08 18:26       ` Zack Weinberg
2023-06-08 19:41         ` Florian Weimer
2023-06-08 19:53           ` Noah Goldstein
2023-06-08 20:22             ` Zack Weinberg
2023-06-08 20:38               ` Noah Goldstein
2023-06-08 20:44                 ` Zack Weinberg
2023-06-08 21:06                   ` Noah Goldstein
2023-06-08 21:25                     ` Florian Weimer
2023-06-09  5:59                       ` Zack Weinberg
2023-06-10  1:11                         ` Noah Goldstein
2023-06-10  2:07                           ` Gabriel Ravier
2023-06-10  4:59                             ` Noah Goldstein [this message]

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=CAFUsyfKmLxq+9-oRmk4E2E6Jbf91quQH0qOWu-3fw27BaTfT-g@mail.gmail.com \
    --to=goldstein.w.n@gmail.com \
    --cc=gabravier@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=zack@owlfolio.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).