All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <dgibson@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	pbonzini@redhat.com, lvivier@redhat.com, clg@fr.ibm.com,
	drjones@redhat.com
Subject: Re: [kvm-unit-tests PATCH] powerpc: Add SPRs migration test
Date: Mon, 11 Apr 2016 11:55:07 +1000	[thread overview]
Message-ID: <20160411115507.524f8f9f@voom.fritz.box> (raw)
In-Reply-To: <1460115329-21611-1-git-send-email-thuth@redhat.com>

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

On Fri,  8 Apr 2016 13:35:29 +0200
Thomas Huth <thuth@redhat.com> wrote:

> This test can be used to check whether the SPR (special purpose
> registers) of the PowerPC CPU are migrated right. It first fills
> the various SPRs with some non-zero value, then reads the values
> back into a first array, then waits for a key (with the '-w' option)
> so that it is possible to migrate the VM, and finally reads the
> values from the SPRs back into another array and then compares it
> with the initial values.
> Currently the test only supports the SPRs from the PowerISA v2.07
> specification (i.e. POWER8 CPUs), but other versions should be
> pretty easy to add later.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

So, the main concern I have about this is that while writing an
arbitrary value is ok for quite a few SPRs, there's a significant
number where that's not safe: either because it could actually cause
some sort of exception interrupting the test, or because the value will
get masked or otherwise modifier on write.

I think at the very least we should separate out the code dealing with
the safe-to-write-anything SPRs from the others as a form of internal
documentation.  Then we probably want some sort of table of safe
non-default values for the other SPRs.

[snip]
> +/* Common SPRs for all PowerPC CPUs */
> +static void set_sprs_common(uint64_t val)
> +{
> +	mtspr(1, val);		/* XER */
> +	mtspr(9, val);		/* CTR */
> +	mtspr(273, val);	/* SPRG1 */
> +	mtspr(274, val);	/* SPRG2 */
> +	mtspr(275, val);	/* SPRG3 */
> +}
> +
> +/* SPRs from PowerISA 2.07 Book III-S */
> +static void set_sprs_book3s_207(uint64_t val)
> +{
> +	mtspr(3, val);		/* DSCR */
> +	mtspr(13, val);		/* AMR */
> +	mtspr(17, val);		/* DSCR */
> +	mtspr(18, val);		/* DSISR */
> +	mtspr(19, val);		/* DAR */
> +	mtspr(29, val);		/* AMR */

AMR seems to be listed twice..

> +	mtspr(61, val);		/* IAMR */
> +	mtspr(152, val);	/* CTRL */
> +	mtspr(153, val);	/* FSCR */
> +	mtspr(157, val);	/* UAMOR */
> +	mtspr(159, val);	/* PSPB */
> +	mtspr(256, val);	/* VRSAVE */
> +	mtspr(272, val);	/* SPRG0 */
> +	mtspr(512, val);	/* SPEFSCR */
> +	mtspr(769, val);	/* MMCR2 */
> +	mtspr(770, val);	/* MMCRA */
> +	mtspr(771, val);	/* PMC1 */
> +	mtspr(772, val);	/* PMC2 */
> +	mtspr(773, val);	/* PMC3 */
> +	mtspr(774, val);	/* PMC4 */
> +	mtspr(775, val);	/* PMC5 */
> +	mtspr(776, val);	/* PMC6 */
> +	mtspr(779, val);	/* MMCR0 */
> +	mtspr(784, val);	/* SIER */
> +	mtspr(785, val);	/* MMCR2 */
> +	mtspr(786, val);	/* MMCRA */
> +	mtspr(787, val);	/* PMC1 */
> +	mtspr(788, val);	/* PMC2 */
> +	mtspr(789, val);	/* PMC3 */
> +	mtspr(790, val);	/* PMC4 */
> +	mtspr(791, val);	/* PMC5 */
> +	mtspr(792, val);	/* PMC6 */
> +	mtspr(795, val);	/* MMCR0 */
> +	mtspr(796, val);	/* SIAR */
> +	mtspr(798, val);	/* SDAR */
> +	mtspr(800, val);	/* BESCRS */
> +	mtspr(801, val);	/* BESCCRSU */
> +	mtspr(802, val);	/* BESCRR */
> +	mtspr(803, val);	/* BESCRRU */
> +	mtspr(804, val);	/* EBBHR */
> +	mtspr(805, val);	/* EBBRR */
> +	mtspr(806, val);	/* BESCR */
> +	mtspr(815, val);	/* TAR */
> +}

At a glance SPRs above where writing an arbitrary value might not be
safe include AMR, IAMR, UAMOR, and MMCR*.

-- 
David Gibson <dgibson@redhat.com>
Senior Software Engineer, Virtualization, Red Hat

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <dgibson@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	pbonzini@redhat.com, lvivier@redhat.com, clg@fr.ibm.com,
	drjones@redhat.com
Subject: Re: [kvm-unit-tests PATCH] powerpc: Add SPRs migration test
Date: Mon, 11 Apr 2016 01:55:07 +0000	[thread overview]
Message-ID: <20160411115507.524f8f9f@voom.fritz.box> (raw)
In-Reply-To: <1460115329-21611-1-git-send-email-thuth@redhat.com>

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

On Fri,  8 Apr 2016 13:35:29 +0200
Thomas Huth <thuth@redhat.com> wrote:

