From nobody Thu Mar 28 20:13:37 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1575022049; cv=none; d=zohomail.com; s=zohoarc; b=EIuFuYCqpGchlmiVgHefNFxOx/YX/aFFQrsPslN6dzQEDiIQvy3Mb9B+auQT5MBSS4RIpP31yLij6T0L7p7s45SPkwrzfc2WXs2MXiXh8RIAlqaqKr1JmmwAkYq971XixPUJIbEw/xJ4irFM4SPN035yrcHwlW3NI0XPX2omT7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575022049; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/eeribKqV3RC5tF9AaJp+KKIwCl/Y2g8EdJNLqI+Zqk=; b=WYB3Xk4R5tQBQz1QrVAdokWnPPMwdxjxhHE6IoucNq8WCDe9WZppHnvAwu3vYmJzcVZK4Q0/E3Fs7iqNEpk7WUVZycrdTsB9SgqKW5+7Hwq7c/D+9C/CmuUOPe2/FzE52ktGzc5/GRdDvZxznDESSazKD5fh+cTnFtXACTZvyEY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157502204966722.34871542972337; Fri, 29 Nov 2019 02:07:29 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iadAT-0007Qt-R7; Fri, 29 Nov 2019 10:06:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iadAS-0007Qo-Bi for xen-devel@lists.xenproject.org; Fri, 29 Nov 2019 10:06:28 +0000 Received: from mga07.intel.com (unknown [134.134.136.100]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e6865dcb-128f-11ea-a3e0-12813bfff9fa; Fri, 29 Nov 2019 10:06:26 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Nov 2019 02:06:24 -0800 Received: from yisun1-ubuntu2.bj.intel.com ([10.238.144.114]) by fmsmga001.fm.intel.com with ESMTP; 29 Nov 2019 02:06:23 -0800 X-Inumbo-ID: e6865dcb-128f-11ea-a3e0-12813bfff9fa X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,257,1571727600"; d="scan'208";a="217759365" From: Yi Sun To: xen-devel@lists.xenproject.org Date: Fri, 29 Nov 2019 18:01:38 +0800 Message-Id: <1575021698-10589-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Xen-devel] [PATCH v3] psr: fix bug which may cause crash X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: andrew.cooper3@citrix.com, Yi Sun , jbeulich@suse.com MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" During test, we found a crash on Xen with below trace. (XEN) Xen call trace: (XEN) [] R psr.c#l3_cdp_write_msr+0x1e/0x22 (XEN) [] F psr.c#do_write_psr_msrs+0x6d/0x109 (XEN) [] F smp_call_function_interrupt+0x5a/0xac (XEN) [] F call_function_interrupt+0x20/0x34 (XEN) [] F do_IRQ+0x175/0x6ae (XEN) [] F common_interrupt+0x10a/0x120 (XEN) [] F cpu_idle.c#acpi_idle_do_entry+0x9d/0xb1 (XEN) [] F cpu_idle.c#acpi_processor_idle+0x41d/0x626 (XEN) [] F domain.c#idle_loop+0xa5/0xa7 (XEN) (XEN) (XEN) **************************************** (XEN) Panic on CPU 20: (XEN) GENERAL PROTECTION FAULT (XEN) [error_code=3D0000] (XEN) **************************************** The bug happens when CDP and MBA co-exist and MBA COS_MAX is bigger than CDP COS_MAX. E.g. MBA has 8 COS registers but CDP only have 6. When setting MBA throttling value for the 7th guest, the value array would be: +------------------+------------------+--------------+ | Data default val | Code default val | MBA throttle | +------------------+------------------+--------------+ Then, COS id 7 will be selected for writting the values. We should avoid writting CDP data/code valules to COS id 7 MSR because it exceeds the CDP COS_MAX. Signed-off-by: Yi Sun --- xen/arch/x86/psr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 5866a26..943a1e0 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -1271,7 +1271,13 @@ static void do_write_psr_msrs(void *data) =20 for ( j =3D 0; j < cos_num; j++, index++ ) { - if ( feat->cos_reg_val[cos * cos_num + j] !=3D info->val[index= ] ) + /* + * Multiple RDT features may co-exist and their COS_MAX may be + * different. So we should prevent one feature to write COS + * register which exceeds its COS_MAX. Otherwise, panic may ha= ppen. + */ + if ( cos <=3D feat->cos_max && + feat->cos_reg_val[cos * cos_num + j] !=3D info->val[index= ] ) { feat->cos_reg_val[cos * cos_num + j] =3D info->val[index]; props->write_msr(cos, info->val[index], props->type[j]); --=20 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel