From patchwork Mon Sep 19 05:52:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 76507 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp794805qgf; Sun, 18 Sep 2016 22:56:25 -0700 (PDT) X-Received: by 10.36.34.204 with SMTP id o195mr9253733ito.29.1474264585575; Sun, 18 Sep 2016 22:56:25 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z4si23904503itg.10.2016.09.18.22.56.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Sep 2016 22:56:25 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@amdcloud.onmicrosoft.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blrWM-0004K1-J9; Mon, 19 Sep 2016 05:53:38 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blrWL-0004JN-Gl for xen-devel@lists.xen.org; Mon, 19 Sep 2016 05:53:37 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 03/5A-06971-06D7FD75; Mon, 19 Sep 2016 05:53:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA1WSX0hTcRTH+93du11lk+tUPC4NHEhiuBQSDR8 KBTHRkHoQQtKrXt1gf2R3xiSUC2bWFriIMIfESlNMIevBrvrkUElTyXrQsjkSRV2lLkwyDdrd nWa/p8Pv8z3ne87hkBLlNqEiGauFMRtpvVoajmvPJqekljd4S9IO9iOyuvyd+EWUPz6yjxWja 4TOWGGylhNa7+AuXmtPtHrmfBiHWk/aUDiJU7ckwHlWMBsKIxFVBpteFyEAJcVhwDk4mQCkVD b4Oj4H42gqAfpsHTJBJKFaEDj25pEAoqg8mPo+RAgxTiUBP90W/FdQhcCtuoIOQJ2CyYkHQU0 YVQRryzMBDRlwK4S1gTOiPBIm21dwIZZQAKPr6xIxVQ3tg5xU8AXqNgK+/2lQpKRS4MPYqFQU FcFE/1dMFPVI4Y7/i0wEeTA78SbUxDMpzI4oxVgPCw8XQ5ossD85QGKyG8H2DB+q9FMCP/o2C FEVD3fH7slE0EwAv+AMzVAGvztyxf8uObi7dkPZizJYfcth4pJUsMVPhhYWDwOPOnAHSnIeG9 x5bHAXwp6j0yxjvsGYUzM0FWZdjdZioHX61PS0DI2BYVm6htHTFaym0mR4hQKXcCLweLTTmut GcSSmjlHwlqUSZUSFqapeS7PaMnOdnmHdKJ4k1aAYuOktUUaamRrGWq3TB87pEAMpV0crRgWs YGtpA6urEdEUSlTFKlwCoASgrTMepR0e4nuUoIpSoEAjSnktYzboLP9zH4olkTpKUSxUkeuMl qPqvoAxFjDucy4Kxhb6H1JxqPD1CDMEL7eaM8+3dfK+mN6+8dLNuUTn7PD1qx7UaG+ZHyMb16 sJtjOTT+32fLrSvSLPnytqqCtZMDwedqbtefGZngT3H663fzp5fMNvaitoGvO/q7+Ayz+eC79 va7J/+3XZZSmt6r6UU5djW3phj9AQjoaCcsdyeeVOXLYaZ7V0eorEzNJ/AT2hfOuDAwAA X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1474264414!44585844!1 X-Originating-IP: [104.47.40.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42001 invoked from network); 19 Sep 2016 05:53:35 -0000 Received: from mail-co1nam03on0042.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) (104.47.40.42) by server-13.tower-206.messagelabs.com with AES256-SHA256 encrypted SMTP; 19 Sep 2016 05:53:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mjOZNsi2Cr1vSdiyddi+2jOQfSjACyJfR9qt5xpuhMU=; b=D33IdOx2cNPHdLP/qCKySx7QOLtSN2iKiBKJTIBicBAVVRiAAHF6itRDYyPk9ixtQb7t4YGMSAM5DRLNWdngeA4EzTQfaDjI3Hm5zGXx25pbEaGMPFudlLofYoVFcXShAAgrY6kUUYT1j3sOYnXFZHdCG+UdoY8AuygcahC+dRs= Received: from localhost.localdomain (114.109.128.54) by BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Mon, 19 Sep 2016 05:53:31 +0000 From: Suravee Suthikulpanit To: Date: Mon, 19 Sep 2016 00:52:46 -0500 Message-ID: <1474264368-4104-8-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474264368-4104-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1474264368-4104-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: HK2PR02CA0002.apcprd02.prod.outlook.com (10.163.104.140) To BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) X-MS-Office365-Filtering-Correlation-Id: a4a8930d-3659-490b-1d71-08d3e0514a59 X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 2:zqqgBUX9AO0KYAWjOabTlvqVl0b8LSRe9TERdrZ0MY9IsOIW5u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Yd+Fukmde+iNy1s+ZxJflr3ROk1ikU3yVACs0LPvrVzZtJO7BkgCVRkiB4C3t9cNbTnUGDBTHq0lFQd3NJDHAudCmVh4UTW4OEGGt7Z4MJMD0KpYDgk0pxt0ELzJedcl5qvIoEe2kRZQxE0HWukNqsyMT2meXnAaB6LkhswYnOETdLh/9i1LAVLMf/om2rTE8PMOSkZsSaoLYDZaK/83TrLZToEC+DNvBh49vkgtqfdZJaedBtF61epLisLURyxtOGGeCRM7Ecqlf1XofyPwAgtUDKFK+Dtt1CyERnpq+7mcMR4Tan+86FRrc5lhK7PuT7EfNrCtygCUv7xlv27ruKpbMJ/PvG5SMtfYJ7oT+hQq5fpLA9tcKwQ8EHIoJzasIGt/9lzYXKKJDU8zTI/YFEK3S1rGWjjTXLZjX2L/J2YuSDauygs84Xcm97t56scQ7VT/SGZpNmxYX8qTnmypIWlXw7Fx7LNVy X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BN6PR12MB1442; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 4:mJzosQl7Ups/gms9lFAn/ujKmdzwAAVef7mgnTQWTVoOj4uUpYUPpgR810Uf+urupjHIp0w2hXAk3vfouE2j1ALdl4DxJa14sq2YnNXUsvP4Ml+bbLDQplAYMmWAxqu3qoWBJ5xVCBI3LRabcZ7mOq1Xb8Gcyq2bK3fm8xg+F+/r8ZC9WtBNu/9ruD/GcfsX7SJGX03sjL9ekdlXVlekrHavxccaN8dpbBA0Ppl8WZhogTZfDtK1LOAOuL7065dsVMhhDNhPPa5USj2EIBoFwu9EwJEH1K1IBu/ofBRCQ6228XalBdd7MuEvSd6ncoZWzQCuK65LxJOWwC21EaIdDFIbLFhlL/l691S4Eovp6p0zXO7kdmrXhs1f0rU//AROlNWIyoFs+XwDlG3oNvHdO/x+T8X9OXpyfQDPpK6Qup/0Yuc0Wpou0SYJ9TnpG3yE X-Forefront-PRVS: 0070A8666B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(2351001)(229853001)(5660300001)(81156014)(81166006)(33646002)(8666005)(8676002)(19580405001)(7846002)(5003940100001)(7736002)(19580395003)(77096005)(305945005)(110136003)(2950100001)(92566002)(105586002)(106356001)(101416001)(2906002)(586003)(86362001)(4326007)(6116002)(3846002)(42186005)(66066001)(97736004)(47776003)(50986999)(36756003)(76176999)(48376002)(50466002)(189998001)(68736007)(50226002)(7059030)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1442; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1442; 23:BBPakQ7jRoAIRK+AmFfVn63tjmVWa1dKsVtkOypFY?= =?us-ascii?Q?xMvxVYw1+kZvY7Rd4j7iEV5KYZK++9NxiFShwAZRuA44Z0oQh4U4OrDj+1Cb?= =?us-ascii?Q?Xz2I2D7x+xUt1lGJPrkmFZtNChfyl4N6yaaobjMdF992zzAou7598scMEOQt?= =?us-ascii?Q?MDMZN1dyWR5P3Hrzd1Ph05ssgtgctlSNxeR7XmtAKX1WZ2uUwIBF+znDZoVT?= =?us-ascii?Q?Ow8SBZJXJVwvK/1LO5kWJ6BS8/hAuxowtEmZV6DzA8++i7s/pRs2J7bDZr1/?= =?us-ascii?Q?Lr2XMHcfctsfoFj1GC5zKFnA9IEPdEoz7cdsCO1QMRjO/604m5SUQ8seklMv?= =?us-ascii?Q?JHyDd6kgPoS5+OgCy5o8ilItv+Nm/nGtiS5AGTZGZwQFqf4e3Dyv6DZXKJot?= =?us-ascii?Q?en0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gWJFGIMicoZFtFgkU2MQhAaqQqujVyVakAfS+eag9qiOAAqqWDrSt9zTAfHbidsgNQ6ppv7FvkWNKZpUsQ33xVXJq0rAs/eHzug+gNG0EYEkDb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2016 05:53:31.1840 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1442 Cc: andrew.cooper3@citrix.com, Suravee Suthikulpanit , jbeulich@suse.com, sherry.hurwitz@amd.com Subject: [Xen-devel] [RFC PATCH 7/9] x86/SVM: Add vcpu scheduling support for AVIC 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Add hooks to manage AVIC data structure during vcpu scheduling. Signed-off-by: Suravee Suthikulpanit --- xen/arch/x86/hvm/svm/avic.c | 82 +++++++++++++++++++++++++++++++++++++++++++++ xen/arch/x86/hvm/svm/svm.c | 10 ++++++ 2 files changed, 92 insertions(+) diff --git a/xen/arch/x86/hvm/svm/avic.c b/xen/arch/x86/hvm/svm/avic.c index 90df181..cd8a9d4 100644 --- a/xen/arch/x86/hvm/svm/avic.c +++ b/xen/arch/x86/hvm/svm/avic.c @@ -45,6 +45,83 @@ avic_get_phy_ait_entry(struct vcpu *v, int index) } /*************************************************************** + * AVIC VCPU SCHEDULING + */ +static void avic_vcpu_load(struct vcpu *v) +{ + struct arch_svm_struct *s = &v->arch.hvm_svm; + int h_phy_apic_id; + struct svm_avic_phy_ait_entry entry; + + if ( !svm_avic || !s->avic_phy_id_cache ) + return; + + if ( test_bit(_VPF_blocked, &v->pause_flags) ) + return; + + /* Note: APIC ID = 0xff is used for broadcast. + * APIC ID > 0xff is reserved. + */ + h_phy_apic_id = cpu_data[v->processor].apicid; + if ( h_phy_apic_id >= AVIC_PHY_APIC_ID_MAX ) + return; + + entry = *(s->avic_phy_id_cache); + smp_rmb(); + entry.host_phy_apic_id = h_phy_apic_id; + entry.is_running = 1; + *(s->avic_phy_id_cache) = entry; + smp_wmb(); +} + +static void avic_vcpu_put(struct vcpu *v) +{ + struct arch_svm_struct *s = &v->arch.hvm_svm; + struct svm_avic_phy_ait_entry entry; + + if ( !svm_avic || !s->avic_phy_id_cache ) + return; + + entry = *(s->avic_phy_id_cache); + smp_rmb(); + entry.is_running = 0; + *(s->avic_phy_id_cache) = entry; + smp_wmb(); +} + +static void avic_vcpu_resume(struct vcpu *v) +{ + struct svm_avic_phy_ait_entry entry; + struct arch_svm_struct *s = &v->arch.hvm_svm; + + if ( !svm_avic_vcpu_enabled(v) || !s->avic_phy_id_cache ) + return; + + ASSERT(!test_bit(_VPF_blocked, &v->pause_flags)); + + entry = *(s->avic_phy_id_cache); + smp_rmb(); + entry.is_running = 1; + *(s->avic_phy_id_cache)= entry; + smp_wmb(); +} + +static void avic_vcpu_block(struct vcpu *v) +{ + struct svm_avic_phy_ait_entry entry; + struct arch_svm_struct *s = &v->arch.hvm_svm; + + if ( !svm_avic_vcpu_enabled(v) || !s->avic_phy_id_cache ) + return; + + entry = *(s->avic_phy_id_cache); + smp_rmb(); + entry.is_running = 0; + *(s->avic_phy_id_cache) = entry; + smp_wmb(); +} + +/*************************************************************** * AVIC APIs */ int svm_avic_dom_init(struct domain *d) @@ -97,6 +174,11 @@ int svm_avic_dom_init(struct domain *d) clear_domain_page(_mfn(mfn)); d->arch.hvm_domain.svm.avic_phy_ait_mfn = mfn; + d->arch.hvm_domain.pi_ops.pi_switch_to = avic_vcpu_put; + d->arch.hvm_domain.pi_ops.pi_switch_from = avic_vcpu_load; + d->arch.hvm_domain.pi_ops.vcpu_block = avic_vcpu_block; + d->arch.hvm_domain.pi_ops.pi_do_resume = avic_vcpu_resume; + return ret; err_out: svm_avic_dom_destroy(d); diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 409096a..aafbfa1 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1011,6 +1011,10 @@ static void svm_ctxt_switch_from(struct vcpu *v) svm_tsc_ratio_save(v); svm_sync_vmcb(v); + + if ( v->domain->arch.hvm_domain.pi_ops.pi_switch_from ) + v->domain->arch.hvm_domain.pi_ops.pi_switch_from(v); + svm_vmload(per_cpu(root_vmcb, cpu)); /* Resume use of ISTs now that the host TR is reinstated. */ @@ -1050,6 +1054,9 @@ static void svm_ctxt_switch_to(struct vcpu *v) svm_lwp_load(v); svm_tsc_ratio_load(v); + if ( v->domain->arch.hvm_domain.pi_ops.pi_switch_to ) + v->domain->arch.hvm_domain.pi_ops.pi_switch_to(v); + if ( cpu_has_rdtscp ) wrmsrl(MSR_TSC_AUX, hvm_msr_tsc_aux(v)); } @@ -1095,6 +1102,9 @@ static void noreturn svm_do_resume(struct vcpu *v) vmcb_set_vintr(vmcb, intr); } + if ( v->domain->arch.hvm_domain.pi_ops.pi_do_resume ) + v->domain->arch.hvm_domain.pi_ops.pi_do_resume(v); + hvm_do_resume(v); reset_stack_and_jump(svm_asm_do_resume);