mbox series

[SRU,J,I,F,0/1] KVM nesting support leaks too much memory, might result in stalls during cleanup (LP: 1974017)

Message ID 20220519063923.352540-1-frank.heimes@canonical.com
Headers show
Series KVM nesting support leaks too much memory, might result in stalls during cleanup (LP: 1974017) | expand

Message

Frank Heimes May 19, 2022, 6:39 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1974017

SRU Justification:

[Impact] 

 * If running KVM with nesting support (e.g. 'kvm.nested=1' on the kernel
   command line), the shadow page table code will produce too many entries
   in the shadow code.

 * The below mentioned upstream fix will prevent the entries from being
   piled up, by checking for existing entries at insert time.

 * This measurably reduces the list length and is faster than traversing
   the list at shutdown time only.

[Fix]

 * a06afe8383080c630a7a528b8382fc6bb4925b61 a06afe838308
   "KVM: s390: vsie/gmap: reduce gmap_rmap overhead"

[Test Plan]

 * A IBM zSystems or LinuxONE LPAR on a z13 or newer is needed.

 * Ubuntu focal, impish or jammy needs to be installed
   and the Ubuntu LPAR setup as (1st level) KVM host,
   allowing nested virtualization.

 * Now setup one (or more) KVM virtual machines,
   with similar Ubuntu releases,
   and define one or more of them again as (2nd level) KVM host.

 * Define several KVM virtual machines on this (2nd level) KVM host
   in a memory constraint fashion,
   so that a lot of memory mapping is caused.

 * Let such a system run for a while under load.

 * Now shutdown one (or more) 2nd level VMs and notice the
   time it takes.

 * With the patch in place this time should be considerably
   quicker than without.

 * The result is reduced mapping (gmap_rmap) overhead,
   less danger of leaking memory
   and a better responding system.

[Where problems could occur]

 * In case wrong entries are freed up this will harm the virtual
   memory management and may even lead to crashes.

 * In case the pointer handling is not done properly,
   again crashes may occur.

 * But with net just five new lines the patch is pretty short, readable
   and the modifications traceable in arch/s390/mm/gmap.c only.

 * The changes are limited to s390/mm only,
   hence don't affect other architectures.

[Other Info]
 
 * The commit was upstream accepted in v5.18-rc6.

 * Since the planned target kernel for kinetic is 5.19,
   the kinetic kernel does not need to be patched.

 * Hence the SRUs are for jammy, impish and focal.

Christian Borntraeger (1):
  KVM: s390: vsie/gmap: reduce gmap_rmap overhead

 arch/s390/mm/gmap.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Marcelo Henrique Cerri May 19, 2022, 2:06 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512


Acked-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>

On Thu, May 19 2022, frank.heimes@canonical.com wrote:
> BugLink: https://bugs.launchpad.net/bugs/1974017
>
> SRU Justification:
>
> [Impact]
>
>  * If running KVM with nesting support (e.g. 'kvm.nested=1' on the kernel
>    command line), the shadow page table code will produce too many entries
>    in the shadow code.
>
>  * The below mentioned upstream fix will prevent the entries from being
>    piled up, by checking for existing entries at insert time.
>
>  * This measurably reduces the list length and is faster than traversing
>    the list at shutdown time only.
>
> [Fix]
>
>  * a06afe8383080c630a7a528b8382fc6bb4925b61 a06afe838308
>    "KVM: s390: vsie/gmap: reduce gmap_rmap overhead"
>
> [Test Plan]
>
>  * A IBM zSystems or LinuxONE LPAR on a z13 or newer is needed.
>
>  * Ubuntu focal, impish or jammy needs to be installed
>    and the Ubuntu LPAR setup as (1st level) KVM host,
>    allowing nested virtualization.
>
>  * Now setup one (or more) KVM virtual machines,
>    with similar Ubuntu releases,
>    and define one or more of them again as (2nd level) KVM host.
>
>  * Define several KVM virtual machines on this (2nd level) KVM host
>    in a memory constraint fashion,
>    so that a lot of memory mapping is caused.
>
>  * Let such a system run for a while under load.
>
>  * Now shutdown one (or more) 2nd level VMs and notice the
>    time it takes.
>
>  * With the patch in place this time should be considerably
>    quicker than without.
>
>  * The result is reduced mapping (gmap_rmap) overhead,
>    less danger of leaking memory
>    and a better responding system.
>
> [Where problems could occur]
>
>  * In case wrong entries are freed up this will harm the virtual
>    memory management and may even lead to crashes.
>
>  * In case the pointer handling is not done properly,
>    again crashes may occur.
>
>  * But with net just five new lines the patch is pretty short, readable
>    and the modifications traceable in arch/s390/mm/gmap.c only.
>
>  * The changes are limited to s390/mm only,
>    hence don't affect other architectures.
>
> [Other Info]
>
>  * The commit was upstream accepted in v5.18-rc6.
>
>  * Since the planned target kernel for kinetic is 5.19,
>    the kinetic kernel does not need to be patched.
>
>  * Hence the SRUs are for jammy, impish and focal.
>
> Christian Borntraeger (1):
>   KVM: s390: vsie/gmap: reduce gmap_rmap overhead
>
>  arch/s390/mm/gmap.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> --
> 2.25.1


