From patchwork Thu Sep 21 08:11:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9963525 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 CE9B36020C for ; Thu, 21 Sep 2017 08:32:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBFF027E01 for ; Thu, 21 Sep 2017 08:32:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0BE928A38; Thu, 21 Sep 2017 08:32:39 +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 4397D27E01 for ; Thu, 21 Sep 2017 08:32:39 +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 1duwsJ-000609-CJ; Thu, 21 Sep 2017 08:30:23 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duwsI-000600-Fj for xen-devel@lists.xenproject.org; Thu, 21 Sep 2017 08:30:22 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 15/A2-02224-D9873C95; Thu, 21 Sep 2017 08:30:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVywNwkVnduxeF Ig90HJSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozF3yazFuzmrriw4gFjA+Mkji5GLg4hgWmM EtefdjN1MXJySAjwShxZNoMVwg6QeHZgCyNEUQOjxL47vewgCTYBdYnHX3vAGkQElCTurZoMZ jMLhEq8eNwJ1iwsYCGx4cZyFhCbRUBVYuGCFjYQm1fAXeLwqovMEAvkJE4em8w6gZF7ASPDKk aN4tSistQiXUMTvaSizPSMktzEzBxdQwNjvdzU4uLE9NScxKRiveT83E2MQA8zAMEOxhXbPQ8 xSnIwKYnyHik8HCnEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgndtOVBOsCg1PbUiLTMHGGowaQkO HiUR3ktlQGne4oLE3OLMdIjUKUZdjo6bd/8wCbHk5eelSonzHgWZIQBSlFGaBzcCFvaXGGWlh HkZgY4S4ilILcrNLEGVf8UozsGoJMwbBDKFJzOvBG7TK6AjmICOyN5wAOSIkkSElFQD46bzMn o7L2yWqvvDnV51RIJDZnmI5laV/0VPd50vkVjiXXNlwVk7X/WEhu5S1TNFbZvKfk1iXrvqaAP T5Ay5nU8qVqoY3Lhh/DZ1tey1w9M/rDvIe9F4ucDqD1oW71yv7bSYsuqq48F8YxbDiFt3brJs 4L+u//vtw8Vbc122ZmsFcZpN+fU+47cSS3FGoqEWc1FxIgAjjmGNdgIAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505982619!115833075!1 X-Originating-IP: [192.55.52.93] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTkyLjU1LjUyLjkzID0+IDMyNDY2NQ==\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30671 invoked from network); 21 Sep 2017 08:30:21 -0000 Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by server-3.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 21 Sep 2017 08:30:21 -0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2017 01:30:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,424,1500966000"; d="scan'208"; a="1174424204" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.75]) by orsmga001.jf.intel.com with ESMTP; 21 Sep 2017 01:30:15 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Thu, 21 Sep 2017 16:11:23 +0800 Message-Id: <1505981483-3885-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 Cc: andrew.cooper3@citrix.com, Yi Sun , jbeulich@suse.com Subject: [Xen-devel] [PATCH v1] x86: fix bug caused by commit 0ade5e 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 only the psr features presented in cmdline cannot be correctly enumerated. 1. If there is only 'psr=', the 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 --- 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);