From patchwork Mon Aug 7 01:50:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 9884267 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 28BFF60364 for ; Mon, 7 Aug 2017 02:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11A7A28619 for ; Mon, 7 Aug 2017 02:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03B922861B; Mon, 7 Aug 2017 02:09:24 +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 88B9328619 for ; Mon, 7 Aug 2017 02:09:23 +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 1deXRH-0007vL-35; Mon, 07 Aug 2017 02:06:39 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deXRF-0007vF-QN for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 02:06:37 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id E8/CB-02962-D2BC7895; Mon, 07 Aug 2017 02:06:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeJIrShJLcpLzFFi42I5YG5SrKtzuj3 SYN1DeYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPiv39sBUvZKnbN+8zUwNjJ2sXIxSEkMI1R YtrWu4xdjJwcEgK8EkeWzWCFsP0lnv1oYYQoamCU+LblBhtIgk1AXeLx1x4mEFtEQEni3qrJY DazQJHEzmOfwAYJC6RKdB9dAGazCKhK9G7cD1bDK+Au8e3/ZTaIBXISJ49NBlvGKeAp0fJzJ1 i9kICHxPn2m4wTGHkXMDKsYtQoTi0qSy3SNTTTSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCr WS87P3cQIDAgGINjBeH9jwCFGSQ4mJVHe+BVtkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeF+d bI8UEixKTU+tSMvMAYYmTFqCg0dJhPcfSJq3uCAxtzgzHSJ1itGYo+nDli9MHK8m/P/GJMSSl 5+XKiXO+wOkVACkNKM0D24QLGYuMcpKCfMyAp0mxFOQWpSbWYIq/4pRnINRSZjXEGQKT2ZeCd y+V0CnMAGd8iaxFeSUkkSElFQDI8eErU+U49iYy9iUNhx7Kvtsvkmu5p09y4NipSU7ctwEC7/ 8CmmYq18oWuB36nMj4wZXm0ojh+xe6wPnW9+xf5m45c8dxurj595OOvLp/zOWCr6dBycEb5fW mFLMzm3MvlP89oaPbxbvPfqzeGuGZkVkpKyU16S70edi+z/wnOyfwHnrsc6cZ0osxRmJhlrMR cWJAEQdBbuUAgAA X-Env-Sender: yi.y.sun@linux.intel.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1502071594!70508413!1 X-Originating-IP: [192.55.52.115] 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 50277 invoked from network); 7 Aug 2017 02:06:36 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-4.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Aug 2017 02:06:36 -0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2017 19:06:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,335,1498546800"; d="scan'208";a="120587155" Received: from vmmmba-s2600wft.bj.intel.com ([10.240.193.80]) by orsmga002.jf.intel.com with ESMTP; 06 Aug 2017 19:06:32 -0700 From: Yi Sun To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 09:50:49 +0800 Message-Id: <1502070649-3746-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 for staging 2/2] x86: adjust place of 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)' at the beginning because the 'socket_info' is allocated only if 'psr' boot parameter is set. So adjust its place to avoid crash. Signed-off-by: Yi Sun Reviewed-by: Jan Beulich --- 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++ ) {