- --
Regards,
Marcelo
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEExJjLjAfVL0XbfEr56e82LoessAkFAmKGTugACgkQ6e82Loes
sAmwXAwAiThoWY38mmcxP5exK0Og9KdFn9YP8SyG+fdXNq9clyxjHOBBhPRw5KBo
obbp+t788bzQMM1iu+DGBqeQsYhzpbF92lwCtmU5VL7hbjiO6RzFq7+jGxBQDRca
mXWhnjPMgOW/YfMg4R2dF2V/OotwrFA28t7PPmiWBRuhtSlN5kTDquSiVFjDaHgP
KZnnwfmQlsY37ZrN9R9F17HACePziXrryh/y/2BnElZJmSU+L7Zh4jCLs3QT8kB3
VS2eaNGi5AixHLK3tBmunXH+972Z5VbJbgjs0DqT61ZhGnkeIeEipFY+ziPerOhO
b9+oO006l++AJTXEzPGqgd7EtnTf9gB+WT3SnHUc8Vrj/ypR0tWPO4O9/ixp6OjY
23svaE5SxoAVAhbmPvh3O40Oj8vHXppLpv8FjL1mFXb/nCwoB/jN5RKciAQCRI3v
Uz9E+3rZHG5o0ZNgrBHwkGpyXZWYwXigfrgXmgcMgfhCHD88Yqem+bi274Ev3gyM
2dAX2dT0
=rBPE
-----END PGP SIGNATURE-----
Bartlomiej Zolnierkiewicz May 19, 2022, 2:10 p.m. UTC | #2
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>