> This test can be used to check whether the SPR (special purpose
> registers) of the PowerPC CPU are migrated right. It first fills
> the various SPRs with some non-zero value, then reads the values
> back into a first array, then waits for a key (with the '-w' option)
> so that it is possible to migrate the VM, and finally reads the
> values from the SPRs back into another array and then compares it
> with the initial values.
> Currently the test only supports the SPRs from the PowerISA v2.07
> specification (i.e. POWER8 CPUs), but other versions should be
> pretty easy to add later.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

So, the main concern I have about this is that while writing an
arbitrary value is ok for quite a few SPRs, there's a significant
number where that's not safe: either because it could actually cause
some sort of exception interrupting the test, or because the value will
get masked or otherwise modifier on write.

I think at the very least we should separate out the code dealing with
the safe-to-write-anything SPRs from the others as a form of internal
documentation.  Then we probably want some sort of table of safe
non-default values for the other SPRs.

[snip]
> +/* Common SPRs for all PowerPC CPUs */
> +static void set_sprs_common(uint64_t val)
> +{
> +	mtspr(1, val);		/* XER */
> +	mtspr(9, val);		/* CTR */
> +	mtspr(273, val);	/* SPRG1 */
> +	mtspr(274, val);	/* SPRG2 */
> +	mtspr(275, val);	/* SPRG3 */
> +}
> +
> +/* SPRs from PowerISA 2.07 Book III-S */
> +static void set_sprs_book3s_207(uint64_t val)
> +{
> +	mtspr(3, val);		/* DSCR */
> +	mtspr(13, val);		/* AMR */
> +	mtspr(17, val);		/* DSCR */
> +	mtspr(18, val);		/* DSISR */
> +	mtspr(19, val);		/* DAR */
> +	mtspr(29, val);		/* AMR */

AMR seems to be listed twice..

> +	mtspr(61, val);		/* IAMR */
> +	mtspr(152, val);	/* CTRL */
> +	mtspr(153, val);	/* FSCR */
> +	mtspr(157, val);	/* UAMOR */
> +	mtspr(159, val);	/* PSPB */
> +	mtspr(256, val);	/* VRSAVE */
> +	mtspr(272, val);	/* SPRG0 */
> +	mtspr(512, val);	/* SPEFSCR */
> +	mtspr(769, val);	/* MMCR2 */
> +	mtspr(770, val);	/* MMCRA */
> +	mtspr(771, val);	/* PMC1 */
> +	mtspr(772, val);	/* PMC2 */
> +	mtspr(773, val);	/* PMC3 */
> +	mtspr(774, val);	/* PMC4 */
> +	mtspr(775, val);	/* PMC5 */
> +	mtspr(776, val);	/* PMC6 */
> +	mtspr(779, val);	/* MMCR0 */
> +	mtspr(784, val);	/* SIER */
> +	mtspr(785, val);	/* MMCR2 */
> +	mtspr(786, val);	/* MMCRA */
> +	mtspr(787, val);	/* PMC1 */
> +	mtspr(788, val);	/* PMC2 */
> +	mtspr(789, val);	/* PMC3 */
> +	mtspr(790, val);	/* PMC4 */
> +	mtspr(791, val);	/* PMC5 */
> +	mtspr(792, val);	/* PMC6 */
> +	mtspr(795, val);	/* MMCR0 */
> +	mtspr(796, val);	/* SIAR */
> +	mtspr(798, val);	/* SDAR */
> +	mtspr(800, val);	/* BESCRS */
> +	mtspr(801, val);	/* BESCCRSU */
> +	mtspr(802, val);	/* BESCRR */
> +	mtspr(803, val);	/* BESCRRU */
> +	mtspr(804, val);	/* EBBHR */
> +	mtspr(805, val);	/* EBBRR */
> +	mtspr(806, val);	/* BESCR */
> +	mtspr(815, val);	/* TAR */
> +}

At a glance SPRs above where writing an arbitrary value might not be
safe include AMR, IAMR, UAMOR, and MMCR*.

-- 
David Gibson <dgibson@redhat.com>
Senior Software Engineer, Virtualization, Red Hat

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-04-11  1:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 11:35 [kvm-unit-tests PATCH] powerpc: Add SPRs migration test Thomas Huth
2016-04-08 11:35 ` Thomas Huth
2016-04-08 12:14 ` Andrew Jones
2016-04-08 12:14   ` Andrew Jones
2016-04-08 14:08   ` Thomas Huth
2016-04-08 14:08     ` Thomas Huth
2016-04-08 15:20     ` Andrew Jones
2016-04-08 15:20       ` Andrew Jones
2016-04-11  1:55 ` David Gibson [this message]
2016-04-11  1:55   ` David Gibson
2016-04-11  9:23   ` Thomas Huth
2016-04-11  9:23     ` Thomas Huth
2016-04-12  1:21     ` David Gibson
2016-04-12  1:21       ` David Gibson
2016-04-12 21:32       ` Greg Harmon
2016-04-14  8:18         ` Thomas Huth
2016-04-14 16:43           ` Greg Harmon
2016-04-15  8:43             ` Andrew Jones
2016-04-19  8:20             ` Thomas Huth

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=20160411115507.524f8f9f@voom.fritz.box \
    --to=dgibson@redhat.com \
    --cc=clg@fr.ibm.com \
    --cc=drjones@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.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 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.