qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Warren <ivan@vmfacility.fr>
To: qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: PPC64 TCG problem.. MSR[SF] switching.
Date: Sun, 24 Jan 2021 03:03:28 +0100	[thread overview]
Message-ID: <73db1b7f-00c2-53d9-9de1-3939b39a525b@vmfacility.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]

Hello people,

I have the following issue : I'm using an OS (not linux) on a 
qemu-system-ppc64. (in my case a Power8 qemu target with a x86_64 TCG 
target)

This OS provides a set of NARROW/WIDE (MSR[SF]) agnostic code snippets 
in the 1st 64K of addresses (so they can be called using the PPC 'bla' 
instruction). Possibly this is kernel provided code so that it can 
provide the best strategy for the current runtime environment depending 
on CPU model or whatever the SPAPR Hypervisor says.

One of the routine is 1st being called in NARROW mode, and the TCG 
generated code reflects that. For example it (seems) to generate address 
folding in the output TCG target code (looking at log out_asm output) 
and/or possibly uses the 32 bit soft mmu helper (but can't be sure of 
this)..

Later the vCPU is switched to WIDE mode (MSR[SF]==1) and invokes the 
code again. No new code is being generated because it is already in the 
TCG cache, but that code is still the NARROW mode generated TCG target 
code so it fails miserably (address incorrectly truncated to 32 bit 
and/or wrong MMU strategy).

The solutions (if my assumptions are correct) I believe is either to 
flush the TCG output cache upon MSR[SF] switching (but that could kill 
performances if there is a lot of NARROW/WIDE switches... or have 2 TCG 
caches (one for narrow code and one for wide code).

It may also affect other architectures that can switch addressing modes 
(for example, s390x has 3 possible different modes that can be switched 
directly from problem state although it doesn't affect the MMU)..

Ideas ? Comments ?

Thanks,

--Ivan



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3997 bytes --]

             reply	other threads:[~2021-01-24  2:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24  2:03 Ivan Warren [this message]
2021-01-24  3:22 ` PPC64 TCG problem.. MSR[SF] switching Richard Henderson

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=73db1b7f-00c2-53d9-9de1-3939b39a525b@vmfacility.fr \
    --to=ivan@vmfacility.fr \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).