Linux-S390 Archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
@ 2016-02-12 13:22 Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 01/18] KVM: s390: allow sync of fp registers via vregs Christian Borntraeger
                   ` (19 more replies)
  0 siblings, 20 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

Paolo,

here is the first set of patches for s390/kvm targetting the next merge 
window for 4.6 (kvm/next)
This time with less testing than usual on the branch itself, as 4.5-rc3
is broken in several ways (with fixes or workarounds or people working on
the issues). So this time these patches have been partially tested against
a 4.4 base and partially tested agains kvm/next :-/

The following changes since commit bce87cce88c71957c56479809db8316a836ec8b1:

  KVM: x86: consolidate different ways to test for in-kernel LAPIC (2016-02-09 16:57:45 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-next-4.6-1

for you to fetch changes up to 1763f8d09d522b3ac998229dcf038476e88b78fc:

  KVM: s390: bail out early on fatal signal in dirty logging (2016-02-10 13:12:57 +0100)

----------------------------------------------------------------
KVM: s390: Fixes and features for kvm/next (4.6)

1. also provide the floating point registers via sync regs
2. Separate out intruction vs. data accesses
3. Fix program interrupts in some cases
4. Documentation fixes
5. dirty log improvements for huge guests

----------------------------------------------------------------
Christian Borntraeger (3):
      KVM: s390: do not take mmap_sem on dirty log query
      KVM: s390: do not block CPU on dirty logging
      KVM: s390: bail out early on fatal signal in dirty logging

Cornelia Huck (1):
      KVM: s390: usage hint for adapter mappings

David Hildenbrand (14):
      KVM: s390: allow sync of fp registers via vregs
      KVM: s390: sync of fp registers via kvm_run
      KVM: s390: PSW forwarding / rewinding / ilc rework
      KVM: s390: migration / injection of prog irq ilc
      KVM: s390: gaccess: introduce access modes
      KVM: s390: gaccess: implement instruction fetching mode
      KVM: s390: read the correct opcode on SIE faults
      KVM: s390: clean up prog irq injection on prog irq icpts
      KVM: s390: irq delivery should not rely on icptcode
      KVM: s390: provide prog irq ilc on SIE faults
      KVM: s390: instruction-fetching exceptions on SIE faults
      KVM: s390: remove old fragment of vector registers
      KVM: s390: add documentation of KVM_S390_VM_TOD
      KVM: s390: add documentation of KVM_S390_VM_CRYPTO

 Documentation/virtual/kvm/devices/s390_flic.txt |  2 +
 Documentation/virtual/kvm/devices/vm.txt        | 52 +++++++++++++++++
 arch/s390/include/asm/kvm_host.h                |  8 +--
 arch/s390/include/uapi/asm/kvm.h                |  8 ++-
 arch/s390/kvm/gaccess.c                         | 57 +++++++++---------
 arch/s390/kvm/gaccess.h                         | 38 ++++++++++--
 arch/s390/kvm/intercept.c                       | 78 +++++++++++++++----------
 arch/s390/kvm/interrupt.c                       | 40 ++++++-------
 arch/s390/kvm/kvm-s390.c                        | 55 +++++++++++------
 arch/s390/kvm/kvm-s390.h                        | 17 +++++-
 arch/s390/kvm/priv.c                            | 13 +++--
 include/uapi/linux/kvm.h                        |  8 ++-
 12 files changed, 254 insertions(+), 122 deletions(-)

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [GIT PULL 01/18] KVM: s390: allow sync of fp registers via vregs
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 02/18] KVM: s390: sync of fp registers via kvm_run Christian Borntraeger
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

If we have MACHINE_HAS_VX, the floating point registers are stored
in the vector register format, event if the guest isn't enabled for vector
registers. So we can allow KVM_SYNC_VRS as soon as MACHINE_HAS_VX is
available.

This can in return be used by user space to support floating point
registers via struct kvm_run when the machine has vector registers.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 4af21c7..8fcdf98 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1414,7 +1414,10 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 				    KVM_SYNC_PFAULT;
 	if (test_kvm_facility(vcpu->kvm, 64))
 		vcpu->run->kvm_valid_regs |= KVM_SYNC_RICCB;
-	if (test_kvm_facility(vcpu->kvm, 129))
+	/* fprs can be synchronized via vrs, even if the guest has no vx. With
+	 * MACHINE_HAS_VX, (load|store)_fpu_regs() will work with vrs format.
+	 */
+	if (MACHINE_HAS_VX)
 		vcpu->run->kvm_valid_regs |= KVM_SYNC_VRS;
 
 	if (kvm_is_ucontrol(vcpu->kvm))
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 02/18] KVM: s390: sync of fp registers via kvm_run
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 01/18] KVM: s390: allow sync of fp registers via vregs Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 03/18] KVM: s390: PSW forwarding / rewinding / ilc rework Christian Borntraeger
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

As we already store the floating point registers in the vector save area
in floating point register format when we don't have MACHINE_HAS_VX, we can
directly expose them to user space using a new sync flag.

The floating point registers will be valid when KVM_SYNC_FPRS is set. The
fpc will also be valid when KVM_SYNC_FPRS is set.

Either KVM_SYNC_FPRS or KVM_SYNC_VRS will be enabled, never both.

Let's also change two positions where we access vrs, making the code easier
to read and one comment superfluous.

Suggested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/include/uapi/asm/kvm.h |  8 ++++++--
 arch/s390/kvm/kvm-s390.c         | 12 +++++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
index fe84bd5..347fe5a 100644
--- a/arch/s390/include/uapi/asm/kvm.h
+++ b/arch/s390/include/uapi/asm/kvm.h
@@ -154,6 +154,7 @@ struct kvm_guest_debug_arch {
 #define KVM_SYNC_PFAULT (1UL << 5)
 #define KVM_SYNC_VRS    (1UL << 6)
 #define KVM_SYNC_RICCB  (1UL << 7)
+#define KVM_SYNC_FPRS   (1UL << 8)
 /* definition of registers in kvm_run */
 struct kvm_sync_regs {
 	__u64 prefix;	/* prefix register */
@@ -168,9 +169,12 @@ struct kvm_sync_regs {
 	__u64 pft;	/* pfault token [PFAULT] */
 	__u64 pfs;	/* pfault select [PFAULT] */
 	__u64 pfc;	/* pfault compare [PFAULT] */
-	__u64 vrs[32][2];	/* vector registers */
+	union {
+		__u64 vrs[32][2];	/* vector registers (KVM_SYNC_VRS) */
+		__u64 fprs[16];		/* fp registers (KVM_SYNC_FPRS) */
+	};
 	__u8  reserved[512];	/* for future vector expansion */
-	__u32 fpc;	/* only valid with vector registers */
+	__u32 fpc;		/* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */
 	__u8 padding[52];	/* riccb needs to be 64byte aligned */
 	__u8 riccb[64];		/* runtime instrumentation controls block */
 };
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 8fcdf98..2270fe4 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1419,6 +1419,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 	 */
 	if (MACHINE_HAS_VX)
 		vcpu->run->kvm_valid_regs |= KVM_SYNC_VRS;
+	else
+		vcpu->run->kvm_valid_regs |= KVM_SYNC_FPRS;
 
 	if (kvm_is_ucontrol(vcpu->kvm))
 		return __kvm_ucontrol_vcpu_init(vcpu);
@@ -1433,10 +1435,10 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 	vcpu->arch.host_fpregs.fpc = current->thread.fpu.fpc;
 	vcpu->arch.host_fpregs.regs = current->thread.fpu.regs;
 
-	/* Depending on MACHINE_HAS_VX, data stored to vrs either
-	 * has vector register or floating point register format.
-	 */
-	current->thread.fpu.regs = vcpu->run->s.regs.vrs;
+	if (MACHINE_HAS_VX)
+		current->thread.fpu.regs = vcpu->run->s.regs.vrs;
+	else
+		current->thread.fpu.regs = vcpu->run->s.regs.fprs;
 	current->thread.fpu.fpc = vcpu->run->s.regs.fpc;
 	if (test_fp_ctl(current->thread.fpu.fpc))
 		/* User space provided an invalid FPC, let's clear it */
@@ -2389,7 +2391,7 @@ int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long gpa)
 				     fprs, 128);
 	} else {
 		rc = write_guest_abs(vcpu, gpa + __LC_FPREGS_SAVE_AREA,
-				     vcpu->run->s.regs.vrs, 128);
+				     vcpu->run->s.regs.fprs, 128);
 	}
 	rc |= write_guest_abs(vcpu, gpa + __LC_GPREGS_SAVE_AREA,
 			      vcpu->run->s.regs.gprs, 128);
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 03/18] KVM: s390: PSW forwarding / rewinding / ilc rework
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 01/18] KVM: s390: allow sync of fp registers via vregs Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 02/18] KVM: s390: sync of fp registers via kvm_run Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 04/18] KVM: s390: migration / injection of prog irq ilc Christian Borntraeger
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

We have some confusion about ilc vs. ilen in our current code. So let's
correctly use the term ilen when dealing with (ilc << 1).

Program irq injection didn't take care of the correct ilc in case of
irqs triggered by EXECUTE functions, let's provide one function
kvm_s390_get_ilen() to take care of all that.

Also, manually specifying in intercept handlers the size of the
instruction (and sometimes overwriting that value for EXECUTE internally)
doesn't make too much sense. So also provide the functions:
- kvm_s390_retry_instr to retry the currently intercepted instruction
- kvm_s390_rewind_psw to rewind the PSW without internal overwrites
- kvm_s390_forward_psw to forward the PSW

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/intercept.c | 31 +++++++++++++++++++++++--------
 arch/s390/kvm/interrupt.c | 28 ++++++----------------------
 arch/s390/kvm/kvm-s390.c  |  2 +-
 arch/s390/kvm/kvm-s390.h  | 17 ++++++++++++++++-
 arch/s390/kvm/priv.c      |  8 ++++----
 5 files changed, 50 insertions(+), 36 deletions(-)

diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index d53c107..7f992e0 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -38,17 +38,32 @@ static const intercept_handler_t instruction_handlers[256] = {
 	[0xeb] = kvm_s390_handle_eb,
 };
 
-void kvm_s390_rewind_psw(struct kvm_vcpu *vcpu, int ilc)
+u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu)
 {
 	struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block;
+	u8 ilen = 0;
 
-	/* Use the length of the EXECUTE instruction if necessary */
-	if (sie_block->icptstatus & 1) {
-		ilc = (sie_block->icptstatus >> 4) & 0x6;
-		if (!ilc)
-			ilc = 4;
+	switch (vcpu->arch.sie_block->icptcode) {
+	case ICPT_INST:
+	case ICPT_INSTPROGI:
+	case ICPT_OPEREXC:
+	case ICPT_PARTEXEC:
+	case ICPT_IOINST:
+		/* instruction only stored for these icptcodes */
+		ilen = insn_length(vcpu->arch.sie_block->ipa >> 8);
+		/* Use the length of the EXECUTE instruction if necessary */
+		if (sie_block->icptstatus & 1) {
+			ilen = (sie_block->icptstatus >> 4) & 0x6;
+			if (!ilen)
+				ilen = 4;
+		}
+		break;
+	case ICPT_PROGI:
+		/* bit 1+2 of pgmilc are the ilc, so we directly get ilen */
+		ilen = vcpu->arch.sie_block->pgmilc & 0x6;
+		break;
 	}
-	sie_block->gpsw.addr = __rewind_psw(sie_block->gpsw, ilc);
+	return ilen;
 }
 
 static int handle_noop(struct kvm_vcpu *vcpu)
@@ -318,7 +333,7 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu)
 	if (rc != 0)
 		return rc;
 
-	kvm_s390_rewind_psw(vcpu, 4);
+	kvm_s390_retry_instr(vcpu);
 
 	return 0;
 }
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index f88ca72..daa4fdb 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -335,23 +335,6 @@ static void set_intercept_indicators(struct kvm_vcpu *vcpu)
 	set_intercept_indicators_stop(vcpu);
 }
 
-static u16 get_ilc(struct kvm_vcpu *vcpu)
-{
-	switch (vcpu->arch.sie_block->icptcode) {
-	case ICPT_INST:
-	case ICPT_INSTPROGI:
-	case ICPT_OPEREXC:
-	case ICPT_PARTEXEC:
-	case ICPT_IOINST:
-		/* last instruction only stored for these icptcodes */
-		return insn_length(vcpu->arch.sie_block->ipa >> 8);
-	case ICPT_PROGI:
-		return vcpu->arch.sie_block->pgmilc;
-	default:
-		return 0;
-	}
-}
-
 static int __must_check __deliver_cpu_timer(struct kvm_vcpu *vcpu)
 {
 	struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
@@ -588,7 +571,7 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
 	struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
 	struct kvm_s390_pgm_info pgm_info;
 	int rc = 0, nullifying = false;
-	u16 ilc = get_ilc(vcpu);
+	u16 ilen = kvm_s390_get_ilen(vcpu);
 
 	spin_lock(&li->lock);
 	pgm_info = li->irq.pgm;
@@ -596,8 +579,8 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
 	memset(&li->irq.pgm, 0, sizeof(pgm_info));
 	spin_unlock(&li->lock);
 
-	VCPU_EVENT(vcpu, 3, "deliver: program irq code 0x%x, ilc:%d",
-		   pgm_info.code, ilc);
+	VCPU_EVENT(vcpu, 3, "deliver: program irq code 0x%x, ilen:%d",
+		   pgm_info.code, ilen);
 	vcpu->stat.deliver_program_int++;
 	trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, KVM_S390_PROGRAM_INT,
 					 pgm_info.code, 0);
@@ -682,9 +665,10 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
 	}
 
 	if (nullifying && vcpu->arch.sie_block->icptcode == ICPT_INST)
-		kvm_s390_rewind_psw(vcpu, ilc);
+		kvm_s390_rewind_psw(vcpu, ilen);
 
-	rc |= put_guest_lc(vcpu, ilc, (u16 *) __LC_PGM_ILC);
+	/* bit 1+2 of the target are the ilc, so we can directly use ilen */
+	rc |= put_guest_lc(vcpu, ilen, (u16 *) __LC_PGM_ILC);
 	rc |= put_guest_lc(vcpu, vcpu->arch.sie_block->gbea,
 				 (u64 *) __LC_LAST_BREAK);
 	rc |= put_guest_lc(vcpu, pgm_info.code,
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 2270fe4..cd84a3e 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2181,7 +2181,7 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
 	rc = read_guest(vcpu, psw->addr, 0, &opcode, 1);
 	if (rc)
 		return kvm_s390_inject_prog_cond(vcpu, rc);
-	psw->addr = __rewind_psw(*psw, -insn_length(opcode));
+	kvm_s390_forward_psw(vcpu, insn_length(opcode));
 
 	return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 }
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index df1abad..1c756c7 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -19,6 +19,7 @@
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
 #include <asm/facility.h>
+#include <asm/processor.h>
 
 typedef int (*intercept_handler_t)(struct kvm_vcpu *vcpu);
 
@@ -212,8 +213,22 @@ int kvm_s390_reinject_io_int(struct kvm *kvm,
 int kvm_s390_mask_adapter(struct kvm *kvm, unsigned int id, bool masked);
 
 /* implemented in intercept.c */
-void kvm_s390_rewind_psw(struct kvm_vcpu *vcpu, int ilc);
+u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu);
 int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu);
+static inline void kvm_s390_rewind_psw(struct kvm_vcpu *vcpu, int ilen)
+{
+	struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block;
+
+	sie_block->gpsw.addr = __rewind_psw(sie_block->gpsw, ilen);
+}
+static inline void kvm_s390_forward_psw(struct kvm_vcpu *vcpu, int ilen)
+{
+	kvm_s390_rewind_psw(vcpu, -ilen);
+}
+static inline void kvm_s390_retry_instr(struct kvm_vcpu *vcpu)
+{
+	kvm_s390_rewind_psw(vcpu, kvm_s390_get_ilen(vcpu));
+}
 
 /* implemented in priv.c */
 int is_valid_psw(psw_t *psw);
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index ed74e86..d58cbe9 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -173,7 +173,7 @@ static int handle_skey(struct kvm_vcpu *vcpu)
 	if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
 		return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
 
-	kvm_s390_rewind_psw(vcpu, 4);
+	kvm_s390_retry_instr(vcpu);
 	VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");
 	return 0;
 }
@@ -184,7 +184,7 @@ static int handle_ipte_interlock(struct kvm_vcpu *vcpu)
 	if (psw_bits(vcpu->arch.sie_block->gpsw).p)
 		return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
 	wait_event(vcpu->kvm->arch.ipte_wq, !ipte_lock_held(vcpu));
-	kvm_s390_rewind_psw(vcpu, 4);
+	kvm_s390_retry_instr(vcpu);
 	VCPU_EVENT(vcpu, 4, "%s", "retrying ipte interlock operation");
 	return 0;
 }
@@ -759,8 +759,8 @@ static int handle_essa(struct kvm_vcpu *vcpu)
 	if (((vcpu->arch.sie_block->ipb & 0xf0000000) >> 28) > 6)
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
-	/* Rewind PSW to repeat the ESSA instruction */
-	kvm_s390_rewind_psw(vcpu, 4);
+	/* Retry the ESSA instruction */
+	kvm_s390_retry_instr(vcpu);
 	vcpu->arch.sie_block->cbrlo &= PAGE_MASK;	/* reset nceo */
 	cbrlo = phys_to_virt(vcpu->arch.sie_block->cbrlo);
 	down_read(&gmap->mm->mmap_sem);
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 04/18] KVM: s390: migration / injection of prog irq ilc
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (2 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 03/18] KVM: s390: PSW forwarding / rewinding / ilc rework Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 05/18] KVM: s390: gaccess: introduce access modes Christian Borntraeger
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

We have to migrate the program irq ilc and someday we will have to
specify the ilc without KVM trying to autodetect the value.

Let's reuse one of the spare fields in our program irq that should
always be set to 0 by user space. Because we also want to make use
of 0 ilcs ("not available"), we need a validity indicator.

If no valid ilc is given, we try to autodetect the ilc via the current
icptcode and icptstatus + parameter and store the valid ilc in the
irq structure.

This has a nice effect: QEMU's making use of KVM_S390_IRQ /
KVM_S390_SET_IRQ_STATE / KVM_S390_GET_IRQ_STATE for migration will
directly migrate the ilc without any changes.

Please note that we use bit 0 as validity and bit 1,2 for the ilc, so
by applying the ilc mask we directly get the ilen which is usually what
we work with.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/interrupt.c | 12 +++++++++++-
 include/uapi/linux/kvm.h  |  7 ++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index daa4fdb..e594a78 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -571,7 +571,7 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
 	struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
 	struct kvm_s390_pgm_info pgm_info;
 	int rc = 0, nullifying = false;
-	u16 ilen = kvm_s390_get_ilen(vcpu);
+	u16 ilen;
 
 	spin_lock(&li->lock);
 	pgm_info = li->irq.pgm;
@@ -579,6 +579,7 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
 	memset(&li->irq.pgm, 0, sizeof(pgm_info));
 	spin_unlock(&li->lock);
 
+	ilen = pgm_info.flags & KVM_S390_PGM_FLAGS_ILC_MASK;
 	VCPU_EVENT(vcpu, 3, "deliver: program irq code 0x%x, ilen:%d",
 		   pgm_info.code, ilen);
 	vcpu->stat.deliver_program_int++;
@@ -1043,8 +1044,16 @@ static int __inject_prog(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq)
 	trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_PROGRAM_INT,
 				   irq->u.pgm.code, 0);
 
+	if (!(irq->u.pgm.flags & KVM_S390_PGM_FLAGS_ILC_VALID)) {
+		/* auto detection if no valid ILC was given */
+		irq->u.pgm.flags &= ~KVM_S390_PGM_FLAGS_ILC_MASK;
+		irq->u.pgm.flags |= kvm_s390_get_ilen(vcpu);
+		irq->u.pgm.flags |= KVM_S390_PGM_FLAGS_ILC_VALID;
+	}
+
 	if (irq->u.pgm.code == PGM_PER) {
 		li->irq.pgm.code |= PGM_PER;
+		li->irq.pgm.flags = irq->u.pgm.flags;
 		/* only modify PER related information */
 		li->irq.pgm.per_address = irq->u.pgm.per_address;
 		li->irq.pgm.per_code = irq->u.pgm.per_code;
@@ -1053,6 +1062,7 @@ static int __inject_prog(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq)
 	} else if (!(irq->u.pgm.code & PGM_PER)) {
 		li->irq.pgm.code = (li->irq.pgm.code & PGM_PER) |
 				   irq->u.pgm.code;
+		li->irq.pgm.flags = irq->u.pgm.flags;
 		/* only modify non-PER information */
 		li->irq.pgm.trans_exc_code = irq->u.pgm.trans_exc_code;
 		li->irq.pgm.mon_code = irq->u.pgm.mon_code;
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 9da9051..4e20a40 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -541,7 +541,12 @@ struct kvm_s390_pgm_info {
 	__u8 exc_access_id;
 	__u8 per_access_id;
 	__u8 op_access_id;
-	__u8 pad[3];
+#define KVM_S390_PGM_FLAGS_ILC_VALID	0x01
+#define KVM_S390_PGM_FLAGS_ILC_0	0x02
+#define KVM_S390_PGM_FLAGS_ILC_1	0x04
+#define KVM_S390_PGM_FLAGS_ILC_MASK	0x06
+	__u8 flags;
+	__u8 pad[2];
 };
 
 struct kvm_s390_prefix_info {
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 05/18] KVM: s390: gaccess: introduce access modes
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (3 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 04/18] KVM: s390: migration / injection of prog irq ilc Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 06/18] KVM: s390: gaccess: implement instruction fetching mode Christian Borntraeger
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

We will need special handling when fetching instructions, so let's
introduce new guest access modes GACC_FETCH and GACC_STORE instead
of a write flag. An additional patch will then introduce GACC_IFETCH.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/gaccess.c   | 46 +++++++++++++++++++++++-----------------------
 arch/s390/kvm/gaccess.h   | 17 +++++++++++------
 arch/s390/kvm/intercept.c |  4 ++--
 arch/s390/kvm/kvm-s390.c  |  6 ++++--
 arch/s390/kvm/priv.c      |  5 +++--
 5 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index d30db40..c72ad91 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -373,7 +373,7 @@ void ipte_unlock(struct kvm_vcpu *vcpu)
 }
 
 static int ar_translation(struct kvm_vcpu *vcpu, union asce *asce, ar_t ar,
-			  int write)
+			  enum gacc_mode mode)
 {
 	union alet alet;
 	struct ale ale;
@@ -454,7 +454,7 @@ static int ar_translation(struct kvm_vcpu *vcpu, union asce *asce, ar_t ar,
 		}
 	}
 
-	if (ale.fo == 1 && write)
+	if (ale.fo == 1 && mode == GACC_STORE)
 		return PGM_PROTECTION;
 
 	asce->val = aste.asce;
@@ -477,7 +477,7 @@ enum {
 };
 
 static int get_vcpu_asce(struct kvm_vcpu *vcpu, union asce *asce,
-			 ar_t ar, int write)
+			 ar_t ar, enum gacc_mode mode)
 {
 	int rc;
 	psw_t *psw = &vcpu->arch.sie_block->gpsw;
@@ -486,7 +486,7 @@ static int get_vcpu_asce(struct kvm_vcpu *vcpu, union asce *asce,
 
 	memset(pgm, 0, sizeof(*pgm));
 	tec_bits = (struct trans_exc_code_bits *)&pgm->trans_exc_code;
-	tec_bits->fsi = write ? FSI_STORE : FSI_FETCH;
+	tec_bits->fsi = mode == GACC_STORE ? FSI_STORE : FSI_FETCH;
 	tec_bits->as = psw_bits(*psw).as;
 
 	if (!psw_bits(*psw).t) {
@@ -506,7 +506,7 @@ static int get_vcpu_asce(struct kvm_vcpu *vcpu, union asce *asce,
 		asce->val = vcpu->arch.sie_block->gcr[13];
 		return 0;
 	case PSW_AS_ACCREG:
-		rc = ar_translation(vcpu, asce, ar, write);
+		rc = ar_translation(vcpu, asce, ar, mode);
 		switch (rc) {
 		case PGM_ALEN_TRANSLATION:
 		case PGM_ALE_SEQUENCE:
@@ -538,7 +538,7 @@ static int deref_table(struct kvm *kvm, unsigned long gpa, unsigned long *val)
  * @gva: guest virtual address
  * @gpa: points to where guest physical (absolute) address should be stored
  * @asce: effective asce
- * @write: indicates if access is a write access
+ * @mode: indicates the access mode to be used
  *
  * Translate a guest virtual address into a guest absolute address by means
  * of dynamic address translation as specified by the architecture.
@@ -554,7 +554,7 @@ static int deref_table(struct kvm *kvm, unsigned long gpa, unsigned long *val)
  */
 static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,
 				     unsigned long *gpa, const union asce asce,
-				     int write)
+				     enum gacc_mode mode)
 {
 	union vaddress vaddr = {.addr = gva};
 	union raddress raddr = {.addr = gva};
@@ -699,7 +699,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,
 real_address:
 	raddr.addr = kvm_s390_real_to_abs(vcpu, raddr.addr);
 absolute_address:
-	if (write && dat_protection)
+	if (mode == GACC_STORE && dat_protection)
 		return PGM_PROTECTION;
 	if (kvm_is_error_gpa(vcpu->kvm, raddr.addr))
 		return PGM_ADDRESSING;
@@ -728,7 +728,7 @@ static int low_address_protection_enabled(struct kvm_vcpu *vcpu,
 
 static int guest_page_range(struct kvm_vcpu *vcpu, unsigned long ga,
 			    unsigned long *pages, unsigned long nr_pages,
-			    const union asce asce, int write)
+			    const union asce asce, enum gacc_mode mode)
 {
 	struct kvm_s390_pgm_info *pgm = &vcpu->arch.pgm;
 	psw_t *psw = &vcpu->arch.sie_block->gpsw;
@@ -740,13 +740,13 @@ static int guest_page_range(struct kvm_vcpu *vcpu, unsigned long ga,
 	while (nr_pages) {
 		ga = kvm_s390_logical_to_effective(vcpu, ga);
 		tec_bits->addr = ga >> PAGE_SHIFT;
-		if (write && lap_enabled && is_low_address(ga)) {
+		if (mode == GACC_STORE && lap_enabled && is_low_address(ga)) {
 			pgm->code = PGM_PROTECTION;
 			return pgm->code;
 		}
 		ga &= PAGE_MASK;
 		if (psw_bits(*psw).t) {
-			rc = guest_translate(vcpu, ga, pages, asce, write);
+			rc = guest_translate(vcpu, ga, pages, asce, mode);
 			if (rc < 0)
 				return rc;
 			if (rc == PGM_PROTECTION)
@@ -768,7 +768,7 @@ static int guest_page_range(struct kvm_vcpu *vcpu, unsigned long ga,
 }
 
 int access_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
-		 unsigned long len, int write)
+		 unsigned long len, enum gacc_mode mode)
 {
 	psw_t *psw = &vcpu->arch.sie_block->gpsw;
 	unsigned long _len, nr_pages, gpa, idx;
@@ -780,7 +780,7 @@ int access_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
 
 	if (!len)
 		return 0;
-	rc = get_vcpu_asce(vcpu, &asce, ar, write);
+	rc = get_vcpu_asce(vcpu, &asce, ar, mode);
 	if (rc)
 		return rc;
 	nr_pages = (((ga & ~PAGE_MASK) + len - 1) >> PAGE_SHIFT) + 1;
@@ -792,11 +792,11 @@ int access_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
 	need_ipte_lock = psw_bits(*psw).t && !asce.r;
 	if (need_ipte_lock)
 		ipte_lock(vcpu);
-	rc = guest_page_range(vcpu, ga, pages, nr_pages, asce, write);
+	rc = guest_page_range(vcpu, ga, pages, nr_pages, asce, mode);
 	for (idx = 0; idx < nr_pages && !rc; idx++) {
 		gpa = *(pages + idx) + (ga & ~PAGE_MASK);
 		_len = min(PAGE_SIZE - (gpa & ~PAGE_MASK), len);
-		if (write)
+		if (mode == GACC_STORE)
 			rc = kvm_write_guest(vcpu->kvm, gpa, data, _len);
 		else
 			rc = kvm_read_guest(vcpu->kvm, gpa, data, _len);
@@ -812,7 +812,7 @@ int access_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
 }
 
 int access_guest_real(struct kvm_vcpu *vcpu, unsigned long gra,
-		      void *data, unsigned long len, int write)
+		      void *data, unsigned long len, enum gacc_mode mode)
 {
 	unsigned long _len, gpa;
 	int rc = 0;
@@ -820,7 +820,7 @@ int access_guest_real(struct kvm_vcpu *vcpu, unsigned long gra,
 	while (len && !rc) {
 		gpa = kvm_s390_real_to_abs(vcpu, gra);
 		_len = min(PAGE_SIZE - (gpa & ~PAGE_MASK), len);
-		if (write)
+		if (mode)
 			rc = write_guest_abs(vcpu, gpa, data, _len);
 		else
 			rc = read_guest_abs(vcpu, gpa, data, _len);
@@ -841,7 +841,7 @@ int access_guest_real(struct kvm_vcpu *vcpu, unsigned long gra,
  * has to take care of this.
  */
 int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva, ar_t ar,
-			    unsigned long *gpa, int write)
+			    unsigned long *gpa, enum gacc_mode mode)
 {
 	struct kvm_s390_pgm_info *pgm = &vcpu->arch.pgm;
 	psw_t *psw = &vcpu->arch.sie_block->gpsw;
@@ -851,19 +851,19 @@ int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva, ar_t ar,
 
 	gva = kvm_s390_logical_to_effective(vcpu, gva);
 	tec = (struct trans_exc_code_bits *)&pgm->trans_exc_code;
-	rc = get_vcpu_asce(vcpu, &asce, ar, write);
+	rc = get_vcpu_asce(vcpu, &asce, ar, mode);
 	tec->addr = gva >> PAGE_SHIFT;
 	if (rc)
 		return rc;
 	if (is_low_address(gva) && low_address_protection_enabled(vcpu, asce)) {
-		if (write) {
+		if (mode == GACC_STORE) {
 			rc = pgm->code = PGM_PROTECTION;
 			return rc;
 		}
 	}
 
 	if (psw_bits(*psw).t && !asce.r) {	/* Use DAT? */
-		rc = guest_translate(vcpu, gva, gpa, asce, write);
+		rc = guest_translate(vcpu, gva, gpa, asce, mode);
 		if (rc > 0) {
 			if (rc == PGM_PROTECTION)
 				tec->b61 = 1;
@@ -883,7 +883,7 @@ int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva, ar_t ar,
  * check_gva_range - test a range of guest virtual addresses for accessibility
  */
 int check_gva_range(struct kvm_vcpu *vcpu, unsigned long gva, ar_t ar,
-		    unsigned long length, int is_write)
+		    unsigned long length, enum gacc_mode mode)
 {
 	unsigned long gpa;
 	unsigned long currlen;
@@ -892,7 +892,7 @@ int check_gva_range(struct kvm_vcpu *vcpu, unsigned long gva, ar_t ar,
 	ipte_lock(vcpu);
 	while (length > 0 && !rc) {
 		currlen = min(length, PAGE_SIZE - (gva % PAGE_SIZE));
-		rc = guest_translate_address(vcpu, gva, ar, &gpa, is_write);
+		rc = guest_translate_address(vcpu, gva, ar, &gpa, mode);
 		gva += currlen;
 		length -= currlen;
 	}
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index ef03726..2a6f8bf 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -155,16 +155,21 @@ int read_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data,
 	return kvm_read_guest(vcpu->kvm, gpa, data, len);
 }
 
+enum gacc_mode {
+	GACC_FETCH,
+	GACC_STORE,
+};
+
 int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva,
-			    ar_t ar, unsigned long *gpa, int write);
+			    ar_t ar, unsigned long *gpa, enum gacc_mode mode);
 int check_gva_range(struct kvm_vcpu *vcpu, unsigned long gva, ar_t ar,
-		    unsigned long length, int is_write);
+		    unsigned long length, enum gacc_mode mode);
 
 int access_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
-		 unsigned long len, int write);
+		 unsigned long len, enum gacc_mode mode);
 
 int access_guest_real(struct kvm_vcpu *vcpu, unsigned long gra,
-		      void *data, unsigned long len, int write);
+		      void *data, unsigned long len, enum gacc_mode mode);
 
 /**
  * write_guest - copy data from kernel space to guest space
@@ -215,7 +220,7 @@ static inline __must_check
 int write_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
 		unsigned long len)
 {
-	return access_guest(vcpu, ga, ar, data, len, 1);
+	return access_guest(vcpu, ga, ar, data, len, GACC_STORE);
 }
 
 /**
@@ -235,7 +240,7 @@ static inline __must_check
 int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
 	       unsigned long len)
 {
-	return access_guest(vcpu, ga, ar, data, len, 0);
+	return access_guest(vcpu, ga, ar, data, len, GACC_FETCH);
 }
 
 /**
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 7f992e0..44bb923 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -317,7 +317,7 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu)
 
 	/* Make sure that the source is paged-in */
 	rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg2],
-				     reg2, &srcaddr, 0);
+				     reg2, &srcaddr, GACC_FETCH);
 	if (rc)
 		return kvm_s390_inject_prog_cond(vcpu, rc);
 	rc = kvm_arch_fault_in_page(vcpu, srcaddr, 0);
@@ -326,7 +326,7 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu)
 
 	/* Make sure that the destination is paged-in */
 	rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg1],
-				     reg1, &dstaddr, 1);
+				     reg1, &dstaddr, GACC_STORE);
 	if (rc)
 		return kvm_s390_inject_prog_cond(vcpu, rc);
 	rc = kvm_arch_fault_in_page(vcpu, dstaddr, 1);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index cd84a3e..85e169b 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2610,7 +2610,8 @@ static long kvm_s390_guest_mem_op(struct kvm_vcpu *vcpu,
 	switch (mop->op) {
 	case KVM_S390_MEMOP_LOGICAL_READ:
 		if (mop->flags & KVM_S390_MEMOP_F_CHECK_ONLY) {
-			r = check_gva_range(vcpu, mop->gaddr, mop->ar, mop->size, false);
+			r = check_gva_range(vcpu, mop->gaddr, mop->ar,
+					    mop->size, GACC_FETCH);
 			break;
 		}
 		r = read_guest(vcpu, mop->gaddr, mop->ar, tmpbuf, mop->size);
@@ -2621,7 +2622,8 @@ static long kvm_s390_guest_mem_op(struct kvm_vcpu *vcpu,
 		break;
 	case KVM_S390_MEMOP_LOGICAL_WRITE:
 		if (mop->flags & KVM_S390_MEMOP_F_CHECK_ONLY) {
-			r = check_gva_range(vcpu, mop->gaddr, mop->ar, mop->size, true);
+			r = check_gva_range(vcpu, mop->gaddr, mop->ar,
+					    mop->size, GACC_STORE);
 			break;
 		}
 		if (copy_from_user(tmpbuf, uaddr, mop->size)) {
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index d58cbe9..add9909 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -981,11 +981,12 @@ static int handle_tprot(struct kvm_vcpu *vcpu)
 		return -EOPNOTSUPP;
 	if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT)
 		ipte_lock(vcpu);
-	ret = guest_translate_address(vcpu, address1, ar, &gpa, 1);
+	ret = guest_translate_address(vcpu, address1, ar, &gpa, GACC_STORE);
 	if (ret == PGM_PROTECTION) {
 		/* Write protected? Try again with read-only... */
 		cc = 1;
-		ret = guest_translate_address(vcpu, address1, ar, &gpa, 0);
+		ret = guest_translate_address(vcpu, address1, ar, &gpa,
+					      GACC_FETCH);
 	}
 	if (ret) {
 		if (ret == PGM_ADDRESSING || ret == PGM_TRANSLATION_SPEC) {
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 06/18] KVM: s390: gaccess: implement instruction fetching mode
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (4 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 05/18] KVM: s390: gaccess: introduce access modes Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 07/18] KVM: s390: read the correct opcode on SIE faults Christian Borntraeger
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

When an instruction is to be fetched, special handling applies to
secondary-space mode and access-register mode. The instruction is to be
fetched from primary space.

We can easily support this by selecting the right asce for translation.
Access registers will never be used during translation, so don't
include them in the interface. As we only want to read from the current
PSW address for now, let's also hide that detail.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/gaccess.c | 11 +++++++----
 arch/s390/kvm/gaccess.h | 21 +++++++++++++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index c72ad91..66938d2 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -480,22 +480,25 @@ static int get_vcpu_asce(struct kvm_vcpu *vcpu, union asce *asce,
 			 ar_t ar, enum gacc_mode mode)
 {
 	int rc;
-	psw_t *psw = &vcpu->arch.sie_block->gpsw;
+	struct psw_bits psw = psw_bits(vcpu->arch.sie_block->gpsw);
 	struct kvm_s390_pgm_info *pgm = &vcpu->arch.pgm;
 	struct trans_exc_code_bits *tec_bits;
 
 	memset(pgm, 0, sizeof(*pgm));
 	tec_bits = (struct trans_exc_code_bits *)&pgm->trans_exc_code;
 	tec_bits->fsi = mode == GACC_STORE ? FSI_STORE : FSI_FETCH;
-	tec_bits->as = psw_bits(*psw).as;
+	tec_bits->as = psw.as;
 
-	if (!psw_bits(*psw).t) {
+	if (!psw.t) {
 		asce->val = 0;
 		asce->r = 1;
 		return 0;
 	}
 
-	switch (psw_bits(vcpu->arch.sie_block->gpsw).as) {
+	if (mode == GACC_IFETCH)
+		psw.as = psw.as == PSW_AS_HOME ? PSW_AS_HOME : PSW_AS_PRIMARY;
+
+	switch (psw.as) {
 	case PSW_AS_PRIMARY:
 		asce->val = vcpu->arch.sie_block->gcr[1];
 		return 0;
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index 2a6f8bf..df0a79d 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -158,6 +158,7 @@ int read_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data,
 enum gacc_mode {
 	GACC_FETCH,
 	GACC_STORE,
+	GACC_IFETCH,
 };
 
 int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva,
@@ -244,6 +245,26 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data,
 }
 
 /**
+ * read_guest_instr - copy instruction data from guest space to kernel space
+ * @vcpu: virtual cpu
+ * @data: destination address in kernel space
+ * @len: number of bytes to copy
+ *
+ * Copy @len bytes from the current psw address (guest space) to @data (kernel
+ * space).
+ *
+ * The behaviour of read_guest_instr is identical to read_guest, except that
+ * instruction data will be read from primary space when in home-space or
+ * address-space mode.
+ */
+static inline __must_check
+int read_guest_instr(struct kvm_vcpu *vcpu, void *data, unsigned long len)
+{
+	return access_guest(vcpu, vcpu->arch.sie_block->gpsw.addr, 0, data, len,
+			    GACC_IFETCH);
+}
+
+/**
  * write_guest_abs - copy data from kernel space to guest space absolute
  * @vcpu: virtual cpu
  * @gpa: guest physical (absolute) address
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 07/18] KVM: s390: read the correct opcode on SIE faults
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (5 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 06/18] KVM: s390: gaccess: implement instruction fetching mode Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 08/18] KVM: s390: clean up prog irq injection on prog irq icpts Christian Borntraeger
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Let's use our fresh new function read_guest_instr() to access
guest storage via the correct addressing schema.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 85e169b..aa51a8d 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2163,7 +2163,6 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu)
 
 static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
 {
-	psw_t *psw = &vcpu->arch.sie_block->gpsw;
 	u8 opcode;
 	int rc;
 
@@ -2178,7 +2177,7 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
 	 * to look up the current opcode to get the length of the instruction
 	 * to be able to forward the PSW.
 	 */
-	rc = read_guest(vcpu, psw->addr, 0, &opcode, 1);
+	rc = read_guest_instr(vcpu, &opcode, 1);
 	if (rc)
 		return kvm_s390_inject_prog_cond(vcpu, rc);
 	kvm_s390_forward_psw(vcpu, insn_length(opcode));
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 08/18] KVM: s390: clean up prog irq injection on prog irq icpts
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (6 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 07/18] KVM: s390: read the correct opcode on SIE faults Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 09/18] KVM: s390: irq delivery should not rely on icptcode Christian Borntraeger
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

__extract_prog_irq() is used only once for getting the program check data
in one place. Let's combine it with an injection function to avoid a memset
and to prevent misuse on injection by simplifying the interface to only
have the VCPU as parameter.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/intercept.c | 41 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 44bb923..6b4e5b5 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -136,11 +136,11 @@ static int handle_instruction(struct kvm_vcpu *vcpu)
 	return -EOPNOTSUPP;
 }
 
-static void __extract_prog_irq(struct kvm_vcpu *vcpu,
-			       struct kvm_s390_pgm_info *pgm_info)
+static int inject_prog_on_prog_intercept(struct kvm_vcpu *vcpu)
 {
-	memset(pgm_info, 0, sizeof(struct kvm_s390_pgm_info));
-	pgm_info->code = vcpu->arch.sie_block->iprcc;
+	struct kvm_s390_pgm_info pgm_info = {
+		.code = vcpu->arch.sie_block->iprcc,
+	};
 
 	switch (vcpu->arch.sie_block->iprcc & ~PGM_PER) {
 	case PGM_AFX_TRANSLATION:
@@ -153,7 +153,7 @@ static void __extract_prog_irq(struct kvm_vcpu *vcpu,
 	case PGM_PRIMARY_AUTHORITY:
 	case PGM_SECONDARY_AUTHORITY:
 	case PGM_SPACE_SWITCH:
-		pgm_info->trans_exc_code = vcpu->arch.sie_block->tecmc;
+		pgm_info.trans_exc_code = vcpu->arch.sie_block->tecmc;
 		break;
 	case PGM_ALEN_TRANSLATION:
 	case PGM_ALE_SEQUENCE:
@@ -161,7 +161,7 @@ static void __extract_prog_irq(struct kvm_vcpu *vcpu,
 	case PGM_ASTE_SEQUENCE:
 	case PGM_ASTE_VALIDITY:
 	case PGM_EXTENDED_AUTHORITY:
-		pgm_info->exc_access_id = vcpu->arch.sie_block->eai;
+		pgm_info.exc_access_id = vcpu->arch.sie_block->eai;
 		break;
 	case PGM_ASCE_TYPE:
 	case PGM_PAGE_TRANSLATION:
@@ -169,32 +169,33 @@ static void __extract_prog_irq(struct kvm_vcpu *vcpu,
 	case PGM_REGION_SECOND_TRANS:
 	case PGM_REGION_THIRD_TRANS:
 	case PGM_SEGMENT_TRANSLATION:
-		pgm_info->trans_exc_code = vcpu->arch.sie_block->tecmc;
-		pgm_info->exc_access_id  = vcpu->arch.sie_block->eai;
-		pgm_info->op_access_id  = vcpu->arch.sie_block->oai;
+		pgm_info.trans_exc_code = vcpu->arch.sie_block->tecmc;
+		pgm_info.exc_access_id  = vcpu->arch.sie_block->eai;
+		pgm_info.op_access_id  = vcpu->arch.sie_block->oai;
 		break;
 	case PGM_MONITOR:
-		pgm_info->mon_class_nr = vcpu->arch.sie_block->mcn;
-		pgm_info->mon_code = vcpu->arch.sie_block->tecmc;
+		pgm_info.mon_class_nr = vcpu->arch.sie_block->mcn;
+		pgm_info.mon_code = vcpu->arch.sie_block->tecmc;
 		break;
 	case PGM_VECTOR_PROCESSING:
 	case PGM_DATA:
-		pgm_info->data_exc_code = vcpu->arch.sie_block->dxc;
+		pgm_info.data_exc_code = vcpu->arch.sie_block->dxc;
 		break;
 	case PGM_PROTECTION:
-		pgm_info->trans_exc_code = vcpu->arch.sie_block->tecmc;
-		pgm_info->exc_access_id  = vcpu->arch.sie_block->eai;
+		pgm_info.trans_exc_code = vcpu->arch.sie_block->tecmc;
+		pgm_info.exc_access_id  = vcpu->arch.sie_block->eai;
 		break;
 	default:
 		break;
 	}
 
 	if (vcpu->arch.sie_block->iprcc & PGM_PER) {
-		pgm_info->per_code = vcpu->arch.sie_block->perc;
-		pgm_info->per_atmid = vcpu->arch.sie_block->peratmid;
-		pgm_info->per_address = vcpu->arch.sie_block->peraddr;
-		pgm_info->per_access_id = vcpu->arch.sie_block->peraid;
+		pgm_info.per_code = vcpu->arch.sie_block->perc;
+		pgm_info.per_atmid = vcpu->arch.sie_block->peratmid;
+		pgm_info.per_address = vcpu->arch.sie_block->peraddr;
+		pgm_info.per_access_id = vcpu->arch.sie_block->peraid;
 	}
+	return kvm_s390_inject_prog_irq(vcpu, &pgm_info);
 }
 
 /*
@@ -223,7 +224,6 @@ static int handle_itdb(struct kvm_vcpu *vcpu)
 
 static int handle_prog(struct kvm_vcpu *vcpu)
 {
-	struct kvm_s390_pgm_info pgm_info;
 	psw_t psw;
 	int rc;
 
@@ -249,8 +249,7 @@ static int handle_prog(struct kvm_vcpu *vcpu)
 	if (rc)
 		return rc;
 
-	__extract_prog_irq(vcpu, &pgm_info);
-	return kvm_s390_inject_prog_irq(vcpu, &pgm_info);
+	return inject_prog_on_prog_intercept(vcpu);
 }
 
 /**
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 09/18] KVM: s390: irq delivery should not rely on icptcode
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (7 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 08/18] KVM: s390: clean up prog irq injection on prog irq icpts Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 10/18] KVM: s390: provide prog irq ilc on SIE faults Christian Borntraeger
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Program irq injection during program irq intercepts is the last candidates
that injects nullifying irqs and relies on delivery to do the right thing.

As we should not rely on the icptcode during any delivery (because that
value will not be migrated), let's add a flag, telling prog IRQ delivery
to not rewind the PSW in case of nullifying prog IRQs.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/intercept.c | 2 ++
 arch/s390/kvm/interrupt.c | 2 +-
 include/uapi/linux/kvm.h  | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 6b4e5b5..2e6b54e 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -140,6 +140,8 @@ static int inject_prog_on_prog_intercept(struct kvm_vcpu *vcpu)
 {
 	struct kvm_s390_pgm_info pgm_info = {
 		.code = vcpu->arch.sie_block->iprcc,
+		/* the PSW has already been rewound */
+		.flags = KVM_S390_PGM_FLAGS_NO_REWIND,
 	};
 
 	switch (vcpu->arch.sie_block->iprcc & ~PGM_PER) {
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index e594a78..87e2d1a 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -665,7 +665,7 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
 				   (u8 *) __LC_PER_ACCESS_ID);
 	}
 
-	if (nullifying && vcpu->arch.sie_block->icptcode == ICPT_INST)
+	if (nullifying && !(pgm_info.flags & KVM_S390_PGM_FLAGS_NO_REWIND))
 		kvm_s390_rewind_psw(vcpu, ilen);
 
 	/* bit 1+2 of the target are the ilc, so we can directly use ilen */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 4e20a40..a2fe0ac 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -545,6 +545,7 @@ struct kvm_s390_pgm_info {
 #define KVM_S390_PGM_FLAGS_ILC_0	0x02
 #define KVM_S390_PGM_FLAGS_ILC_1	0x04
 #define KVM_S390_PGM_FLAGS_ILC_MASK	0x06
+#define KVM_S390_PGM_FLAGS_NO_REWIND	0x08
 	__u8 flags;
 	__u8 pad[2];
 };
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 10/18] KVM: s390: provide prog irq ilc on SIE faults
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (8 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 09/18] KVM: s390: irq delivery should not rely on icptcode Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 11/18] KVM: s390: instruction-fetching exceptions " Christian Borntraeger
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

On SIE faults, the ilc cannot be detected automatically, as the icptcode
is 0. The ilc indicated in the program irq will always be 0. Therefore we
have to manually specify the ilc in order to tell the guest which ilen was
used when forwarding the PSW.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index aa51a8d..12cec63ed 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2163,7 +2163,10 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu)
 
 static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
 {
-	u8 opcode;
+	struct kvm_s390_pgm_info pgm_info = {
+		.code = PGM_ADDRESSING,
+	};
+	u8 opcode, ilen;
 	int rc;
 
 	VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
@@ -2180,9 +2183,10 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
 	rc = read_guest_instr(vcpu, &opcode, 1);
 	if (rc)
 		return kvm_s390_inject_prog_cond(vcpu, rc);
-	kvm_s390_forward_psw(vcpu, insn_length(opcode));
-
-	return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
+	ilen = insn_length(opcode);
+	pgm_info.flags = ilen | KVM_S390_PGM_FLAGS_ILC_VALID;
+	kvm_s390_forward_psw(vcpu, ilen);
+	return kvm_s390_inject_prog_irq(vcpu, &pgm_info);
 }
 
 static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 11/18] KVM: s390: instruction-fetching exceptions on SIE faults
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (9 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 10/18] KVM: s390: provide prog irq ilc on SIE faults Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 12/18] KVM: s390: remove old fragment of vector registers Christian Borntraeger
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

On instruction-fetch exceptions, we have to forward the PSW by any
valid ilc and correctly use that ilc when injecting the irq. Injection
will already take care of rewinding the PSW if we injected a nullifying
program irq, so we don't need special handling prior to injection.

Until now, autodetection would have guessed an ilc of 0.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 12cec63ed..d0dcf73 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2181,9 +2181,17 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
 	 * to be able to forward the PSW.
 	 */
 	rc = read_guest_instr(vcpu, &opcode, 1);
-	if (rc)
-		return kvm_s390_inject_prog_cond(vcpu, rc);
 	ilen = insn_length(opcode);
+	if (rc < 0) {
+		return rc;
+	} else if (rc) {
+		/* Instruction-Fetching Exceptions - we can't detect the ilen.
+		 * Forward by arbitrary ilc, injection will take care of
+		 * nullification if necessary.
+		 */
+		pgm_info = vcpu->arch.pgm;
+		ilen = 4;
+	}
 	pgm_info.flags = ilen | KVM_S390_PGM_FLAGS_ILC_VALID;
 	kvm_s390_forward_psw(vcpu, ilen);
 	return kvm_s390_inject_prog_irq(vcpu, &pgm_info);
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 12/18] KVM: s390: remove old fragment of vector registers
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (10 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 11/18] KVM: s390: instruction-fetching exceptions " Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 13/18] KVM: s390: add documentation of KVM_S390_VM_TOD Christian Borntraeger
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Since commit 9977e886cbbc ("s390/kernel: lazy restore fpu registers"),
vregs in struct sie_page is unsed. We can safely remove the field and
the definition.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/include/asm/kvm_host.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 8959ebb..727e7f7 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -229,17 +229,11 @@ struct kvm_s390_itdb {
 	__u8	data[256];
 } __packed;
 
-struct kvm_s390_vregs {
-	__vector128 vrs[32];
-	__u8	reserved200[512];	/* for future vector expansion */
-} __packed;
-
 struct sie_page {
 	struct kvm_s390_sie_block sie_block;
 	__u8 reserved200[1024];		/* 0x0200 */
 	struct kvm_s390_itdb itdb;	/* 0x0600 */
-	__u8 reserved700[1280];		/* 0x0700 */
-	struct kvm_s390_vregs vregs;	/* 0x0c00 */
+	__u8 reserved700[2304];		/* 0x0700 */
 } __packed;
 
 struct kvm_vcpu_stat {
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 13/18] KVM: s390: add documentation of KVM_S390_VM_TOD
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (11 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 12/18] KVM: s390: remove old fragment of vector registers Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 14/18] KVM: s390: add documentation of KVM_S390_VM_CRYPTO Christian Borntraeger
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Let's properly document KVM_S390_VM_TOD and its attributes.

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 Documentation/virtual/kvm/devices/vm.txt | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/virtual/kvm/devices/vm.txt b/Documentation/virtual/kvm/devices/vm.txt
index f083a16..27c1a3b 100644
--- a/Documentation/virtual/kvm/devices/vm.txt
+++ b/Documentation/virtual/kvm/devices/vm.txt
@@ -84,3 +84,22 @@ Returns:    -EBUSY in case 1 or more vcpus are already activated (only in write
 	    -EFAULT if the given address is not accessible from kernel space
 	    -ENOMEM if not enough memory is available to process the ioctl
 	    0 in case of success
+
+3. GROUP: KVM_S390_VM_TOD
+Architectures: s390
+
+3.1. ATTRIBUTE: KVM_S390_VM_TOD_HIGH
+
+Allows user space to set/get the TOD clock extension (u8).
+
+Parameters: address of a buffer in user space to store the data (u8) to
+Returns:    -EFAULT if the given address is not accessible from kernel space
+	    -EINVAL if setting the TOD clock extension to != 0 is not supported
+
+3.2. ATTRIBUTE: KVM_S390_VM_TOD_LOW
+
+Allows user space to set/get bits 0-63 of the TOD clock register as defined in
+the POP (u64).
+
+Parameters: address of a buffer in user space to store the data (u64) to
+Returns:    -EFAULT if the given address is not accessible from kernel space
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 14/18] KVM: s390: add documentation of KVM_S390_VM_CRYPTO
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (12 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 13/18] KVM: s390: add documentation of KVM_S390_VM_TOD Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:22 ` [GIT PULL 15/18] KVM: s390: usage hint for adapter mappings Christian Borntraeger
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Let's properly document KVM_S390_VM_CRYPTO and its attributes.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 Documentation/virtual/kvm/devices/vm.txt | 33 ++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/Documentation/virtual/kvm/devices/vm.txt b/Documentation/virtual/kvm/devices/vm.txt
index 27c1a3b..a9ea877 100644
--- a/Documentation/virtual/kvm/devices/vm.txt
+++ b/Documentation/virtual/kvm/devices/vm.txt
@@ -103,3 +103,36 @@ the POP (u64).
 
 Parameters: address of a buffer in user space to store the data (u64) to
 Returns:    -EFAULT if the given address is not accessible from kernel space
