All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration
@ 2018-03-14 22:40 Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code Mauricio Faria de Oliveira
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

This patchset allows for setup_rfi_flush() to be called again
after PowerVM LPM (live partition mobility) aka LPAR migration,
in order to possibly switch to a different flush method.

The patches are mostly from Michael Ellerman, I have rebased to
powerpc/linux.git merge branch as of commit d8443ef (March 14).

Testcase and results sent as the last email in the series.

v3: add patch 4 to tell flush types are 'available' and not 'Using'.
    remove plumbing patch.

v2: add plumbing patch between platforms and setup code to
    force init fallback flush.

Mauricio Faria de Oliveira (1):
  rfi-flush: Differentiate enabled and patched flush types

Michael Ellerman (4):
  rfi-flush: Move the logic to avoid a redo into the debugfs code
  rfi-flush: Make it possible to call setup_rfi_flush() again
  rfi-flush: Always enable fallback flush on pseries
  rfi-flush: Call setup_rfi_flush() after LPM migration

 arch/powerpc/include/asm/setup.h          |  2 +-
 arch/powerpc/kernel/setup_64.c            | 25 ++++++++++++++++---------
 arch/powerpc/lib/feature-fixups.c         |  9 ++++++++-
 arch/powerpc/platforms/pseries/mobility.c |  3 +++
 arch/powerpc/platforms/pseries/pseries.h  |  2 ++
 arch/powerpc/platforms/pseries/setup.c    | 12 ++----------
 6 files changed, 32 insertions(+), 21 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code
  2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
@ 2018-03-14 22:40 ` Mauricio Faria de Oliveira
  2018-03-15 20:36   ` Murilo Opsfelder Araujo
  2018-03-28 14:13   ` [v3, " Michael Ellerman
  2018-03-14 22:40 ` [PATCH v3 2/5] rfi-flush: Make it possible to call setup_rfi_flush() again Mauricio Faria de Oliveira
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

From: Michael Ellerman <mpe@ellerman.id.au>

rfi_flush_enable() includes a check to see if we're already
enabled (or disabled), and in that case does nothing.

But that means calling setup_rfi_flush() a 2nd time doesn't actually
work, which is a bit confusing.

Move that check into the debugfs code, where it really belongs.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/setup_64.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index c388cc3..3efc01a 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -846,9 +846,6 @@ static void do_nothing(void *unused)
 
 void rfi_flush_enable(bool enable)
 {
-	if (rfi_flush == enable)
-		return;
-
 	if (enable) {
 		do_rfi_flush_fixups(enabled_flush_types);
 		on_each_cpu(do_nothing, NULL, 1);
@@ -902,13 +899,19 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
 #ifdef CONFIG_DEBUG_FS
 static int rfi_flush_set(void *data, u64 val)
 {
+	bool enable;
+
 	if (val == 1)
-		rfi_flush_enable(true);
+		enable = true;
 	else if (val == 0)
-		rfi_flush_enable(false);
+		enable = false;
 	else
 		return -EINVAL;
 
+	/* Only do anything if we're changing state */
+	if (enable != rfi_flush)
+		rfi_flush_enable(enable);
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 2/5] rfi-flush: Make it possible to call setup_rfi_flush() again
  2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code Mauricio Faria de Oliveira
@ 2018-03-14 22:40 ` Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 3/5] rfi-flush: Always enable fallback flush on pseries Mauricio Faria de Oliveira
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

From: Michael Ellerman <mpe@ellerman.id.au>

For PowerVM migration we want to be able to call setup_rfi_flush()
again after we've migrated the partition.

To support that we need to check that we're not trying to allocate the
fallback flush area after memblock has gone away (i.e., boot-time only).

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/setup.h | 2 +-
 arch/powerpc/kernel/setup_64.c   | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index 469b7fd..bbcdf92 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -49,7 +49,7 @@ enum l1d_flush_type {
 	L1D_FLUSH_MTTRIG	= 0x8,
 };
 
-void __init setup_rfi_flush(enum l1d_flush_type, bool enable);
+void setup_rfi_flush(enum l1d_flush_type, bool enable);
 void do_rfi_flush_fixups(enum l1d_flush_type types);
 
 #endif /* !__ASSEMBLY__ */
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 3efc01a..d60e2f7 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -860,6 +860,10 @@ static void init_fallback_flush(void)
 	u64 l1d_size, limit;
 	int cpu;
 
+	/* Only allocate the fallback flush area once (at boot time). */
+	if (l1d_flush_fallback_area)
+		return;
+
 	l1d_size = ppc64_caches.l1d.size;
 	limit = min(ppc64_bolted_size(), ppc64_rma_size);
 
@@ -877,7 +881,7 @@ static void init_fallback_flush(void)
 	}
 }
 
-void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
+void setup_rfi_flush(enum l1d_flush_type types, bool enable)
 {
 	if (types & L1D_FLUSH_FALLBACK) {
 		pr_info("rfi-flush: Using fallback displacement flush\n");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 3/5] rfi-flush: Always enable fallback flush on pseries
  2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 2/5] rfi-flush: Make it possible to call setup_rfi_flush() again Mauricio Faria de Oliveira
@ 2018-03-14 22:40 ` Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 4/5] rfi-flush: Differentiate enabled and patched flush types Mauricio Faria de Oliveira
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

From: Michael Ellerman <mpe@ellerman.id.au>

This ensures the fallback flush area is always allocated on pseries,
so in case a LPAR is migrated from a patched to an unpatched system,
it is possible to enable the fallback flush in the target system.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/setup.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 4642e48..b20d107 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)
 
 	/* Enable by default */
 	enable = true;
