Bug 2130487 - Backport latest fixes from upstream s390x KVM for the RHEL 9.2 kernel
Summary: Backport latest fixes from upstream s390x KVM for the RHEL 9.2 kernel
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: kernel
Version: 9.2
Hardware: s390x
OS: Linux
medium
medium
Target Milestone: rc
: 9.2
Assignee: Thomas Huth
QA Contact: bfu
URL:
Whiteboard:
: 2087766 2160042 (view as bug list)
Depends On: 2119111
Blocks: 2095748 2116377 1871143 2038729 2044301 2111086
TreeView+ depends on / blocked
 
Reported: 2022-09-28 10:35 UTC by Thomas Huth
Modified: 2023-07-03 12:33 UTC (History)
8 users (show)

Fixed In Version: kernel-5.14.0-189.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 08:03:50 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/centos-stream/src/kernel centos-stream-9 merge_requests 1545 0 None opened KVM on s390x resync, Protected dump, Enhanced Interpretation for PCI Functions and CPU topology 2022-10-28 12:54:22 UTC
IBM Linux Technology Center 200091 0 None None None 2022-11-08 14:46:21 UTC
Red Hat Bugzilla 2072041 1 None None None 2023-04-28 06:59:17 UTC
Red Hat Bugzilla 2169293 1 None None None 2023-06-17 05:52:08 UTC
Red Hat Issue Tracker RHELPLAN-135128 0 None None None 2022-09-28 10:38:34 UTC
Red Hat Product Errata RHSA-2023:2458 0 None None None 2023-05-09 08:04:31 UTC

Internal Links: 2072041 2169293

Description Thomas Huth 2022-09-28 10:35:47 UTC
Description of problem:
We should make sure to pull in the latest upstream fixes and improvements for the s390x KVM code. Suggested upstream kernel target: 6.0

Ideally, we could also handle the following BZs with this sync in one go:

- https://bugzilla.redhat.com/show_bug.cgi?id=2044301
  ("Secure Execution guest dump encryption with customer keys")

- https://bugzilla.redhat.com/show_bug.cgi?id=2111086
  ("Provide virtual CPU topology to guests")

- https://bugzilla.redhat.com/show_bug.cgi?id=1871143
  ("Enhanced Interpretation for PCI Functions (kvm)")

Comment 1 Thomas Huth 2022-10-10 09:48:50 UTC
Suggested list of patches:

# BZ 2130487 (KVM mass backport, part 1):
ec5c86976674 KVM: s390: Skip gfn/size sanity checks on memslot DELETE or FLAGS_ONLY
f786ab1bf17a KVM: s390: Use Makefile.kvm for common files
15b5c1833afc s390/uv: fix memblock virtual vs physical address confusion
3c724f1a1caa s390: uv: Add offset comments to UV query struct and fix naming
c783631b0bff KVM: s390: Don't indicate suppression on dirtying, failing memop
6d5946274df1 s390/gmap: voluntarily schedule during key setting
3ae11dbcfac9 s390/mm: use non-quiescing sske for KVM switch to keyed guest

# BZ 2044301 (dump feature):
ac640db3a026 s390/uv: Add SE hdr query information
38c218259d4c s390/uv: Add dump fields to query
35d02493dba1 KVM: s390: pv: Add query interface
06eb3388e703 KVM: s390: pv: Add dump support definitions
fe9a93e07ba4 KVM: s390: pv: Add query dump information
0460eb35b443 KVM: s390: Add configuration dump functionality
8aba09588d2a KVM: s390: Add CPU dump functionality
e9bf3acb23f0 KVM: s390: Add KVM_CAP_S390_PROTECTED_DUMP
daec8d408308 Documentation: KVM: add separate directories ...
660a28653d83 Documentation: virt: Protected virtual machine dumps
cde363ab7ca7 Documentation: KVM: add API issues section
437cfd714db9 Documentation/virt/kvm/api.rst: Add protvirt dump/info api descriptions  # needs tweaking
b0f46280d3fc Documentation/virt/kvm/api.rst: Explain rc/rrc delivery  # needs tweaking