+
+4. GROUP: KVM_S390_VM_CRYPTO
+Architectures: s390
+
+4.1. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_AES_KW (w/o)
+
+Allows user space to enable aes key wrapping, including generating a new
+wrapping key.
+
+Parameters: none
+Returns:    0
+
+4.2. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_DEA_KW (w/o)
+
+Allows user space to enable dea key wrapping, including generating a new
+wrapping key.
+
+Parameters: none
+Returns:    0
+
+4.3. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_AES_KW (w/o)
+
+Allows user space to disable aes key wrapping, clearing the wrapping key.
+
+Parameters: none
+Returns:    0
+
+4.4. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_DEA_KW (w/o)
+
+Allows user space to disable dea key wrapping, clearing the wrapping key.
+
+Parameters: none
+Returns:    0
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 15/18] KVM: s390: usage hint for adapter mappings
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (13 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 14/18] KVM: s390: add documentation of KVM_S390_VM_CRYPTO Christian Borntraeger
@ 2016-02-12 13:22 ` Christian Borntraeger
  2016-02-12 13:23 ` [GIT PULL 16/18] KVM: s390: do not take mmap_sem on dirty log query Christian Borntraeger
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:22 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

From: Cornelia Huck <cornelia.huck@de.ibm.com>

The interface for adapter mappings was designed with code in mind
that maps each address only once; let's document this.

