Thread (22 messages) 22 messages, 3 authors, 2018-03-16

Re: [PATCH 2/3] rfi-flush: Make it possible to call setup_rfi_flush() again

From: Michal Suchánek <hidden>
Date: 2018-03-06 12:55:26

On Tue, 06 Mar 2018 23:15:45 +1100
Michael Ellerman [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Mauricio Faria de Oliveira [off-list ref] writes:
=20
quoted
Hi Michael, Michal,

I got back from vacation. Checking this one. =20
=20
Yeah it got stuck in a rut.
=20
quoted
On 02/20/2018 02:06 PM, Michal Such=C3=A1nek wrote: =20
quoted
quoted
I did it the way I did because otherwise we waste memory on every
system on earth just to support a use case that we don't actually
intend for anyone to ever use - ie. migrating from a patched
machine to an unpatched machine. =20
If this thread eventually closes in 'ok, so that memory has to be
reserved/wasted anyway', that can be done only in pseries, right?

It seems not so much memory for this particular platform/hardware. =20
=20
Yes and no. We certainly have pseries machines with 10s of TBs of
memory, but pseries is also used when running on KVM/Openstack where
some people are interested in running small VMs - so as usual it's not
so simple :)
=20
But it's not *that* much memory so we should probably stop worrying
about it and just always allocate the fallback on pseries.
=20
I *think* the patch below is all we need, as well as some tweaking of
patch 2, are you able to test and repost?
=20
cheers
=20
diff --git a/arch/powerpc/platforms/pseries/setup.c
b/arch/powerpc/platforms/pseries/setup.c index
1a527625acf7..9116824bd7c5 100644 ---
a/arch/powerpc/platforms/pseries/setup.c +++
b/arch/powerpc/platforms/pseries/setup.c @@ -468,26 +468,18 @@ static
void pseries_setup_rfi_flush(void)=20
 	/* Enable by default */
 	enable =3D true;
+	types =3D L1D_FLUSH_FALLBACK;
=20
 	rc =3D plpar_get_cpu_characteristics(&result);
 	if (rc =3D=3D H_SUCCESS) {
-		types =3D L1D_FLUSH_NONE;
-
 		if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
 			types |=3D L1D_FLUSH_MTTRIG;
 		if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
 			types |=3D L1D_FLUSH_ORI;
=20
-		/* Use fallback if nothing set in hcall */
-		if (types =3D=3D L1D_FLUSH_NONE)
-			types =3D L1D_FLUSH_FALLBACK;
-
 		if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
|| (!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
 			enable =3D false;
-	} else {
-		/* Default to fallback if case hcall is not
available */
-		types =3D L1D_FLUSH_FALLBACK;
 	}
=20
 	setup_rfi_flush(types, enable);
=20
Enabling the fallback flush always looks a bit dodgy but
do_rfi_flush_fixups will overwrite the jump so long any other fixup is
enabled.

Reviewed-by: Michal Such=C3=A1nek <redacted>

Thanks

Michal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help