# PCI code sync (needed for BZ 1871143):
81a076171e72 s390/pci: reset zdev->zbus on registration failure
f7addcdd527a s390/pci: fix misleading rc in clp_set_pci_fn()
8256adda1f44 s390/pci: handle FH state mismatch only on disable
cc049eecfb7a s390/pci: simplify CLP List PCI handling
1f3f76812d5d s390/pci: improve DMA translation init and exit
ebd9cc659369 s390/pci: fix clp_get_state() handling of -ENODEV
85ad27215ca5 s390/pci: read clp_list_pci_req only once
a8b92b8c1eac s390/pci_mmio: fully validate the VMA before calling follow_pte()
1c8174fdc798 s390/pci: tolerate inconsistent handle in recover
6526a597a2e8 s390/pci: add simpler s390dbf traces for events
4fe204977096 s390/pci: refresh function handle in iomap
da995d538d3a s390/pci: implement reset_slot for hotplug slot
4cdf2f4e24ff s390/pci: implement minimal PCI error recovery
4e4dc65ab578 s390/pci: use phys_to_virt() for AIBVs/DIBVs
568de506e317 s390/pci: use physical addresses in DMA tables
7b2932162f66 s390/pci: simplify __pciwb_mio() inline asm
6c2797cd5121 s390/pci: make zpci_set_irq()/zpci_clear_irq() static
c122383d221d s390/pci: improve zpci_dev reference counting
7dcfe50f58d2 s390/pci: rename get_zdev_by_bus() to zdev_from_bus()
52c79e636a58 s390/pci: make better use of zpci_dbg() levels
723b5a9d2bb0 s390/pci: don't log availability events as errors
cde8833e40dd s390/pci: add PCI access type and length to error records
34fb0e703480 s390/pci: add error record for CC 2 retries

# BZ 1871143 (PCI enhancement):
1b553839e132 s390/sclp: add detection of IPL-complete-control facility
e3d27b62110c s390/sclp: detect the zPCI load/store interpretation facility
9db153f45230 s390/sclp: detect the AISII facility
efef0db77c93 s390/sclp: detect the AENI facility
b05a870c5e4e s390/sclp: detect the AISI facility
948e50551b9a s390/ap: fix kernel doc comments                 # needs tweaking
d2197485a188 s390/airq: pass more TPI info to airq handlers   # needs tweaking
932b646727f9 s390/airq: allow for airq structure that uses an input vector
062f002485d4 s390/pci: externalize the SIC operation controls and routine
c68468ed3416 s390/pci: stash associated GISA designation
d10384677630 s390/pci: stash dtsm and maxstbl
c435c54639aa vfio/pci: introduce CONFIG_VFIO_PCI_ZDEV_KVM
6438e30714ab KVM: s390: pci: add basic kvm_zdev structure
98b1d33dac5f KVM: s390: pci: do initial setup for AEN interpretation
73f91b004321 KVM: s390: pci: enable host forwarding of Adapter Event Notifications
3f4bbb4342ec KVM: s390: mechanism to enable guest zPCI Interpretation
3c5a1b6f0a18 KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding
09340b2fca00 KVM: s390: pci: add routines to start/stop interpretive execution
8061d1c31f1a vfio-pci/zdev: add open/close device hooks
faf3bfcb8950 vfio-pci/zdev: add function handle to clp base capability
ba6090ff8ae0 vfio-pci/zdev: different maxstbl for interpreted devices
db1c875e0539 KVM: s390: add KVM_S390_ZPCI_OP to manage guest zPCI devices
4ac34b94a534 MAINTAINERS: additional files related kvm s390 pci passthrough
5efab5cdf06b Documentation: kvm: extend KVM_S390_ZPCI_OP subheading underline  ## later?
ca922fecda6c KVM: s390: pci: Hook to access KVM lowlevel from VFIO
189e7d876e48 KVM: s390: pci: register pci hooks without interpretation
6131fd198099 KVM: s390/pci: fix include duplicates
e8c924a4fb6e KVM: s390: pci: fix plain integer as NULL pointer warnings
70ba8fae2775 KVM: s390: pci: fix GAIT physical vs virtual pointers usage

# BZ 2130487 (KVM mass backport, part 2):
da0f8e957be9 KVM: s390: replace bitmap_copy with bitmap_{from,to}_arr64 where appropriate
b9df116cb765 KVM: s390: drop unexpected word 'and' in the comments
1b6abe95b522 s390: Add attestation query information
faa2f72cb356 KVM: s390: pv: leak the topmost page table when destroy fails
a52c25848e31 KVM: s390: pv: handle secure storage violations for protected guests
6f73517d0a99 KVM: s390: pv: refactor s390_reset_acc
07fbdf7f9347 KVM: s390: pv: usage counter instead of flag
72b1daff2671 KVM: s390: pv: add export before import
e40df9efd68a KVM: s390: pv: clear the state without memset
be48d86f77f0 KVM: s390: pv: Add kvm_s390_cpus_from_pv to kvm-s390.h and add documentation
ca2fd0609b5d KVM: s390: pv: add mmu_notifier
da15fbc646f3 KVM: s390: pv: refactoring of kvm_s390_pv_deinit_vm
7746f735f552 KVM: s390: pv: destroy the configuration before its memory
b3cefd6bf16e KVM: s390: Pass initialized arg even if unused

# BZ 2111086 (topology):
0130337ec45b KVM: s390: Cleanup ipte lock access and SIIF facility checks
24fe0195bc19 KVM: s390: guest support for topology function
f5ecfee94493 KVM: s390: resetting the Topology-Change-Report
25f308951703 tools headers kvm s390: Sync headers with the kernel sources

