* [GIT PULL 1/6] s390x/mm: cleanup gmap_pte_op_walk()
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
@ 2018-01-16 15:03 ` Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 2/6] KVM: s390: use created_vcpus in more places Christian Borntraeger
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:03 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, Christian Borntraeger, linux-s390,
Janosch Frank
From: David Hildenbrand <david@redhat.com>
gmap_mprotect_notify() refuses shadow gmaps. Turns out that
a) gmap_protect_range()
b) gmap_read_table()
c) gmap_pte_op_walk()
Are never called for gmap shadows. And never should be. This dates back
to gmap shadow prototypes where we allowed to call mprotect_notify() on
the gmap shadow (to get notified about the prefix pages getting removed).
This is avoided by always getting notified about any change on the gmap
shadow.
The only real function for walking page tables on shadow gmaps is
gmap_table_walk().
So, essentially, these functions should never get called and
gmap_pte_op_walk() can be cleaned up. Add some checks to callers of
gmap_pte_op_walk().
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20171110151805.7541-1-david@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/mm/gmap.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 05d459b638f5..54cfd51a5a27 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -815,27 +815,17 @@ static inline unsigned long *gmap_table_walk(struct gmap *gmap,
* @ptl: pointer to the spinlock pointer
*
* Returns a pointer to the locked pte for a guest address, or NULL
- *
- * Note: Can also be called for shadow gmaps.
*/
static pte_t *gmap_pte_op_walk(struct gmap *gmap, unsigned long gaddr,
spinlock_t **ptl)
{
unsigned long *table;
- if (gmap_is_shadow(gmap))
- spin_lock(&gmap->guest_table_lock);
+ BUG_ON(gmap_is_shadow(gmap));
/* Walk the gmap page table, lock and get pte pointer */
table = gmap_table_walk(gmap, gaddr, 1); /* get segment pointer */
- if (!table || *table & _SEGMENT_ENTRY_INVALID) {
- if (gmap_is_shadow(gmap))
- spin_unlock(&gmap->guest_table_lock);
+ if (!table || *table & _SEGMENT_ENTRY_INVALID)
return NULL;
- }
- if (gmap_is_shadow(gmap)) {
- *ptl = &gmap->guest_table_lock;
- return pte_offset_map((pmd_t *) table, gaddr);
- }
return pte_alloc_map_lock(gmap->mm, (pmd_t *) table, gaddr, ptl);
}
@@ -889,8 +879,6 @@ static void gmap_pte_op_end(spinlock_t *ptl)
* -EFAULT if gaddr is invalid (or mapping for shadows is missing).
*
* Called with sg->mm->mmap_sem in read.
- *
- * Note: Can also be called for shadow gmaps.
*/
static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr,
unsigned long len, int prot, unsigned long bits)
@@ -900,6 +888,7 @@ static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr,
pte_t *ptep;
int rc;
+ BUG_ON(gmap_is_shadow(gmap));
while (len) {
rc = -EAGAIN;
ptep = gmap_pte_op_walk(gmap, gaddr, &ptl);
@@ -960,7 +949,8 @@ EXPORT_SYMBOL_GPL(gmap_mprotect_notify);
* @val: pointer to the unsigned long value to return
*
* Returns 0 if the value was read, -ENOMEM if out of memory and -EFAULT
- * if reading using the virtual address failed.
+ * if reading using the virtual address failed. -EINVAL if called on a gmap
+ * shadow.
*
* Called with gmap->mm->mmap_sem in read.
*/
@@ -971,6 +961,9 @@ int gmap_read_table(struct gmap *gmap, unsigned long gaddr, unsigned long *val)
pte_t *ptep, pte;
int rc;
+ if (gmap_is_shadow(gmap))
+ return -EINVAL;
+
while (1) {
rc = -EAGAIN;
ptep = gmap_pte_op_walk(gmap, gaddr, &ptl);
--
2.13.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [GIT PULL 2/6] KVM: s390: use created_vcpus in more places
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 1/6] s390x/mm: cleanup gmap_pte_op_walk() Christian Borntraeger
@ 2018-01-16 15:03 ` Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 3/6] KVM: s390: add debug tracing for cpu features of CPU model Christian Borntraeger
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:03 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, Christian Borntraeger, linux-s390,
Janosch Frank
commit a03825bbd0c3 ("KVM: s390: use kvm->created_vcpus") introduced
kvm->created_vcpus to avoid races with the existing kvm->online_vcpus
scheme. One place was "forgotten" and one new place was "added".
Let's fix those.
Reported-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Fixes: 4e0b1ab72b8a ("KVM: s390: gs support for kvm guests")
Fixes: a03825bbd0c3 ("KVM: s390: use kvm->created_vcpus")
---
arch/s390/kvm/kvm-s390.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 40f0ae5a883f..00ef6f47e466 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -573,7 +573,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
case KVM_CAP_S390_GS:
r = -EINVAL;
mutex_lock(&kvm->lock);
- if (atomic_read(&kvm->online_vcpus)) {
+ if (kvm->created_vcpus) {
r = -EBUSY;
} else if (test_facility(133)) {
set_kvm_facility(kvm->arch.model.fac_mask, 133);
@@ -1094,7 +1094,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
return -EINVAL;
mutex_lock(&kvm->lock);
- if (!atomic_read(&kvm->online_vcpus)) {
+ if (!kvm->created_vcpus) {
bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
KVM_S390_VM_CPU_FEAT_NR_BITS);
ret = 0;
--
2.13.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [GIT PULL 3/6] KVM: s390: add debug tracing for cpu features of CPU model
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 1/6] s390x/mm: cleanup gmap_pte_op_walk() Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 2/6] KVM: s390: use created_vcpus in more places Christian Borntraeger
@ 2018-01-16 15:03 ` Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 4/6] KVM: s390: drop use of spin lock in __floating_irq_kick Christian Borntraeger
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:03 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, Christian Borntraeger, linux-s390,
Janosch Frank
The cpu model already traces the cpu facilities, the ibc and
guest CPU ids. We should do the same for the cpu features (on
success only).
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
arch/s390/kvm/kvm-s390.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 00ef6f47e466..c85d7c4e8a38 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1084,7 +1084,6 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
struct kvm_device_attr *attr)
{
struct kvm_s390_vm_cpu_feat data;
- int ret = -EBUSY;
if (copy_from_user(&data, (void __user *)attr->addr, sizeof(data)))
return -EFAULT;
@@ -1094,13 +1093,18 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
return -EINVAL;
mutex_lock(&kvm->lock);
- if (!kvm->created_vcpus) {
- bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
- KVM_S390_VM_CPU_FEAT_NR_BITS);
- ret = 0;
+ if (kvm->created_vcpus) {
+ mutex_unlock(&kvm->lock);
+ return -EBUSY;
}
+ bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
+ KVM_S390_VM_CPU_FEAT_NR_BITS);
mutex_unlock(&kvm->lock);
- return ret;
+ VM_EVENT(kvm, 3, "SET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
+ data.feat[0],
+ data.feat[1],
+ data.feat[2]);
+ return 0;
}
static int kvm_s390_set_processor_subfunc(struct kvm *kvm,
@@ -1202,6 +1206,10 @@ static int kvm_s390_get_processor_feat(struct kvm *kvm,
KVM_S390_VM_CPU_FEAT_NR_BITS);
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
return -EFAULT;
+ VM_EVENT(kvm, 3, "GET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
+ data.feat[0],
+ data.feat[1],
+ data.feat[2]);
return 0;
}
@@ -1215,6 +1223,10 @@ static int kvm_s390_get_machine_feat(struct kvm *kvm,
KVM_S390_VM_CPU_FEAT_NR_BITS);
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
return -EFAULT;
+ VM_EVENT(kvm, 3, "GET: host feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
+ data.feat[0],
+ data.feat[1],
+ data.feat[2]);
return 0;
}
--
2.13.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [GIT PULL 4/6] KVM: s390: drop use of spin lock in __floating_irq_kick
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
` (2 preceding siblings ...)
2018-01-16 15:03 ` [GIT PULL 3/6] KVM: s390: add debug tracing for cpu features of CPU model Christian Borntraeger
@ 2018-01-16 15:03 ` Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 5/6] kvm_config: add CONFIG_S390_GUEST Christian Borntraeger
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:03 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, Christian Borntraeger, linux-s390,
Janosch Frank
From: Michael Mueller <mimu@linux.vnet.ibm.com>
It is not required to take to a lock to protect access to the cpuflags
of the local interrupt structure of a vcpu as the performed operation
is an atomic_or.
Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/kvm/interrupt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 024ad8bcc516..818aa4248b0f 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1569,7 +1569,6 @@ static void __floating_irq_kick(struct kvm *kvm, u64 type)
/* make the VCPU drop out of the SIE, or wake it up if sleeping */
li = &dst_vcpu->arch.local_int;
- spin_lock(&li->lock);
switch (type) {
case KVM_S390_MCHK:
atomic_or(CPUSTAT_STOP_INT, li->cpuflags);
@@ -1581,7 +1580,6 @@ static void __floating_irq_kick(struct kvm *kvm, u64 type)
atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
break;
}
- spin_unlock(&li->lock);
kvm_s390_vcpu_wakeup(dst_vcpu);
}
--
2.13.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [GIT PULL 5/6] kvm_config: add CONFIG_S390_GUEST
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
` (3 preceding siblings ...)
2018-01-16 15:03 ` [GIT PULL 4/6] KVM: s390: drop use of spin lock in __floating_irq_kick Christian Borntraeger
@ 2018-01-16 15:03 ` Christian Borntraeger
2018-01-16 15:03 ` [GIT PULL 6/6] KVM: s390: cleanup struct kvm_s390_float_interrupt Christian Borntraeger
2018-01-16 15:09 ` [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Paolo Bonzini
6 siblings, 0 replies; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:03 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, Christian Borntraeger, linux-s390,
Janosch Frank
make kvmconfig currently does not select CONFIG_S390_GUEST. Since
the virtio-ccw transport depends on CONFIG_S390_GUEST, we want
to add CONFIG_S390_GUEST to kvmconfig.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
---
kernel/configs/kvm_guest.config | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/configs/kvm_guest.config b/kernel/configs/kvm_guest.config
index 8d9643767142..108fecc20fc1 100644
--- a/kernel/configs/kvm_guest.config
+++ b/kernel/configs/kvm_guest.config
@@ -18,6 +18,7 @@ CONFIG_VIRTUALIZATION=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_KVM_GUEST=y
+CONFIG_S390_GUEST=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BLK=y
--
2.13.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* [GIT PULL 6/6] KVM: s390: cleanup struct kvm_s390_float_interrupt
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
` (4 preceding siblings ...)
2018-01-16 15:03 ` [GIT PULL 5/6] kvm_config: add CONFIG_S390_GUEST Christian Borntraeger
@ 2018-01-16 15:03 ` Christian Borntraeger
2018-01-16 15:09 ` [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Paolo Bonzini
6 siblings, 0 replies; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:03 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, Christian Borntraeger, linux-s390,
Janosch Frank
From: David Hildenbrand <david@redhat.com>
"wq" is not used at all. "cpuflags" can be access directly via the vcpu,
just as "float_int" via vcpu->kvm.
While at it, reuse _set_cpuflag() to make the code look nicer.
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180108193747.10818-1-david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/include/asm/kvm_host.h | 3 ---
arch/s390/kvm/interrupt.c | 25 +++++++++++--------------
arch/s390/kvm/kvm-s390.c | 3 ---
arch/s390/kvm/kvm-s390.h | 2 +-
arch/s390/kvm/sigp.c | 12 ++++--------
5 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index e14f381757f6..e16a9f2a44ad 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -515,9 +515,6 @@ struct kvm_s390_irq_payload {
struct kvm_s390_local_interrupt {
spinlock_t lock;
- struct kvm_s390_float_interrupt *float_int;
- struct swait_queue_head *wq;
- atomic_t *cpuflags;
DECLARE_BITMAP(sigp_emerg_pending, KVM_MAX_VCPUS);
struct kvm_s390_irq_payload irq;
unsigned long pending_irqs;
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 818aa4248b0f..f8eb2cfa763a 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -107,12 +107,11 @@ static int sca_inject_ext_call(struct kvm_vcpu *vcpu, int src_id)
static void sca_clear_ext_call(struct kvm_vcpu *vcpu)
{
- struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
int rc, expect;
if (!kvm_s390_use_sca_entries())
return;
- atomic_andnot(CPUSTAT_ECALL_PEND, li->cpuflags);
+ atomic_andnot(CPUSTAT_ECALL_PEND, &vcpu->arch.sie_block->cpuflags);
read_lock(&vcpu->kvm->arch.sca_lock);
if (vcpu->kvm->arch.use_esca) {
struct esca_block *sca = vcpu->kvm->arch.sca;
@@ -279,13 +278,13 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu)
static void __set_cpu_idle(struct kvm_vcpu *vcpu)
{
atomic_or(CPUSTAT_WAIT, &vcpu->arch.sie_block->cpuflags);
- set_bit(vcpu->vcpu_id, vcpu->arch.local_int.float_int->idle_mask);
+ set_bit(vcpu->vcpu_id, vcpu->kvm->arch.float_int.idle_mask);
}
static void __unset_cpu_idle(struct kvm_vcpu *vcpu)
{
atomic_andnot(CPUSTAT_WAIT, &vcpu->arch.sie_block->cpuflags);
- clear_bit(vcpu->vcpu_id, vcpu->arch.local_int.float_int->idle_mask);
+ clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.float_int.idle_mask);
}
static void __reset_intercept_indicators(struct kvm_vcpu *vcpu)
@@ -1228,7 +1227,7 @@ static int __inject_pfault_init(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq)
li->irq.ext = irq->u.ext;
set_bit(IRQ_PEND_PFAULT_INIT, &li->pending_irqs);
- atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
+ __set_cpuflag(vcpu, CPUSTAT_EXT_INT);
return 0;
}
@@ -1253,7 +1252,7 @@ static int __inject_extcall(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq)
if (test_and_set_bit(IRQ_PEND_EXT_EXTERNAL, &li->pending_irqs))
return -EBUSY;
*extcall = irq->u.extcall;
- atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
+ __set_cpuflag(vcpu, CPUSTAT_EXT_INT);
return 0;
}
@@ -1329,7 +1328,7 @@ static int __inject_sigp_emergency(struct kvm_vcpu *vcpu,
set_bit(irq->u.emerg.code, li->sigp_emerg_pending);
set_bit(IRQ_PEND_EXT_EMERGENCY, &li->pending_irqs);
- atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
+ __set_cpuflag(vcpu, CPUSTAT_EXT_INT);
return 0;
}
@@ -1373,7 +1372,7 @@ static int __inject_ckc(struct kvm_vcpu *vcpu)
0, 0);
set_bit(IRQ_PEND_EXT_CLOCK_COMP, &li->pending_irqs);
- atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
+ __set_cpuflag(vcpu, CPUSTAT_EXT_INT);
return 0;
}
@@ -1386,7 +1385,7 @@ static int __inject_cpu_timer(struct kvm_vcpu *vcpu)
0, 0);
set_bit(IRQ_PEND_EXT_CPU_TIMER, &li->pending_irqs);
- atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
+ __set_cpuflag(vcpu, CPUSTAT_EXT_INT);
return 0;
}
@@ -1546,7 +1545,6 @@ static int __inject_io(struct kvm *kvm, struct kvm_s390_interrupt_info *inti)
static void __floating_irq_kick(struct kvm *kvm, u64 type)
{
struct kvm_s390_float_interrupt *fi = &kvm->arch.float_int;
- struct kvm_s390_local_interrupt *li;
struct kvm_vcpu *dst_vcpu;
int sigcpu, online_vcpus, nr_tries = 0;
@@ -1568,16 +1566,15 @@ static void __floating_irq_kick(struct kvm *kvm, u64 type)
dst_vcpu = kvm_get_vcpu(kvm, sigcpu);
/* make the VCPU drop out of the SIE, or wake it up if sleeping */
- li = &dst_vcpu->arch.local_int;
switch (type) {
case KVM_S390_MCHK:
- atomic_or(CPUSTAT_STOP_INT, li->cpuflags);
+ __set_cpuflag(dst_vcpu, CPUSTAT_STOP_INT);
break;
case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX:
- atomic_or(CPUSTAT_IO_INT, li->cpuflags);
+ __set_cpuflag(dst_vcpu, CPUSTAT_IO_INT);
break;
default:
- atomic_or(CPUSTAT_EXT_INT, li->cpuflags);
+ __set_cpuflag(dst_vcpu, CPUSTAT_EXT_INT);
break;
}
kvm_s390_vcpu_wakeup(dst_vcpu);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c85d7c4e8a38..de16c224319c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2509,9 +2509,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
vcpu->arch.sie_block->icpua = id;
spin_lock_init(&vcpu->arch.local_int.lock);
- vcpu->arch.local_int.float_int = &kvm->arch.float_int;
- vcpu->arch.local_int.wq = &vcpu->wq;
- vcpu->arch.local_int.cpuflags = &vcpu->arch.sie_block->cpuflags;
seqcount_init(&vcpu->arch.cputm_seqcount);
rc = kvm_vcpu_init(vcpu, kvm, id);
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 5e46ba429bcb..8877116f0159 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -54,7 +54,7 @@ static inline int is_vcpu_stopped(struct kvm_vcpu *vcpu)
static inline int is_vcpu_idle(struct kvm_vcpu *vcpu)
{
- return test_bit(vcpu->vcpu_id, vcpu->arch.local_int.float_int->idle_mask);
+ return test_bit(vcpu->vcpu_id, vcpu->kvm->arch.float_int.idle_mask);
}
static inline int kvm_is_ucontrol(struct kvm *kvm)
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index c1f5cde2c878..5cafd1e2651b 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -20,14 +20,11 @@
static int __sigp_sense(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu,
u64 *reg)
{
- struct kvm_s390_local_interrupt *li;
int cpuflags;
int rc;
int ext_call_pending;
- li = &dst_vcpu->arch.local_int;
-
- cpuflags = atomic_read(li->cpuflags);
+ cpuflags = atomic_read(&dst_vcpu->arch.sie_block->cpuflags);
ext_call_pending = kvm_s390_ext_call_pending(dst_vcpu);
if (!(cpuflags & CPUSTAT_STOPPED) && !ext_call_pending)
rc = SIGP_CC_ORDER_CODE_ACCEPTED;
@@ -211,7 +208,7 @@ static int __sigp_store_status_at_addr(struct kvm_vcpu *vcpu,
int flags;
int rc;
- flags = atomic_read(dst_vcpu->arch.local_int.cpuflags);
+ flags = atomic_read(&dst_vcpu->arch.sie_block->cpuflags);
if (!(flags & CPUSTAT_STOPPED)) {
*reg &= 0xffffffff00000000UL;
*reg |= SIGP_STATUS_INCORRECT_STATE;
@@ -231,7 +228,6 @@ static int __sigp_store_status_at_addr(struct kvm_vcpu *vcpu,
static int __sigp_sense_running(struct kvm_vcpu *vcpu,
struct kvm_vcpu *dst_vcpu, u64 *reg)
{
- struct kvm_s390_local_interrupt *li;
int rc;
if (!test_kvm_facility(vcpu->kvm, 9)) {
@@ -240,8 +236,8 @@ static int __sigp_sense_running(struct kvm_vcpu *vcpu,
return SIGP_CC_STATUS_STORED;
}
- li = &dst_vcpu->arch.local_int;
- if (atomic_read(li->cpuflags) & CPUSTAT_RUNNING) {
+ if (atomic_read(&dst_vcpu->arch.sie_block->cpuflags) &
+ CPUSTAT_RUNNING) {
/* running */
rc = SIGP_CC_ORDER_CODE_ACCEPTED;
} else {
--
2.13.4
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16
2018-01-16 15:03 [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Christian Borntraeger
` (5 preceding siblings ...)
2018-01-16 15:03 ` [GIT PULL 6/6] KVM: s390: cleanup struct kvm_s390_float_interrupt Christian Borntraeger
@ 2018-01-16 15:09 ` Paolo Bonzini
2018-01-16 15:14 ` Christian Borntraeger
6 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2018-01-16 15:09 UTC (permalink / raw)
To: Christian Borntraeger, Radim Krčmář
Cc: KVM, Cornelia Huck, linux-s390, Janosch Frank
On 16/01/2018 16:03, Christian Borntraeger wrote:
> Paolo, Radim,
>
> the first chunk (of already reviewed) patches for 4.16 via kvm/next.
>
>
> The following changes since commit ccff53fd86ee54022e3d841f3db9280b1deb22e4:
>
> KVM: x86: avoid unnecessary XSETBV on guest entry (2017-12-18 13:10:25 +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.16-1
>
> for you to fetch changes up to 715e0427049606f499ea6b485c997f93f0778c77:
>
> KVM: s390: cleanup struct kvm_s390_float_interrupt (2018-01-16 15:53:09 +0100)
>
> ----------------------------------------------------------------
> KVM: s390: Fixes and features for 4.16
>
> - add the virtio-ccw transport for kvmconfig
> - more debug tracing for cpu model
> - cleanups and fixes
>
> ----------------------------------------------------------------
> Christian Borntraeger (3):
> KVM: s390: use created_vcpus in more places
> KVM: s390: add debug tracing for cpu features of CPU model
> kvm_config: add CONFIG_S390_GUEST
>
> David Hildenbrand (2):
> s390x/mm: cleanup gmap_pte_op_walk()
> KVM: s390: cleanup struct kvm_s390_float_interrupt
>
> Michael Mueller (1):
> KVM: s390: drop use of spin lock in __floating_irq_kick
>
> arch/s390/include/asm/kvm_host.h | 3 ---
> arch/s390/kvm/interrupt.c | 27 +++++++++++----------------
> arch/s390/kvm/kvm-s390.c | 29 +++++++++++++++++++----------
> arch/s390/kvm/kvm-s390.h | 2 +-
> arch/s390/kvm/sigp.c | 12 ++++--------
> arch/s390/mm/gmap.c | 23 ++++++++---------------
> kernel/configs/kvm_guest.config | 1 +
> 7 files changed, 44 insertions(+), 53 deletions(-)
>
We probably will have to rebase kvm/next, sorry, to remove a series that
had problems and (worse) complaints from the arch/x86 maintainers. :(
Can you rebase on top of 5cb0944c0c66004c0d9006a7f0fba5782ae38f69?
Thanks,
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16
2018-01-16 15:09 ` [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16 Paolo Bonzini
@ 2018-01-16 15:14 ` Christian Borntraeger
2018-01-16 15:27 ` Radim Krčmář
0 siblings, 1 reply; 11+ messages in thread
From: Christian Borntraeger @ 2018-01-16 15:14 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář
Cc: KVM, Cornelia Huck, linux-s390, Janosch Frank
On 01/16/2018 04:09 PM, Paolo Bonzini wrote:
> On 16/01/2018 16:03, Christian Borntraeger wrote:
>> Paolo, Radim,
>>
>> the first chunk (of already reviewed) patches for 4.16 via kvm/next.
>>
>>
>> The following changes since commit ccff53fd86ee54022e3d841f3db9280b1deb22e4:
>>
>> KVM: x86: avoid unnecessary XSETBV on guest entry (2017-12-18 13:10:25 +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.16-1
>>
>> for you to fetch changes up to 715e0427049606f499ea6b485c997f93f0778c77:
>>
>> KVM: s390: cleanup struct kvm_s390_float_interrupt (2018-01-16 15:53:09 +0100)
>>
>> ----------------------------------------------------------------
>> KVM: s390: Fixes and features for 4.16
>>
>> - add the virtio-ccw transport for kvmconfig
>> - more debug tracing for cpu model
>> - cleanups and fixes
>>
>> ----------------------------------------------------------------
>> Christian Borntraeger (3):
>> KVM: s390: use created_vcpus in more places
>> KVM: s390: add debug tracing for cpu features of CPU model
>> kvm_config: add CONFIG_S390_GUEST
>>
>> David Hildenbrand (2):
>> s390x/mm: cleanup gmap_pte_op_walk()
>> KVM: s390: cleanup struct kvm_s390_float_interrupt
>>
>> Michael Mueller (1):
>> KVM: s390: drop use of spin lock in __floating_irq_kick
>>
>> arch/s390/include/asm/kvm_host.h | 3 ---
>> arch/s390/kvm/interrupt.c | 27 +++++++++++----------------
>> arch/s390/kvm/kvm-s390.c | 29 +++++++++++++++++++----------
>> arch/s390/kvm/kvm-s390.h | 2 +-
>> arch/s390/kvm/sigp.c | 12 ++++--------
>> arch/s390/mm/gmap.c | 23 ++++++++---------------
>> kernel/configs/kvm_guest.config | 1 +
>> 7 files changed, 44 insertions(+), 53 deletions(-)
>>
>
> We probably will have to rebase kvm/next, sorry, to remove a series that
> had problems and (worse) complaints from the arch/x86 maintainers. :(
> Can you rebase on top of 5cb0944c0c66004c0d9006a7f0fba5782ae38
Can you (when doing that) rebase on something newer? rc3 is broken in many ways
and only works on some of my test systems (those without multipath).
I will rebase on 4.15-rc3 to give you all the freedom you need.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16
2018-01-16 15:14 ` Christian Borntraeger
@ 2018-01-16 15:27 ` Radim Krčmář
2018-01-16 15:35 ` Paolo Bonzini
0 siblings, 1 reply; 11+ messages in thread
From: Radim Krčmář @ 2018-01-16 15:27 UTC (permalink / raw)
To: Christian Borntraeger
Cc: Paolo Bonzini, KVM, Cornelia Huck, linux-s390, Janosch Frank
2018-01-16 16:14+0100, Christian Borntraeger:
> On 01/16/2018 04:09 PM, Paolo Bonzini wrote:
> > On 16/01/2018 16:03, Christian Borntraeger wrote:
> >> Paolo, Radim,
> >>
> >> the first chunk (of already reviewed) patches for 4.16 via kvm/next.
> >>
> >>
> >> The following changes since commit ccff53fd86ee54022e3d841f3db9280b1deb22e4:
> >>
> >> KVM: x86: avoid unnecessary XSETBV on guest entry (2017-12-18 13:10:25 +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.16-1
> >>
> >> for you to fetch changes up to 715e0427049606f499ea6b485c997f93f0778c77:
> >>
> >> KVM: s390: cleanup struct kvm_s390_float_interrupt (2018-01-16 15:53:09 +0100)
> >>
> >> ----------------------------------------------------------------
> >> KVM: s390: Fixes and features for 4.16
> >>
> >> - add the virtio-ccw transport for kvmconfig
> >> - more debug tracing for cpu model
> >> - cleanups and fixes
> >>
> >> ----------------------------------------------------------------
> >> Christian Borntraeger (3):
> >> KVM: s390: use created_vcpus in more places
> >> KVM: s390: add debug tracing for cpu features of CPU model
> >> kvm_config: add CONFIG_S390_GUEST
> >>
> >> David Hildenbrand (2):
> >> s390x/mm: cleanup gmap_pte_op_walk()
> >> KVM: s390: cleanup struct kvm_s390_float_interrupt
> >>
> >> Michael Mueller (1):
> >> KVM: s390: drop use of spin lock in __floating_irq_kick
> >>
> >> arch/s390/include/asm/kvm_host.h | 3 ---
> >> arch/s390/kvm/interrupt.c | 27 +++++++++++----------------
> >> arch/s390/kvm/kvm-s390.c | 29 +++++++++++++++++++----------
> >> arch/s390/kvm/kvm-s390.h | 2 +-
> >> arch/s390/kvm/sigp.c | 12 ++++--------
> >> arch/s390/mm/gmap.c | 23 ++++++++---------------
> >> kernel/configs/kvm_guest.config | 1 +
> >> 7 files changed, 44 insertions(+), 53 deletions(-)
> >>
> >
> > We probably will have to rebase kvm/next, sorry, to remove a series that
> > had problems and (worse) complaints from the arch/x86 maintainers. :(
> > Can you rebase on top of 5cb0944c0c66004c0d9006a7f0fba5782ae38
>
> Can you (when doing that) rebase on something newer? rc3 is broken in many ways
> and only works on some of my test systems (those without multipath).
I'd like to avoid rebasing that much -- so far we're only rebasing
patches since Jan 11 and there is a batch from Dec 14 on top of rc3.
> I will rebase on 4.15-rc3 to give you all the freedom you need.
I think that basing s390 on a later -rc would work for all of us,
thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [GIT PULL 0/6] KVM: s390: Fixes and features for 4.16
2018-01-16 15:27 ` Radim Krčmář
@ 2018-01-16 15:35 ` Paolo Bonzini
0 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2018-01-16 15:35 UTC (permalink / raw)
To: Radim Krčmář, Christian Borntraeger
Cc: KVM, Cornelia Huck, linux-s390, Janosch Frank
On 16/01/2018 16:27, Radim Krčmář wrote:
>>> We probably will have to rebase kvm/next, sorry, to remove a series that
>>> had problems and (worse) complaints from the arch/x86 maintainers. :(
>>> Can you rebase on top of 5cb0944c0c66004c0d9006a7f0fba5782ae38
>> Can you (when doing that) rebase on something newer? rc3 is broken in many ways
>> and only works on some of my test systems (those without multipath).
> I'd like to avoid rebasing that much -- so far we're only rebasing
> patches since Jan 11 and there is a batch from Dec 14 on top of rc3.
>
>> I will rebase on 4.15-rc3 to give you all the freedom you need.
> I think that basing s390 on a later -rc would work for all of us,
I agree---unless you need to rebase on top the VCPU lock pushdown,
4.15-rc3 would work great.
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread