From nobody Sun May 5 14:02:02 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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; dkim=fail; spf=none (zoho.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=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1559343798; cv=none; d=zoho.com; s=zohoarc; b=CruQwLAmExfCFW41TDZzihMP/5BqhP0vtyzKHaAeqaSid5OADoBRKZ1XiVIx+LDIE9ErUqFF60EEz4SGtlxMkCKkwxYCyeDduUfSWRwiV2Uopsv364MX7cjTYNUeCzeH1LgD/VsOKjO+jBRniPKhkXtmJMy6xyzAkKycWUNcyUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559343798; 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:ARC-Authentication-Results; bh=y0oHWLT9T5hBuf7N06lWEye6kFP7eMZ20LhoRpAu7sA=; b=P/YoeddFdhb1t3COjo1c/Lcz/x58QhB+AOQRvMrOqORxiSsbGHq3xmJBrxPiPFAuAy2URCNDgN1YC62h9b8+LeLJr+p0CpeA5njXiafr5NXngAqaOSKStRmE3J5UFtnFMVULxBSyzRxYbje+jwpJ/6v7d/KkybyVbghhJbwm8jA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.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 1559343798946574.5285951367803; Fri, 31 May 2019 16:03:18 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWqWE-0000fu-Vf; Fri, 31 May 2019 23:01:02 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWqWE-0000fp-AL for xen-devel@lists.xenproject.org; Fri, 31 May 2019 23:01:02 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id f4caad0e-83f7-11e9-8980-bc764e045a96; Fri, 31 May 2019 23:01:00 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0953B26FD4; Fri, 31 May 2019 23:00:58 +0000 (UTC) X-Inumbo-ID: f4caad0e-83f7-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559343659; bh=ux1rlcx1ZzlpWW4DxZtrV8RJCSi6w5Whb9yaji2y/p8=; h=From:To:Cc:Subject:Date:From; b=JDwcUs72QQ0oZNc4BGzmBXBcKRGrTC8ZqsVOGux3TYGfg/qUX6y8SrCeEbyilvr1R FBzArYsEyJRpdjpfEtzbSVKdW5FdHLZP0H6uwWS/1wiMuGrfZfNod10g6QnCg86tm2 Dti6VgquQLeNXUjay9WleiZAEYxLV2vP3IPzO9f8= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Fri, 31 May 2019 16:00:56 -0700 Message-Id: <20190531230056.14506-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH] xen: debug_registers_trap, perf_counters_trap, and "static_partitioning" 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: Stefano Stabellini , sstabellini@kernel.org, Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Dario Faggioli 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" X-ZohoMail-DKIM: fail (Header signature does not verify) Introduce two global parameters to disable debug registers trapping and perf counters trapping. They are only safe to use in static partitiong scenarios where sched=3Dnull is used -- vcpu cannot be migrated from one pcpu to the next. Introduce a new simple umbrella command line option "static_partitioning" that enables vwfi=3Dnative, sched=3Dnull, and also sets debug_registers_trap and perf_counters_trap to false. Signed-off-by: Stefano Stabellini CC: Julien Grall CC: Andrew Cooper CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Tim Deegan CC: Wei Liu CC: George Dunlap CC: Dario Faggioli --- This is not ideal. The best course of action would be to implement proper context switching of all the necessary debug and perf counters registers. This is an imperfect shortcut, which could reasonably be left out of the upstream tree but I shared it with others for their convenience. --- xen/arch/arm/traps.c | 26 +++++++++++++++++++++++++- xen/common/schedule.c | 2 +- xen/include/xen/sched.h | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 5c18e918b0..d6eaffde23 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -118,6 +118,28 @@ static int __init parse_vwfi(const char *s) } custom_param("vwfi", parse_vwfi); =20 +static bool debug_registers_trap =3D true; +static bool perf_counters_trap =3D true; + +static int __init opt_static_partitioning(const char *s) +{ + if ( strcmp(s, "true") &&=20 + strcmp(s, "True") && + strcmp(s, "1") ) + return 0; + + vwfi =3D NATIVE; + debug_registers_trap =3D false; + perf_counters_trap =3D false; + memcpy(opt_sched, "null", 5); + + /* Disable Trap Debug and Performance Monitor now for CPU0 */ + WRITE_SYSREG(HDCR_TDRA, MDCR_EL2); + + return 0; +} +custom_param("static_partitioning", opt_static_partitioning); + register_t get_default_hcr_flags(void) { return (HCR_PTW|HCR_BSU_INNER|HCR_AMO|HCR_IMO|HCR_FMO|HCR_VM| @@ -165,7 +187,9 @@ void init_traps(void) WRITE_SYSREG((vaddr_t)hyp_traps_vector, VBAR_EL2); =20 /* Trap Debug and Performance Monitor accesses */ - WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR, + WRITE_SYSREG(HDCR_TDRA | + (debug_registers_trap ? HDCR_TDOSA|HDCR_TDA : 0) | + (perf_counters_trap ? HDCR_TPM|HDCR_TPMCR : 0), MDCR_EL2); =20 /* Trap CP15 c15 used for implementation defined registers */ diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 049f93f7aa..51eb3d770b 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -39,7 +39,7 @@ #include =20 /* opt_sched: scheduler - default to configured value */ -static char __initdata opt_sched[10] =3D CONFIG_SCHED_DEFAULT; +char __initdata opt_sched[10] =3D CONFIG_SCHED_DEFAULT; string_param("sched", opt_sched); =20 /* if sched_smt_power_savings is set, diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index b73ccbdf3a..c40a1b5dbc 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -906,6 +906,7 @@ static inline bool is_vcpu_online(const struct vcpu *v) } =20 extern bool sched_smt_power_savings; +extern char opt_sched[10]; =20 extern enum cpufreq_controller { FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel