public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: DJ Delorie <dj@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: tunables vs osxsave vs checkpointing vs _dl_runtime_resolve
Date: Thu, 18 Mar 2021 10:29:22 -0700	[thread overview]
Message-ID: <CAMe9rOp8i08vc8u_rOMSFeW68_1wyaYHReP0itjTjHjspZ-vmA@mail.gmail.com> (raw)
In-Reply-To: <xn8s6knzxw.fsf@rhel8.vm>

On Thu, Mar 18, 2021 at 10:18 AM DJ Delorie via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
>
> In response to this customer bug...
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1937515
>
> I spent some time digging into this code, and was able to reproduce it
> using criu (checkpoint/restore in userspace).  In a nutshell: if you
> create a task on a machine WITH xsave (or xsavec), and migrate it
> (somehow) to a machine WITHOUT xsave (or xsavec), any further DSO
> calls will fail because we've already chosen an xsave/xsavec resolver.
>
> This, of course, is guaranteed to fail, and cannot be fixed.  With
> criu I had to override the checks with a command line option just to
> prove my point.
>
> However, if you *know* you might do this, there should be a way to use
> tunables to avoid xsave/xsavec - with the usual caveats about "YMMV" -
> so that a process could be migrated across such CPUs without fault.
>
> Our tunables almost provide this.
>
> IMHO the tunables logic should interact with cpu features like this:
>
> 1. Read the CPU features available
> 2. Apply tunables
> 3. Make secondary decisions based on the results
>
> The code that handles xsave breaks these rules; the save size for
> extended registers is computed before tunables are applied, so
> disabling xsave, xsavec, or osxsave in tunables has no affect.
> *After* tunables, we use the save size to determine if xsave/xsavec
> are enabled!
>
> It looks like just moving the save_size logic in update_usable()
> (cpu_features.c) to after the tunables check in init_cpu_features()
> should "solve" this problem, allowing tunables to determine if
> xsave/xsavec are used in dl_runtime_resolve.  However, the code is
> complex and hairy and there's a good chance for gotchas in there.
>
> Comments?
>

Please open a glibc bug and CC me.

-- 
H.J.

  reply	other threads:[~2021-03-18 17:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 17:18 DJ Delorie
2021-03-18 17:29 ` H.J. Lu [this message]
2021-03-18 17:45   ` DJ Delorie
2021-03-18 20:39     ` H.J. Lu
2021-03-19  3:40       ` DJ Delorie
2021-03-19  4:16         ` H.J. Lu
2021-03-19  4:35           ` DJ Delorie
2021-03-18 17:32 ` Florian Weimer
2021-03-18 17:47   ` DJ Delorie
2021-03-18 17:57     ` Florian Weimer
2021-03-18 18:19       ` DJ Delorie
2021-03-19 16:43 ` Szabolcs Nagy
2021-03-19 21:12   ` DJ Delorie

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=CAMe9rOp8i08vc8u_rOMSFeW68_1wyaYHReP0itjTjHjspZ-vmA@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=dj@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).