+	types = L1D_FLUSH_FALLBACK;
 
 	rc = plpar_get_cpu_characteristics(&result);
 	if (rc == H_SUCCESS) {
-		types = L1D_FLUSH_NONE;
-
 		if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
 			types |= L1D_FLUSH_MTTRIG;
 		if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
 			types |= L1D_FLUSH_ORI;
 
-		/* Use fallback if nothing set in hcall */
-		if (types == L1D_FLUSH_NONE)
-			types = L1D_FLUSH_FALLBACK;
-
 		if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) ||
 		    (!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
 			enable = false;
-	} else {
-		/* Default to fallback if case hcall is not available */
-		types = L1D_FLUSH_FALLBACK;
 	}
 
 	setup_rfi_flush(types, enable);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 4/5] rfi-flush: Differentiate enabled and patched flush types
  2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
                   ` (2 preceding siblings ...)
  2018-03-14 22:40 ` [PATCH v3 3/5] rfi-flush: Always enable fallback flush on pseries Mauricio Faria de Oliveira
@ 2018-03-14 22:40 ` Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [PATCH v3 5/5] rfi-flush: Call setup_rfi_flush() after LPM migration Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [TESTS] Create 'enabled_flush_types' boot option, and short-circuit LPM Mauricio Faria de Oliveira
  5 siblings, 0 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

Currently the rfi-flush messages print 'Using <type> flush' for all
enabled_flush_types, but that is not necessarily true -- as now the
fallback flush is always enabled on pseries, but the fixup function
overwrites its nop/branch slot with other flush types, if available.

So, replace the 'Using <type> flush' messages with '<type> flush is
available'.

Also, print the patched flush types in the fixup function, so users
can know what is (not) being used (e.g., the slower, fallback flush,
or no flush type at all if flush is disabled via the debugfs switch).

Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---

P.S.: Michael, you suggested only hunk 1. please feel free to discard
      hunk 2 if you don't like it.

 arch/powerpc/kernel/setup_64.c    | 6 +++---
 arch/powerpc/lib/feature-fixups.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d60e2f7..4ec4a27 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -884,15 +884,15 @@ static void init_fallback_flush(void)
 void setup_rfi_flush(enum l1d_flush_type types, bool enable)
 {
 	if (types & L1D_FLUSH_FALLBACK) {
-		pr_info("rfi-flush: Using fallback displacement flush\n");
+		pr_info("rfi-flush: fallback displacement flush available\n");
 		init_fallback_flush();
 	}
 
 	if (types & L1D_FLUSH_ORI)
-		pr_info("rfi-flush: Using ori type flush\n");
+		pr_info("rfi-flush: ori type flush available\n");
 
 	if (types & L1D_FLUSH_MTTRIG)
-		pr_info("rfi-flush: Using mttrig type flush\n");
+		pr_info("rfi-flush: mttrig type flush available\n");
 
 	enabled_flush_types = types;
 
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
index 73697c4..35f80ab 100644
--- a/arch/powerpc/lib/feature-fixups.c
+++ b/arch/powerpc/lib/feature-fixups.c
@@ -153,7 +153,14 @@ void do_rfi_flush_fixups(enum l1d_flush_type types)
 		patch_instruction(dest + 2, instrs[2]);
 	}
 
-	printk(KERN_DEBUG "rfi-flush: patched %d locations\n", i);
+	printk(KERN_DEBUG "rfi-flush: patched %d locations (%s flush)\n", i,
+		(types == L1D_FLUSH_NONE)       ? "no" :
+		(types == L1D_FLUSH_FALLBACK)   ? "fallback displacement" :
+		(types &  L1D_FLUSH_ORI)        ? (types & L1D_FLUSH_MTTRIG)
+							? "ori+mttrig type"
+							: "ori type" :
+		(types &  L1D_FLUSH_MTTRIG)     ? "mttrig type"
+						: "unknown");
 }
 #endif /* CONFIG_PPC_BOOK3S_64 */
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 5/5] rfi-flush: Call setup_rfi_flush() after LPM migration
  2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
                   ` (3 preceding siblings ...)
  2018-03-14 22:40 ` [PATCH v3 4/5] rfi-flush: Differentiate enabled and patched flush types Mauricio Faria de Oliveira
@ 2018-03-14 22:40 ` Mauricio Faria de Oliveira
  2018-03-14 22:40 ` [TESTS] Create 'enabled_flush_types' boot option, and short-circuit LPM Mauricio Faria de Oliveira
  5 siblings, 0 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

From: Michael Ellerman <mpe@ellerman.id.au>

We might have migrated to a machine that uses a different flush type,
or doesn't need flushing at all.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 3 +++
 arch/powerpc/platforms/pseries/pseries.h  | 2 ++
 arch/powerpc/platforms/pseries/setup.c    | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 0f7fb71..8a8033a 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -348,6 +348,9 @@ void post_mobility_fixup(void)
 		printk(KERN_ERR "Post-mobility device tree update "
 			"failed: %d\n", rc);
 
+	/* Possibly switch to a new RFI flush type */
+	pseries_setup_rfi_flush();
+
 	return;
 }
 
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index c73351c..60db2ee 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -108,4 +108,6 @@ static inline unsigned long cmo_get_page_size(void)
 
 int dlpar_workqueue_init(void);
 
+void pseries_setup_rfi_flush(void);
+
 #endif /* _PSERIES_PSERIES_H */
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index b20d107..f34f908 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -459,7 +459,7 @@ static void __init find_and_init_phbs(void)
 	of_pci_check_probe_only();
 }
 
-static void pseries_setup_rfi_flush(void)
+void pseries_setup_rfi_flush(void)
 {
 	struct h_cpu_char_result result;
 	enum l1d_flush_type types;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [TESTS] Create 'enabled_flush_types' boot option, and short-circuit LPM
  2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
                   ` (4 preceding siblings ...)
  2018-03-14 22:40 ` [PATCH v3 5/5] rfi-flush: Call setup_rfi_flush() after LPM migration Mauricio Faria de Oliveira
@ 2018-03-14 22:40 ` Mauricio Faria de Oliveira
  5 siblings, 0 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-14 22:40 UTC (permalink / raw)
  To: linuxppc-dev, mpe, msuchanek