On Thu, May 19, 2022 at 8:40 AM <frank.heimes@canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/1974017
>
> SRU Justification:
>
> [Impact]
>
>  * If running KVM with nesting support (e.g. 'kvm.nested=1' on the kernel
>    command line), the shadow page table code will produce too many entries
>    in the shadow code.
>
>  * The below mentioned upstream fix will prevent the entries from being
>    piled up, by checking for existing entries at insert time.
>
>  * This measurably reduces the list length and is faster than traversing
>    the list at shutdown time only.
>
> [Fix]
>
>  * a06afe8383080c630a7a528b8382fc6bb4925b61 a06afe838308
>    "KVM: s390: vsie/gmap: reduce gmap_rmap overhead"
>
> [Test Plan]
>
>  * A IBM zSystems or LinuxONE LPAR on a z13 or newer is needed.
>
>  * Ubuntu focal, impish or jammy needs to be installed
>    and the Ubuntu LPAR setup as (1st level) KVM host,
>    allowing nested virtualization.
>
>  * Now setup one (or more) KVM virtual machines,
>    with similar Ubuntu releases,
>    and define one or more of them again as (2nd level) KVM host.
>
>  * Define several KVM virtual machines on this (2nd level) KVM host
>    in a memory constraint fashion,
>    so that a lot of memory mapping is caused.
>
>  * Let such a system run for a while under load.
>
>  * Now shutdown one (or more) 2nd level VMs and notice the
>    time it takes.
>
>  * With the patch in place this time should be considerably
>    quicker than without.
>
>  * The result is reduced mapping (gmap_rmap) overhead,
>    less danger of leaking memory
>    and a better responding system.
>
> [Where problems could occur]
>
>  * In case wrong entries are freed up this will harm the virtual
>    memory management and may even lead to crashes.
>
>  * In case the pointer handling is not done properly,
>    again crashes may occur.
>
>  * But with net just five new lines the patch is pretty short, readable
>    and the modifications traceable in arch/s390/mm/gmap.c only.
>
>  * The changes are limited to s390/mm only,
>    hence don't affect other architectures.
>
> [Other Info]
>
>  * The commit was upstream accepted in v5.18-rc6.
>
>  * Since the planned target kernel for kinetic is 5.19,
>    the kinetic kernel does not need to be patched.
>
>  * Hence the SRUs are for jammy, impish and focal.
>
> Christian Borntraeger (1):
>   KVM: s390: vsie/gmap: reduce gmap_rmap overhead
>
>  arch/s390/mm/gmap.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> --
> 2.25.1
Kleber Souza May 27, 2022, 8:42 a.m. UTC | #3
On 19.05.22 08:39, frank.heimes@canonical.com wrote:
> BugLink: https://bugs.launchpad.net/bugs/1974017
> 
> SRU Justification:
> 
> [Impact]
> 
>   * If running KVM with nesting support (e.g. 'kvm.nested=1' on the kernel
>     command line), the shadow page table code will produce too many entries
>     in the shadow code.
> 
>   * The below mentioned upstream fix will prevent the entries from being
>     piled up, by checking for existing entries at insert time.
> 
>   * This measurably reduces the list length and is faster than traversing
>     the list at shutdown time only.
> 
> [Fix]
> 
>   * a06afe8383080c630a7a528b8382fc6bb4925b61 a06afe838308
>     "KVM: s390: vsie/gmap: reduce gmap_rmap overhead"
> 
> [Test Plan]
> 
>   * A IBM zSystems or LinuxONE LPAR on a z13 or newer is needed.
> 
>   * Ubuntu focal, impish or jammy needs to be installed
>     and the Ubuntu LPAR setup as (1st level) KVM host,
>     allowing nested virtualization.
> 
>   * Now setup one (or more) KVM virtual machines,
>     with similar Ubuntu releases,
>     and define one or more of them again as (2nd level) KVM host.
> 
>   * Define several KVM virtual machines on this (2nd level) KVM host
>     in a memory constraint fashion,
>     so that a lot of memory mapping is caused.
> 
>   * Let such a system run for a while under load.
> 
>   * Now shutdown one (or more) 2nd level VMs and notice the
>     time it takes.
> 
>   * With the patch in place this time should be considerably
>     quicker than without.
> 
>   * The result is reduced mapping (gmap_rmap) overhead,
>     less danger of leaking memory
>     and a better responding system.
> 
> [Where problems could occur]
> 
>   * In case wrong entries are freed up this will harm the virtual
>     memory management and may even lead to crashes.
> 
>   * In case the pointer handling is not done properly,
>     again crashes may occur.
> 
>   * But with net just five new lines the patch is pretty short, readable
>     and the modifications traceable in arch/s390/mm/gmap.c only.
> 
>   * The changes are limited to s390/mm only,
>     hence don't affect other architectures.
> 
> [Other Info]
>   
>   * The commit was upstream accepted in v5.18-rc6.
> 
>   * Since the planned target kernel for kinetic is 5.19,
>     the kinetic kernel does not need to be patched.
> 
>   * Hence the SRUs are for jammy, impish and focal.
> 
> Christian Borntraeger (1):
>    KVM: s390: vsie/gmap: reduce gmap_rmap overhead
> 
>   arch/s390/mm/gmap.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 

Applied to focal/impish/jammy:linux.

Thanks,
Kleber