Otherwise, duplicate mappings are added to the list, which makes
the code ineffective and uses up the limited amount of mapping
needlessly.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 Documentation/virtual/kvm/devices/s390_flic.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/virtual/kvm/devices/s390_flic.txt b/Documentation/virtual/kvm/devices/s390_flic.txt
index d1ad9d5..e3e314c 100644
--- a/Documentation/virtual/kvm/devices/s390_flic.txt
+++ b/Documentation/virtual/kvm/devices/s390_flic.txt
@@ -88,6 +88,8 @@ struct kvm_s390_io_adapter_req {
       perform a gmap translation for the guest address provided in addr,
       pin a userspace page for the translated address and add it to the
       list of mappings
+      Note: A new mapping will be created unconditionally; therefore,
+            the calling code should avoid making duplicate mappings.
 
     KVM_S390_IO_ADAPTER_UNMAP
       release a userspace page for the translated address specified in addr
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 16/18] KVM: s390: do not take mmap_sem on dirty log query
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (14 preceding siblings ...)
  2016-02-12 13:22 ` [GIT PULL 15/18] KVM: s390: usage hint for adapter mappings Christian Borntraeger
@ 2016-02-12 13:23 ` Christian Borntraeger
  2016-02-12 13:23 ` [GIT PULL 17/18] KVM: s390: do not block CPU on dirty logging Christian Borntraeger
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:23 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

Dirty log query can take a long time for huge guests.
Holding the mmap_sem for very long times  can cause some unwanted
latencies.
Turns out that we do not need to hold the mmap semaphore.
We hold the slots_lock for gfn->hva translation and walk the page
tables with that address, so no need to look at the VMAs. KVM also
holds a reference to the mm, which should prevent other things
going away. During the walk we take the necessary ptl locks.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d0dcf73..d4bcd86 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -274,7 +274,6 @@ static void kvm_s390_sync_dirty_log(struct kvm *kvm,
 	unsigned long address;
 	struct gmap *gmap = kvm->arch.gmap;
 
-	down_read(&gmap->mm->mmap_sem);
 	/* Loop over all guest pages */
 	last_gfn = memslot->base_gfn + memslot->npages;
 	for (cur_gfn = memslot->base_gfn; cur_gfn <= last_gfn; cur_gfn++) {
@@ -283,7 +282,6 @@ static void kvm_s390_sync_dirty_log(struct kvm *kvm,
 		if (gmap_test_and_clear_dirty(address, gmap))
 			mark_page_dirty(kvm, cur_gfn);
 	}
-	up_read(&gmap->mm->mmap_sem);
 }
 
 /* Section: vm related */
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 17/18] KVM: s390: do not block CPU on dirty logging
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (15 preceding siblings ...)
  2016-02-12 13:23 ` [GIT PULL 16/18] KVM: s390: do not take mmap_sem on dirty log query Christian Borntraeger