fallback -> fallback:

    # dmesg -c | grep rfi-flush
    [    0.000000] rfi-flush (debug): enabled flush types: 0x0
    [    0.000000] rfi-flush: fallback displacement flush available
    [    0.000000] rfi-flush: patched 8 locations (fallback displacement flush)

    # echo > /sys/kernel/mobility/migration 

    # dmesg -c | grep rfi-flush
    [   32.525443] rfi-flush: fallback displacement flush available
    [   32.526269] rfi-flush: patched 8 locations (fallback displacement flush)

fallback -> instructions:

    # dmesg -c | grep rfi-flush
    [    0.000000] rfi-flush (debug): enabled flush types: 0x0
    [    0.000000] rfi-flush: fallback displacement flush available
    [    0.000000] rfi-flush: patched 8 locations (fallback displacement flush)

    # echo 24 > /sys/kernel/debug/powerpc/rfi_flush 

    # dmesg -c | grep rfi-flush
    [   30.984247] rfi-flush (debug): enabled flush types: 0xc

    # echo > /sys/kernel/mobility/migration 

    # dmesg -c | grep rfi-flush
    [   51.554357] rfi-flush: fallback displacement flush available
    [   51.554360] rfi-flush: ori type flush available
    [   51.554361] rfi-flush: mttrig type flush available
    [   51.554366] rfi-flush: patched 8 locations (ori+mttrig type flush)