Comment 2 IBM Bug Proxy 2022-10-10 10:11:09 UTC
------- Comment From cborntra.com 2022-10-10 06:01 EDT-------
(In reply to comment #6)
> Suggested list of patches:
[...]

Is there maybe a diff from the result to the respective upstream kernel for

arch/s390/kvm/ \
arch/s390/include/uapi/asm/kvm.h \
arch/s390/include/asm/kvm_host.h \
include/uapi/linux/kvm.h \
arch/s390/include/asm/sclp.h \
arch/s390/include/asm/mmu.h \
arch/s390/include/asm/mmu_context.h \
arch/s390/include/asm/pgalloc.h \
arch/s390/include/asm/pgtable.h \
arch/s390/kvm/Kconfig \
drivers/s390/char/sclp_early.c \
drivers/s390/char/sclp_config.c \
drivers/s390/char/sclp_cmd.c \
virt/kvm/
?

That might be easier to review than the commit list

Comment 3 Thomas Huth 2022-10-10 10:38:52 UTC
Christian, I've pushed a preview here: https://gitlab.com/thuth/kernel-cs-9/-/commits/bz2130487preview

I hope that should give you the possibility to diff the files that you want - if not, please let me know, then I'll try to create a diff for you.

Comment 4 IBM Bug Proxy 2022-10-10 12:40:55 UTC
------- Comment From cborntra.com 2022-10-10 08:37 EDT-------
(In reply to comment #8)
> Christian, I've pushed a preview here:
> https://gitlab.com/thuth/kernel-cs-9/-/commits/bz2130487preview
>
> I hope that should give you the possibility to diff the files that you want
> - if not, please let me know, then I'll try to create a diff for you.

Looks mostly good. The only thing which might be missing is

commit 82cc27eff4486f8e79ef8faac1af1f5573039aa4
Author:     Vitaly Kuznetsov <vkuznets>
AuthorDate: Tue Nov 16 17:34:42 2021 +0100
Commit:     Paolo Bonzini <pbonzini>
CommitDate: Thu Nov 18 02:12:15 2021 -0500

KVM: s390: Cap KVM_CAP_NR_VCPUS by num_online_cpus()

Comment 5 IBM Bug Proxy 2022-10-10 13:10:36 UTC
------- Comment From cborntra.com 2022-10-10 09:06 EDT-------
And I had to revert
commit 71c243db4353e3fff7240289ea2bc940e6fb36a3
Author:     Thomas Huth <thuth>
AuthorDate: Mon Oct 10 04:22:29 2022 +0200
Commit:     Thomas Huth <thuth>
CommitDate: Mon Oct 10 04:22:29 2022 +0200

KVM: s390: replace bitmap_copy with bitmap_{from,to}_arr64 where appropriate

Comment 6 Thomas Huth 2022-10-10 17:20:42 UTC
(In reply to IBM Bug Proxy from comment #4)
> ------- Comment From cborntra.com 2022-10-10 08:37 EDT-------
> Looks mostly good. The only thing which might be missing is
> 
> commit 82cc27eff4486f8e79ef8faac1af1f5573039aa4
> KVM: s390: Cap KVM_CAP_NR_VCPUS by num_online_cpus()

Yes, I've had that in my hands already, but decided to omit it this time - it was causing some problems for us in RHEL 8.7/9.1 due to another downstream-only qemu-kvm patch. It had been fixed there already, but in case somebody still wants to run an exotic setup like qemu-kvm from 9.0/8.6 in a container on a 9.2 host, it could still trigger with those old builds. Thus let's better play safe and don't change it in RHEL 9.2.

Comment 7 Thomas Huth 2022-10-10 17:22:18 UTC
(In reply to IBM Bug Proxy from comment #5)
> ------- Comment From cborntra.com 2022-10-10 09:06 EDT-------
> And I had to revert
> commit 71c243db4353e3fff7240289ea2bc940e6fb36a3
> KVM: s390: replace bitmap_copy with bitmap_{from,to}_arr64 where appropriate

Thanks for the hint - and sorry for that - we had a system outage today, so I did not compile-test the last bunch of patches on the stack :-/

Comment 13 bfu 2022-11-08 03:44:06 UTC
Critical regression tests have a PASS, add Verified: tested in this bz

Comment 17 smitterl 2022-11-09 09:37:04 UTC
Setting verified with kernel-5.14.0-189.el9 and we'll track IBM's verification of BZs whose patches are part of this very MR correspondingly there.

Comment 18 Tobias Huschle (IBM) 2022-11-10 07:14:43 UTC
*** Bug 2087766 has been marked as a duplicate of this bug. ***

Comment 20 errata-xmlrpc 2023-05-09 08:03:50 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 (Important: kernel security, 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/RHSA-2023:2458

Comment 21 Steve Best 2023-07-03 12:33:13 UTC
*** Bug 2160042 has been marked as a duplicate of this bug. ***


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