From patchwork Tue Jun 13 14:03:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 775240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wnBbp5bd9z9s8Y for ; Wed, 14 Jun 2017 00:14:46 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OUFqocre"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="SzKr7gUl"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+hm4CdZZsOzQuIbrZp1kI8QqKiFVwxwk+M8HTVpCtak=; b=OUFqocreUWlFVnSOOrLM8H9516 ZNF8+QrI0AjZkuRD6VVpxs6OU02/bHqbTO0CQIF2elvnzc5JbvfdOKT7xwGobbAja1yxdWIWZ0chV AiQFhLdA/aWc4X7yKm9mXed8ZI3YwlYSIZiE3tnK9/uuiblj57YzMcCUT6KrUMfsSFQU172F2BAYM SMPUuFN4pvf2D3F2OEQmCWWNSLeiLDcsj1PvZNruvtlo+X4WYSuGHLWdi4eZ7reU1l7lqRgGKJOhf s+urHaz+36/T6KShBFEBbu/yn1KJSuBgXrib2ckHm0e33HzPndp/irSqc6+Qsr7s7Heb4A5eKsR1s +S11DcAg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKmaj-0000sg-DN; Tue, 13 Jun 2017 14:14:45 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKmah-0000ej-PI for linux-snps-arc@bombadil.infradead.org; Tue, 13 Jun 2017 14:14:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AYsFT351RKVqfYbBYIUrMJcCt7Kr/mgYGx8f3rDCVfg=; b=SzKr7gUlnWSlDU6tm6Om+TElv sdC89Xtu9QDxyJd8EdFcoWttD212Z/E4FpWlkSBh5h4SgbHaQctIV4/bypjk+brb+gceRgL2USzgP CWAGjPRT1mSXpIaQ3t0K3PP5bTKCTxEaj9SoJ0HC7DbGLdH7ie6IUDNAFDdZHLPp4ZCW3H3iEIVqS Y9wVZJUFqGdoozCmOxF4ZBpDlIQ4mj5r89ZJiOeqXMwX+6Zpch7HMhay6RyfIIvNtI1YNhcyPnqtk QzN8gXYlY7BkWTUaMfl/lY7smgZoAgcnGrB7+mt+7/w786goaP4mm4DDqXWZxSbWK076KWr+UWty0 XwKuk86Jg==; Received: from mail-il-dmz.mellanox.com ([193.47.165.129] helo=mellanox.co.il) by casper.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKmQp-00027b-70 for linux-snps-arc@lists.infradead.org; Tue, 13 Jun 2017 14:04:36 +0000 Received: from Internal Mail-Server by MTLPINE1 (envelope-from noamca@mellanox.com) with ESMTPS (AES256-SHA encrypted); 13 Jun 2017 17:04:07 +0300 Received: from nps20.mtl.labs.mlnx. (l-nps20.mtl.labs.mlnx [10.7.191.20]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v5DE471H019874; Tue, 13 Jun 2017 17:04:07 +0300 From: Noam Camus To: linux-snps-arc@lists.infradead.org Subject: [PATCH v2 08/12] ARC: [plat-eznps] new command line argument for HW scheduler at MTM Date: Tue, 13 Jun 2017 17:03:52 +0300 Message-Id: <1497362636-30353-9-git-send-email-noamca@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1497362636-30353-1-git-send-email-noamca@mellanox.com> References: <1497362636-30353-1-git-send-email-noamca@mellanox.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170613_150431_484676_BF06DA49 X-CRM114-Status: GOOD ( 14.95 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Noam Camus , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Noam Camus We add ability for all cores at NPS SoC to control the number of cycles HW thread can execute before it is replace with another eligible HW thread within the same core. The replacement is done by the HE scheduler. Signed-off-by: Noam Camus --- Documentation/admin-guide/kernel-parameters.txt | 9 ++++ arch/arc/plat-eznps/mtm.c | 49 ++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 15f79c2..5b551f7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2693,6 +2693,15 @@ If the dependencies are under your control, you can turn on cpu0_hotplug. + nps_mtm_hs_ctr= [KNL,ARC] + This parameter sets the maximum duration, in + cycles, each HW thread of the CTOP can run + without interruptions, before HW switches it. + The actual maximum duration is 16 times this + parameter's value. + Format: integer between 1 and 255 + Default: 255 + nptcg= [IA-64] Override max number of concurrent global TLB purges which is reported from either PAL_VM_SUMMARY or SAL PALO. diff --git a/arch/arc/plat-eznps/mtm.c b/arch/arc/plat-eznps/mtm.c index 59a0162..dd1ea1f 100644 --- a/arch/arc/plat-eznps/mtm.c +++ b/arch/arc/plat-eznps/mtm.c @@ -21,10 +21,13 @@ #include #include -#define MT_CTRL_HS_CNT 0xFF +#define MT_HS_CNT_MIN 0x01 +#define MT_HS_CNT_MAX 0xFF #define MT_CTRL_ST_CNT 0xF #define NPS_NUM_HW_THREADS 0x10 +static int mtm_hs_ctr = MT_HS_CNT_MAX; + #ifdef CONFIG_EZNPS_MEM_ERROR int do_memory_error(unsigned long address, struct pt_regs *regs) { @@ -129,7 +132,7 @@ void mtm_enable_core(unsigned int cpu) /* Enable HW schedule, stall counter, mtm */ mt_ctrl.value = 0; mt_ctrl.hsen = 1; - mt_ctrl.hs_cnt = MT_CTRL_HS_CNT; + mt_ctrl.hs_cnt = mtm_hs_ctr; mt_ctrl.mten = 1; write_aux_reg(CTOP_AUX_MT_CTRL, mt_ctrl.value); @@ -140,3 +143,45 @@ void mtm_enable_core(unsigned int cpu) */ cpu_relax(); } + +/* Handle an out of bounds mtm hs counter value */ +static void __init handle_mtm_hs_ctr_out_of_bounds_error(uint8_t val) +{ + pr_err("** The value of mtm_hs_ctr is out of bounds!\n" + "** It must be in the range [%d,%d] (inclusive)\n" + "Setting mtm_hs_ctr to %d\n", MT_HS_CNT_MIN, MT_HS_CNT_MAX, val); + + mtm_hs_ctr = val; +} + +/* Verify and set the value of the mtm hs counter */ +static int __init set_mtm_hs_ctr(char *ctr_str) +{ + int ret; + long hs_ctr; + + ret = kstrtol(ctr_str, 0, &hs_ctr); + if (ret) { + pr_err("** Error parsing the value of mtm_hs_ctr\n" + "** Make sure you entered a valid integer value\n" + "Setting mtm_hs_ctr to default value: %d\n", + MT_HS_CNT_MAX); + mtm_hs_ctr = MT_HS_CNT_MAX; + return -EINVAL; + } + + if (hs_ctr > MT_HS_CNT_MAX) { + handle_mtm_hs_ctr_out_of_bounds_error(MT_HS_CNT_MAX); + return -EDOM; + } + + if (hs_ctr < MT_HS_CNT_MIN) { + handle_mtm_hs_ctr_out_of_bounds_error(MT_HS_CNT_MIN); + return -EDOM; + } + + mtm_hs_ctr = hs_ctr; + + return 0; +} +early_param("nps_mtm_hs_ctr", set_mtm_hs_ctr);