public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Liebler <stli@linux.ibm.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: s390x: Diagnose missing VXE at run time if required at build time
Date: Fri, 9 Apr 2021 15:50:54 +0200	[thread overview]
Message-ID: <68069597-69f1-f97e-f1d3-184a58495d14@linux.ibm.com> (raw)
In-Reply-To: <87eefk3ibd.fsf@oldenburg.str.redhat.com>

On 08/04/2021 17:30, Florian Weimer wrote:
> * Stefan Liebler:
> 
>> I've just had a quick look to dl_platform_init for other architectures
>> to check if there are similar checks. But I haven't found those there.
>> Are there similar checks for other architectures at a different place?
> 
> There is a check in sysdeps/x86/dl-prop.h, but that's different because
> it looks at ELF data, not build flags.
> 
>> Is there a special reason for this check beyond giving the user an error
>> message instead of crashing with SIGILL?
> 
> No, there isn't.  It's merely about the diagnostic.
> 
>> The user will get the error message if build with -march=z14 and running
>> on z13. If this binary is running on zEC12, it just crashes with SIGILL
>> as there is a z13 vector instructions before dl_platform_init. Currently
>> it works on z13, but who knows if this does not change if build with a
>> different gcc version?
> 
> To be honest, this change is mostly driven by downstream requirements.
> Our zEC12 hardware is powered off, but the z13 hardware is not, so there
> is some space for confusion.
> 
> I'm going to post a similar patch for POWER9 if I can get it to work.
> There we actually hit the issue you mention: some of them min/max
> instructions are actually used early during startup.  I don't know yet
> if that's before or after the point I'm patching here for s390x.
> 
>> The __LONG_DOUBLE_VX__ macro is quite new and the first gcc release will
>> be gcc 11. But there is also the __ARCH__ macro. If defined by the used
>> gcc, it is set to the architecture level determined by -march=xyz
>> (z15=13; z14=12; z13=11; ...).
>> See gcc commit "S/390: Rename __S390_ARCH_LEVEL__ to __ARCH__."
>> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4727e06bb7c047a10aa502c829b7e4b519d8082b
>> If I remember correctly, this was introduced with gcc 7 or 8.
>>
>> Would it make sense to add such a check also if build with -march=z15?:
>> #if defined __ARCH__
>> # if __ARCH__ >= 13
>>   if (!(GLRO(dl_hwcap) & HWCAP_S390_VXRS_EXT2))
>>     _dl_fatal_printf ("\
>> Fatal glibc error: CPU lacks VXRS_EXT2 support (z15 or later required)\n");
>> # elif __ARCH__ >= 12
>>   if (!(GLRO(dl_hwcap) & HWCAP_S390_VXE))
>>     _dl_fatal_printf ("\
>> Fatal glibc error: CPU lacks VXE support (z14 or later required)\n");
>> #endif
> 
> This is fine with me too.
Okay. Then I would prefer the __ARCH__ variant.

Thanks,
Stefan


      parent reply	other threads:[~2021-04-09 13:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 15:55 Florian Weimer
2021-04-08 14:49 ` Stefan Liebler
2021-04-08 15:30   ` Florian Weimer
2021-04-09  8:35     ` Florian Weimer
2021-04-09 13:50     ` Stefan Liebler [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=68069597-69f1-f97e-f1d3-184a58495d14@linux.ibm.com \
    --to=stli@linux.ibm.com \
    --cc=fweimer@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).