From patchwork Fri Sep 22 02:18:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9965053 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BCB7602D8 for ; Fri, 22 Sep 2017 02:40:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09323296E1 for ; Fri, 22 Sep 2017 02:40:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1483296E3; Fri, 22 Sep 2017 02:40:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 770BA296E1 for ; Fri, 22 Sep 2017 02:40:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvDqj-000575-BT; Fri, 22 Sep 2017 02:37:53 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvDqi-00056z-7A for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 02:37:52 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id BF/28-03610-F7774C95; Fri, 22 Sep 2017 02:37:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsXS1tbhqFtbfiT S4NwWS4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNePgpp+sBRt5Kl5svsDewPieo4uRi0NIYDqj xPaln5i7GDk5JAR4JY4sm8HaxcgBZPtLHP5VAlHTwCjx7dx+JpAaNgF1icdfe8BsEQEliXurJ oPZzALpErfvfgebIyyQInH20wUWEJtFQFVixqrXrCA2r4CHxMbdRxghdslJnDw2GSzOCRSfuO sT2BwhAXeJrZ8+sE1g5F3AyLCKUaM4tagstUjXyEwvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NSc xqVgvOT93EyMwHBiAYAfjmQWBhxglOZiURHl9s49ECvEl5adUZiQWZ8QXleakFh9ilOHgUJLg dSwDygkWpaanVqRl5gADEyYtwcGjJMLLCJLmLS5IzC3OTIdInWLU5ei4efcPkxBLXn5eqpQ4r wdIkQBIUUZpHtwIWJRcYpSVEuZlBDpKiKcgtSg3swRV/hWjOAejkjDvApApPJl5JXCbXgEdwQ R0RPaGAyBHlCQipKQaGCcEPVlVu+Rk//bzR3+8v/nVccdq4X+NF3buVbovJ5Zy/OCC35EJ9j6 LJW/d+3evzc8+qPH1ykwZ9sLQQBO7Dbevpi6++u/IYz/r4mMLJb5M2TmjkX2Sk2J/JXOL87bM 8GYPDVNDW+5PPpUnc6Z27tO53NnpvX7KsQsb/97r4WSz/RgX0Vdv/U2JpTgj0VCLuag4EQA46 3CdjQIAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1506047867!118143498!1 X-Originating-IP: [134.134.136.65] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2625 invoked from network); 22 Sep 2017 02:37:49 -0000 Received: from mga03.intel.com (HELO mga03.intel.com) (134.134.136.65) by server-6.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Sep 2017 02:37:49 -0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2017 19:37:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,426,1500966000"; d="scan'208";a="154188057" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.75]) by fmsmga005.fm.intel.com with ESMTP; 21 Sep 2017 19:37:42 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 10:18:46 +0800 Message-Id: <1506046726-42267-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505981483-3885-1-git-send-email-yi.y.sun@linux.intel.com> References: <1505981483-3885-1-git-send-email-yi.y.sun@linux.intel.com> Cc: jgross@suse.com, andrew.cooper3@citrix.com, Yi Sun , JBeulich@suse.com Subject: [Xen-devel] [PATCH v2] x86: commit 0ade5e causes psr features in cmdline cannot be correctly enumerated X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit 0ade5e causes a bug that the psr features presented in cmdline cannot be correctly enumerated. 1. If there is only 'psr=', then CMT is enumerated which is not right. 2. If cmdline is 'psr=cmt,cat,cdp,mba', only the last feature is enumerated. This patch fixes the issues. Signed-off-by: Yi Sun Reviewed-by: Juergen Gross --- v2: - fix title and commit message. (suggested by Jan Beulich) --- xen/arch/x86/psr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 4515100..daa2aeb 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -422,9 +422,10 @@ static bool __init parse_psr_bool(const char *s, const char *delim, const char *ss, const char *feature, unsigned int mask) { - if ( !strncmp(s, feature, delim - s) ) + /* If cmdline is 'psr=', we need make sure delim != s */ + if ( delim != s && !strncmp(s, feature, delim - s) ) { - if ( !*delim ) + if ( !*delim || *delim == ',' ) opt_psr |= mask; else { @@ -457,6 +458,10 @@ static int __init parse_psr_param(const char *s) if ( !val_delim ) val_delim = strchr(s, '\0'); + /* E.g. 'psr=cmt,rmid_max:200' */ + if ( val_delim > ss ) + val_delim = ss; + if ( *val_delim && !strncmp(s, "rmid_max", val_delim - s) ) { opt_rmid_max = simple_strtoul(val_delim + 1, &q, 0);