Skip to content

Commit

Permalink
KVM: s390: protvirt: Add UV debug trace
Browse files Browse the repository at this point in the history
Let's have some debug traces which stay around for longer than the
guest.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
[borntraeger@de.ibm.com: patch merging, splitting, fixing]
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
  • Loading branch information
Janosch Frank authored and Christian Borntraeger committed Feb 27, 2020
1 parent f654706 commit 3e6c556
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
11 changes: 9 additions & 2 deletions arch/s390/kvm/kvm-s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* hosting IBM Z kernel virtual machines (s390x)
*
* Copyright IBM Corp. 2008, 2018
* Copyright IBM Corp. 2008, 2020
*
* Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com>
Expand Down Expand Up @@ -220,6 +220,7 @@ static struct kvm_s390_vm_cpu_subfunc kvm_s390_available_subfunc;
static struct gmap_notifier gmap_notifier;
static struct gmap_notifier vsie_gmap_notifier;
debug_info_t *kvm_s390_dbf;
debug_info_t *kvm_s390_dbf_uv;

/* Section: not file related */
int kvm_arch_hardware_enable(void)
Expand Down Expand Up @@ -460,7 +461,12 @@ int kvm_arch_init(void *opaque)
if (!kvm_s390_dbf)
return -ENOMEM;

if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view))
kvm_s390_dbf_uv = debug_register("kvm-uv", 32, 1, 7 * sizeof(long));
if (!kvm_s390_dbf_uv)
goto out;

if (debug_register_view(kvm_s390_dbf, &debug_sprintf_view) ||
debug_register_view(kvm_s390_dbf_uv, &debug_sprintf_view))
goto out;

kvm_s390_cpu_feat_init();
Expand All @@ -487,6 +493,7 @@ void kvm_arch_exit(void)
{
kvm_s390_gib_destroy();
debug_unregister(kvm_s390_dbf);
debug_unregister(kvm_s390_dbf_uv);
}

/* Section: device related */
Expand Down
13 changes: 12 additions & 1 deletion arch/s390/kvm/kvm-s390.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* definition for kvm on s390
*
* Copyright IBM Corp. 2008, 2009
* Copyright IBM Corp. 2008, 2020
*
* Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com>
Expand All @@ -25,6 +25,17 @@
#define IS_ITDB_VALID(vcpu) ((*(char *)vcpu->arch.sie_block->itdba == TDB_FORMAT1))

extern debug_info_t *kvm_s390_dbf;
extern debug_info_t *kvm_s390_dbf_uv;

#define KVM_UV_EVENT(d_kvm, d_loglevel, d_string, d_args...)\
do { \
debug_sprintf_event((d_kvm)->arch.dbf, d_loglevel, d_string "\n", \
d_args); \
debug_sprintf_event(kvm_s390_dbf_uv, d_loglevel, \
"%d: " d_string "\n", (d_kvm)->userspace_pid, \
d_args); \
} while (0)

#define KVM_EVENT(d_loglevel, d_string, d_args...)\
do { \
debug_sprintf_event(kvm_s390_dbf, d_loglevel, d_string "\n", \
Expand Down

0 comments on commit 3e6c556

Please sign in to comment.