From patchwork Wed Mar 14 22:40:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 886071 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 401nGM1Yn7z9sVJ for ; Thu, 15 Mar 2018 09:59:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 401nGL5jrQzDqGV for ; Thu, 15 Mar 2018 09:59:06 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=mauricfo@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 401msb1rs8zDrDB for ; Thu, 15 Mar 2018 09:41:06 +1100 (AEDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EMf5rj072807 for ; Wed, 14 Mar 2018 18:41:05 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gqcmm082f-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 18:41:05 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 18:41:03 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 18:41:01 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EMf1Of40960142; Wed, 14 Mar 2018 22:41:01 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76423AE03B; Wed, 14 Mar 2018 18:42:31 -0400 (EDT) Received: from t470.localdomain.com (unknown [9.85.202.175]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 8515BAE034; Wed, 14 Mar 2018 18:42:30 -0400 (EDT) From: Mauricio Faria de Oliveira To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, msuchanek@suse.de Subject: [TESTS] Create 'enabled_flush_types' boot option, and short-circuit LPM Date: Wed, 14 Mar 2018 19:40:43 -0300 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1521067243-19520-1-git-send-email-mauricfo@linux.vnet.ibm.com> References: <1521067243-19520-1-git-send-email-mauricfo@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031422-0056-0000-0000-0000042D99DE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008675; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.01003110; UDB=6.00510475; IPR=6.00782440; MB=3.00020038; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-14 22:41:02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031422-0057-0000-0000-0000086F9AF3 Message-Id: <1521067243-19520-7-git-send-email-mauricfo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-14_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140241 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- 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; }