From patchwork Sat Aug 5 01:26:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9882843 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 1B2896031B for ; Sat, 5 Aug 2017 01:44:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DD0F28A15 for ; Sat, 5 Aug 2017 01:44:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0280528A1B; Sat, 5 Aug 2017 01:44:46 +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 7F2A628A15 for ; Sat, 5 Aug 2017 01:44:46 +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 1ddo6d-0008Qg-A9; Sat, 05 Aug 2017 01:42:19 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ddo6b-0008Qa-Rr for xen-devel@lists.xenproject.org; Sat, 05 Aug 2017 01:42:17 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id 73/4A-02962-97225895; Sat, 05 Aug 2017 01:42:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsXS1taRoluh1Bp p8OWnqsX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmnG25QN7wQ22ilkrjzA1MG5l7WLk4BASqJDo mhTWxcjJISHAK3Fk2QxWCNtfYuuh3SxdjFxAJQ2MEheaPjGBJNgE1CUef+0Bs0UElCTurZoMZ jMLFEnsPPaJEWSmsICPxIvpuiBhFgFViT1TXoOV8Ap4SDQ/nswGMV9O4uSxyWC7OAU8JVp+7m QEsYWAas6332ScwMi7gJFhFaN6cWpRWWqRrrFeUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrF ecn7uJkZgIDAAwQ7Gjn9OhxglOZiURHmrjzVFCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgXavQ GikkWJSanlqRlpkDDEmYtAQHj5IIbxxImre4IDG3ODMdInWK0Zij6cOWL0wcryb8/8YkxJKXn 5cqJc67BaRUAKQ0ozQPbhAsVi4xykoJ8zICnSbEU5BalJtZgir/ilGcg1FJmFdHEWgKT2ZeCd y+V0CnMAGd8qeuEeSUkkSElFQDI8/5zYmlU9bJPs7ne1F2ScbKkeuzgfK+UOFJbcWLfrrO5/w yozQnfcfrzfx5E1L4Im7++eAvda/3T6+TUIfEfYF9M38d1Ch4eiPIOs3H6cX9n/tWnRIz2Tvv x5n36v6CAafnhnh3/l4rrmyl9vdogWul+lv3//Ub0rs4n/86XrktdfXkFTvS9iuxFGckGmoxF xUnAgDH7qqJkAIAAA== X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1501897334!62627117!1 X-Originating-IP: [134.134.136.100] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63676 invoked from network); 5 Aug 2017 01:42:16 -0000 Received: from mga07.intel.com (HELO mga07.intel.com) (134.134.136.100) by server-2.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Aug 2017 01:42:16 -0000 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP; 04 Aug 2017 18:42:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,322,1498546800"; d="scan'208";a="115831600" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by orsmga004.jf.intel.com with ESMTP; 04 Aug 2017 18:42:12 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Sat, 5 Aug 2017 09:26:38 +0800 Message-Id: <1501896398-69885-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501838977-63404-2-git-send-email-yi.y.sun@linux.intel.com> References: <1501838977-63404-2-git-send-email-yi.y.sun@linux.intel.com> Cc: andrew.cooper3@citrix.com, boris.ostrovsky@oracle.com, Yi Sun , jbeulich@suse.com Subject: [Xen-devel] [PATCH] 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, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 7d9fa26..9ce8f17 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -1294,11 +1294,11 @@ static void psr_free_cos(struct domain *d) { unsigned int socket, cos; - ASSERT(socket_info); - if ( !d->arch.psr_cos_ids ) return; + ASSERT(socket_info); + /* Domain is destroyed so its cos_ref should be decreased. */ for ( socket = 0; socket < nr_sockets; socket++ ) {