@ 2016-02-12 13:23 ` Christian Borntraeger
  2016-02-12 13:23 ` [GIT PULL 18/18] KVM: s390: bail out early on fatal signal in " Christian Borntraeger
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:23 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

When doing dirty logging on huge guests (e.g.600GB) we sometimes
get rcu stall timeouts with backtraces like

[ 2753.194083] ([<0000000000112fb2>] show_trace+0x12a/0x130)
[ 2753.194092]  [<0000000000113024>] show_stack+0x6c/0xe8
[ 2753.194094]  [<00000000001ee6a8>] rcu_pending+0x358/0xa48
[ 2753.194099]  [<00000000001f20cc>] rcu_check_callbacks+0x84/0x168
[ 2753.194102]  [<0000000000167654>] update_process_times+0x54/0x80
[ 2753.194107]  [<00000000001bdb5c>] tick_sched_handle.isra.16+0x4c/0x60
[ 2753.194113]  [<00000000001bdbd8>] tick_sched_timer+0x68/0x90
[ 2753.194115]  [<0000000000182a88>] __run_hrtimer+0x88/0x1f8
[ 2753.194119]  [<00000000001838ba>] hrtimer_interrupt+0x122/0x2b0
[ 2753.194121]  [<000000000010d034>] do_extint+0x16c/0x170
[ 2753.194123]  [<00000000005e206e>] ext_skip+0x38/0x3e
[ 2753.194129]  [<000000000012157c>] gmap_test_and_clear_dirty+0xcc/0x118
[ 2753.194134] ([<00000000001214ea>] gmap_test_and_clear_dirty+0x3a/0x118)
[ 2753.194137]  [<0000000000132da4>] kvm_vm_ioctl_get_dirty_log+0xd4/0x1b0
[ 2753.194143]  [<000000000012ac12>] kvm_vm_ioctl+0x21a/0x548
[ 2753.194146]  [<00000000002b57f6>] do_vfs_ioctl+0x30e/0x518
[ 2753.194149]  [<00000000002b5a9c>] SyS_ioctl+0x9c/0xb0
[ 2753.194151]  [<00000000005e1ae6>] sysc_tracego+0x14/0x1a
[ 2753.194153]  [<000003ffb75f3972>] 0x3ffb75f3972

