From: Steffen Eiden <seiden@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, pbonzini@redhat.com,
mhartmay@linux.ibm.com, borntraeger@linux.ibm.com,
imbrenda@linux.ibm.com, pasic@linux.ibm.com, cohuck@redhat.com,
thuth@redhat.com, qemu-s390x@nongnu.org, scgl@linux.ibm.com
Subject: Re: [PATCH v5 17/18] s390x: Add KVM PV dump interface
Date: Tue, 23 Aug 2022 17:25:17 +0200 [thread overview]
Message-ID: <3ebfdfb7-592e-1a96-3d34-dfcdcb9dc0a8@linux.ibm.com> (raw)
In-Reply-To: <20220811121111.9878-18-frankja@linux.ibm.com>
On 8/11/22 14:11, Janosch Frank wrote:
> Let's add a few bits of code which hide the new KVM PV dump API from
> us via new functions.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> hw/s390x/pv.c | 51 +++++++++++++++++++++++++++++++++++++++++++
> include/hw/s390x/pv.h | 8 +++++++
> 2 files changed, 59 insertions(+)
>
> diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c
> index 2b892b45e8..ce3b6ad3e9 100644
> --- a/hw/s390x/pv.c
> +++ b/hw/s390x/pv.c
> @@ -175,6 +175,57 @@ bool kvm_s390_pv_info_basic_valid(void)
> return info_valid;
> }
>
> +static int s390_pv_dump_cmd(uint64_t subcmd, uint64_t uaddr, uint64_t gaddr,
> + uint64_t len)
> +{
> + struct kvm_s390_pv_dmp dmp = {
> + .subcmd = subcmd,
> + .buff_addr = uaddr,
> + .buff_len = len,
> + .gaddr = gaddr,
> + };
> + int ret;
> +
> + ret = s390_pv_cmd(KVM_PV_DUMP, (void *)&dmp);
> + if (ret) {
> + error_report("KVM DUMP command %ld failed", subcmd);
> + }
> + return ret;
> +}
> +
> +int kvm_s390_dump_cpu(S390CPU *cpu, void *buff)
> +{
> + struct kvm_s390_pv_dmp dmp = {
> + .subcmd = KVM_PV_DUMP_CPU,
> + .buff_addr = (uint64_t)buff,
> + .gaddr = 0,
> + .buff_len = info_dump.dump_cpu_buffer_len,
> + };
> + struct kvm_pv_cmd pv = {
> + .cmd = KVM_PV_DUMP,
> + .data = (uint64_t)&dmp,
> + };
> +
> + return kvm_vcpu_ioctl(CPU(cpu), KVM_S390_PV_CPU_COMMAND, &pv);
> +}
> +
> +int kvm_s390_dump_init(void)
> +{
> + return s390_pv_dump_cmd(KVM_PV_DUMP_INIT, 0, 0, 0);
> +}
> +
I suggest changing that into something like
* kvm_s390_dump_mem_state
* kvm_s390_dump_config_state
This would make the effect of that function more clear.
It is not dumping the memory, but getting (part of) the
necessary metadata to process the dump.
Additionally, I suggest to reflect the name changes in the next patch.
I mark all functions I find.
> +int kvm_s390_dump_mem(uint64_t gaddr, size_t len, void *dest)
> +{
> + return s390_pv_dump_cmd(KVM_PV_DUMP_CONFIG_STATE, (uint64_t)dest,
> + gaddr, len);
> +}
> +
> +int kvm_s390_dump_complete(void *buff)
> +{
> + return s390_pv_dump_cmd(KVM_PV_DUMP_COMPLETE, (uint64_t)buff, 0,
> + info_dump.dump_config_finalize_len);
> +}
> +
> #define TYPE_S390_PV_GUEST "s390-pv-guest"
> OBJECT_DECLARE_SIMPLE_TYPE(S390PVGuest, S390_PV_GUEST)
>
> diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h
> index 573259cf2b..02a6c06b9f 100644
> --- a/include/hw/s390x/pv.h
> +++ b/include/hw/s390x/pv.h
> @@ -51,6 +51,10 @@ uint64_t kvm_s390_pv_dmp_get_size_cpu(void);
> uint64_t kvm_s390_pv_dmp_get_size_stor_state(void);
> uint64_t kvm_s390_pv_dmp_get_size_complete(void);
> bool kvm_s390_pv_info_basic_valid(void);
> +int kvm_s390_dump_init(void);
> +int kvm_s390_dump_cpu(S390CPU *cpu, void *buff);
> +int kvm_s390_dump_mem(uint64_t addr, size_t len, void *dest);
> +int kvm_s390_dump_complete(void *buff);
> #else /* CONFIG_KVM */
> static inline bool s390_is_pv(void) { return false; }
> static inline int s390_pv_query_info(void) { return 0; }
> @@ -66,6 +70,10 @@ static inline uint64_t kvm_s390_pv_dmp_get_size_cpu(void) { return 0; }
> static inline uint64_t kvm_s390_pv_dmp_get_size_stor_state(void) { return 0; }
> static inline uint64_t kvm_s390_pv_dmp_get_size_complete(void) { return 0; }
> static inline bool kvm_s390_pv_info_basic_valid(void) { return false; }
> +static inline int kvm_s390_dump_init(void) { return 0; }
> +static inline int kvm_s390_dump_cpu(S390CPU *cpu, void *buff, size_t len) { return 0; }
> +static inline int kvm_s390_dump_mem(uint64_t addr, size_t len, void *dest) { return 0; }
> +static inline int kvm_s390_dump_complete(void *buff) { return 0; }
> #endif /* CONFIG_KVM */
>
> int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp);
Beside that nit, LGTM.
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
next prev parent reply other threads:[~2022-08-23 15:27 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 12:10 [PATCH v5 00/18] dump: Add arch section and s390x PV dump Janosch Frank
2022-08-11 12:10 ` [PATCH v5 01/18] dump: Replace opaque DumpState pointer with a typed one Janosch Frank
2022-08-11 16:51 ` Daniel Henrique Barboza
2022-08-16 7:58 ` Marc-André Lureau
2022-08-11 12:10 ` [PATCH v5 02/18] dump: Rename write_elf_loads to write_elf_phdr_loads Janosch Frank
2022-08-11 12:10 ` [PATCH v5 03/18] dump: Refactor dump_iterate and introduce dump_filter_memblock_*() Janosch Frank
2022-08-16 8:12 ` Marc-André Lureau
2022-08-11 12:10 ` [PATCH v5 04/18] dump: Rework get_start_block Janosch Frank
2022-08-29 20:17 ` Janis Schoetterl-Glausch
2022-09-26 14:48 ` Janosch Frank
2022-08-11 12:10 ` [PATCH v5 05/18] dump: Rework filter area variables Janosch Frank
2022-08-16 8:19 ` Marc-André Lureau
2022-08-11 12:10 ` [PATCH v5 06/18] dump: Rework dump_calculate_size function Janosch Frank
2022-09-01 9:24 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 07/18] dump: Split elf header functions into prepare and write Janosch Frank
2022-08-16 8:26 ` Marc-André Lureau
2022-09-01 9:24 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 08/18] dump: Rename write_elf*_phdr_note to prepare_elf*_phdr_note Janosch Frank
2022-08-16 8:28 ` Marc-André Lureau
2022-09-01 9:24 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 09/18] dump: Use a buffer for ELF section data and headers Janosch Frank
2022-08-16 8:43 ` Marc-André Lureau
2022-08-29 20:43 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 10/18] dump: Reorder struct DumpState Janosch Frank
2022-08-11 12:11 ` [PATCH v5 11/18] dump: Swap segment and section header locations Janosch Frank
2022-08-11 12:11 ` [PATCH v5 12/18] dump/dump: Add section string table support Janosch Frank
2022-08-30 11:35 ` Steffen Eiden
2022-08-30 14:02 ` Janosch Frank
2022-09-01 9:25 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 13/18] dump/dump: Add arch section support Janosch Frank
2022-09-01 9:26 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 14/18] DRAFT: linux header sync Janosch Frank
2022-08-11 12:11 ` [PATCH v5 15/18] s390x: Add protected dump cap Janosch Frank
2022-08-29 11:29 ` Thomas Huth
2022-09-01 9:26 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 16/18] s390x: Introduce PV query interface Janosch Frank
2022-08-29 11:30 ` Thomas Huth
2022-09-01 9:26 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 17/18] s390x: Add KVM PV dump interface Janosch Frank
2022-08-23 15:25 ` Steffen Eiden [this message]
2022-09-01 9:26 ` Janis Schoetterl-Glausch
2022-08-11 12:11 ` [PATCH v5 18/18] s390x: pv: Add dump support Janosch Frank
2022-08-11 13:03 ` Janosch Frank
2022-08-23 15:26 ` Steffen Eiden
2022-08-29 11:57 ` Thomas Huth
2022-09-01 9:31 ` Janis Schoetterl-Glausch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ebfdfb7-592e-1a96-3d34-dfcdcb9dc0a8@linux.ibm.com \
--to=seiden@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=marcandre.lureau@redhat.com \
--cc=mhartmay@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=scgl@linux.ibm.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).