Bug 2036955

Summary: glibc: A64FX SVE optimized memory operations break "sve=off" guest mode
Product: Red Hat Enterprise Linux 8 Reporter: Eric Auger <eric.auger>
Component: glibcAssignee: Florian Weimer <fweimer>
Status: CLOSED ERRATA QA Contact: Martin Coufal <mcoufal>
Severity: low Docs Contact:
Priority: low    
Version: 8.6CC: ashankar, codonell, dj, drjones, fj-lsoft-kernel-it, fweimer, lcapitulino, mcoufal, mnewsome, pfrankli, sipoyare, skolosov, yihyu
Target Milestone: rcKeywords: Bugfix, Patch, Regression, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: aarch64   
OS: Linux   
Whiteboard:
Fixed In Version: glibc-2.28-183.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 15:18:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1885765    

Description Eric Auger 2022-01-04 14:05:19 UTC
Bug 1929928 - [Fujitsu 8 FEAT] Support of glibc memory operation A64FX SVE performance improvement

backports the upstream series

[v2,0/6] aarch64: Added optimized memcpy/memmove/memset for A64FX [1]

This latter uses SVE instructions for some memory operation optimizations. However the enablement is based on the SVE asm capability and on the MIDR:

for instance in sysdeps/aarch64/multiarch/memset.c:
> 
> > +#if HAVE_AARCH64_SVE_ASM
> > +	       : (IS_A64FX (midr)
../..

Unfortunately, when launching a VM it is possible to turn the SVE feature off at VCPU level. In that specific case, when running on A64FX, the guest kernel panics at /init because some SVE instructions are attempted by userspace while the vcpu does not support them.

So the problem needs to be fixed upstream and backported on 8.6 on top of [1].

"sve=off" vcpu mode is not the default operating mode so the BZ has rather low priority but we think it is also good to get it fixed upstream to discourage other coders to rely on MIDR only and downstream for arm-virt CI.

The arm-virt team will be happy to test the fix :-)

Comment 1 Florian Weimer 2022-01-07 10:07:11 UTC
Upstream fix has been committed:

commit e5fa62b8db546f8792ec9e5c61e6419f4f8e3f4d
Author: Wilco Dijkstra <wdijkstr>
Date:   Thu Jan 6 14:36:28 2022 +0000

    AArch64: Check for SVE in ifuncs [BZ #28744]
    
    Add a check for SVE in the A64FX ifuncs for memcpy, memset and memmove.
    This fixes BZ #28744.

Comment 5 Eric Auger 2022-01-10 17:28:55 UTC
Hi Yihuang,

Would you have cycles to test it?

Thanks

Eric

Comment 6 Yihuang Yu 2022-01-11 13:33:37 UTC
(In reply to Eric Auger from comment #5)
> Hi Yihuang,
> 
> Would you have cycles to test it?
> 
> Thanks
> 
> Eric

Hello Eric,

It's easy for me if I can reserve a FJ host to do it. However, I am not sure how to test with glibc? Using this version to build a kernel or it's there any kernel built by glibc-2.28-183.el8?

Comment 9 Eric Auger 2022-01-17 13:03:34 UTC
Sure trying to get a loan to either of the machines

Comment 10 Eric Auger 2022-01-17 20:43:15 UTC
I was able to launch a VM on Fujitsu machine with

  <cpu mode='host-passthrough' check='none'>
    <feature policy='disable' name='sve'/>
  </cpu>


inducing at qemu command line level: -cpu host,sve=off

The installed glibc is 2.28-184.el8
Yihuang, please can you move this BZ to verified?

Comment 11 Yihuang Yu 2022-01-18 01:57:41 UTC
Thank you Eric for your help, I will set "Tested" first.

Comment 14 Yihuang Yu 2022-01-21 05:36:04 UTC
Test with glibc-2.28-184.el8.aarch64 on RHEL-8.6.0-20220118.5 compose, test case passed without call trace occurs.

(2/4) Host_RHEL.m8.u6.product_rhel.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.6.0.aarch64.io-github-autotest-qemu.sve_basic.arm64-pci: PASS (384.85 s)
(3/4) Host_RHEL.m8.u6.product_rhel.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.6.0.aarch64.io-github-autotest-qemu.sve_basic.unsupported_length.arm64-pci: PASS (38.20 s)
(4/4) Host_RHEL.m8.u6.product_rhel.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.8.6.0.aarch64.io-github-autotest-qemu.sve_basic.unsupported_length.invalid_length.arm64-pci: PASS (8.33 s)

Comment 15 Martin Coufal 2022-01-21 09:27:46 UTC
Thank you both @yihyu and @eric.auger for testing.

Comment 18 errata-xmlrpc 2022-05-10 15:18:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (glibc bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2005