From: Narayana Murty N <nnmlinux@linux.vnet.ibm.com>
To: Fabiano Rosas <farosas@suse.de>,
Vaibhav Jain <vaibhav@linux.ibm.com>,
Narayana Murty N <nnmlinux@linux.ibm.com>,
danielhb413@gmail.com, clg@kaod.org, david@gibson.dropbear.id.au,
groug@kaod.org
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
npiggin@linux.ibm.com, vajain21@linux.ibm.com,
harshpb@linux.ibm.com, sbhat@linux.ibm.com
Subject: Re: [PATCH] target: ppc: Correctly initialize HILE in HID-0 for book3s processors
Date: Thu, 4 May 2023 11:05:46 +0530 [thread overview]
Message-ID: <ed0fc438-de4c-9204-2321-cf9f1bac677c@linux.vnet.ibm.com> (raw)
In-Reply-To: <87sfckrsd9.fsf@suse.de>
[-- Attachment #1: Type: text/plain, Size: 3640 bytes --]
On 4/28/23 20:00, Fabiano Rosas wrote:
> Vaibhav Jain<vaibhav@linux.ibm.com> writes:
>
>> Hi Fabiano,
>>
>> Thanks for looking into this patch and apologies for the delayed reponse.
>> Fabiano Rosas<farosas@suse.de> writes:
>>
>>> Narayana Murty N<nnmlinux@linux.ibm.com> writes:
>>>
>>>> On PPC64 the HILE(Hypervisor Interrupt Little Endian) bit in HID-0
>>>> register needs to be initialized as per isa 3.0b[1] section
>>>> 2.10. This bit gets copied to the MSR_LE when handling interrupts that
>>>> are handled in HV mode to establish the Endianess mode of the interrupt
>>>> handler.
>>>>
>>>> Qemu's ppc_interrupts_little_endian() depends on HILE to determine Host
>>>> endianness which is then used to determine the endianess of the guest dump.
>>>>
>>> Not quite. We use the interrupt endianness as a proxy to guest
>>> endianness to avoid reading MSR_LE at an inopportune moment when the
>>> guest is switching endianness.
>> Agreed
Agreed
>>
>>> This is not dependent on host
>>> endianness. The HILE check is used when taking a memory dump of a
>>> HV-capable machine such as the emulated powernv.
>> I think one concern which the patch tries to address is the guest memorydump file
>> generated of a BigEndian(BE) guest on a LittleEndian(LE) host is not readable on
>> the same LE host since 'crash' doesnt support cross endianess
>> dumps. Also even for a LE guest on LE host the memory dumps are marked as BE
>> making it not possible to analyze any guest memory dumps on the host.
>>
> From QEMU's perspective there's no "host" in this equation. We'll
> generate a BE dump for a BE guest and a LE dump for a LE guest. Anything
> different is a bug in QEMU (as the one this patch addresses).
>
>> However setting the HILE based on host endianess of qemu might not be
>> the right way to fix this problem. Based on an off mailing list discussion
>> with Narayana, he is working on another patch which doesnt set HILE
>> based on host endianess. However the problem seems to be stemming from
>> fact that qemu on KVM is using the HILE to set up the endianess of
>> memory-dump elf and since its not setup correctly the memory dumps are
>> in wrong endianess.
>>
>>> I think the actual issue might be that we're calling
>>> ppc_interrupts_little_endian with hv=true for the dump.
>>>
>> Yes, that is currently the case with cpu_get_dump_info(). Excerpt from
>> that function below that sets the endianess of the dump:
>>
>> if (ppc_interrupts_little_endian(cpu, cpu->env.has_hv_mode)) {
> This should probably be looking at cpu->vhyp or MSR_HVB since
> has_hv_mode will not change after we init the cpu.
yes, I agree. New version patch is under testing once done,
will post the patch.
>> info->d_endian = ELFDATA2LSB;
>> } else {
>> info->d_endian = ELFDATA2MSB;
>> }
>>
>> for pseries kvm guest cpu->env.has_hv_mode is already set hence
>> ppc_interrupts_little_endian() assumes its running in 'hv' mode. The new
>> patch from Narayana will be addressing this.
>>
>>>> Currently the HILE bit is never set in the HID0 register even if the
>>>> qemu is running in Little-Endian mode. This causes the guest dumps to be
>>>> always taken in Big-Endian byte ordering. A guest memory dump of a
>>>> Little-Endian guest running on Little-Endian qemu guest fails with the
>>>> crash tool as illustrated below:
>>>>
>>> Could you describe in more detail what is your setup? Specifically
>>> whether both guests are running TCG or KVM (info kvm) and the state of
>>> the nested-hv capability in QEMU command line.
>> Currently the issue is seen with any pseries KVM guest running on a PowerNV host.
[-- Attachment #2: Type: text/html, Size: 5746 bytes --]
next prev parent reply other threads:[~2023-05-04 17:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 14:50 [PATCH] target: ppc: Correctly initialize HILE in HID-0 for book3s processors Narayana Murty N
2023-04-20 15:52 ` Harsh Prateek Bora
2023-04-20 18:19 ` Fabiano Rosas
2023-04-28 4:53 ` Vaibhav Jain
2023-04-28 14:30 ` Fabiano Rosas
2023-05-04 5:35 ` Narayana Murty N [this message]
2023-05-15 6:32 ` Nicholas Piggin
2023-05-16 1:54 ` Narayana Murty N
2023-05-16 3:13 ` 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=ed0fc438-de4c-9204-2321-cf9f1bac677c@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@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.com \
--cc=vajain21@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).