instructions -> instructions:

    # dmesg -c | grep rfi-flush
    [    0.000000] rfi-flush (debug): enabled flush types: 0xc
    [    0.000000] rfi-flush: fallback displacement flush available
    [    0.000000] rfi-flush: ori type flush available
    [    0.000000] rfi-flush: mttrig type flush available
    [    0.000000] rfi-flush: patched 8 locations (ori+mttrig type flush)

    # echo > /sys/kernel/mobility/migration 

    # dmesg -c | grep rfi-flush
    [   55.100566] rfi-flush: fallback displacement flush available
    [   55.100570] rfi-flush: ori type flush available
    [   55.100571] rfi-flush: mttrig type flush available
    [   55.100575] rfi-flush: patched 8 locations (ori+mttrig type flush)

instructions -> fallback:

    # dmesg -c | grep rfi-flush
    [    0.000000] rfi-flush (debug): enabled flush types: 0xc
    [    0.000000] rfi-flush: fallback displacement flush available
    [    0.000000] rfi-flush: ori type flush available
    [    0.000000] rfi-flush: mttrig type flush available
    [    0.000000] rfi-flush: patched 8 locations (ori+mttrig type flush)

    # echo 1111 > /sys/kernel/debug/powerpc/rfi_flush

    # dmesg -c | grep rfi-flush
    [   18.730782] rfi-flush (debug): enabled flush types: 0x0

    # echo > /sys/kernel/mobility/migration                                                                                                                                                    

    # dmesg -c | grep rfi-flush
    [   27.120071] rfi-flush: fallback displacement flush available
    [   27.120078] rfi-flush: patched 8 locations (fallback displacement flush)

debugfs switch:

    # echo 0 > /sys/kernel/debug/powerpc/rfi_flush 
    # echo 1 > /sys/kernel/debug/powerpc/rfi_flush 

    # dmesg -c | grep rfi-flush
    [  106.031993] rfi-flush: patched 8 locations (no flush)
    [  109.670966] rfi-flush: patched 8 locations (fallback displacement flush)

ori type only:

    # echo 8 > /sys/kernel/debug/powerpc/rfi_flush
    # echo 0 > /sys/kernel/debug/powerpc/rfi_flush 
    # echo 1 > /sys/kernel/debug/powerpc/rfi_flush 

    # dmesg -c | grep rfi-flush
    [  308.988958] rfi-flush (debug): enabled flush types: 0x4
    [  314.206548] rfi-flush: patched 8 locations (no flush)
    [  316.349916] rfi-flush: patched 8 locations (ori type flush)

