Skip to contentSkip to conversation

KVM: s390: introduce module parameter kvm.use_gisa

PATCH Applied Michael Mueller 4 participants 14 messages Feb 27, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: s390: introduce module parameter kvm.use_gisa

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

  # cat /sys/module/kvm/parameters/use_gisa
  Y

The parameter can be changed on the fly.

  # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

  # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
  00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
  00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
  ...
  00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
 arch/s390/kvm/kvm-s390.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +7 -1
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
 module_param(halt_poll_max_steal, byte, 0644);
 MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
 /*
  * For now we handle at most 16 double words as this is what the s390 base
  * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm->arch.use_skf = sclp.has_skey;
 	spin_lock_init(&kvm->arch.start_stop_lock);
 	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);
 	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
 	return 0;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 49 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

  # cat /sys/module/kvm/parameters/use_gisa
  Y

The parameter can be changed on the fly.

  # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

  # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
  00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
  00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
  ...
  00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
 arch/s390/kvm/kvm-s390.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +5 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
 module_param(halt_poll_max_steal, byte, 0644);
 MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
 /*
  * For now we handle at most 16 double words as this is what the s390 base
  * kernel handles and stores in the prefix page. If we ever need to go beyond

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2513

Quoted 6 lines
arch/s390/kvm/kvm-s390.c +2 -1
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm->arch.use_skf = sclp.has_skey;
 	spin_lock_init(&kvm->arch.start_stop_lock);
 	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);

Looks sane to me. gi->origin will remain NULL and act like css_general_characteristics.aiv wouldn't be around.

I assume initializing the gib is fine, and having some guests use it and others not?

I do wonder if it would be even clearer/cleaner to not allow to change this property on the fly, and to also not init the gib if disabled.

If you want to perform performance tests, simply unload+reload KVM.

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 51 lines · David Hildenbrand
Quoted 50 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

   # cat /sys/module/kvm/parameters/use_gisa
   Y

The parameter can be changed on the fly.

   # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

   # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
   00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
   00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
   ...
   00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
  arch/s390/kvm/kvm-s390.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +5 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
  module_param(halt_poll_max_steal, byte, 0644);
  MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
  /*
   * For now we handle at most 16 double words as this is what the s390 base
   * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
  	kvm->arch.use_skf = sclp.has_skey;
Quoted 8 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2513

Quoted 5 lines
arch/s390/kvm/kvm-s390.c +2 -1
  	spin_lock_init(&kvm->arch.start_stop_lock);
  	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);

Looks sane to me. gi->origin will remain NULL and act like css_general_characteristics.aiv wouldn't be around.

right

Quoted 3 lines

I assume initializing the gib is fine, and having some guests use it and others not?

Is fine as well.

Quoted 5 lines

I do wonder if it would be even clearer/cleaner to not allow to change this property on the fly, and to also not init the gib if disabled.

If you want to perform performance tests, simply unload+reload KVM.

That would work if kvm is build as module but not in-kernel, then a reboot would be required with kvm.use_gisa=Y/N

I tend to leave it as it is.

Thanks,
Michael

Quoted 1 line
Reviewed-by
#3 lore raw
Quoted 72 lines · Michael Mueller
Quoted 51 lines · David Hildenbrand
Quoted 50 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

   # cat /sys/module/kvm/parameters/use_gisa
   Y

The parameter can be changed on the fly.

   # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

   # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
   00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
   00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
   ...
   00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
  arch/s390/kvm/kvm-s390.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +5 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
  module_param(halt_poll_max_steal, byte, 0644);
  MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
  /*
   * For now we handle at most 16 double words as this is what the s390 base
   * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
  	kvm->arch.use_skf = sclp.has_skey;
Quoted 8 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2513

Quoted 5 lines
arch/s390/kvm/kvm-s390.c +2 -1
  	spin_lock_init(&kvm->arch.start_stop_lock);
  	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);

Looks sane to me. gi->origin will remain NULL and act like css_general_characteristics.aiv wouldn't be around.

right

Quoted 3 lines

I assume initializing the gib is fine, and having some guests use it and others not?

Is fine as well.

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

I do wonder if it would be even clearer/cleaner to not allow to change this property on the fly, and to also not init the gib if disabled.

If you want to perform performance tests, simply unload+reload KVM.

That would work if kvm is build as module but not in-kernel, then

Right, but AFAIK that's not an usual setup (at least in distros) - and for testing purposes not an issue as well.

Anyhow, I'm fine with this

Thanks!

Signature · 3 lines
Thanks,

David / dhildenb
#4 lore raw
Quoted 78 lines · David Hildenbrand
Quoted 77 lines · Michael Mueller
Quoted 51 lines · David Hildenbrand
Quoted 50 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

    # cat /sys/module/kvm/parameters/use_gisa
    Y

The parameter can be changed on the fly.

    # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

    # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
    00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
    00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
    ...
    00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
   arch/s390/kvm/kvm-s390.c | 8 +++++++-
   1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +5 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
   module_param(halt_poll_max_steal, byte, 0644);
   MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
   /*
    * For now we handle at most 16 double words as this is what the s390 base
    * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
   	kvm->arch.use_skf = sclp.has_skey;
Quoted 8 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2513

Quoted 5 lines
arch/s390/kvm/kvm-s390.c +2 -1
   	spin_lock_init(&kvm->arch.start_stop_lock);
   	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);

Looks sane to me. gi->origin will remain NULL and act like css_general_characteristics.aiv wouldn't be around.

right

Quoted 3 lines

I assume initializing the gib is fine, and having some guests use it and others not?

Is fine as well.

Quoted 5 lines

I do wonder if it would be even clearer/cleaner to not allow to change this property on the fly, and to also not init the gib if disabled.

If you want to perform performance tests, simply unload+reload KVM.

Quoted 9 lines
Quoted 1 line

That would work if kvm is build as module but not in-kernel, then

Right, but AFAIK that's not an usual setup (at least in distros) - and for testing purposes not an issue as well.

Anyhow, I'm fine with this

Thank you!

Quoted 2 lines

Thanks!

#5 lore raw
In reply to Michael Mueller
Quoted 13 lines · On Thu, 27 Feb 2020 10:10:31 +0100 Michael Mueller <[email protected]> wrote:

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

  # cat /sys/module/kvm/parameters/use_gisa
  Y

The parameter can be changed on the fly.

  # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

Quoted 7 lines

The kvm s390 debug feature shows if a guest is running with GISA.

  # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
  00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
  00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
  ...
  00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

Maybe log something as well if it is off due to this kernel parameter?

Quoted 17 lines

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
 arch/s390/kvm/kvm-s390.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +0 -0
index d7ff30e45589..5c2081488024 100644

arch/s390/kvm/kvm-s390.c static u8 halt_poll_max_steal = 10; · line 190

Quoted 7 lines
arch/s390/kvm/kvm-s390.c +4 -0
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
 module_param(halt_poll_max_steal, byte, 0644);
 MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");

I probably would have inverted the logic (i.e. introduce a disable_gisa parameter that is off by default), as you want KVM to use the gisa, except in special circumstances.

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2513

Quoted 11 lines
arch/s390/kvm/kvm-s390.c +3 -1
+
 /*
  * For now we handle at most 16 double words as this is what the s390 base
  * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm->arch.use_skf = sclp.has_skey;
 	spin_lock_init(&kvm->arch.start_stop_lock);
 	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);

I assume we're fine with no gisa but a gib (i.e. doesn't hurt?)

Quoted 3 lines
arch/s390/kvm/kvm-s390.c +0 -0
 	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
 	return 0;
#6 lore raw
Quoted 18 lines · Cornelia Huck
Quoted 15 lines · On Thu, 27 Feb 2020 10:10:31 +0100 Michael Mueller <[email protected]> wrote:

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

   # cat /sys/module/kvm/parameters/use_gisa
   Y

The parameter can be changed on the fly.

   # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

Quoted 7 lines
Quoted 5 lines
   # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
   00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
   00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
   ...
   00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

Maybe log something as well if it is off due to this kernel parameter?

There is also no message when the host does not support it.

Quoted 21 lines
Quoted 21 lines

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

---
  arch/s390/kvm/kvm-s390.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +0 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
  module_param(halt_poll_max_steal, byte, 0644);
  MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
Quoted 8 lines

arch/s390/kvm/kvm-s390.c static u8 halt_poll_max_steal = 10; · line 190

Quoted 4 lines
arch/s390/kvm/kvm-s390.c +4 -0
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");

I probably would have inverted the logic (i.e. introduce a disable_gisa parameter that is off by default), as you want KVM to use the gisa, except in special circumstances.

Hm, in my opinion "use it := no" is more explicit and natural than "don't use it := yes"

Quoted 14 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2513

Quoted 12 lines
arch/s390/kvm/kvm-s390.c +3 -1
+
  /*
   * For now we handle at most 16 double words as this is what the s390 base
   * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
  	kvm->arch.use_skf = sclp.has_skey;
  	spin_lock_init(&kvm->arch.start_stop_lock);
  	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);

I assume we're fine with no gisa but a gib (i.e. doesn't hurt?)

The GIB is a host entity and is required for guests with GISA that want to use AP with interruptions in guest.

Quoted 5 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2516

Quoted 4 lines
arch/s390/kvm/kvm-s390.c +0 -0
  	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
  	return 0;

Thanks a lot!
Michael

#7 lore raw
In reply to Michael Mueller
Quoted 21 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

  # cat /sys/module/kvm/parameters/use_gisa
  Y

The parameter can be changed on the fly.

  # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

  # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
  00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
  00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
  ...
  00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared
Quoted 7 lines

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Looks good to me. Regarding the other comments, I think allowing for dynamic changes and keeping use_gisa vs disable_gisa makes sense. So I would think that the patch as is makes sense.

The only question is: shall we set use_gisa to 0 when the machine does not support it (e.g. VSIE?) and then also forbid setting it to 1? Could be overkill.

Quoted 31 lines
---
 arch/s390/kvm/kvm-s390.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +7 -1
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
 module_param(halt_poll_max_steal, byte, 0644);
 MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
 /*
  * For now we handle at most 16 double words as this is what the s390 base
  * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm->arch.use_skf = sclp.has_skey;
 	spin_lock_init(&kvm->arch.start_stop_lock);
 	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);
 	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
 	return 0;
#8 lore raw
Quoted 30 lines · Christian Borntraeger
Quoted 27 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

   # cat /sys/module/kvm/parameters/use_gisa
   Y

The parameter can be changed on the fly.

   # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

   # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
   00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
   00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
   ...
   00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Quoted 8 lines
Quoted 1 line

Looks good to me. Regarding the other comments, I think allowing for dynamic changes and keeping use_gisa vs disable_gisa makes sense. So I would think that the patch as is makes sense.

The only question is: shall we set use_gisa to 0 when the machine does not support it (e.g. VSIE?) and then also forbid setting it to 1? Could be overkill.

Then I would rename the parameter to "try_to_use_gisa" instead. (a joke ;) )

In that case we exit gisa_init() because of the missing AIV facility.

void kvm_s390_gisa_init(struct kvm *kvm)

{
        struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int;

--> if (!css_general_characteristics.aiv)

                return;
        gi->origin = &kvm->arch.sie_page2->gisa;
        gi->alert.mask = 0;
	...
}

Thanks,
Michael

Quoted 34 lines
Quoted 33 lines

---
  arch/s390/kvm/kvm-s390.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +7 -1
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
  module_param(halt_poll_max_steal, byte, 0644);
  MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");
+
  /*
   * For now we handle at most 16 double words as this is what the s390 base
   * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
  	kvm->arch.use_skf = sclp.has_skey;
  	spin_lock_init(&kvm->arch.start_stop_lock);
  	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);
  	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
  	return 0;
Signature · 8 lines
Mit freundlichen Grüßen / Kind regards
Michael Müller

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#9 lore raw
Quoted 50 lines · Michael Mueller
Quoted 30 lines · Christian Borntraeger
Quoted 27 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

   # cat /sys/module/kvm/parameters/use_gisa
   Y

The parameter can be changed on the fly.

   # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

   # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
   00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
   00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
   ...
   00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Quoted 8 lines
Quoted 1 line

Looks good to me. Regarding the other comments, I think allowing for dynamic changes and keeping use_gisa vs disable_gisa makes sense. So I would think that the patch as is makes sense.

The only question is: shall we set use_gisa to 0 when the machine does not support it (e.g. VSIE?) and then also forbid setting it to 1? Could be overkill.

Then I would rename the parameter to "try_to_use_gisa" instead. (a joke ;) )

In that case we exit gisa_init() because of the missing AIV facility.

void kvm_s390_gisa_init(struct kvm *kvm)
{
        struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int;

Quoted 7 lines

-->    if (!css_general_characteristics.aiv)
                return;
        gi->origin = &kvm->arch.sie_page2->gisa;
        gi->alert.mask = 0;
    ...
}

I know. My point was more: "can we expose this". But this is probably overkill.

#10 lore raw
Quoted 61 lines · Christian Borntraeger
Quoted 50 lines · Michael Mueller
Quoted 30 lines · Christian Borntraeger
Quoted 27 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

    # cat /sys/module/kvm/parameters/use_gisa
    Y

The parameter can be changed on the fly.

    # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

    # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
    00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
    00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
    ...
    00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Quoted 8 lines
Quoted 1 line

Looks good to me. Regarding the other comments, I think allowing for dynamic changes and keeping use_gisa vs disable_gisa makes sense. So I would think that the patch as is makes sense.

The only question is: shall we set use_gisa to 0 when the machine does not support it (e.g. VSIE?) and then also forbid setting it to 1? Could be overkill.

Then I would rename the parameter to "try_to_use_gisa" instead. (a joke ;) )

In that case we exit gisa_init() because of the missing AIV facility.

void kvm_s390_gisa_init(struct kvm *kvm)
{
        struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int;

Quoted 7 lines

-->    if (!css_general_characteristics.aiv)
                return;
        gi->origin = &kvm->arch.sie_page2->gisa;
        gi->alert.mask = 0;
    ...
}

Quoted 1 line

I know. My point was more: "can we expose this". But this is probably overkill.

I agree with Connie here, that would make the whole thing just more error-prone. That way the messages are at least consistent.

Quoted 1 line
Reviewed-by
#11 lore raw
In reply to Christian Borntraeger
Quoted 25 lines · On Thu, 27 Feb 2020 13:27:10 +0100 Christian Borntraeger…
Quoted 24 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

  # cat /sys/module/kvm/parameters/use_gisa
  Y

The parameter can be changed on the fly.

  # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

  # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
  00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
  00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
  ...
  00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

Quoted 8 lines
Quoted 4 lines

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Looks good to me. Regarding the other comments, I think allowing for dynamic changes and keeping use_gisa vs disable_gisa makes sense. So I would think that the patch as is makes sense.

use_gisa vs disable_gisa is more a personal preference; I don't mind keeping it as use_gisa.

Quoted 3 lines

The only question is: shall we set use_gisa to 0 when the machine does not support it (e.g. VSIE?) and then also forbid setting it to 1? Could be overkill.

I don't think you should try to overload a debug knob like that; it's now simple enough, adding more code also adds to the potential for errors.

Quoted 14 lines
Quoted 14 lines

---
 arch/s390/kvm/kvm-s390.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +0 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
 module_param(halt_poll_max_steal, byte, 0644);
 MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
Quoted 4 lines

arch/s390/kvm/kvm-s390.c static u8 halt_poll_max_steal = 10; · line 190

Quoted 4 lines
arch/s390/kvm/kvm-s390.c +4 -0
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");

Especially as the description explicitly says "if the host supports it" -- that's good enough for a new knob.

Quoted 13 lines
Quoted 13 lines
arch/s390/kvm/kvm-s390.c +3 -1
+
 /*
  * For now we handle at most 16 double words as this is what the s390 base
  * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	kvm->arch.use_skf = sclp.has_skey;
 	spin_lock_init(&kvm->arch.start_stop_lock);
 	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);
 	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
Quoted 3 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2516

Quoted 2 lines
arch/s390/kvm/kvm-s390.c +0 -0
 	return 0;
#12 lore raw
Quoted 83 lines · Cornelia Huck
Quoted 25 lines · On Thu, 27 Feb 2020 13:27:10 +0100 Christian Borntraeger…
Quoted 24 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

   # cat /sys/module/kvm/parameters/use_gisa
   Y

The parameter can be changed on the fly.

   # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

   # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
   00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
   00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
   ...
   00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

Quoted 8 lines
Quoted 4 lines

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Looks good to me. Regarding the other comments, I think allowing for dynamic changes and keeping use_gisa vs disable_gisa makes sense. So I would think that the patch as is makes sense.

use_gisa vs disable_gisa is more a personal preference; I don't mind keeping it as use_gisa.

Quoted 3 lines

The only question is: shall we set use_gisa to 0 when the machine does not support it (e.g. VSIE?) and then also forbid setting it to 1? Could be overkill.

I don't think you should try to overload a debug knob like that; it's now simple enough, adding more code also adds to the potential for errors.

Quoted 14 lines
Quoted 14 lines

---
  arch/s390/kvm/kvm-s390.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +0 -0
index d7ff30e45589..5c2081488024 100644
@@ -184,6 +184,11 @@ static u8 halt_poll_max_steal = 10;
  module_param(halt_poll_max_steal, byte, 0644);
  MODULE_PARM_DESC(halt_poll_max_steal, "Maximum percentage of steal time to allow polling");
 
Quoted 4 lines

arch/s390/kvm/kvm-s390.c static u8 halt_poll_max_steal = 10; · line 190

Quoted 4 lines
arch/s390/kvm/kvm-s390.c +4 -0
+/* if set to true, the GISA will be initialized and used if available */
+static bool use_gisa  = true;
+module_param(use_gisa, bool, 0644);
+MODULE_PARM_DESC(use_gisa, "Use the GISA if the host supports it.");

