From patchwork Wed Aug 16 22:45:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 9904703 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 D314B60244 for ; Wed, 16 Aug 2017 22:48:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6436288A0 for ; Wed, 16 Aug 2017 22:48:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4CA128A80; Wed, 16 Aug 2017 22:48:37 +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, UNPARSEABLE_RELAY 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 38E46288A0 for ; Wed, 16 Aug 2017 22:48:27 +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 1di74B-0005s3-46; Wed, 16 Aug 2017 22:45:35 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1di74A-0005rx-7o for xen-devel@lists.xen.org; Wed, 16 Aug 2017 22:45:34 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 87/CB-27137-D0BC4995; Wed, 16 Aug 2017 22:45:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRWlGSWpSXmKPExsXSO6nOVZfn9JR IgysLzC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyVR0+xF+zkrui7odHAuJuzi5GLQ0hgIpPE xg8/WCGc34wSD86cZIZwNjJK/Py4lwnC2cYosXvTGSCHk0NYwEti1ubfzCC2iECURPOZ6WC2k ICnxJWDy1hAbGaBJIl9vfvB6tkEjCTOHp3OCGLzCthKXP49C6yGRUBVYubmiWwgtqhAuMTbxi MsEDWCEidnPgGzOYF2/V30nx1ipp7Ejuu/WCFseYntb+eA7ZUQMJT4vHEp8wRGwVlI2mchaZm FpGUBI/MqRo3i1KKy1CJdIwu9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzA0GUA gh2M59cGHmKU5GBSEuX9PWtKpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJXo1TQDnBotT01Iq0z BxgFMGkJTh4lER4xUHSvMUFibnFmekQqVOMuhwbVq//wiTEkpeflyolznv6JFCRAEhRRmke3A hYRF9ilJUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMK8MyCqezLwSuE2vgI5gAjriSvskkCNKEhF SUg2Mme/K0/kuflBcZqfbyvJSY13Pgee72NmkNK+J+03YEb5kxy3nL0s/aT3Rk+b5ev+b3MHN 50yN+PvO5vDzCF/S6S//s0dnZeC5i7c23Mw3KPPvYDojpTCnWltCnWtrnMjmO7yNkXJLwh7L5 Eor2IYqu7P3T9v12SLoZQyzTt+XK/NumYbG1UopsRRnJBpqMRcVJwIA9jLp8uMCAAA= X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1502923531!106650531!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9132 invoked from network); 16 Aug 2017 22:45:32 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-5.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 16 Aug 2017 22:45:32 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v7GMjMWr005685 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Aug 2017 22:45:23 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v7GMjMDx008415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Aug 2017 22:45:22 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v7GMjKt9003958; Wed, 16 Aug 2017 22:45:21 GMT Received: from dhcp-burlington7-2nd-B-east-10-152-55-162.usdhcp.oraclecorp.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 16 Aug 2017 15:45:20 -0700 To: Andrew Cooper , Xen-devel References: <1502907799-24072-1-git-send-email-andrew.cooper3@citrix.com> From: Boris Ostrovsky Message-ID: <1f55fca3-9938-441f-de52-2d99bacaf1cc@oracle.com> Date: Wed, 16 Aug 2017 18:45:17 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1502907799-24072-1-git-send-email-andrew.cooper3@citrix.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Suravee Suthikulpanit , Jan Beulich Subject: Re: [Xen-devel] [PATCH] x86/svm: Use physical addresses for HSA and Host VMCB 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" X-Virus-Scanned: ClamAV using ClamSMTP On 08/16/2017 02:23 PM, Andrew Cooper wrote: > They are only referenced by physical address (either the HSA MSR, or via > VMSAVE/VMLOAD which take a physical operand). Allocating xenheap hages and > storing their virtual address is wasteful. > > Allocate them with domheap pages instead, taking the opportunity to suitably > NUMA-position them. This avoids Xen needing to perform a virt to phys > translation on every context switch. > > Signed-off-by: Andrew Cooper Reviewed-by: Boris Ostrovsky > --- > CC: Jan Beulich > CC: Boris Ostrovsky > CC: Suravee Suthikulpanit > > TODO at some other point: Figure out why svm_cpu_up_prepare() is reliably > called twice for every CPU. That's because it is called by BSP via PREPARE_CPU notifier and then by the ASP during svm_cpu_up(). I think should take care of this. I only had a quick look at intel and seems they may have the same problem. -boris diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 0dc9442..3e7b9fc 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1538,7 +1538,7 @@ static int _svm_cpu_up(bool bsp) return -EINVAL; } - if ( (rc = svm_cpu_up_prepare(cpu)) != 0 ) + if ( bsp && (rc = svm_cpu_up_prepare(cpu)) != 0 ) return rc; write_efer(read_efer() | EFER_SVME);