From patchwork Thu Apr 13 10:44:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luwei Kang X-Patchwork-Id: 9679159 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 C3877601C3 for ; Thu, 13 Apr 2017 10:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFEF528625 for ; Thu, 13 Apr 2017 10:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A192328658; Thu, 13 Apr 2017 10:50:04 +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 3B6D928625 for ; Thu, 13 Apr 2017 10:50:03 +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 1cycGh-0003lY-UV; Thu, 13 Apr 2017 10:46:27 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cycGg-0003lS-9F for xen-devel@lists.xen.org; Thu, 13 Apr 2017 10:46:26 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id 94/E2-03648-1075FE85; Thu, 13 Apr 2017 10:46:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVywNykWJcx/H2 EwfofPBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8ae3WwFRzgq3l/dzNbAeJ+ti5GLQ0hgOqPE 4bVbgRxODgkBXokjy2awQtj+EvfWvWIHsYUEqiRefX4AFmcTUJfY+n4jmC0iIC1x7fNlRpBBz AKtjBI7bvewgCSEBQIk3l15wQxiswioSiyYeo6pi5GDg1fAReLuCm+I+XISN891Mk9g5F7AyL CKUaM4tagstUjX0FIvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyPQuwxAsIPxx7K AQ4ySHExKoryvQ99HCPEl5adUZiQWZ8QXleakFh9ilOHgUJLgrQHJCRalpqdWpGXmAMMMJi3B waMkwnstBCjNW1yQmFucmQ6ROsWoKCXOKxgGlBAASWSU5sG1wUL7EqOslDAvI9AhQjwFqUW5m SWo8q8YxTkYlYR5p4Bs58nMK4Gb/gpoMRPQ4rV734IsLklESEk1MHpMmMQxe5189+wc9Smvmu /+VE36Jex57IRasoZbnOENWybvqS5qKg+W2djYb1Cr35L5bObBn22RV+58vSJd5Wzx94bo+xn v1tT8cvxaL/ZE+9t9d8uM5mvSzbbfEreKxucJ5Pbcssu87T5N9Z1A6fc/qWZzNXSkK1d1bpRY 2/6jp9Si+9j9R0osxRmJhlrMRcWJAEwuwmJoAgAA X-Env-Sender: luwei.kang@intel.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1492080382!92574352!1 X-Originating-IP: [192.55.52.115] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8914 invoked from network); 13 Apr 2017 10:46:24 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-7.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 13 Apr 2017 10:46:24 -0000 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2017 03:46:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,194,1488873600"; d="scan'208";a="248187135" Received: from vmm-dell.bj.intel.com ([10.238.154.151]) by fmsmga004.fm.intel.com with ESMTP; 13 Apr 2017 03:46:20 -0700 From: Luwei Kang To: xen-devel@lists.xen.org Date: Thu, 13 Apr 2017 18:44:28 +0800 Message-Id: <1492080268-18123-1-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 Cc: wei.liu2@citrix.com, julien.grall@arm.com, ian.jackson@eu.citrix.com, Luwei Kang , roger.pau@citrix.com Subject: [Xen-devel] [PATCH V2] 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 [cpuid] " or set max freq to all cpu with default cpuid by "xenpm set-scaling-maxfreq ". Set max freq with default 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index ded40b9..762311e 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -99,10 +99,12 @@ 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 ( sscanf(argv[argc > 1], "%d", val) != 1 ) { - fprintf(stderr, "Invalid %s '%s'\n", what, argv[1]); + fprintf(stderr, "Invalid %s '%s'\n", what, argv[argc > 1]); exit(EINVAL); } }