We should do a cond_resched in here.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d4bcd86..bb99ca2 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -281,6 +281,7 @@ static void kvm_s390_sync_dirty_log(struct kvm *kvm,
 
 		if (gmap_test_and_clear_dirty(address, gmap))
 			mark_page_dirty(kvm, cur_gfn);
+		cond_resched();
 	}
 }
 
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [GIT PULL 18/18] KVM: s390: bail out early on fatal signal in dirty logging
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (16 preceding siblings ...)
  2016-02-12 13:23 ` [GIT PULL 17/18] KVM: s390: do not block CPU on dirty logging Christian Borntraeger
@ 2016-02-12 13:23 ` Christian Borntraeger
  2016-02-12 15:51 ` [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Paolo Bonzini
  2016-02-16 17:48 ` Paolo Bonzini
  19 siblings, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 13:23 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

A KVM_GET_DIRTY_LOG ioctl might take a long time.
This can result in fatal signals seemingly being ignored.
Lets bail out during the dirty bit sync, if a fatal signal
is pending.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index bb99ca2..28bd5ea 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -281,6 +281,8 @@ static void kvm_s390_sync_dirty_log(struct kvm *kvm,
 
 		if (gmap_test_and_clear_dirty(address, gmap))
 			mark_page_dirty(kvm, cur_gfn);
+		if (fatal_signal_pending(current))
+			return;
 		cond_resched();
 	}
 }
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (17 preceding siblings ...)
  2016-02-12 13:23 ` [GIT PULL 18/18] KVM: s390: bail out early on fatal signal in " Christian Borntraeger
@ 2016-02-12 15:51 ` Paolo Bonzini
  2016-02-12 15:54   ` Christian Borntraeger
  2016-02-16 17:48 ` Paolo Bonzini
  19 siblings, 1 reply; 28+ messages in thread
