From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 162EC395C416 for ; Fri, 9 Apr 2021 13:51:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 162EC395C416 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 139DY9XA119627 for ; Fri, 9 Apr 2021 09:51:00 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37tmgyq1gd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 09 Apr 2021 09:51:00 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 139DYGTs120436 for ; Fri, 9 Apr 2021 09:50:59 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 37tmgyq1fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 09:50:59 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 139DllSj004920; Fri, 9 Apr 2021 13:50:57 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 37t3h8gtvm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Apr 2021 13:50:57 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 139DotYa53936394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Apr 2021 13:50:55 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0304F4C046; Fri, 9 Apr 2021 13:50:55 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF3964C040; Fri, 9 Apr 2021 13:50:54 +0000 (GMT) Received: from li-ab9d22cc-354d-11b2-a85c-e984af76f811.ibm.com (unknown [9.171.61.173]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 9 Apr 2021 13:50:54 +0000 (GMT) Subject: Re: s390x: Diagnose missing VXE at run time if required at build time To: Florian Weimer Cc: libc-alpha@sourceware.org References: <87k0pfmmpy.fsf@oldenburg.str.redhat.com> <294a9d07-64bc-7db7-6cd9-1fe4fdbfc1f9@linux.ibm.com> <87eefk3ibd.fsf@oldenburg.str.redhat.com> From: Stefan Liebler Message-ID: <68069597-69f1-f97e-f1d3-184a58495d14@linux.ibm.com> Date: Fri, 9 Apr 2021 15:50:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 In-Reply-To: <87eefk3ibd.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Prem5HKmmSUPVhII5jkgb-tUSmNbwo3_ X-Proofpoint-ORIG-GUID: ASa1rRZjBOpcXqCXK2B5cTTzgpON4dRl Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-09_05:2021-04-09, 2021-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104090101 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 13:51:02 -0000 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