Especially as the description explicitly says "if the host supports it" -- that's good enough for a new knob.

Quoted 13 lines
Quoted 13 lines
arch/s390/kvm/kvm-s390.c +3 -1
+
  /*
   * For now we handle at most 16 double words as this is what the s390 base
   * kernel handles and stores in the prefix page. If we ever need to go beyond
@@ -2504,7 +2509,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
  	kvm->arch.use_skf = sclp.has_skey;
  	spin_lock_init(&kvm->arch.start_stop_lock);
  	kvm_s390_vsie_init(kvm);
-	kvm_s390_gisa_init(kvm);
+	if (use_gisa)
+		kvm_s390_gisa_init(kvm);
  	KVM_EVENT(3, "vm 0x%pK created by pid %u", kvm, current->pid);
 
Quoted 6 lines
Quoted 3 lines

arch/s390/kvm/kvm-s390.c int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · line 2516

Quoted 2 lines
arch/s390/kvm/kvm-s390.c +0 -0
  	return 0;

Thanks!

#13 lore raw
In reply to Michael Mueller
Quoted 21 lines · Michael Mueller

The boolean module parameter "kvm.use_gisa" controls if newly created guests will use the GISA facility if provided by the host system. The default is yes.

  # cat /sys/module/kvm/parameters/use_gisa
  Y

The parameter can be changed on the fly.

  # echo N > /sys/module/kvm/parameters/use_gisa

Already running guests are not affected by this change.

The kvm s390 debug feature shows if a guest is running with GISA.

  # grep gisa /sys/kernel/debug/s390dbf/kvm-$pid/sprintf
  00 01582725059:843303 3 - 08 00000000e119bc01  gisa 0x00000000c9ac2642 initialized
  00 01582725059:903840 3 - 11 000000004391ee22  00[0000000000000000-0000000000000000]: AIV gisa format-1 enabled for cpu 000
  ...
  00 01582725059:916847 3 - 08 0000000094fff572  gisa 0x00000000c9ac2642 cleared
Quoted 7 lines

In general, that value should not be changed as the GISA facility enhances interruption delivery performance.

A reason to switch the GISA facility off might be a performance comparison run or debugging.

Thanks applied.