qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>, qemu-devel@nongnu.org
Cc: Bernhard Beschow <shentey@gmail.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	bharata.rao@gmail.com, Chinmay Rath <rathc@linux.ibm.com>,
	qemu-ppc@nongnu.org, Aaron Larson <alarson@ddci.com>
Subject: Re: [PATCH 2/3] target/ppc: Have gen_pause() actually pause vCPUs
Date: Tue, 30 Sep 2025 05:00:30 +0200	[thread overview]
Message-ID: <a7c48a36-8a7b-41b3-bd3c-3cd56b1c1a26@linaro.org> (raw)
In-Reply-To: <5923fc8c7ac36d8bcae7a416cfd072c18c8698ec.camel@kernel.crashing.org>

(Cc'ing Aaron for commit 9e196938aa1 "target-ppc: gen_pause for
instructions: yield, mdoio, mdoom, miso")

On 30/9/25 00:59, Benjamin Herrenschmidt wrote:
> On Mon, 2025-09-29 at 09:51 +0200, Philippe Mathieu-Daudé wrote:
>>> What will resume it though ? The smt_low() case isn't meant to
>>> *halt*
>>> the CPUs permanently. smt_*() levels are about SMT thread
>>> priorities.
>>> Using a "pause" that just gets out of TCG (and back in), is a way
>>> to
>>> "yield" to another thread, thus enabling more forward progress when
>>> a
>>
>> What you describe can be achieved with a helper doing:
>>
>>     cs->exception_index = EXCP_YIELD;
>>     cpu_loop_exit(cs);
>>
>> Is that what you wanted?
> 
> I suppose so... this was many years ago and I don't have much context
> anymore, so I don't know why I didn't do it that way back then.

I *think* Nick implemented something similar for sPAPR in commit
e8ce0e40ee9 ("spapr: Implement H_CONFER"):

     /*
      * The targeted confer does not do anything special beyond yielding
      * the current vCPU, but even this should be better than nothing.
      * At least for single-threaded tcg, it gives the target a chance to
      * run before we run again. Multi-threaded tcg does not really do
      * anything with EXCP_YIELD yet.
      */

     cs->exception_index = EXCP_YIELD;
     cpu_exit(cs);

Nick, would that make sense to implement smt_low?


  reply	other threads:[~2025-09-30  3:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 17:30 [PATCH 0/3] target/ppc: Have gen_pause() actually pause vCPUs Philippe Mathieu-Daudé
2025-09-24 17:30 ` [PATCH 1/3] hw/ppc: Do not open-code cpu_resume() in spin_kick() Philippe Mathieu-Daudé
2025-09-24 17:58   ` Richard Henderson
2025-09-24 17:30 ` [PATCH 2/3] target/ppc: Have gen_pause() actually pause vCPUs Philippe Mathieu-Daudé
2025-09-24 17:58   ` Richard Henderson
2025-09-29  4:28   ` Benjamin Herrenschmidt
2025-09-29  7:51     ` Philippe Mathieu-Daudé
2025-09-29 22:59       ` Benjamin Herrenschmidt
2025-09-30  3:00         ` Philippe Mathieu-Daudé [this message]
2025-09-24 17:30 ` [PATCH 3/3] target/ppc: Re-use gen_pause() in gen_wait() Philippe Mathieu-Daudé
2025-09-24 18:05   ` Richard Henderson
2025-10-07  8:21 ` [PATCH 0/3] target/ppc: Have gen_pause() actually pause vCPUs Philippe Mathieu-Daudé

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=a7c48a36-8a7b-41b3-bd3c-3cd56b1c1a26@linaro.org \
    --to=philmd@linaro.org \
    --cc=alarson@ddci.com \
    --cc=benh@kernel.crashing.org \
    --cc=bharata.rao@gmail.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=shentey@gmail.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).