mttrig type only:

    # echo 16 > /sys/kernel/debug/powerpc/rfi_flush
    # echo 0 > /sys/kernel/debug/powerpc/rfi_flush 
    # echo 1 > /sys/kernel/debug/powerpc/rfi_flush 

    # dmesg -c | grep rfi-flush
    [  355.993189] rfi-flush (debug): enabled flush types: 0x8
    [  360.644291] rfi-flush: patched 8 locations (no flush)
    [  365.300547] rfi-flush: patched 8 locations (mttrig type flush)

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/setup_64.c            | 29 +++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/mobility.c |  4 ++++
 2 files changed, 33 insertions(+)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4ec4a27..9c9568e 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -816,6 +816,24 @@ static void *l1d_flush_fallback_area;
 static bool no_rfi_flush;
 bool rfi_flush;
 
+static int __init handle_enabled_flush_types(char *p)
+{
+	int rc;
+	enum l1d_flush_type types;
+
+	rc = kstrtoul(p, 0, (long unsigned int *)&types);
+	if (!rc) {
+		enabled_flush_types = types;
+		pr_info("rfi-flush (debug): enabled flush types: 0x%x\n", enabled_flush_types);
+	} else {
+		enabled_flush_types = L1D_FLUSH_NONE;
+		pr_info("rfi-flush (debug): enabled flush types is invalid\n");
+	}
+
+	return rc;
+}
+early_param("enabled_flush_types", handle_enabled_flush_types);
+
 static int __init handle_no_rfi_flush(char *p)
 {
 	pr_info("rfi-flush: disabled on command line.");
@@ -883,6 +901,8 @@ static void init_fallback_flush(void)
 
 void setup_rfi_flush(enum l1d_flush_type types, bool enable)
 {
+	types |= enabled_flush_types;
+
 	if (types & L1D_FLUSH_FALLBACK) {
 		pr_info("rfi-flush: fallback displacement flush available\n");
 		init_fallback_flush();
@@ -909,6 +929,15 @@ static int rfi_flush_set(void *data, u64 val)
 		enable = true;
 	else if (val == 0)
 		enable = false;
+	else if (val == 1111) {
+		enable = true;
+		enabled_flush_types = 0;
+		pr_info("rfi-flush (debug): enabled flush types: 0x%x\n", enabled_flush_types);
+	} else if (val >= 2) {
+		enable = true;
+		enabled_flush_types = val >> 1;
+		pr_info("rfi-flush (debug): enabled flush types: 0x%x\n", enabled_flush_types);
+	}
 	else
 		return -EINVAL;
 
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 8a8033a..2a8458a 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -326,6 +326,7 @@ int pseries_devicetree_update(s32 scope)
 
 void post_mobility_fixup(void)
 {
+#if 0
 	int rc;
 	int activate_fw_token;
 
@@ -348,6 +349,7 @@ void post_mobility_fixup(void)
 		printk(KERN_ERR "Post-mobility device tree update "
 			"failed: %d\n", rc);
 
+#endif
 	/* Possibly switch to a new RFI flush type */
 	pseries_setup_rfi_flush();
 
@@ -358,6 +360,7 @@ static ssize_t migration_store(struct class *class,
 			       struct class_attribute *attr, const char *buf,
 			       size_t count)
 {
+#if 0
 	u64 streamid;
 	int rc;
 
@@ -374,6 +377,7 @@ static ssize_t migration_store(struct class *class,
 	if (rc)
 		return rc;
 
+#endif
 	post_mobility_fixup();
 	return count;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code
  2018-03-14 22:40 ` [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code Mauricio Faria de Oliveira
@ 2018-03-15 20:36   ` Murilo Opsfelder Araujo
  2018-03-16  8:52     ` Michal Suchánek
  2018-03-28 14:13   ` [v3, " Michael Ellerman
  1 sibling, 1 reply; 11+ messages in thread
From: Murilo Opsfelder Araujo @ 2018-03-15 20:36 UTC (permalink / raw)
  To: Mauricio Faria de Oliveira, linuxppc-dev, mpe, msuchanek

On 03/14/2018 07:40 PM, Mauricio Faria de Oliveira wrote:
> From: Michael Ellerman <mpe@ellerman.id.au>
> 
> rfi_flush_enable() includes a check to see if we're already
> enabled (or disabled), and in that case does nothing.
> 
> But that means calling setup_rfi_flush() a 2nd time doesn't actually
> work, which is a bit confusing.
> 
> Move that check into the debugfs code, where it really belongs.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
> ---
>  arch/powerpc/kernel/setup_64.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index c388cc3..3efc01a 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -846,9 +846,6 @@ static void do_nothing(void *unused)
> 
>  void rfi_flush_enable(bool enable)
>  {
> -	if (rfi_flush == enable)
> -		return;
> -
>  	if (enable) {
>  		do_rfi_flush_fixups(enabled_flush_types);
>  		on_each_cpu(do_nothing, NULL, 1);
> @@ -902,13 +899,19 @@ void __init setup_rfi_flush(enum l1d_flush_type types, bool enable)
>  #ifdef CONFIG_DEBUG_FS
>  static int rfi_flush_set(void *data, u64 val)
>  {
> +	bool enable;
> +
>  	if (val == 1)
> -		rfi_flush_enable(true);
> +		enable = true;
>  	else if (val == 0)
> -		rfi_flush_enable(false);
> +		enable = false;
>  	else
>  		return -EINVAL;
> 
> +	/* Only do anything if we're changing state */
> +	if (enable != rfi_flush)

Hi, Mauricio.

Do we need to take into account if no_rfi_flush == true?

    if ((enable != rfi_flush) && !no_rfi_flush)

> +		rfi_flush_enable(enable);
> +
>  	return 0;
>  }
> 

Cheers
Murilo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code
  2018-03-15 20:36   ` Murilo Opsfelder Araujo
@ 2018-03-16  8:52     ` Michal Suchánek
  2018-03-16 16:42       ` Mauricio Faria de Oliveira
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Suchánek @ 2018-03-16  8:52 UTC (permalink / raw)
  To: Murilo Opsfelder Araujo; +Cc: Mauricio Faria de Oliveira, linuxppc-dev, mpe

On Thu, 15 Mar 2018 17:36:00 -0300
Murilo Opsfelder Araujo <muriloo@linux.vnet.ibm.com> wrote:

> On 03/14/2018 07:40 PM, Mauricio Faria de Oliveira wrote:
> > From: Michael Ellerman <mpe@ellerman.id.au>
> > 
> > rfi_flush_enable() includes a check to see if we're already
> > enabled (or disabled), and in that case does nothing.
> > 
> > But that means calling setup_rfi_flush() a 2nd time doesn't actually
> > work, which is a bit confusing.
> > 
> > Move that check into the debugfs code, where it really belongs.
> > 
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > Signed-off-by: Mauricio Faria de Oliveira
> > <mauricfo@linux.vnet.ibm.com> ---
> >  arch/powerpc/kernel/setup_64.c | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/powerpc/kernel/setup_64.c
> > b/arch/powerpc/kernel/setup_64.c index c388cc3..3efc01a 100644
> > --- a/arch/powerpc/kernel/setup_64.c
> > +++ b/arch/powerpc/kernel/setup_64.c
> > @@ -846,9 +846,6 @@ static void do_nothing(void *unused)
> > 
> >  void rfi_flush_enable(bool enable)
> >  {
> > -	if (rfi_flush == enable)
> > -		return;
> > -
> >  	if (enable) {
> >  		do_rfi_flush_fixups(enabled_flush_types);
> >  		on_each_cpu(do_nothing, NULL, 1);
> > @@ -902,13 +899,19 @@ void __init setup_rfi_flush(enum
> > l1d_flush_type types, bool enable) #ifdef CONFIG_DEBUG_FS
> >  static int rfi_flush_set(void *data, u64 val)
> >  {
> > +	bool enable;
> > +
> >  	if (val == 1)
> > -		rfi_flush_enable(true);
> > +		enable = true;
> >  	else if (val == 0)
> > -		rfi_flush_enable(false);
> > +		enable = false;
> >  	else
> >  		return -EINVAL;
> > 
> > +	/* Only do anything if we're changing state */
> > +	if (enable != rfi_flush)  
> 
> Hi, Mauricio.
> 
> Do we need to take into account if no_rfi_flush == true?

I think it makes sense you are able to override that using debugfs.

It's interface used for diagnostics and testing.

If this was in sysfs it would be a different story.

Thanks

Michal

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code
  2018-03-16  8:52     ` Michal Suchánek
@ 2018-03-16 16:42       ` Mauricio Faria de Oliveira
  0 siblings, 0 replies; 11+ messages in thread
From: Mauricio Faria de Oliveira @ 2018-03-16 16:42 UTC (permalink / raw)
  To: Michal Suchánek, Murilo Opsfelder Araujo; +Cc: linuxppc-dev

Hi Murilo and Michal,

On 03/16/2018 05:52 AM, Michal Suchánek wrote:
>> Do we need to take into account if no_rfi_flush == true?

> I think it makes sense you are able to override that using debugfs.
> 
> It's interface used for diagnostics and testing.
> 
> If this was in sysfs it would be a different story.

Yes, I agree. The debugfs is way to override the cmdline option.

Thanks for looking carefully at this :)

cheers,
Mauricio

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [v3, 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code
  2018-03-14 22:40 ` [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code Mauricio Faria de Oliveira
  2018-03-15 20:36   ` Murilo Opsfelder Araujo
@ 2018-03-28 14:13   ` Michael Ellerman
  1 sibling, 0 replies; 11+ messages in thread
From: Michael Ellerman @ 2018-03-28 14:13 UTC (permalink / raw)
  To: Mauricio Faria de Oliveira, linuxppc-dev, msuchanek

On Wed, 2018-03-14 at 22:40:38 UTC, Mauricio Faria de Oliveira wrote:
> From: Michael Ellerman <mpe@ellerman.id.au>
> 
> rfi_flush_enable() includes a check to see if we're already
> enabled (or disabled), and in that case does nothing.
> 
> But that means calling setup_rfi_flush() a 2nd time doesn't actually
> work, which is a bit confusing.
> 
> Move that check into the debugfs code, where it really belongs.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/1e2a9fc7496955faacbbed49461d61

cheers

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-03-28 14:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 22:40 [PATCH v3 0/5] Setup RFI flush after PowerVM LPM migration Mauricio Faria de Oliveira
2018-03-14 22:40 ` [PATCH v3 1/5] rfi-flush: Move the logic to avoid a redo into the debugfs code Mauricio Faria de Oliveira
2018-03-15 20:36   ` Murilo Opsfelder Araujo
2018-03-16  8:52     ` Michal Suchánek
2018-03-16 16:42       ` Mauricio Faria de Oliveira
2018-03-28 14:13   ` [v3, " Michael Ellerman
2018-03-14 22:40 ` [PATCH v3 2/5] rfi-flush: Make it possible to call setup_rfi_flush() again Mauricio Faria de Oliveira
2018-03-14 22:40 ` [PATCH v3 3/5] rfi-flush: Always enable fallback flush on pseries Mauricio Faria de Oliveira
2018-03-14 22:40 ` [PATCH v3 4/5] rfi-flush: Differentiate enabled and patched flush types Mauricio Faria de Oliveira
2018-03-14 22:40 ` [PATCH v3 5/5] rfi-flush: Call setup_rfi_flush() after LPM migration Mauricio Faria de Oliveira
2018-03-14 22:40 ` [TESTS] Create 'enabled_flush_types' boot option, and short-circuit LPM Mauricio Faria de Oliveira

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.