From patchwork Wed Apr 12 01:19:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luwei Kang X-Patchwork-Id: 9676391 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 3A6B260382 for ; Wed, 12 Apr 2017 01:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29E372852E for ; Wed, 12 Apr 2017 01:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E9B728573; Wed, 12 Apr 2017 01:24:21 +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 D98EE2857B for ; Wed, 12 Apr 2017 01:24:19 +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 1cy6yb-00089P-Eg; Wed, 12 Apr 2017 01:21:41 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy6yZ-00089J-Vt for xen-devel@lists.xen.org; Wed, 12 Apr 2017 01:21:40 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 8F/62-01909-3218DE85; Wed, 12 Apr 2017 01:21:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsXS1tYhoqvU+Db C4P0iHYslHxezODB6HN39mymAMYo1My8pvyKBNePs4xVMBd0cFRM/vWJpYNzO1sXIxSEkMJ1R 4ljTCqYuRk4OCQFeiSPLZrBC2H4Sz2acYwGxhQSqJPZ/OwoWZxNQl9j6fiOYLSIgLXHt82VGE JtZIFyi6ekksLiwgK/E+7VtbCA2i4CqxK7rD9i7GDk4eAWcJabNkYQYLydx81wn8wRG7gWMDK sYNYpTi8pSi3SNLPSSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQK9W8/AwLiDsW+ V3yFGSQ4mJVHeywpvI4T4kvJTKjMSizPii0pzUosPMcpwcChJ8CY2AOUEi1LTUyvSMnOAYQaT luDgURLhnVMPlOYtLkjMLc5Mh0idYlSUEudlAekTAElklObBtcFC+xKjrJQwLyMDA4MQT0FqU W5mCar8K0ZxDkYlYV5RkCk8mXklcNNfAS1mAlp8ZtdLkMUliQgpqQbGyczHVhWdEdWuc2QJm+ Pw2O5pp/T6OVXfv6gxq2pL7ft0rLC4u+qhariD4BqN8htLt/RsStTTfLDm0YOjLY5X5p16nnO Sv7G5agl3gVzriXeX9i64+cDz/8HSWTZTZOZ82vo0OVp098/rG47uOdnKvUWbyYuXT9Ba+aYG 11e542685v53dqmnK7EUZyQaajEXFScCAMtPg6xoAgAA X-Env-Sender: luwei.kang@intel.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1491960096!72437052!1 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40842 invoked from network); 12 Apr 2017 01:21:38 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-2.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Apr 2017 01:21:38 -0000 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2017 18:21:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,187,1488873600"; d="scan'208";a="87647228" Received: from vmm-dell.bj.intel.com ([10.238.154.151]) by fmsmga005.fm.intel.com with ESMTP; 11 Apr 2017 18:21:34 -0700 From: Luwei Kang To: xen-devel@lists.xen.org Date: Wed, 12 Apr 2017 09:19:34 +0800 Message-Id: <1491959974-8761-1-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 Cc: wei.liu2@citrix.com, ian.jackson@eu.citrix.com, Luwei Kang Subject: [Xen-devel] [PATCH] tools:misc:xenpm: set max freq to all cpu with default cpuid 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 User can set max freq to specific cpu by "xenpm set-scaling-maxfreq " or set max freq to all cpu with default cpuid by "xenpm set-scaling-maxfreq ". Set max freq with defaule cpuid will cause segmentation fault after commit id d4906b5d05. This patch will fix this issue and add ability to set max freq with default cpuid. Signed-off-by: Luwei Kang Acked-by: Wei Liu --- tools/misc/xenpm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index ded40b9..abe31b5 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -99,8 +99,10 @@ static void parse_cpuid_and_int(int argc, char *argv[], exit(EINVAL); } - parse_cpuid(argv[0], cpuid); - if ( sscanf(argv[1], "%d", val) != 1 ) + if ( argc > 1 ) + parse_cpuid(argv[0], cpuid); + + if ( argc == 0 || sscanf(argv[argc > 1], "%d", val) != 1 ) { fprintf(stderr, "Invalid %s '%s'\n", what, argv[1]); exit(EINVAL);