From: Narayana Murty N <nnmlinux@linux.vnet.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>,
"Narayana Murty N" <nnmlinux@linux.ibm.com>,
danielhb413@gmail.com, david@gibson.dropbear.id.au,
groug@kaod.org, npiggin@gmail.com
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, farosas@suse.de,
npiggin@linux.ibm.com, vaibhav@linux.ibm.com,
harshpb@linux.ibm.com, sbhat@linux.ibm.com,
Greg Kurz <groug@kaod.org>
Subject: Re: [PATCH v3] target: ppc: Use MSR_HVB bit to get the target endianness for memory dump
Date: Thu, 25 May 2023 09:45:11 +0530 [thread overview]
Message-ID: <460d3d0f-3b4b-330e-87ba-d491d7c55d07@linux.vnet.ibm.com> (raw)
In-Reply-To: <b73560c5-6422-bc5b-1819-ca0ea41e2baf@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 3950 bytes --]
On 5/23/23 15:52, Cédric Le Goater wrote:
> On 5/22/23 18:02, Narayana Murty N wrote:
>> Currently on PPC64 qemu always dumps the guest memory in
>> Big Endian (BE) format even though the guest running in Little Endian
>
>
>
> The patch is surely correct. I have problems understanding the config
> you are testing. PPC Book3s has multiple hypervisor implementations :
>
> 1. pHyp (AKA PowerVM)
> 2. OPAL/PowerNV (AKA Power KVM-HV)
> 3. OPAL/PowerNV/pSeries (AKA Power KVMHV-on-pSeries)
> 4. pHyp/pSeries (very recent implementation, I don't know how it is
> referred to in the kernel)
>
> I am leaving the KVM-PR implementation out of the discussions for
> simplicity.
>
> QEMU also supports emulation of 2. and 3. in two different machines
> PowerNV and pseries, although running pseries guests under a PowerNV
> machine is slow, so is running pseries guests under pseries.
>
> Could you please describe your environment ?
>
> Thanks,
>
> C.
>
>
It had been tested target machine OPAL/PowerNV with big endian host os.
and also target OPAL/PowerNV/pSeries little endian host setup with qemu.
>
>> (LE) mode. So crash tool fails to load the dump as illustrated below:
>>
>> Log :
>> $ virsh dump DOMAIN --memory-only dump.file
>>
>> Domain 'DOMAIN' dumped to dump.file
>>
>> $ crash vmlinux dump.file
>>
>> <snip>
>> crash 8.0.2-1.el9
>>
>> WARNING: endian mismatch:
>> crash utility: little-endian
>> dump.file: big-endian
>>
>> WARNING: machine type mismatch:
>> crash utility: PPC64
>> dump.file: (unknown)
>>
>> crash: dump.file: not a supported file format
>> <snip>
>>
>> This happens because cpu_get_dump_info() passes cpu->env->has_hv_mode
>> to function ppc_interrupts_little_endian(), the cpu->env->has_hv_mode
>> always set for powerNV even though the guest is not running in hv mode.
>> The hv mode should be taken from msr_mask MSR_HVB bit
>> (cpu->env.msr_mask & MSR_HVB). This patch fixes the issue by passing
>> MSR_HVB value to ppc_interrupts_little_endian() in order to determine
>> the guest endianness.
>>
>> The crash tool also expects guest kernel endianness should match the
>> endianness of the dump.
>>
>> The patch was tested on POWER9 box booted with Linux as host in
>> following cases:
>>
>> Host-Endianess Qemu-Target-Machine Qemu-Guest-Endianess
>> Qemu-Generated-Guest
>> Memory-Dump-Format
>> BE powernv LE KVM guest LE
>> BE powernv BE KVM guest BE
>> LE powernv LE KVM guest LE
>> LE powernv BE KVM guest BE
>> LE pseries KVM LE KVM guest LE
>> LE pseries TCG LE guest LE
>>
>> Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
>> ---
>> Changes since V2:
>> commit message modified as per feedbak from Nicholas Piggin.
>> Changes since V1:
>> https://lore.kernel.org/qemu-devel/20230420145055.10196-1-nnmlinux@linux.ibm.com/
>>
>> The approach to solve the issue was changed based on feedback from
>> Fabiano Rosas on patch V1.
>> ---
>> target/ppc/arch_dump.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
>> index f58e6359d5..a8315659d9 100644
>> --- a/target/ppc/arch_dump.c
>> +++ b/target/ppc/arch_dump.c
>> @@ -237,7 +237,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
>> info->d_machine = PPC_ELF_MACHINE;
>> info->d_class = ELFCLASS;
>> - if (ppc_interrupts_little_endian(cpu, cpu->env.has_hv_mode)) {
>> + if (ppc_interrupts_little_endian(cpu, !!(cpu->env.msr_mask &
>> MSR_HVB))) {
>> info->d_endian = ELFDATA2LSB;
>> } else {
>> info->d_endian = ELFDATA2MSB;
>
[-- Attachment #2: Type: text/html, Size: 6767 bytes --]
next prev parent reply other threads:[~2023-05-25 4:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 16:02 [PATCH v3] target: ppc: Use MSR_HVB bit to get the target endianness for memory dump Narayana Murty N
2023-05-22 18:20 ` Greg Kurz
2023-05-23 6:50 ` Narayana Murty N
2023-05-23 10:15 ` Greg Kurz
2023-06-23 7:25 ` Narayana Murty N
2023-05-23 10:22 ` Cédric Le Goater
2023-05-25 4:15 ` Narayana Murty N [this message]
2023-05-29 3:19 ` Nicholas Piggin
2023-05-29 3:42 ` Nicholas Piggin
2023-05-29 14:05 ` Fabiano Rosas
2023-06-05 9:33 ` Nicholas Piggin
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=460d3d0f-3b4b-330e-87ba-d491d7c55d07@linux.vnet.ibm.com \
--to=nnmlinux@linux.vnet.ibm.com \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=farosas@suse.de \
--cc=groug@kaod.org \
--cc=harshpb@linux.ibm.com \
--cc=nnmlinux@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=npiggin@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.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).