All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Apply paravirt to all vcpu
Date: Tue, 22 Nov 2011 22:02:53 +0000	[thread overview]
Message-ID: <4ECC1C0D.6070302@freescale.com> (raw)
In-Reply-To: <1321955703-1628-1-git-send-email-yu.liu@freescale.com>

On 11/22/2011 03:45 PM, Yoder Stuart-B08248 wrote:
> Hmm...not sure which approach makes sense.
> 
> So to make sure I understand Scott's proposal the sequence would
> be something like:
> 
>    -after secondaries CPUs are released from spin and can
>     determine they are running under KVM they:
>       -disable interrupts
>       -set a flag indicating they are waiting for paravirt
>        patching to complete
>       -spin in a loop until a flag is set that indicates
>        paravirt patch is complete
>       -make the paravirt hcall
> 
>   -boot CPU
>       -waits for all secondaries to set the 'waiting for 
>        paravirt' flag
>       -makes the paravirt hcall
>       -patches the kernel
>       -sets 'paravirt complete' flag
> 
> Is that basically correct?

That's not my proposal.

My proposal is just to add something like this at the end of
kvm_map_magic_page():

if (not the cpu doing the patching) {
	while (!kvm_patching_done)
		cpu_relax();
}

And even that is only really worth it if there are races besides SPRG3-7
to worry about.  Using the privileged version of SPRG3-7 inside the
kernel would avoid needing anything special for KVM, and would make SPRG
access slightly simpler than they are now (no separate W/R versions to
keep track of) -- I'm not sure why the kernel bothers with the user-read
version of the SPRs in the first place.

-Scott


  parent reply	other threads:[~2011-11-22 22:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22  9:55 [PATCH] KVM: PPC: Apply paravirt to all vcpu Liu Yu
2011-11-22 11:13 ` Alexander Graf
2011-11-22 11:19 ` Liu Yu-B13201
2011-11-22 11:27 ` Alexander Graf
2011-11-22 18:36 ` Scott Wood
2011-11-22 20:44 ` Alexander Graf
2011-11-22 21:11 ` Yoder Stuart-B08248
2011-11-22 21:27 ` Alexander Graf
2011-11-22 21:45 ` Yoder Stuart-B08248
2011-11-22 22:02 ` Scott Wood [this message]
2011-11-25  6:52 ` Liu Yu-B13201
2011-11-25 10:00 ` Alexander Graf

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=4ECC1C0D.6070302@freescale.com \
    --to=scottwood@freescale.com \
    --cc=kvm-ppc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.