From: Paolo Bonzini @ 2016-02-12 15:51 UTC (permalink / raw
  To: Christian Borntraeger
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf



On 12/02/2016 14:22, Christian Borntraeger wrote:
> This time with less testing than usual on the branch itself, as 4.5-rc3
> is broken in several ways (with fixes or workarounds or people working on
> the issues). So this time these patches have been partially tested against
> a 4.4 base and partially tested agains kvm/next :-/

Do you want to send them against 4.4 instead?  That would simplify
bisection in the future.

Paolo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 15:51 ` [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Paolo Bonzini
@ 2016-02-12 15:54   ` Christian Borntraeger
  2016-02-12 16:00     ` Paolo Bonzini
  0 siblings, 1 reply; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 15:54 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

On 02/12/2016 04:51 PM, Paolo Bonzini wrote:
> 
> 
> On 12/02/2016 14:22, Christian Borntraeger wrote:
>> This time with less testing than usual on the branch itself, as 4.5-rc3
>> is broken in several ways (with fixes or workarounds or people working on
>> the issues). So this time these patches have been partially tested against
>> a 4.4 base and partially tested agains kvm/next :-/
> 
> Do you want to send them against 4.4 instead?  That would simplify
> bisection in the future.

I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
on 4.4 as well, I just had it fixed earlier.

As you like, I can certainly rebase against 4.4, I am (un)happy with both.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 15:54   ` Christian Borntraeger
@ 2016-02-12 16:00     ` Paolo Bonzini
  2016-02-12 16:08       ` Christian Borntraeger
  0 siblings, 1 reply; 28+ messages in thread
From: Paolo Bonzini @ 2016-02-12 16:00 UTC (permalink / raw
  To: Christian Borntraeger
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf



On 12/02/2016 16:54, Christian Borntraeger wrote:
> I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
> on 4.4 as well, I just had it fixed earlier.

If these three patches are in Linus's tree, just send the pull request
against that.  It's okay if a submaintainer pull request brings back a
few more commits from Linus's tree.

Rebases aren't great, but no one should be basing a linux-next tree on
kvm-s390/next so I guess that's not too evil a thing to do.

What is the patch you need on top of 4.4?  If the alternative is to
rebase on top of 4.4 + "that patch", I can plan my pull so that it
doesn't cause conflicts when I will send this stuff to Linus for the 4.6
merge window.

Paolo

> As you like, I can certainly rebase against 4.4, I am (un)happy with both.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 16:00     ` Paolo Bonzini
@ 2016-02-12 16:08       ` Christian Borntraeger
  2016-02-12 16:15         ` Christian Borntraeger
  2016-02-12 16:18         ` Paolo Bonzini
  0 siblings, 2 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 16:08 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

On 02/12/2016 05:00 PM, Paolo Bonzini wrote:
> 
> 
> On 12/02/2016 16:54, Christian Borntraeger wrote:
>> I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
>> on 4.4 as well, I just had it fixed earlier.
> 
> If these three patches are in Linus's tree, just send the pull request
> against that.  It's okay if a submaintainer pull request brings back a
> few more commits from Linus's tree.

Not yet in Linus tree (cgroup-fixes mostly)

> 
> Rebases aren't great, but no one should be basing a linux-next tree on
> kvm-s390/next so I guess that's not too evil a thing to do.

Yes, kvm-s390/next can certainly be rebased, right now I do not have a working
upstream commit >4.4.

What I could do is to use my old pull request for kvm/next that was
targetted for 4.5. That tree did survive some testing, so basically rebase
against kvm-s390-next-4.5-3 ?


Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 16:08       ` Christian Borntraeger
@ 2016-02-12 16:15         ` Christian Borntraeger
  2016-02-12 16:18         ` Paolo Bonzini
  1 sibling, 0 replies; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 16:15 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

On 02/12/2016 05:08 PM, Christian Borntraeger wrote:
> On 02/12/2016 05:00 PM, Paolo Bonzini wrote:
>>
>>
>> On 12/02/2016 16:54, Christian Borntraeger wrote:
>>> I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
>>> on 4.4 as well, I just had it fixed earlier.
>>
>> If these three patches are in Linus's tree, just send the pull request
>> against that.  It's okay if a submaintainer pull request brings back a
>> few more commits from Linus's tree.
> 
> Not yet in Linus tree (cgroup-fixes mostly)
> 
>>
>> Rebases aren't great, but no one should be basing a linux-next tree on
>> kvm-s390/next so I guess that's not too evil a thing to do.
> 
> Yes, kvm-s390/next can certainly be rebased, right now I do not have a working
> upstream commit >4.4.
> 
> What I could do is to use my old pull request for kvm/next that was
> targetted for 4.5. That tree did survive some testing, so basically rebase
> against kvm-s390-next-4.5-3 ?

Hmmm, nope. This has some fallout that we both have to fix as conflicts.
I will simply retest the 4.5 branch with cherry-picks and thp disabled.

Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 16:08       ` Christian Borntraeger
  2016-02-12 16:15         ` Christian Borntraeger
@ 2016-02-12 16:18         ` Paolo Bonzini
  2016-02-12 19:31           ` Christian Borntraeger
  1 sibling, 1 reply; 28+ messages in thread
From: Paolo Bonzini @ 2016-02-12 16:18 UTC (permalink / raw
  To: Christian Borntraeger
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf



On 12/02/2016 17:08, Christian Borntraeger wrote:
>>> I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
>>> on 4.4 as well, I just had it fixed earlier.
>>
>> If these three patches are in Linus's tree, just send the pull request
>> against that.  It's okay if a submaintainer pull request brings back a
>> few more commits from Linus's tree.
> 
> Not yet in Linus tree (cgroup-fixes mostly)

As long as the bugs only surface with libvirt, I guess that's acceptable.

Paolo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 16:18         ` Paolo Bonzini
@ 2016-02-12 19:31           ` Christian Borntraeger
  2016-02-12 22:25             ` Paolo Bonzini
  0 siblings, 1 reply; 28+ messages in thread
From: Christian Borntraeger @ 2016-02-12 19:31 UTC (permalink / raw
  To: Paolo Bonzini
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

On 02/12/2016 05:18 PM, Paolo Bonzini wrote:
> 
> 
> On 12/02/2016 17:08, Christian Borntraeger wrote:
>>>> I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
>>>> on 4.4 as well, I just had it fixed earlier.
>>>
>>> If these three patches are in Linus's tree, just send the pull request
>>> against that.  It's okay if a submaintainer pull request brings back a
>>> few more commits from Linus's tree.
>>
>> Not yet in Linus tree (cgroup-fixes mostly)
> 
> As long as the bugs only surface with libvirt, I guess that's acceptable.

If disabling the cpuset controller in libvirt + disabling thp is considered
ok for bisecting, then you can go ahead and pull. Otherwise I can wait for
the cgroup fix tree to be pulled and then rebase. 

Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 19:31           ` Christian Borntraeger
@ 2016-02-12 22:25             ` Paolo Bonzini
  0 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2016-02-12 22:25 UTC (permalink / raw
  To: Christian Borntraeger
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf



On 12/02/2016 20:31, Christian Borntraeger wrote:
> On 02/12/2016 05:18 PM, Paolo Bonzini wrote:
>>
>>
>> On 12/02/2016 17:08, Christian Borntraeger wrote:
>>>>> I need one patch for 4.4 as well (vs. 3 patches against 4.5-rc3). So bisect is broken
>>>>> on 4.4 as well, I just had it fixed earlier.
>>>>
>>>> If these three patches are in Linus's tree, just send the pull request
>>>> against that.  It's okay if a submaintainer pull request brings back a
>>>> few more commits from Linus's tree.
>>>
>>> Not yet in Linus tree (cgroup-fixes mostly)
>>
>> As long as the bugs only surface with libvirt, I guess that's acceptable.
> 
> If disabling the cpuset controller in libvirt + disabling thp is considered
> ok for bisecting, then you can go ahead and pull.

Well, certainly not optimal but feasible.

> Otherwise I can wait for
> the cgroup fix tree to be pulled and then rebase. 

Ok, then I'll pull it and add a note in the merge commit to Linus.

Paolo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6)
  2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
                   ` (18 preceding siblings ...)
  2016-02-12 15:51 ` [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Paolo Bonzini
@ 2016-02-16 17:48 ` Paolo Bonzini
  19 siblings, 0 replies; 28+ messages in thread
From: Paolo Bonzini @ 2016-02-16 17:48 UTC (permalink / raw
  To: Christian Borntraeger
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf



On 12/02/2016 14:22, Christian Borntraeger wrote:
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-next-4.6-1

Pulled, thanks.  Not so fast this time. :)

Paolo

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2016-02-16 17:48 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12 13:22 [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 01/18] KVM: s390: allow sync of fp registers via vregs Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 02/18] KVM: s390: sync of fp registers via kvm_run Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 03/18] KVM: s390: PSW forwarding / rewinding / ilc rework Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 04/18] KVM: s390: migration / injection of prog irq ilc Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 05/18] KVM: s390: gaccess: introduce access modes Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 06/18] KVM: s390: gaccess: implement instruction fetching mode Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 07/18] KVM: s390: read the correct opcode on SIE faults Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 08/18] KVM: s390: clean up prog irq injection on prog irq icpts Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 09/18] KVM: s390: irq delivery should not rely on icptcode Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 10/18] KVM: s390: provide prog irq ilc on SIE faults Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 11/18] KVM: s390: instruction-fetching exceptions " Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 12/18] KVM: s390: remove old fragment of vector registers Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 13/18] KVM: s390: add documentation of KVM_S390_VM_TOD Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 14/18] KVM: s390: add documentation of KVM_S390_VM_CRYPTO Christian Borntraeger
2016-02-12 13:22 ` [GIT PULL 15/18] KVM: s390: usage hint for adapter mappings Christian Borntraeger
2016-02-12 13:23 ` [GIT PULL 16/18] KVM: s390: do not take mmap_sem on dirty log query Christian Borntraeger
2016-02-12 13:23 ` [GIT PULL 17/18] KVM: s390: do not block CPU on dirty logging Christian Borntraeger
2016-02-12 13:23 ` [GIT PULL 18/18] KVM: s390: bail out early on fatal signal in " Christian Borntraeger
2016-02-12 15:51 ` [GIT PULL 00/18] KVM: s390: Fixes and features for kvm/next (4.6) Paolo Bonzini
2016-02-12 15:54   ` Christian Borntraeger
2016-02-12 16:00     ` Paolo Bonzini
2016-02-12 16:08       ` Christian Borntraeger
2016-02-12 16:15         ` Christian Borntraeger
2016-02-12 16:18         ` Paolo Bonzini
2016-02-12 19:31           ` Christian Borntraeger
2016-02-12 22:25             ` Paolo Bonzini
2016-02-16 17:48 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).