From patchwork Fri Aug 4 09:29:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9880921 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 B26D76031B for ; Fri, 4 Aug 2017 09:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A42CC28854 for ; Fri, 4 Aug 2017 09:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 992B628985; Fri, 4 Aug 2017 09:47:36 +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 F0DE62896F for ; Fri, 4 Aug 2017 09:47:34 +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 1ddZAP-0001Ks-86; Fri, 04 Aug 2017 09:45:13 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddZAO-0001Kb-0X for xen-devel@lists.xenproject.org; Fri, 04 Aug 2017 09:45:12 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 82/D2-01862-72244895; Fri, 04 Aug 2017 09:45:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgkeJIrShJLcpLzFFi42I5YG5Soavm1BJ psOaAvsX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmtE/6QxzwU62is7bE9kaGFewdjFycQgJTGOU 2HbnO1sXIyeHhACvxJFlM4ASHEC2v0T3Hx+ImgZGiSOffjKB1LAJqEs8/toDZosIKEncWzUZz GYW6GCUmPK7HsQWFoiRuNF7lQXEZhFQlfi4s4UVxOYV8JD4vnUqC8QuOYmTxyaDxTkFPCVOv1 rLDGILAdWc6VnFNoGRdwEjwypGjeLUorLUIl0jE72kosz0jJLcxMwcXUMDY73c1OLixPTUnMS kYr3k/NxNjMBwqGdgYNzB+Oq43yFGSQ4mJVHe6mNNkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQk eH84tEQKCRalpqdWpGXmAAMTJi3BwaMkwmvpCJTmLS5IzC3OTIdInWI05mj6sOULE8erCf+/M Qmx5OXnpUqJ804CmSQAUppRmgc3CBYxlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ814Amc KTmVcCt+8V0ClMQKf8qWsEOaUkESEl1cCoXO5gF1Usr9wYG/wh4MVvX6tIKd71iSv9peQvJc6 2/fS7eVPHyddla77cP67eryR7xzBZqZCT3Wfq8w7/2LTEK0wCMuJPe+/7np+s6Gz/xiIz4cU7 saILU5RKpCflti//+Fss9/rHpvQQi/OVu288rIw5Hvj3Up7HAtW6VcmOqWle2qrR/EosxRmJh lrMRcWJALLYfgGTAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1501839907!91779077!2 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28304 invoked from network); 4 Aug 2017 09:45:10 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-12.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Aug 2017 09:45:10 -0000 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Aug 2017 02:45:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,320,1498546800"; d="scan'208";a="133516984" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by orsmga005.jf.intel.com with ESMTP; 04 Aug 2017 02:45:06 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Fri, 4 Aug 2017 17:29:37 +0800 Message-Id: <1501838977-63404-2-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501838977-63404-1-git-send-email-yi.y.sun@linux.intel.com> References: <1501838977-63404-1-git-send-email-yi.y.sun@linux.intel.com> Cc: Yi Sun , andrew.cooper3@citrix.com, boris.ostrovsky@oracle.com, wei.liu2@citrix.com, jbeulich@suse.com Subject: [Xen-devel] [Patch for staging 2/2] x86: remove an ASSERT to avoid crash when destroy a domain. 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 In 'psr_free_cos', we should not use 'ASSERT(socket_info)' because the 'socket_info' is allocated only if 'psr' boot parameter is set. So remove it and use 'psr_alloc_feat_enabled' to check if 'socket_info' is valid or not to avoid crash. Signed-off-by: Yi Sun --- xen/arch/x86/psr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 7d9fa26..13c0daa 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -1294,9 +1294,7 @@ static void psr_free_cos(struct domain *d) { unsigned int socket, cos; - ASSERT(socket_info); - - if ( !d->arch.psr_cos_ids ) + if ( !d->arch.psr_cos_ids || !psr_alloc_feat_enabled() ) return; /* Domain is destroyed so its cos_ref should be decreased. */