* [PATCH] KVM: s390: reduce number of IO pins to 1
@ 2020-06-17 8:36 Christian Borntraeger
2020-06-17 10:06 ` Cornelia Huck
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Christian Borntraeger @ 2020-06-17 8:36 UTC (permalink / raw)
To: Janosch Frank
Cc: KVM, Cornelia Huck, Christian Borntraeger, David Hildenbrand,
linux-s390, Paolo Bonzini
The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
allocation (32kb) for each guest start/restart. This can result in OOM
killer activity even with free swap when the memory is fragmented
enough:
kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
kernel: Call Trace:
kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
kernel: [<00000001f8687032>] dump_header+0x62/0x258
kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
As far as I can tell s390x does not use the iopins as we bail our for
anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
reduce the memory footprint.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/include/asm/kvm_host.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index cee3cb6455a2..6ea0820e7c7f 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -31,12 +31,12 @@
#define KVM_USER_MEM_SLOTS 32
/*
- * These seem to be used for allocating ->chip in the routing table,
- * which we don't use. 4096 is an out-of-thin-air value. If we need
- * to look at ->chip later on, we'll need to revisit this.
+ * These seem to be used for allocating ->chip in the routing table, which we
+ * don't use. 1 is as small as we can get to reduce the needed memory. If we
+ * need to look at ->chip later on, we'll need to revisit this.
*/
#define KVM_NR_IRQCHIPS 1
-#define KVM_IRQCHIP_NUM_PINS 4096
+#define KVM_IRQCHIP_NUM_PINS 1
#define KVM_HALT_POLL_NS_DEFAULT 50000
/* s390-specific vcpu->requests bit members */
--
2.25.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 8:36 [PATCH] KVM: s390: reduce number of IO pins to 1 Christian Borntraeger
@ 2020-06-17 10:06 ` Cornelia Huck
2020-06-17 10:19 ` David Hildenbrand
2020-06-18 7:10 ` Christian Borntraeger
2 siblings, 0 replies; 9+ messages in thread
From: Cornelia Huck @ 2020-06-17 10:06 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Janosch Frank, KVM, David Hildenbrand, linux-s390, Paolo Bonzini
On Wed, 17 Jun 2020 10:36:20 +0200
Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
> allocation (32kb) for each guest start/restart. This can result in OOM
> killer activity even with free swap when the memory is fragmented
> enough:
>
> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
> kernel: Call Trace:
> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
> kernel: [<00000001f8687032>] dump_header+0x62/0x258
> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>
> As far as I can tell s390x does not use the iopins as we bail our for
> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
> reduce the memory footprint.
Right, I added that #define when I was not sure yet whether we would
need to support chip/pin routing, and it just was never revisited
again. I think we can safely assume that it is uninteresting on s390.
Getting it down to the minimum seems to be the right thing to do.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/include/asm/kvm_host.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 8:36 [PATCH] KVM: s390: reduce number of IO pins to 1 Christian Borntraeger
2020-06-17 10:06 ` Cornelia Huck
@ 2020-06-17 10:19 ` David Hildenbrand
2020-06-17 11:04 ` Christian Borntraeger
2020-06-18 7:10 ` Christian Borntraeger
2 siblings, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2020-06-17 10:19 UTC (permalink / raw)
To: Christian Borntraeger, Janosch Frank
Cc: KVM, Cornelia Huck, linux-s390, Paolo Bonzini
On 17.06.20 10:36, Christian Borntraeger wrote:
> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
> allocation (32kb) for each guest start/restart. This can result in OOM
> killer activity even with free swap when the memory is fragmented
> enough:
>
> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
> kernel: Call Trace:
> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
> kernel: [<00000001f8687032>] dump_header+0x62/0x258
> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>
> As far as I can tell s390x does not use the iopins as we bail our for
> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
> reduce the memory footprint.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/include/asm/kvm_host.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index cee3cb6455a2..6ea0820e7c7f 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -31,12 +31,12 @@
> #define KVM_USER_MEM_SLOTS 32
>
> /*
> - * These seem to be used for allocating ->chip in the routing table,
> - * which we don't use. 4096 is an out-of-thin-air value. If we need
> - * to look at ->chip later on, we'll need to revisit this.
> + * These seem to be used for allocating ->chip in the routing table, which we
> + * don't use. 1 is as small as we can get to reduce the needed memory. If we
> + * need to look at ->chip later on, we'll need to revisit this.
> */
> #define KVM_NR_IRQCHIPS 1
> -#define KVM_IRQCHIP_NUM_PINS 4096
> +#define KVM_IRQCHIP_NUM_PINS 1
> #define KVM_HALT_POLL_NS_DEFAULT 50000
>
> /* s390-specific vcpu->requests bit members */
>
Guess it doesn't make sense to wrap all the "->chip" handling in a
separate set of defines.
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 10:19 ` David Hildenbrand
@ 2020-06-17 11:04 ` Christian Borntraeger
2020-06-17 11:11 ` Cornelia Huck
2020-06-18 9:07 ` David Hildenbrand
0 siblings, 2 replies; 9+ messages in thread
From: Christian Borntraeger @ 2020-06-17 11:04 UTC (permalink / raw)
To: David Hildenbrand, Janosch Frank
Cc: KVM, Cornelia Huck, linux-s390, Paolo Bonzini
On 17.06.20 12:19, David Hildenbrand wrote:
> On 17.06.20 10:36, Christian Borntraeger wrote:
>> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
>> allocation (32kb) for each guest start/restart. This can result in OOM
>> killer activity even with free swap when the memory is fragmented
>> enough:
>>
>> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
>> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
>> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
>> kernel: Call Trace:
>> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
>> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
>> kernel: [<00000001f8687032>] dump_header+0x62/0x258
>> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
>> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
>> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
>> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
>> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
>> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
>> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
>> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
>> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
>> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
>> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
>> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
>> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>>
>> As far as I can tell s390x does not use the iopins as we bail our for
>> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
>> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
>> reduce the memory footprint.
>>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>> arch/s390/include/asm/kvm_host.h | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>> index cee3cb6455a2..6ea0820e7c7f 100644
>> --- a/arch/s390/include/asm/kvm_host.h
>> +++ b/arch/s390/include/asm/kvm_host.h
>> @@ -31,12 +31,12 @@
>> #define KVM_USER_MEM_SLOTS 32
>>
>> /*
>> - * These seem to be used for allocating ->chip in the routing table,
>> - * which we don't use. 4096 is an out-of-thin-air value. If we need
>> - * to look at ->chip later on, we'll need to revisit this.
>> + * These seem to be used for allocating ->chip in the routing table, which we
>> + * don't use. 1 is as small as we can get to reduce the needed memory. If we
>> + * need to look at ->chip later on, we'll need to revisit this.
>> */
>> #define KVM_NR_IRQCHIPS 1
>> -#define KVM_IRQCHIP_NUM_PINS 4096
>> +#define KVM_IRQCHIP_NUM_PINS 1
>> #define KVM_HALT_POLL_NS_DEFAULT 50000
>>
>> /* s390-specific vcpu->requests bit members */
>>
>
> Guess it doesn't make sense to wrap all the "->chip" handling in a
> separate set of defines.
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
I guess this is just the most simple solution. I am asking myself if I should add
cc stable of Fixes as I was able to trigger this by having several guests with a
reboot loop and several guests that trigger memory overcommitment.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 11:04 ` Christian Borntraeger
@ 2020-06-17 11:11 ` Cornelia Huck
2020-06-17 11:13 ` Christian Borntraeger
2020-06-18 9:07 ` David Hildenbrand
1 sibling, 1 reply; 9+ messages in thread
From: Cornelia Huck @ 2020-06-17 11:11 UTC (permalink / raw)
To: Christian Borntraeger
Cc: David Hildenbrand, Janosch Frank, KVM, linux-s390, Paolo Bonzini
On Wed, 17 Jun 2020 13:04:52 +0200
Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> On 17.06.20 12:19, David Hildenbrand wrote:
> > On 17.06.20 10:36, Christian Borntraeger wrote:
> >> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
> >> allocation (32kb) for each guest start/restart. This can result in OOM
> >> killer activity even with free swap when the memory is fragmented
> >> enough:
> >>
> >> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
> >> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
> >> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
> >> kernel: Call Trace:
> >> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
> >> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
> >> kernel: [<00000001f8687032>] dump_header+0x62/0x258
> >> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
> >> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
> >> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
> >> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
> >> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
> >> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
> >> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
> >> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
> >> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
> >> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
> >> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
> >> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
> >> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
> >>
> >> As far as I can tell s390x does not use the iopins as we bail our for
> >> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
> >> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
> >> reduce the memory footprint.
> >>
> >> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> >> ---
> >> arch/s390/include/asm/kvm_host.h | 8 ++++----
> >> 1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> >> index cee3cb6455a2..6ea0820e7c7f 100644
> >> --- a/arch/s390/include/asm/kvm_host.h
> >> +++ b/arch/s390/include/asm/kvm_host.h
> >> @@ -31,12 +31,12 @@
> >> #define KVM_USER_MEM_SLOTS 32
> >>
> >> /*
> >> - * These seem to be used for allocating ->chip in the routing table,
> >> - * which we don't use. 4096 is an out-of-thin-air value. If we need
> >> - * to look at ->chip later on, we'll need to revisit this.
> >> + * These seem to be used for allocating ->chip in the routing table, which we
> >> + * don't use. 1 is as small as we can get to reduce the needed memory. If we
> >> + * need to look at ->chip later on, we'll need to revisit this.
> >> */
> >> #define KVM_NR_IRQCHIPS 1
> >> -#define KVM_IRQCHIP_NUM_PINS 4096
> >> +#define KVM_IRQCHIP_NUM_PINS 1
> >> #define KVM_HALT_POLL_NS_DEFAULT 50000
> >>
> >> /* s390-specific vcpu->requests bit members */
> >>
> >
> > Guess it doesn't make sense to wrap all the "->chip" handling in a
> > separate set of defines.
> >
> > Reviewed-by: David Hildenbrand <david@redhat.com>
>
> I guess this is just the most simple solution. I am asking myself if I should add
> cc stable of Fixes as I was able to trigger this by having several guests with a
> reboot loop and several guests that trigger memory overcommitment.
>
Not sure if I would count this as a real bug -- it's mostly just that a
large enough memory allocation may fail or draw the wrath of the oom
killer. It still sucks; but I'm wondering why we trigger this after
seven years.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 11:11 ` Cornelia Huck
@ 2020-06-17 11:13 ` Christian Borntraeger
0 siblings, 0 replies; 9+ messages in thread
From: Christian Borntraeger @ 2020-06-17 11:13 UTC (permalink / raw)
To: Cornelia Huck
Cc: David Hildenbrand, Janosch Frank, KVM, linux-s390, Paolo Bonzini
On 17.06.20 13:11, Cornelia Huck wrote:
> On Wed, 17 Jun 2020 13:04:52 +0200
> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>
>> On 17.06.20 12:19, David Hildenbrand wrote:
>>> On 17.06.20 10:36, Christian Borntraeger wrote:
>>>> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
>>>> allocation (32kb) for each guest start/restart. This can result in OOM
>>>> killer activity even with free swap when the memory is fragmented
>>>> enough:
>>>>
>>>> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
>>>> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
>>>> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
>>>> kernel: Call Trace:
>>>> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
>>>> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
>>>> kernel: [<00000001f8687032>] dump_header+0x62/0x258
>>>> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
>>>> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
>>>> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
>>>> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
>>>> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
>>>> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
>>>> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
>>>> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
>>>> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
>>>> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
>>>> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
>>>> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
>>>> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>>>>
>>>> As far as I can tell s390x does not use the iopins as we bail our for
>>>> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
>>>> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
>>>> reduce the memory footprint.
>>>>
>>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>>> ---
>>>> arch/s390/include/asm/kvm_host.h | 8 ++++----
>>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>>>> index cee3cb6455a2..6ea0820e7c7f 100644
>>>> --- a/arch/s390/include/asm/kvm_host.h
>>>> +++ b/arch/s390/include/asm/kvm_host.h
>>>> @@ -31,12 +31,12 @@
>>>> #define KVM_USER_MEM_SLOTS 32
>>>>
>>>> /*
>>>> - * These seem to be used for allocating ->chip in the routing table,
>>>> - * which we don't use. 4096 is an out-of-thin-air value. If we need
>>>> - * to look at ->chip later on, we'll need to revisit this.
>>>> + * These seem to be used for allocating ->chip in the routing table, which we
>>>> + * don't use. 1 is as small as we can get to reduce the needed memory. If we
>>>> + * need to look at ->chip later on, we'll need to revisit this.
>>>> */
>>>> #define KVM_NR_IRQCHIPS 1
>>>> -#define KVM_IRQCHIP_NUM_PINS 4096
>>>> +#define KVM_IRQCHIP_NUM_PINS 1
>>>> #define KVM_HALT_POLL_NS_DEFAULT 50000
>>>>
>>>> /* s390-specific vcpu->requests bit members */
>>>>
>>>
>>> Guess it doesn't make sense to wrap all the "->chip" handling in a
>>> separate set of defines.
>>>
>>> Reviewed-by: David Hildenbrand <david@redhat.com>
>>
>> I guess this is just the most simple solution. I am asking myself if I should add
>> cc stable of Fixes as I was able to trigger this by having several guests with a
>> reboot loop and several guests that trigger memory overcommitment.
>>
>
> Not sure if I would count this as a real bug -- it's mostly just that a
> large enough memory allocation may fail or draw the wrath of the oom
> killer. It still sucks; but I'm wondering why we trigger this after
> seven years.
I think it is just that every kernel has a different threshold regarding "did
I made forward progress in freeing enough memory before I trigger the OOM killer"
I had to make it run very long with heavy overcommitment.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 11:04 ` Christian Borntraeger
2020-06-17 11:11 ` Cornelia Huck
@ 2020-06-18 9:07 ` David Hildenbrand
2020-06-23 8:06 ` Janosch Frank
1 sibling, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2020-06-18 9:07 UTC (permalink / raw)
To: Christian Borntraeger, Janosch Frank
Cc: KVM, Cornelia Huck, linux-s390, Paolo Bonzini
On 17.06.20 13:04, Christian Borntraeger wrote:
>
>
> On 17.06.20 12:19, David Hildenbrand wrote:
>> On 17.06.20 10:36, Christian Borntraeger wrote:
>>> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
>>> allocation (32kb) for each guest start/restart. This can result in OOM
>>> killer activity even with free swap when the memory is fragmented
>>> enough:
>>>
>>> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
>>> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
>>> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
>>> kernel: Call Trace:
>>> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
>>> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
>>> kernel: [<00000001f8687032>] dump_header+0x62/0x258
>>> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
>>> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
>>> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
>>> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
>>> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
>>> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
>>> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
>>> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
>>> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
>>> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
>>> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
>>> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
>>> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>>>
>>> As far as I can tell s390x does not use the iopins as we bail our for
>>> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
>>> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
>>> reduce the memory footprint.
>>>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>> ---
>>> arch/s390/include/asm/kvm_host.h | 8 ++++----
>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>>> index cee3cb6455a2..6ea0820e7c7f 100644
>>> --- a/arch/s390/include/asm/kvm_host.h
>>> +++ b/arch/s390/include/asm/kvm_host.h
>>> @@ -31,12 +31,12 @@
>>> #define KVM_USER_MEM_SLOTS 32
>>>
>>> /*
>>> - * These seem to be used for allocating ->chip in the routing table,
>>> - * which we don't use. 4096 is an out-of-thin-air value. If we need
>>> - * to look at ->chip later on, we'll need to revisit this.
>>> + * These seem to be used for allocating ->chip in the routing table, which we
>>> + * don't use. 1 is as small as we can get to reduce the needed memory. If we
>>> + * need to look at ->chip later on, we'll need to revisit this.
>>> */
>>> #define KVM_NR_IRQCHIPS 1
>>> -#define KVM_IRQCHIP_NUM_PINS 4096
>>> +#define KVM_IRQCHIP_NUM_PINS 1
>>> #define KVM_HALT_POLL_NS_DEFAULT 50000
>>>
>>> /* s390-specific vcpu->requests bit members */
>>>
>>
>> Guess it doesn't make sense to wrap all the "->chip" handling in a
>> separate set of defines.
>>
>> Reviewed-by: David Hildenbrand <david@redhat.com>
>
> I guess this is just the most simple solution. I am asking myself if I should add
> cc stable of Fixes as I was able to trigger this by having several guests with a
> reboot loop and several guests that trigger memory overcommitment.
>
I don't think this classifies as stable material.
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-18 9:07 ` David Hildenbrand
@ 2020-06-23 8:06 ` Janosch Frank
0 siblings, 0 replies; 9+ messages in thread
From: Janosch Frank @ 2020-06-23 8:06 UTC (permalink / raw)
To: David Hildenbrand, Christian Borntraeger, Janosch Frank
Cc: KVM, Cornelia Huck, linux-s390, Paolo Bonzini
[-- Attachment #1.1: Type: text/plain, Size: 3878 bytes --]
On 6/18/20 11:07 AM, David Hildenbrand wrote:
> On 17.06.20 13:04, Christian Borntraeger wrote:
>>
>>
>> On 17.06.20 12:19, David Hildenbrand wrote:
>>> On 17.06.20 10:36, Christian Borntraeger wrote:
>>>> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
>>>> allocation (32kb) for each guest start/restart. This can result in OOM
>>>> killer activity even with free swap when the memory is fragmented
>>>> enough:
>>>>
>>>> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
>>>> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
>>>> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
>>>> kernel: Call Trace:
>>>> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
>>>> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
>>>> kernel: [<00000001f8687032>] dump_header+0x62/0x258
>>>> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
>>>> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
>>>> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
>>>> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
>>>> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
>>>> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
>>>> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
>>>> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
>>>> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
>>>> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
>>>> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
>>>> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
>>>> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>>>>
>>>> As far as I can tell s390x does not use the iopins as we bail our for
>>>> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
>>>> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
>>>> reduce the memory footprint.
>>>>
>>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>>> ---
>>>> arch/s390/include/asm/kvm_host.h | 8 ++++----
>>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>>>> index cee3cb6455a2..6ea0820e7c7f 100644
>>>> --- a/arch/s390/include/asm/kvm_host.h
>>>> +++ b/arch/s390/include/asm/kvm_host.h
>>>> @@ -31,12 +31,12 @@
>>>> #define KVM_USER_MEM_SLOTS 32
>>>>
>>>> /*
>>>> - * These seem to be used for allocating ->chip in the routing table,
>>>> - * which we don't use. 4096 is an out-of-thin-air value. If we need
>>>> - * to look at ->chip later on, we'll need to revisit this.
>>>> + * These seem to be used for allocating ->chip in the routing table, which we
>>>> + * don't use. 1 is as small as we can get to reduce the needed memory. If we
>>>> + * need to look at ->chip later on, we'll need to revisit this.
>>>> */
>>>> #define KVM_NR_IRQCHIPS 1
>>>> -#define KVM_IRQCHIP_NUM_PINS 4096
>>>> +#define KVM_IRQCHIP_NUM_PINS 1
>>>> #define KVM_HALT_POLL_NS_DEFAULT 50000
>>>>
>>>> /* s390-specific vcpu->requests bit members */
>>>>
>>>
>>> Guess it doesn't make sense to wrap all the "->chip" handling in a
>>> separate set of defines.
>>>
>>> Reviewed-by: David Hildenbrand <david@redhat.com>
>>
>> I guess this is just the most simple solution. I am asking myself if I should add
>> cc stable of Fixes as I was able to trigger this by having several guests with a
>> reboot loop and several guests that trigger memory overcommitment.
>>
>
> I don't think this classifies as stable material.
>
I'd like to have it in stable.
I'm not looking forward to getting bugzillas after distro tests and then
telling them that we already have a patch for that.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] KVM: s390: reduce number of IO pins to 1
2020-06-17 8:36 [PATCH] KVM: s390: reduce number of IO pins to 1 Christian Borntraeger
2020-06-17 10:06 ` Cornelia Huck
2020-06-17 10:19 ` David Hildenbrand
@ 2020-06-18 7:10 ` Christian Borntraeger
2 siblings, 0 replies; 9+ messages in thread
From: Christian Borntraeger @ 2020-06-18 7:10 UTC (permalink / raw)
To: Janosch Frank
Cc: KVM, Cornelia Huck, David Hildenbrand, linux-s390, Paolo Bonzini
On 17.06.20 10:36, Christian Borntraeger wrote:
> The current number of KVM_IRQCHIP_NUM_PINS results in an order 3
> allocation (32kb) for each guest start/restart. This can result in OOM
> killer activity even with free swap when the memory is fragmented
> enough:
>
> kernel: qemu-system-s39 invoked oom-killer: gfp_mask=0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_COMP|__GFP_ZERO), order=3, oom_score_adj=0
> kernel: CPU: 1 PID: 357274 Comm: qemu-system-s39 Kdump: loaded Not tainted 5.4.0-29-generic #33-Ubuntu
> kernel: Hardware name: IBM 8562 T02 Z06 (LPAR)
> kernel: Call Trace:
> kernel: ([<00000001f848fe2a>] show_stack+0x7a/0xc0)
> kernel: [<00000001f8d3437a>] dump_stack+0x8a/0xc0
> kernel: [<00000001f8687032>] dump_header+0x62/0x258
> kernel: [<00000001f8686122>] oom_kill_process+0x172/0x180
> kernel: [<00000001f8686abe>] out_of_memory+0xee/0x580
> kernel: [<00000001f86e66b8>] __alloc_pages_slowpath+0xd18/0xe90
> kernel: [<00000001f86e6ad4>] __alloc_pages_nodemask+0x2a4/0x320
> kernel: [<00000001f86b1ab4>] kmalloc_order+0x34/0xb0
> kernel: [<00000001f86b1b62>] kmalloc_order_trace+0x32/0xe0
> kernel: [<00000001f84bb806>] kvm_set_irq_routing+0xa6/0x2e0
> kernel: [<00000001f84c99a4>] kvm_arch_vm_ioctl+0x544/0x9e0
> kernel: [<00000001f84b8936>] kvm_vm_ioctl+0x396/0x760
> kernel: [<00000001f875df66>] do_vfs_ioctl+0x376/0x690
> kernel: [<00000001f875e304>] ksys_ioctl+0x84/0xb0
> kernel: [<00000001f875e39a>] __s390x_sys_ioctl+0x2a/0x40
> kernel: [<00000001f8d55424>] system_call+0xd8/0x2c8
>
> As far as I can tell s390x does not use the iopins as we bail our for
> anything other than KVM_IRQ_ROUTING_S390_ADAPTER and the chip/pin is
> only used for KVM_IRQ_ROUTING_IRQCHIP. So let us use a small number to
> reduce the memory footprint.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
applied.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-06-23 8:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17 8:36 [PATCH] KVM: s390: reduce number of IO pins to 1 Christian Borntraeger
2020-06-17 10:06 ` Cornelia Huck
2020-06-17 10:19 ` David Hildenbrand
2020-06-17 11:04 ` Christian Borntraeger
2020-06-17 11:11 ` Cornelia Huck
2020-06-17 11:13 ` Christian Borntraeger
2020-06-18 9:07 ` David Hildenbrand
2020-06-23 8:06 ` Janosch Frank
2020-06-18 7:10 ` Christian Borntraeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox