From patchwork Tue Mar 22 12:56:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8642091 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6C4B8C0553 for ; Tue, 22 Mar 2016 12:58:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A8DC20396 for ; Tue, 22 Mar 2016 12:58:51 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id C69DA202AE for ; Tue, 22 Mar 2016 12:58:50 +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 1aiLrJ-000523-AK; Tue, 22 Mar 2016 12:56:29 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aiLrI-00051s-CE for xen-devel@lists.xenproject.org; Tue, 22 Mar 2016 12:56:28 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id ED/B5-03597-BF041F65; Tue, 22 Mar 2016 12:56:27 +0000 X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1458651385!16303993!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19893 invoked from network); 22 Mar 2016 12:56:26 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-16.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Mar 2016 12:56:26 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Tue, 22 Mar 2016 06:56:24 -0600 Message-Id: <56F14F0702000078000DF2B4@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Tue, 22 Mar 2016 06:56:23 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Cc: Andrew Cooper , Keir Fraser Subject: [Xen-devel] [PATCH] x86/domctl: don't waste domain CPUID slot for all zero data 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP domain_cpuid() returns all zeroes anyway when not finding a match, so there's no need to explicitly store such a set of values. Signed-off-by: Jan Beulich x86/domctl: don't waste domain CPUID slot for all zero data domain_cpuid() returns all zeroes anyway when not finding a match, so there's no need to explicitly store such a set of values. Signed-off-by: Jan Beulich --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -714,7 +714,7 @@ long arch_do_domctl( case XEN_DOMCTL_set_cpuid: { - xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; + const xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; cpuid_input_t *cpuid, *unused = NULL; if ( d == currd ) /* no domain_pause() */ @@ -742,7 +742,12 @@ long arch_do_domctl( domain_pause(d); - if ( i < MAX_CPUID_INPUT ) + if ( !(ctl->eax | ctl->ebx | ctl->ecx | ctl->edx) ) + { + if ( i < MAX_CPUID_INPUT ) + cpuid->input[0] = XEN_CPUID_INPUT_UNUSED; + } + else if ( i < MAX_CPUID_INPUT ) *cpuid = *ctl; else if ( unused ) *unused = *ctl; Reviewed-by: Andrew Cooper --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -714,7 +714,7 @@ long arch_do_domctl( case XEN_DOMCTL_set_cpuid: { - xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; + const xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; cpuid_input_t *cpuid, *unused = NULL; if ( d == currd ) /* no domain_pause() */ @@ -742,7 +742,12 @@ long arch_do_domctl( domain_pause(d); - if ( i < MAX_CPUID_INPUT ) + if ( !(ctl->eax | ctl->ebx | ctl->ecx | ctl->edx) ) + { + if ( i < MAX_CPUID_INPUT ) + cpuid->input[0] = XEN_CPUID_INPUT_UNUSED; + } + else if ( i < MAX_CPUID_INPUT ) *cpuid = *ctl; else if ( unused ) *unused = *ctl;