Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1941652 - qemu-system-ppc64 KVM fails: Facility 'SCV' unavailable (12)
Summary: qemu-system-ppc64 KVM fails: Facility 'SCV' unavailable (12)
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 34
Hardware: ppc64le
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PPCTracker
TreeView+ depends on / blocked
 
Reported: 2021-03-22 14:40 UTC by sadoon_albader
Modified: 2021-03-25 12:03 UTC (History)
28 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-03-23 09:42:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Core dump (1.53 KB, text/plain)
2021-03-22 15:15 UTC, sadoon_albader
no flags Details

Description sadoon_albader 2021-03-22 14:40:44 UTC
Description of problem:

(Suspected glibc issue!)

qemu-system-ppc64 fails when invoked with kvm acceleration with error "illegal instruction"

> qemu-system-ppc64 -M pseries,accel=kvm

Illegal instruction (core dumped)

In dmesg:

Facility 'SCV' unavailable (12), exception at 0x7624f8134c0c, MSR=900000000280f033


Version-Release number of selected component (if applicable):
5.2.0 (qemu-5.2.0-5.fc34.1)
Linux kernel 5.11 (5.11.3-300.fc34.ppc64le)
glibc 2.33 (2.33-5.fc34)

How reproducible:
Always

Steps to Reproduce:
1. Run qemu with kvm acceleration

Actual results:
Illegal instruction

Expected results:
Normal VM execution

Additional info:
The machine is a Raptor Talos II Lite with a Sforza V1 8-core, but was also observed on a Raptor Blackbird with the same processor.

This was also observed on Ubuntu 21.04 testing, which uses glibc 2.33
Also tested on ArchPOWER (unofficial port of Arch Linux for ppc64le) with glibc 2.33
Fedora 33 and Ubuntu 20.10, both using glibc 2.32 do not have this issue, and downgrading the Linux kernel from 5.11 to 5.4 LTS on ArchPOWER solved the problem. Kernel 5.9 and 5.10 have the same issue when combined with glibc2.33

Comment 1 Richard W.M. Jones 2021-03-22 15:09:13 UTC
David - any idea about this one?

Comment 2 Laurent Vivier 2021-03-22 15:13:15 UTC
I think you need:

25edcc50d76c ("KVM: PPC: Book3S HV: Save and restore FSCR in the P9 path")

Comment 3 sadoon_albader 2021-03-22 15:15:36 UTC
Created attachment 1765332 [details]
Core dump

Comment 4 Laurent Vivier 2021-03-22 15:16:17 UTC
The problem happens because glibc uses the new SCV call rather than SC and this needs a kernel support.

This needs kernel support, but included in 5.9

commit 7fa95f9adaee7e5cbb195d3359741120829e488b
Author: Nicholas Piggin <npiggin>
Date:   Thu Jun 11 18:12:03 2020 +1000

    powerpc/64s: system call support for scv/rfscv instructions
    
    Add support for the scv instruction on POWER9 and later CPUs.
    
    For now this implements the zeroth scv vector 'scv 0', as identical to
    'sc' system calls, with the exception that LR is not preserved, nor
    are volatile CR registers, and error is not indicated with CR0[SO],
    but by returning a negative errno.
    
    rfscv is implemented to return from scv type system calls. It can not
    be used to return from sc system calls because those are defined to
    preserve LR.
    
    getpid syscall throughput on POWER9 is improved by 26% (428 to 318
    cycles), largely due to reducing mtmsr and mtspr.
    
    Signed-off-by: Nicholas Piggin <npiggin>
    [mpe: Fix ppc64e build]
    Signed-off-by: Michael Ellerman <mpe.au>
    Link: https://lore.kernel.org/r/20200611081203.995112-3-npiggin@gmail.com

For POWER9, we need also this bugfix:

25edcc50d76c ("KVM: PPC: Book3S HV: Save and restore FSCR in the P9 path")

Comment 5 Richard W.M. Jones 2021-03-22 15:23:37 UTC
Moving to "kernel" component per comment 4.

Comment 6 sadoon_albader 2021-03-23 01:25:31 UTC
(In reply to Laurent Vivier from comment #4)
> The problem happens because glibc uses the new SCV call rather than SC and
> this needs a kernel support.
> 
> This needs kernel support, but included in 5.9
> 
> commit 7fa95f9adaee7e5cbb195d3359741120829e488b
> Author: Nicholas Piggin <npiggin>
> Date:   Thu Jun 11 18:12:03 2020 +1000
> 
>     powerpc/64s: system call support for scv/rfscv instructions
>     
>     Add support for the scv instruction on POWER9 and later CPUs.
>     
>     For now this implements the zeroth scv vector 'scv 0', as identical to
>     'sc' system calls, with the exception that LR is not preserved, nor
>     are volatile CR registers, and error is not indicated with CR0[SO],
>     but by returning a negative errno.
>     
>     rfscv is implemented to return from scv type system calls. It can not
>     be used to return from sc system calls because those are defined to
>     preserve LR.
>     
>     getpid syscall throughput on POWER9 is improved by 26% (428 to 318
>     cycles), largely due to reducing mtmsr and mtspr.
>     
>     Signed-off-by: Nicholas Piggin <npiggin>
>     [mpe: Fix ppc64e build]
>     Signed-off-by: Michael Ellerman <mpe.au>
>     Link: https://lore.kernel.org/r/20200611081203.995112-3-npiggin@gmail.com
> 
> For POWER9, we need also this bugfix:
> 
> 25edcc50d76c ("KVM: PPC: Book3S HV: Save and restore FSCR in the P9 path")

Can confirm that this patch works in ArchPOWER with linux 5.11.7, thank you!
I am not familiar with the build system of Fedora, otherwise I would have tested there too.

Comment 7 David Gibson 2021-03-23 01:27:53 UTC
Right, this looks like a Fedora dupe of the RHEL9 bug 1922974.

Comment 8 Richard W.M. Jones 2021-03-23 09:42:41 UTC
I'm closing this bug as the fix is upstream so it will eventually
make its way through to Fedora.

Comment 9 Dan Horák 2021-03-23 10:04:11 UTC
I would prefer to include the mentioned commit in Fedora 5.11 kernels, there is long time before F-34 will be on 5.12

Comment 10 Dan Horák 2021-03-23 19:54:09 UTC
should be in the next 5.11 build via https://gitlab.com/cki-project/kernel-ark/-/commit/d6e1043c3ee761b14ddae1707e78f10b26868c19

Comment 11 Florian Weimer 2021-03-24 08:29:03 UTC
Does this bug have to be private? Thanks.

Comment 12 Richard W.M. Jones 2021-03-25 10:28:41 UTC
Remove private group.


Note You need to log in before you can comment on or make changes to this bug.